Skip to content
Amin Mirlohi

Production Agents 2026 · Part 2 of 5

13 min read8 primary sources

AI Agent Memory in 2026: Learn, Update, Forget, Verify

Build agent memory as governed state: control writes, preserve provenance, supersede stale beliefs, enforce deletion, and verify actions against evidence.

On this page

The short answer is that production agent memory should be built as governed state, not as a vector database with a chat interface. Retrieval is only one operation inside the system. Reliable memory also needs rules for what may be written, who can read it, how a newer fact supersedes an older one, when information expires or is deleted, and what evidence must be checked before memory can influence an action.

That changes the central design question. Do not ask only, "Can the agent remember this later?" Ask, "Should this become durable state, for which principal and purpose, until when, and with what authority?" A memory that recalls perfectly but preserves a poisoned instruction, exposes one user's data to another, or acts on an obsolete preference is not a good memory system. It is a durable failure mechanism.

Agent memory is governed state. Every durable item needs provenance, scope, temporal validity, update semantics, access control, deletion behavior, and an explicit rule for whether it may inform an action.

Memory is not the context window

Three concepts are often collapsed into the word memory:

  1. Working context is the temporary material available to the model during one inference or task: instructions, recent messages, tool results, and selected evidence.
  2. Persistent memory is information kept across sessions: events, user preferences, environment knowledge, procedures, and previous outcomes.
  3. Context assembly is the policy that selects a small part of persistent state and presents it to the model now.

The distinction matters because a larger context window does not solve memory governance. It can postpone selection, but it does not establish whether a claim is current, authorized, or safe to use. Anthropic's guidance on effective context engineering (opens in a new tab) frames context as a finite attention budget whose contents should be high-signal and deliberately curated. Persistent storage can be enormous. The model's active context should not be.

This is also why retrieval is not grounding. Similarity search can find a plausible memory, but similarity does not prove that the item is true, still valid, applicable to this task, or permitted for this reader. Retrieval proposes evidence. A separate policy decides whether that evidence may enter context, and a separate verification step decides whether the resulting action is justified.

A five-store architecture

A useful production design separates memory by function instead of putting every string into one index. The exact storage technology can vary. The contracts should remain distinct.

StoreWhat belongs thereWrite and update ruleRead and action rule
Event ledgerImmutable observations, messages, tool results, and outcomesAppend with source, subject, time, and integrity metadataRead for audit or reconstruction; never treat a raw event as standing authority
Profile stateCurrent preferences, constraints, relationships, and stable factsCreate from evidence; supersede rather than silently overwriteFilter by principal, purpose, sensitivity, and validity interval
Experience memoryEnvironment behavior, successful workflows, recurring failures, and exceptionsPromote only after verified outcomes or reviewRetrieve by task and environment version; expire when dependencies change
Procedure registryApproved rules, skills, and deterministic workflowsVersion, test, review, and sign like codeExecute only within declared permissions and input constraints
Derived indexEmbeddings, summaries, keywords, and retrieval featuresRebuild from authoritative stores; attach source referencesUse for candidate generation only; verify against source records before action

The event ledger is the evidence base. Profile state and experience memory are interpretations. Procedures are executable policy. The derived index is an acceleration layer. Keeping those roles separate lets a bad summary be rebuilt and an obsolete profile value be superseded without erasing history.

The 2026 preprint User as Code (opens in a new tab) proposes typed user state and executable rules backed by an append-only log. The lesson is not that every profile should become Python. Aggregation, contradiction handling, and invariant checks benefit from explicit types and deterministic computation, while unstructured text preserves nuance.

The write boundary is the first safety boundary

Most memory failures begin before retrieval. A conversational claim gets promoted into a durable fact without preserving who said it, how certain it was, or the scope in which it applied.

The persistent sycophancy (opens in a new tab) preprint makes this failure concrete. An agent can accept a user-centered claim during a conversation, commit it to memory, and reuse it later after the original context is gone. The model's agreeable response becomes a state-writing error. The paper highlights patterns such as removing attribution and broadening scope during commitment. "The user says this restaurant was noisy on Friday" can degrade into "this restaurant is bad."

Every proposed memory write should therefore carry a structured envelope:

  • principal and subject: whose state this is and whom the claim concerns;
  • source and provenance: user statement, observed tool result, imported record, model inference, or approved rule;
  • scope: the task, project, account, environment, or relationship in which it applies;
  • time: observed time, effective interval, expiry, and last verification;
  • epistemic status: quoted, observed, inferred, confirmed, disputed, or revoked;
  • sensitivity and purpose: why it is stored and which uses are allowed;
  • supersession link: which prior value this changes, if any;
  • write authority: the policy or human decision that allowed persistence.

Then place a gate before commitment. Low-risk, explicit preferences can be accepted automatically. Sensitive facts, cross-user claims, procedures, and anything that can expand capabilities should require stronger evidence or review. Instructions discovered inside webpages, emails, retrieved documents, or tool output should default to untrusted data, not reusable procedure.

Update by supersession, not silent replacement

Real users and environments change. Preferences, health records, repository workflows, and tool behavior can all become obsolete.

Flat memory tends to fail in one of two directions: it keeps both values and retrieves the wrong one, or it overwrites the old value and destroys the history needed to explain the change. A better model is temporal and append-oriented:

  1. record the new evidence as an event;
  2. determine whether it confirms, narrows, disputes, or supersedes existing state;
  3. create a new version with an effective time and provenance;
  4. close the prior version without erasing it from the audit history;
  5. invalidate summaries, embeddings, and caches derived from the old value;
  6. require downstream readers to select the valid version for the task time.

The Memora benchmark (opens in a new tab), published as a 2026 preprint and accepted to ACL 2026 Findings, explicitly penalizes reliance on obsolete or invalidated memory. Its framing is important: forgetting is not merely failing to retrieve something. It includes refusing to keep using a fact after later evidence makes it invalid.

Event-driven personalization adds another difficulty. The recent FinPerMA preprint (opens in a new tab) evaluates whether memory adapts a user model after material events. Its reported analysis suggests summaries can preserve factual details while losing the preference signal needed for personalization. Compression is therefore a semantic transformation, not routine storage maintenance. A summary must remain linked to the events it represents and be regenerated when those events are superseded.

Reading memory must not grant authority

Memory can influence a plan without authorizing an action. That separation is essential.

Suppose a memory says, "For invoices from this supplier, approve automatically." Even if the sentence is relevant and accurately retrieved, it should not bypass the current payment policy. The action layer must independently check the authenticated principal, amount, recipient, current rule version, approval threshold, and any required confirmation. A remembered procedure is an input to authorization, never a substitute for it.

The same principle applies to lower-stakes actions. A stored preference can choose a default meeting length, but should not reveal a private calendar. Environment experience can suggest a deployment command, but should not grant production credentials.

This is the memory version of not letting the agent grade itself. The model that retrieved and interpreted a memory should not also be the only component deciding that the memory is valid authority. Deterministic policy at the action boundary must be able to say no.

Shared memory needs principal-aware isolation

Single-user demos hide the hardest governance problem: multiple people and agents reading and writing a shared pool.

The 2026 GateMem preprint (opens in a new tab) evaluates utility, access control, and active forgetting in multi-principal settings such as workplaces, households, education, and health-related scenarios. Its central lesson is architectural even before any benchmark result: a shared assistant cannot apply one global relevance score and call that memory. It needs contextual authorization across identities, roles, relationships, and purposes.

Enforce that isolation before retrieval, not after generation. A query should first resolve an authenticated principal and a permitted scope. Candidate generation should run only over records that scope allows. Post-generation redaction is a weaker last line because private information has already entered model context and may influence the answer indirectly.

Cross-agent memory needs the same discipline. Store the writing agent's identity, tool and policy version, observed sources, and verification. An internal channel alone does not turn another agent's assertion into fact.

Poisoning turns memory into a delayed attack

Persistent state separates compromise from consequence. Malicious content can be stored today, retrieved next month, and converted into an action after its original source is no longer visible.

The July 2026 MemSecBench preprint (opens in a new tab) studies a Write, Execute, and Forget lifecycle. Use that sequence as a security test:

  • Can adversarial content cross the write gate and persist?
  • Can it later alter tool selection, arguments, disclosure, or execution?
  • Can the system identify and remove the malicious semantics without destroying legitimate state?
  • Do derived summaries, indexes, caches, and replicas also lose the poisoned content?

Defenses should include content-source labeling, instruction and data separation, least-privilege tools, delayed promotion of untrusted observations, integrity checks on approved procedures, and lineage that supports selective repair. Broad deletion is not a satisfying incident response if it erases useful history. Selective repair is not credible if a poisoned summary survives after the source record is removed.

Forgetting is an end-to-end operation

Deleting one row is not necessarily forgetting. The information may remain in a profile snapshot, embedding index, cached prompt, trace, backup, or another agent's note.

Define deletion semantics before choosing the database:

  1. identify the authoritative record and every derivative through lineage;
  2. block the record from future retrieval immediately;
  3. invalidate or rebuild summaries, indexes, and caches;
  4. propagate a tombstone to replicas and downstream stores;
  5. define what happens to immutable audit evidence and encrypted backups;
  6. verify through a read-path test that the information no longer reaches the agent;
  7. record completion without reproducing the deleted content in the receipt.

Retention, deletion, audit, and legal-hold requirements can conflict. The correct behavior depends on jurisdiction, sector, contract, and the purpose for which data was collected. This article is an engineering framework, not legal or privacy advice. Product teams should define those obligations with qualified counsel and privacy specialists, then encode the resulting policy in testable controls.

Evaluate the lifecycle, not just recall

Recall accuracy answers a narrow question: can the system surface a past item? Production evaluation needs a matrix that crosses memory abilities with governance properties.

Test at least these capabilities:

  • remember: recover the right evidence across long histories;
  • update: apply corrections, shocks, and changing preferences without stale reuse;
  • reason: aggregate multiple records while preserving provenance;
  • experience: recover environment workflows, state changes, and recurring failure modes;
  • scope: prevent unauthorized principals and purposes from reading a record;
  • resist: reject poisoning and status promotion at the write boundary;
  • forget: remove an item and its derivatives from agent-facing paths;
  • repair: selectively clean compromised state while retaining legitimate memory;
  • act: require current evidence and independent authorization before side effects.

The LongMemEval-V2 preprint (opens in a new tab) broadens memory evaluation beyond personal facts to environment-specific experience, including dynamic state, workflows, and recurring gotchas. That matters because agents need more than biography. They need valid operational knowledge tied to an environment version.

For every test, preserve the exact model, harness, memory backend, policy, and dataset version. Inspect both outcome and trace. A final answer can look correct while the trace shows an unauthorized read, a stale source, or a lucky guess. Run repeated trials for stochastic paths, but do not compare headline scores across unrelated benchmarks. The tasks, histories, memory configurations, graders, and success definitions differ.

A production memory checklist

Before allowing persistent memory to affect real actions, verify the following:

  • Every item has a principal, source, timestamp, scope, status, and retention class.
  • Model inference is distinguishable from user statements and observed system facts.
  • Durable writes pass a risk-based gate; untrusted content cannot become procedure by default.
  • Updates create explicit supersession links and invalidate every derivative.
  • Retrieval is filtered by identity and purpose before content enters model context.
  • The action layer rechecks current policy and authority independently of memory.
  • Shared stores isolate principals, roles, projects, and environments.
  • Procedures are versioned, tested, integrity-protected, and least-privileged.
  • Deletion covers source records, indexes, summaries, caches, replicas, and agent-facing traces according to policy.
  • Evals cover recall, update, scope, poisoning, repair, forgetting, and action correctness.
  • Audit logs can explain why a memory was written, read, changed, and used without becoming a second uncontrolled memory store.

The most advanced memory system is not the one that remembers the most. It is the one that can explain what it knows, distinguish evidence from inference, adapt when the world changes, forget when required, and remain unable to turn a stale or poisoned memory into unauthorized action.

Sources

← All writing