Memory Types Overview
Agents need memory for coherence and personalization. By time span and purpose, memory can be categorized as follows.
Short-term Memory (Working Memory)
- Scope: Current session or recent turns
- Implementation: Usually a
messageslist in memory, fed directly as LLM context - Characteristics: Limited by context window; lost when the session ends
- Optimization: Sliding window, summary compression—compress earlier turns into summaries before concatenation
Long-term Memory
- Scope: Across sessions and users (if multi-tenant)
- Implementation: Persisted to databases, vector stores, graph databases
- Content: User preferences, important facts, past decisions, relationship graphs
- Retrieval: By semantics or metadata, injected into context when needed
Episodic vs. Semantic Memory
- Episodic: Concrete events (e.g., "user asked about X last week") with time, subject, etc.
- Semantic: Abstract knowledge (e.g., "user prefers concise replies") that generalizes to new situations
Mem0 Overview
Mem0 is an open-source Agent memory framework that provides:
- Auto-extraction: Identify storable memories (facts, preferences, commitments) from dialogue
- Storage and indexing: Multiple backends including vector and graph stores
- Retrieval: Retrieve relevant memories for the current query and inject into the prompt
- Update and forgetting: Support for correction, merge, and time- or importance-based forgetting
Vector Stores in Memory
Vector stores suit "semantic retrieval" style memory:
Rerankers can further improve recall quality.
Design Recommendations
- Keep short-term memory bounded to avoid exceeding the context window
- Define clear write policies for long-term memory to avoid noise buildup
- Let users view and delete memories for privacy and control
- Make update and forgetting policies configurable for different use cases
Summary
From short-term dialogue context to long-term persisted memory, Agent memory systems determine coherence and personalization. Mem0 and vector stores offer ready-made solutions for long-term memory; designing write, retrieval, and forgetting strategies well enables sustainable learning in Agent systems.