Guide · Context engineering

AI agent memory types: what an agent keeps, where, and for how long.

A language model forgets everything between calls. Memory is what the software around it writes down, and chooses to show it again.

Researchers borrowed four names from cognitive science to describe agent memory — working, episodic, semantic and procedural — and the CoALA framework gave them precise meanings for language agents. This guide defines each type, shows how memory moves during one decision cycle, compares the ways to keep a long conversation small, and lists what to govern before an agent remembers anything about your business.

Updated · 7 sources

A language agentone decision cycle at a time, reading from and writing to its memories
Working memorywhat is in front of the model now: the context of this cycle
Episodic memoryrecords of earlier cycles, conversations and runs
Semantic memoryfacts about the world, the business and the agent itself
Procedural memoryhow to act: the model’s weights, its code, its instructions

What are the AI agent memory types?

The four AI agent memory types are working memory — the information in the model’s context for the current step; episodic memory — records of past interactions and runs; semantic memory — stored facts about the world and the business; and procedural memory — how to act, held in the model’s weights, the agent’s code and its instructions. The definitions come from the CoALA framework for language agents (2023).

Definitions

The four AI agent memory types, defined with examples.

Only working memory reaches the model directly. The other three are long-term stores: something has to retrieve from them into working memory before the model can use them, and something has to write to them for the agent to learn.

01short-term

Working memory

Active information for the current decision cycle. In practice: the context window — instructions, the latest messages, tool results, retrieved facts.

  • Lives in the prompt of each call
  • Rebuilt every turn
  • Bounded by the context window
02long-term

Episodic memory

Experience from earlier cycles: what was asked, what the agent did, how it went. Used to recall a past case or avoid a past mistake.

  • Conversation logs, run traces
  • Summaries of past sessions
  • “Last time this supplier…”
03long-term

Semantic memory

Knowledge about the world and about the agent itself — facts that stay true across conversations.

  • Documents, policies, records
  • Facts about a user or account
  • Searched by keyword or meaning
04long-term

Procedural memory

How to do things. CoALA splits it in two: implicit, in the model’s weights; explicit, in the agent’s code, instructions and skills.

  • System instructions, skills
  • Tool code and workflows
  • Changed by people, carefully

Why the names matter. They tell you what to store and how to retrieve it. A user’s preferred currency is semantic; the refund the agent issued yesterday is episodic; the refund procedure is procedural. Mixing them in one undifferentiated “memory” is how agents end up obeying a remark someone made once.

How memory moves

How memory moves in and out of the context in one decision cycle.

CoALA describes three internal actions on memory — retrieval, reasoning and learning — and external actions on the world. Every agent loop is some arrangement of them.

One decision cycle (after CoALA)
  1. RetrieveRead from episodic, semantic or procedural memory into working memory.
  2. ReasonThe model works on what is in working memory and proposes actions.
  3. SelectCandidate actions are evaluated and one is chosen.
  4. ActA tool call, a reply, a change in another system.
  5. LearnWrite something worth keeping to long-term memory.

The observation from the action becomes working memory for the next cycle.

The research that shaped agent memory

  • Generative Agents (Apr 2023)Keep a complete record of experience in natural language, synthesise it into higher-level reflections, retrieve it to plan.
  • CoALA (Sep 2023)The four memory types and the retrieve-reason-learn action space, as one framework for language agents.
  • MemGPT (Oct 2023)Treat the context like an operating system’s fast memory, paging information between it and slower stores.
  • Anthropic (Sep 2025)Compaction, structured note-taking and just-in-time retrieval as the working techniques for long-horizon agents.
Keeping working memory small

Summaries, compaction and notes: keeping working memory small.

A long conversation outgrows any context window, and long inputs lose recall before they overflow. Each strategy below trades exact recall for room — the further right, the more is kept as distilled fact rather than as words.

Every word keptOnly distilled facts kept
12345
  1. Full transcriptExact, until the window fills — then the request fails or the oldest turns vanish.
  2. Sliding windowThe latest turns only. Cheap; the agent forgets the start of the conversation.
  3. Window plus rolling summaryLatest turns word for word, one summary of everything older.
  4. CompactionNear the limit, summarise the whole context and continue in a fresh window.
  5. Structured notesThe agent writes a to-do list or notes file outside the window and reads it back.
drift

Summarise once, not recursively

A summary of a summary loses detail and can end up stating things nobody said. Fold new turns into one fresh summary instead.

cheap win

Clear tool results first

Old tool output is often the largest, least useful block — Anthropic calls clearing it one of the safest, lightest forms of compaction.

notes

Keep what must survive

Pair compaction with a memory store: compaction keeps the window small, memory keeps the facts that must outlive it.

Reading memory back

Retrieval: how an agent reads the right memory back.

Memory is only useful if the right piece reaches working memory at the right moment — and nothing it should not see comes with it.

  1. Write with context

    Store each memory with who, when, which conversation and which source.

    metadata
  2. Index

    Make it findable by keyword, by meaning, or by a plain path or key.

    search
  3. Fetch on demand

    Keep a name or reference in context; load the body only when the step needs it.

    just-in-time
  4. Filter by person

    Return only what the person asking may see.

    permissions
  5. Place and cite

    Put the memory near the question and say where it came from.

    traceable

Which memory should hold this?

What was said in this chatWorking memory: the latest turns word for word, older turns as a rolling summary stored with the conversation.
A fact that stays trueSemantic memory: a document, a record or a profile field, searched when relevant.
What happened last timeEpisodic memory: run records and session summaries, searched by case, customer or date.
How to do the taskProcedural memory: instructions and skills, changed by a person and versioned, never by a stray remark.
Before an agent remembers

What to govern before an AI agent remembers anything.

Memory turns one conversation’s content into another conversation’s input. That is useful — and it is also how private data leaks across users and how one planted instruction persists for weeks.

A memory policy worth writing down
  • Scoped to a person or projectA memory written in one person’s conversation is read back only where that person’s access allows.
  • Treated as dataRecalled text is quoted material, never fresh instructions — a remembered “ignore your rules” stays inert.
  • No secrets storedStrip sensitive values before writing; Anthropic’s memory tool guidance says to add that validation yourself.
  • Paths and keys validatedFile-based memory needs path-traversal checks so a crafted path cannot reach outside the store.
  • ExpiryDelete memories nobody has read in a long time; stale facts are worse than none.
  • Visible and erasablePeople can see what an agent kept about them, and an administrator can remove it.
On Botminds

How Botminds handles AI agent memory in conversations.

Botminds keeps two kinds of conversation memory and never summarises a summary — so a long conversation stays inside its budget without drifting from what was said.

Conversation memorylatest messages word for word, one rolling summary of the rest
Folded, never re-summarisedolder turns fold into a fresh summary that replaces the last one
Strategy per agentautomatic, keep-the-latest, or summarise-and-compact
Summary modelthe agent’s own model, or a lighter one picked for summaries
Stored with the conversationsurvives restarts; any replica takes the next turn
Compact on requesta person types /compact to fold the conversation at once
Names first, bodies on demandskills, tool servers and tables listed in a line; fetched when chosen

Memory is one provider in a context built from budgeted tiers, with every block visible in a preview. Read context engineering on Botminds, and see an agent’s parts in the anatomy of an agent.

Questions people ask

AI agent memory types: common questions.

The technology behind itContext engineeringExactly what the model sees, each turn
What are the main AI agent memory types?

The four AI agent memory types are working memory (the current context), episodic memory (past interactions and runs), semantic memory (facts about the world and the business) and procedural memory (how to act — weights, code and instructions). The CoALA framework set out these definitions for language agents in 2023.

What is the difference between short-term and long-term memory in AI agents?

Short-term memory is working memory: what is in the model’s context on this call, rebuilt every turn. Long-term memory is everything stored outside the model — episodic, semantic and procedural — which reaches the model only when it is retrieved into the context.

What is episodic memory in an AI agent?

Episodic memory stores experience from earlier decision cycles: past conversations, actions and outcomes. An agent uses it to recall how a similar case went, or to continue work from a previous session.

What is semantic memory in AI?

Semantic memory holds knowledge that stays true across conversations — documents, policies, records and facts about a user or the agent itself. It is usually searched by keyword or by meaning and placed into the context when relevant.

What is procedural memory for AI agents?

Procedural memory is knowledge of how to act. CoALA describes two forms: implicit, in the language model’s weights, and explicit, in the agent’s code — which in practice includes its instructions, skills and tool implementations.

Do LLMs have memory?

A language model keeps nothing between calls; each request starts from what is sent to it. Memory is built by the application around the model, which stores conversations and facts and puts the relevant parts back into the context.

How do AI agents remember long conversations?

By keeping the latest messages word for word and replacing older ones with a summary, by compacting the whole context near its limit, or by writing notes outside the window and reading them back. Most agents combine two of these.

Is RAG a form of agent memory?

Retrieval-augmented generation is a way to read from semantic memory: it searches a store and places the results in working memory. Agent memory also covers writing new memories and keeping episodic records, which RAG alone does not.

See it on
your own work.

Bring one process and its documents. We’ll show you the agents, the controls and the record, running on your data.