Install
openclaw skills install @liuweifly/openclaw-dreamAutomatic memory consolidation for OpenClaw agents. Cleans, deduplicates, and organizes memory files (MEMORY.md + memory/*.md) like human REM sleep consolidates memories. Triggers: 'dream', 'consolidate memory', 'tidy memory', 'clean up memory', '整理记忆', '记忆整理', or automatically via cron/heartbeat. Use when memory files have accumulated noise, contradictions, stale dates, duplicates, or exceed manageable size.
openclaw skills install @liuweifly/openclaw-dreamAutomatic memory consolidation — turn scattered daily notes into clean, organized long-term memory.
Memory files accumulate noise over time: relative dates lose meaning, contradictory entries confuse the agent, duplicates waste context, and stale information causes hallucinations. Dream fixes this by running a structured consolidation pass.
openclaw cron add for daily execution (recommended: 3-4 AM)memory/.last_dream is older than 24h AND new daily notes exist since last dreamAlways run as a sub-agent to avoid blocking the main session:
sessions_spawn:
task: "Run openclaw-dream consolidation. Read the skill at skills/openclaw-dream/SKILL.md first."
mode: run
model: sonnet # use a cheaper model
For manual triggers in the main session, spawn the sub-agent, reply to user "开始整理记忆,稍后汇报结果", then yield.
MEMORY.md — note current line count, section headers, last-updated datememory/YYYY-MM-DD.md files from the last 14 daysmemory/self-improving/*.jsonl if it exists (error/correction/best_practice/decision logs).last_dream timestamp to know what's already been processedScan all content for these problems:
Relative dates — Find phrases like "yesterday", "today", "last week", "recently", "刚才", "昨天", "上周". Cross-reference with the file's date to compute the absolute date.
Contradictions — Same topic with conflicting conclusions across different files. Examples:
Duplicates — Same fact recorded in multiple daily notes. Example:
Stale entries — Information about things that no longer exist:
Unprocessed JSONL patterns — High-frequency errors or corrections in self-improving logs that should become rules in MEMORY.md
Important events not yet in MEMORY.md — Significant decisions, lessons, or changes in daily notes that deserve long-term retention
Execute fixes in this order:
Date absolutization: Replace relative dates with absolute dates
Contradiction resolution: Keep the most recent entry, remove or mark the old one
[superseded by YYYY-MM-DD] to the old entry if in a daily noteDuplicate merging: Consolidate into one canonical entry
Stale cleanup: Remove or archive entries about things that no longer exist
JSONL distillation: Extract patterns from self-improving logs
memory/self-improving/.last_distill timestampDaily notes → MEMORY.md promotion: Identify significant items worth keeping long-term
Update MEMORY.md:
*最后更新* date at the bottomRebuild vector index:
openclaw memory index --force
Generate dream log at memory/dream-log-YYYY-MM-DD.md:
# Dream Log YYYY-MM-DD
## Changes Made
- [date-fix] 3 relative dates converted to absolute
- [contradiction] Removed stale Express reference (superseded by Fastify migration)
- [duplicate] Merged 2 duplicate build command entries
- [stale] Marked ChatClaw Phase 2 as completed
- [promote] Added RhinoRank order tracking to MEMORY.md
- [distill] Added 1 new rule from error logs
## MEMORY.md Stats
- Lines: 119 → 128
- Sections: 8 (unchanged)
## Skipped
- 5 daily notes with only routine operational logs (no action needed)
Update timestamp:
date -u +%Y-%m-%dT%H:%M:%SZ > memory/.last_dream
Users can create DREAM.md in workspace root to customize behavior:
# DREAM.md
## Settings
- max_memory_lines: 250
- lookback_days: 14
- min_hours_between_dreams: 24
## Protected Sections
<!-- These MEMORY.md sections are never auto-pruned -->
- 经验教训
- 关于 River
- Agent 网络
## Custom Rules
<!-- Additional consolidation rules -->
- Always keep pricing/billing related entries
- Merge duplicate API endpoint references
If DREAM.md doesn't exist, use defaults above.
openclaw cron add \
--id dream-nightly \
--schedule "0 3 * * *" \
--task "Run openclaw-dream memory consolidation. Read skills/openclaw-dream/SKILL.md and follow Phase 1-4." \
--model sonnet \
--isolated