Playbooks · Coding
Claude agents now dream: memory that consolidates
Written November 9, 2026
A coding agent that forgets everything between sessions has to relearn your project every morning. Anthropic's November 6 post lays out the four-layer memory system its agents run, and the offline "dreaming" pass that tidies it up. The one part you control is a single file.
What agent memory means here
Anthropic's post, by Lance Martin, defines agent memory narrowly: knowledge Claude gains from experience — interactions with users and tasks it has been assigned — that it retains between sessions, saved as context it can read later. It excludes three other things: changes to the model's weights, in-context learning inside a single conversation, and compaction, the summaries Claude writes to replace older turns so it can continue in a new context window.
The idea behind "dreaming" comes from sleep-time compute, proposed by researchers at Letta and UC Berkeley: models use idle time between interactions to reorganize their existing context. Anthropic applies it to memory — the agent reflects on its logs to fix mistakes or produce new notes and representations, with the original transcripts as ground truth to check those notes against.
The four layers
| Layer | What it keeps | Its weakness |
|---|---|---|
| Transcripts | A searchable log of everything that happened in a session | It records events but does not put the right information in front of Claude on its own |
| Memory notes | Salient observations, rules, failure diagnoses and next steps that Claude writes itself, during the work or into a memory directory | Quality depends on Claude's judgment about what deserves to survive |
| Representations | Higher-level structures such as a wiki — linked pages about one subject that map a growing body of knowledge | Can grow larger than the documents it summarizes, and then abstracts nothing |
| Injected context | A small amount of material loaded at the start of every session, so Claude does not need to search for it | Costs tokens in every session, and a wrong note is carried into every session |
Dreaming works across all four: it checks notes against transcripts and corrects them, builds representations such as wikis, promotes useful notes up to the injected layer, and prunes what no longer earns its place. A memory note is, in Anthropic's framing, a prediction — writing down a rule predicts the pattern will matter again, and writing down a verified fact predicts a future session will want to trust it without double-checking.
What the tests showed
All figures in this section are Anthropic's own test results, from the post. They are not independent measurements.
- Learning loop (CL-Bench 1.0). On a database task where Claude answers questions, is told the correct solution, and can write a memory to help with future questions, Claude Opus 5.5 rose from 0.655 to 0.838 mean reward with a memory store. Sonnet 5.5 went from 0.644 to 0.833, and Opus 5 from 0.564 to 0.828. Opus 5 was the first model to close the loop — most of its entries included a rule, how it knew the rule was true, answers to earlier questions and warnings about traps.
- Judging salience (Pokémon Red). Sonnet 3.7 wrote 413 memory files across 225 folders and earned one badge; Fable 5 wrote nine files in two folders plus a single
global.mddashboard and earned four badges. The indiscriminate record kept going out of date as the game state changed, and around step 10,000 Sonnet 3.7 spent 17 steps creating and deleting memory files without taking a single game action. Opus 5.5 kept a small folder of notes and beat the game. - Correcting a wrong note (dreaming). Claude wrote down, incorrectly, that a PokéCenter was on the east side of Mt. Moon. It walked off a one-way ledge, concluded it had overshot, and gave up after three failures. Dreaming on that memory folder compared the note with the session transcript, caught the error and rewrote it; with the corrected note Claude went back into Mt. Moon and reached Cerulean City.
- Building a wiki (Stainless corpus). Over about 350,000 internal files, roughly 420 million tokens, with 25 graded questions, scaling dreaming from 2 sessions to 128 lifted performance from 13% to 48% of graded criteria. Wiki plus search scored 61% against 53% for search alone, and saved about 20,000 tokens per question. On merger questions the wiki scored 87% against 73% for search alone — but on one legal-brief task the wiki showed no clear gain, and on another it grew larger than the documents themselves.
- One writer per page. When several agents wrote contract terms into one shared table, the resulting brief included only 41 of 57 graded facts. After a loop in which Claude reflected on failures and rewrote the wiki instructions, each contract got its own page, written by a single agent quoting terms word for word — and the brief met 100% of the criteria.
The part you control
For Claude Code users, the practical point is one file. Claude Code's auto memory loads only the first 200 lines or 25 KB of MEMORY.md, whichever comes first. That header serves as an index, showing Claude what it knows and where to find it. What sits at the top of that file is what gets loaded into every session — so the top of the file should hold the current goal, the rules that have been tested, and pointers to the rest, not a running diary. Longer instruction files reduce adherence, Anthropic's own documentation warns, so the injected layer has to stay small — and much of dreaming's work is keeping it that way by moving details down the hierarchy and leaving links behind.
Dreaming itself is not a feature switched on in Claude Code. The post points to dreaming in Claude Managed Agents, where the Dreams API is a research preview, and to cookbooks for getting started with dreaming and building knowledge wikis. Do not expect a dreaming pass to run on your Claude Code sessions.
Limits
- Every benchmark figure above is Anthropic's, from its own evaluations. The Stainless corpus behind the wiki tests is internal and cannot be inspected by outside readers, and several results are single runs.
- Dreaming costs compute, and Anthropic names the open questions plainly: when Claude should create memory, how often dreaming should run, and how to keep memory up to date as the environment changes. A wrong note can carry into every later session, and directing Claude to check all its memories continuously may not be practical.
- A wiki sometimes adds little over plain search, as the legal-brief tests showed. Memory is a tool for long-horizon work with repeated patterns, not a default for every task.
Related playbooks
- Codex memory v2: import memories from other agents
- DeepSeek, Exa, Brave, Tavily: which web-search API should your agent actually pay for now that search is metered
- Together Compiler: agents that speed inference
- gputaskman: see what your LLM is holding
Sources
Back to: Coding playbooks hub · Also: Pick a memory server for your coding agent · Codex memory v2: import memories from other agents · Run claude-mem on your own plan, redaction on