# The components of agent memory
<!--
ref: @content/web/anthropic/2026-11-06-components-of-agent-memory
tags: [agent-memory, memory-consolidation, dreaming, agent-wikis, long-running-agents, evaluation, claude-code]
version: 2
updated_at: 2026-11-21T17:13:33.928Z
-->

**[Read the original](https://www.anthropic.com/research/components-of-agent-memory)**


*Synthesized from Lance Martin's article on Anthropic, 2026-11-06.*

The Anthropic Engineering article argues that agent memory should be treated like the brain's offline consolidation: agents review logs and transcripts, fix mistakes, write notes, build representations and decide what is loaded into future sessions. It uses Pokémon Red runs, a 350,000-file corpus from Stainless and a contract-facts test to show when memory helps and when it adds noise.

## Core Thesis

Lance Martin argues that writing a memory is a bet that it will be useful later, so the hard parts are judging salience, steering what gets written, and correcting memory once it is wrong. Dreaming, a background consolidation pass over past logs, is presented as the mechanism that keeps memory accurate and useful over time.

## Key Insights

- **Dreaming consolidates memory.** Agents reflect on logs and transcripts to fix mistakes, write notes, build representations and shape what loads into future sessions. The article says that "Claude can use dreaming to organize memory."
- **Memory as prediction.** On the CL-Bench database task, Claude Opus 5 was the first model to close the learning loop, and later models matched its performance.
- **Salience matters more than volume.** In Pokémon Red, Sonnet 3.7 wrote 413 memory files and earned one badge. Claude Fable 5 wrote nine files plus a `global.md` and earned four badges. The article says Sonnet 3.7 "assumed everything might matter and wrote to memory indiscriminately."
- **Steer with purpose, not rigid rules.** Telling Claude what memory is for works better than prescribing rules. A "record only failures" rule reduced gains for Opus 5 and Opus 4.7.
- **Dreaming corrects bad notes.** In Pokémon, dreaming caught a wrong landmark note that had sent Claude back over a ledge. With the corrected note, Claude reached the next city.
- **Wikis beat raw search on large corpora.** On a 350,000-file Stainless corpus, accuracy on 25 questions rose from 13% to 48% over 128 dreaming sessions. Wiki plus search reached 61%, against 53% for search alone. In one case the wiki grew larger than the source files.
- **Per-entity pages keep facts intact.** Giving each contract its own wiki page, with terms quoted word for word, raised graded facts captured from 72% (41 of 57) to 100% (57 of 57).
- **Open questions remain.** The authors discuss when to write memory during a task versus in background dreaming, how to keep memory current, and how to balance transcript search with maintained representations.

## Actionable Takeaways

- Run a background consolidation pass over logs or transcripts, rather than only writing memory during the task.
- State what memory is for in the instructions, and avoid a blanket "record only failures" rule; the article found it reduced gains.
- Review and correct stored notes periodically, since one wrong landmark note cost Claude a detour in the Pokémon runs.
- For a large document corpus, maintain a wiki of entity pages alongside search; the article reports 61% with wiki plus search versus 53% with search alone on its 25-question test.
- For contracts or other exact-term material, give each entity its own page and quote the terms verbatim (72% to 100% of graded facts in the article's test).
- Measure memory against a graded question set, as the article's experiments did, rather than judging by file counts.

## Notable Quotes

- "Claude can use dreaming to organize memory." Lance Martin, as quoted in the article.
- "Sonnet 3.7 assumed everything might matter and wrote to memory indiscriminately." The article's authors, on the Pokémon Red runs.

---

*Related: `@content/web/github/2026-11-25-followups-scope-issue-112120` · `@content/web/github/2026-11-25-claude-code-v2-1-332` · `@content/web/claude-dev/2026-11-24-the-work-after-you-open-a-pr` · `@content/web/github/2026-11-24-builtin-ship-shadows-user-skill` · `@content/web/github/2026-11-23-claude-code-v2-1-331`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*