heartbeat

A scheduled maintenance check for an agent that runs periodic health checks, consolidates memory, and can do proactive work.

In plain words
What is it for?
It is used for cron-job audits, repairing orphaned reminders, and running the agent’s regular 30-minute checks.
Why use it?
It helps catch problems in recurring tasks and reminders during long-running sessions instead of leaving them unnoticed.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/crisandrews/clawcode/heartbeat
Any agent
npx skills add crisandrews/ClawCode --skill heartbeat
Clone the repo
git clone --depth 1 https://github.com/crisandrews/ClawCode

Made for: Claude Code, Codex.

Per session 41 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,270 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00041 $0.01270
Opus 5 $0.00020 $0.00635
Sonnet 5 $0.00008 $0.00254
Haiku 4.5 $0.00004 $0.00127

Measured 2d ago against content hash cc878a8114dd, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

heartbeat scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/heartbeat/SKILL.md · 80 lines

How it starts

The opening of the file, as written. The whole thing — 80 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Heartbeat

Run the agent's periodic checks. Triggered every 30 minutes by a local cron, or manually.

How it works

  1. 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:
    • Load the tools once per session if needed: ToolSearch(query="select:CronList,CronCreate").
    • Retire fired one-shots FIRST so the repair below cannot resurrect them: bash "$CLAUDE_PLUGIN_ROOT/skills/crons/writeback.sh" prune-expired
    • Call CronList 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).
    • If orphaned=0 and blocked=0: clear cronAudit.pending in memory/heartbeat-state.json if set — done, say nothing.
    • If 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 CronListaudit.
    • Notification throttle: write the keys still orphaned-after-repair or blocked into 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.

Read the full file on GitHub · 80 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 80 lines · 41 tokens per session scan A cc878a8114dd

Subscribe to this mod's changes

heartbeat is a skill published in the GitHub repository crisandrews/ClawCode (62 stars, last pushed 3d ago), licensed MIT. It adds 41 tokens to every session and 1,270 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

meta-optimize

Analyze ARIS usage logs and propose optimizations to SKILL.md files, reviewer prompts, and workflow defaults. Outer-loop harness optimization inspired by Meta-Harness (Lee et al., 2026). Use when user says "优化技能", "meta optimize", "improve skills", "分析使用记录", or wants to optimize ARIS's own harness components based on…

wanshuiyin/Auto-claude-code-research-in-sleep · 81 tokens

meta-apply

Privileged applier that LANDS meta-optimize / corpus-audit patches the user approved — the ONLY skill permitted to mutate the skill corpus from a self-modification proposal, with cross-model jury and human approval at landing. Use when the user says "meta apply", "/meta-apply", "land the staged patches", "应用优化", after…

wanshuiyin/Auto-claude-code-research-in-sleep · 81 tokens

auto-review-loop-minimax

Autonomous multi-round research review loop using MiniMax API. Use when you want to use MiniMax instead of Codex MCP for external review. Trigger with "auto review loop minimax" or "minimax review".

wanshuiyin/Auto-claude-code-research-in-sleep · 50 tokens

flow-next-prospect

Generate ranked candidate ideas grounded in the repo. Use when asked what to build next.

gmickel/flow-next · 22 tokens

flow-next-export-context

Export RepoPrompt context to a markdown file for review with an external LLM (ChatGPT, Claude web, etc.). Use when you want Carmack-level review but prefer an external model. Triggers on "export context", "export for external review", "export plan for ChatGPT", "export impl review context", "review with an external…

gmickel/flow-next · 81 tokens

genesis-development

This skill should be used when developing, debugging, refactoring, or building Genesis itself — tasks like "fix this in Genesis", "add a new MCP tool", "wire up the runtime", "Genesis won't start", "create a worktree", "debug the bridge", or "add a capability". Applies to any task modifying files under src/, .claude/…

WingedGuardian/GENesis-AGI · 115 tokens