Guides
Dreaming: memory consolidation for AI agents
Memory consolidation, often called dreaming, is an offline pass where an agent reviews its stored memory, merges duplicates, resolves contradictions, drops stale entries and rebuilds the index. It runs between sessions, not during them. In Cozy, your own agent runs it over a Markdown wiki using the dream prompt.
What memory consolidation is
An agent that writes notes after every session accumulates clutter. The same fact gets stored twice, a decision changes but the old version stays, and the index grows until it stops being a useful map. Consolidation is the maintenance step that fixes this. The agent steps away from the task, reads what it has stored, and cleans it up.
The name "dreaming" is a borrowed metaphor. People consolidate memory during sleep, and the agent version happens while no user is waiting for an answer. The work is ordinary editing, done in bulk and on a schedule or on demand.
A typical consolidation pass does five things:
- Reviews what changed since the last pass.
- Extracts facts worth keeping.
- Reconciles entries that disagree.
- Prunes duplicates and stale entries.
- Rewrites the index so it stays short and accurate.
The Anthropic research context
Anthropic has been working in this area. Secondary coverage reports that on May 6, 2026 the company announced "dreaming" for Claude Managed Agents as a gated research preview. Per Inventive HQ, it is a scheduled four-phase pass (review, extract, reconcile, prune) that rewrites an agent's memory store, with optional human review before changes apply. The New Stack describes it as a scheduled offline process that consolidates Markdown memory files, resolves contradictions and rebuilds an index.
We could not find official Anthropic documentation for this when we researched the page, so treat those details as reported rather than confirmed. Check Anthropic's own announcements for the current state.
Other vendors have the idea too. Mem0's pricing page lists "Dream" memory consolidation on its Custom plan. Cozy's version is inspired by Anthropic's agent-memory research, but Cozy does not implement or resell any vendor's feature.
How Cozy's dreaming works
Cozy runs no model itself. Dreaming is a procedure that your own agent (Claude, Codex or another MCP client) executes against your workspace. The workspace exposes a prompt named dream next to organize, recall and maintain through its hosted MCP server. You invoke the prompt, and the agent does the work with Cozy's tools under your credentials.
The dream prompt follows this sequence:
- Orient. The agent calls
cozy_healthto see the current score and the prioritized list of fixes. - Scope. It reads
agents/dream/state.mdto find when the last run happened, then callscozy_changeswith that timestamp. It reviews what changed, not the whole wiki. - Verify. For changed pages, it checks claims against the cited files in
sources/. - Preserve history. When a value has been superseded, it keeps the old value with a date instead of overwriting it.
- Flag disagreement. When two sources conflict and it cannot decide, it writes a
CONFLICT:line so Health counts it and a person can resolve it. - Merge duplicates. It uses
cozy_resolveto find likely duplicate pages, then merges them. - Write typed relations. It adds relations such as
relation:: [[target]]so the graph carries meaning. - Keep the index short. It trims
wiki/index.mdso it remains a quick entry point. - Record the run. It updates
agents/dream/state.mdso the next pass starts from the right timestamp.
What keeps an unattended pass safe
An agent that rewrites your notes needs guardrails. Cozy provides several, all documented in the product:
- Every edit requires
expectedRevision(0 for a new file), so concurrent edits return a conflict instead of silently overwriting. - Deletion is a tombstone. The last 50 revisions of a file are readable and restorable with
cozy_historyandcozy_restore. - Moves keep history and return the links that need repair.
- Credentials are scoped (read, wiki-write, source-write), can be limited to folder prefixes, and never exceed your own access.
- Sources are treated as untrusted data, and audit history records what changed.
A wiki-write credential without source-write access is a reasonable choice for a dream run. The agent can fix pages but cannot touch the evidence it verifies against.
Dreaming and Health work together
Health is the measurement side. It reports broken links, duplicate titles and aliases, stale pages (a cited source changed after the page's last edit), conflicts, orphans, unsourced pages and oversized pages. Each page starts at 1.0 and loses weight per issue, and the score is the average times 100. The next list orders fixes by priority. See wiki health for the full rule set.
Dreaming is the repair side. Starting a run with cozy_health and ending with a recorded state file gives you a loop: measure, fix, record, measure again.
Limits to know about
- No built-in scheduler for the model. Cozy does not run an agent for you. Something has to start the run, whether that is you, a scheduled job in your agent tool, or a routine you set up there.
- Search is lexical. There are no embeddings or vector database, so duplicate detection through
cozy_resolveworks on names, aliases, titles and paths, not on meaning. - Quality depends on your agent. A weak model can merge pages it should not have. The revision history lets you undo it, but review the first few runs.
- Not a replacement for human judgment.
CONFLICT:lines exist so unresolved disagreements stay visible to a person.
Where to go next
Consolidation matters most once an agent has been writing to a wiki for a while. If you are still deciding how agents should store memory at all, read the agent memory guide. For the wiki pattern that dreaming maintains, see the LLM wiki overview. Cozy is operated by Coral Sourcing LLC and is not affiliated with Cozy Cloud (cozy.io) or Cozi.
Frequently asked questions
What is dreaming for AI agents?
Dreaming is an offline memory consolidation pass. The agent reviews stored memory, merges duplicates, reconciles contradictions, prunes stale entries and rebuilds the index between working sessions.
Does Cozy run the dreaming model for me?
No. Cozy runs no model itself. Your own agent runs the dream prompt over your workspace through the hosted MCP server, using the tools and credentials you grant it.
How does a dream run know what to review?
It reads agents/dream/state.md for the time of the last run, then calls cozy_changes since that timestamp. It begins by checking cozy_health and records the run when it finishes.
Can a dream run damage my wiki?
Edits need expectedRevision, deletions are tombstones, and the last 50 revisions of a file can be restored. Credentials can also be limited to specific scopes and folder prefixes. Reviewing early runs is still a good idea.
Is Cozy's dreaming the same as Anthropic's?
No. Cozy's version is inspired by Anthropic's agent-memory research, but it is a prompt run by your own agent on a Markdown wiki. Anthropic's dreaming for Managed Agents is, per secondary reports, a separate gated research preview.
Give your agents a memory worth keeping
Cozy gives every account a private wiki that Claude, Codex, ChatGPT and other MCP clients can read and maintain.
Start your wiki