31.3 Memory in four layers
- Approved by
- Panaversity ·
In everyday life. A lawyer's office keeps everything. The recordings of every client meeting sit in a basement archive. Each lawyer keeps notebooks. The office has a filing system, with an index of cases. And on the reception desk is one laminated page of rules everyone must see each morning. Nobody reads the archive every day. Everybody reads the laminated page.
What you will learn. The four layers of a worker's memory, what goes in each, and why the top layer must stay small. You practise it in Lab 31, Task 1.
Why it matters. A memory that loads everything into every run is slow and costly, and its important rules drown in detail. A memory that loads nothing is useless.
What are the four layers?
Anthropic's engineering post on agent memory describes memory as layers that narrow as they rise: everything is logged, and little is loaded into every run.1 In this chapter's files:
| Layer | What it holds | Brightline's files | Loaded |
|---|---|---|---|
| 4. Injected context | The few rules every run must see | instructions.md and index.md | Every run |
| 3. Memory representations | Organized pages, linked from the index | notes/ pages, such as notes/cedar-ridge/credit-memos.md | When the index points to them |
| 2. Memory notes | What a run writes while it works | scratch/<run>/notes.md | By the next dream |
| 1. Transcripts | Every session: messages, tool calls and results | The platform's session events | By the dream only |

Figure 31.4. Memory narrows as it rises. Dreaming moves what matters upward, and keeps the top small.
How did memory get here?
In four steps, over about a year, each the simple thing that worked. Mukta traced the path in her talk:2
| Step | What it is | What it taught |
|---|---|---|
| 1. CLAUDE.md | A Markdown file loaded at the start of every Claude Code session | "Unreasonably effective" at steering. People and the worker can both read and write it. It breaks down as it grows long |
| 2. Memory tools | The worker decides when to read, write and update memory, in band | Letting the worker decide works well. Later systems cared less about the exact shape of the tools |
| 3. Skills | Know-how behind a short description; the body loads only when relevant | Loading only what is needed solves the ever-growing context. But a person still decides what deserves a skill |
| 4. File-system memory | Memory as a folder of Markdown, searched with ordinary tools such as grep | Memory can grow large while the worker searches for what matters. Workers already use these tools well |
Her picture for step 3 is a bookshelf. You scan the titles, and pull down the French dictionary only when someone speaks French. You do not carry seven years of French classes in your head. This is called progressive disclosure: a short description first, the full text only when needed.
The talk ends with three principles. Markdown is a good format for memory. Let memory grow large, but give the worker a fast index and search. And let the worker decide what to write.
The engineering post defines memory narrowly: knowledge kept between sessions. It leaves out changes to the model itself, learning inside one conversation, and compaction, which summarizes a long conversation to save space.1 It adds one more piece of advice: give each worker its own page, instead of one shared file.
Why plain Markdown files?
Because people and workers can both read them. Anthropic's memory work settled on a folder of Markdown files. The worker searches it with ordinary file tools, the way a coding agent searches a repository.2 An index at the top points down to pages, the way a skill's short description points to its body (Chapter 16). The worker reads the index every run, and opens a page only when its work needs it. Claude Managed Agents mounts a memory store as a directory inside the session's sandbox, for the same reason.3
What should a worker remember?
Only what it cannot look up again. A note is a prediction that a fact will matter later.1 An invoice's amount can be read from the connector every time, so a note about it is waste, and goes stale. It also fails Chapter 4's wipe test: if memory were wiped tonight, tomorrow's work must still be correct (4.3). The fact that Northfield's NA- documents are credits, with the invoice in the line text, is worth a note, because nothing in a single document says so. Anthropic's post reports a Claude model that played a video game. It wrote hundreds of memory files about things it could read off the screen, and spent its time searching them instead of playing. A later model kept a small folder of tested rules, and got much further.1
Tell the worker what memory is for, not how to use it. In the same post, telling strong models to "record only failures" took away much of what memory gained them.1 Brightline's instructions say: "Memory is for what you will need again and cannot look up: how this company's documents and tools behave, and corrections people gave you." They do not list what to write.
Why must the top layer stay small?
Every line in it is read, and paid for, on every run, and long instruction files are followed less well.1 Brightline keeps instructions.md under 40 lines and index.md to one line per page. A lesson can be published to a notes/ page without being added to the top layer. Those are two decisions, and 31.6 keeps them apart.
Check yourself
Question 1 / 2
0 answered
Which memory layer is read, and paid for, on every run?
Sources
- Owner
- Panaversity