Learning / Agentic Operations / Lesson 0010
Episodic Memory
"The agent remembers" is always code choosing what to reload. Here you write that code.
1 · The setup: a run worth remembering
Give your agent a task that can fail informatively and be retried later. Example: a "deploy checker" that runs a (simulated) check tool which fails the first time with a specific reason ("port 8080 already in use"), and a task the agent should approach differently next session if it recalls that failure.
2 · Write the episodic store
The whole lesson in one idea: memory is retrieval-and-injection, not remembering. Between runs the model retains nothing (Lesson 0001). So:
- Write: at the end of a run, append a record to
episodes.jsonl— the task, what happened, the outcome, one lesson learned. Give the agent a tool (record_episode(summary, outcome, lesson)) or write it from your loop. - Retrieve & inject: at the start of the next run, read the relevant past episodes and place them into the context (a "prior runs" section in the system prompt or first message) before the model plans.
This is the same move as your MISSION/NOTES files in this very teaching workspace — they're the teacher's episodic memory, re-injected each session because the teacher is stateless too.
3 · Prove the plan changed
Run twice. Run 1: the agent hits the failure, records the episode. Run 2 (fresh process): the agent loads the episode and should open differently — checking the port first, or choosing an alternative — rather than repeating run 1's blind approach.
episodes.jsonl and run
again — it reverts to the naive approach, proving the behavior came from the injected memory,
not the model.episodes.jsonl on disk), episodic (past-run records you
chose to reload). You never made the model "remember" — you engineered what re-entered the
window. That is the whole of memory in agentic systems.4 · The M2 readiness check
You've now built every M2 exercise: structured prompt + injection defense (0007), ReAct multi-hop (0008), RAG build-and-break (0009), episodic memory (0010). Bring to your teaching agent a design justification for one grounded multi-step agent of your choosing — the M2 gate skill from Lesson 0002 — now backed by things you've actually built.
- Pattern: "Why ReAct here and not CoT or ToT?" — answer by problem shape and token cost, with numbers from your builds
- Memory: "Where does state live, and what gets reloaded when?" — answer as retrieval-and-injection, not "it remembers"
- Grounding: "What caps this agent's answer quality?" — retrieval; and how you'd measure it
- Injection: "Where does untrusted data enter, and what must it never reach?" — least privilege as the structural answer
Next
Lesson 0011 — the orchestrator-vs-single bake-off: prove multi-agent earns its cost, with traces — or admit it doesn't.