Session 5: Memory - systems that persist and compound
9 lessons · Back to full syllabus
What you keep
How to give an agent memory that lasts and improves, and how to run it persistently.
You ship
Your agent remembering across sessions and deployed to run for real, with a Streamlit UI that demos memory.
Recommended reading (async)
Session 5 recommended reading and video
Context vs memory, compaction, durable execution, and LLM wiki patterns. Skim after the live session.
Videos
The Four Types of Memory Every AI Agent Needs
IBM Technology - working, semantic, episodic, and procedural memory.
Architecting Agent Memory: Principles, Patterns, and Best Practices
Richmond Alake (MongoDB) at AI Engineer - production memory patterns.
Google's OKF - The New Way to Structure Your Knowledge for Agents
Open Knowledge Format walkthrough for agent knowledge wikis.
Articles
- Anthropic: Effective context engineering for AI agents
- Anthropic: Effective harnesses for long-running agents
- Machine Learning Mastery: Choosing the right AI agent memory strategy
- Hugging Face: KV Caching Explained
- Karpathy llm-wiki gist
- Open Knowledge Format (OKF) spec
- LangGraph: add memory
- LangGraph: persistence (checkpointers vs stores)
- gbrain (Garry Tan)
- gstack (Garry Tan)
Live session resources
Week 5 session: Anatomy of Agentic Memory
Live deck: memory vs context, LLM wiki / OKF, compaction, write gates, durable execution, poisoning demos, and Demo Day prep.
Open resourceWeek 5 assignment build guide
Path A / Path B guide: durable store, cross-session recall, public URL, UI proof, and copy-paste prompts.
Open resourceWeek 5 Agentic Memory Lab (GitHub)
Next.js interactive UI + notebook: context budget, vector vs graph, compaction, memory store, crash/resume, poisoning. Local equivalent of gbrain ideas.
Open resourceOpen Knowledge Format (OKF v0.1)
Open markdown + YAML standard for portable agent knowledge wikis (Google Cloud Data Cloud).
Open resourceKarpathy llm-wiki gist
Where the LLM wiki pattern was coined: raw sources compiled by an LLM into a living markdown knowledge base.
Open resourcegbrain · gstack (Garry Tan)
gbrain = agent brain / knowledge layer. gstack = Claude Code role toolkit. Skim; dig in later.
Open resourceLessons
The memory spectrum
Working, semantic, episodic, and procedural memory. Match the store to the job.
Graph plus vector hybrid memory (and gbrain)
Vector recalls by similarity; graph recalls by relationship. Hybrid earns its cost when both matter.
Compaction, write gates, and durable execution
Context fills up. Compaction loses rules. Writes need gates. Checkpoints are not full durability.
Persistent runtime deployment
From "I built an agent" to "I deployed an agent": stays up, holds memory, ready for Demo Day.
Skills and the compounding loop
Procedural memory you can write down: capture a process once, and the agent gets better at it every time after.
Course wrap and your capstone from here
Reasoning, RAG, agents, evals, memory - the full arc, what carries forward, and where the capstone goes after Demo Day.
Rolling your own memory store
A real, minimal memory store: Postgres + pgvector, a write gate, hybrid retrieval, and an actual forgetting policy.
Skills authoring patterns
A skill is only as good as its trigger. Structure, scope, and how to actually test one before you trust it.
Session 5 assignment support: Give your capstone memory and deploy it
Path A: durable store, cross-session recall, public URL, UI proof. Path B: graph, consolidation, provenance, crash drill, LLM wiki.
Lessons in this module