# HEARTBEAT.md ## 🚧 Parked β€” Needs Mario ### Library Volume β€” Where are the 900 docs? - `/app/data/bulk-docs` mounted but **empty** - Mario to check on host: `find /data/muhlai-uploads -type f | wc -l` + `ls -la /data/muhlai-uploads/` - Files may be in subdirectory or wiped on Coolify volume recreation - βœ… Gmail fallback already done for Seed Capital (79 docs uploaded 2026-03-11) --- ## Periodic Tasks ### 1. Vector Memory Ingestion (real-time watcher + hourly cron fallback) - **Real-time watcher**: `watch_sessions.py` uses inotify to detect session file changes - Check if running: `bash ~/.openclaw/skills/m2-memory/scripts/start_watcher.sh status` - If NOT running, restart it: `bash ~/.openclaw/skills/m2-memory/scripts/start_watcher.sh start` - Watcher state: `memory/watcher-state.json` - Log: `memory/watch-sessions.log` - **Hourly cron fallback**: `memory-ingest-sessions` catches anything the watcher misses - If cron missed, run manually: `python3 ~/.openclaw/skills/m2-memory/scripts/ingest_sessions.py -v` - Batch state: `memory/ingest-state.json` ### 2. PMH Portfolio Inbox Scan β€” ⏸️ PAUSED (Peter, 2026-03-11) - Paused by Peter β€” too many irrelevant docs being extracted - Do NOT run the monthly inbox scan until Peter explicitly re-enables it - Script: `~/repos/mp1-muhlman-ai/scripts/monthly_inbox_scan.py -v` --- ### 3. Error Recovery Check - On each heartbeat, check if there were recent failures/crashes - If the last interaction with Peter ended in an error or silence: send him a 1-line status - Format: "I went down earlier, I'm back now. [What I was doing / current status]." - Only send once β€” don't repeat the recovery message on every heartbeat ### 4. Sub-Agent Failure Auto-Resume ⚑ (HARD GATE β€” cannot HEARTBEAT_OK until cleared) On EVERY heartbeat, check for timed-out or failed sub-agents: ```bash # Check for recent sub-agent failures (last 2h) ``` Use `subagents(action=list)` to check for recently failed runs. **β›” HARD GATE: If ANY sub-agent failed or timed out, you CANNOT reply HEARTBEAT_OK. You MUST address it first.** **If a sub-agent failed or timed out:** 1. Read its task description to understand what it was doing 2. Check what it actually completed (git log, DB state, file changes) 3. Resume the remaining work yourself or spawn a new sub-agent with a longer timeout 4. Report to Peter in ONE plain-English message: "Sub-agent timed out at [task]. Here's what it finished and what I'm picking up." 5. **Never wait for Peter to ask β€” he should never have to ask for a status on a failed task** 6. Only after steps 1-4 are done can this heartbeat section be considered cleared **Key rules:** - Sub-agents doing build/extraction work: set `runTimeoutSeconds` to **1800** (30min) minimum, **3600** for large batch jobs - If a sub-agent fails mid-task: the work is NOT lost β€” check git log and DB before assuming failure - Translate ALL error messages to plain English before reporting to Peter *Add your own periodic tasks below as your role develops.* ## Self-Improvement Review (weekly, Sundays) Check `memory/heartbeat-state.json` β†’ `lastSelfImproveReview`. If >7 days ago: **What to do:** 1. Search Qdrant for recent friction patterns: `bash ~/.openclaw/skills/m2-memory/memory.sh search "friction correction failure lesson learned" 2>&1 | head -40` 2. Read `memory/learnings.md` for accumulated observations 3. Read recent daily files (last 7 days) for patterns: permission-seeking, narration relapses, untested deploys, confident wrong answers 4. Synthesize: are there new patterns? Do existing SOUL.md/AGENTS.md principles need updating? 5. If LOW-risk change (wording, emphasis, example): apply directly to SOUL.md or AGENTS.md, commit, note in daily file 6. If HIGH-risk change (new principle, removed section, behavioral shift): write to `memory/AMENDMENT_DRAFT.md`, create Planka card on Governance & Process β†’ Proposals, notify Mario 7. Store any new fleet-wide learnings to Qdrant: `bash ~/.openclaw/skills/m2-memory/memory.sh store "FLEET LEARNING: ..." --importance 0.85 --entities "fleet,learning"` 8. Update Planka card `1725149310410032290` with review date + findings **The test:** Am I repeating the same mistakes I made last week? If yes, the principles aren't working β€” they need reframing, not restating. Update `lastSelfImproveReview: ` after running. ## Intent Extraction (every 12h) Check `memory/heartbeat-state.json` β†’ `lastIntentExtraction`. If >12h ago: ```bash bash /home/developer/.openclaw/workspace/scripts/extract-intent.sh peter ``` Update `lastIntentExtraction: ` after running.