Overview

4 Memory: What your agent remembers shapes what it becomes

This chapter argues that memory is not just storage, but a policy for what information survives each boundary and what is allowed back into decision-making. An agent’s memory must distinguish working context, session state, long-term evidence, preferences, decisions, and candidate lessons, while also tracking scope, ownership, version, permissions, and expiry. The central lesson is that persistence alone does not create authority: an item can be remembered without being valid, current, or allowed to guide action.

The chapter then presents four memory patterns, each designed for a different failure. Hierarchical Retention keeps information in tiers so useful material can persist without confusing old or low-authority items with current guidance. RAG Pipeline assembles governed evidence from large or changing corpora, with retrieval methods chosen to fit the source and with citations and authority checks preserved. Progress Tracking stores resumable task state so work can continue after resets or handoffs, and Failure Journals preserve failure evidence and candidate lessons without automatically promoting them into rules.

Across these patterns, the recurring design principle is to preserve history while controlling reuse. Good memory systems do not simply retain more; they retain the right things, in the right form, for the right audience, and with clear rules for supersession, invalidation, and review. The chapter closes by showing how these patterns can be composed when needed, but only after checking that the combined design improves outcomes such as recovery, citation quality, and correct resumption without repeating mistakes.

Memory access-cost analogy. Promotion and eviction manage active context; authority, version, and permission remain separate checks.
Memory access-cost analogy. Promotion and eviction manage active context; authority, version, and permission remain separate checks.
Hierarchical Retention in two views. The three-tier teaching model shows promotion and eviction; the production view adds scope, function, lifetime, ownership, and admission.
Hierarchical Retention in two views. The three-tier teaching model shows promotion and eviction; the production view adds scope, function, lifetime, ownership, and admission.
RAG Pipeline from basic retrieval to governed compile and assemble paths. Provenance, version, permission, and source identifiers survive into the evidence package.
RAG Pipeline from basic retrieval to governed compile and assemble paths. Provenance, version, permission, and source identifiers survive into the evidence package.
Progress Tracking from a checkpoint chain to verified resumption. Each checkpoint records the goal, artifacts, versions, effect receipts, and pending decisions.
Progress Tracking from a checkpoint chain to verified resumption. Each checkpoint records the goal, artifacts, versions, effect receipts, and pending decisions.
Failure Journal from an immutable failure entry to governed reuse. An entry may support a candidate lesson; independent admission controls publication, and later retrieval and effect observation govern continued reuse.
Failure Journal from an immutable failure entry to governed reuse. An entry may support a candidate lesson; independent admission controls publication, and later retrieval and effect observation govern continued reuse.
Memory validity checks. A superseded game decision is rejected before active context; a current, authorized item may re-enter.
Memory validity checks. A superseded game decision is rejected before active context; a current, authorized item may re-enter.

Summary

  • Memory is a policy for what survives a boundary and under what authority it may return to a later decision. A separate memory service is optional.
  • Hierarchical Retention (Memory × Hierarchy) separates scope, function, access, and lifetime. Recency and frequency can guide retrieval; they do not determine authority.
  • RAG Pipeline (Memory × Chain) governs a compile path for sources and an assembly path for decision evidence. Exact, lexical, semantic, structural, relational, and temporal retrieval serve different corpora.
  • Progress Tracking (Memory × Orchestrate) preserves the goal, acceptance condition, artifact evidence, authoritative versions, pending decisions, side-effect receipts, and handoff conditions needed to resume safely.
  • Failure Journals (Memory × Loop) keep raw failure evidence, candidate diagnoses, and published lessons distinct. Chapter 7 owns admission and replay.
  • The four patterns are selected from observed failures; they do not form a mandatory pipeline. A system may use one, several, or none.
  • Memory and Collaboration may share infrastructure while retaining different responsibilities. Memory governs persistence and retrieval; Collaboration governs roles, handoffs, and integration.
  • Measure memory through downstream decisions: retrieval utility, repeated mistakes, stale reads, duplicated effects, harmful transfer, latency, and token cost within a defined workload.

FAQ

What is agent memory in Designing AI Agents, chapter 4?Memory is the policy for what information survives across boundaries like turns, sessions, tasks, users, devices, or systems. It also determines what form that information takes, who owns it, how long it lasts, and what checks are required before it can return to active context.
Why is persistence alone not enough for an agent to “remember” correctly?Persistence only keeps information available; it does not decide which version is current, valid, or allowed to influence action. A separate control plane must validate scope, authority, version, permissions, and supersession before reuse.
What are the three main responsibilities of memory in agent systems?The chapter groups memory into three responsibilities: state persistence for resuming work, evidence retrieval for finding relevant information outside active context, and experience capture for preserving failures and candidate lessons with provenance.
What is Hierarchical Retention?Hierarchical Retention is a memory design that assigns information to tiers with explicit scope, function, access, and lifetime policies. It is used when information needs different handling depending on whether it is working state, evidence, preferences, decisions, or archived history.
Why does the chapter say “popularity is not authority”?A frequently retrieved item can still be wrong or outdated, even if it is often used. The chapter emphasizes that ownership, versioning, invalidation, and supersession rules must govern what is valid, not just retrieval frequency or recency.
How does the chapter distinguish memory from retrieval?Memory decides what survives and what may return; retrieval is the process of bringing selected information back into context. Retrieval methods can include exact lookup, lexical search, semantic search, structural indexes, and relation graphs, depending on the evidence needed.
What is the purpose of a RAG Pipeline in this chapter?A RAG Pipeline brings governed external evidence into active context for a specific decision. It prepares sources on a write/compile path, then retrieves and assembles an evidence package on a read/assemble path with provenance, version, and permission preserved.
What does Progress Tracking preserve for resumable tasks?Progress Tracking preserves the task’s current contract so work can resume after a reset, session break, or handoff. It should record the goal, completed artifacts, authoritative references, pending decisions, version information, and effect receipts.
What is a Failure Journal, and why keep raw failure evidence?A Failure Journal stores failure facts, execution evidence, candidate diagnoses, and the lineage of any later lesson. Raw evidence stays immutable so later tasks can challenge or revise the diagnosis without losing the original facts.
How should an agent choose among the four memory patterns?Start with the observed failure and add the smallest pattern that fixes that boundary. Use Hierarchical Retention for scope/lifetime differences, RAG for large or changing corpora, Progress Tracking for resumable work, and Failure Journals for recurring failures and candidate lessons.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Designing AI Agents Designing AI Agents ebook for free
Close
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Designing AI Agents Designing AI Agents ebook for free