OpenClaw dreaming
The three sleep phases, what gets promoted into MEMORY.md, the Dream Diary, and the 3 am schedule
OpenClaw’s memory core has a background process the docs call dreaming: a sweep that runs three cooperative phases, light, REM and deep, moves strong short-term signals into durable memory, and keeps the whole thing explainable and reviewable. It is on by default. Here is what each phase does, what dreaming writes and where, the safety rules on a MEMORY.md rewrite, the ranking signals, the schedule, and the ways to look at it.
The three phases
- Light sorts and stages recent short-term material: it reads recent recall state, daily memory files and redacted session transcripts, dedupes signals, stages candidate lines, records reinforcement signals, and never writes to MEMORY.md.
- REM reflects on themes and recurring ideas from recent short-term traces, writes its own managed block, and records reinforcement used by deep ranking; it never writes to MEMORY.md either.
- Deep scores and promotes: candidates pass weighted scoring and three threshold gates, minimum score, minimum recall count and minimum unique queries, are rehydrated from the live daily files so stale snippets are skipped, and go to a tool-free completion that chooses additions, merges and supersessions against the current MEMORY.md.
- Only the deep phase writes durable memory, and long-term promotion writes only to MEMORY.md; the human-readable output goes to DREAMS.md and optional dated phase reports.
The diary is for human reading in the Dreams UI, not a promotion source.
The safety rules
Before the consolidation prompt is built, candidates whose provenance is untrusted or system are removed, a structural taint gate rather than a score penalty. The model returns operation decisions, not replacement prose, and the memory writer applies them using each candidate’s bounded, sourced entry. An accepted rewrite must preserve prior entries within a loss fraction, a quarter by default, include every promoted candidate’s source reference, stay within the bootstrap-safe file budget, and parse as the expected structure; if the model is unavailable or the rewrite fails validation, dreaming falls back to the older append-only promotion. The previous MEMORY.md is stored before the file changes, and DREAMS.md receives the added, merged and superseded counts with short diff-style highlights. Transcript ingestion takes only interactive sessions, never cron, heartbeat or subagent ones, redacts personal and sensitive content first, and strips recalled context so a recalled snippet cannot be learned again as new memory.
Ranking, schedule, diary
- Deep ranking uses six weighted signals: relevance at 0.30, frequency at 0.24, query diversity and recency at 0.15 each, multi-day consolidation at 0.10 and conceptual richness at 0.06, plus a small recency-decayed boost from light and REM hits. Each promoted entry carries up to three trigger phrases and an importance from 1 to 10, and existing annotated entries are kept byte for byte unless explicitly merged or superseded.
- When enabled, the memory core manages one cron job for a full sweep, at three in the morning by default in the configured timezone, sharing the background work budget of at most three runs with the other plugin completions; a multi-agent fleet needs a system agent to own the job, or the log reports that an agent-less cron job has no resolvable owner.
- After each phase has enough material, a tool-free background completion appends a short Dream Diary entry to DREAMS.md, using the agent’s default model unless a dreaming model is configured, and a failed or empty run writes a fallback entry and reports a degraded outcome so the gap is visible.
OpenClaw memory explained explains the files this sweep feeds, and OpenClaw sessions the transcripts it is allowed to read.
Turning it, reading it, backfilling it
The slash command reports status and switches dreaming on or off, the latter two for owners or Gateway admins only; the config key under the memory core plugin disables it outright or changes the cadence and timezone. The CLI previews or applies promotion, explains why a given candidate would or would not promote, and runs the REM harness without writing anything; a grounded backfill lane can replay historical daily notes or retained session history into reversible diary entries and staged candidates, with rollback commands. The Gateway’s Dreams tab shows the enabled state, phase status, counts, the next run and the diary reader. OpenClaw automations covers the cron machinery the sweep rides on.
On Diali
On Diali the memory files live in the assistant’s persistent workspace, so a sweep at three in the morning has something to consolidate and a place to keep it. Hosted OpenClaw on Diali is the assistant.
- Light stages, REM reflects, deep promotes.
- A rewrite may not drop more than a quarter of prior entries.
- The diary is for reading, never for promotion.
Stop reading about it, build one
Set up an agent, pick a channel, and have it working inside the app you already keep open.
