Semantic Memory
Maintain a dedicated store of durable facts the agent holds to be true — separate from event records (episodic) and learned skills (procedural) — so facts are retrievable, updatable, and substrate-agnostic.
Intent & Description
🎯 Intent
Maintain a dedicated store of what the agent holds to be true about the user and the world — separate from event records (episodic) and learned how-to (procedural).
📋 Context
An agent operating across many sessions accumulates durable knowledge: user identity, preferences, domain definitions, settled conclusions. This knowledge needs to survive sessions, be retrievable when relevant, and stay separate from the raw event history that produced it. The team wants the fact layer to be queryable independently of any specific storage technology.
💡 Solution
The CoALA framework (Sumers et al. 2023) names semantic memory as one of three long-term memory types (alongside episodic and procedural), defined by function rather than storage. Implementations vary: LangMem’s semantic channel uses profile (single JSON doc) or collection (many docs) stores; knowledge graph implementations (cognee, Zep) store assertions as typed triples; vector stores back it when retrieval is by similarity over fact text. The function is always the same: extract durable assertions from interactions, store with entity/attribute keys and provenance, retrieve when the situation calls for “what does the agent know about X?”
Real-world Use Case
- The agent needs to remember durable facts (user preferences, domain truths, settled conclusions) across sessions.
- Retrieval by “what does the agent know about X?” must be cheap and substrate-agnostic.
- Facts must be updatable and invalidatable independently of the events that produced them.
Source
📌 TL;DR
Store durable facts in a dedicated semantic layer, separate from events and skills — retrieve by entity/attribute, update and invalidate independently, swap storage substrates without changing the agent’s interface.
Advantages
- Stable facts survive across sessions without re-derivation from raw episodes.
- Retrieval is assertion-shaped, not event-shaped — “what is the user’s timezone?” returns the fact, not the conversation where it was mentioned.
- Substrate decisions can change (vector → graph, profile → collection) without changing the agent’s contract with memory.
Disadvantages
- Extraction errors are sticky — a wrong fact poisons every later turn until explicitly invalidated.
- Conflict resolution policy (what happens when two contradictory facts are extracted?) is its own design problem.
- Provenance and update governance add real implementation cost beyond just choosing a storage substrate.