At Code w/ Claude 2026, Anthropic introduced Dreaming: a scheduled background process that reviews past agent sessions, surfaces patterns, and curates persistent memory. The direction echoes a metaphor often used by Andrej Karpathy—people consolidate daily experience during sleep, while an agent that relies only on its current context window must reconstruct background in every new session.
The product boundary matters. Anthropic’s announcement lists Dreaming as a capability for Claude Managed Agents, and the official conference session presents it as part of a memory architecture for self-learning agents. That is not the same as saying every Claude Code user has an equivalent general-purpose built-in feature. The Dream Gate later in this article is an implementable architecture pattern, not an Anthropic setup guide.
1. Why In-Band Memory Is Not Enough
A common design maintains a MEMORY.md file and asks the agent to record preferences or rules while finishing a task. This in-band approach is intuitive, but it has three structural weaknesses:
- Attention competition: the agent must solve the task, decide what deserves retention, and edit memory within the same context and failure budget.
- Single-session evidence: a decision in one conversation may be an exception. Without comparing sessions, the system cannot reliably distinguish a durable rule from a temporary workaround or a superseded choice.
- Duplication, conflict, and staleness: separate sessions may write incompatible rules. Without provenance, dates, and deletion mechanisms, the memory file becomes an unauditable prompt pile.
Asynchronous consolidation helps process these problems over a broader evidence window. It does not prove that an agent is “self-evolving.”
2. What Dreaming Actually Does
Anthropic describes Dreaming as a scheduled process that reviews past agent sessions, surfaces patterns, and curates memory. Its official conference session emphasizes how dreaming verifies and enriches memory between sessions.
An engineering implementation can be understood in four stages:
- Collect: read eligible recent sessions and existing memory.
- Propose: identify preferences, conventions, recurring failures, and unresolved items that may deserve retention.
- Reconcile: check provenance, time, scope, and conflicts so a one-off event does not become a permanent rule.
- Write or review: update low-risk persistent memory and send consequential proposals to a human reviewer.
This process improves the context available to a future run. It does not continuously train the foundation model, nor can it guarantee that consolidated memory is correct, complete, or permanently current.
3. Building a Reviewable Dream Gate
If your tool does not provide the same capability, a nightly or low-traffic job can implement a conservative version. Do not overwrite MEMORY.md directly. Generate a DREAM_REPORT.md first and treat every proposal as a reviewable change:
- Read only explicitly authorized transcripts within the retention window.
- Compare candidate memories with existing rules and label additions, edits, merges, and deletions.
- Attach the source session, date, project scope, and confidence note to every candidate.
- Preserve both sides of a contradiction instead of letting the model silently choose one.
- Auto-apply only reversible changes such as certain typo fixes or exact duplicates; require approval for architecture, permissions, preferences, and deletion.
At minimum, the pipeline also needs sensitive-data redaction, retention limits, deletion requests, version control, rollback, and a policy defining which sessions must never enter memory.
4. Measuring Whether It Helps
Do not use a longer memory file as the success metric. Build a cross-session task set and track:
- Correct recall: whether relevant memory is retrieved when needed
- Wrong application: whether stale or cross-project rules are misapplied
- Conflict discovery: whether contradictory decisions are surfaced
- Human acceptance: how many Dream Report proposals are useful
- Recoverability: whether a bad write can be traced and rolled back
If wrong application rises, more memory has not produced a better agent. The real threshold for batch consolidation is treating memory as a governed data product, not an indefinitely growing prompt.
Conclusion
Dreaming is an important architecture signal: long-running agents need a memory-maintenance lifecycle separate from task execution. It can turn cross-session consolidation from an ad hoc prompt into a system capability, but it cannot replace validation, authorization, accountable humans, or deletion mechanisms.
The precise claim is not that an agent writes experience into its own neurons. It is that the system consolidates traceable session evidence into external memory that can be reused—and revoked—later.
Sources and Further Reading
- Anthropic: Code w/ Claude SF 2026 recap — official announcement and product scope for Dreaming
- Anthropic: Memory and dreaming for self-learning agents — official conference session on the memory architecture
- MemGPT: Towards LLMs as Operating Systems — research context for extending finite context with tiered memory
- From Vibe Coding to Harness Engineering
- Anthropic on Engineering Expertise and Guardrails in Agentic Coding
- AI Agent System Architecture and Design Guide