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: How Dreams Rebuild an Agent's Memory Between Sessions

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.

A dream reads your memory and your sessions, then writes a new storeOne dream in Claude Managed Agents: what goes in, what comes out, and what stays as it was
What goes in
InputOne memory storeThe store Claude verifies, deduplicates and reorganizes
Input1 to 100 sessionsPast transcripts mined for patterns
OptionalInstructionsWhat to focus on, keep or drop
The dream
1 · pendingQueuedAn asynchronous job, run by the model you pick
2 · runningClones the input storeThe new store’s ID appears in outputs
3 · completedA new memory storeMerged, updated, with new insights
What stays as it was
The input storeNever modified
The sessionsRead, never changed

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.

Anthropic's Dreams page in the Claude Platform documentation
Anthropic’s Dreams documentation for Claude Managed Agents

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.

Anthropic’s SRE demo: what one dream changed in a team’s memory store
You · Console

Dream over the Team SRE store, with the sessions from the past 7 days that touched it.

running

a session starts; subagents read the transcripts

new note

agents fired exactly 60 seconds after an upstream CPU spike

merged

five identical entries become one

removed

one stale entry that is no longer valid

added

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

  1. 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-01 on its own does not grant them. The SDK sets the right header on each call.

  2. 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.

  3. 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.

  4. Create the dream and wait

    One call creates it (below). It takes minutes to a few hours, driven by the number of transcripts.

  5. 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:

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...
  1. client.beta.dreams.create( starts a dream. Like sessions and memory stores, it sits in the SDK's beta namespace.
  2. inputs=[ holds the dream's two inputs.
  3. {"type": "memory_store", ...} names the store to clean. The dream verifies, deduplicates and reorganizes it, into a copy. This store is not modified.
  4. {"type": "sessions", "session_ids": [...]} lists the past sessions to learn from: between 1 and 100. Their transcripts are what the dream mines for patterns.
  5. 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).
  6. instructions= is optional. It tells the pipeline what matters here: in this case, coding style counts and one-off debugging notes do not.
  7. print(dream.id) prints the dream's ID, which starts with drm_. You need it for everything after.

The call answers at once with the whole dream, still waiting:

JSON
{
  "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:

Python
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}")
statusWhat it means
pendingCreated and queued.
runningThe pipeline is working; usage updates as it goes.
completedDone. outputs holds the new memory store.
failedEnded with an error. The output store keeps whatever was written before the failure.
canceledYou stopped it. The output store stays as it was.

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:

Python
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 failed or canceled dream'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:

Python
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.

Dreaming works on every layer of an agent’s memoryThe memory hierarchy in Anthropic’s research post, from the raw log to what loads into every session
From the bottom up
1TranscriptsA searchable log of every session
2Memory notesWhat Claude writes down as it works
3RepresentationsWikis: linked pages Claude maintains
4Injected contextLoaded into every session, so kept small
What a dream can do there
Correct notesCheck them against the transcripts
Build a wikiTurn notes into a linked map
Promote a noteFloat it to the top, move details down
Fill gapsFind what many sessions share

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.

Anthropic’s Mt. Moon test: the same wrong note, with and without a dream
Raw memory

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

Memory + dreaming

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:

What Anthropic testedWhat dreaming didThe result
A wiki of about 350,000 internal files (roughly 420M tokens) from Stainless, 25 questionsOpus 5 agents built and corrected linked wiki pages over 128 sessionsWiki alone: 13% to 48% of graded criteria. Wiki plus search: 54% to 61%, against 53% for search alone, and about 20,000 fewer tokens a question
24 questions about a merger, most needing several documentsBuilt a wiki from the deal documents87% with the wiki, 73% with search alone, on the questions that needed several documents or judgment
A legal brief graded on contract termsRebuilt the wiki after the instructions were rewritten41 of 57 facts (72%), then 57 of 57
A wiki with links to pages that did not existA second dreaming passNine broken links repointed to the right page; three new pages added, one of them an index

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.

Run a dream whenWhy
Many agents write to one storeOnly a pass over all their sessions sees what they share, like the 60-second pattern in the SRE demo
Facts in the store change oftenThe dream replaces stale and contradicted entries with the latest value
A store nears its 10,000-memory limitNew writes fail at the limit; the memory doc names dreaming as one way to consolidate
A batch of work has just endedIn the launch talk, some teams start a dream when their agents finish a task and spin down
You want a knowledge base, not a pile of notesDreaming built the wikis in Anthropic's tests, over many rounds

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 usage reports 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:

error.typeWhen it happens
timeoutThe pipeline ran past its runtime budget.
internal_errorAn unclassified pipeline failure.
memory_store_org_limit_exceededYour organization hit its memory-store cap while the dream set up working storage.
input_memory_store_too_largeThe input store is over the pipeline's size limit.
input_memory_store_unavailableThe input store was archived or deleted after the dream was created.
input_session_unavailableAn input session was deleted after the dream was created.

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.md during 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.

Published
Category
Build
Related Articles
Vercel Workflow SDK 5.8: Which Steps Are Safe to Run Early?

Vercel Workflow SDK 5.8: Which Steps Are Safe to Run Early?

Vercel cut step-to-step overhead from 85 ms to 7 ms. See how speculative execution works, which steps need a retry policy, and how to roll out the upgrade.Nov 27, 2026Build
Claude Agent Teams: Setup, Use Cases and Limits

Claude Agent Teams: Setup, Use Cases and Limits

Enable Claude Code agent teams, split a review across sessions, and choose when peer discussion earns the extra usage. Includes setup and recovery steps.Nov 27, 2026Build
Odysseus AI: The Official Repository, What It Does, and How to Start

Odysseus AI: The Official Repository, What It Does, and How to Start

Find PewDiePie’s official Odysseus repository and demo, see how local and external models connect, and start the workspace with its Docker commands.Nov 27, 2026Build
Boris Cherny and How He Uses Claude Code

Boris Cherny and How He Uses Claude Code

How Boris Cherny created Claude Code, why he changed his mind about Plan Mode, and what developers can learn from his talks and interviews.Nov 27, 2026Build
Claude Code /ship

Claude Code /ship

Use /ship on your first branch, ask Claude to show its findings before it pushes fixes, and use /steward to watch checks and comments on an open PR.Nov 27, 2026Build
Anthropic's Python to Rust Migration: The Method, Step by Step

Anthropic's Python to Rust Migration: The Method, Step by Step

How Anthropic moved its Messages API from Python to Rust: the old service as the check, Claude agents fixing each difference, and a checklist to copy.Nov 26, 2026Build
NotebookLM API Guide to Notebooks, Sources and Audio Overviews

NotebookLM API Guide to Notebooks, Sources and Audio Overviews

Create a Gemini Notebook from code, add a source and see which Google API can generate an Audio Overview for a personal or business workflow.Nov 26, 2026Build
Grok API: Get a Key and Make Your First Request

Grok API: Get a Key and Make Your First Request

Get a Grok API key, send the official first request, choose a model, and see how billing and rate limits work when you call Grok from code.Nov 26, 2026Build
Newsletter

One letter, every Sunday.Working systems, not hot takes.

Weekly. No spam. Unsubscribe anytime.