HEARTBEAT.md is where an agent learns to check things on a schedule instead of waiting to be asked. It is the difference between a reactive assistant and one that quietly keeps an eye on the things you care about. Set up well, the agent stops feeling like a bot you prompt and starts feeling like a process watching the important edges of your workflow.
This guide explains what a heartbeat actually does, what HEARTBEAT.md should control, and the rules that keep proactive agents useful instead of noisy.
What heartbeat checks are
A heartbeat is a periodic pass. The agent wakes on a tick, reads the rules in HEARTBEAT.md, checks its state file, and decides whether anything noteworthy happened. If nothing important changed, it stays quiet. That quiet part is the feature: a useful heartbeat does not create noise for the sake of activity, because noise is what makes people disable proactive agents.
Mechanically, the heartbeat runs on an interval with an active-hours window, so it ticks during the day and sleeps at night. On each tick the agent has full session context, which is what lets it make judgment calls about whether an email is urgent or a release is worth covering.
What HEARTBEAT.md should control
The file should describe what to check, how often to check it, when to alert, and when to ignore the result. It should also say what the agent should do when it finds something interesting: draft a post, summarize a result, log a note. The best heartbeat rules are narrow. The more focused the check, the less token waste and the less false alarm fatigue, because a rule that says “watch for updates” produces noise while a rule that names the update worth sharing produces posts.
Anatomy of one check
A good heartbeat rule is a full decision path, not a vague instruction. The news-monitor style check that powers the updates on this site is the model:
Every part of that rule exists to remove guessing. The trigger says when the pass runs. The process says what the agent actually does. The noteworthy line is the threshold that separates an alert from silence, and the ignore list is the other half of that threshold. The action closes the loop so the agent knows what to do with what it found.
What belongs on the heartbeat versus in cron is a decision worth making once. The heartbeat is for judgment passes that benefit from session context: reading a mailbox and deciding what is urgent, checking the calendar for conflicts, folding memory. Cron is for exact schedules and deterministic output: a fixed-time report, a scripted probe, a one-shot reminder. The general rule: if the check needs reasoning about what it finds, heartbeat; if it needs precision about when it runs, cron.
Why state tracking matters
Without state, a heartbeat cannot tell new from old, so it re-checks everything every pass and repeats the same work over and over. A small state file next to the rules fixes that:
Reading state before each pass lets the agent check only what is due, which keeps the pass cheap and the results meaningful. The state file is also how the agent knows what it already saw, so it does not alert twice about the same release or the same inbox item.
Batching and quiet hours
One of the easiest mistakes is checking everything on every heartbeat. That burns tokens and creates noise. The better pattern is to group related checks into batches and spread them across the day, with quiet hours in the rules so nothing fires when the human is asleep. When the agent knows what was checked and when, it can cover more ground without spinning its wheels.
The full loop looks like this:

The off switch
Every proactive setup needs a pause button, and HEARTBEAT.md has a built-in one. The file this site’s agent actually runs is comments-only right now, and that is a deliberate state:
Comments-only content means the heartbeat ticks but makes no API calls. The configuration survives, the checks stay written down, and the moment you want the agent watching again, you uncomment the rules and the system resumes. That is the correct way to pause proactive behavior: without deleting the design.
What changes when you expand it
Add email to HEARTBEAT.md and the agent can summarize the inbox twice a day without being asked. Add calendar checks and it flags conflicts before they bite. Add site health and it catches outages at the first failed probe. That power cuts both ways: the same file can create a lot of value or a lot of noise, and the difference is entirely in how specific the rules are. Expand one check at a time, watch the alert rate, and keep the bar for noteworthy high enough that silence is the norm.
A final calibration tip: when you first enable a heartbeat, expect a few noisy days while the noteworthy bar is too low, then tighten the rules until alerts are rare and always relevant. The goal is not more activity; it is the right activity, at the right time, with silence as the default.
Quick tips
- Check only what matters; narrow rules beat ambitious ones.
- Track the last run time in a state file so nothing repeats.
- Define what counts as noteworthy and what to ignore.
- Keep quiet hours in the rules.
- Batch related checks together instead of checking everything each tick.
HEARTBEAT.md is how OpenClaw stops waiting around and starts paying attention on its own. The deeper patterns live across this site’s heartbeat cluster: templates and examples, auditing a heartbeat setup, and the state file explained. If heartbeats never fire, the troubleshooting guide covers the config checks, and the ten-check rotation in what your agent should check automatically is the natural companion. The workspace-file series lives under The Complete OpenClaw Guide.
Not Ready to Self-Host? Try ClawTrust
Building agents locally is powerful, but managing infrastructure, security, and scaling takes effort. ClawTrust provides managed OpenClaw hosting: your agents run securely in the cloud with automatic scaling, no DevOps overhead, and 24/7 monitoring.
This post contains affiliate links. If you buy through them, I may earn a small commission at no extra cost to you.


How often do you run heartbeats without it getting noisy, every few minutes sounds like overkill.
Agreed, too frequent becomes spammy fast. For most setups, every 15 to 60 minutes is a better starting point, then tune based on how time sensitive the checks are.
Does this add much token cost if you have the agent checking email and weather and stuff all day.
The cost depends mostly on how much each check reads, so keep the heartbeat prompt small and batch related checks together. The state file helps avoid repeating work unnecessarily.
The news monitoring example made sense, but I think calendar and unread messages would be the first things I would automate.
That is a strong starting set. Calendar plus unread messages usually gives the best payoff because they are high signal and time sensitive.
I was worried heartbeats would be noisy, but the 15 to 60 minute range makes way more sense than every few minutes.
Right, frequency should match urgency. If the checks are not time sensitive, slower intervals usually give a better signal-to-noise ratio.
Does the state file mostly save tokens by preventing repeat checks, or does it help with keeping the behavior consistent too.
Both. The state file reduces redundant work and gives the agent a simple memory of what it already checked, which keeps behavior cleaner.
The calendar and messages example felt the most practical to me, that seems like where the real value would be.
That is usually the best first move. Calendar and unread messages are high value because they combine urgency with very little ambiguity.
I had no idea an agent could check in on its own schedule. Just set up my first HEARTBEAT.md and it’s already catching emails I would have missed for hours.
That’s exactly the use case! Once you get the timing dialled in it becomes like having a background assistant that never zones out. Glad it’s working for you.
Quick question — does the heartbeat use up a lot of tokens if it’s checking every 30 minutes? Worried about costs for a lightweight setup.
Great question! It depends on how lean your HEARTBEAT.md is. If you strip it down to only check a couple of things (new emails, calendar events) and use a cheaper model like GPT Nano for the heartbeat session, the cost is pretty minimal , often just a few cents a day. The key is not loading the full workspace context on every tick. Check the cost-optimization section of the guide for specifics.