# How do the top AI agent harnesses handle heartbeats?

Only Hermes Agent documents a feature called a heartbeat: one recurring prompt per session that fires when the session is idle. Claude Code, Codex, Cursor and Antigravity document timers or schedules under other names; the docs read for OpenCode and pi describe none. Read 2026-11-06.

Short answer, from the docs read: "heartbeat" is a Hermes Agent term, and only Hermes Agent documents a feature by that name.[1] The idea behind it, waking an agent on a timer with no new message from a person, appears in four more harnesses under other names: Claude Code's /loop and scheduled tasks, Codex's scheduled tasks, Cursor's Automations and Antigravity's SDK triggers.[2][3][4][5] OpenCode's own docs read here describe no scheduler, only a community plugin that adds one.[6] pi's extension docs describe none either.[7] This is the last page in a series that began with a [survey of the harnesses](/research/top-ai-agent-harnesses-survey), then [memory](/research/how-top-ai-agent-harnesses-handle-memory), [tool calls](/research/how-top-ai-agent-harnesses-handle-tool-calls) and [hooks](/research/how-top-ai-agent-harnesses-handle-hooks).

This page uses heartbeat in a wide sense: the harness itself starts an agent turn on a timer or on an outside event, without a person typing. A hook that fires after the agent goes idle does not count, because the person or something else still has to start the work.

## Hermes Agent is the one named heartbeat

Hermes Agent's /heartbeat gives the current session one recurring instruction. Whenever the session is idle and the interval has elapsed, the prompt fires as a normal user turn, in the same conversation, with the same context and the same prompt cache. A session has one heartbeat. The interval can be as short as 60 seconds. The heartbeat is injected only between turns, never in the middle of a run. Its state survives a restart.[1]

The docs set it against cron, which Hermes also has. A cron job runs in a fresh isolated session on each tick, there can be any number of them, and the scheduler is fully durable. The docs' rule of thumb: if the recurring prompt needs the conversation's context, use /heartbeat; if it is a self-contained job, use cron.[1]

## The same idea under other names

- **Claude Code.** /loop runs a prompt repeatedly inside a session, either on a fixed interval, such as every five minutes, or at an interval Claude chooses. A bare /loop runs a maintenance prompt that continues unfinished work and tends the branch's pull request. Session-scoped tasks only fire while Claude Code is running and idle, so closing the terminal stops them, and a loop that is not cancelled ends after seven days.[2] Claude Code's overview adds cloud scheduled tasks, which keep running when the computer is off, and desktop scheduled tasks that run on the user's machine.[8]
- **Codex.** Scheduled tasks run recurring work in the background. In the desktop app they can work on local projects, in the project directory or an isolated worktree, and need the computer on and the app running. The docs also describe scheduling a task inside an existing chat, for work that should keep the same context.[3]
- **Cursor.** Automations run cloud agents in the background, on a schedule or in response to events from GitHub, GitLab, Slack, webhooks, Linear and more. A schedule is a preset or a cron expression, and may run with a delay but not before the indicated time. An automation can have several triggers and runs when any one fires.[4]
- **Antigravity.** The SDK documents triggers that run tasks on schedules or events; its example checks a background service every 60 seconds.[5]
- **OpenCode.** The tools and plugins docs read describe no scheduler. A community plugin, opencode-scheduler, advertises recurring tasks that run "even when you're away"; it is a third-party project and was not tested.[6]
- **pi.** The extensions docs read describe events such as agent_settled that fire when a run ends, and warn against starting timers from an extension's factory function. They describe no scheduler.[7]

## Two shapes of the idea

The docs split into two shapes, and the split matters more than the names.

- **Inside the live session.** Hermes Agent's /heartbeat, Claude Code's /loop and Codex's task scheduled in an existing chat keep the conversation's context. The cost is in what is documented: Claude Code's version stops when the session ends, Codex's local tasks need the app running, and Hermes Agent's survives a restart.[1][2][3]
- **A fresh run on a trigger.** Hermes cron, Cursor's cloud Automations and Claude Code's cloud scheduled tasks start a new agent run on a schedule or an outside event. Hermes cron's docs say each tick gets a fresh isolated session, and Cursor's and Claude Code's cloud versions run without the person's computer, since they run in the cloud.[1][4][8] Whether the cloud runs carry any conversation context was not stated in the pages read.

## What the comparison rules out

These are consequences of the docs read, not findings from a test.

- "Has heartbeats" does not describe a harness. Five of seven document something timer-like, and none of the five documents it the same way.
- A timer inside a session is bounded by the session. Of the three in-session versions read, only Hermes Agent says its state survives a restart.
- Nothing read says what a heartbeat costs. A recurring prompt spends tokens on every tick, including ticks where nothing changed; Claude Code's docs mention a five-minute prompt-cache window when timing runs, which suggests cost shapes the design, but none of the pages gives a price.[2]

## Terms

- **Heartbeat:** a recurring prompt the harness sends to its own agent when it is idle, with no person typing.
- **Cron:** a standard way to write a schedule, such as every hour.
- **Trigger:** the schedule or outside event that starts an automated run.
- **Prompt cache:** a model provider's short-lived store of a prompt's start, which makes a repeated prompt cheaper if it arrives soon enough.

## Not yet proven

- **Whether any of it is reliable.** The docs describe design, not how often a scheduled run is missed.
- **Cost.** No source read gives the token cost of a heartbeat or a scheduled run.
- **OpenCode and pi.** A negative: no scheduler appeared in the pages read, which does not show none exists. The community plugin was not tested.
- **Hermes Agent's cron, and Antigravity's CLI.** Hermes cron is described only through the heartbeat page. Antigravity's triggers are cited from the SDK page only.
- **Currency.** The Hermes Agent heartbeat docs were saved on 2026-10-23; the others on 2026-11-06.

If you run an agent on a timer and the docs left something out, I would like to hear it: mackenzie@mackenziebowes.com.

## Sources

1. Hermes Agent docs, Session Heartbeats (/heartbeat), from a clone at commit 5894e750. Saved 2026-10-23. <https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/heartbeat.md>
2. Claude Code Docs, Run prompts on a schedule. Read in Rotunda 2026-11-06. <https://code.claude.com/docs/en/scheduled-tasks>
3. OpenAI, Codex docs, Scheduled tasks. Read in Rotunda 2026-11-06. <https://learn.chatgpt.com/docs/automations?surface=app>
4. Cursor Docs, Automations. Read in Rotunda 2026-11-06. <https://cursor.com/docs/cloud-agent/automations>
5. Google Antigravity Docs, Lifecycle hooks, triggers and session persistence. Read in Rotunda 2026-11-06. <https://antigravity.google/docs/sdk/lifecycle/>
6. GitHub, different-ai/opencode-scheduler, a community plugin. Read in Rotunda 2026-11-06; not tested. <https://github.com/different-ai/opencode-scheduler>
7. Pi docs, Extensions. Read in Rotunda 2026-11-06. <https://pi.dev/docs/latest/extensions>
8. Claude Code Docs, Overview. Read in Rotunda 2026-11-06. <https://code.claude.com/docs/en/overview>

---

Published 2026-11-06. Web page: https://www.mackenziebowes.com/research/how-top-ai-agent-harnesses-handle-heartbeats
