openclaw - 💡(How to fix) Fix Feature: Heartbeat auto-toggle when periodic tasks exist [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#77699Fetched 2026-05-06 06:22:49
View on GitHub
Comments
1
Participants
2
Timeline
1
Reactions
2
Timeline (top)
commented ×1

Let heartbeat auto-enable when HEARTBEAT.md has active tasks, and auto-disable when it is empty.

Root Cause

Let heartbeat auto-enable when HEARTBEAT.md has active tasks, and auto-disable when it is empty.

Code Example

agents:
  defaults:
    heartbeat:
      every: "auto"
RAW_BUFFERClick to expand / collapse

Summary

Let heartbeat auto-enable when HEARTBEAT.md has active tasks, and auto-disable when it is empty.

Problem to solve

Currently agents.defaults.heartbeat.every is a static interval. If set to e.g. 30m, it runs every 30 minutes regardless of whether there are any periodic tasks to check. This wastes API calls (and therefore cost) when HEARTBEAT.md is empty or contains only comments.

The user has to manually change the config every time they want to add/remove periodic tasks, which defeats the purpose of a smart agent.

Proposed solution

Add a new heartbeat mode that checks whether HEARTBEAT.md (or the configured prompt file) contains actionable content before triggering a heartbeat turn.

Option A – auto mode for every:

agents:
  defaults:
    heartbeat:
      every: "auto"

When every: "auto":

  • Before each scheduled heartbeat window, check if HEARTBEAT.md has any non-comment, non-whitespace content.
  • If yes → run heartbeat as normal.
  • If no (empty or only comments) → skip, no model invocation.
  • A new config field like autoCheckInterval: "30m" controls how often to re-check the file.

Option B – Lighter-touch: Heartbeat always runs but returns HEARTBEAT_OK without model call when file is empty. This is simpler to implement but still incurs scheduling overhead.

Option C – Smart hook: Trigger heartbeat only when HEARTBEAT.md is modified. Use a file watcher on HEARTBEAT.md → when saved, schedule a one-shot heartbeat; when file is cleared, cancel pending heartbeat.

Alternatives considered

  1. Status quo (static every): Simple but wasteful. User pays for empty turns.
  2. Manual toggle: User sets every: "0" / every: "30m" via config. Works but friction, easily forgotten.
  3. Only use cron instead of heartbeat: Cron already supports exact scheduling. But heartbeat has simpler HEARTBEAT.md workflow and is better for users who want the write-a-task-and-get-remembered pattern.

Impact

  • Affected users: All OpenClaw users with heartbeat enabled, especially self-hosted users who pay per-token (DeepSeek, OpenAI, etc.).
  • Severity: Moderate annoyance / cost leakage. One user reported ~48 model calls/day from empty heartbeats, each loading the full conversation context.
  • Frequency: Always — every heartbeat cycle when HEARTBEAT.md is empty.
  • Consequence: Unnecessary billing charges. For a user on paid API, this could add $5-30/month depending on context size and model pricing.

Evidence/examples

  • User workflow: wants periodic weather reminders → sets up HEARTBEAT.md → turns on heartbeat → task done → clears HEARTBEAT.md → still pays for empty heartbeats until they remember to disable it.
  • User asked: Does OpenClaw call the model even when I am not talking to it? — yes, heartbeat does.

Additional information

  • Config schema already has agents.defaults.heartbeat.every (string type). An "auto" value would be backward-compatible.
  • HEARTBEAT.md already exists as the canonical task file. Reusing it avoids adding another config surface.
  • The file-watch approach (Option C) would need chokidar or similar, which is already a bundled dependency in OpenClaw plugin runtime.

extent analysis

TL;DR

Implement an "auto" mode for the every field in the heartbeat configuration to dynamically adjust the heartbeat interval based on the presence of actionable content in HEARTBEAT.md.

Guidance

  • Introduce a new auto mode for agents.defaults.heartbeat.every that checks HEARTBEAT.md for non-comment, non-whitespace content before triggering a heartbeat.
  • Add a autoCheckInterval field to control how often to re-check the file when in auto mode.
  • Consider implementing a file watcher (e.g., using chokidar) to trigger a one-shot heartbeat when HEARTBEAT.md is modified, as an alternative to the auto mode.
  • Evaluate the trade-offs between the proposed options (A, B, and C) in terms of implementation simplicity, scheduling overhead, and user experience.

Example

agents:
  defaults:
    heartbeat:
      every: "auto"
      autoCheckInterval: "30m"

This configuration enables the auto mode and sets the auto-check interval to 30 minutes.

Notes

The choice of implementation depends on the specific requirements and constraints of the OpenClaw system, including the trade-offs between simplicity, overhead, and user experience. The auto mode and file watcher approaches may have different implications for system complexity, performance, and user workflow.

Recommendation

Apply the auto mode workaround by introducing the new every: "auto" configuration option, as it provides a balance between simplicity and effectiveness in reducing unnecessary heartbeat calls.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Feature: Heartbeat auto-toggle when periodic tasks exist [1 comments, 2 participants]