The Components of Agent Memory
TL;DR Highlight
Giving Claude a memory folder plus dreaming lifted document QA scores from 13% to 48%
Who Should Read
Backend developer adding cross-session memory to a long-running agent whose notes just keep piling up
Core Mechanics
- Memory is a prediction about future needs
- Writing down a rule predicts that the pattern will matter again.
- Writing down a verified fact predicts a future session can rely on it without rechecking.
- Newer models close the learning loop
- On the CL-Bench database task, Sonnet 4.6 wrote theories but never tested them.
- Opus 5 was the first to record rules, how it knew them, and warnings about traps.
- Pokémon: 9 files beat 413 files
- Sonnet 3.7 wrote 413 memory files and earned 1 badge.
- Fable 5 wrote 9 files plus global.md and earned 4 badges.
- Info readable from the screen each turn, like money or location, was redundant to store.
- Tell it what memory is for, not how
- Just saying a memory folder exists noticeably boosted Opus 4.7 and Opus 5.
- A 'record only failures' rule made both lose much of their memory gain.
- Telling Sonnet 4.6 to read memory and test its theories nearly doubled its score.
- Dreaming (offline log review that reorganizes memory) fixes wrong notes
- Claude wrongly noted the PokéCenter's location and fell off the Mt. Moon ledge three times.
- After dreaming checked the note against the transcript, it re-entered the cave and reached Cerulean City.
- Dreaming-built wikis improve QA
- On about 350,000 Stainless files (about 420M tokens), 25 questions were evaluated.
- Scaling dreaming from 2 to 128 sessions raised graded criteria met from 13% to 48%.
- On single-document tasks the wiki gave no gain, and on one task the wiki grew larger than the source.
Community Reactions
- Memory stuck to a single project
- One commenter built a skill that reads past transcripts across agents and projects.
- They argue hindsight beats guessing what to store.
- They extended transcript retention because Claude deletes them after 30 days.
- Most auto-memories get deleted
- One commenter turned off auto memory and deletes about 95% of what Claude Code creates.
- They say notes are mostly relevant only to the current task and clutter context.
- Another uses a memory-prune skill to move notes into code comments, rules, or AGENTS.md, or delete them.
- Wiki+search seems cheaper and nearly as good as dreaming
- One commenter read Fig. 10 as wiki+search beating dreaming, with dreaming adding only marginal gains.
- They note that search being cheaper would matter a lot.
- Skepticism about quality and terminology
- Several commenters found models over-generalize and are poor at incremental memory.
- One pointed out that provenance is lost when memories are overwritten.
- Many criticized calling .md notes re-injected into context 'dreaming' as anthropomorphizing.
How to Apply
- Audit existing memory with transcripts
- Open your agent's memory folder and delete anything readable directly from the screen or logs.
- Use the prompt below to have the model judge which notes to keep.
- Tell the agent only what memory is for
- Write one line saying a memory folder exists and persists across sessions.
- Do not add fixed rules like 'record only failures'.
- For weaker models, add an instruction to read memory first and test theories.
- Run a periodic dreaming job
- After sessions, have a separate agent check note claims against transcripts and fix wrong ones.
- Make it mark confirmed rules versus unconfirmed guesses.
- Keep the injected top layer small
- Keep index files like MEMORY.md within 200 lines or 25 KB.
- Move details into lower files and leave links behind.
Try It
# Paste into Claude Code or Claude/ChatGPT (simplified version of the article's method: mimicking dreaming)
Below are an agent's memory notes and a session transcript.
[Memory notes]
{{memory notes}}
[Transcript]
{{session transcript}}
Do the following.
1. Check each note's claims against the transcript and mark them confirmed / wrong / unverified.
2. For wrong notes, write a corrected version with evidence.
3. Flag as deletion candidates any info that can be read directly from the screen or tools each time.
4. Condense the key notes to load every session into an index of at most 20 lines, with the rest as links to lower files.
Next step: put the resulting index into MEMORY.md and compare performance on the same task in the next session.Terminology
Related Papers
How I Fight AI Brain Fry
Keeping tickets in git and deciding in one inbox tamed my 20-thread agent chaos
Goldman Sachs is pulling Claude Code from its bankers and traders
Goldman limits coding agents to engineers, cutting off traders and bankers
Agent memory needs its OpenTelemetry moment
Agent memory formats are fragmented, so this post proposes an OpenTelemetry-style shared spec.
Goodbye Claude, hello Pi
Frequent system prompt changes and token overhead pushed one dev from Claude Code to Pi.
ChatGPT silently passes data between connectors and the bounty wants an ID card
With two connectors enabled, a follow-up tool call silently switched connectors
Claude Code sends your email address to websites
Claude Code put users' emails in curl User-Agent headers, prompting spam complaints and a built-in blocking mod
Launch HN: Rivet (YC W23) – Scale and Orchestrate Agents on S3
Running each agent as an Actor gave 4.99 ms p99 cold starts and 72 KB RAM per instance.
Show HN: Stroq – a local audit of what your coding agent did and why
Stroq finds leaked keys in agent sessions and traces risky commands to their source before they run