heartbeat

heartbeat is a command for coding agents from paulonasc/orchestra. It costs 0 tokens per session (1,301 once invoked), scanned A, original, MIT.

A lightweight command that checks whether the project’s Orchestra state files are up to date and repairs missing updates. It can also schedule the check to run every 30 minutes.

In plain words
What is it for?
Use it for a periodic state audit, to start recurring checks, or to stop an existing recurring schedule.
Why use it?
It catches gaps in saved project state so ongoing work remains accurate without requiring a full manual review.

Command

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 commands/paulonasc/orchestra/heartbeat
Clone the repo
git clone --depth 1 https://github.com/paulonasc/orchestra

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for heartbeat

README.md
[![agentmods](https://agentmods.dev/badge/commands/paulonasc/orchestra/heartbeat.svg)](https://agentmods.dev/commands/paulonasc/orchestra/heartbeat)
Your own site
<a href="https://agentmods.dev/commands/paulonasc/orchestra/heartbeat"><img src="https://agentmods.dev/badge/commands/paulonasc/orchestra/heartbeat.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,301 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.00000 $0.01301
Opus 5 $0.00000 $0.00651
Sonnet 5 $0.00000 $0.00260
Haiku 4.5 $0.00000 $0.00130

Measured 5d ago against content hash b0da1444b632, 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 5d 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.

commands/heartbeat.md · 100 lines

How it starts

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

/o heartbeat — Periodic state audit

Lightweight check that audits whether Orchestra state is current and fixes gaps.

How it gets triggered: The agent runs /o heartbeat on the first /o invocation in a session (see dashboard section). Hooks do NOT trigger heartbeat — this prevents compaction loops.

Usage:

  • /o heartbeat — audit now + auto-schedule recurring checks every 30 minutes
  • /o heartbeat stop — cancel the recurring schedule

The main agent does exactly this (in order):

Step 1 — Quick mental check (NO tool calls): Did I do anything noteworthy since the last heartbeat? If no → output Heartbeat: all current. and stop. Zero tool calls. Done. This is the common case.

Step 2 — Schedule cron (first invocation only, 3 tool calls in main context):

Cron scheduling MUST happen in the main agent, not a subagent. Subagents can't reliably construct the exact cron prompt — they tend to simplify it to /o heartbeat, creating the recursive loop this system is designed to prevent.

# 1. List existing cron jobs
CronList()

# 2. Delete ALL existing cron jobs (prevents duplicates after compaction)
CronDelete(<each job id>)

# 3. Create new cron with INLINE prompt (NEVER "/o heartbeat")
CronCreate(
  cron: "*/30 * * * *",
  prompt: "Quick mental check: did I make commits, decisions, or progress since my last check? If yes, update .orchestra/state/sessions/{session-id}.md briefly. If no, do nothing and say nothing. Do NOT run /o heartbeat. Do NOT create cron jobs. Do NOT read files unless you need to write. Maximum 1 tool call.",
  recurring: true
)

CRITICAL: The cron prompt must NEVER be /o heartbeat or invoke any skill. It is a minimal inline instruction. If the cron invokes the skill, it creates a recursive scheduling bomb that consumes the entire context window.

Store in state/sessions/{session-id}.md: heartbeat_scheduled: true, heartbeat_job_id: <id>, heartbeat_created_at: <ISO timestamp>

Step 3 — State audit (subagent, only if noteworthy work happened):

If you did something worth recording, spawn a background subagent for the file writes:

Agent(
  description: "Heartbeat state update",
  prompt: "Update Orchestra state at <ORCH_ROOT>. Active thread: <THREAD>.

What happened since last heartbeat:
<bullet list: commits, decisions, progress, blockers, current state>

Update ONLY files that need changes:
- state/sessions/{session-id}.md — current working state
- memory/YYYY-MM-DD.md — append daily log entry
- threads/<thread>/progress.yaml — mark items done if applicable

Do NOT create cron jobs. Do NOT run /o heartbeat. Do NOT invoke skills.
Return a single summary line of what you updated.",
  run_in_background: true,
  mode: "bypassPermissions"
)

Step 4 — Output: One line to the user. Either Heartbeat: all current. or Heartbeat: [what the subagent updated]. Scheduled every 30 min.

/o heartbeat stop — inline: CronListCronDelete each → remove heartbeat fields from session file. Confirm: Heartbeat cancelled.

Rules:

  • The no-op case (nothing happened) = ZERO tool calls. Just one line of text.
  • Cron scheduling = main agent only (3 tool calls, deterministic).
  • State audit file I/O = subagent only (background, returns one line).
  • Hooks NEVER trigger /o heartbeat. Only the first /o invocation and manual user runs do.
  • After compaction, do NOT re-run heartbeat. The cron is still alive.

Read the full file on GitHub · 100 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. 5d ago First seen · 100 lines · 0 tokens per session scan A b0da1444b632

Subscribe to this mod's changes

heartbeat is a command published in the GitHub repository paulonasc/orchestra (15 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,301 tokens. 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.