Heartbeat 💓
Build reliable heartbeat playbooks for OpenClaw agents without noisy checks, missed signals, or runaway costs.
Setup
On first use, follow setup.md to capture timezone, active hours, precision needs, and risk tolerance.
When to Use
User wants a better heartbeat file in OpenClaw. Agent audits current heartbeat behavior, designs a safer file, and tunes intervals using real workflow constraints.
Use this for adaptive monitoring, proactive check-ins, and hybrid heartbeat plus cron strategies.
Architecture
Memory lives in ~/heartbeat/. See memory-template.md for the structure and fields.
CODEBLOCK0
Quick Reference
| Topic | File |
|---|
| Setup interview | INLINECODE3 |
| Memory schema |
memory-template.md |
| Production heartbeat template |
heartbeat-template.md |
| Practical heartbeat use cases |
use-cases.md |
| Interval strategy reference |
intervals.md |
| Trigger strategy reference |
triggers.md |
| Validation checklist before shipping |
qa-checklist.md |
| Internet research sources |
sources.md |
Core Rules
1. Scope the heartbeat before writing anything
Define one mission sentence and 1-3 monitored signals first.
If scope is broad, split into explicit sections (critical, important, nice-to-have) and only automate the first two.
2. Keep output contract strict
If nothing actionable is found, heartbeat must return exactly
HEARTBEAT_OK.
Do not emit summaries on empty cycles. This prevents noisy loops and keeps heartbeat cheap.
3. Tune cadence with timezone and active hours
Start from OpenClaw defaults and adapt: use a moderate baseline interval, then tighten only during active windows.
Always encode timezone and active hours in the heartbeat file to avoid waking during sleep hours.
4. Use cron for exact timing, heartbeat for adaptive timing
If a task must run at exact wall-clock times, move it to cron.
If a task should react to changing context or event probability, keep it in heartbeat.
5. Add cost guards to every expensive check
Use a two-stage pattern: cheap precheck first, expensive action only on threshold hit.
Never call paid APIs on every heartbeat cycle unless the user explicitly accepts the cost.
6. Define escalation and cooldown rules
Each alert condition must have trigger threshold, escalation route, and cooldown period.
No escalation path means no alert. No cooldown means likely alert spam.
7. Validate with dry runs and rollback path
Before finalizing, run at least one dry simulation against the checklist in
qa-checklist.md.
Keep a snapshot of the previous heartbeat so the user can rollback in one step.
Common Traps
- - Polling everything every cycle -> high token/API burn with low signal quality.
- Using heartbeat for exact 09:00 jobs -> drift and missed exact-time expectations.
- Missing timezone in heartbeat config -> notifications at the wrong local time.
- No active-hours filter -> overnight wakeups and user fatigue.
- No
HEARTBEAT_OK fallback -> verbose no-op loops. - No cooldown on alerts -> duplicate escalations during noisy incidents.
Security & Privacy
Data that stays local:
- - Heartbeat preferences and tuning notes in INLINECODE17
- Draft and snapshot files for heartbeat definitions
This skill does NOT:
- - Require credentials by default
- Trigger external APIs without user-approved instructions
- Edit unrelated files outside the heartbeat workflow
Related Skills
Install with
clawhub install <slug> if user confirms:
- -
schedule - Scheduling patterns for recurring workflows - INLINECODE20 - Monitoring strategies and alert design
- INLINECODE21 - Alert routing and escalation hygiene
- INLINECODE22 - Multi-step workflow orchestration
- INLINECODE23 - Proactive assistant patterns with controlled autonomy
Feedback
- - If useful: INLINECODE24
- Stay updated: INLINECODE25
技能名称: Heartbeat
详细描述:
Heartbeat 💓
为OpenClaw代理构建可靠的心跳剧本,无需嘈杂的检查、错过的信号或失控的成本。
设置
首次使用时,请按照setup.md捕获时区、活跃时段、精度需求和风险承受能力。
何时使用
用户希望在OpenClaw中获得更好的心跳文件。代理审计当前的心跳行为,设计更安全的文件,并使用实际工作流约束调整间隔。
适用于自适应监控、主动签到以及混合心跳加定时任务策略。
架构
内存存储在~/heartbeat/中。结构和字段请参见memory-template.md。
text
~/heartbeat/
├── memory.md # 偏好、节奏配置文件和上次调整决策
├── drafts/ # 候选心跳变体
└── snapshots/ # 用于回滚的先前心跳版本
快速参考
memory-template.md |
| 生产环境心跳模板 | heartbeat-template.md |
| 实用心跳用例 | use-cases.md |
| 间隔策略参考 | intervals.md |
| 触发策略参考 | triggers.md |
| 发布前验证清单 | qa-checklist.md |
| 互联网研究来源 | sources.md |
核心规则
1. 在编写任何内容之前先界定心跳范围
首先定义一条任务陈述和1-3个监控信号。
如果范围较广,则拆分为明确的章节(关键、重要、锦上添花),并仅自动化前两个。
2. 保持输出契约严格
如果未发现可操作的内容,心跳必须准确返回HEARTBEAT_OK。
不要在空周期上输出摘要。这可以防止嘈杂的循环并保持心跳低成本。
3. 使用时区和活跃时段调整节奏
从OpenClaw默认值开始并调整:使用适中的基线间隔,仅在活跃窗口期间收紧。
始终在心跳文件中编码时区和活跃时段,以避免在睡眠时段唤醒。
4. 使用cron进行精确计时,使用心跳进行自适应计时
如果任务必须在精确的挂钟时间运行,请将其移至cron。
如果任务应对变化的上下文或事件概率做出反应,请将其保留在心跳中。
5. 为每次昂贵检查添加成本防护
使用两阶段模式:先进行廉价预检查,仅在达到阈值时执行昂贵操作。
除非用户明确接受成本,否则不要在每次心跳周期调用付费API。
6. 定义升级和冷却规则
每个警报条件必须具有触发阈值、升级路径和冷却周期。
没有升级路径意味着没有警报。没有冷却意味着可能产生警报垃圾。
7. 通过试运行和回滚路径进行验证
在最终确定之前,至少针对qa-checklist.md中的清单运行一次干模拟。
保留先前心跳的快照,以便用户可以一步回滚。
常见陷阱
- - 每个周期轮询所有内容 -> 高令牌/API消耗,信号质量低。
- 使用心跳执行精确的09:00任务 -> 漂移和错过精确时间预期。
- 心跳配置中缺少时区 -> 在错误的本地时间发送通知。
- 没有活跃时段过滤器 -> 夜间唤醒和用户疲劳。
- 没有HEARTBEAT_OK回退 -> 冗长的无操作循环。
- 警报没有冷却 -> 在嘈杂事件期间重复升级。
安全与隐私
本地存储的数据:
- - ~/heartbeat/中的心跳偏好和调整记录
- 心跳定义的草稿和快照文件
此技能不会:
- - 默认需要凭据
- 在未经用户批准的指令下触发外部API
- 编辑心跳工作流之外的不相关文件
相关技能
如果用户确认,使用clawhub install
安装:
- - schedule - 重复工作流的调度模式
- monitoring - 监控策略和警报设计
- alerts - 警报路由和升级规范
- workflow - 多步骤工作流编排
- copilot - 具有受控自主性的主动助手模式
反馈
- - 如果有用:clawhub star heartbeat
- 保持更新:clawhub sync