Why it matters
A single vector store labelled memory hides a design problem: a past event, a stable fact and a learned procedure need different write rules, lifetimes and retrieval. Splitting by type lets you say that facts can be corrected, events are immutable, and procedures are versioned with the code. That separation is what makes deletion, audit and debugging tractable.
Mental model
Memory types are a diary, an address book and a recipe box: different containers because the contents age differently. The metaphor breaks because real memory does not sort so cleanly; one sentence can be an event, a fact and a hint about procedure, so a record may need to be filed once and read for several purposes.
How it works
Keyed transitions
- Classify → Semantic: subject ∧ value ∧ source ∧ window
- Episodic → Route: recent
- Route → In prompt: intent matched
- Semantic → Two current: edit in place
Event · step 1 of 9
Turn ends
Entry: a working context holding six turns. Nothing is durable yet; the candidates are still sentences inside the context, and the store has six current facts and twelve episodes.
In state
- Turn
Next: Classify by question
- Episodes
- 12
- Current facts
- 1
- Superseded
- 0
Figure. Nine states. Classify sends a record down exactly one lane, and each lane has its own write guard and lifetime: events append, facts supersede, procedures carry a version. Route reads across lanes by intent. The two red states are the failures the page warns about: an event returned as a fact, and a fact edited in place so two values are current.
What to notice. The event count, the 210-token injection and the 180-day validity window are illustrative. Working context is the start state, not a fourth store. Procedure drift is drawn as the version guard on the procedure lane rather than as a state, and deletion is one rule per lane with a shared exit, which the prose covers and the figure omits to keep the board readable.
Text version
A state machine with nine states. Turn is the start, a pill. Turn goes to Classify, a hexagonal decision, on a candidate record. Classify sends an event to Episodic, a checkpoint; a fact to Semantic, a decision; and a procedure to Procedural, a checkpoint. Episodic goes to Route on recent, Semantic goes to Route on current, and Procedural goes to Route on how-to. Route goes to In prompt, a terminal pill, on intent matched, and to Type confused, a red failure box, on no type filter. Semantic goes to Two current, a red failure box, on edit in place. In prompt has a repeat edge back to Turn labelled next turn. The trace walks Turn, Classify, Episodic, Semantic, Procedural, Route, In prompt, then Type confused, then Two current. Counters show episodic rows rising from 12 to 13, current facts at 1 until the last step shows 2, and superseded rising from 0 to 1 then back to 0.
- Define the types the product needs and the question each answers at read time.
- For episodic records, store the step or turn id, timestamp and actor, and never rewrite history.
- For semantic facts, store a subject, a value, a source and a validity window, and supersede rather than edit.
- For procedural knowledge, keep prompts, code or versioned playbooks rather than free-text memory.
- Route retrieval by intent: recent events for continuity, facts for constraints, procedures for how-to.
- Apply one deletion policy per type, with events expiring sooner than stable facts.
Trade-offs
| Choice | Good for | Cost | Fails when |
|---|---|---|---|
| Single vector store | One integration, simple retrieval | Mixed relevance and retention rules | Types have different lifetimes or privacy needs |
| Typed stores | Correct retrieval and deletion per type | More plumbing and schema work | The product is small and continuity is minimal |
| Append-only events | Auditable and safe to replay | Growth and noise over time | Queries need the current value only |
| Mutable fact store | Compact and current | Loses history and provenance | A decision must be explained later |
Good for
One integration, simple retrieval
Cost
Mixed relevance and retention rules
Fails when
Types have different lifetimes or privacy needs
- Types have different lifetimes or privacy needs
- The product is small and continuity is minimal
- Queries need the current value only
- A decision must be explained later
Figure. Each choice with what it buys, what it costs, and the case where it loses.
What to notice. The fourth column is the decision: if the losing case describes your situation, the choice is wrong.
Text version
Four trade-offs: Single vector store is good for One integration, simple retrieval, costs Mixed relevance and retention rules, and fails when Types have different lifetimes or privacy needs. Typed stores is good for Correct retrieval and deletion per type, costs More plumbing and schema work, and fails when The product is small and continuity is minimal. Append-only events is good for Auditable and safe to replay, costs Growth and noise over time, and fails when Queries need the current value only. Mutable fact store is good for Compact and current, costs Loses history and provenance, and fails when A decision must be explained later
Failure modes
- Type confusion. A one-off event is retrieved as a stable preference and the agent overfits. Debug: sample retrieved records and check each carries a type and a validity rule.
- Immutable fact. A corrected fact cannot replace the old one and answers alternate. Debug: query by subject and assert exactly one current record.
- Procedure in free text. A learned procedure drifts from the code that actually runs. Debug: diff stored procedures against the deployed prompt or playbook version.
In production
Monitor records per type, retrieval share per type and deletion lag. Cap episodic growth per user and test that deleting a user removes every type.
Common misconceptions
People think: Long-term memory is one database.
Actually: It is at least three lifetimes and write rules; one table can hold them but one policy cannot.
People think: More memory types make the agent smarter.
Actually: Each type adds a retrieval decision and a failure mode; add one when a question cannot be answered today.
Interview angle
Strong answers name the types, the question each answers, and the different write and delete rules, then explain how retrieval routes by intent. Weak answers say memory is a vector store of past conversations and never distinguish an event from a fact.
Sources
- Sumers et al., Cognitive Architectures for Language Agents — working, episodic, semantic and procedural memory in one framework.
- Packer et al., MemGPT: Towards LLMs as Operating Systems — separating context from archival and recall storage.
- Park et al., Generative Agents: Interactive Simulacra of Human Behavior — episodic memory stream with reflection into higher-level facts.