Memory system with intelligent skip detection, hybrid retrieval, and background consolidation.
""" title: Memory System description: A semantic memory management system for Open WebUI that consolidates, deduplicates, and retrieves personalized user memories using LLM operations. version: 1.2.0 authors: https://github.com/mtayfur license: Apache-2.0 required_open_webui_version: 0.6.37 """ import asyncio import hashlib import json
A long-term memory system that learns from conversations and personalizes responses without requiring external APIs or tokens.
🔒 Privacy & Data Sharing:
💰 Cost & Model Requirements:
gpt-5-nano, gemini-2.5-flash-lite, qwen3-instruct, or your local LLMsZero External Dependencies
Uses Open WebUI's built-in models (LLM and embeddings) — no API keys, no external services.
Intelligent Memory Consolidation
Automatically processes conversations in the background to create, update, or delete memories. The LLM analyzes context and decides when to store personal facts, enriching existing memories rather than creating duplicates.
Hybrid Memory Retrieval
Starts with fast semantic search, then switches to LLM-powered reranking only when needed. The system triggers LLM reranking automatically when candidate count exceeds 50% of max retrieval limit, optimizing for both speed and accuracy.
Smart Skip Detection
Avoids wasting resources on irrelevant messages through two-stage detection:
Categories automatically skipped: technical discussions, formatting requests, calculations, translation tasks, proofreading, and non-personal queries.
Multi-Layer Caching
Three specialized caches (embeddings, retrieval, memory) with LRU eviction keep responses fast while managing memory efficiently. Each user gets isolated cache storage.
Real-Time Status Updates
Emits progress messages during operations: memory retrieval progress, consolidation status, operation summaries — keeping users informed without overwhelming them.
Multilingual by Design
All prompts and logic work language-agnostically. Stores memories in English but processes any input language seamlessly.
LLM Support
Tested with gemini-2.5-flash-lite, gpt-5-nano, and qwen3-instruct. Should work with any model that supports structured outputs.
Embedding Model Support
Uses OpenWebUI's configured embedding model (supports Ollama, OpenAI, Azure OpenAI, and local sentence-transformers). Configure embedding models through OpenWebUI's RAG settings. The memory system automatically uses whatever embedding backend you've configured in OpenWebUI.
During Chat (Inlet)
After Response (Outlet)
Customize behavior through valves:
The system maintains high-quality memories through:
We use optional analytics to improve our websites, and advertising cookies on this site. Privacy Policy.