Guide · 4 min read
Episodic, semantic and procedural memory for agents
The three types of long-term memory in AI agents, with examples of each, how they are stored and recalled, and which one to build first for your product.
Psychologists divide human long-term memory into kinds. The same division is useful for agents, because each kind is written, stored and recalled differently.
Semantic memory: what is true
Facts that hold regardless of when they were learned.
- “Maya is vegetarian.”
- “The API uses cursor pagination.”
Stored as short statements, one fact each. Recalled by similarity to the question. Maintained by replacing a fact when a newer one contradicts it.
This is what most people mean by “agent memory”, and it is the right place to start.
Episodic memory: what happened
Events with a time and an order.
- “On 3 June the deploy failed because a migration was missing.”
- “Last session we stopped at chapter four.”
Stored as dated entries, often a summary per session. Recalled by similarity plus time: “last time”, “in March”, “the most recent”. Maintained by condensing: old episodes are merged into shorter summaries, and lasting facts found in them are promoted to semantic memory.
Episodes let an agent pick up where it left off and learn from what went wrong before.
Procedural memory: how to do it
Rules and habits.
- “Run the tests before every commit.”
- “Answer this user in bullet points.”
Stored as instructions, often in a file or prompt section that is always loaded. Recalled by being present; it is not searched for on each turn. Maintained by editing: when the user corrects the agent twice in the same way, the correction becomes a rule.
Side by side
| Semantic | Episodic | Procedural | |
|---|---|---|---|
| Answers | What is true? | What happened? | How should I act? |
| Shape | Fact | Dated event | Rule |
| Recall | By meaning | By meaning and time | Always loaded |
| Grows | Slowly | Every session | Rarely |
How they feed each other
Episodes are the raw material. Seen often enough, an episode becomes a fact (“always asks for the aisle seat” becomes “prefers aisle seats”) or a rule (“was corrected on date format three times” becomes “use DD/MM/YYYY”). A mature memory system has a regular pass that does this promotion and then lets the old episodes fade.