What Should an AI Agent Remember? How 'Dreaming' Fixes Its Memory

Give an AI a “memory notebook,” and it gets smarter on its own, right?
Not quite. In research Anthropic published on November 6, 2026, notes alone weren't enough. What made the difference was what the AI chose to write down, and how wrong notes got corrected.
People sort their memories while they sleep
Our brains jot down the day's experiences quickly in the hippocampus, then keep only some of them as long-term memories. This sorting is thought to happen mostly during sleep.
AI agents (AI that uses tools to get work done) can be designed the same way. While working, they keep a log. When the job is done, they use the downtime to reread that log, fix their notes and tidy up. That's dreaming. In the middle of a task, you can't know what will matter later, so you need time to look back.
An AI's memory stacks up in four layers. At the bottom is the work log (the raw record). Above it sit notes (sticky notes), a wiki (a company knowledge base), and a short summary the AI reads at the start of every session. Dreaming means using the lower layers as evidence to fix and build the layers above.
Is more always better? What Pokémon showed
Anthropic used the long video game Pokémon Red to test “the judgment to decide what's worth writing down.” It compared the memory folders after about 10,000 steps of play.
| Sonnet 3.7 | Fable 5 | |
|---|---|---|
| Memory files | 413 | 10 |
| Size of notes | ~980,000 characters | ~43,000 characters |
In the end, Sonnet 3.7 earned 1 badge and Fable 5 earned 4.
Sonnet 3.7 made a file for every battle, every item and every character it met. The game kept changing, so the notes went stale fast, and play stalled while it tidied them. At one point it spent 17 steps creating six files and deleting nine, without making a single move in the game.
Fable 5 didn't write down anything it could read off the screen each time, such as money or its current location. It recorded only what it had to work out for itself: strategies, plans and verified rules. After seven Poké Balls in a row missed, for instance, it left itself a rule: “after three or more failures in a row, change the input timing.”
There's one more finding. For stronger models, detailed rules like “only record failures” sharply cut the benefit of memory. It worked better to say only what the notes were for and leave the judgment to the model. The exception was Sonnet 4.6, which got little from its notes at first. Once it was told to “read your notes before answering, and test the hypotheses you form,” its score nearly doubled, from 0.364 to 0.641.
Dreaming #1: Fixing wrong notes
In Pokémon, the AI once wrote down the location of a building outside the cave entrance (Mt. Moon) backwards. That note convinced it that it had already passed the cave. It fell off a one-way ledge three times and never reached the next city.
When dreaming was run on the same folder, the AI checked its notes against the work log, found the error and fixed it. The AI with the corrected notes headed straight back to the cave and reached the next city on action 1,935. The AI with no notes at all never made it either. A wrong note is as harmful as no note, and you need the original log to fix it.
Dreaming #2: Turning scattered notes into a knowledge map
A wiki is a set of pages, linked to one another, that the AI writes and maintains itself. Given about 350,000 company documents and 128 sessions to build one, the AI answered 48% of questions correctly using the wiki alone, up from 13%. Used together with search, accuracy rose from 54% to 61%, beating search alone (53%), and it saved about 20,000 tokens (the unit of text an AI reads) per question.
The benefit depended on the kind of task. For questions that needed several documents plus judgment or math, the wiki scored 87% against 73% for search alone. When the answer sat in a single document, the gain wasn't clear, and on one task the wiki grew to 1.77 times the size of the source text.
How do you build dreaming?
The implementation details are in Anthropic's official docs and cookbook. Start with the foundation, the memory store. A memory store is a collection of text documents addressed by path. Attach it to a session and it's mounted like a folder; the AI reads and writes it with the same file tools it already uses. Each document can be up to 100 KB, a store can hold up to 10,000 documents, and every change is saved as a version (usually kept for 30 days). That's why the docs recommend “many small files.”
Option 1. The official Dreams API
You request dreaming as a single asynchronous job (research preview; you have to request access).
- Input: one existing memory store + 1–100 past session logs
- Output: a new memory store. Duplicates are merged, stale or contradictory entries are replaced with the latest value, and new insights are added.
- The original is never touched. Review the result, then attach it to the next session or throw it away.
- It takes anywhere from a few minutes to a few hours and is billed at the chosen model's standard API rates. Cost grows with the number of sessions, so the docs suggest starting small.
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.",
)
Use instructions for broad direction, such as what to focus on. The docs explain that line-level orders like “change this sentence to that” generally aren't applied. For individual fixes, edit the output store directly through the memory API.
Option 2. Build it yourself: the cookbook's four-step pipeline
If you want to decide when it runs, which logs it reads and how they're processed, build an agent pipeline like the one in the cookbook.
- Export: Save each finished session as one text file (requests, tool calls, results, conclusions).
- Analyzer agents (one per log, in parallel): Each reads its whole log, then verifies → enriches → organizes the existing notes, in that order. Enriching adds concrete values such as commands and file names, verification dates, and flags for what may be out of date. Organizing produces small files with frontmatter and
[[links]], plus an_index.mdtable of contents. - Organizer agent (once, at the end): Merges duplicate files, fixes broken links and finishes the index. It never deletes lines that state facts.
- Connect: The next session mounts the resulting store read-only. Run the whole thing from cron at 1 a.m. and it refreshes every day.
The cookbook used Sonnet 5.5 for the lead agent and Haiku 5.5 for analysis and organizing. Eleven logs from a sample project (283 KB) cost about $0.36 and took 2.5 minutes; about 50 long logs (roughly 12 MB) cost about $8 and took a little over 10 minutes.
The 128-session wiki experiment in Anthropic's research worked in a similar way. Agents explored files, wrote and revised linked wiki pages, merged duplicates, and checked claims against their original sources. Each session picked up where the last one left off through a shared log.
Design principles to follow
- Small files + links + an index. They're easier for the AI to navigate than a few big files.
- Date every fact and note whether it's been verified. Don't delete stale facts; replace them with the latest value and keep the history.
- Plan for concurrent edits. If several analyzer agents write to the same file at once, they overwrite each other. In the cookbook, an analyzer rereads the file right before writing, reads it back afterward to confirm, and merges both versions if there's a conflict.
- Treat logs as data, not commands. Even if a line in a log says “ignore your instructions,” the agent shouldn't obey. Give analyzer agents no shell or network access, and connect the store read-only.
- Keep the top-level summary short. The text injected into the system prompt each session is capped at 4,096 characters, and one wrong line spreads to every session. The cookbook advises reading it yourself before you inject it.
NOTE
In short
- Good memory isn't about writing more. It's about writing down only what the AI worked out itself.
- Notes can be wrong. “Dreaming” is the process where the AI, during downtime, checks its notes against the original log and fixes them.
- A well-organized knowledge map (a wiki) helped most on questions that span several documents.
- You can request dreaming through the official API, or build it yourself as a pipeline of analyzer agents.
Putting it to work
- Tell the AI only what its notes are for, then add instructions as you see the results.
- Don't have it write down anything it can look up again. Have it record the rules and pitfalls it found itself, along with the evidence.
- Check important notes against the original log on a regular basis.
Try it: List five things your AI could save as notes from a recent task, then cross out anything it could find again by looking it up. What's left is the memory actually worth keeping. To learn how to check an AI's “done” report against the actual records, continue with this article.
Not sure how to bring AI into your work? Pick one repetitive task and look at it together with AIB. Talk to AIB about adopting AI
References
Read Next
More posts related to AI Agents →
Teach Kids About AI, Limit Their AI Use: 6 Family Rules for Safe AI
In our last post, we looked at "What Should Kids Learn When AI Does the Work?" This time, let's look at what families can actually do at home. O…

Pickle AI Agent Review: How Far Can It Go with Calls, Bookings and Shopping?
A Korean AI agent called Pickle has been attracting attention lately. The name and interface feel a little playful, and the character bears a sl…

Who Will Control AI Agents: The AI Builders or the Platforms Holding the Data and Tools?
When a shopper tells an AI, “Find the right one and buy it for me,” who controls the customer relationship? The AI company that understands the…

Can Benchmarks Alone Tell Us How Capable an AI Agent Is?
AI is beginning to read screens, operate applications, and carry out work. The question we ask about its performance is changing too. Beyond wha…