Why does your AI assistant forget the rule you taught it last week — or worse, confidently follow a note it wrote down wrong? On 6 November 2026, Anthropic's engineering team published The components of agent memory by Lance Martin, the clearest explanation yet of how serious AI agents actually remember — including a self-correction process called dreaming. This guide explains the ideas and turns them into steps you can use with your own AI tools today.
How agent memory is actually built: four layers
- Transcripts: the raw record of past sessions — everything that was said and done, kept verbatim.
- Self-written notes: the agent's own distilled notes about what matters — facts, decisions, preferences — written in its own words during or after work.
- Representations (a wiki): organised pages built from those notes and transcripts, so knowledge is structured and searchable rather than buried in logs.
- Always-loaded context: the small set of instructions and facts loaded at the start of every session — in Claude Code, that is your MEMORY.md.
The important insight is that these layers do different jobs. The always-loaded layer must be tiny and reliable; the deeper layers can be huge, because they are searched only when needed.
What 'dreaming' is
Dreaming is an offline pass over an agent's memory: while not working on a live task, the agent re-reads its logs and notes, fixes wrong or stale notes, and builds wiki pages that organise what it knows. It is the difference between an assistant that accumulates clutter and one that periodically tidies, corrects and summarises its own memory — much like sleep consolidating memory in people.
One honest caution: this is a research post, not a product launch. Dreaming is currently in research preview on Claude Managed Agents — it is not a switch you can flip in the normal Claude app today.
Do the numbers back it up?
Anthropic reports the following from its own internal tests — treat them as the maker's measurements, not independent benchmarks:
- A wiki built over roughly 350,000 internal files, with 128 dreaming sessions, improved scores on 25 test questions from 13% to 48%.
- Wiki plus search scored 61%, against 53% for search alone.
- On CL-Bench, Opus 5.5 scored 0.655 without memory and 0.838 with memory.
Even allowing for home-field advantage, the direction is consistent: structured, self-corrected memory helps a lot; a pile of raw logs helps much less.
Step by step: set up your own agent memory properly
- Keep MEMORY.md short and index-like. Claude Code's auto-memory loads only the first 200 lines or 25 KB of MEMORY.md. Anything beyond that may simply never be read at startup — so write it as an index of the most important facts, with detail stored in linked files, not as a diary.
- Put your top rules first. The earliest lines are the ones guaranteed to load. Your non-negotiables — names, formats, boundaries, standing decisions — belong at the top, not buried under history.
- Say what the memory is FOR, not how to use it. Anthropic's guidance, in spirit: tell the agent the purpose a note serves ("this contact is the approver for invoices") rather than micromanaging retrieval. Purpose survives changing tools; brittle instructions do not.
- Separate facts from logs. Keep a clean notes file of current facts and decisions, and let raw session history live elsewhere. When the two mix, stale details get loaded as if they were still true.
- Do your own 'dreaming' pass weekly. Until automated dreaming reaches your tools, imitate it: once a week, ask your agent to re-read its notes, flag anything outdated or contradicted, and rewrite the summary. Wrong notes are worse than no notes — this is the step that catches them.
- Test recall with real questions. Ask the agent questions whose answers live only in its memory files. If it cannot find them, your index is too long, too vague, or in the wrong file — fix the index, not the agent.
Bottom line: good agent memory is not "remember everything". It is a small, accurate, well-indexed set of notes, backed by searchable detail, and corrected regularly — by dreaming where it exists, and by a weekly tidy-up where it does not. Set that up once, and every future session with your AI assistant starts smarter.
Source: Anthropic, "The components of agent memory" (Lance Martin), 6 November 2026. All performance figures are Anthropic's own internal test results as published in that post. Hero image: person writing notes in a notebook beside a laptop, Wikimedia Commons.

