Anthropic Details Agent Memory Design, Adding a Dreaming Step to Correct Notes
Anthropic's engineering team detailed a four-layer memory architecture for Claude spanning raw session logs, self-written notes, structured wikis, and auto-injected context, plus a post-session 'dreaming' step that revisits transcripts to fix and reorganize notes. Pokemon and database-QA tests show memory quality, not volume, drives performance, with Opus 5 the first model to form a complete learning loop.
Full Report
宝玉 (@dotey) · 2026-11-08 03
Anthropic Breaks Down Agent Memory: Claude Records While Working, Then Relies on "Dreaming" to Go Back, Correct, and Organize
The Anthropic engineering team published an article on November 6 explaining how they designed cross-session memory for Claude. The challenge: Claude has to decide in the moment what is worth remembering, yet it does not know what will be useful later.
Their approach adds a background step called "dreaming": after a session ends, Claude goes back through the raw conversation records, corrects notes it got wrong, and organizes scattered notes into a form that is easier to find. It is somewhat like how the brain replays the day's experiences during sleep and consolidates part of them into long-term knowledge.
• Newer models are clearly better at using memory: in a test that involved querying a database to answer questions, Sonnet 4.6 with memory rose only from 0.330 to 0.364, while Opus 5 rose from 0.564 to 0.828 (out of 1) • Playing Pokémon Red, Sonnet 3.7 wrote 413 memory files and earned only 1 badge; Fable 5 wrote only 10 files and earned 4 • After one incorrect note was fixed through "dreaming," Claude made it out of Mount Moon; in the run where it was not fixed, Claude fell back to the original route three times and ultimately never reached the next city
[Memory Has Four Layers]
The article defines "agent memory" as content Claude learns from experience, retains across sessions, and stores in a form it can read later. Changing model weights, things learned temporarily within a single conversation, and compressing old conversations into summaries when context is nearly full do not count.
According to Anthropic's breakdown, memory is divided into four layers from bottom to top: at the very bottom are raw session records, which can be searched; above that are memory notes Claude writes itself; above that are organized structures, such as an interlinked wiki; and at the top is content automatically inserted into context whenever a new session starts. "Dreaming" is responsible for checking and refining the lower layers and then passing them upward.
[Choosing Well Matters More Than Remembering a Lot]
The Pokémon test illustrates this best. Sonnet 3.7 thought anything might be useful, creating a separate file for every battle, every item, and every passerby. By around 10,000 steps, its memory had nearly 980,000 characters. At that point it began creating a fourth "master" folder, and over the next 17 steps it created 6 files and deleted 9, without playing the game for a single step.
Fable 5 remembered only things that could not be seen on screen. Money and location can be read from the screen every turn, so recording them is redundant and quickly becomes outdated; strategies and verified patterns exist only if it summarizes them itself. It used a global.md as a control panel, recording the current goal, the plan for gym battles, and its own memory rules. After failing to catch a Magikarp with all seven Poké Balls, it noted: "After 3 consecutive failed balls, change the rhythm and press a few extra waits between menu steps." Opus 5.5 used a similar small folder, revised it while playing, and eventually completed the game.
In the database test, each question started a new session, and only the memory folder carried over; after answering, the model was told the correct answer. Sonnet 4.6 merely piled up unverified guesses. Anthropic says Opus 5 was the first among these models to form a complete learning loop: most notes recorded the rule, how to confirm it held, previous answers, and pitfalls it had encountered.
[Several Lessons for Developers]
Tell Claude what memory is for; do not prescribe how to record it. With only a single sentence—"a memory folder is available"—Opus 4.7 and Opus 5 used it well; adding "record only failures" caused both to lose most of the improvement that memory provided.
Older models need prompting. When Sonnet 4.6 was told to read memory before answering and to verify its guesses, its score rose from 0.364 to 0.641. Sonnet 5 does not need the reminder; 9 times out of 10 it reads first on its own.
The automatically loaded layer should be small. It consumes tokens every time, one wrong item gets carried into every session, and the longer the instruction file, the less likely the model is to follow it. Claude Code's automatic memory loads only the first 200 lines or 25KB of MEMORY.md; this part serves as a table of contents, with details placed in lower layers and links left behind.
When multiple agents run in parallel, do not have them write to the same file. In an acquisition contract test, four agents wrote simultaneously to one shared clause table, overwrote one another, and retained only 41 of 57 key points. After changing to one page per contract, one agent responsible for each, and verbatim copying of clause text, all 57 points were preserved.
["Dreaming" Can Also Build a Wiki]
Anthropic used roughly 350,000 internal files (about 420 million tokens) from Stainless, the software company it acquired in May, for a test, having Opus 5 continuously organize them into a wiki across 128 sessions and then answer 25 questions. With the wiki alone, the score rose from 13% to 48%; with search alone it was 53%; with wiki plus search it rose from 54% to 61%, while also saving about 20,000 tokens per question.
The wiki is suited to questions that require assembling information across documents. In a set of 24 M&A questions, more than half required synthesizing multiple files; using the wiki answered 87% correctly, versus 73% with search alone. For tasks where the answer can be found by searching a single file, the wiki offered no clear help; in one case the wiki grew to 203KB, larger than the 115KB of source files.
[Can It Be Used?]
"Dreaming" is already a feature in Claude Managed Agents (Anthropic's hosted agent runtime service); it is currently a research preview and requires an application to use. The cross-session memory library feature is in beta. Anthropic has also released a cookbook teaching developers how to build a similar setup with their own prompts and models.
All the above numbers come from Anthropic's own tests, and the Pokémon comparisons were each run once per model. The article also notes that "dreaming" costs extra compute, and that questions such as how often memory should be reviewed and whether to record while working or organize afterward remain unsettled.
Original article: https://t.co/om01JMciNI
↳ Quoting @AnthropicAI (Anthropic): Memory is what allows Claude to learn from experience. In a new Engineering Blog post, we share how "dreaming" helps Claude organize what it's learned, correct its mistakes, and find what it needs more easily the next time. https://www.anthropic.com/research/components-of-agent-memory

