# HEARTBEAT.md

# 白天系统健康检查
# 时区：Asia/Hong_Kong
# 目标：本机
# 规则：08:30-23:00 每 30 分钟检查一次；若 CPU 或内存 > 80%，主动在当前聊天报警；
# 若无异常，则单聊内一律不发健康状态，只回复 HEARTBEAT_OK。

- Track in `memory/heartbeat-state.json`.
- On each heartbeat, if current local time is outside 08:30-23:00, reply HEARTBEAT_OK.
- If within window, inspect local system health for this machine.
- Collect and summarize:
  - CPU usage percentage
  - Memory usage percentage
  - Disk usage for /
  - Load average
  - Uptime
- Alert condition: CPU > 80 OR Memory > 80.
- If alert condition is met, send a concise alert to this current chat/topic with the metrics.
- If no alert, reply HEARTBEAT_OK. Do not send normal health summaries in this direct chat; normal monitoring summaries are handled by the user's separate fixed monitoring script and OpenClaw cron/topic flow.
- After each check, update `memory/heartbeat-state.json` with the last check time. Only update `lastProactiveHealthSummary` when an actual alert is sent from heartbeat.
