/agent:heartbeatfrom ClawCode
Runs periodic agent heartbeat checks including cron health, memory consolidation, and proactive work. Useful for maintaining long-running sessions and repairing orphaned cron tasks.
Ships in ClawCode. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Run the agent's periodic checks. Triggered every 30 minutes by a local cron, or manually.
Cron health (ALWAYS — even outside active hours). This is infrastructure, not a user-facing check; it is what heals orphaned reminders in long-running sessions (see issue #32). This step manages its own state: it reads AND writes the cronAudit field of memory/heartbeat-state.json itself, here, regardless of whether the later steps run. Every heartbeat:
ToolSearch(query="select:CronList,CronCreate").bash "$CLAUDE_PLUGIN_ROOT/skills/crons/writeback.sh" prune-expiredCronList and pipe its FULL output to:
bash "$CLAUDE_PLUGIN_ROOT/skills/crons/writeback.sh" audit
(mechanical diff: refreshes lastSeenAlive, relinks survivors, prints orphan key=… / blocked key=… lines and an audit: alive=K/N … summary; exit 4 = format drift — stop, surface it, do not create anything).orphaned=0 and blocked=0: clear cronAudit.pending in memory/heartbeat-state.json if set — done, say nothing.orphaned>0: repair orphan key= lines ONLY (NEVER blocked key= lines — those have ambiguous live duplicates; recreating them would add a third copy). touch "$CLAUDE_PROJECT_DIR/memory/.reconciling" (the registry's crons are replayed verbatim, so the cron-from.sh stamp gate must be bypassed), then for each orphan key: CronCreate with that entry's cron/prompt/recurring from memory/crons.json + writeback.sh set-alive --key <key> --harness-task-id <new id>; continue past individual failures. Then rm -f "$CLAUDE_PROJECT_DIR/memory/.reconciling" immediately and re-run CronList → audit.cronAudit.pending (with a timestamp) in memory/heartbeat-state.json. Notify the user ONLY when the same key(s) were already in cronAudit.pending from the previous beat — one notice (orphans: "couldn't re-create X, run /agent:crons reconcile"; blocked: "X has duplicate live reminders, review with /agent:crons list"), then record it as notified so it doesn't repeat every beat.Check active hours — read agent-config.json for heartbeat.activeHours. If outside the window, skip the remaining steps silently (the cron-health step above already ran).
Load state — read memory/heartbeat-state.json (if exists) to know when each check last ran. Avoid repeating checks done less than 30 min ago.
Read HEARTBEAT.md — this is the checklist. Follow it strictly. Do not infer or repeat old tasks from prior conversations. If nothing in the checklist needs attention, skip to step 7.
Execute checks — rotate through the items in HEARTBEAT.md, doing 2-4 per heartbeat (not all every time). For each:
dream(action='status') → note high-recall items not yet promotedProactive work (do without asking):
IMPORT_BACKLOG.md if it exists — remind user about pending itemsUpdate state — write memory/heartbeat-state.json with timestamps for each check performed.
Notify or stay quiet:
The agent should edit HEARTBEAT.md during normal conversations when something needs periodic attention:
- **Email inbox** — check for urgent unread to HEARTBEAT.mdRule: batch similar checks into HEARTBEAT.md instead of creating multiple cron jobs. Heartbeats are cheaper (one turn, multiple checks) than separate crons (one turn each).
{
"heartbeat": {
"activeHours": {
"start": "08:00",
"end": "23:00",
"timezone": "America/Santiago"
}
}
}
Outside this window, heartbeats skip silently. Configure via /agent:settings.
Created automatically on first session (SessionStart hook):
*/30 * * * * (every 30 minutes)/agent:service installWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
heartbeat, cron-health, memory-consolidation, periodic-checks
npx claudepluginhub crisandrews/clawcode --plugin agent21 skills in this plugin
/aboutShow the plugin source — name, version, and repo URL. Works from CLI or messaging. Triggers on /about, /version, /agent:about, /agent:version, "qué versión", "what version", "about the plugin", "about clawcode"./channelsShow messaging channel status (WhatsApp, Telegram, Discord, iMessage, Slack, Fakechat) and the launch command to load them. Triggers on /agent:channels, /agent:channels list, /agent:channels status, /agent:channels launch, "ver canales", "estado de canales", "cómo lanzo con whatsapp", "channel status", "messaging status"./compactFlush important session context to daily log (manual memory flush). Does NOT invoke native /compact. Triggers on /compact, /agent:compact, /flush, "guarda memoria", "flush"./createCreate a new agent in the current directory with personality files and bootstrap ritual. Triggers on /agent:create, "crear agente", "nuevo agente", "new agent", "create agent"./cronsManage scheduled reminders (crons) — list, add, delete, pause, resume, reconcile, or import from OpenClaw. Triggers on /agent:crons, /agent:reminders; listing ("list reminders", "show crons", "recordatorios", "mis crons", "mis recordatorios"); creating from natural language via any channel ("recordame", "recuérdame", "me recuerdas", "hazme acordar", "agendame", "agéndame", "avísame", "remind me", "remind me in", "reminder in", "schedule a reminder", "set a reminder", "wake me at", "every day at", "todos los días a las", "every monday|tuesday|...", "todos los lunes|martes|...", "cada N minutos|horas"); importing ("import crons", "importar crons", "traer crons")./doctorRun diagnostic checks on the agent workspace. Triggers on /agent:doctor, "diagnóstico", "diagnostico", "doctor", "health check", "agent health", "checkup", "revisar agente", "agent broken", "fix agent", "revisa el agente".Other plugins' skills for the same job