liveBook · Manning

Chapter 4: Memory: What your agent remembers shapes what it becomes

What you will learn in chapter 4 of Designing AI Agents

The introduction defines agent memory as a policy for carrying information across boundaries, using a decision ledger to show why stored history must be separated from current authority.

After this chapter you will be able to

What it builds on

Section by section

Introduction

The introduction defines agent memory as a policy for carrying information across boundaries, using a decision ledger to show why stored history must be separated from current authority.

Key terms: append-only ledger, superseded, current accepted decision, control plane, agent memory, boundary, policy, live decision, persistence, candidate lesson

4.1 What is memory? State, persistence, and knowledge across sessions

The section defines agent memory as selected information carried across a boundary and distinguishes its roles in resuming work, retrieving evidence, and carrying experience into later tasks.

Key terms: memory, active context, state persistence, evidence retrieval, experience capture, failure facts, proposed lessons, provenance, validation, admission

4.1.1 The memory hierarchy analogy

This section uses a cognitive memory analogy to explain how agent memory differs by purpose, access cost, lifetime, and authority.

Key terms: working memory, episodic memory, semantic memory, scope, function, access, lifetime, authority, access-cost analogy, provenance

4.1.2 The memory lifecycle

This section outlines possible memory lifecycle operations and explains why retention, retrieval, and updates require decisions about policy and authority.

Key terms: capture, organization, retrieval, update or supersession, sharing, forgetting, authority, proximity, supersession, memory

4.1.3 How production agents handle memory today

This section compares how production agents persist context and gives a rule for deciding when a dedicated memory layer is warranted.

Key terms: user-written instruction files, auto memory, provenance, authoritative policy store, Memory Bank, externalized working memory, checkpoint files, authoritative sources, dedicated layer, control surface

4.1.4 Measuring memory quality

This section shows how to judge memory by its effect on later decisions and how to trace a memory item to find where its usefulness breaks down.

Key terms: retrieval utility, precision, coverage, risk class, repeated-mistake rate, capture, retrieval, admission, application, memory staleness

4.2 Pattern: Hierarchical Retention

Introduces Hierarchical Retention as a way to keep information at the right scope and lifetime while preserving the authority of human-owned rules.

Key terms: Hierarchical Retention, tiers, promotion, eviction, invalidation, retention, lifetime, AI camera, companion system, authority

4.2.1 Three tiers and the eviction question

This subsection frames three-tier retention as a configurable design whose transitions depend on broader rules about stored items.

Key terms: storage tiers, promotion, eviction, scope, function, access

4.2.2 In production: Claude Code's scoped memory sources

This section explains how Claude Code’s memory sources differ in ownership and retention, and why model context must not be mistaken for an enforceable rule.

Key terms: auto memory, candidate context, managed policy, human-owned project rule, scope-addressed sources, sharing boundaries, provenance, conflict resolution, CLAUDE.md, model context

4.2.3 Building it

This section uses a compact three-tier memory implementation to explain retrieval, eviction, and the safeguards needed before using those mechanisms in production.

Key terms: durable tier, working context, vector-search relevance score, eviction priority, _enforce_budget, importance, recency, access frequency, eviction policy, owner

4.2.4 Before and after: What eviction looks like

The section illustrates an eviction policy that restores the working budget while retaining evidence needed for reliable decisions.

Key terms: eviction policy, working budget, error trace, high importance, stale-read incidents

4.2.5 Argus integration

Argus connects hierarchical memory to its review workflow so findings can be retrieved in later sessions, while leaving memory governance unimplemented.

Key terms: Argus, HierarchicalMemory, candidate admission, policy ownership, supersession

4.2.6 When it breaks

Explains when hierarchical retention is useful, where it can fail, and how to keep authoritative sources in control of memory-driven decisions.

Key terms: hierarchy, promotion, eviction, invalidation, scope, lifetime, authority policy, precedence rule, control-plane source, model-written notes

4.3 Pattern: RAG Pipeline

This section introduces RAG as a governed pipeline that prepares external sources and assembles decision-specific evidence for an agent.

Key terms: RAG Pipeline, write or compile path, read or assemble path, evidence package, source authority, permission, version, abstention, incomplete retrieval, source corpus

4.3.1 Two governed paths: Compile and assemble

The section distinguishes RAG’s compile and assemble paths and explains when agent-directed retrieval is worth its added cost.

Key terms: compile path, assemble path, provenance, permissions, versions, citations, agentic form of RAG, deterministic lookup, exact key, verification surface

4.3.2 In production: Claude Code's tool-based retrieval

Shows how Claude Code retrieves repository evidence with tools, why that evidence needs source and version context, and how retrieval methods should fit the source.

Key terms: tool-based retrieval, Grep, Glob, Read, retrieval structures, current working tree, evidence package, source and version, direct lookup, lexical and semantic search

4.3.3 Building it

This section describes a RAG retrieval implementation that combines query rewriting and hybrid search, explains how RRF merges results, and cautions that retrieval gains must be measured.

Key terms: query rewriting, semantic search, keyword search, Reciprocal Rank Fusion, authority and coverage checks, RRF, rank, k, recall, corpus

4.3.4 When it breaks

Explains when a RAG pipeline is useful, how it can fail despite apparently relevant retrieval, and how to test and verify its answers.

Key terms: RAG, retrieved package, controlling source, chunk boundaries, index, accepted outcomes, injected tokens, citation coverage, missed-authority failures, source citations

4.4 Pattern: Progress tracking

Progress Tracking preserves inspectable task state so an agent can resume bounded work after a reset, session break, or handoff instead of starting over.

Key terms: Progress Tracking, checkpoint, acceptance condition, side-effect receipts, idempotency keys, progress log, JSON feature list, version-control history, recovery contract, duplicated work

4.4.1 The checkpoint chain

4.4.2 In Production: Three approaches compared

The section compares three production approaches to progress tracking and explains why persisted progress still needs evidence and application-level safeguards.

Key terms: todo.md, checklist, checkpoint, progress log, feature list, version history, checkpointers, graph state, pending writes, acceptance condition

4.4.3 Building it

The section shows how a ProgressTracker persists task status and explains why production recovery needs a richer record.

Key terms: ProgressTracker, JSON, recovery contract

4.4.4 When it breaks

This section explains when progress tracking supports safe recovery, how it fails, and how to measure and implement it.

Key terms: progress tracking, checkpoint, artifact versions, verification results, acceptance evidence, authoritative versions, conflict detection, baseline, orientation tokens, latency

4.5 Pattern: Failure journals

This section introduces Failure Journals as a way to preserve evidence of recurring failures while controlling which lessons can influence later tasks.

Key terms: Failure Journal, failure fact, execution evidence, candidate diagnosis, published lesson, publication boundary, candidate lesson, admission, hard rule, capture

4.5.1 Failure fact, candidate lesson, published lesson

The section distinguishes recorded failures and candidate lessons from lessons independently admitted for reuse.

Key terms: failure journal, immutable evidence, candidate lesson, independent admission, scoped reuse

4.5.2 In production: Model-written notes as candidate memory

This section distinguishes model-written failure notes from verified lessons and explains how an index can organize a growing Failure Journal without validating its contents.

Key terms: auto memory, candidate failure memory, Failure Journal, raw evidence, index, topic files, Hierarchical Retention

4.5.3 Building it

Shows how a failure journal records failures and retrieves proposed lessons for review without treating them as admitted memory.

Key terms: record method, raw failure context, candidate heuristic, append-only file, search index, provenance, candidate, candidate consultation, active recall, independent evaluation

4.5.4 When it breaks

This section explains when failure journals are useful, how they can mislead later tasks, and how to judge whether they earn their cost.

Key terms: durable capture, causal attribution, scope, admission, expiry, retrieval, execution evidence, separate review path, verified lesson, avoided rework

4.6 Composing memory patterns

The section shows how to select, combine, and test memory patterns so that only valid stored information returns to an agent’s decisions.

Key terms: Hierarchical Retention, RAG Pipeline, Progress Tracking, Failure Journals, validity gates, active context, authority, supersession, retention policy, composition

4.7 Memory and collaboration: A boundary

The section distinguishes memory’s responsibility for carrying information across boundaries from collaboration’s responsibility for assigning and integrating work.

Key terms: Memory, Collaboration, persistence, retrieval policy, delegated worker, versioned findings, source references, handoff

4.8 Argus checkpoint: What Argus can do now

This checkpoint shows what Argus’s memory patterns can carry into a later review and argues that memory should be judged by the authority and usefulness of what returns, not by how much is stored.

Key terms: Argus, Hierarchical Retention, Progress Tracking, Failure Journals, review_candidate, checkpoint, memory policy, authority, reverified, valid source

4.9 Summary

4.10 References

This section lists references for the chapter on agent memory without explaining any assessable concepts or procedures.

Where this is used later

Concepts explained in this chapter

← Chapter 3: Perception: What your agent sees determines what it does Chapter 5: Reasoning: How your agent decides what to do next →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.