Module 2 · Lesson 3 · 15 min read
Episodic, semantic and procedural memory
Episodic, Semantic and Procedural Memory
Introduction
Not all memories are alike: some are events that happened, some are facts, and some are skills. In this lesson we learn the three kinds of long-term memory as classified by the CoALA framework, and see how a real agent draws on them in a single task.
Learning objectives
- Distinguish between episodic, semantic and procedural memory with examples
- Link each kind to the retrieval method that suits it
- Explain the idea of the memory stream in the Generative Agents paper
- Build a classified memory in Python and use it in a single decision
Three kinds of long-term memory
Dividing memory into "short" and "long" tells us when information lasts, but not what kind it is. The CoALA framework (Sumers and colleagues, 2023) borrows three kinds of long-term memory from cognitive psychology, and each kind has a storage and retrieval method that suits it.
Episodic memory
It stores specific events that happened: what happened, when, and the outcome. It is the agent's "diary". Examples:
- "On 3 March the student asked to postpone an exam, and the request was rejected for lack of a medical excuse."
- "In the previous attempt to solve this problem, the reading tool failed because the file was in an unsupported format."
Retrieval here usually relies on similarity to the current situation or on time. The Generative Agents paper (Park and colleagues, 2023) built simulated characters that keep a "memory stream" of events and retrieve from it based on recency, importance and relevance to the situation, then generate higher-level reflections from it.
Semantic memory
It stores facts and general knowledge separate from the moment they were learned. Examples:
- "The maximum course load is 18 credit hours."
- "Student stu-9 majors in computer science."
It does not matter when the agent learned this information; what matters is that it is correct now. Knowledge bases and the RAG pipelines we study later are, in essence, semantic memory.
Procedural memory
It stores how things are done: skills and procedures. In language agents it appears in more than one place:
- The weights of the model itself (skills acquired in training).
- The system prompt that describes how the agent behaves.
- The agent's code and tools.
- Written "recipes" the agent saves, such as: "To register a course: check the prerequisite, then the clash, then register."
A quick comparison
| Kind | What it stores | Example | Typical retrieval |
|---|---|---|---|
| Episodic | Events with their time and outcome | The postponement request was rejected on 3 March | Similarity of situation, recency |
| Semantic | Facts and knowledge | A maximum of 18 hours | Search by meaning or by key |
| Procedural | Ways of doing things | The steps for registering a course | Loaded according to the task type |
A practical example: a student affairs agent
A student writes: "I want to register for the artificial intelligence course." The agent draws on all three kinds:
- Procedural: it loads the "register a course" recipe.
- Semantic: it retrieves that the course's prerequisite is "Data Structures", and that the student has passed it.
- Episodic: it retrieves that the student tried to register last week and failed because of a timetable clash, so it checks for clashes first.
from datetime import datetime
class TypedMemory:
def __init__(self):
self.episodic = [] # events with time
self.semantic = {} # facts by key
self.procedural = {} # recipes: task name -> steps
def log_event(self, what, outcome):
self.episodic.append({"time": datetime.now().isoformat(timespec="minutes"),
"what": what, "outcome": outcome})
def set_fact(self, key, value):
self.semantic[key] = value
def add_procedure(self, task, steps):
self.procedural[task] = steps
def similar_events(self, keyword):
return [e for e in self.episodic if keyword in e["what"]]
mem = TypedMemory()
mem.add_procedure("Register a course", ["Check the prerequisite", "Check for clashes", "Register"])
mem.set_fact("prerequisite:Artificial Intelligence", "Data Structures")
mem.set_fact("stu-9:passed", ["Data Structures", "Programming 1"])
mem.log_event("Attempt to register for Artificial Intelligence", "Failed: timetable clash")
course = "Artificial Intelligence"
steps = mem.procedural["Register a course"]
prereq = mem.semantic[f"prerequisite:{course}"]
ok = prereq in mem.semantic["stu-9:passed"]
past = mem.similar_events(course)
print("Steps:", steps)
print("Prerequisite met?", ok)
if past:
print("Warning from a past attempt:", past[-1]["outcome"])Summary
Episodic memory stores specific events with their time and outcome, semantic memory stores facts and knowledge independent of when they were learned, and procedural memory stores ways of performing tasks in instructions, recipes and code. Each kind has a retrieval method that suits it, and they may be stored in different systems. A good agent combines all three kinds in a single decision. Modifying procedural memory automatically needs care because it changes overall behavior.
Terms
| Term | English | Definition |
|---|---|---|
| Episodic memory | Episodic Memory | Memory of specific events with their time and outcome |
| Semantic memory | Semantic Memory | Memory of facts and general knowledge independent of when they were learned |
| Procedural memory | Procedural Memory | Memory of ways of doing things, skills and instructions |
| System prompt | System Prompt | Fixed instructions that define the agent's behavior in every call |
| Knowledge base | Knowledge Base | An organized collection of facts and documents that is retrieved from |
Review questions
- What is the difference between an episodic piece of information and a semantic one? Give an example of each from your university life.
- Why is modifying procedural memory automatically dangerous?
- How did the student affairs agent use all three kinds in a single request?
- What three criteria did the Generative Agents paper use for retrieval?
References
- Cognitive Architectures for Language Agents (CoALA) arxiv.org Reviewed on 2026-11-18
- Generative Agents: Interactive Simulacra of Human Behavior arxiv.org Reviewed on 2026-11-18
