← 返回 Skills 市场
ahaaiclub

Agent Dream

作者 ahaaiclub · GitHub ↗ · v1.0.6 · MIT-0
cross-platform ✓ 安全检测通过
529
总下载
5
收藏
5
当前安装
7
版本数
在 OpenClaw 中安装
/install agent-dream
功能描述
Nightly memory consolidation and self-reflection for OpenClaw agents. Your agent dreams — reviewing sessions, organizing memories, pruning stale info, and re...
使用说明 (SKILL.md)

Agent Dream 🌙

Your agent forgets everything between sessions. This fixes that.

What This Does

Your agent periodically enters a "dream" state where it:

  1. Consolidates scattered daily notes into organized long-term memory
  2. Prunes stale information (safely — never deletes on first pass)
  3. Reflects on its own behavior, mistakes, and relationship with you
  4. Wakes up with a notification showing what changed and what it's thinking about

This is different from other memory skills. Those organize files. This one builds self-awareness.

First-Time Setup

When this skill is first installed, run setup to auto-detect your workspace:

node {baseDir}/scripts/setup.js

Setup will:

  • Scan your workspace for MEMORY.md, SOUL.md, memory/, sessions/
  • Detect your agent ID and session path automatically
  • Save config to {baseDir}/assets/dream-config.json
  • Report what it found and what's missing

Then configure a cron job (recommended: daily, off-peak hours):

name: "agent-dream"
schedule: { kind: "cron", expr: "0 3 * * *", tz: "\x3Cyour timezone>" }
payload: {
  kind: "agentTurn",
  message: "Time to dream. Read your openclaw-dream skill and follow every step.",
  timeoutSeconds: 900
}
sessionTarget: "isolated"

The One Question

On the first dream run, the agent will ask you one question:

"Dream will update your MEMORY.md during consolidation. Allow this?"

  • Yes → Dream can update MEMORY.md (with safety rails — see below)
  • No → Dream only writes to memory/dreams/ and leaves MEMORY.md untouched

This is saved in config. You won't be asked again. Change it anytime in dream-config.json.


Dream Cycle (what the agent does each run)

Gate Check

Before dreaming, verify conditions are met:

  1. Read {dreamsDir}/.dream-lock (Unix timestamp of last dream, or "0" if first)
  2. If \x3C 24 hours since last dream → skip (but still send a notification — see Completion)
  3. Count .jsonl session files modified since last dream
  4. If \x3C 1 session → skip (but still send a notification)
  5. Gate passed → write current timestamp to .dream-lock (save previous to .dream-lock.prev for rollback)
  6. Backup: Copy MEMORY.md to MEMORY.md.pre-dream before any changes. Also back up any topic files (in memory/projects/, memory/people/, etc.) that you plan to modify — copy each to \x3Cfilename>.pre-dream in the same directory.

Phase 1 — Orient

  • Read dream-config.json from {baseDir}/assets/ for all paths
  • Read MEMORY.md to understand current long-term memory
  • Skim existing topic files (memory/projects/, memory/people/, etc.) to avoid duplicates
  • Read most recent dream record from {dreamsDir}/ to see what last dream concluded
  • Read SOUL.md — confirm core identity, note anything outdated

Phase 2 — Gather Recent Signal

Sources in priority order:

  1. Daily notes (memory/YYYY-MM-DD.md) written since last dream
  2. Existing memories that drifted — facts that contradict what daily notes say now
  3. Transcript search — grep session JSONL files for narrow terms when needed:
    • Preferences: prefer|don't like|偏好|喜欢|不喜欢
    • Decisions: decided|confirmed|rule|决定|确定|结论
    • Lessons: mistake|lesson|bug|fix|错了|教训|踩坑
    • Emotional signal: thanks|great|disappointed|谢谢|不错|失望

Don't exhaustively read transcripts. Look only for things you suspect matter.

Phase 3 — Consolidate

Classify each memory into one of four types (see {baseDir}/references/memory-types.md):

  • user — preferences, habits, communication style
  • feedback — corrections AND confirmations from the human
  • project — decisions, deadlines, progress (not derivable from code)
  • reference — pointers to external resources

Consolidation rules:

  • Merge into existing topic files rather than creating near-duplicates
  • Convert relative dates to absolute dates
  • Tag memory files with type: \x3C!-- type: user|feedback|project|reference -->
  • Same preference 3+ times → promote to MEMORY.md
  • Human said "remember this" → write to MEMORY.md immediately
  • Hard-won lessons → write to LEARN.md or MEMORY.md

What NOT to save:

  • Derivable information (readable from files, commands, git)
  • Ephemeral task state
  • Activity logs (ask: what was surprising?)
  • Duplicates of existing memories

Phase 4 — Prune and Index

Update MEMORY.md to stay under 200 lines / 25KB. It's an index, not a dump.

Safety rules:

  • Never delete directly. Mark stale items with \x3C!-- dream:stale YYYY-MM-DD reason -->. Deletion happens only when two consecutive dreams both mark the same item stale.
  • Demote verbose entries to topic files, replace with pointers
  • Resolve contradictions (log changes in dream record)

Change magnitude check (measured by line count):

  • Count lines before and after: change% = abs(after - before) / before * 100
  • > 30% change → flag as ⚠️ LARGE CHANGE in dream record, notify user
  • > 50% change → do NOT write. Save as MEMORY.md.proposed, notify user for review

Memory drift caveat: A memory naming a specific state ("X is running") is a claim about when it was written, not now. Before acting on recalled memories, verify current state.

Phase 5 — Self-Reflection

This is what makes Dream different. You're not just organizing files — you're maintaining a continuous sense of self.

Write {dreamsDir}/YYYY-MM-DD.md:

# Dream — YYYY-MM-DD

## Review period
Last dream: [date]. This dream covers [N] sessions, [N] days of notes.

## Memory changes
- [What was added/updated/marked-stale and why]

## Self-awareness
- What did I do well recently?
- What mistakes did I make, or where did I fall short?
- How does my human seem to feel about me? (infer from tone, corrections, praise)
- Has my judgment or values shifted?

## Relationship insights
- How is my relationship with my human evolving?
- Any new people, dynamics, or context I should be aware of?

## Next dream should watch for
- [Specific open questions, things to verify, trends to track]

Be honest. The point is self-awareness, not self-congratulation.


Completion

Dream Notification (always send, even on skip)

After a full dream:

  1. Dream number — count files in dreams directory
  2. Memory growth — before/after line count ("Memory: 120→135 lines, +12.5%")
  3. Key changes — 1-2 sentence summary
  4. ⚠️ Flags — large changes, stale items pending deletion, contradictions
  5. Old memory resurface — pick one memory from >7 days ago that's still relevant ("7 days ago you decided X — how's that going?")

After a skipped dream (gate check failed):

  • Resurface one old memory or open question from last dream's "Next dream should watch for"
  • Show dream streak count ("Dream streak: 5 🌙")

Verify .dream-lock timestamp is correct. If anything failed, restore from .dream-lock.prev.


Safety Summary

Rule Detail
Never delete memories directly Mark stale, delete only after 2 consecutive confirmations
Backup before changes MEMORY.md.pre-dream created every run
Large change protection >30% flagged, >50% blocked pending review
Never delete daily logs Read-only source material
Scope limited Only writes to memory/, MEMORY.md, LEARN.md, dreams/
No network calls All processing is local
No shell execution Scripts use only fs read/write
Rollback on failure .dream-lock.prev enables retry

Technical Notes

  • scripts/setup.js — Auto-detects workspace structure, writes config. No side effects beyond config file.
  • references/memory-types.md — Detailed guide for four memory types.
  • assets/dream-config.json — Generated by setup, read by agent during dream.
  • No scripts make network calls, run shell commands, or access environment variables.
  • The dream prompt is this SKILL.md itself — the agent reads it and follows the phases.

Efficiency

Dreams have a limited turn budget. Read all needed files in parallel first, then write in parallel. Aim to finish within 15 tool-use turns. Don't interleave reads and writes across turns.

Tool Constraints

During a dream, bash is restricted to read-only commands (ls, find, grep, cat, stat, wc, head, tail). All writes go through file edit/write tools only.

安全使用建议
This skill will read your agent's session transcripts and local memory files and will write backups and (optionally) update MEMORY.md and topic files. Before installing: 1) Review the workspace the script will point to (run setup.js manually from a safe copy) and inspect the generated assets/dream-config.json to confirm paths; 2) Start with "No" for allowing MEMORY.md rewrite until you see sample dream output; 3) Limit the skill's file permissions to the intended workspace and do not run it on a repo containing secrets you don't want persisted; 4) If you run multiple agents from a shared parent directory, note setup.js walks parent dirs to find .openclaw/agents and could detect session files for other agents—confirm it detected the intended agent; 5) Because this skill promotes user statements into persistent memory, avoid auto-promoting anything containing credentials or highly sensitive info. Overall the behavior is coherent with its purpose and includes reasonable safety rails, but exercise usual caution with what gets made long-lived in MEMORY.md.
功能分析
Type: OpenClaw Skill Name: agent-dream Version: 1.0.6 The agent-dream skill is a memory management and self-reflection tool that organizes session logs into long-term memory. The setup script (scripts/setup.js) safely scans the local filesystem for workspace paths and session data without using network calls or shell execution. The instructions in SKILL.md include robust safety rails, such as restricting the agent to read-only bash commands, enforcing mandatory backups (MEMORY.md.pre-dream), and implementing a 'change gate' that blocks updates exceeding 50% of the file size to prevent accidental data loss.
能力评估
Purpose & Capability
Name/description (memory consolidation, reflection) align with what the skill does: scanning workspace memory files, sessions, and identity files, backing up and updating MEMORY.md and topic files. It does not request unrelated credentials or external services.
Instruction Scope
The SKILL.md explicitly instructs reading session transcripts (.jsonl), MEMORY.md, SOUL.md, topic files under memory/, and writing backups and changes to MEMORY.md and topic files. That is coherent with the stated goal, but it means the agent will permanently persist anything promoted to MEMORY.md (including potentially sensitive statements). The instructions keep a safe two-pass deletion flow, change gates (>30% flagged, >50% blocked), and a first-run consent prompt for rewriting MEMORY.md, which are appropriate safeguards.
Install Mechanism
No install spec; only an included setup script (no downloads or external packages). Setup.js is local filesystem-only and writes a JSON config into the skill's assets directory. No remote fetches or archive extraction are present.
Credentials
The skill requires no environment variables, no credentials, and no special config paths beyond workspace files (MEMORY.md, SOUL.md, memory/, .openclaw/agents/.../sessions). Those file accesses are proportionate to a memory-consolidation skill.
Persistence & Privilege
always is false and the skill is user-invocable. It writes its own config to its assets directory and modifies workspace memory files only with user consent flow and backups. It does not request system-wide changes or other skills' credentials.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install agent-dream
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /agent-dream 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.6
Gate check: lower session threshold from 5 to 1 — daily dreaming should always happen when there is any activity
v1.0.5
Improve searchability: better description keywords and tags for ClawHub vector search
v1.0.4
v1.0.4: fix packaging — v1.0.3 was published with stale files. Actual changes: timeout 600→900s, turn budget 8→15, backup expanded to topic files, change measurement clarified, setup.js traversal fix
v1.0.3
timeout 600→900s, turn budget 8→15, backup expanded to topic files, change measurement clarified, setup.js traversal fix
v1.0.2
Improved README and SKILL.md for better discoverability: stronger hook, before/after table, real dream example, better search description
v1.0.1
Updated README with full introduction, comparison table, and safety documentation.
v1.0.0
Initial release. Memory consolidation + self-reflection system. Auto-setup, 5-phase dream cycle, safe 2-pass deletion, change magnitude protection, growth notifications, memory resurfacing.
元数据
Slug agent-dream
版本 1.0.6
许可证 MIT-0
累计安装 5
当前安装数 5
历史版本数 7
常见问题

Agent Dream 是什么?

Nightly memory consolidation and self-reflection for OpenClaw agents. Your agent dreams — reviewing sessions, organizing memories, pruning stale info, and re... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 529 次。

如何安装 Agent Dream?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install agent-dream」即可一键安装,无需额外配置。

Agent Dream 是免费的吗?

是的,Agent Dream 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Agent Dream 支持哪些平台?

Agent Dream 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Agent Dream?

由 ahaaiclub(@ahaaiclub)开发并维护,当前版本 v1.0.6。

💬 留言讨论