--- 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 --- # Set Up Dream Routine Configure nightly memory distillation for agent `$ARGUMENTS`. ## Reference Read `~/.openclaw/workspace/skills/02-memory-system.md` for the full memory system guide. ## Setup Detection ```bash 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: ```bash 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 ``` ## Steps 1. **Create directories:** ```bash mkdir -p "$OPENCLAW_REPO/.openclaw/agents/$ARGUMENTS/memory/archives" ``` 2. **Ask the user:** - What time should the dream routine run? (default: 23:00) - What timezone? (default: user's local timezone) - Any specific focus areas for distillation? (e.g., "focus on project status and commitments") 3. **Create DREAM-ROUTINE.md** at `$OPENCLAW_REPO/.openclaw/agents/$ARGUMENTS/DREAM-ROUTINE.md`: ```markdown # DREAM-ROUTINE.md ## Trigger Nightly cron at