# Agent Memory Hierarchy
The agent memory hierarchy is the model [[Anthropic]] uses to describe how an [[AI Agents|AI agent]] remembers across sessions. It comes from the research post "The components of agent memory" (November 2026) and stacks four layers: the raw record of what happened sits at the bottom, and the few lines loaded into every session sit at the top. An offline process Anthropic calls dreaming moves knowledge up and between the layers.
I find the model useful because it names what I ended up building by hand in my own vault. Each layer answers a different question: what happened, what the agent noticed along the way, how it all connects, and what it must know in every session.
## The four layers
From bottom to top:
| Layer | What it holds | Example from the post |
|---|---|---|
| 1. Transcripts | A searchable event log of the work | The session transcripts a dreaming pass checks notes against |
| 2. Memory notes | Salient observations the agent writes down (e.g. a folder of files) | The memory directory Claude keeps on CL-Bench and in Pokémon Red |
| 3. Memory representations | Structures that link knowledge together, such as wikis | The wiki Opus 5 agents built from ~350,000 internal Stainless files |
| 4. Injected context | What gets loaded into every session | The `MEMORY.md` index of [[Claude Code Memory\|Claude Code auto memory]] |
The higher you go, the smaller and more processed the content gets. Transcripts are complete, but you have to search them. Injected context is tiny and always there, and you pay for it in tokens in every session.
## Dreaming moves knowledge up
Dreaming is an offline pass over the layers (the product version is [[Claude Managed Agents Dreams]]). It reads the transcripts and the existing memory, then rewrites what it finds wrong or missing. In Anthropic's experiments, it:
- Fixed a wrong note by checking it against the transcript (a PokéCenter written down on the wrong side of Mt. Moon)
- Built and maintained wikis from raw documents
- Repointed dangling wiki links and created the missing pages
- Promoted notes to the top layer, so that they load in every session
## Keep the top small
Promotion is where it gets risky. According to Anthropic, injected memories use up tokens, a wrong note gets carried into every session, and longer instruction files reduce adherence. Their advice: keep the top layer small, push the details down, and leave links behind.
Claude Code applies this to its own auto memory. It loads only the first 200 lines or 25 KB of `MEMORY.md`, so that file works as an index pointing to topic files. That's [[Progressive Disclosure]] applied to memory.
## Why the bottom layer matters most
The transcript is the only layer that records what actually happened. Everything above it is a judgement made at writing time, and Anthropic calls memory "occasionally, a prediction": a rule predicts that a pattern will recur, and a verified fact predicts that you can rely on it without checking again. Predictions go stale.
As long as the transcripts exist, you can check the upper layers against them, and rebuild them if needed. That's exactly how the Mt. Moon note got fixed. Without them, a wrong note has nothing left to be checked against. So keep the transcripts, and keep the top layer as small as you can.
## Same split, other names
Other memory systems I've documented use the same split, usually with fewer layers:
- [[Cog Memory]]: hot memory (always loaded, under 50 lines), warm domain files loaded when relevant, and a glacier archive searched on demand
- [[OpenClaw Memory System]]: append-only daily logs plus a curated `MEMORY.md`
- [[LLM Wiki]]: raw sources the LLM never modifies, the wiki it maintains, and a schema file that tells it how
- My own [[AI Assistant Architecture]]: transcript backups at the bottom (a PreCompact hook copies them into the vault), daily agent logs and curated `MEMORY.md` and `Lessons Learned.md` files above them, LLM wikis as representations, and `AGENTS.md` (every session) plus `Hard Rules.md` and `Facts.md` (every agent activation) at the top
## References
- Anthropic, "The components of agent memory" (research post, 2026-11-06): https://www.anthropic.com/research/components-of-agent-memory
- Hacker News discussion of the post: https://news.ycombinator.com/item?id=50402212
- Claude Code auto memory documentation: https://code.claude.com/docs/en/memory
- Claude Managed Agents dreams documentation: https://platform.claude.com/docs/en/managed-agents/dreams
## Related
- [[AI Agent Memory]]
- [[Claude Managed Agents Dreams]]
- [[Claude Managed Agents Memory Stores]]
- [[Claude Code Memory]]
- [[LLM Wiki]]
- [[Progressive Disclosure]]
- [[Context Engineering]]
- [[Strategic Forgetting]]
- [[Cog Memory]]
- [[OpenClaw Memory System]]
- [[AI Assistant Architecture]]