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

Anthropic

How can an AI agent learn from past work when each new session starts with a fresh context? Anthropic explores long-term memory stored outside the model, rather than learning through weight updates. Its central proposal is to retain useful experience, organize it into searchable knowledge, and revisit it between sessions.

The memory architecture has four layers: searchable records of past sessions; notes containing useful facts, strategies and tested rules; linked knowledge structures such as wikis; and a small set of memories or pointers loaded automatically at session start. Dreaming is an offline process that reviews earlier work to correct notes, fill gaps, organize related knowledge and decide what deserves automatic loading.

The experiments illustrate three lessons. Selective memory and verified rules can be more useful than exhaustive logging; different models need different guidance to use memory well. In a 25-question corporate document evaluation, adding a mature wiki to search increased the share of graded criteria met from 53% to 61%. Wikis helped more with questions requiring synthesis across documents than with simple lookups. In a legal task, separating agents' writes and preserving exact contract terms improved coverage from 41 to 57 of 57 required facts.

The practical takeaway is to preserve original evidence, keep active context small, combine curated knowledge with search, and evaluate memory against real tasks. These are task-specific experiments, not universal guarantees: memories can be wrong or stale, and offline maintenance costs compute.

Key ideas

  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

All 10 ideas