Source: The components of agent memory (Anthropic Engineering, published 2026-11-06, written by Lance Martin), saved in full at ai-research/anthropic-research-components-of-agent-memory-2026-11-06.md. Cross-checked against the Dreams API docs (ai-research/claude-platform-docs-managed-agents-dreams-2026-11-17.md) and the Claude Code memory docs (ai-research/claude-code-docs-memory-2026-11-17.md).
Anthropic’s engineering post lays out how it thinks about agent memory: a four-layer hierarchy (transcripts, memory notes, memory representations such as wikis, and injected context) with dreaming as the offline process that moves and corrects information between layers. It is the first Anthropic source in this wiki with benchmark numbers for memory and dreaming: CL-Bench 1.0, Pokémon Red runs, a 420M-token internal corpus, and the Harvey LAB legal benchmark. The findings bear directly on how to prompt for memory, how to run Dreams in Managed Agents, and how to build an LLM-maintained wiki like this one.
Key Takeaways
- Memory is a four-layer hierarchy. Bottom to top: transcripts (a searchable event log), memory notes written by Claude, memory representations such as wikis, and injected context loaded into every session. Dreaming runs from transcripts up to each layer and between neighbouring upper layers.
- Scope of “agent memory”. Knowledge Claude gains from experience and retains between sessions as context it can read later. It excludes weight changes, in-context learning within one conversation, and compaction.
- Newer models write far better memory. On a CL-Bench 1.0 database task run on Claude Managed Agents, mean reward without and with a memory store was: Opus 5.5 0.655 → 0.838, Sonnet 5.5 0.644 → 0.833, Opus 5 0.564 → 0.828, Opus 4.7 0.383 → 0.700, Sonnet 5 0.306 → 0.610, Sonnet 4.6 0.330 → 0.364.
- Opus 5 was the first to “close the loop”. Its entries held a rule, how it knew the rule was true, answers to earlier questions, and warnings about traps. Sonnet 4.6 left scattered files of untested guesses; Opus 4.7 consolidated into one reference document and marked checked versus unconfirmed facts.
- Less memory, better judged, wins. About 10,000 steps into Pokémon Red, Sonnet 3.7 had written 413 files in 225 folders (977,930 characters) and earned one badge; Fable 5 had written nine files in two folders plus
global.md(43,406 characters) and earned four. Opus 5.5 kept a similarly small folder and beat the game. - Store what cannot be read off the environment. Sonnet 3.7 saved money and map position, which the screen shows every turn. Fable 5 saved strategy, plans and tested rules, which exist only if written down.
- Tell Claude what memory is for, not how to use it. Telling Opus 4.7 and Opus 5 only that a memory folder was available was enough. A fixed rule, “record only failures”, cut their gain from memory (Opus 5 −0.234, Opus 4.7 −0.150, Sonnet 4.6 −0.020).
- Steering helps older models most. Prompting Sonnet 4.6 to read memory before answering and to test its theories raised it from 0.364 to 0.641. Sonnet 5 read memory first 9 times in 10 unprompted; Sonnet 4.6 did so less than half the time.
- Dreaming corrects wrong notes against transcripts. A wrong note about a PokéCenter’s location sent Claude off a one-way ledge three times and the run never reached Cerulean City. After a dream checked the note against the session transcript and rewrote it, the run reached Cerulean at action 1,935.
- A dreamed wiki plus search beats either alone. On 25 questions over about 350,000 internal Stainless files (roughly 420M tokens), scaling dreaming from 2 to 128 sessions raised wiki-only scores from 13% to 48% of graded criteria. Wiki plus search rose from 54% to 61%, against 53% for search alone, and saved about 20,000 tokens per question.
- Wikis help on cross-document questions, not single-document lookups. On merger questions that needed several documents, judgment or arithmetic, Claude scored 87% with the wiki against 73% with search alone. On a LAB task where most criteria sat in one document, the wiki showed no clear gain.
- A wiki can grow larger than its sources. On one LAB task the wiki reached 68 pages and 203 KB from a 115 KB corpus (1.77 times), abstracting nothing.
- One agent per page, quote terms verbatim. Several agents writing one shared table of contract terms overwrote each other; 41 of 57 graded facts survived. One page per contract, one agent per page, terms quoted word for word: 57 of 57.
The memory hierarchy
| Layer | What it holds | How it is filled |
|---|---|---|
| Injected context | Notes loaded into every session | Dreaming promotes notes up; the harness preloads them |
| Memory representations | Wikis: linked pages gathering what Claude knows on a subject | Dreaming builds and prunes them over many sessions |
| Memory notes | Salient observations, rules, verified facts | Claude writes them in-session; dreaming corrects them |
| Transcripts | Searchable event log of sessions | Recorded automatically; the ground truth dreaming checks against |
- Memory as prediction. Writing down a rule predicts the pattern will matter again; writing a verified fact predicts a future session will rely on it without re-checking.
- The top layer must stay small. Injected memories use tokens, an incorrect note is carried into every session, and loading a note does not guarantee Claude acts on it. Much of dreaming’s work at this layer is moving detail down the hierarchy and leaving links behind.
- Claude Code does the same in-session. Auto memory loads only the first 200 lines or 25 KB of
MEMORY.md, which serves as an index of what Claude knows and where to find it.
What dreaming does, per the post
- Corrects memory. Tests notes against the original transcripts and rewrites the ones that are wrong or have drifted.
- Builds representations. Writes and maintains wiki pages, merges duplicates and checks claims against sources. In the Stainless test, Opus 5 agents built on earlier sessions and coordinated through a shared log.
- Promotes notes. Floats notes to the injected layer so Claude does not need to search for them, or know there is something to search for.
- Focuses memory on a goal. Instructions tell Claude what information matters. For Claude Duet, memory is organized around the person it helps. See Claude Duet.
- Fills gaps a single session leaves. A second pass on one LAB wiki found nine links to a page that did not exist, repointed them to the existing page for the same document, and added three pages including an index (38 entries and 225 links became 41 and 278).
- Improves its own instructions. A loop in which Claude reflected on failures, proposed a change to the wiki-building instructions and rebuilt the wiki is how the one-page-per-contract rule was found (72% to 100% of criteria).
Limits and open design questions the post names
- When to write. In-session notes capture salience at the source but pull attention from the task. Dreaming moves the work to the background, but its output may not be available immediately.
- Keeping memory current costs compute. Checking every memory continuously may not be practical. The post suggests focusing dreaming on information likely to change, or tuning cadence, for example by how often memories are accessed.
- Transcript search as the foundation. Combining representations with search can be effective, but representations need compute to maintain and can accumulate errors or hallucinations.
- Single runs. The Pokémon comparisons are one run per model, and the Mt. Moon correction is one demonstrated case.
What this means for this wiki’s own pattern
- The design matches. A wiki written and maintained by the model, linked pages, an index, claims checked against sources, duplicates merged, and a shared log are all named in the post as parts of Anthropic’s wiki-building runs. This vault uses the same parts (
raw/andai-research/as sources,wiki/log.md, lint passes). - Keep search. The wiki-alone score (48%) stayed below search alone (53%); the gain came from using both. That supports keeping QMD retrieval over the vault and not relying on index navigation alone.
- Watch the size ratio. A wiki larger than its sources abstracts nothing. Articles that restate a source at near full length are the same failure.
- Quote, don’t summarize, where exact terms are graded. Prices, limits, version numbers and contract-style terms are the equivalent here.
Try It
- Trim memory prompts for current models. In an agent’s system prompt, say a memory folder exists and what it is for. Remove fixed rules about what to record, then compare results on your own task.
- For older or smaller models, add two instructions: read the memory files before answering, and test theories before recording them.
- Audit a memory folder against the Pokémon test. Delete notes that restate what the agent can read from its environment each turn. Keep goals, plans and tested rules.
- Run a dream over a real store. With Managed Agents access, pass a memory store and a small batch of session IDs to the Dreams API, then diff the output store against the input before attaching it.
- Building a wiki with several agents: give each agent its own page and have it quote source terms. Run a second pass to repair links to pages that were never created.
- Start from Anthropic’s cookbooks. Dreaming with a dynamic workflow and the knowledge-wiki quickstart. Neither has been read or run for this article.
A creator’s /dream skill for Claude Code and Cowork memory (2026-11-17 addition)
Source: raw/Anthropic_Just_Revealed_How_To_10x_Your_Claude_Memory.md · Creator: Ben AI (channel confirmed from YouTube metadata; he introduces himself as a three-time founder who runs an AI agency and a second-brain app; see also the setup detox skill) · URL: https://www.youtube.com/watch?v=uYdbxzxRWl8 · Platform: YouTube · Duration: 16:16 · Uploaded: 2026-11-17
Ben summarises the post above for non-technical users and offers a free /dream skill that applies the dreaming idea to local Claude memory. Dreams is a Managed Agents API feature; his skill is a community recreation for the desktop app, not an Anthropic product. The skill file was not fetched or run for this article.
His numbers against the post
| Ben says | The post says |
|---|---|
| Memory took Opus 5.5 “from about 66% to 84% on the same task” | Mean reward 0.655 → 0.838 on one CL-Bench 1.0 database task. A reward score, not a percentage of tasks |
| Dreaming over more sessions took answers “from 13% to 48%“ | Matches the wiki-only result, 2 to 128 sessions. He leaves out that search alone scored 53% and wiki plus search 61% |
| “Fewer memory files often work better” | Matches the Pokémon Red comparison |
| Rules like “save only failures” made strong models worse | Matches (“record only failures”: Opus 5 −0.234) |
| Anthropic “splits a dream across three types of agents, a lead, analyzers, and an organizer” | Not in the post or the Dreams API docs held here. It may come from Anthropic’s dreaming cookbook, which has not been read |
Where he says Claude memory lives
- Settings → Manage memory. His claim: this store is used only by Cowork in the browser, and he finds it “pretty stale and quite random.” See Claude Memory in Three Levels.
- Global
~/.claude/CLAUDE.md. Rules for every chat; his is 87 lines. He says Claude updates this file automatically. The Claude Code docs list CLAUDE.md files as written by you and auto memory as written by Claude, so the docs win here. - Project
CLAUDE.md. Mostly a map of the folder plus project rules. His second-brain folder’s file routes to over 15,000 files. - Auto memory.
~/.claude/projects/<project>/memory/MEMORY.mdis an index of one-line pointers to topic files, opened only when needed. Before his first run he had one index and 124 topic files. This matches Auto Memory, including the 200-line load limit.
What the skill does, as he describes it
- Setup questions. Which project folders to dream over (or only the built-in memory), whether there is a shared team folder, whether it may propose lines for the global CLAUDE.md, and the model. All agents default to Sonnet.
- Lead. Finds every chat since the last run (seven days on the first run), strips tool calls so only prompts and replies remain, removes keys and passwords, groups chats by type of work, and backs up current memory before any change.
- Analyzers, one subagent per group, in parallel (seven in his run). Each checks old notes against the chats and fixes a topic file a chat proves wrong, keeping one line with the old version. Each writes new lessons as topic files, proposes lines for the global or team CLAUDE.md when the same correction recurs, and holds back anything it is unsure of for review. Analyzers never touch
MEMORY.md. - Organizer. Runs once and is the only agent that edits
MEMORY.md. It merges duplicate topic files, rewrites the index grouped by topic at one line per file under 200 lines, and proposes moving notes that are really global rules into the global CLAUDE.md. He says the CLAUDE.md promotion step is his own addition to Anthropic’s design. - Dedup pass over the proposed CLAUDE.md lines.
- Review page. One HTML page lists every change; you keep, revert or comment on each. CLAUDE.md files are only changed after you approve. Reverts and comments are fed into the next run.
- The analyzers’ one instruction, which he ties to the post’s “say what memory is for” finding: save lessons learned the hard way that are still true and not already written down elsewhere, such as in a skill or project instructions.
- Schedule. The skill creates a scheduled task; he suggests nightly at 9 p.m. or weekly. It runs on your computer, so the Claude app must be open and the machine awake.
- His first run: 35 chats in under six minutes, 30 changes, seven stale notes found, nine rules proposed, five pairs of duplicates merged, 11 new lessons, six lines proposed for the global CLAUDE.md and three for a team CLAUDE.md, with the index regrouped from one flat list into seven groups. One fix: a note said he was on an image tool’s paid plan; a later chat showed he was back on the free plan.
Use it: the parts worth copying without his skill are the backup before any change, the rule that only one agent writes the index, the review page before CLAUDE.md edits, and the analyzers’ single-purpose instruction. ^[inferred] Before scheduling any nightly memory rewrite, note the post’s own caution that representations can accumulate errors or hallucinations (see Limits above), and that nothing here measures whether his skill improves output.
Open Questions
- Is the lead, analyzers and organizer split Anthropic’s? Ben attributes it to Anthropic; neither first-party source here names those roles.
- Does Settings → Memory apply only to Cowork in the browser? Ben’s claim, not checked against the Help Center.
- CL-Bench 1.0 details. The post gives scores for one database task. The benchmark’s full task set, sample sizes and variance are not in the source.
- Cost of the 128-session wiki build. The chart’s axis runs from 2M to 128M dreaming tokens; the post gives no dollar figure.
- Question-set size. The Stainless evaluation is 25 questions and the merger set is 24. Confidence intervals are not reported.
- How Fable 5.2 and Opus 5.5 compare on wiki building. The wiki runs used Opus 5 agents only.
- Cadence guidance. The post raises tuning dream frequency by memory access rate but gives no recommended schedule.
Related
- Claude Dreaming — the Managed Agents feature, including the Dreams API reference.
- Auto Memory — Claude Code’s in-session version of the small injected layer.
- Agents That Remember — Memory Stores + Dreaming — the London workshop on the same primitives.
- Memory and Dreaming for Self-Learning Agents (Mahes) — the storage, structure and process framing.
- Managed Agents in Production (Jess + Lance) — the post’s author on the Managed Agents primitives.
- AI Agent Memory Architectures — Three Vendor Takes — where this fits against Hermes and Auto Memory.
- Claude Code Memory Architectures Compared — storage, injection and recall across three Claude Code memory systems.
- Karpathy’s Wiki vs. Open Brain — ingest-time versus query-time synthesis, the same trade the wiki-plus-search result measures.