Guide13 min read

Nikos Dritsakos, Founder

Agent dreaming for memory: how different systems consolidate what agents learn

Agent dreaming rewrites an agent's stored memory between sessions. How Letta, GitHub Copilot and Mem0 do it, what a person approves, and how to undo it.

On this page
  1. Short answer
  2. What agent dreaming is
  3. How the systems compare
  4. Letta: background edits to Git-backed memory
  5. GitHub Copilot: automatic memories, pull requests for files
  6. Mem0: consolidation at write time, synthesis on a schedule
  7. Claude Managed Agents and Codex
  8. Controlling dreamed memory
  9. Dreaming, repository instructions, or searchable sessions
  10. What to do with this
  11. Frequently asked questions

"Dreaming" is the name several agent products have landed on for the same idea: while the agent is idle, a background job reads what happened in past sessions and rewrites the agent's stored memory. Letta, GitHub Copilot and Mem0 each ship a feature with the word in its name. Claude Managed Agents has one in research preview, and Codex consolidates memories in the background without calling it that.

They differ in what gets rewritten, when, and whether a person sees the change before it takes effect. This guide compares them on those points. Every product detail was read from the vendor's documentation in November 2026.

Short answer

  • Agent dreaming is asynchronous maintenance of persistent memory. It runs outside the turn you're waiting on, reads past interactions, and writes consolidated records to an external store.
  • It isn't retrieval, context compaction or training. Those select memory, shrink a conversation and change weights. Dreaming edits what's stored.
  • Letta has background subagents edit Git-backed memory files. No person approves the edit.
  • GitHub Copilot Dreaming changes memories automatically and proposes changes to checked-in instructions and skills as pull requests.
  • Mem0 Dream merges and supersedes facts as they're written, then synthesizes patterns on a schedule.
  • Only one of those outputs, Copilot's pull requests, waits for a human. Plan for how you'd find and reverse a wrong write before you turn any of them on for shared memory.

What agent dreaming is

A dreaming job is a worker that runs on a schedule, on idle, or after some number of agent steps. It reads accumulated transcripts and existing memory entries, looks for what recurs across sessions, and writes reconciled records back. Later turns read the consolidated records and not the raw logs.

Four mechanisms get confused with each other here, and they change different things.

Retrieval, context compaction, dreaming and training compared by when each runs and what it changes. Dreaming is the only one that rewrites the external memory store between turns.
Retrieval, context compaction, dreaming and training compared by when each runs and what it changes. Dreaming is the only one that rewrites the external memory store between turns.

Retrieval picks existing records for the current task. Nothing stored changes.

Context compaction shrinks the live conversation, usually by summarising older messages. It decides what stays in the window. It doesn't decide what becomes long-term memory, though a product can use a compaction event to trigger a dreaming job, and Letta does.

Dreaming changes the stored guidance that later tasks will read.

Training changes the model's weights. None of the products here do that. We covered where that boundary sits in continual learning vs external memory.

Dreaming is an implementation pattern. There's no standard algorithm behind the word, and no guarantee that a given run finds anything worth keeping.

One example, used throughout

Across three coding sessions, an engineer corrects the agent the same way: schema changes must be zero-downtime, with the backfill in a separate script. A dreaming pass could turn those three corrections into one stored convention.

This is an illustration and not a test result. It's useful because each product would store that convention in a different place, with a different answer to "who approved this?".

How the systems compare

LettaGitHub CopilotMem0
ReadsRecent conversations and existing memory filesSynced sessions, memories, repository content and pull request review feedbackNew facts and existing memory records
Runs whenAfter a set number of agent steps, or when the context is compactedIn the background once enabled. No cadence is documentedAt write time for merge and supersede. Every 7 days on Pro, daily on Enterprise, for synthesis
WritesEdits to Git-backed memory filesMemory changes, pull requests for instructions and skills, and internal code review guidanceMerged and superseded flags, and new synthesized memories
Human approvalNone. An optional second agent passRequired to merge a pull request. None for memories or code review guidanceNone
ProvenanceGit history of the editsThe pull request diff, for checked-in filesLinks from a synthesized memory to its sources, and from a replaced memory to its replacement
UndoGit history, which you restore yourselfRevert a merged pull request. No undo for a runNothing is deleted. Filters decide what search returns

A Git-backed store and a human approval step are separate design choices. Letta has the first without the second. Copilot has both for some outputs and neither for others.

Letta: background edits to Git-backed memory

Letta agents keep memory in MemFS, a Git-backed filesystem the agent can inspect and edit, shared across all of that agent's conversations. Dreaming uses background subagents that review recent conversations and write what they find into those files, without interrupting the conversation in progress.

You configure it with /sleeptime in the CLI or the Dream settings in the app. A run fires after a set number of completed agent steps, or when the context window is compacted, and it can be turned off.

In the migration example, a subagent would write the zero-downtime convention into a project memory file. Done well, the entry says when the rule applies. Done badly, it generalises a one-off workaround, or drops an exception while tightening the wording.

There's a setting called "Agent reviews before applying". It sends proposed updates through a second background conversation. Letta's documentation is direct about what that is: it uses more model tokens and doesn't ask you for approval. A second agent agreeing isn't the same as a person agreeing.

To see what was saved, run /memory or look in $MEMORY_DIR. Git history shows what changed, and it doesn't show which conversation caused the change. For an agent that runs only locally, the repository lives on your machine and backing it up is your job.

GitHub Copilot: automatic memories, pull requests for files

Copilot Dreaming is in public preview on eligible paid plans, subject to enterprise and organization policy. It writes to three places, and each has a different control.

  • Copilot memories. Dreaming adds, updates and deletes them automatically, with no approval per change. Copilot Memory already learns repository facts and personal preferences during normal use, even when Dreaming is off. Dreaming curates what's there.
  • Checked-in instructions and skills. Dreaming proposes changes in a pull request, and the files stay as they are until someone merges it.
  • Internal code review guidance. Updated without a pull request.

So the migration convention could end up as a memory, which changes without review, or as a proposed edit to an instructions file, which you read as a diff and can correct before merging. Same rule, different gate.

The pull request path is the strongest review control in this comparison, because it reuses the workflow a team already trusts for code. It covers only one of the three outputs.

Recovery has limits the documentation spells out. Turning Dreaming off stops future runs. It doesn't undo earlier changes, close open pull requests or restore deleted memories. There's no option to undo a run, and the run details aren't a complete history of what it did. Reverting a merged pull request restores the file and leaves memories and review guidance as they were.

Two operational notes. Every run uses AI credits. And repository customization and personal memory curation both need session syncing turned on.

Mem0: consolidation at write time, synthesis on a schedule

Mem0 Dream is two mechanisms under one name.

The first runs as memories are written. When a new fact duplicates a stored one, Mem0 merges them. When it contradicts one, the older memory is marked superseded. Mem0's documentation lists merge and supersede as always on, for every plan.

The second is synthesis, a scheduled job that looks across a user's stored memories for patterns no single write would show. The documentation puts it on paid plans: every 7 days on Pro, daily and configurable on Enterprise. A user needs at least 20 memories before synthesis considers them, and turning Dream on doesn't process memories that already existed.

In the migration example, the correction would supersede an older memory that allowed blocking schema changes. Later, synthesis could connect the separate notes about zero-downtime changes and backfill scripts into one migration convention. Mem0 describes synthesis as conservative: it wants several independent observations, not one incident or the same question asked twice.

The detail that catches people is what search returns afterwards. Nothing is deleted. Merged memories are hidden by default. Superseded memories are still returned by default, marked as superseded, and a query has to pass latest_only=true to get current facts only. Storing a correction doesn't by itself mean the old rule stops coming back.

Each synthesized memory keeps a link to the memories it was built from, so a reviewer can read the evidence. Memories marked immutable are skipped.

Claude Managed Agents and Codex

Two more products do background consolidation.

Claude Managed Agents has dreams in research preview. A dream is a job you create through the API. It reads one memory store and between 1 and 100 session transcripts, and writes a new, separate memory store. The input store is never modified, so adopting the result is your decision, and discarding it costs nothing.

Codex updates its local memories in the background once a chat has been idle long enough, and a memories.consolidation_model setting chooses the model for that. Local memories are off by default, and the documentation doesn't use the word dreaming.

Controlling dreamed memory

A plausible summary can encode the wrong rule. An agent could read one approved exception as permission to run blocking migrations everywhere. Before a consolidated rule reaches memory your whole team reads, you want answers to four questions.

What each system's dreaming writes, and whether a person reviews it before it takes effect. Only GitHub Copilot's changes to checked-in instructions and skills wait for a pull request merge.
What each system's dreaming writes, and whether a person reviews it before it takes effect. Only GitHub Copilot's changes to checked-in instructions and skills wait for a pull request merge.

What was the evidence?

A record of what changed doesn't say why. Letta's Git history shows the edit and not the conversation behind it. Mem0 links a synthesized memory to its source memories, which separates the inference from the observations. A Copilot pull request shows the proposed text, and you supply the judgment.

Who approved it?

For most outputs, nobody. Copilot's pull requests are the exception, and they cover checked-in files only. For a mandatory rule such as zero-downtime migrations, have a person check the proposed wording against the actual policy. A second agent's review isn't evidence that the rule is right.

Is the old rule still returned?

Deleting a record and hiding it from search are different controls. In Mem0, a superseded rule still comes back unless the query asks for the latest only. In Copilot, a deleted memory is gone and can't be restored. Know which one your product does.

Can you undo it?

Turning the feature off never reverses what it already wrote. Git-backed stores give you history to restore from, by hand. Preserved records help you investigate, and they don't amount to a rollback button.

A cheap test settles all four. Before enabling shared-memory writes, plant a harmless, obviously wrong convention and let the system consolidate it. Then correct it, and check which records still come back and whether the agent's answers change.

Dreaming, repository instructions, or searchable sessions

These solve different problems, and most teams need more than one.

Repository instructions are explicit. A person wrote the rule, it's in version control, and a pull request changed it. Keep mandatory conventions in AGENTS.md or its equivalent. Neither a file nor a dreamed memory guarantees the agent follows the rule, so anything you can check mechanically belongs in tests and CI.

Dreaming derives rules from experience. It saves upkeep, and it produces guidance that nobody wrote and, usually, nobody reviewed. Treat its output as a proposal.

Searchable session memory keeps the sessions themselves and derives nothing in advance. Glen is this kind of tool. Its plugins record sessions from Claude Code, Codex, Cursor, Pi and Grok Build, and an agent answers a question by searching them and citing the session, pull request or thread it found. If the team later reverses a decision, Glen aims to follow the decision that stuck. An old one can still come back, and glen forget hides it from search until you restore it.

The trade is direct. A dreamed rule is short and always available, and you have to trust the summary. A cited session is longer and has to be found, and you can read what was said. For "why does this handler skip retries", you want the session. For "always use pnpm", you want a line in AGENTS.md.

Glen isn't for everyone. It's hosted with no self-hosted build, and teammates in your organization can find each other's recorded sessions. Working alone in one agent, AGENTS.md plus that agent's built-in memory or dreaming is usually enough. Our comparison of context sources goes through where each one fits.

What to do with this

  1. Keep mandatory engineering rules in version-controlled files behind pull request review, and enforce the checkable ones in CI.
  2. Use dreaming to propose and maintain learned context. Don't treat an inferred convention as approved policy.
  3. Turn autonomous consolidation on for individual workflows first, and audit what it writes before letting it write to memory a team shares.
  4. Before that step, run the planted-mistake test: find the evidence, correct the rule, and confirm the old one stops coming back.
  5. For history across teammates and agents with nothing rewritten in the background, pair repository files with searchable session memory that cites its sources.

Frequently asked questions

What is agent dreaming?

Background maintenance of an agent's persistent memory. A worker reviews past interactions or stored memories while the agent is idle and writes consolidated records for later use. It's a pattern several products implement differently, with no shared standard.

How is dreaming different from retrieval, compaction and training?

Retrieval selects stored records for a task and changes nothing. Compaction shortens the live conversation. Training changes model weights. Dreaming rewrites the external memory store or guidance files between turns.

When does dreaming run?

It depends on the product. Letta runs it after a set number of agent steps or on context compaction. Mem0 synthesizes every 7 days on Pro and daily on Enterprise, and merges and supersedes at write time. GitHub documents no cadence for Copilot Dreaming. Codex consolidates after a chat has been idle.

Does a person approve dreamed memories?

Usually not. Copilot Dreaming changes memories and code review guidance automatically, and only its changes to checked-in instructions and skills need a pull request merged. Letta's optional review is a second agent. Mem0's operations are automatic.

Can dreamed changes be undone?

Partly. A merged pull request can be reverted. GitHub documents no undo for a Dreaming run, and turning it off restores nothing. Mem0 keeps every record and links replacements to what they replaced, which supports investigation without being a one-click rollback. Claude Managed Agents writes to a separate store, so the original is untouched.

Does dreaming replace AGENTS.md?

No. AGENTS.md holds rules a person wrote and reviewed. Dreaming infers rules from sessions. Neither guarantees compliance, so requirements that can be tested should be enforced in CI.

More field notes

Fix your agents’ amnesia.

Start on your own or with up to two teammates. Your first 15,000 memories are free, no credit card.

Start free