Anthropic Agent Memory Explained: Architecture, Dreams & CLAUDE.md

summarized

TLDR

Good agent memory is small, curated, and rewritten between sessions, according to Anthropic's 'dreams' feature and its Pokemon Red test. The Claude that saved 413 memory files fell behind one that kept a short dashboard, and the fix is an offline pass that checks saved notes against transcripts and rewrites them. The practical takeaway is to keep CLAUDE.md under 200 lines and let the agent curate its own memory.

Key points

Anthropic's 'dreams' feature checks saved notes against transcripts and rewrites mistakes between sessions.

In Anthropic's Pokemon Red test, the Claude that saved 413 memory files fell behind one with a short dashboard.

Anthropic's memory architecture has four layers, and automemory is capped at 200 lines while CLAUDE.md is not.

On the CLB benchmark, telling Claude a memory folder was available boosted performance.

On the CLB benchmark, a fixed rule to record only failures cost much of that gain.

Techniques

  • dreaming (offline memory reorganization)
  • four-layer memory architecture
  • closing the loop
  • sleeptime compute
Transcript (captions)

0:00 I expected the claw that saved 413 memory files to be winning at Pokemon Red. It was way behind a Claude that kept a short dashboard. If your coding agent forgets everything between

0:11 sessions and ignores the rules you keep adding to claude.md, that gap is your problem, too. Enthropics fix from a post on November 6th. Between sessions, Claude dreams.

0:22 That's their word for an extra pass that checks what the agent saved against what really happened, then rewrites it. What bugged me was the direction. The usual advice says more memory, smarter agent.

0:33 Here, the one that saved more fell behind. So, I went looking for what the winning Claude chose to save. That advice isn't silly. The open-source plug-in Claude Mem with over a 100,000

0:43 GitHub stars says it captures everything your agent does, compresses it, and injects the relevant parts into later sessions. Popular videos recommend the same fix, and forgetting does cost you,

0:54 but watch the file that loads every time. On the Claude AI subreddit, a user called Dev Moses added a rule each time Claude ignored one. Their Claude MD started at 45 lines. It ended at 190.

1:07 Trimming it back by their own report improve compliance right away. Underneath all of it is one question. What's worth writing down at all? By the end, you'll know Anthropic's four

1:18 layers. What a dream does to a wrong note and what to cut from your claw.md? Start with the run. About 10,000 steps in, each model had a memory folder through managed agents. Sonnet 3.7

1:30 assumed everything might matter and saved without choosing. Much of it, like the player's money and map position, was right there on the screen every turn. It had one badge and very thorough notes on

1:41 its own wallet. Fable 5 went small. It wrote a short list of files, plus one called global.md that Anthropic describes as a dashboard. That file held the current goal, a plan for the gyms

1:52 written in advance, and the model's own rules for using memory. Its other folders kept route plans and strategies it had learned. At the same point in the game, it had four badges. That's

2:02 Anthropic's own test, and it hasn't been reproduced independently. The pattern still easy to steal. The money and the map were free to look at every turn. The gym plan had to be worked out. Save what

2:13 you had to work out, not what you can see. Why would less memory win? Anthropic Post answers that by splitting memory into four layers. Picture them as a desk with drawers. The bottom drawer

2:25 holds transcripts, a searchable log of what happened in each session. That's the raw record. One drawer up are memory notes the observations Claude decides are worth writing down itself. Above

2:36 those sit memory representations, bigger organized structures like a wiki. Then the top of the desk, injected context loaded up front before any work starts. In cloud code, that's claude.md, which

2:49 you write, and automemory, which Claude writes for itself. Both load at the start of every session, and one of them has a cutoff, 200 lines, or a size cap, whichever comes first. I'd have guessed

3:01 that cutoff was for claude.md. It's automemies, not yours. Your claude.md doesn't get chopped at that line, so it can keep growing. Cloud codes docs as a dev writeup quotes them

3:12 say to aim for under 200 lines because longer files use more context and reduce adherence. The docs don't say why length hurts at the model level. Enthropic's case for keeping the top small is blunt.

3:25 Injected memories cost tokens each time. A wrong note gets carried into every session. And loading a note doesn't guarantee Claude acts on it. The cloud code docs say Claude treats these files

3:35 as context, not enforced configuration. That wrong note is where Pokemon comes back. Claude got mixed up about which side of the Pokemon center it was on, announced the mountain was behind it,

3:46 and wrote a note. Mount Moon done. It wasn't done. Left alone, a note like that gets loaded again and again. This mountain has history. David Hershey built the original Claude plays Pokémon

3:57 in 2025 to study how Claude handles very long tasks. in it. Sonnet 3.7, the same model that hoarded files in Anthropic's newer run once made its whole team faint to escape Mount Moon. After respawning,

4:10 it deleted all its Mount Moon notes, which is one way to fix a bad note. Anthropic's newer run had a better fix. During a dream, between sessions, Claude checked the note against the session

4:20 transcript. It caught the mistake. It rewrote the note with the corrected note. It went back into Mount Moon and reached Ceruan City. runs with the uncorrected note or with no memory at

4:31 all. Never got past the mountain. That's where my desk picture breaks. A real desk doesn't care whether your sticky notes are true. Here, the bottom drawer is the ground truth, and the notes on

4:41 top get tested against it. Mechanically, a dream is extra model work while the agent sits idle. The sleep part is only a name. The idea comes from sleeptime compute, a 2025 paper from Leta and UC

4:54 Berkeley where a model thinks about a context offline before any questions arrive. Anthropic version reads the logs and fixes mistakes. Then it writes notes, builds the wiki layer, and picks

5:04 what loads next session. Most of that work is keeping the desk clear. A dream promotes some notes up into what loads up front and moves details down the hierarchy, leaving a link where each one

5:15 used to be. Anthropic doesn't publish how a dream picks which notes reach the top or how often to run one. Then I read the dreams docs for cloud managed agents and they broke an assumption. I'd

5:26 pictured a cleanup job editing memory in place. A dream reads your existing memory store plus anywhere from one to 100 past transcripts. Then it writes a separate reorganized store with

5:37 duplicates merged. Stale entries replaced and new insights surfaced. The original is never modified so you can review the new one or throw it away. The same docs explain why dreams exist.

5:48 Writes during a session are local and incremental. So over many sessions, a store piles up duplicates, contradictions, and stale entries. A dream takes minutes to a few hours build

5:58 at standard token rates. So yes, your agents dreams come with an invoice. It's a research preview you have to request, and the docs don't list the steps a dream runs inside. Outside of games,

6:09 Anthropic's manage agents announcement describes Harvey, the legal AI company. Harvey's agents used Dreaming to remember five flight workarounds and tool specific patterns between sessions.

6:19 Completion rates were about six times higher in Harvey's own tests with no setup or baseline published. Look at what got remembered though. Workarounds, things that had to be figured out, which

6:29 brings back the question from the start. What's worth writing down at all? The clearest answer is in CLB, a benchmark for agents that keep learning across sessions. In the database task Anthropic

6:40 describes, every question starts in a fresh session, and only a memory folder carries over. When Claude gets one wrong, it can record the failure, come up with theories, test them, and turn

6:51 what holds up into a rule. Anthropic calls that closing the loop. Anthropic found opus 5 was the first model to close it. It saved a rule along with how it knew the rule was true. Sonnet 4.6

7:02 stored guesses it hadn't tested. Opus and Sonnet 5.5 closed it, too. And with memory, they landed about level with Opus 5. So write down what you worked out and how you know it's true. A guess

7:14 saved as a fact is just another Mount Moon done waiting to load. You'd think the next step is stricter rules about memory. Anthropic found the opposite. On CLB Bench, simply telling Claude a

7:25 memory folder was available gave Opus 4.7 and Opus 5 a noticeable boost. A fixed rule. Record only failures cost both models much of that gain. Tell the agent what memory is for and leave the

7:37 how-to the agent. What I changed today starts with your Claude MD. Keep it under 200 lines and cut anything the agent can just look up in the repo. Another Claude AI subreddit user

7:48 described the cost. The agent rereads the file every turn, so short stays cheap and long gets expensive. They'd also found rules of their own contradicting each other with no way to

7:58 tell which one was winning. Next, let the agent write its own notes. In cloud code, that's automemory. In managed agents, a dream goes further and tidies those notes for you across many

8:09 sessions. Point them at what they're for. Rules and plans worth keeping. The transcripts already the log. And every so often, read the top layer yourself. A dream hands you a story you can review

8:20 or throw away. So give your claw.md the same look. The docs say the more specific and concise your instructions, the more consistently Claude follows them. If you run a local agent, I'd

8:31 expect the same shape to carry over. A raw log at the bottom, a small file on top, and a pass between sessions that checks one against the other. That's my inference from the design. And none of

8:41 these sources test it on local models. Back to those two clouds. The one with 413 files had memory to spare and still fell behind. The one with a short dashboard knew its goal, its plan, and

8:52 its own rules. My call, good agent memory is small, curated, and rewritten between sessions. If you're on cloud code with a longclaw.mmd, trim it before you install a plugin. If

9:03 you're building on managed agents, request dreams access and read the first store it writes before you trust it. So, what's in your claw.md right now? Count the lines and put that number in the

9:14 first rule you'd cut in the comments.

Frontier News · by Hyperjump Technology