一键导入
openclaw-dream-setup
Set up nightly dream routine (memory distillation) for an OpenClaw agent including DREAM-ROUTINE.md, cron job, and archive pipeline
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Set up nightly dream routine (memory distillation) for an OpenClaw agent including DREAM-ROUTINE.md, cron job, and archive pipeline
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Add a messaging channel binding (Telegram, Slack, WhatsApp, or GChat) to an existing OpenClaw agent
Create a new scheduled cron job for an OpenClaw agent (recurring, interval, or one-shot)
Scaffold a new deterministic shell script for an OpenClaw agent with JSON output, error handling, and the json-response library
Add a new secret to the OpenClaw keychain and update the appropriate launcher/secrets script
Create a new OpenClaw agent with all required directive files, directory structure, and config registration
Restart OpenClaw gateway(s) — handles stow conflicts and verifies channels reconnect. Supports single-gateway and multi-gateway (per-tier) deployments.
| name | openclaw-dream-setup |
| description | Set up nightly dream routine (memory distillation) for an OpenClaw agent including DREAM-ROUTINE.md, cron job, and archive pipeline |
| argument-hint | ["agent-id"] |
| disable-model-invocation | true |
Configure nightly memory distillation for agent $ARGUMENTS.
Read ~/.openclaw/workspace/skills/02-memory-system.md for the full memory system guide.
OPENCLAW_REPO=$(readlink ~/.openclaw/openclaw.json 2>/dev/null | sed 's|/.openclaw/openclaw.json||')
TIER_CONFIGS=(~/.openclaw/configs/openclaw-*.json)
[[ -f "${TIER_CONFIGS[0]}" ]] && MULTI_GATEWAY=true || MULTI_GATEWAY=false
If multi-gateway, resolve the agent's tier and config:
for cfg in ~/.openclaw/configs/openclaw-*.json; do
if grep -q "\"id\": *\"$ARGUMENTS\"" "$cfg" 2>/dev/null; then
TIER=$(basename "$cfg" | sed 's/openclaw-//;s/.json//')
TIER_CONFIG="$OPENCLAW_REPO/.openclaw/configs/openclaw-$TIER.json"
break
fi
done
mkdir -p "$OPENCLAW_REPO/.openclaw/agents/$ARGUMENTS/memory/archives"
Ask the user:
Create DREAM-ROUTINE.md at $OPENCLAW_REPO/.openclaw/agents/$ARGUMENTS/DREAM-ROUTINE.md:
# DREAM-ROUTINE.md
## Trigger
Nightly cron at <time> <timezone>.
## Process
1. Read today's `memory/YYYY-MM-DD.md`
2. Read `MEMORY.md` for long-term context
3. Distill to `memory/YYYY-MM-DD-DISTILLED.md` (max 2,500 tokens)
4. Update `memory/MEMORY-DIGEST.md` (3-day rolling window, max 7,500 tokens)
5. Archive distillations older than 3 days to `memory/archives/`
## Distillation Format
# Distilled — YYYY-MM-DD
## Decisions
- <decision, who, context>
## Project Updates
- <project>: <change>
## New Context
- <new info worth remembering>
## Completed
- <finished tasks>
## Blockers
- <unresolved issues>
## Tomorrow
- <items needing attention>
## Rules
- NEVER include credentials or secrets
- Stay within 2,500 token budget
- Focus on what CHANGED, not status quo
- If no daily log exists, skip gracefully
$OPENCLAW_REPO/.openclaw/agents/$ARGUMENTS/MEMORY.md:# MEMORY.md — <Agent Name>
## Active Projects
(To be filled as the agent works)
## Key Contacts
(To be filled)
## Standing Rules
(To be filled)
$OPENCLAW_REPO/.openclaw/cron/jobs.json. Generate a UUID first:python3 -c "import uuid; print(uuid.uuid4())"
Add the job:
{
"id": "<generated-uuid>",
"agentId": "$ARGUMENTS",
"name": "<Agent Name> Dream Routine",
"enabled": true,
"schedule": {
"kind": "cron",
"expr": "0 <hour> * * *",
"tz": "<timezone>"
},
"sessionTarget": "isolated",
"wakeMode": "now",
"payload": {
"kind": "agentTurn",
"message": "Run your nightly dream routine. Read DREAM-ROUTINE.md and follow the process exactly. Read today's daily log from memory/, distill it, update the rolling digest, and archive old distillations.",
"model": "anthropic/claude-sonnet-4-5",
"timeoutSeconds": 120
},
"delivery": {
"mode": "announce",
"channel": "last"
}
}
$TIER_CONFIG$OPENCLAW_REPO/.openclaw/openclaw.jsonAdd to memory.qmd.paths:
{
"path": "$HOME/.openclaw/agents/$ARGUMENTS/memory",
"name": "$ARGUMENTS-memory",
"pattern": "**/*.md"
},
{
"path": "$HOME/.openclaw/agents/$ARGUMENTS",
"name": "$ARGUMENTS-docs",
"pattern": "*.md"
}
Replace $HOME with the user's actual home directory path.
$OPENCLAW_REPO/.openclaw/agents/$ARGUMENTS/AGENTS.md:## Every Session
1. Read `SOUL.md`
2. Read `USER.md`
3. Read `MEMORY.md` — curated long-term context
4. Read `memory/MEMORY-DIGEST.md` — rolling 3-day digest (if exists)
5. Do NOT load raw daily logs on startup
rm -f ~/.openclaw/cron/jobs.json
cd "$OPENCLAW_REPO" && stow --no-folding -t ~ .
tail -30 ~/.openclaw-$TIER/gateway.logtail -30 ~/.openclaw/logs/gateway.logmemory/YYYY-MM-DD.md) should be gitignored — they're ephemeral