This is an early release preview. You may encounter bugs.
LightMem logo
Unclaimed

Tool memory

LightMem

Agent memory has a hidden bill: the tokens and calls spent building and updating it, often more than answering the quest

C 63/100 GitHub score ? This grade is derived from GitHub signals, not user votes. Open for the full breakdown.
Discussion

01 / Summary

About LightMem.

LightMem is a Python memory layer for language model agents that targets the cost of building and maintaining memory, not only of answering from it. Conversation turns are compressed and split into topic segments before a model extracts memory entries, which are stored and later retrieved to answer questions about earlier sessions.

The pipeline is modular. A pre-compressor (LLMLingua-2 or entropy-based) shortens incoming messages, a topic segmenter groups them, a memory manager model extracts entries, and an embedder plus retriever (Qdrant, FAISS, or BM25) serves them back. Updates can run offline in a batch after a session instead of on every write, which reduces the model calls spent during memory construction. Each stage is selected through a configuration object.

The memory manager runs on cloud APIs such as OpenAI and DeepSeek or on local models through Ollama, vLLM, or Transformers. An MCP server exposes the memory operations as tools, and tutorial notebooks cover a travel-planning agent, a code assistant, and LongMemEval evaluation.

The repository also hosts related memory methods from the same group: StructMem (hierarchical event-level memory), FluxMem (memory as an evolving heterogeneous graph), and EM²Mem (event-centric multimodal memory for long video). A baseline evaluation toolkit benchmarks memory layers such as Mem0, A-MEM, LangMem, and MemoryOS on LoCoMo and LongMemEval, reporting accuracy, token use, model calls, and runtime.

  • Pre-compression: LLMLingua-2 or entropy-based compression shortens messages before memory extraction
  • Topic segmentation: incoming turns are grouped by topic so extraction works on coherent chunks
  • Offline update: memory entries are consolidated in a batch pass after a session, with a similarity threshold, instead of on every write
  • Pluggable retrieval: Qdrant, FAISS, or BM25 retrievers with Hugging Face text and multimodal embedders
  • Model backends: OpenAI, DeepSeek, Ollama, vLLM, and Transformers for the memory manager
  • MCP server: add, retrieve, and other memory operations exposed as MCP tools
  • Memory API: add memory, run offline updates, generate summaries, and retrieve by question
  • Benchmark toolkit: reproduction scripts and baselines for LoCoMo and LongMemEval, covering Mem0, A-MEM, LangMem, and MemoryOS
  • Method family: StructMem, FluxMem, and EM²Mem memory methods documented alongside LightMem

02 / Discussion CREDIBILITY-GATED

Discussion

Reading is open to everyone. Posting and voting need a verified identity or a GitHub grade of B or higher.

  • No discussions yet.

04 / Build

Build with LightMem.

Browse the catalog for frameworks, tools, and harnesses, each scored on real GitHub credibility.

Get LightMem →

Browse the catalog