Memory consolidation in three phases: Sense → Consolidate → Settle.
Daily session logs accumulate raw detail. This skill reads the ones written since the last run, promotes what matters into durable topic files, and keeps the top-level index worth reading at session start.
A two-layer memory layout:
memory/YYYY-MM-DD*.md) — raw session notes, read-only, never moved or deletedmemory/<topic>.md) — curated durable knowledge per subject (e.g. memory/clash-verge.md)MEMORY.md) — high-level status with pointers down to L2If you are starting fresh, create MEMORY.md and memory/dream-log.md before the first run. L2 files are created on demand.
memory/dream-log.md doubles as the only state this skill keeps: entries record a Consolidated through: date — the newest daily log already folded into memory. The next run scans back for the most recent entry carrying that field to know where to resume. There is no state file, no lock file, and nothing to migrate or repair.
Tell your agent:
"Run a memory dream consolidation. Follow the protocol in
<SKILL_PATH>/references/dream-protocol.md. Workspace root:<YOUR_WORKSPACE_PATH>."
Or just "run a dream consolidation" — if this skill is loaded, the agent will know what to do.
json
{
"name": "daily-dream",
"schedule": { "kind": "cron", "expr": "0 7 * * *", "tz": "<YOUR_TIMEZONE>" },
"sessionTarget": "isolated",
"payload": {
"kind": "agentTurn",
"timeoutSeconds": 1800,
"message": "Run a memory dream consolidation. Read <SKILL_PATH>/SKILL.md and <SKILL_PATH>/references/dream-protocol.md in full, then follow the protocol phases in order. Workspace root: <YOUR_WORKSPACE_PATH>. Do not modify cron jobs, agent config, the Gateway, any daily log, or memory/dreaming/**. End your final response with a one-line dream summary — the cron delivery mechanism will auto-announce it."
},
"delivery": { "mode": "announce", "channel": "<CHANNEL_TYPE>", "to": "<CHANNEL_ID>" }
}
Set expr and tz to when your human is asleep. timeoutSeconds and the batch cap are a pair — lower one without the other and a batch is admitted that cannot finish.
PhaseWritesPurposeSense❌ NoneSelect logs since the watermark, plan the workConsolidate✅ L2 files onlyPromote content into topic filesSettle✅ MEMORY.md + dream-log.mdUpdate index, write diary entry
Phase 1 is always read-only. An error in Sense never corrupts files.
A read-only planning checkpoint runs before any write: topic identity (do not merge legacy and current projects on name similarity), lifecycle (closed work must not reappear as an active TODO), secret propagation (never promote credentials into curated memory; the credential list is exhaustive and the guard is not a privacy classifier), backup (existing L2 files and MEMORY.md are copied to <WORKSPACE_ROOT>/.backup/memory-dreams/YYYYMMDD-HHMM/ with a .bak suffix first), and a post-write audit reporting size, structure, lifecycle separation, and credential patterns without gating the run. references/dream-audit.sh covers the common checks; it is not full DLP.
This protocol is written for an agent to follow, not for a program to enforce. It fails soft:
MEMORY.md is the reason to run, not a reason to abort.Exactly two conditions cancel writes: a failed backup, or a write plan reaching outside the allowed paths — and the second cancels only those targets, not the run.
The secret guard is the one hard block on content — and it blocks the offending value, not the run.
This skill works on the Markdown layer only — MEMORY.md plus memory/*.md. It never reads or writes memory/dreaming/** or memory/.dreams/**, which belong to memory-core's own built-in Dreaming, and it skips ## Light Sleep / ## REM Sleep blocks found inside a daily log. The two systems are independent: run this one with built-in Dreaming on or off.
How they differ, which adjacent components ( memory-wiki, alternate backends, database-first state, automatic memory flush) are deliberately untouched, and what the version note covers: references/memory-stack.md.
Tool names in the protocol ( exec, edit) are OpenClaw's; on another harness use its equivalents.
memory_search indexingMEMORY.md and any existing L2 filemin(bootstrapMaxChars, bootstrapTotalMaxChars − other bootstrap files); target = 80% of it ( SD_INDEX_TARGET_PCT, a knob), the remaining 20% being growth slack. Count characters, not bytes. Crossing the target means sink detail into L2 — it never blocks and never justifies deleting facts>= exists to catch same-day appends, not to re-admit the whole date at full size every run. Compare mtimes against the heading of the newest entry carrying Consolidated through:, never a later backfill headingSee references/dream-protocol.md for the complete three-phase workflow, quality gates, dream-log format, and safety rules.
5.0.3 names what the batch cap actually counts, gives a forgotten topic file one way back into view, and reports backup growth without touching it. No change to what a run produces.
5.0.2 aligns the cron template's timeoutSeconds with the batch cap it has to finish inside, and defines what a run does when 5.0.1's selection rule returns nothing at all.
5.0.1 stops a large watermark date from blocking every later date forever, and makes two silent write failures visible. The deadlock needed all three of >= selection, oldest-first resumption and the unsplittable date boundary — each correct alone. Only changed files on the watermark date are re-read now.
5.0.0 makes the index a domain-level summary rather than a mirror of the L2 topic list, and curates on every run rather than only when the index is over budget.
Both halves change what this skill produces, so an existing workspace will see its MEMORY.md restructured on the first run after upgrading. That rewrite is backed up like any other (Phase 3.1), but it is not something the human asked for on that day — hence the major version. Run it manually the first time, with someone watching, then hand it back to the schedule; later runs only touch the increment.
Full release history, with the reasoning behind each change: references/changelog.md.