Tools
Tools: Heartbeats in OpenClaw: Cheap Checks First, Models Only When You Need Them
2026-02-07
0 views
admin
Heartbeats in OpenClaw: Cheap Checks First, Models Only When You Need Them ## The core idea: a heartbeat is a gate, not a workflow ## You usually don’t need a model for that ## A practical pattern: cheap mode first ## When should you involve a model? ## Tuning heartbeat frequency: faster isn’t always better ## Short intervals (e.g. every 5 minutes) ## Longer intervals (e.g. every 30–60 minutes) ## A simple rule of thumb ## The takeaway I used to think “heartbeat” meant “run the assistant every X minutes.” It doesn’t. In OpenClaw, a heartbeat is just a regular pulse where your agent checks a short checklist and decides one of two things: That sounds simple, but there’s a trap: if you throw an LLM at every heartbeat, you end up paying for a whole lot of “nothing happened.” This post shows the approach I’m using now: Think of a heartbeat as a gatekeeper. A good heartbeat answers questions like: If the answer is “no” to all of those… the best output is literally a single line: Anything more is noise. Most heartbeat logic is not “reasoning.” It’s just checking state. Examples that don’t need an LLM: For this, a shell script + a few API calls is perfect. Run a lightweight script first. It outputs either: Only if it prints an alert do you involve a model. That gives you the best of both worlds: A model is worth it when the output benefits from language understanding: In my setup, I keep it simple: Heartbeat schedules are like monitoring: you want fast enough to catch the important stuff, but not so frequent that it turns into spam (or cost creep). And if you need something at an exact time (“remind me at 9am sharp”), use a scheduled job (cron) instead of heartbeats. If you’re using OpenClaw (or any agent system): If you want to copy the pattern, start with a tiny script that prints either HEARTBEAT_OK or a short HEARTBEAT_ALERT list — and only summarise the alert with a model when you need to. Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse - Nothing important changed → reply HEARTBEAT_OK
- Something needs attention → send a short alert (and maybe do deeper work) - do rule-based checks first (fast, deterministic, basically free)
- only call a model when there’s actual signal (summaries, decisions, or messy human context) - Did anything break? (CI failing, errors, deploy alarms)
- Did anything change? (new PR, new task queued, new email from a customer)
- Is anything time-sensitive? (calendar event in <2 hours, expiring cert) - is the repo dirty?
- are there open PRs?
- did the agent queue grow?
- did a job fail?
- did Slack/WhatsApp disconnect? - HEARTBEAT_OK
- or HEARTBEAT_ALERT + bullet list of what changed - $0 heartbeats most of the time
- still get a clean human summary when something real happens - summarising multiple alerts into one message
- deciding what to do first when several things changed at once
- writing a “brief” that a human actually wants to read
- turning raw logs into a short action plan - run cheap checks
- if alert → use a small model (e.g. Claude Haiku) to summarise + recommend next actions - high-velocity shipping (lots of PRs / CI runs)
- active incident response
- anything with a “respond now” requirement - cost, if an LLM runs every time
- notification fatigue (“another alert… for nothing”)
- wasted compute / API calls - most solo founder work
- “keep an eye on it” workflows
- staying informed without interruptions - you’ll learn about failures later
- some tasks won’t feel “real-time” - If you’re actively shipping: 5–15 minutes
- If you’re in build mode but stable: 30 minutes
- If you’re just keeping watch: 60–120 minutes - Make heartbeats cheap and deterministic
- Treat the model as an escalation layer, not the default
- Tune frequency so you get signal, not noise
how-totutorialguidedev.toaillmshellcron