InquiryLoom

Source

The components of agent memory

Copy link

Press Ctrl+C (⌘C on a Mac) to copy the text below; on a phone, long-press and choose Copy.

Share posterSuggest a change
  1. AI agents need to balance immediate memory writing with periodic offline review to keep knowledge useful and up to date.

    An agent can write a lesson while doing a task, or return to session records later and consolidate them in an offline process known as dreaming. Immediate writing makes the information available to the next session but competes with the current task for attention. Offline review can compare past experiences, correct outdated notes, and improve organization, but it requires compute and its results may not be ready immediately. A sensible design is to preserve searchable records and review important, frequently used or change-prone knowledge more often than rarely used stable notes.

    Anthropic

    1 quotev2

  2. A second review of an AI-generated wiki can repair broken links and add missing pages that individual writing sessions overlook.

    An agent writing a knowledge page sees only part of the material, and may link to a page that does not exist or miss useful relationships. In Anthropic's legal-document wiki example, a later offline review found nine links to a nonexistent page and redirected them to an existing page about the same document. It also created three pages, including an index, increasing the wiki from 38 to 41 entries and from 225 to 278 links. This illustrates a two-stage workflow: extract knowledge first, then review the collection as a whole to resolve missing references and improve navigation.

    Anthropic

    1 quotev2

  3. When multiple AI agents build a knowledge base, separate write ownership and precise evidence can prevent important facts from being lost.

    Multiple agents building the same wiki may overwrite one another's edits or summarize away details that matter to the final task. In Anthropic's Harvey Legal Agent Benchmark contract example, agents initially wrote contract terms into a shared table; the resulting brief covered only 41 of 57 required facts. After assigning each contract its own page and a single writer, and requiring the exact contractual wording to be preserved, the brief covered all 57. For tasks that depend on precise evidence, partition writing responsibilities and preserve important source details before merging or summarizing them.

    Anthropic

    1 quotev2

  4. AI agents benefit more from a prebuilt wiki when answers require combining documents than when one document contains the answer.

    When answering a question over a document collection, an AI agent can search original files or use a wiki that has already organized facts and links between them. In Anthropic's 24-question merger-document evaluation, wiki-assisted answers satisfied 87% of graded criteria on items requiring synthesis or judgment/arithmetic, compared with 73% for direct search. In a separate legal task where most criteria could be satisfied from one document, the wiki provided no clear advantage. Another wiki grew to 203 KB from a 115 KB source collection, illustrating that organization without useful abstraction can add clutter. A practical approach is to use direct search for precise lookups and consider curated representations for recurring cross-document reasoning.

    Anthropic

    1 quotev2

  5. AI agents should load a short memory index at the start of each session and retrieve detailed knowledge only when needed.

    An AI agent with a long history cannot fit every past experience into each new conversation. Anthropic describes four layers of persistent memory: searchable session records, notes about useful experiences, linked knowledge such as wikis, and a small amount of context loaded at startup. A short startup index tells the agent what knowledge exists and where to find it, while detailed notes stay available for on-demand retrieval. Claude Code illustrates this approach by loading only the first 200 lines or 25 KB of its MEMORY.md index.

    Anthropic

    1 quotev2

  6. AI agents can learn across sessions by saving feedback, testing explanations, and recording verified rules for future tasks.

    A new session usually lacks the reasoning that led to earlier successes and failures. In Anthropic's CL-Bench database exercise, Claude answered questions in separate sessions, received the correct answers, and could keep files between sessions. Opus 5 used those files to record rules, the basis for trusting them, and pitfalls; its average reward rose from 0.564 without memory to 0.828 with memory. Sonnet 4.6 mostly saved untested explanations and saw a much smaller improvement, from 0.330 to 0.364. A useful learning loop is therefore to record feedback, form and test an explanation, and store the validated lesson instead of treating a guess as knowledge.

    Anthropic

    1 quotev2

  7. Combining a prebuilt wiki with direct document search can improve AI agents' answers to complex knowledge-base questions.

    Repeatedly searching a large document collection can require an agent to rediscover the same relationships each time. Anthropic had agents build and refine a wiki over about 350,000 Stainless company files (420 million tokens), then evaluated answers to 25 questions. As wiki construction increased from 2 to 128 sessions, the wiki-only score rose from 13% to 48% of graded criteria met; the wiki-plus-search score rose from 54% to 61%, compared with 53% for search alone. Combining the wiki with search reportedly also reduced per-question token use by about 20,000. The wiki supplies an organized map of known facts, while search can retrieve original evidence and information missing from that map.

    Anthropic

    2 quotesv3

  8. An AI agent can correct persistent memory errors by comparing its notes with records of what actually happened.

    A mistaken memory can mislead later sessions even if the agent has access to current information. In Anthropic's Pokémon Red example, Claude incorrectly recorded that a Pokémon Center was beyond Mt. Moon, so it thought the cave had been completed and repeatedly backtracked. An offline review process called dreaming examined the earlier session record, corrected the landmark's location, and let Claude resume the right route; the corrected run reached the next city at action 1,935, while the uncorrected and no-memory runs did not reach it within the plotted 3,000 actions. This illustrates why persistent memory needs a way to check, revise and trace claims back to their evidence.

    Anthropic

    2 quotesv3

  9. AI agents should remember reusable strategies and hard-won lessons rather than repeatedly saving information they can look up.

    An agent working in a changing environment can waste time maintaining notes about facts that are already visible, such as its current position or balance. In Anthropic's Pokémon Red comparison at roughly 10,000 steps, Sonnet 3.7 saved 413 files (977,930 characters) and earned one badge, whereas Fable 5 saved 10 files including a top-level dashboard (43,406 characters) and earned four badges. Fable 5 kept route plans, goals and gameplay strategies rather than duplicating transient screen information. The useful distinction is between facts that can be retrieved cheaply from the environment and knowledge that would otherwise require repeating difficult reasoning or experiments.

    Anthropic

    2 quotesv3

  10. Strong AI agents can often decide what to remember themselves, while weaker agents may need explicit memory-use instructions.

    Giving an agent a persistent memory folder is not enough if it never reads its notes or saves incorrect explanations. Anthropic tested Claude models on database questions with feedback and found that Opus 5 and Opus 4.7 used memory effectively with general guidance; requiring them to save only failures reduced their memory-related performance gains by 0.234 and 0.150 respectively. For Sonnet 4.6, telling it to consult earlier notes and test its explanations raised average reward from 0.364 with memory alone to 0.641, versus 0.330 without memory. Memory instructions should therefore be adjusted to the agent's demonstrated ability, not applied as one rigid policy to every model.

    Anthropic

    2 quotesv3