Claude Dreaming: How Dreams Rebuild an Agent's Memory Between Sessions
Claude dreaming in Managed Agents: what a dream reads, the new memory store it writes, the request line by line, how to review it, and what it costs.
Published

Claude dreaming is a job in Claude Managed Agents that reads an agent's memory store alongside up to 100 of its past sessions, then writes a new, cleaned-up store: duplicates merged, stale entries replaced, new patterns written down. Your original store is never touched, so you read the result before any agent does. As of November 2026 it is a research preview on the Claude API.
What Claude dreaming is
An agent on Managed Agents writes to its memory store as it works. Each write is local: one session, one task, one moment. Anthropic's Dreams documentation names what that does over time: a store collects duplicates, contradictions and stale entries.
A dream is the clean-up. In the doc's own terms, it is an asynchronous job that reads an existing memory store alongside past session transcripts and produces a new, reorganized memory store, with duplicates merged, stale or contradicted entries replaced with the latest value, and new insights surfaced.
As of Nov 27, 2026 · Source: Anthropic, Dreams (Claude Platform Docs)
Anthropic announced dreaming in a talk posted on May 8, 2026, by Mahesh, a product manager on its platform team. The launch post says what it is for: patterns a single agent cannot see on its own, such as recurring mistakes, workflows that agents converge on, and preferences shared across a team. One agent sees its own session. A dream sees up to a hundred at once.
What a dream changes, in Anthropic's own demo
The launch talk shows one dream end to end. A team runs SRE agents that answer alerts. Each agent mounts two stores: an org-wide knowledge store it can only read (runbooks, SLO guidelines, owners to page) and a team SRE store it can write to. Agents add notes to the SRE store as they investigate. Then someone opens the store in the Claude Console and starts a dream from its dreaming tab.
Dream over the Team SRE store, with the sessions from the past 7 days that touched it.
a session starts; subagents read the transcripts
agents fired exactly 60 seconds after an upstream CPU spike
five identical entries become one
one stale entry that is no longer valid
a verification note: checked against a transcript, safe to rely on
The first change is the one no single agent could make. Each agent saw its own alert. Only a pass over all the sessions could see that the agents kept being triggered 60 seconds after a CPU spike upstream, a pattern that points at inefficient retry logic. The other three changes are housekeeping a busy store needs anyway.
How to run a dream, step by step
Get access
Dreams are a research preview. You request access on Anthropic's form. The dream endpoints need the beta header
dreaming-2026-04-21;managed-agents-2026-04-01on its own does not grant them. The SDK sets the right header on each call.Have a store worth cleaning
A dream needs a memory store your agents already read and write, and the IDs of past sessions (
sesn_…) that used it. In the launch demo, the Console's dreaming tab offered the sessions that touched the store.Start small
Pick a handful of sessions, not a hundred. The doc's own advice: start with a small batch and scale up once you're satisfied with the quality, because cost grows with the number and length of the sessions.
Create the dream and wait
One call creates it (below). It takes minutes to a few hours, driven by the number of transcripts.
Review, then attach or discard
The output is an ordinary memory store. Read it, then point your next sessions at it, or delete it.
The request, line by line
This is the doc's own example, in Python:
dream = client.beta.dreams.create(
inputs=[
{"type": "memory_store", "memory_store_id": store_id},
{"type": "sessions", "session_ids": [session_a, session_b]},
],
model="claude-opus-5-5",
instructions="Focus on coding-style preferences; ignore one-off debugging notes.",
)
print(dream.id) # drm_01...client.beta.dreams.create(starts a dream. Like sessions and memory stores, it sits in the SDK'sbetanamespace.inputs=[holds the dream's two inputs.{"type": "memory_store", ...}names the store to clean. The dream verifies, deduplicates and reorganizes it, into a copy. This store is not modified.{"type": "sessions", "session_ids": [...]}lists the past sessions to learn from: between 1 and 100. Their transcripts are what the dream mines for patterns.model="claude-opus-5-5"chooses the model that runs the dreaming pipeline, and so the token rate you pay. Only listed models work (see the limits below).instructions=is optional. It tells the pipeline what matters here: in this case, coding style counts and one-off debugging notes do not.print(dream.id)prints the dream's ID, which starts withdrm_. You need it for everything after.
The call answers at once with the whole dream, still waiting:
{
"type": "dream",
"id": "drm_01AbCDefGhIjKlMnOpQrStUv",
"status": "pending",
"inputs": [
{ "type": "memory_store", "memory_store_id": "memstore_01Hx..." },
{ "type": "sessions", "session_ids": ["sesn_01...", "sesn_02..."] }
],
"outputs": [],
"model": { "id": "claude-opus-5-5" },
"instructions": "Focus on coding-style preferences; ignore one-off debugging notes.",
"session_id": null,
"created_at": "2026-04-29T17:04:10Z",
"ended_at": null,
"archived_at": null,
"usage": {
"input_tokens": 0,
"output_tokens": 0,
"cache_read_input_tokens": 0,
"cache_creation_input_tokens": 0
},
"error": null
}Three fields matter later. outputs is empty now; the new store's ID lands there shortly after the dream starts running, once it has cloned your input store, and a running dream can briefly still show it empty. session_id will point at the session that runs the pipeline. usage counts tokens as the work goes, and tokens are what a dream is billed on.
Then you wait. The doc's loop checks every ten seconds:
while dream.status in ("pending", "running"):
time.sleep(10)
dream = client.beta.dreams.retrieve(dream.id)
print(f"status={dream.status} input_tokens={dream.usage.input_tokens}")While it runs, you can watch it work. Its session_id points at an ordinary session, and streaming that session's events shows what the dream reads and writes in real time. When the dream ends, the session is archived, not deleted, so the transcript stays readable.
client.beta.dreams.cancel(dream.id) stops a pending or running dream at once. Canceling a completed or failed dream returns a 400. client.beta.dreams.archive(dream.id) hides a finished dream from the default list (it stays readable by ID); there is no unarchive, and archiving a dream does not touch its output store.
Steer it with instructions, not edits
The instructions field shapes the whole pass: what to read closely, what to merge or drop, how to lay out the new store. The doc lists what it is good for: focus areas, content to preserve unchanged, and conventions you want across the store.
What it cannot do is edit a line. The doc is explicit: the pipeline is a synthesis pass over the inputs, not an editor, so an order like "change sentence X to Y" or "fix the count in section Z" generally changes nothing. For a precise fix, let the dream finish, then edit that one memory in the output store through the Memory Stores API.
Anthropic's research post shows how much the right instructions are worth. Agents built a wiki from a set of contracts with basic instructions, several of them writing to one shared table, and overwrote each other's work; a brief written from that wiki carried 41 of 57 graded facts (72%). Claude then found better instructions itself, in a loop that reflected on its failures and rebuilt the wiki. Once the instructions said what mattered (one page per contract, written by one agent, terms quoted word for word), the brief carried all 57.
Review a dream's output, then keep it or discard it
When the status reads completed, the memory_store entry in outputs is a full, ordinary memory store in your workspace. Nothing reads it yet. You can open it in the Claude Console or through the Memory Stores API.
A quick first look is what appeared and what went away. This compares the paths in the two stores with the memory doc's own list call:
output_store_id = next(
output.memory_store_id for output in dream.outputs if output.type == "memory_store"
)
def paths(memory_store_id):
return {m.path for m in client.beta.memory_stores.memories.list(memory_store_id, path_prefix="/")}
before, after = paths(store_id), paths(output_store_id)
print("new in the dream's store:", sorted(after - before))
print("gone from it:", sorted(before - after))Then read the memories that changed in full (the retrieve call returns a memory's whole text) and judge them against what you know:
- Keep it when the facts your agents rely on are still there, a contradicted entry now carries the latest value, merged notes are fewer and clearer, and each new insight points back to something that happened in the sessions.
- Fix it, then keep it when one memory is wrong and the rest is good. Edit that memory in the output store with the Memory Stores API; a second dream is the wrong tool for one line.
- Discard it when it dropped something you know is still true, kept a stale value, wrote an insight you cannot trace to a session, or ignored the structure you asked for. Discard a
failedorcanceleddream's output too: it holds only what was written before it stopped.
To use it, attach it to the next session in place of the old store, or alongside it. This is the doc's code:
session = client.beta.sessions.create(
agent=agent_id,
environment_id=environment_id,
resources=[
{"type": "memory_store", "memory_store_id": output_store_id},
],
)A store can only be attached when a session is created, not added to one that is running, and a session takes at most eight stores. Once your sessions run on the new store, the memory doc's advice is to archive or delete the original. Archiving makes a store read-only and can't be undone; deleting removes it with all its memories and versions.
To throw a dream's output away, delete that store, or archive it if you want to keep it as a record.
What Anthropic's research found about memory and dreaming
Anthropic's research post, The components of agent memory, starts from sleep. People record experiences as they go, and much of the sorting into lasting knowledge seems to happen offline, while we rest. Agents can split the work the same way: write notes during a session, then reflect on the logs between sessions to fix mistakes and build better notes. Researchers at Letta and UC Berkeley proposed the idea as sleep-time compute; the process is often called dreaming.
As of Nov 27, 2026 · Source: Anthropic, The components of agent memory
Good memory starts in the session. On a task from CL-Bench 1.0, where Claude answers database questions and is told the right answer after each one, Claude Opus 5.5 went from a mean reward of 0.655 with no memory to 0.838 with a memory store. Telling the models to "record only failures" hurt: it took 0.234 off Opus 5's gain from memory. In a Pokémon Red run, Claude Sonnet 3.7 wrote 413 memory files across 225 folders and earned one badge; Claude Fable 5 wrote nine files in two folders, plus one global.md, and earned four. The lesson the post draws: tell a strong model what memory is for, and let it judge what to keep.
A dream can correct a wrong note. Notes are written in the moment, so a note can be wrong from the start and still be trusted later. The post's own example comes from Mt. Moon, a cave whose entrance sits near a one-way ledge.
Note: the PokéCenter is on the east side (it is not)
“Mt Moon is behind me.”
Walks off the ledge, back onto the earlier route, three times
Backtracks to Pewter City; never reaches Cerulean
The dream checks that note against the session transcript
It catches the error and rewrites the note
“Now I need to find the Mt Moon cave entrance to re-enter”
Reaches Cerulean City at action 1,935
The transcript was the ground truth. The note said one thing; the record of what actually happened said another, and the dream sided with the record.
The rest of the post tests dreaming on documents rather than games:
The post is as clear about where it did not help. On one legal task the answers sat in a single document, and the wiki showed no clear gain over plain search. On another, the wiki grew to 203 KB from 115 KB of source documents, 1.77 times the corpus: a map as large as the territory, which abstracts nothing. And dreaming costs compute, so the post suggests aiming it at what is likely to change and tuning how often it runs.
One customer reports the same direction. In the launch post, Harvey, which runs legal drafting and document work on Managed Agents, says that with dreaming its agents remember what they learned between sessions, including filetype workarounds and tool-specific patterns, and that completion rates went up about 6x in its tests.
When to run a dream
Run one when the store has started to hurt: agents rediscover what an earlier session already found, two notes disagree, or a note describes a world that has moved on. Before that, there is little to merge.
On cadence, the launch talk describes dreams started on a schedule from the Console or the API, or from inside your own process. Start with one dream over a few sessions, read the output, and only then put it on a clock.
If you need more control than the Dreams API gives, Anthropic's dreaming cookbook builds the same idea yourself, as a dynamic workflow: you choose the prompts, the models and the inputs, and it updates your store in place, every night from cron if you want. The trade: updating in place has no review step by default, so a bad transcript can reach your agent the next morning; the cookbook saves a copy of the store's files before each run.
What a dream costs, and its limits
Everything here is as Anthropic's docs state it in November 2026.
- Price. A dream is billed at standard API token rates for the model you choose. The dream's
usagereports the exact totals: input tokens, output tokens, cache reads and cache writes. Cost grows roughly in line with the number and length of the input sessions. - Time. Minutes to a few hours, driven by the number of transcripts.
- Size. One memory store and 1 to 100 sessions per dream. An input store over the pipeline's size limit fails with
input_memory_store_too_large; the doc does not give the number. - Rate. Default rate limits apply to creating dreams during the preview; for higher ones, the doc says to contact Anthropic support.
- Models. Claude Fable 5.2, Fable 5.1 and Fable 5; Claude Opus 5.5, Opus 5, Opus 4.8 and Opus 4.7; Claude Sonnet 5.5, Sonnet 5 and Sonnet 4.6. No Haiku model is on the list.
- Data. Managed Agents, dreams included, are not eligible for zero data retention (except self-hosted Managed Agents) or for HIPAA. Session transcripts persist until you delete them.
- Memory stores around it. A store holds up to 10,000 memories; a session mounts up to eight stores; each change to a memory is kept as a version for 30 days.
The doc's list of errors, so a failed dream is quick to read:
What dreaming is not
- It is not training. Nothing in the model changes. Anthropic's research post defines agent memory as knowledge saved as context Claude can read later, and sets it apart from changes to the model's weights. A dream rewrites text files in a memory store; the model that reads them tomorrow is the same model.
- It is not compaction. Compaction summarizes a session's older turns so that one session can keep going. A dream works between sessions, on the store they share.
- It is not the memory in the Claude apps. The app memory saves topics about you as you chat, and you manage it under Settings > Your Claude. Dreams are a Managed Agents API resource for agents you build. Our guide to Claude memory covers the app side.
- It is not Claude Code's auto memory. In Claude Code, Claude maintains its own
MEMORY.mdduring the session, and only the first 200 lines or 25 KB of it load into a session. Claude Code's memory documentation, as of November 2026, describes no dream step. - It is not an editor. Instructions steer a synthesis; they do not change a chosen line. Line fixes go through the Memory Stores API.
- It does not change your agents by itself. The launch post says you choose how much control you want: memory can update automatically, or you can review changes before they land. In the API as documented, both are your code. A dream writes a new store, and no agent reads it until you attach it.
Does Claude dreaming change the model?
No. A dream rewrites the text in a memory store. The model's weights are untouched, and the next session runs the same model on better notes.
Can I use dreaming in the Claude app?
Dreams are part of Claude Managed Agents on the Claude API, for agents you build. The memory in the Claude apps is a separate feature with its own settings.
Does a dream overwrite my memory store?
No. It writes a separate output store and never modifies its inputs. You decide whether your sessions use the new store.
How long does a dream take, and what does it cost?
Minutes to a few hours, depending on how many transcripts it reads. It is billed at the standard token rates of the model you choose, and the dream's usage field shows the exact totals.
Where to go next
If your agents do not keep memory yet, start there: a dream needs a store with something in it. When you are choosing where that memory should live in the first place, the comparison below weighs the options.
Best Persistent Memory Systems for AI Agents 2026
Where an agent's memory should live, compared on the same lines, Managed Agents memory stores among them.
Agent Memory Explained: Context, Sessions, Stores and Costs
What an agent should remember between tasks, and what each layer of memory costs to run.
Claude Agent SDK
The agent loop from Claude Code inside your own Python or TypeScript app: when to pick it, and how to start.
Claude Agent Teams: Setup, Use Cases and Limits
Several Claude Code sessions on one job, one of them leading: setup, uses and limits.
- Published
- Category
- Build








