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.

Quick answers

What are the three types of AI agent memory?

Semantic memory holds facts, episodic memory holds events, and procedural memory holds how to do things. All three are forms of long-term memory.

Which type of memory should I build first?

Semantic memory. A short list of facts per user or project gives the biggest improvement for the least work.

Where does procedural memory live?

Usually in instructions: a rules file or a section of the system prompt that the agent, or a person, updates over time.

Read next

Pack the doko. Ask it anything.

Nine memories, one question, no account. See which facts an agent would carry into its next answer.