On November 6, 2026, Anthropic published new research on how Claude agents remember things between sessions. The headline idea is “dreaming”: the agent reviews its own logs in idle time and rewrites its memory notes.
The results are striking. One internal wiki test jumped from 13% to 48% after 128 dreaming sessions. This post explains the research in plain English and shows how to use the same idea with Claude Code and CLAUDE.md today.
- The paper: “The components of agent memory” on Anthropic’s research site, by Lance Martin, dated November 6, 2026.
- Dreaming: an offline pass where Claude checks memory notes against session transcripts, fixes mistakes and reorganises what it keeps.
- Memory judgment: in a Pokémon Red test, Sonnet 3.7 wrote 413 files and won 1 badge. Fable 5 wrote about 10 files and won 4.
- Newer models learn better: Opus 5 was the first tested model to “close the loop” on a database task.
- Try it: Dreams are a research preview in Claude Managed Agents. You can copy the idea in Claude Code with a short review routine for MEMORY.md and CLAUDE.md.
What Anthropic means by dreaming
Anthropic defines agent memory as knowledge Claude gains from experience that it can read in later sessions. It does not mean changing the model’s weights, and it is not the same as compaction inside one chat.
The hard part, the paper says, is that an agent “has to decide what’s worth remembering before it knows what’s next.” Notes written in the middle of a task are often wrong, messy or too detailed.
Dreaming fixes that after the fact. When the agent is idle, Claude reads back its session transcripts, checks its notes against them, and then tidies up.
- Inputs: past transcripts plus the existing notes and wiki pages.
- Outputs: corrected notes, new notes, merged duplicates, new index pages and a trimmed set of always-loaded context.
- When: between sessions, not while the agent is doing real work.
The name comes from how human memory replays the day during sleep. Anthropic credits the earlier “sleep-time compute” idea from Letta and UC Berkeley researchers.
The four layers of agent memory
The paper describes memory as a stack. Each layer is smaller and more processed than the one below it.
| Layer | What it is | Claude Code example |
|---|---|---|
| 1. Transcripts | A searchable log of everything that happened | Session history in ~/.claude/projects/ |
| 2. Memory notes | Short observations Claude chose to save | Topic files in the auto memory folder |
| 3. Memory representations | Structured forms like a wiki of linked pages | A docs/ folder of linked notes |
| 4. Injected context | Loaded into every new session automatically | CLAUDE.md and the top of MEMORY.md |
The paper stresses that the top layer “has to stay relatively small.” Everything in it costs tokens on every session, and it does not guarantee Claude will follow it.
The key results in numbers
Anthropic ran several internal experiments. These are the numbers that matter most.
| Test | Result |
|---|---|
| CL-Bench database task, Opus 5 | Mean reward rose from 0.564 to 0.828 with memory |
| CL-Bench, Opus 5.5 | 0.655 to 0.838 with memory |
| CL-Bench, Sonnet 4.6 | Only 0.330 to 0.364, rising to 0.641 with better instructions |
| Stainless internal wiki (about 350,000 files) | Wiki-only score rose from 13% to 48% over 128 dreaming sessions with Opus 5 |
| Same wiki plus search | 61%, against 53% for search alone, and about 20,000 fewer tokens per question |
| Harvey LAB merger questions (24) | 87% with a wiki, 73% with search alone |
| Pokémon Red Mt. Moon run | With dreaming, a wrong note was fixed and the run reached Cerulean City. Without it, it never did |
Note: These are Anthropic’s own tests, and the Pokémon runs were one run each. Treat them as strong signals, not final proof.
Why newer models write better memories
The most quoted part of the paper compares how models decide what to save. It is a test of memory judgment, not a test of a judge model scoring others.
Sonnet 3.7 vs Fable 5 in Pokémon Red
- Sonnet 3.7: after about 10,000 steps it had written 413 files across 225 folders, nearly 978,000 characters, and earned one badge. The paper says it “assumed everything might matter.”
- Fable 5: wrote about 10 files, around 43,000 characters, including a
global.mddashboard, and earned four badges. It saved strategy and rules, not raw state. - Opus 5.5: kept a small folder of goals and next steps and beat the game.
Closing the learning loop
On the CL-Bench database task, each question started a fresh session with only a memory folder carried over. Older models wrote guesses but never tested them.
Opus 4.7 began marking which facts were checked. Opus 5 was the first to close the loop, writing rules, past answers and warnings about traps. Opus 5.5 and Sonnet 5.5 did the same.
Lessons for anyone building agents
The paper ends with practical advice. Here it is in short form.
- Say what memory is for: tell the model the goal, then let a strong model decide how to use it.
- Avoid rigid rules: “record only failures” cut Opus 5’s memory gain by 0.234.
- Help weaker models: tell them to read memory before answering and to test their theories.
- Use transcripts as truth: when reviewing notes, check them against what really happened.
- Keep the top small: use an index file that links to deeper notes.
- One page per item: parallel agents writing to one shared table kept only 72% of facts. One page per contract hit 100%.
- Quote, do not paraphrase: copy key terms verbatim.
- Pair a wiki with search: a wiki alone scored below search, but both together did best.
How to apply dreaming in Claude Code
Claude Code already has two memory layers. CLAUDE.md files hold your instructions, and auto memory (on by default since v2.1.59) stores Claude’s own notes in ~/.claude/projects/<project>/memory/.
Only the first 200 lines or 25 KB of MEMORY.md load at the start of each session. Topic files load on demand. That is exactly the “small top layer” the paper recommends.
Claude Code has no built-in dream command, but you can run your own review pass. Here is a simple routine.
- Finish a work session. Do this at the end of the day or after a big task, when you are not in a hurry.
- Open your memory. Run
/memoryto see every loaded CLAUDE.md, rules file and the auto memory folder. - Start a fresh session. Run
claudein the same repo so the review has a clean context. - Ask for a dream pass. Use a prompt like the one below. It mirrors the paper’s steps.
- Review the diff. Read the changes before you accept them. If your memory folder is in git, commit after each pass.
- Repeat weekly. Focus on notes about things that change, like APIs, versions and team rules.
Review my auto memory folder and CLAUDE.md like an offline "dream" pass.
1. Check each note against the code and recent git history. Fix anything wrong.
2. Merge duplicates and delete stale notes.
3. Keep MEMORY.md as a short index under 200 lines that links to topic files.
4. Move long detail out of CLAUDE.md into .claude/rules/ or topic files.
5. Quote exact commands and names. Do not paraphrase them.
6. Show me a summary of every change before saving.
Tip: Run this as a dedicated subagent with only Read, Grep, Glob and Edit tools. My Claude Code subagents guide shows how, including the memory field that gives an agent its own memory folder.
What about the Claude app?
In the Claude apps, memory is a set of individual, categorised entries that Claude reads and updates. Since August 25, 2026 it works across chat and Cowork, and you can edit topics under Settings > Memory.
The same idea applies there. Every few weeks, open Settings > Memory and delete or fix anything outdated. For project-level context, my Claude Projects guide explains how project knowledge works.
Dreams in Claude Managed Agents
For developers, Anthropic offers dreaming as a real API feature. Dreams are a research preview in Claude Managed Agents, first announced on May 19, 2026.
- Inputs: one memory store plus 1 to 100 past sessions.
- Output: a brand new memory store. The input store is never changed, so you can review before using it.
- Time: usually minutes to a few hours.
- Cost: standard API token rates for the chosen model. Cost grows with the number and length of sessions.
- Access: request it through Anthropic’s Managed Agents form. It needs the
dreaming-2026-04-21beta header, which the SDK sets for you. - Compliance: not ZDR or HIPAA eligible during the preview.
dream = client.beta.dreams.create(
inputs=[
{"type": "memory_store", "memory_store_id": store_id},
{"type": "sessions", "session_ids": [session_a, session_b]},
],
model="claude-opus-5-5",
instructions="Focus on coding-style preferences; ignore one-off debugging notes.",
)
Harvey reported completion rates up about 6x in its own tests with dreaming. For building agents in code, see my Claude Agent SDK guide and my Claude API pricing guide for token costs.
My Take
The big lesson is simple. Memory is not about saving more. Sonnet 3.7 saved almost a million characters and did worse than Fable 5 with about 43,000.
For everyday Claude Code users, the best move is to treat CLAUDE.md and MEMORY.md like a garden. Prune them often, keep the top short and check notes against reality.
Dreams in Managed Agents are still a preview, but the routine above gives you most of the benefit today, for free.
Troubleshooting memory problems
Claude ignores my CLAUDE.md
Long files reduce adherence. The docs suggest under 200 lines per CLAUDE.md. Move detail into .claude/rules/ or topic files.
Claude keeps repeating an old mistake
A wrong note is probably being reloaded. Search your auto memory folder for it and fix or delete it, as dreaming did for the Mt. Moon note.
Auto memory is not saving anything
Check you are on v2.1.59 or later and that autoMemoryEnabled is not false. Also check CLAUDE_CODE_DISABLE_AUTO_MEMORY is not set.
Notes are cut off at session start
Only the first 200 lines or 25 KB of MEMORY.md load. Turn it into a short index that links to topic files.
My memory differs between machines
Claude Code auto memory is machine-local. Keep shared knowledge in a committed CLAUDE.md or .claude/rules/ instead.
A Managed Agents dream failed
Do not archive or delete the input store or sessions while a dream runs. That causes input_memory_store_unavailable or input_session_unavailable errors.
Frequently Asked Questions
What is Claude dreaming?
It is an offline process where Claude reviews past session transcripts in idle time, fixes its memory notes and reorganises them. Anthropic describes it in its November 6, 2026 research post.
Did Opus 5 and Fable 5 judge memories better than Sonnet 3.7?
They showed better judgment about what to save. In Pokémon Red, Fable 5 kept about 10 files and won four badges, while Sonnet 3.7 kept 413 files and won one. Opus 5 was the first model to fully close the learning loop on CL-Bench.
Can I use dreaming in Claude Code?
There is no built-in dream command. You can run a manual review pass with a prompt, as shown above, against your auto memory and CLAUDE.md files.
Is Dreams in Managed Agents available to everyone?
No. It is a research preview, and you request access through Anthropic’s Managed Agents form.
Does dreaming change the model itself?
No. It only edits readable memory such as notes and wiki pages. The model’s weights stay the same.
How much does a dream cost?
It is billed at standard API token rates for the model you pick, and cost grows with the number and length of input sessions.
Where does Claude Code store auto memory?
In ~/.claude/projects/<project>/memory/, with MEMORY.md as the index. You can change it with the autoMemoryDirectory setting.
Sources
- Anthropic: The components of agent memory (Nov 6, 2026)
- Claude Platform docs: Dreams in Managed Agents
- Anthropic: New in Claude Managed Agents, dreaming, outcomes and orchestration
- Claude Code docs: Memory
- Claude Help Center: Release notes
- Let’s Data Science: Anthropic details how Claude uses dreaming




