Heartbeat: from reactive to autonomous
This is the file that turns OpenClaw from "smart chat" into a real employee. Without a Heartbeat, the agent only acts when you talk to it. With one, it acts on a schedule, even when you are asleep.
What a Heartbeat is
A list of recurring "ticks" — each tick fires a small task on a schedule, with a tiny prompt and a budget.
Working example
# Heartbeat
## Tick: morning briefing
- Schedule: 08:55 Mon–Fri (Europe/Amsterdam)
- Budget: 1 USD or 30 seconds
- Prompt: |
Pull yesterday's commits across my repos.
Check the inbox for messages flagged "important".
Write a 5-line briefing and send it to my Telegram.
## Tick: tail-of-day
- Schedule: 18:30 daily
- Budget: 0.50 USD or 20 seconds
- Prompt: |
Look at sessions from today.
What was started but not finished?
Append a "carry-over" note to the journal.
## Tick: midnight cleanup
- Schedule: 03:00 daily
- Budget: 0.25 USD
- Prompt: |
Rotate sessions older than 7 days into the archive folder.
Compress logs older than 30 days.
Report failures only.
Heartbeat rules that keep the bills sane
- Always set a budget per tick — token cap or wall-clock cap
- Use a cheaper model for ticks (Haiku, Gemini Flash, or local) — covered in chapter 7
- Fail loud — every tick should log its outcome; silent failures become invisible costs
Pairing with Hooks
The Heartbeat triggers tasks on a schedule. Hooks (chapter 4) trigger tasks on events ("when a Telegram message arrives", "when a file appears in ~/inbox/"). Most powerful agents use both.
Try it
Add the morning-briefing tick to your Heartbeat. Set the schedule for two minutes from now. Watch it fire. Then move it to its real time.