← 返回
未分类

Memory-Dream

Memory consolidation for OpenClaw agents. Periodically reviews daily memory files (memory/*.md), extracts durable knowledge, and merges it into MEMORY.md — l...
OpenClaw代理的记忆整合。定期检查每日记忆文件(memory/*.md),提取持久知识并合并到MEMORY.md — ...
wavmson
未分类 clawhub v1.0.3 1 版本 100000 Key: 无需
★ 0
Stars
📥 621
下载
💾 2
安装
1
版本
#latest

概述

Dream — Memory Consolidation for OpenClaw

Memory consolidation for OpenClaw agents. Your agent accumulates daily notes in memory/YYYY-MM-DD.md files, but without periodic consolidation, long-term memory (MEMORY.md) becomes stale while daily files grow endlessly. Dream fixes this — like REM sleep for your AI.

When to Use

  • User says "dream", "做梦", "consolidate memory", or "整理记忆"
  • Cron trigger (recommended: nightly at 3:00 AM)
  • Heartbeat detects memory files piling up (>20 files or >3000 total lines)

Consolidation Flow

Phase 1 — Orient

  1. ls memory/ to inventory daily files
  2. Read MEMORY.md to understand current long-term memory structure
  3. Count: total files, total lines, files from last 7 days

Phase 2 — Scan Recent Journals

Read daily files from the last 7 days (memory/YYYY-MM-DD.md). Extract:

  • New facts, preferences, or decisions not yet in MEMORY.md
  • Information that contradicts MEMORY.md (needs correction)
  • Recurring themes (indicates importance)

Token budget rules:

  • Skip files older than 7 days (too many tokens)
  • If a file exceeds 500 lines, read only the first 200 lines
  • Focus on headings and key facts, not verbose logs

Phase 3 — Merge into MEMORY.md

Apply these operations to MEMORY.md using surgical edits (not full rewrites):

  1. Add: Append new facts to the appropriate section
  2. Correct: Update outdated information with newer data from journals
  3. Deduplicate: Merge entries that say the same thing
  4. Prune: Remove clearly obsolete info (e.g., "temporary workaround for X" when X is resolved)
  5. Absolutize dates: Convert "yesterday", "just now" → actual dates (e.g., "2026-03-27")

Phase 4 — Mark Old Journals (Optional)

For daily files older than 30 days:

  • If content is consolidated → prepend:
  • Never delete any file (user may want to look back)

Phase 5 — Report

Output a brief consolidation report:

🌙 Dream complete
- Scanned N daily files (X lines total)
- MEMORY.md: +N added / ~N corrected / -N pruned
- Next suggestion: [if any]

Critical Rules

  • MEMORY.md is the primary output — all consolidated knowledge goes here
  • Surgical edits only — use the edit tool for precise changes, never overwrite the whole file
  • Conservative by default — when unsure whether to remove something, keep it
  • No secrets in logs — don't expose API keys, passwords, or tokens in the dream report
  • Log each run — append a ## Dream Log (HH:MM) entry to today's memory/YYYY-MM-DD.md

Cron Setup

/cron add --schedule "0 3 * * *" --task "Execute dream skill: consolidate memory" --label dream-nightly

How It Works (Under the Hood)

This skill mimics the human sleep cycle's memory consolidation process:

Daily experiences          Nightly consolidation        Long-term memory
┌─────────────────┐       ┌─────────────────┐         ┌─────────────────┐
│ memory/03-26.md │──┐    │                 │         │                 │
│ memory/03-27.md │──┤    │    Dream Skill   │────────▶│   MEMORY.md     │
│ memory/03-28.md │──┤    │   (scan+merge)  │         │  (structured,   │
│ memory/03-29.md │──┘    │                 │         │   deduplicated) │
│       ...       │       └─────────────────┘         └─────────────────┘
└─────────────────┘
     Raw daily logs            Consolidation              Curated knowledge

Without Dream, MEMORY.md stays frozen at whatever was manually written, while daily files accumulate unbounded. With Dream, your agent's long-term memory stays fresh, accurate, and compact.

版本历史

共 1 个版本

  • v1.0.3 当前
    2026-05-03 04:32 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

Smart Compact

wavmson
为 OpenClaw 代理提供的智能上下文压缩。采用四阶段递进策略:扫描、抽取、检查、压缩。运行 /compact 前,此技能先扫描工具输出...
★ 0 📥 514

Session Resume

wavmson
会话恢复:Gateway 重启或 session 中断后自动恢复任务上下文并向用户报告进度;任务状态通过 .task-state.json 持久化,防止长时间任务因断线丢失。触发词包括恢复任务、resume、任务状态、断线恢复、sessio
★ 0 📥 436

Test B

wavmson
为 OpenClaw 代理提供的智能上下文压缩。采用四阶段递进策略:扫描、抽取、检查、压缩。运行 /compact 前,此技能先扫描工具输出...
★ 0 📥 394