Context Engineering and Memory Management for Production Agent Systems

anthropic · Tech · 2026 · source Agentic: yes · promotional bias: low · source-backed · extracted with prompt 0.5.6 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Production AI agent context and memory management

Anthropic's Applied AI team needed a way for production agent fleets to improve on organization-specific tasks over time. Raw model intelligence did not carry enough local task, codebase, preference, and failure context, while naive context injection and in-band memory hit context-window, concurrency, staleness, and governance limits at production scale.

Constraints:

Architecture

Anthropic describes a layered memory architecture: session agents use markdown/file-system memory for normal in-band recall and updates; production guardrails add versioning, hashing-based concurrency control, permissions, and portability; and an out-of-band 'dreaming' process batches transcripts and memory stores into a separate review workflow that proposes memory changes with human acceptance.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  session-agents["Session agents"] --> file-system-memory-store["File-system memory store"]
  session-agents --> memory-guardrails["Memory guardrails"]
  transcript-analysis-subjects["Transcript analysis subjects"] --> dreaming-orchestrator["Dreaming orchestrator"]
  file-system-memory-store --> transcript-analysis-subjects
  dreaming-orchestrator --> human-reviewer["Human reviewer"]
  human-reviewer --> file-system-memory-store
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Session agents Agents that perform user tasks while reading from and writing to memory during a session. File-system memory store, Memory guardrails
File-system memory store Markdown-oriented memory substrate that agents can search, index, read, and update. Session agents, Dreaming orchestrator, Memory guardrails, Human reviewer
Memory guardrails Versioning, hashing, concurrency, permissions, and portability controls around autonomous memory writes. Session agents, File-system memory store, Human reviewer
Dreaming orchestrator Out-of-band batch coordinator that reviews transcript-analysis outputs and proposes memory-store changes. File-system memory store, Transcript analysis subjects, Human reviewer
Transcript analysis subjects Dedicated agents that analyze transcripts, tool metadata, and current memories for recurring failure or improvement patterns. Dreaming orchestrator, File-system memory store
Human reviewer Reviewer who accepts or rejects proposed memory changes after the dreaming process surfaces rationale and examples. Dreaming orchestrator, File-system memory store, Memory guardrails

Data flow

During normal sessions, agents read and write file-system memories. Separately, dreaming takes the memory store plus session transcripts and tool metadata, has subject agents analyze them, and lets an orchestrator propose memory-store changes with supporting prevalence evidence for a human to accept or reject.

“You then take a number of the transcripts. And like I mentioned, that is a mixture of like the back and forth passes between the agents as well as metadata on tools, other skills they used, etc.”transcript, stated
“the orchestrator then reviews all of the responses from the subjects. And it then decides like where there are prevalent enough patterns, that it thinks this warrants a change in the memories.”transcript, stated

Why this architecture

The architecture separates fast in-session learning from slower fleet-level memory curation. File systems give agents a simple, searchable memory interface, while dreaming gives dedicated capacity and cross-session visibility to identify recurring failures that single sessions cannot see.

“Agents are actually just very good at using normal file system tools like bash and grep. So just let them search over the file system rather than being opinionated about these specific tools”transcript, stated
“So on the other side, we have dreaming, which is this out-of-band process. And this allows, again broader visibility and dedicated capacity, i.e. token spend, which is specifically directed towards helping agents learn better.”transcript, stated

Models used: Claude Code · Dedicated memory/dreaming agents

Scale

Alternatives considered (roads not taken)

Simple session-start CLAUDE.md context injection only

Rejected because: It was effective but unbounded files create context-window management problems as preferences and organization knowledge grow.

“However, we also learned a couple of things about what doesn't work here. So when we're injecting this at the beginning, at the beginning of the session into context, we obviously start to run into problems”transcript, stated

In-band memory curation only

Rejected because: The task agent has split attention and cannot see recurring cross-session or cross-fleet failure patterns.

“you're asking an agent to complete a task, but at the same time, you're also asking it to invest in memory curation, which would help it perform better in a future run.”transcript, stated
“the agents just have an inherent visibility limitation. So they only have the context of what's going on in their session.”transcript, stated

Unconstrained autonomous writes to shared memory

Rejected because: Incorrect or stale organization-wide writes would propagate to all agents, so production memory needs versioning, concurrency, and permissions.

“Think about one agent running into a problem and deciding to write to the organizational wide context which every other agent is currently reading from. Like if something was incorrect there, that would scale to all of your agents”transcript, stated

Patterns

agent-memory (context)

Agents use a markdown/file-system memory store that they can search, index, read, and update, rather than relying only on prompt-injected context.

“what we think is best practice is modeling these memory systems just as file systems. So this kind of aggregates a couple of the learnings from this path.”transcript, stated

tool-use-orchestration (orchestration)

The memory interface deliberately leans on ordinary file-system tools such as bash and grep, letting the agent search and progressively disclose relevant memory.

“Agents are actually just very good at using normal file system tools like bash and grep. So just let them search over the file system rather than being opinionated about these specific tools”transcript, stated

safety-policy-enforcement (governance)

Shared memory writes are constrained by versioning, hash-based concurrency checks, and permissions so one agent cannot casually corrupt organization-wide context.

“So when an agent decides that it wants to write an update to a memory, it takes a hash. It then drafts its edit. And then before it writes the update, it takes another hash.”transcript, stated
“you wouldn't want one agent to just decide that it should update the organization wide context. Probably you might want that as read only.”transcript, stated

batch-offline-processing (operations)

Dreaming runs asynchronously and in batch over memories plus transcripts, using dedicated resources to identify recurring patterns and propose memory updates.

“dreaming, which is a process that runs in batch and asynchronously with its own allocated resources to ensure that those memories themselves are effective up to date”transcript, stated

human-in-the-loop-gate (governance)

The dreaming process proposes memory changes and supporting evidence, but the individual reviewer decides which memory updates to accept or reject.

“You get this output and you as the individual can decide where you want to accept changes to the memory, where you want to reject them, etc.”transcript, stated

Tradeoffs

Memory substrate design

Chose file-system markdown memories over opinionated bespoke memory tools.

Rationale: File systems preserve agent autonomy and progressive disclosure because agents are already strong at searching ordinary files with tools like bash and grep.

“You can just fill them up with markdown. Agents are actually just very good at using normal file system tools like bash and grep.”transcript, stated

Continual-learning path

Chose out-of-band dreaming in addition to in-band memory over forcing the task agent to curate all future memory during the current session.

Rationale: Dreaming spends dedicated tokens on learning and sees cross-session patterns, while in-band agents suffer from split focus and limited visibility.

“this out-of-band process. And this allows, again broader visibility and dedicated capacity, i.e. token spend, which is specifically directed towards helping agents learn better.”transcript, stated

Autonomous memory writes

Chose guardrailed writes with versioning, hashes, and permissions over fully open autonomous updates to shared memory.

Rationale: The benefits of autonomous memory only hold in production if incorrect, stale, or malicious memory updates can be audited, rolled back, and scoped.

“you have to have a lot of guardrails in place to make sure that these nice autonomous memory systems actually work in production.”transcript, stated

Gotchas (what bit them)

Simple context files can become a new context-management problem.

Root cause: Important preferences and organization knowledge accumulate in files injected at session start, eventually consuming context and becoming hard to manage.

Resolution: Treat markdown memory as a searchable file-system substrate rather than an ever-growing prompt prefix.

“when we're injecting this at the beginning, at the beginning of the session into context, we obviously start to run into problems where you get problems with context, like what happens when this file with very important preferences gets very, very long.”transcript, stated

Shared autonomous memory creates concurrency and blast-radius risks.

Root cause: Multiple agents may write the same memory, and an incorrect organization-wide memory update would affect every agent reading it.

Resolution: Use versioning, hash checks before commit, and read/write permissions by memory scope.

“Think about multiple agents trying to write to a memory file at the same time. How do you manage that?”transcript, stated
“if something was incorrect there, that would scale to all of your agents and be pretty disastrous.”transcript, stated

In-band memory curation cannot see fleet-wide repeated failures.

Root cause: A single agent session only sees its own context and has to split resources between the current task and future-memory improvement.

Resolution: Add out-of-band dreaming with dedicated transcript review and cross-session pattern detection.

“The second thing is that the agents just have an inherent visibility limitation. So they only have the context of what's going on in their session.”transcript, stated

Evaluation

The talk reports production observations rather than a formal benchmark: memory effectiveness is judged by repeated-task improvement, faster one-shot task completion, and reduced agent cost/latency.

Metrics: accuracy on repeated tasks · speed and latency · token/cost reduction through better one-shot task completion

“from what we've seen, deploying these large scale memory systems in production. And for example we see you get better accuracy.”transcript, stated
“that then has second order effect on the speed and latency, sorry, speed and cost of your agents running because then spending fewer tokens, they can be more easily one shot”transcript, stated

Outcomes

The talk positions the design for production fleets with many agents, long-running workspaces, and shared memory systems; it gives thousands of agents as the motivating concurrency example.

“you have this effect where the second time the agent does the task, it actually does it better with higher results, because it's noted all of those memories about what went wrong.”transcript, stated
“Once you think about scaling those things into architectures with many agents, agents that run over a very long time”transcript, stated