# Types of AI memory: working, episodic, semantic, procedural

> The four memory types borrowed from cognitive science and how each maps to engineering: what it stores, how it is written and read, and how it fails.

- Published: 2026-03-06; last updated 2026-11-14
- Author: the WeStack AI team
- Subject: AI agents
- Address: https://westack.ai/blog/types-of-ai-memory

> AI systems borrow four memory types from cognitive science. Working memory is the context window: what the model can see now. Episodic memory records what happened, semantic memory holds facts about the user and the world, and procedural memory holds how to do things. The labels matter less than the fact that each type is stored, written and read differently, and each fails in its own way.

## Where do the four types come from?

Psychologists have long separated kinds of human memory. Endel Tulving drew the line between episodic memory (events you lived through) and semantic memory (general knowledge) in 1972. Baddeley and Hitch described working memory in 1974 as the small, active store used for the task in hand. Procedural memory, the kind behind riding a bicycle, covers skills that are performed without being recalled as facts.

In 2023 the authors of [Cognitive Architectures for Language Agents](https://arxiv.org/abs/2309.02427), a paper usually shortened to CoALA, applied that vocabulary to software. They describe an agent as a model with a working memory and three long-term memories: episodic, semantic and procedural.

The framing stuck. LangChain's [memory documentation](https://docs.langchain.com/oss/python/concepts/memory) uses the same three long-term categories and cites the paper. Amazon's AgentCore Memory service ships [built-in strategies](https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/built-in-strategies.html) named semantic, user preference, summary and episodic. The words have moved from papers into configuration screens, so it helps to know what they mean.

One caution before the detail. This is an analogy and a filing system. It says nothing about how a model works inside. Its use is practical: the four types need different storage, different write paths and different safeguards. If you want the plainer split into short-term and long-term first, start with [AI agent memory explained](https://westack.ai/blog/ai-agent-memory-explained).

### The four types at a glance

| Type | What it stores | Written by | Read by | Usual storage | Failure mode |
|---|---|---|---|---|---|
| Working | What the model sees on this call | Code that assembles the context | The model, directly | The context window | Overfilled, so details are missed |
| Episodic | What happened: conversations, runs, outcomes | Logging, or a record after each run | Search over past cases | Log store, database, vector index | A similar but wrong case is recalled |
| Semantic | Facts about users, the business, the world | Extraction, user input, document ingestion | Profile loaded each turn, or search | Database rows, knowledge base, graph | Stale or wrongly inferred facts |
| Procedural | How to act: instructions, tools, playbooks | Developers, sometimes the agent | Loaded as instructions | Prompt files, code, skill folders | Rules pile up, or a bad rule persists |

We use one example throughout: a purchasing assistant at a manufacturer with a few hundred suppliers. Buyers ask it to raise purchase orders, chase deliveries and compare quotes.

## Working memory: the context window

**What it stores.** Everything the model can see on the current call: instructions, tool definitions, the buyer's request, quotes fetched from the ERP, and whatever the other three memories contributed. CoALA treats it as the hub through which the model, the long-term stores and the outside world connect.

**How it is written and read.** Your code writes it, fresh, on every call. The model reads all of it, every time. Nothing in it survives unless something copies it elsewhere.

**Example.** A buyer asks for 2,000 brackets by the 20th. The window holds that request, the ordering playbook, the supplier's record and the last two delivery reports.

**Failure mode.** Overfilling. Add every quote, every past order and the full supplier list, and the model starts to miss the one line that mattered. Curation is the whole job, and we cover it in [context engineering](https://westack.ai/blog/context-engineering).

## Episodic memory: what happened

**What it stores.** Specific events with their time and circumstances: past conversations, the steps an agent took on a task, and how it turned out.

**How it is written.** Most systems already have the raw material, because they log conversations and tool calls. The useful form is usually a short record written after each run: what was asked, what was done, what the result was. Raw transcripts are long and expensive to search.

**How it is read.** By search, when a new situation looks like an old one. A retrieved episode can serve as a worked example: here is a similar order and how it was handled. The [Generative Agents](https://arxiv.org/abs/2304.03442) paper from 2023 is the well-known demonstration. Its agents kept a complete record of their experiences in natural language and condensed it over time into higher-level reflections.

**Example.** In March an order from one supplier arrived nine days late, and the buyer split the next order between two suppliers. When a similar order comes up in June, the assistant retrieves that episode and suggests the same split.

**Failure mode.** Retrieval by similarity brings back cases that look alike and are not. An episode in which the agent made a mistake can be replayed as if it were a model answer, so episodes need an outcome field, and bad ones should be marked. The store grows without limit unless you prune it. And raw episodes contain everything users said, which is a privacy problem we take up in [AI memory and privacy](https://westack.ai/blog/ai-memory-privacy-and-forgetting).

## Semantic memory: facts about the user and the world

**What it stores.** Facts with the event stripped away. This buyer wants quotes in euros. This supplier has a 21-day lead time and a minimum order of 500 units. Orders above £10,000 need the purchasing manager's approval. It covers three things that are often built separately: a user profile, the organisation's knowledge base, and structured knowledge such as a graph of suppliers, parts and contracts.

**How it is written.** Knowledge bases are ingested from documents, which is ordinary [RAG](https://westack.ai/blog/retrieval-augmented-generation-guide). Profile facts are entered by users or extracted from conversations by a model. LangChain's documentation describes the two common shapes: a single profile document that is updated in place, and a collection of small separate memories that grows over time. A profile is easy to read and gets error-prone to update as it grows. A collection is easier to add to and harder to search and reconcile.

**How it is read.** A short profile is loaded on every call. Larger stores are searched, and graphs are traversed for questions about relationships, which is where [knowledge graphs and vector search](https://westack.ai/services/data) come in.

**Example.** Episodic: 'on 3 March the delivery was nine days late'. Semantic: 'this supplier is often late'. The second is derived from several of the first. Amazon's service calls this step reflection, meaning insights generated across episodes.

**Failure mode.** Facts go stale, and nothing in the store says so. Two facts contradict each other after a change. Worst, a single remark is promoted to a standing fact: one rush order becomes 'this buyer always wants express delivery'. Every semantic memory should carry its source and a date, and inferred facts should be marked as inferred.

## Procedural memory: how to do things

**What it stores.** How to act. CoALA identifies two forms: knowledge implicit in the model's weights, and knowledge explicit in the agent's code. For builders, the explicit part is the system prompt, the tool definitions, the workflow code and any playbooks or skills the agent can load.

**How it is written.** Mostly by developers, through the normal process of changing a prompt or shipping code. Some systems let the agent add to it. The [Voyager](https://arxiv.org/abs/2305.16291) research agent built a growing library of skills as executable code and reused them on later tasks. Coding assistants do a mild version of this. Claude Code's [memory documentation](https://code.claude.com/docs/en/memory) describes instruction files that you write and an auto memory of notes that the assistant writes for itself from your corrections.

**How it is read.** Core instructions are loaded on every call. Longer procedures are better loaded on demand: the agent sees a one-line description of each playbook and opens the full text only when the task matches.

**Example.** A playbook: orders above £10,000 need two quotes and the purchasing manager's approval, and are raised in the ERP, never by email. A learned addition: when a quote arrives as a scanned PDF, run the OCR tool before trying to read it.

**Failure mode.** Instructions pile up until they contradict each other. And a bad entry is worse here than anywhere else, because it changes behaviour on every later run. The CoALA authors make the same point: writing to procedural memory is much riskier than writing to the other two. An instruction planted by an attacker would persist in the same way, which is why we treat agent-written rules as changes that need review, as set out in [guardrails for AI agents](https://westack.ai/blog/ai-agent-guardrails-prompt-injection).

## How do the four work together?

Follow one request through the purchasing assistant: 'Order 2,000 brackets from our usual supplier, delivered by the 20th.'

1. Procedural memory supplies the ordering playbook, because the request matches its description.
2. Semantic memory resolves 'our usual supplier', and adds the 21-day lead time and the buyer's approval limit.
3. Episodic memory returns the two most recent orders from that supplier, both late.
4. Working memory now holds all of that with the request. The model sees that the 20th is 16 days away, inside the lead time, with a record of late deliveries. It proposes a split order and asks the buyer to confirm.
5. After the run, a new episode is written. If the buyer says the supplier has moved to a 28-day lead time, the semantic fact is updated, with today's date and the buyer as the source.

None of the steps is exotic. The value is in keeping the stores separate, so that a late delivery is recorded as an event, a lead time as a fact and an approval rule as an instruction, each with the handling it needs.

## Which types do you need?

Every agent has working memory and procedural memory already. The question is whether they are managed or left to grow.

Add semantic memory next, and start small: a profile of a few explicit fields. It gives most of the benefit users notice.

Add episodic memory when past cases would help with new ones, and prefer short structured records to raw transcripts. For many support and operations agents, the ticket system already is the episodic memory, and a search tool over it is enough.

Leave agent-written procedural memory until last, and put it behind review.

The taxonomy has blurry edges. 'Always reply in German' is a fact about the user and also an instruction. Sort such cases by how the entry will be used. If it is loaded as a rule on every call, treat it as procedural, with the review that implies. If it is retrieved as a fact when relevant, treat it as semantic.

## How to start

In the first week, list what your assistant already has under each of the four headings and where each lives. Most teams find procedural memory spread across several prompt files and a wiki page, and semantic memory mixed into chat history.

Then pick the one type whose absence causes a failure you have seen in real transcripts, and design its write path before its storage: who or what creates an entry, from what evidence, and how a wrong one gets corrected. The steps for doing that are in [how to build long-term memory for an AI assistant](https://westack.ai/blog/long-term-memory-for-ai-assistants). If you would like help working out which of these an agent of yours needs, it is part of the [AI agent](https://westack.ai/services/ai-agents) work we do at WeStack AI.

## Frequently asked questions

### What are the four types of memory in AI agents?

Working memory is the context window, which holds what the model can see on the current call. Episodic memory records what happened in past conversations and runs. Semantic memory holds facts about the user, the organisation and the world. Procedural memory holds how to do things: instructions, tool definitions, playbooks and saved skills.

### What is the difference between episodic and semantic memory in an AI system?

Episodic memory is a record of specific events with a time attached: on 3 March the delivery from a supplier arrived nine days late. Semantic memory is a general fact with the event stripped away: this supplier is often late. Systems usually derive semantic facts from episodes, and that step is where wrong generalisations get in.

### What is procedural memory in an AI agent?

Procedural memory is the agent's knowledge of how to act. In practice it is the system prompt, the tool definitions, the agent's own code and any playbooks or skills it can load. Developers write most of it. Some agents add to it themselves, which is useful and risky, because a bad entry changes behaviour on every later run.

### Do I need all four types of memory?

Every agent already has working and procedural memory, whatever they are called. Most assistants benefit from a small amount of semantic memory, such as a user profile. Episodic memory is worth adding when past cases help with new ones. Start with the fewest types that fix a problem you have seen in real use.
