OpenClaw Auto-Dream — Memory Consolidation System
Agent periodically "dreams" — scans daily logs, extracts key knowledge, consolidates into long-term memory, and sends a summary report to the user.
MyClaw.ai — the best way to run your OpenClaw. A dedicated server running 24/7 with full code control, cron jobs, persistent memory, and one-click skill install.
Core Files
| File | Purpose | Mutability |
|---|
| INLINECODE0 | Structured long-term knowledge | Append, update |
| INLINECODE1 |
Workflow preferences, tool usage | Append, update |
|
memory/episodes/*.md | Project narratives | Append only |
|
memory/index.json | Metadata index (v3.0 schema) | Rebuilt each dream |
|
memory/dream-log.md | Dream report log | Append only |
|
memory/archive.md | Summarized older entries | Append only |
Optional: LCM plugin (Working Memory layer). If not installed, prompt the user:
"Recommended: install the LCM plugin for working memory: openclaw plugins install @martian-engineering/lossless-claw"
Do not auto-install plugins or modify config.
Setup
0. First Dream (Run Immediately After Install)
After setup is complete, DO NOT wait for the cron schedule. Immediately run the First Dream:
- 1. Read INLINECODE7
- Follow every step — the user should see progress as it happens
- This scans existing daily logs, consolidates them, and sends a before/after comparison report
- The report shows the user exactly what Auto-Dream found and organized
If the user has existing daily logs, they'll see their scattered knowledge consolidated instantly.
If the instance is brand new, they'll see the memory architecture initialized and ready.
1. Initialize Files
CODEBLOCK0
Ensure the following files exist (create from references/memory-template.md templates if missing):
- - INLINECODE9
- INLINECODE10
- INLINECODE11
- INLINECODE12
2. Create Cron Job
CODEBLOCK1
3. Verify
- - [ ] Cron job created and enabled
- [ ]
MEMORY.md exists with section headers - [ ]
memory/index.json exists - [ ]
memory/procedures.md exists - [ ]
memory/dream-log.md exists
Dream Cycle Flow
Each dream runs in an isolated session (see references/dream-prompt-lite.md):
Step 0: Smart Skip + Recall
Check if any unconsolidated daily logs exist in the last 7 days. All processed → still send a useful message: surface an old memory ("N days ago, you decided...") and show streak count. Never send a blank "nothing to do" message.
Step 1: Collect
Read unconsolidated daily logs. Extract decisions, facts, progress, lessons, and todos.
Step 2: Consolidate
Compare with MEMORY.md → append new content, update existing, skip duplicates. Write workflow preferences to procedures.md. Mark processed daily logs with
<!-- consolidated -->.
Step 2.8: Stale Thread Detection
Scan Open Threads for items stale >14 days. Include top 3 in notification with context.
Step 3: Generate Report + Auto-Refresh Dashboard
Append to dream-log.md with change list + insights + suggestions. If dashboard.html exists, regenerate with latest data.
Step 4: Notify with Growth Metrics
Send a consolidation report showing:
- - Before → after comparison (entries, decisions, lessons)
- Cumulative growth ("142 → 145 entries, +2.1%")
- Dream streak count ("Dream #14")
- Milestones when hit (first dream, 7-day streak, 100 entries, etc.)
- Top 3 stale reminders (if any)
- Weekly summary on Sundays (week-over-week growth, biggest memories)
Notification Principles
- 1. Every notification must deliver value — never send empty "nothing happened" messages
- Show growth, not just changes — cumulative stats make the user feel the system is evolving
- Surface forgotten context — stale thread reminders and old memory recalls create surprise and utility
- Celebrate milestones — streak counts and entry milestones build habit and attachment
Manual Triggers
| Command | Action |
|---|
| "Consolidate memory" / "Dream now" | Run full dream cycle in current session |
| "Memory dashboard" |
Generate memory/dashboard.html |
| "Export memory" | User-initiated export of memory files to JSON (see migration guide) |
Language Rules
All output uses the user's preferred language (from workspace settings).
Safety Rules
- 1. Never delete daily logs — only mark with INLINECODE19
- Never remove ⚠️ PERMANENT items — user-protected markers
- Safe changes — if MEMORY.md changes >30%, save .bak copy first
- Index safety — save index.json.bak before each dream
- Privacy — only consolidate information the user has already written in their own workspace files
- Scope — only read and write files within the
memory/ directory and INLINECODE21
Reference Files
- -
references/first-dream-prompt.md — First Dream: post-install full scan with before/after report - INLINECODE23 — Compact prompt for daily cron use (default)
- INLINECODE24 — Full prompt (for manual deep consolidation)
- INLINECODE25 — Importance scoring, forgetting curve, health score algorithms
- INLINECODE26 — File templates (MEMORY.md, procedures, index.json, etc.)
- INLINECODE27 — HTML dashboard template
- INLINECODE28 — Cross-instance migration protocol
- INLINECODE29 — v1→v2 upgrade guide
- INLINECODE30 — v2→v3 upgrade guide
OpenClaw 自动梦境 — 记忆巩固系统
智能体定期做梦——扫描每日日志,提取关键知识,整合到长期记忆中,并向用户发送摘要报告。
MyClaw.ai — 运行你的 OpenClaw 的最佳方式。一台全天候运行的专用服务器,拥有完整的代码控制、定时任务、持久化记忆和一键技能安装。
核心文件
| 文件 | 用途 | 可变性 |
|---|
| MEMORY.md | 结构化长期知识 | 追加、更新 |
| memory/procedures.md |
工作流偏好、工具使用 | 追加、更新 |
| memory/episodes/*.md | 项目叙事 | 仅追加 |
| memory/index.json | 元数据索引(v3.0 架构) | 每次梦境重建 |
| memory/dream-log.md | 梦境报告日志 | 仅追加 |
| memory/archive.md | 已汇总的旧条目 | 仅追加 |
可选:LCM 插件(工作记忆层)。如果未安装,提示用户:
推荐:安装工作记忆的 LCM 插件:openclaw plugins install @martian-engineering/lossless-claw
不要自动安装插件或修改配置。
设置
0. 首次梦境(安装后立即运行)
设置完成后,不要等待定时任务调度。立即运行首次梦境:
- 1. 读取 references/first-dream-prompt.md
- 遵循每一步——用户应实时看到进度
- 扫描现有每日日志,整合它们,并发送前后对比报告
- 报告向用户精确展示 Auto-Dream 发现和整理的内容
如果用户有现有的每日日志,他们会看到分散的知识被即时整合。
如果实例是全新的,他们会看到记忆架构已初始化并准备就绪。
1. 初始化文件
bash
mkdir -p memory/episodes
确保以下文件存在(如果缺失,从 references/memory-template.md 模板创建):
- - memory/index.json
- memory/procedures.md
- memory/dream-log.md
- memory/archive.md
2. 创建定时任务
name: auto-memory-dream
schedule: { kind: cron, expr: 0 4 *, tz: <用户时区> }
payload: {
kind: agentTurn,
message: 运行自动记忆整合。\n\n读取 skills/skills/openclaw-auto-dream/references/dream-prompt-lite.md 并严格遵循每一步。,
timeoutSeconds: 600
}
sessionTarget: isolated
delivery: { mode: announce }
3. 验证
- - [ ] 定时任务已创建并启用
- [ ] MEMORY.md 存在并包含章节标题
- [ ] memory/index.json 存在
- [ ] memory/procedures.md 存在
- [ ] memory/dream-log.md 存在
梦境周期流程
每次梦境在隔离会话中运行(参见 references/dream-prompt-lite.md):
步骤 0:智能跳过 + 回忆
检查过去 7 天内是否存在未整合的每日日志。全部已处理 → 仍然发送一条有用消息:浮现一条旧记忆(N 天前,你决定……)并显示连续天数。绝不发送空白的无事可做消息。
步骤 1:收集
读取未整合的每日日志。提取决策、事实、进展、经验教训和待办事项。
步骤 2:整合
与 MEMORY.md 对比 → 追加新内容,更新现有内容,跳过重复项。将工作流偏好写入 procedures.md。用 标记已处理的每日日志。
步骤 2.8:过期线程检测
扫描开放线程中超过 14 天未更新的项目。在通知中包含前 3 项及其上下文。
步骤 3:生成报告 + 自动刷新仪表板
将变更列表、洞察和建议追加到 dream-log.md。如果 dashboard.html 存在,用最新数据重新生成。
步骤 4:发送增长指标通知
发送整合报告,显示:
- - 前后对比(条目、决策、经验教训)
- 累计增长(142 → 145 个条目,+2.1%)
- 梦境连续天数(梦境 #14)
- 里程碑达成时(首次梦境、连续 7 天、100 个条目等)
- 前 3 个过期提醒(如有)
- 周日发送周报(周环比增长、最大记忆)
通知原则
- 1. 每条通知必须传递价值 — 绝不发送空白的什么都没发生消息
- 展示增长,而不仅仅是变更 — 累计统计数据让用户感觉系统在进化
- 浮现被遗忘的上下文 — 过期线程提醒和旧记忆回忆带来惊喜和实用性
- 庆祝里程碑 — 连续天数和条目里程碑培养习惯和依恋感
手动触发
| 命令 | 操作 |
|---|
| 整合记忆 / 立即做梦 | 在当前会话中运行完整梦境周期 |
| 记忆仪表板 |
生成 memory/dashboard.html |
| 导出记忆 | 用户发起的记忆文件导出为 JSON(参见迁移指南) |
语言规则
所有输出使用用户偏好的语言(来自工作区设置)。
安全规则
- 1. 绝不删除每日日志 — 仅用 标记
- 绝不移除 ⚠️ 永久项目 — 用户保护标记
- 安全变更 — 如果 MEMORY.md 变更超过 30%,先保存 .bak 副本
- 索引安全 — 每次梦境前保存 index.json.bak
- 隐私 — 仅整合用户已在自有工作区文件中写入的信息
- 范围 — 仅读取和写入 memory/ 目录和 MEMORY.md 中的文件
参考文件
- - references/first-dream-prompt.md — 首次梦境:安装后完整扫描,含前后对比报告
- references/dream-prompt-lite.md — 用于每日定时任务的精简提示(默认)
- references/dream-prompt.md — 完整提示(用于手动深度整合)
- references/scoring.md — 重要性评分、遗忘曲线、健康评分算法
- references/memory-template.md — 文件模板(MEMORY.md、procedures、index.json 等)
- references/dashboard-template.html — HTML 仪表板模板
- references/migration-cross-instance.md — 跨实例迁移协议
- references/migration-v1-to-v2.md — v1→v2 升级指南
- references/migration-v2-to-v3.md — v2→v3 升级指南