Caricamento in corso...
Caricamento in corso...
Last synced: Today, 22:00
Technical reference for the OpenClaw framework. Real-time synchronization with the official documentation engine.
Use this file to discover all available pages before exploring further.
Heartbeat runs periodic agent turns in the main session so the model can surface anything that needs attention without spamming you.
Heartbeat is a scheduled main-session turn — it does not create background task records. Task records are for detached work (ACP runs, subagents, isolated cron jobs).
Troubleshooting: Scheduled Tasks
Example config:
json5{ agents: { defaults: { heartbeat: { every: "30m", target: "last", // explicit delivery to last contact (default is "none") directPolicy: "allow", // default: allow direct/DM targets; set "block" to suppress lightContext: true, // optional: only inject HEARTBEAT.md from bootstrap files isolatedSession: true, // optional: fresh session each run (no conversation history) skipWhenBusy: true, // optional: also defer when subagent or nested lanes are busy // activeHours: { start: "08:00", end: "24:00" }, // includeReasoning: true, // optional: send separate `Reasoning:` message too }, }, }, }
30m1hagents.defaults.heartbeat.everyagents.list[].heartbeat.every0magents.defaults.heartbeat.promptRead HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.0mHEARTBEAT.mdheartbeat.activeHoursheartbeat.skipWhenBusy: trueThe default prompt is intentionally broad:
Heartbeat can react to completed background tasks, but a heartbeat run itself does not create a task record.
If you want a heartbeat to do something very specific (e.g. "check Gmail PubSub stats" or "verify gateway health"), set
agents.defaults.heartbeat.promptagents.list[].heartbeat.promptHEARTBEAT_OKHEARTBEAT_OKackMaxCharsHEARTBEAT_OKHEARTBEAT_OKOutside heartbeats, stray
HEARTBEAT_OKHEARTBEAT_OKjson5{ agents: { defaults: { heartbeat: { every: "30m", // default: 30m (0m disables) model: "anthropic/claude-opus-4-6", includeReasoning: false, // default: false (deliver separate Reasoning: message when available) lightContext: false, // default: false; true keeps only HEARTBEAT.md from workspace bootstrap files isolatedSession: false, // default: false; true runs each heartbeat in a fresh session (no conversation history) skipWhenBusy: false, // default: false; true also waits for subagent/nested lanes target: "last", // default: none | options: last | none | <channel id> (core or plugin, e.g. "bluebubbles") to: "+15551234567", // optional channel-specific override accountId: "ops-bot", // optional multi-account channel id prompt: "Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.", ackMaxChars: 300, // max chars allowed after HEARTBEAT_OK }, }, }, }
agents.defaults.heartbeatagents.list[].heartbeatheartbeatchannels.defaults.heartbeatchannels.<channel>.heartbeatchannels.<channel>.accounts.<id>.heartbeatIf any
agents.list[]heartbeatagents.defaults.heartbeatExample: two agents, only the second agent runs heartbeats.
json5{ agents: { defaults: { heartbeat: { every: "30m", target: "last", // explicit delivery to last contact (default is "none") }, }, list: [ { id: "main", default: true }, { id: "ops", heartbeat: { every: "1h", target: "whatsapp", to: "+15551234567", timeoutSeconds: 45, prompt: "Read HEARTBEAT.md if it exists (workspace context). Follow it strictly. Do not infer or repeat old tasks from prior chats. If nothing needs attention, reply HEARTBEAT_OK.", }, }, ], }, }
Restrict heartbeats to business hours in a specific timezone:
json5{ agents: { defaults: { heartbeat: { every: "30m", target: "last", // explicit delivery to last contact (default is "none") activeHours: { start: "09:00", end: "22:00", timezone: "America/New_York", // optional; uses your userTimezone if set, otherwise host tz }, }, }, }, }
Outside this window (before 9am or after 10pm Eastern), heartbeats are skipped. The next scheduled tick inside the window will run normally.
If you want heartbeats to run all day, use one of these patterns:
activeHoursactiveHours: { start: "00:00", end: "24:00" }Use
accountIdjson5{ agents: { list: [ { id: "ops", heartbeat: { every: "1h", target: "telegram", to: "12345678:topic:42", // optional: route to a specific topic/thread accountId: "ops-bot", }, }, ], }, channels: { telegram: { accounts: { "ops-bot": { botToken: "YOUR_TELEGRAM_BOT_TOKEN" }, }, }, }, }
mainopenclaw sessions --json"user"agents.defaults.userTimezone"local"America/New_York"user"startendBy default,
HEARTBEAT_OKyamlchannels: defaults: heartbeat: showOk: false # Hide HEARTBEAT_OK (default) showAlerts: true # Show alert messages (default) useIndicator: true # Emit indicator events (default) telegram: heartbeat: showOk: true # Show OK acknowledgments on Telegram whatsapp: accounts: work: heartbeat: showAlerts: false # Suppress alert delivery for this account
Precedence: per-account → per-channel → channel defaults → built-in defaults.
showOkHEARTBEAT_OKshowAlertsuseIndicatorIf all three are false, OpenClaw skips the heartbeat run entirely (no model call).
yamlchannels: defaults: heartbeat: showOk: false showAlerts: true useIndicator: true slack: heartbeat: showOk: true # all Slack accounts accounts: ops: heartbeat: showAlerts: false # suppress alerts for the ops account only telegram: heartbeat: showOk: true
| Goal | Config |
|---|---|
| Default behavior (silent OKs, alerts on) | (no config needed) |
| Fully silent (no messages, no indicator) | text channels.defaults.heartbeat: { showOk: false, showAlerts: false, useIndicator: false } |
| Indicator-only (no messages) | text channels.defaults.heartbeat: { showOk: false, showAlerts: false, useIndicator: true } |
| OKs in one channel only | text channels.telegram.heartbeat: { showOk: true } |
If a
HEARTBEAT.mdOn normal runs,
HEARTBEAT.md0mincludeSystemPromptSection: falseIf
HEARTBEAT.md# Headingreason=empty-heartbeat-fileKeep it tiny (short checklist or reminders) to avoid prompt bloat.
Example
HEARTBEAT.mdmd# Heartbeat checklist - Quick scan: anything urgent in inboxes? - If it's daytime, do a lightweight check-in if nothing else is pending. - If a task is blocked, write down _what is missing_ and ask Peter next time.
tasks:HEARTBEAT.mdtasks:Example:
mdtasks: - name: inbox-triage interval: 30m prompt: "Check for urgent unread emails and flag anything time sensitive." - name: calendar-scan interval: 2h prompt: "Check for upcoming meetings that need prep or follow-up." # Additional instructions - Keep alerts short. - If nothing needs attention after all due tasks, reply HEARTBEAT_OK.
Task mode is useful when you want one heartbeat file to hold several periodic checks without paying for all of them every tick.
Yes — if you ask it to.
HEARTBEAT.mdHEARTBEAT.mdHEARTBEAT.mdIf you want this to happen proactively, you can also include an explicit line in your heartbeat prompt like: "If the checklist becomes stale, update HEARTBEAT.md with a better one."
You can enqueue a system event and trigger an immediate heartbeat with:
bashopenclaw system event --text "Check for urgent follow-ups" --mode now
If multiple agents have
heartbeatUse
--mode next-heartbeatBy default, heartbeats deliver only the final "answer" payload.
If you want transparency, enable:
agents.defaults.heartbeat.includeReasoning: trueWhen enabled, heartbeats will also deliver a separate message prefixed
Reasoning:/reasoning onHeartbeats run full agent turns. Shorter intervals burn more tokens. To reduce cost:
isolatedSession: truelightContext: trueHEARTBEAT.mdmodelollama/llama3.2:1bHEARTBEAT.mdtarget: "none"If a heartbeat uses a smaller local model, for example an Ollama model with a 32k window, and the next main-session turn reports context overflow, check whether the previous heartbeat left the session on the heartbeat model. OpenClaw's reset message calls this out when the last runtime model matches configured
heartbeat.modelUse
isolatedSession: truelightContext: true© 2024 TaskFlow Mirror
Powered by TaskFlow Sync Engine