Skip to content

Agent Memory

How agents remember, retrieve, and reason over context.

Agent memory is the layer that lets an AI agent persist and recall information across steps and sessions — short-term context, long-term stores, and the retrieval strategies that decide what gets back into the prompt.

Test memory in three stages: was the applicable record selected, did it reach the active prompt, and did the answer use it correctly? A 2023 study found that performance on question-answering and key-value retrieval tasks varied with the position of relevant information in the tested models' contexts (Liu et al., Lost in the Middle). That finding motivates a position-sensitive test, rather than a universal claim about today's models. Keep expected source IDs and answer criteria so a retrieval failure can be distinguished from a failure to use supplied evidence. Types of AI agent memory covers authority and access checks.

Most agent memory is a write-and-retrieve loop: the application saves facts, preferences and lessons, then loads the relevant ones into later prompts. The harder part is keeping them true. In the TEPA study, agents with append-only or last-write-wins memory scored 0.210 when facts fully reversed, below the same agents with no memory at all (0.309); revoking stale memories raised the score to 0.950 (arXiv, TEPA: Revoking Stale Memories for Conflict-Robust Language Agents). A second study warns that "a stale stored fact can override current authoritative evidence without warning" (arXiv, The Memory Trust Gap).

Products are converging on background consolidation, but cleanup is not the same as correction. Cognition's Devin keeps each user's memories as markdown files in a Git-backed Memory Drive, and its dreaming pass consolidates notes and removes memories that no session used (Cognition, Memory and dreaming). Mem0's Dream marks replaced facts as superseded, yet "superseded memories still appear in search by default" (Mem0, Dream). Deletion is a separate question: Anthropic says that when a Claude conversation expires or is deleted, related memory entries generated from it are not removed (Anthropic Help Center).

On the show, Oracle's Richmond Alake argues that memory deserves its own engineering discipline, with forgetting designed in from the start: "you don't delete information in memory engineering, you forget" (episode 53). Types of AI agent memory, prompt vs context vs memory engineering and what is context poisoning go further, and agent memory defines the term.

Choose your depth

  1. Explain it simply

    New to the idea? Start with a plain definition and why forgetting matters.

  2. Help me use it

    Building an agent? Practice keeping its context current, then compare memory tools.

11 episodes

Explainers on this topic

Terms on this topic

Tool comparisons on this topic

Essay on this topic

Guests on this topic

Andy TriedmanKimberly LoganKapil ChhabraJaime DeLangheDan LorencJerry LiuRichmond AlakeMichel TricotAishwarya SrinivasanMikiko ChandrasekharBrian RaymondBob van LuijtJoão Moura