Est.
PersistentLong read

Memory and Context Accumulation Patterns Across Agent Sessions

Agents need lifecycle rules for what memories survive sessions and shape future actions.

· 9 min read
Cover illustration for “Memory and Context Accumulation Patterns Across Agent Sessions”
Persistent · October 24, 2026 · 9 min read · 1,987 words

With cross-session memory, an agent can build on earlier work and avoid repeating its mistakes. Effective memory is a lifecycle architecture. It governs what becomes durable, how that state changes, and when it must be erased.

Why cross-session memory is an architecture problem, not a storage problem

A procurement agent learns a correction during one session, then repeats the same mistake in the next because the correction never becomes usable state. The conversation may still exist in storage. The agent nevertheless starts its work without the institutional knowledge that conversation should have produced. This is a deeper failure than asking a user to repeat a preference, because the missing state affects how work gets done. A transcript preserves an exchange, but does not by itself establish what the agent should believe or do differently.

The shift from chatbots to procurement, code review, research, and operations makes that distinction unavoidable. Truncating a chat buffer cannot govern knowledge that must survive a workflow. A lifecycle architecture instead connects observation, writing, validation, organization, retrieval, and action to the return stages of update, forgetting, audit, and rollback. Each stage has consequences for the next. The Always-On Agents survey found that research concentrates heavily on accumulating and retrieving state, with much less attention to governing, recovering, or relinquishing it. The architecture therefore needs both more storage capacity and control over how stored state shapes what the agent does next.

The taxonomy of persistent state an agent actually needs to manage

The Always-On Agents survey distinguishes episodic traces, semantic facts, preferences, and procedural skills. These represent events, general claims, learned dispositions, and recurring patterns of action. Their persistence needs are not interchangeable. An event record says what happened, while a semantic claim may need to change when the world changes. A procedural skill must help the agent act as well as answer a question about an earlier conversation.

The same survey extends persistent state beyond memory to task ledgers, policies and permissions, provenance and audit records, tools and credentials, and external commitments. These records govern unfinished work, authority, access, and actions already taken. Some external effects cannot simply be rolled back. The survey finds governance especially thin at the intersections between these types, where a credential update should also revise a task-ledger entry.

Michaël Roynard’s The Missing Knowledge Layer in Cognitive Architectures for AI Agents proposes a sharper distinction based on persistence semantics. Its four layers are Knowledge, retained indefinitely until superseded, Memory, subject to Ebbinghaus decay, Wisdom, revised through evidence, and Intelligence, used for ephemeral inference. The distinction changes the update policy. Roynard’s paper argues that CoALA and JEPA lack an explicit Knowledge layer and consequently apply the same mechanics to facts and experiences. A factual claim should not gradually fade when the required operation is clean supersession. Each state type therefore needs its own lifecycle rules, even if they all use the same storage system.

The OS-inspired memory hierarchy and how production systems implement it

The OS-inspired hierarchy puts these state types in places that differ in how much they cost to access and how visible they are. Core memory stays in the LLM’s context window and serves as immediate working state, analogous to RAM. Recall memory holds searchable conversation history, analogous to disk cache. Archival memory provides long-term storage that the agent queries explicitly, analogous to cold storage. State can be durable without being included in context by default. Choosing a tier is consequently a retention decision as well as an access decision.

A user_id identifies memories that persist across a user’s sessions, while an agent_id identifies state belonging to a particular agent instance. A run_id or session_id confines state to one conversation, and an app_id or org_id marks shared organizational context. These boundaries set whose history an agent may draw on when it acts. The tier answers how state becomes available, while the scope answers where it belongs.

Continuum Memory Architectures for Long-Horizon LLM Agents characterizes RAG as a stateless lookup table with indefinite persistence, read-only retrieval, and no temporal continuity. That model does not supply accumulation, mutation, or disambiguation across sessions. Retrieval alone is therefore an incomplete architecture. The Mem0 2026 state-of-memory report describes production systems combining semantic, keyword, entity, and graph-based retrieval, but broader search does not resolve what should happen after a result is found. The survey notes that retrieval research rarely addresses how retrieval changes what the agent treats as true.

The forward arc: how an agent decides what becomes durable state

Context poisoning begins when erroneous information enters episodic memory and reproduces through later steps. A retention mistake becomes a continuing input. The agent may make that decision without user participation, under criteria set by the vendor, so the write path is also an authority boundary. The survey describes the central difficulty at ingestion, when the agent must choose what becomes state before it knows whether the information is accurate or useful over time.

The forward arc begins with observation and a candidate write, rather than an automatic commitment to durable knowledge. The survey calls validation “the missing gate” between write and organize. Before the candidate becomes durable, that gate checks whether it is consistent with itself, whether its source has authority, and whether it conflicts with existing state. A retention rule needs to weigh more than how recent an item is. The CMA paper requires criteria for selecting which episodic traces rise into semantic facts and limiting the accumulation of raw history.

The state type then determines how the accepted information can change. Roynard’s paper argues that applying decay to facts produces partially decayed claims where explicit supersession is needed. Organization creates a further risk after validation. Merging, deduplicating, and abstracting records can strip their provenance, leaving a compact belief without a usable account of its origin or authority. The survey treats consolidation as a step that can preserve or destroy governance, because later correction depends on knowing which evidence supported the resulting state.

The return arc: update, consolidation, and deliberate forgetting

Changing the recorded budget owner from Alice to Bob does not automatically revise task-ledger entries that assumed Alice’s approval authority. The fact is current, but dependent work is not. The survey finds that research studies revision of individual entries more than propagation to downstream memories. Treat an update as a dependency problem that includes edits to individual records. Otherwise, an agent can retrieve the new fact while continuing work built on the old one.

The CMA paper uses sleep-phase consolidation as an analogy for organizing episodic traces into higher-order semantic abstractions. The aim is structured understanding rather than longer transcripts. This process can turn prior experience into more useful future behavior, provided it preserves the evidence needed for revision. Without that connection, compression can undermine knowledge reliability by making an unsupported belief harder to inspect.

Forgetting also needs clear rules for what stays. The survey characterizes current practice as “a retrieval edit, not an erasure,” because excluded records can remain available through audit queries and still occupy storage. Keeping records this way breaks privacy rules that call for them to be deleted. Rollback poses a related recovery obligation. The survey identifies it as the least-implemented lifecycle stage, although agents can create committed external effects that a memory edit cannot undo. Governance must therefore distinguish correcting internal state from recovering an action, and recognize that some side effects are irreversible.

How benchmarks expose which lifecycle stages a memory system actually handles

Benchmark selection should follow the agent’s required lifecycle behavior. LoCoMo tests conversational recall across sessions through single-hop, multi-hop, temporal, open-domain, and adversarial questions. It fits agents that answer questions about what a user said. LongMemEval goes further into information extraction, multi-session reasoning, knowledge updates, temporal reasoning, and abstention over long histories. When user facts change, its update tests provide a more relevant lens than recall alone.

Scale and procedural learning require different tests. BEAM tests recall and reasoning at one-million and ten-million token scales and shows where organization and retrieval fail even with a larger context window. Roynard’s paper also points to near-zero contradiction-resolution scores on BEAM as signs of related gaps in the architecture. STATE-Bench tests whether experience with a task helps with repeated enterprise workflows, so it is a narrow test of how consolidation turns that experience into procedural skill on the job. DolphinBench examines whether memory improves tool-use outcomes over multi-year simulated histories. These benchmarks ask different questions about what experience produces.

A score needs its methodology to be interpretable. The Mem0 report notes that results can differ widely with the dataset, model, retrieval depth, configuration, and grading method. No current benchmark adequately covers governed forgetting, update propagation, rollback, and privacy-compliant deletion. Strong answer quality is not proof of recovery capability. The survey’s evaluation protocol helps fill that gap by scoring how state changes and whether recovery duties are met, which shows how much of the lifecycle still needs to be tested beyond recall.

Why persistent execution environments are the substrate that makes memory lifecycle viable

A memory lifecycle depends on state surviving the intervals between sessions. Stateless functions cannot keep files, credentials, and working memory through sleep and redeploy on their own, so they need external storage and a way to rebuild state to carry it between sessions. A persistent, isolated execution environment makes continuity part of the substrate. Its filesystem retains episodic traces, semantic facts, and credential state between sessions, without requiring every return-arc operation to round-trip to an external store. The lifecycle’s durability therefore depends on more than the memory API.

Isolation gives the scoping model an infrastructure boundary. One agent’s state must not contaminate another’s, regardless of how the application labels its records. The environment also needs to support the work that procedural memory informs, including package installation, browser sessions, and arbitrary code execution. A retrieved skill still has to be exercised. Memory for an agent performing real workflows is consequently tied to both its execution state and searchable text.

Snapshot and restore make that persistence economically practical. Most agents are idle most of the time, so snapshotting a microVM’s memory and disk state allows restoration on demand while operators pay for storage and avoid idle compute costs between sessions. Reuse introduces a separate governance risk, however. When a warm pool is recycled between tenants, it must flush filesystem state, shared memory, and environment variables. Skipping that step lets tenant data bleed across the boundary, so a shortcut in the infrastructure breaks memory scope.

Governing the lifecycle at scale: multi-tenant fleets, audit, and the right to forget

Across thousands of users, audit, deletion, and rollback omitted from prototypes become operational requirements. The survey identifies provenance as essential to that governance. Every durable state item needs a record of how it arose, what authorized it, and which agent actions it influenced. Without that lineage, deletion cannot be verified. Genuine erasure must cover both the original record and downstream memories that referenced the deleted item.

The Mem0 report names cross-session identity among the hardest unresolved problems, because deciding whether sessions belong to the same user determines which memories may merge. Scoping state to a dedicated agent instance per user makes the governance surface explicit through one VM, one filesystem, one memory scope, and one audit log per user. It also exposes the top-heavy usage pattern in which a small fraction of users consume a large fraction of inference and memory budgets, which fleet-wide averages can conceal.

Shared memory complicates that otherwise clear boundary. The survey identifies state written by one agent and readable by others as an area with particularly thin governance, including absent access control and unaudited cross-principal state. Multi-agent enterprise work needs this sharing, but governing it takes more than letting agents read the records. Authority, provenance, revision, and erasure must follow state beyond the agent that first wrote it. At fleet scale, the defining question is not how much an agent remembers, but whether every durable belief remains accountable throughout its useful life.

Sources

  1. Always-OnAgents:A Survey of Persistent Memory, State, and Governance in LLMAgents
  2. Continuum Memory Architectures for Long-Horizon LLM Agents
  3. The Missing Knowledge Layer in Cognitive Architectures for AI Agents
Filed underPersistent

More in Persistent