AI Agent Memory Types
Have you ever wondered how an AI agent remembers what it's doing? Or how it learns from past mistakes without you having to repeat yourself?
Just like humans, AI agents have different kinds of memory. Each type serves a different purpose. Let's walk through the four main types — from the simple stuff to the more advanced ideas that researchers are working on today.
How Human Memory Works (As a Starting Point)
Before we talk about AI, it helps to think about how we remember things:
- Short-term memory — What's active in your brain right now. Like the words you're reading at this very moment.
- Factual knowledge — Things you know, like "Python is a programming language" or "our company password policy requires 12 characters."
- Learned skills — Things you know how to do, like riding a bike or writing backwards on a sheet of glass.
- Personal experience — Memories of specific events, like the time you spent hours debugging something only to realize the problem was something silly.
Well-designed AI agents need similar types of memory. Researchers at Princeton created a framework called CoALA (Cognitive Architectures for Language Agents) that maps out four types of memory that agents need.
Let's look at each one.
Type 1: Working Memory
What it is: The agent's "scratch pad" — everything it can see and work with right now.
Analogy: Think of this like your computer's RAM. It's fast and immediately accessible, but it's temporary. When the session ends, it's gone.
What goes in here:
- The current conversation
- System instructions
- Any files or data loaded into the prompt
Limitations: Even the biggest context windows have a ceiling. If you stuff too much in, the agent starts losing track of things buried in the middle.
Every chatbot has working memory — it's just the conversation window. But agents need more than that to be truly useful.
Type 2: Semantic Memory
What it is: The agent's knowledge base — facts, rules, and documentation it can refer to.
Analogy: This is like a reference book or a company handbook. It tells the agent what it needs to know in general.
How it works in practice: In many production systems, semantic memory is surprisingly simple — just Markdown files (.md files). For example, the coding agent Claude Code uses a file called Claude.md stored in the root of a project. That file contains:
- Project architecture
- Coding conventions
- Build commands
- What frameworks to use
- What not to do
This file gets loaded into the agent's working memory at the start of every session.
Why it matters: Without semantic memory, an agent is destined to make the same mistakes over and over again. It has no persistent knowledge to draw from.
Type 3: Procedural Memory
What it is: How the agent knows how to do things — step-by-step instructions for specific tasks.
Analogy: This is like a recipe book or a standard operating procedure. It tells the agent the process for completing a task.
How it works: There's an open standard for this called agent skills, using a file format called skill.md. A skill is a folder with:
- A Markdown file describing what the skill does
- Step-by-step instructions for how to perform it
Skills can cover anything from "create a PowerPoint presentation" to "run a structured code review."
The clever part — progressive disclosure: The agent doesn't load all its skills into working memory at once (that would eat up too much space). Instead, it sees a lightweight index — just the name and a short description of each skill. When a task comes in that matches a skill description, the agent loads the full instructions. And if the skill references other files or templates, those only get pulled in when the agent actually needs them during execution.
This is different from semantic memory, where the knowledge is always present in context.
Type 4: Episodic Memory
What it is: The agent's record of what happened in past interactions — decisions made, lessons learned, mistakes to avoid.
Analogy: This is like your personal memory of past experiences. "Last time we debugged the login module, the issue was in the authentication layer."
How it works: A naive approach is to save every conversation transcript and search through them later. But that's not very useful in practice.
Production systems do something smarter — distillation. As the agent works across sessions, it accumulates notes for itself. But it doesn't save everything. It decides what's worth remembering based on whether that information would actually be useful in a future conversation.
The result is compressed experience — useful takeaways without the noise.
Why it's powerful: This is where memory starts to look like genuine learning. The agent gets better over time because it remembers what worked and what didn't.
Why it's hard: What do you delete? When does information become obsolete? If a user changes projects, do you keep the old memories around? Humans are actually pretty good at forgetting — but for AI agents, forgetting is an engineering problem.
Do All Agents Need All Four Types?
No. It depends on what the agent is doing.
| Type of Agent | Memory It Needs |
|---|---|
| Simple reflex agent (like a thermostat or basic routing bot) | Working memory only |
| Simple customer support agent (like a password reset bot) | Working memory + procedural memory |
| Coding agent | All four — working, semantic, procedural, and episodic |
A coding agent needs the full set because it needs:
- Working memory — the current task and conversation
- Semantic memory — project knowledge and conventions
- Procedural memory — skills for writing, testing, and debugging code
- Episodic memory — lessons learned from past sessions
Why Memory Matters
Memory is what separates a chatbot from an agent.
- A chatbot gives a response based on the current conversation.
- An agent gives a response shaped by persistent knowledge, accumulated experience, and lessons from past mistakes.
A good memory architecture means the agent:
- Remembers the project
- Remembers your preferences
- Remembers past mistakes — so you're not destined to repeat them
Memory turns a one-time helper into a tool that gets better the more you use it.