heartbeat
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHeartbeat Orchestrator
Heartbeat 编排器
The Heartbeat skill acts as the background processor for the Agentic OS. It reads the queue, identifies pending tasks, routes them to the appropriate skills, and updates the task status upon completion.
.agent/state/tasks.jsonHeartbeat技能是Agentic OS的后台处理器。它读取队列,识别待处理任务,将其路由到对应的技能,并在任务完成后更新状态。
.agent/state/tasks.jsonHow it works
工作原理
Use the script included in this skill's directory to manage the queue:
heartbeat.pyscripts/- Pop Task: Run (for Gemini/Antigravity) or
python3 ~/.gemini/skills/heartbeat/scripts/heartbeat.py pop(for Claude) to get the highest priority pending task and move it topython3 ~/.claude/skills/heartbeat/scripts/heartbeat.py pop.in_progress - Execute: Read the task details and use the appropriate skill (e.g., ,
osint) to fulfill the task.deep-research - Resilience & Retry: If a task fails unexpectedly, autonomous agents MUST attempt to retry the task logic up to two times before formally failing.
- Complete/Fail: Run or
python3 ~/.gemini/skills/heartbeat/scripts/heartbeat.py complete <task_id> --outcome '{"result": "..."}' --trace-id <id> --decision-log "..."(adjust path for Claude) to update the task status. Failing a task automatically logs the failure topython3 ~/.gemini/skills/heartbeat/scripts/heartbeat.py fail <task_id> --reason "..." --trace-id <id>so the Command Center can track unresolved issues..agent/state/errors.json
使用本技能目录下的脚本管理队列:
scripts/heartbeat.py- 取出任务:运行(适用于Gemini/Antigravity)或
python3 ~/.gemini/skills/heartbeat/scripts/heartbeat.py pop(适用于Claude),获取优先级最高的待处理任务并将其移至python3 ~/.claude/skills/heartbeat/scripts/heartbeat.py pop状态。in_progress - 执行任务:读取任务详情,使用对应的技能(如、
osint)完成任务。deep-research - 弹性与重试:若任务意外失败,自主Agent必须尝试重试任务逻辑最多2次,之后才标记为正式失败。
- 完成/失败:运行或
python3 ~/.gemini/skills/heartbeat/scripts/heartbeat.py complete <task_id> --outcome '{"result": "..."}' --trace-id <id> --decision-log "..."(Claude需调整路径)来更新任务状态。标记任务失败会自动将失败信息记录到python3 ~/.gemini/skills/heartbeat/scripts/heartbeat.py fail <task_id> --reason "..." --trace-id <id>,以便指挥中心追踪未解决问题。.agent/state/errors.json
Task Format
任务格式
The should contain an object with status arrays:
tasks.jsonjson
{
"pending": [
{
"id": "task-123",
"priority": "high",
"description": "Deep research the current state of local LLM orchestration.",
"assigned_skill": "deep-research",
"project_id": "claude-skills",
"agent_id": "antigravity",
"user_id": "matthias",
"created_at": "2026-04-25T12:00:00Z",
"completed_at": null
}
],
"in_progress": [],
"completed": [],
"failed": []
}Statuses correspond to the array the task resides in.
tasks.jsonjson
{
"pending": [
{
"id": "task-123",
"priority": "high",
"description": "Deep research the current state of local LLM orchestration.",
"assigned_skill": "deep-research",
"project_id": "claude-skills",
"agent_id": "antigravity",
"user_id": "matthias",
"created_at": "2026-04-25T12:00:00Z",
"completed_at": null
}
],
"in_progress": [],
"completed": [],
"failed": []
}任务状态由其所在的数组决定。
Execution
执行机制
When invoked (or automatically on agent startup), the Heartbeat should process one task at a time to maintain stability and context length, unless explicitly asked to drain the queue.
当被调用(或Agent启动时自动触发)时,Heartbeat应一次处理一个任务以保持稳定性和上下文长度,除非明确要求清空队列。
Agentic OS Integration
Agentic OS 集成
As a core OS component, this skill MUST log its own execution to , noting which task was processed and what the outcome was.
.agent/state/last-run.json作为核心OS组件,本技能必须将自身执行情况记录到,注明处理的任务及结果。
.agent/state/last-run.json