LightMem is a memory management framework for large language model applications and agents. It stores conversation turns as long-term memory, retrieves the parts relevant to a new question, and updates what it has stored, so an assistant can carry facts between sessions instead of re-reading a whole transcript.
The pipeline is split into pluggable components selected by configuration: optional pre-compression of incoming messages, topic segmentation of long conversations, metadata and summary generation, indexing, retrieval, and update. Indexing and retrieval each run in embedding, context, or hybrid mode, and an extraction threshold controls how much of a conversation is kept as memory. Updates run in offline mode, where changes are batched; the online setting is a placeholder that does not persist memory.
Backends are chosen per module. Pre-compression uses llmlingua-2 or an entropy-based compressor, the memory manager calls OpenAI, DeepSeek, Ollama, or vLLM models, embeddings come from Hugging Face models, and retrieval runs on Qdrant, FAISS, or BM25. A Model Context Protocol (MCP) server exposes the same operations over HTTP for MCP clients.
The repository also hosts three related memory methods with their own documentation: FluxMem models memory as a heterogeneous graph, EM²Mem is an event-centric multimodal memory for long-video question answering, and StructMem is a hierarchical memory that preserves event-level bindings and cross-event connections.
Reproduction scripts cover the LoCoMo and LongMemEval benchmarks, and a separate baseline evaluation framework runs memory layers such as Mem0, A-MEM, and LangMem over the same datasets. Tutorial notebooks walk through a travel-planning agent, a code agent, and a LongMemEval run.
Features
- Pluggable pipeline: pre-compression, topic segmentation, metadata generation, indexing, retrieval, and update are separate configurable components
- Pre-compression: incoming messages can be compressed with llmlingua-2 or an entropy compressor before storage to cut storage and indexing cost
- Topic segmentation: long conversations are split into topic segments that are indexed and stored independently
- Retrieval strategies: embedding, context, or hybrid retrieval, with a matching choice of indexing strategy
- Vector and keyword stores: Qdrant, FAISS, and BM25 back the retrievers, with a separate collection available for summaries
- Model backends: the memory manager runs against OpenAI, DeepSeek, Ollama, or vLLM endpoints
- Offline update: an update queue is built and applied in batch against a score threshold
- MCP server: the memory operations are callable from MCP clients over HTTP
- Benchmark scripts: ready-to-run reproductions for LoCoMo and LongMemEval, plus a baseline framework for other memory layers
- Related methods: FluxMem, EM²Mem, and StructMem ship alongside LightMem in the same repository
