After Claude Learned to “Dream,” Memory Files Fell from 413 to 9
Anthropic’s engineering blog reveals the agent memory architecture. In a Pokémon test, Sonnet 3.7 wrote 413 memory files but earned only 1 badge, while Fable 5 wrote 9 files plus a dashboard and earned 4. Truly useful memory doesn’t come from piling up volume; it comes from filtering, error correction, and indexing.
On November 6, the Anthropic engineering team published a long article, “The components of agent memory,” by Lance Martin. The article explains how Claude’s agent memory is designed and also presents a set of very concrete test results. X user @hungryturbo condensed the long article into 10 takeaways, and several of the numbers are worth a closer look from developers.
First, some background. Agent memory here refers to context that the model retains across sessions and can read later. It is not the same as changing model weights, in-context learning within a single conversation, or compaction—condensing old conversations into summaries to extend the context window. True agent memory must be persistent and mounted on demand.
The core mechanism Anthropic proposes is called dreaming. While a session is underway, Claude marks important points; after going offline, it uses idle compute to replay the raw logs and performs error correction, deduplication, and knowledge reorganization in the background. This division of labor is somewhat like the human brain: the hippocampus quickly captures experiences as they happen, while the cortex slowly integrates them during sleep and quiet rest.

In CL-Bench’s database tasks, the differences in how well different models write memory are obvious. Sonnet 4.6 writes its own guesses into files, but those guesses are unverified. Opus 5 is the first to complete the full loop: give a wrong answer, form a hypothesis, run experiments to verify it, and then write down rules for avoiding pitfalls. By Opus 5.5 and Sonnet 5.5, memory-enabled scores both reached around 0.83.

Even more vivid is the Pokémon Red test. Sonnet 3.7 created records for every battle, every passerby, and every item, eventually writing 413 memory files spread across 225 folders—and earned only 1 badge. Fable 5 wrote just 9 files plus a top-level global.md dashboard and earned 4 badges. Opus 5.5 cleared the game outright with a concise set of notes.

The problem is what to remember. Information like current coins or map coordinates can be seen by glancing at the screen each turn, and if written into memory it quickly becomes stale. What is truly worth writing down are patterns that would disappear without inference. Claude threw seven balls in a row and failed to catch Magikarp; later it figured out that after losing three times, pressing wait a few extra times across menus changes the rhythm. After writing down this rule, it caught the Pokémon with one ball. Memory is a prediction of future needs; writing it accurately matters more than writing a lot.
There are also counterintuitive findings about how to guide models to write memory. Tell strong models that a memory directory is available, and they will judge for themselves. If you rigidly require them to record only failure lessons, the memory boost for Opus 5 actually drops by 0.234, and Opus 4.7 drops by 0.150. For Sonnet 4.6, which is not inclined to read memory proactively, forcing it to read and verify memory before answering raised its score from 0.364 to 0.641—nearly double.

The most direct use of dreaming is error correction. At Mt. Moon, Claude recorded the direction of the Pokémon Center backwards. Upon leaving, it said “Mt Moon is behind me” and even updated a note saying “Mt Moon DONE.” After that it fell back onto the same path, fell off a cliff three times in a row, and wrote, “I’m going to stop rather than keep looping.” In the background, dreaming reconciled the notes with the raw action logs, found that the direction had been recorded backwards, and after correcting it Claude passed through the cave in one go. The run with dreaming enabled reached Cerulean City in 1,935 steps; the run without error correction never got through.

Dreaming can also build a Wiki. Anthropic used about 350,000 internal documents—roughly 420M tokens—from the acquired company Stainless for a test, having Opus 5 create pages, add bidirectional links, deduplicate, and verify sources across 128 rounds of dreaming. Answering 25 questions using only the Wiki raised the score from 13% to 48%; Wiki plus a search tool raised the overall score from 54% to 61%, while search alone was 53%. Wiki plus search also saved about 20,000 tokens per question.

But a Wiki is not a panacea. For simple retrieval tasks, forcing the construction of a Wiki brings no gain, and there are even cases where the Wiki is larger than the original documents. The original article mentions Borges’s short story in which a map is drawn at the same scale as the empire, precise to the point of having no abstraction. In one test, there was a 115KB document, and the Wiki Claude built was 203KB—1.77 times the original.

So the top-level context must be small. Claude Code’s automatic memory injects only the first 200 lines or 25KB of MEMORY.md into each session, using it as an index. Details sink to lower layers and are read only when needed. Injecting too much consumes tokens and dilutes attention. Long instruction files reduce compliance—developers should be familiar with this pitfall.
Multi-agent collaboration has pitfalls too. When reviewing acquisition contracts, multiple agents edited a shared table at the same time, overwriting each other; only 41 of 57 scoring facts survived, for 72% accuracy. After a dreaming review, Claude changed the rules to create a separate page for each contract, assign a single agent as owner, and quote core clauses verbatim from the source. On the next run, all 57 facts survived, for 100% accuracy. The second round of dreaming also fixed 9 dead links and added 3 new pages.

There is a judgment embedded in this design: a memory system must solve maintenance and indexing, with volume a lower priority. If you write a lot, erroneous notes will carry into the next session; if multiple agents write to shared memory, overwrites will silently devour facts; if the Wiki is too large, retrieval actually slows down. Dreaming trades background compute for memory quality, but compute is not free. When to write memory, how often to run dreaming, and how to prevent errors from accumulating are open questions left by the original article as well.
After reading the summary, an X user commented that AI dreaming also needs to keep a record of corrections; otherwise, yesterday’s misunderstanding could be written up tonight as ancestral doctrine. Someone in the comments also dropped a video and asked: “Dreaming?”
Original article: https://www.anthropic.com/research/components-of-agent-memory
X summary: https://x.com/hungryturbo/status/2118874895237185734
发布时间: 2026-11-07 11:28