heartbeat

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Heartbeat Skill

Heartbeat Skill

A self-monitoring system inspired by ZeroClaw's heartbeat architecture. This skill enables agents to perform periodic health checks, system diagnostics, and proactive maintenance without external triggers.
这是一个受ZeroClaw心跳架构启发的自我监控系统。该Skill使Agent无需外部触发即可执行周期性健康检查、系统诊断和预防性维护。

Purpose

用途

The heartbeat system allows an agent to:
  • Monitor its own health and resources
  • Report status periodically
  • Perform routine maintenance tasks
  • Alert on anomalies or issues
  • Stay "alive" and responsive
心跳系统允许Agent:
  • 监控自身健康状况与资源
  • 定期报告状态
  • 执行日常维护任务
  • 针对异常或问题发出警报
  • 保持“活跃”并响应及时

Key Concepts

核心概念

Heartbeat Types

心跳类型

  • health: System health check (disk, memory, process status)
  • report: Generate and send status reports
  • maintenance: Perform cleanup, optimization, or updates
  • custom: User-defined heartbeat tasks
  • health:系统健康检查(磁盘、内存、进程状态)
  • report:生成并发送状态报告
  • maintenance:执行清理、优化或更新操作
  • custom:用户自定义心跳任务

Configuration

配置

The heartbeat is configured via
HEARTBEAT.md
in the workspace root:
markdown
undefined
心跳通过工作区根目录下的
HEARTBEAT.md
进行配置:
markdown
undefined

Heartbeat Configuration

Heartbeat Configuration

  • health: Check system health every 30 minutes
  • report: Send status report every day at 9 AM
  • maintenance: Run cleanup every Sunday at 2 AM
undefined
  • health: Check system health every 30 minutes
  • report: Send status report every day at 9 AM
  • maintenance: Run cleanup every Sunday at 2 AM
undefined

Tools Added

新增工具

When this skill is active, the agent gains access to:
激活该Skill后,Agent将获得以下工具的访问权限:

heartbeat_schedule

heartbeat_schedule

Schedule a new heartbeat task.
javascript
// Schedule a health check every 30 minutes
heartbeat_schedule({
  name: "health-check",
  type: "health",
  interval: "30m",
  enabled: true
})
调度新的心跳任务。
javascript
// Schedule a health check every 30 minutes
heartbeat_schedule({
  name: "health-check",
  type: "health",
  interval: "30m",
  enabled: true
})

heartbeat_run

heartbeat_run

Manually trigger a heartbeat task.
javascript
// Run a specific heartbeat
heartbeat_run({ name: "health-check" })

// Run all enabled heartbeats
heartbeat_run({ all: true })
手动触发心跳任务。
javascript
// Run a specific heartbeat
heartbeat_run({ name: "health-check" })

// Run all enabled heartbeats
heartbeat_run({ all: true })

heartbeat_list

heartbeat_list

List configured heartbeat tasks.
javascript
heartbeat_list({})
列出已配置的心跳任务。
javascript
heartbeat_list({})

heartbeat_status

heartbeat_status

Check the status and results of heartbeat tasks.
javascript
// Get status of all heartbeats
heartbeat_status({})

// Get status of specific heartbeat
heartbeat_status({ name: "health-check" })
检查心跳任务的状态与结果。
javascript
// Get status of all heartbeats
heartbeat_status({})

// Get status of specific heartbeat
heartbeat_status({ name: "health-check" })

Usage in Agent Prompt

在Agent提示词中的使用

When this skill is active, include this context in your system prompt:
undefined
激活该Skill后,请在系统提示词中包含以下上下文:
undefined

Heartbeat System

Heartbeat System

You have access to a periodic self-monitoring system (heartbeat). Use it to:
  • Monitor system health and resources
  • Generate periodic status reports
  • Perform routine maintenance
Available commands:
  • heartbeat_schedule
    - Schedule a new recurring check
  • heartbeat_run
    - Manually run a heartbeat task
  • heartbeat_list
    - Show all configured heartbeats
  • heartbeat_status
    - Check heartbeat status and results
Create HEARTBEAT.md in the workspace root to define your heartbeat tasks.
undefined
You have access to a periodic self-monitoring system (heartbeat). Use it to:
  • Monitor system health and resources
  • Generate periodic status reports
  • Perform routine maintenance
Available commands:
  • heartbeat_schedule
    - Schedule a new recurring check
  • heartbeat_run
    - Manually run a heartbeat task
  • heartbeat_list
    - Show all configured heartbeats
  • heartbeat_status
    - Check heartbeat status and results
Create HEARTBEAT.md in the workspace root to define your heartbeat tasks.
undefined

Integration with PopeBot

与PopeBot的集成

This skill integrates with PopeBot's cron system by:
  1. Reading heartbeat definitions from HEARTBEAT.md
  2. Converting them to cron-compatible schedules
  3. Storing heartbeat status in the logs directory
该Skill通过以下方式与PopeBot的 cron 系统集成:
  1. 从HEARTBEAT.md读取心跳定义
  2. 将其转换为兼容cron的调度计划
  3. 将心跳状态存储在日志目录中

File Structure

文件结构

.pi/skills/heartbeat/
├── SKILL.md           # This file
├── lib/
│   ├── scheduler.js   # Heartbeat scheduling logic
│   ├── runners.js     # Built-in heartbeat runners
│   └── status.js      # Status tracking
└── templates/
    └── HEARTBEAT.md   # Example configuration
.pi/skills/heartbeat/
├── SKILL.md           # This file
├── lib/
│   ├── scheduler.js   # Heartbeat scheduling logic
│   ├── runners.js     # Built-in heartbeat runners
│   └── status.js      # Status tracking
└── templates/
    └── HEARTBEAT.md   # Example configuration