THEORY · 2.5 hours
Map out the four working memory types — short-term, episodic, semantic, and procedural — and learn which to reach for based on real production tradeoffs from the support-automation system.
The first thing I noticed: "memory" is not one thing. The support system needed to remember what happened in this conversation (short-term), what happened in past conversations with this customer (episodic), what the billing system actually does (semantic), and how to run a refund process (procedural). These are four distinct problems with four distinct storage strategies.
graph TD
A[Agent Memory] --> B[Short-Term\nContext Window]
A --> C[Episodic\nSession History]
A --> D[Semantic\nFacts & Knowledge]
A --> E[Procedural\nSkills & How-To]
B --> F[In-memory, expires]
C --> G[Persistent store, time-stamped]
D --> H[Persistent store, indexed]
E --> I[Config / tool definitions]Here's the working taxonomy I landed on:
Analogy: Think of a senior support engineer on their first day back from vacation. Short-term memory is the notes on their desk from today. Episodic memory is their notebook of past cases. Semantic memory is the product knowledge in their head. Procedural memory is the muscle memory of running the refund tool.
Each type maps to a different storage mechanism and retrieval pattern. Getting the taxonomy right before writing any code saved me from building one monolithic "memory table" that would have been impossible to query effectively.
Short-term memory is the context window — the messages the model sees right now. It is fast, zero-latency, and inherently stateless: when the API call ends, the context is gone.
The practical problem with short-term memory is capacity. A long support conversation can easily hit 50,000+ tokens across multiple tool calls. Most models have context limits, and even models with large windows get slower and more expensive as the context grows.
The two common patterns for managing context window size:
Sliding window — keep only the last N turns. Simple to implement, but the agent "forgets" earlier turns abruptly.
Summarization — use the model to compress older turns into a summary, then replace them. Preserves intent but loses detail. Costs a model call.
Summarization trade-off: Summaries lose specifics. If the agent summarized away "the customer already tried resetting their password twice," it may suggest the same fix again. For support use cases, I keep exact failure steps in episodic memory rather than trusting the summary to preserve them.
Episodic memory is a time-stamped log of past sessions and their outcomes. It answers the question: "What happened before, with this user, in this context?"
In the support-automation system, the absence of episodic memory caused a specific and infuriating failure: a customer would open a new session about a billing issue, and the agent would walk through the same diagnostic steps it had already run with them twice before. The customer knew this; the agent didn't. The session started from zero every time.
The fix was simple in concept: persist a record of each session — what was tried, what the outcome was, when it happened — and retrieve it at the start of any new session with the same customer.
Retrieving these at session start lets the agent open with: "I see we've looked at this billing issue twice before — both times the card processor returned a timeout. Let me check the processor status first this time."
Analogy: Episodic memory is a clinician's case notes. Each session is logged; the next clinician who picks up the case can see what was already tried. Without it, every session starts from the intake form.
Semantic memory holds facts that are true about the world — product documentation, billing system rules, escalation policies, known bugs. It is not specific to any session or customer; it's shared knowledge the agent needs to reason correctly.
The key distinction from episodic memory: semantic memory answers "what is true?" while episodic memory answers "what happened?"
In the support system, semantic memory included things like:
Storing semantic memory separately from session history means it can be updated once (when a policy changes) and immediately affects all future queries, without re-training anything.
Preview: Retrieval from semantic memory is where embeddings become essential. Keyword search ("find documents containing 'billing'") breaks down when the query is "the error that looks like a login issue but is actually a payment method problem." Module 03 covers embeddings in depth — for now, the key point is that semantic memory needs a smarter retrieval layer than a keyword index.
The simplest viable semantic memory is a table of facts with a text description, queried with keyword search to start and upgraded to vector search when keyword search breaks down:
Each memory type has a natural fit. The mistake I made early on was reaching for episodic memory when I actually needed semantic memory, and vice versa. Here's the decision guide I use:
| Question | Memory type |
|---|---|
| What are we talking about right now? | Short-term (context window) |
| What did we try last time with this customer? | Episodic |
| What does the billing system do? | Semantic |
| How do I run a refund? | Procedural |
Start with short-term. The context window is free and instant. Only move information to persistent memory when you hit a real limit: the session ends and you need it again (→ episodic), the agent lacks domain knowledge it can't infer (→ semantic), or a workflow is too complex to keep in context (→ procedural).
Episodic vs. semantic confusion is the most common mistake. The rule: if the information is about a specific past event ("this customer's card was declined at 2pm on Tuesday"), it's episodic. If it's a general fact that would be true for any customer ("our billing processor retries failed charges after 24 hours"), it's semantic.
Don't over-engineer procedural memory. In most systems I've built, procedural memory is just tool schemas and runbook YAML, not a separate database. The agent reads the tool definition and knows how to use it. Only build a dynamic procedural memory store if the set of tools changes frequently at runtime.
Reflective prompt: For your own agent use case, which memory types are load-bearing? Which one, if you removed it, would cause the agent to fail immediately? That's the one to build first.
1. A customer opens a new support session about a billing issue they've contacted support about twice before. Which memory type lets the agent avoid suggesting steps that already failed?
Correct Answer: B
Episodic memory stores what happened in past sessions (steps tried, outcomes). Semantic memory stores general facts about the billing system — it won't tell you what was tried with this specific customer.
2. The support agent needs to know that 'error code 4003 means the card processor's fraud filter blocked the charge.' Where does this fact belong?
Correct Answer: C
Semantic memory holds facts about the world that are true regardless of session or customer. Error code mappings are facts — they don't change per customer and aren't tied to a specific past event.
3. What is the primary risk of using a simple sliding window for short-term memory management?
Correct Answer: C
A sliding window keeps only the last N turns. If the customer mentioned a key detail in turn 3 and the window only keeps turns 8-18, the agent loses that context entirely — with no warning.
4. You're building an agent that runs a multi-step refund process. The steps are fixed and don't change per customer. Which memory type fits best?
Correct Answer: C
A fixed multi-step process is procedural knowledge — it's a skill or how-to, not a fact about the world and not a past event. Tool schemas and runbook YAML are the natural fit. Short-term works for simple cases, but procedural memory scales better when the process is complex or shared across agents.
5. A teammate suggests storing all memory in one 'memory' table to keep things simple. What's the most likely failure mode of this approach?
Correct Answer: B
The core problem with a single memory table is retrieval: 'give me relevant memory for this query' returns a mix of past episodes, general facts, and stale context. Each type needs a different retrieval strategy. Separating them by type makes each query answerable with the right strategy.
6. Which situation correctly calls for upgrading from keyword search to embedding-based retrieval in semantic memory?
Correct Answer: B
Keyword search breaks down when the query and the matching fact use different words for the same concept. 'Billing error that looks like a login problem' won't match a fact titled 'payment method validation failure' even if they describe the same thing. That's the signal to add embeddings — module 03 covers the implementation.
7. Episodic memory is to semantic memory as _______ is to _______.
Correct Answer: A
A case file records what happened in a specific past interaction — like episodic memory. A textbook holds general facts true across many situations — like semantic memory. The distinction is specific-event vs. general-knowledge.