Track 03 · Agents & toolsLesson 06 of 12
Memory that makes people come back
Working, episodic and semantic memory: what to store, what to forget, what to protect.
- Lesson library · reference
- 35 min read
- 60 min hands-on
- Pro
What you'll be able to do
01- Explain the difference between working, episodic, semantic and procedural memory, and between memory and workflow state, using a Carevia example for each.
- Design a write policy that decides what an agent may remember, from which sources, with what confidence, and when a human must confirm it.
- Implement scoped retrieval that filters by tenant and subject first and then ranks by relevance, recency and importance, with TTL expiry and conflict-aware updates.
- Choose a retention and forgetting design that can satisfy an erasure request across every store where a memory or its derivatives live.
- Diagnose memory poisoning and cross-scope leakage, and defend your controls in a privacy or security review.
Before you start
- Context on a budget: what to keep, compress and cut: what happens to context inside a session. This concept starts where that one stops.
- The agent loop, written by hand: memory is read in the perceive phase and written after observe.
- Hybrid search and reranking: semantic memory retrieval reuses these techniques.
- Tools with scoped, auditable access: tenant allow-lists and audit records, which memory reuses.
The short version
Memory is what an agent knows at the start of a session that it did not learn in that session. Working memory is the context window, gone when the call ends. Long-term memory is data you persist and retrieve: episodic memory records what happened, semantic memory records facts and preferences, procedural memory records how to do things. A production memory system is mostly policy, not storage. A write policy decides what may be remembered, from which source, and whether a human must confirm it. A retrieval policy filters by scope first, then ranks by relevance, recency and importance. Update rules resolve conflicts without silently overwriting. Forgetting rules expire, decay and delete, including on an erasure request. And memory is an attack surface: one injected "fact" written today is replayed into every future session.
Key takeaways:
- Memory is not workflow state. "Where is case PA-88213?" belongs to the durable workflow (Workflows that survive restarts); "this provider office prefers fax" belongs to memory.
- Write less than you think. An allow-listed schema of things worth remembering beats "extract everything and let retrieval sort it out".
- Scope is a hard filter in code, never a retrieval score or a prompt instruction.
- Every memory needs provenance, a confidence, an expiry and a deletion path before it is written.
- Memory written from untrusted input stays untrusted on the way back in.
Pro lesson
The rest of this lesson is in Pro.
The mental model, worked example, field note, failure table, exercise and self-check, with the voice tutor.
- Every stage and specialisation, in full
- Every lab and every role project
- Halden weeks 2–10, on your record
- Every drill, live in the playground
- All solutions, plus the server judge
- Lab Assistant and every Teach with AI