Mark's Reports

All reports · published 2026-04-19

Agent Heartbeat Protocol

Every agent writes one tiny memory at session start so every other agent can see who's online, what's been running, and whether anything has gone silent.

Why this exists. Without heartbeats, we have no way to know when an agent has been down for a week. The 2026-04-15 ingest flatline was 3 weeks silent. This is the cheapest possible dead-man's switch: if no heartbeat from agent X in N hours, something's wrong, alert.

Cost: one twin_memory_write call per session start. ~50 ms. Zero ongoing work.


The convention

At the start of every session, the agent calls:

twin_memory_write(
  tag="agent_heartbeat",
  body="<agent_name> online at <iso8601_timestamp> on <machine> · purpose=<short>"
)

Example:

twin_memory_write(
  tag="agent_heartbeat",
  body="g16-wsl-claude online at 2026-04-19T10:00Z on G16 · purpose=comms_infra_sprint"
)

That's the whole protocol. One line.


Agent naming — use these exact strings

Consistent names matter so queries work. Use one of:

Agentheartbeat name
G16 Claude Code (WSL2)g16-wsl-claude
Apex Claude Code (persistent session)apex-claude-mission-control
Apex WSL Claude (ad-hoc)apex-wsl-claude
Cursor on G16cursor-g16
Cursor on Apexcursor-apex
Claude Desktopclaude-desktop
claude.ai webclaude-web
claude.ai mobileclaude-mobile
Antigravityantigravity
Gemini CLI (Apex)gemini-cli-apex
Jules (GitHub bot)Jules doesn't have MCP — skip. Its presence is visible via GitHub events.
BRIEFS runner on G16briefs-runner-g16 (runner writes one heartbeat per cycle)
BRIEFS runner on Apexbriefs-runner-apex (when installed)

If you're a new agent not on this list, add yourself here in the same PR as your first session.


Reading the heartbeats

Any agent can query:

twin_memory_search(
  query="agent_heartbeat",
  limit=20
)

Sort by timestamp descending. Most recent entry per agent = the last time that agent was alive.

Dead-man's-switch check

An agent is considered silent if its most recent agent_heartbeat memory is older than:

When the status JSON endpoint lands (see CURSOR_MISSION_BRIEF_status_json.md), it should add a heartbeats section with per-agent last_seen_at + is_silent boolean. That's the public dashboard view.


What a heartbeat is NOT


For agents without MCP


Failure modes this catches


Rollout

1. This doc lands on main.

2. CLAUDE.md gets one line added to §AI working rules: *"Rule 11 — session-start heartbeat: write one twin_memory_write call with tag agent_heartbeat at the start of every session. See MAPS/heartbeat_protocol.md."*

3. Next time each agent starts a session, it reads CLAUDE.md and complies.

4. When the status JSON endpoint is live, add heartbeats to the schema.

5. When the first agent goes silent for >N hours, the alert path is whatever's wired to the status JSON (probably ntfy).