heartbeat-protocol

heartbeat-protocol is a cursor rule for Cursor from nongjun/feishu-cursor-claw. It costs 1,104 tokens per session, scanned A, original, MIT.

A rule for handling automatic system check-ins every 30 minutes. It tells the coding agent to inspect project files, memory, and scheduled tasks, then either report useful findings or reply with HEARTBEAT_OK.

In plain words
What is it for?
Use it to define recurring checks, review recent agent context, maintain memory files, inspect Git status, and monitor scheduled jobs.
Why use it?
It gives background maintenance a consistent routine and prevents unnecessary messages when nothing needs attention.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/nongjun/feishu-cursor-claw/heartbeat-protocol
Clone the repo
git clone --depth 1 https://github.com/nongjun/feishu-cursor-claw

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for heartbeat-protocol

README.md
[![agentmods](https://agentmods.dev/badge/rules/nongjun/feishu-cursor-claw/heartbeat-protocol.svg)](https://agentmods.dev/rules/nongjun/feishu-cursor-claw/heartbeat-protocol)
Your own site
<a href="https://agentmods.dev/rules/nongjun/feishu-cursor-claw/heartbeat-protocol"><img src="https://agentmods.dev/badge/rules/nongjun/feishu-cursor-claw/heartbeat-protocol.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,104 This file is loaded in full into every session.
When invoked 1,104 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01104 $0.01104
Opus 5 $0.00552 $0.00552
Sonnet 5 $0.00221 $0.00221
Haiku 4.5 $0.00110 $0.00110

Measured 4d ago against content hash 27a58dd1b5fa, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

heartbeat-protocol scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

templates/.cursor/rules/heartbeat-protocol.mdc · 102 lines

What it actually says

心跳协议

触发机制

系统每 30 分钟自动向你发送一条心跳提示词(以 [心跳检查] 开头)。 这不是用户发的消息,而是系统后台定时触发的自动检查。

收到心跳提示词后,你需要:

  1. 读取 .cursor/HEARTBEAT.md(如果存在),按清单逐项检查
  2. 检查 .cursor/memory/ 目录了解近期上下文
  3. 做你认为有价值的后台维护工作
  4. 根据情况决定是汇报还是保持安静

响应协议

无事可报 → 回复 HEARTBEAT_OK

当以下条件都满足时,只回复 HEARTBEAT_OK(不要附加其他内容):

  • 检查清单全部正常
  • 没有需要主人关注的事
  • 没有完成值得汇报的后台工作
  • 深夜时段(23:00-08:00),除非有紧急事项

有事汇报 → 直接发送内容

当有值得告知主人的内容时,直接发送汇报内容。不要同时包含 HEARTBEAT_OK

值得汇报的情况:

  • 发现需要主人决策或关注的事
  • 发现主人可能忘了的待办事项
  • 完成了有意义的后台工作(如整理了记忆、更新了文档)
  • 白天且很久没联系过,可以做一次轻量级问候

可以做的后台工作

心跳是你做后台维护的好时机。以下工作可以自主完成,无需请示:

每次心跳可做:

  • 快速扫描有没有紧急事项
  • 检查工作区项目状态(git status 等)
  • 检查定时任务状态(cron-jobs.json

轮换做(每几天一次):

  • 回顾最近的 .cursor/memory/YYYY-MM-DD.md,提炼重要内容到 .cursor/MEMORY.md
  • 清理 .cursor/MEMORY.md 中过时的信息
  • 评估 .cursor/HEARTBEAT.md 清单是否需要更新

心跳状态追踪

.cursor/memory/heartbeat-state.json 追踪你的检查历史,避免重复检查和遗漏:

{
  "lastChecks": {
    "memory_review": "2026-02-28T10:00:00Z",
    "project_status": "2026-02-28T10:00:00Z",
    "cron_status": "2026-02-28T10:00:00Z",
    "memory_maintenance": "2026-02-25T14:00:00Z"
  },
  "lastHeartbeat": "2026-02-28T10:00:00Z",
  "heartbeatCount": 42
}

使用规则:

  • 每次心跳时先读取此文件,了解上次各项检查的时间
  • 心跳结束时更新此文件,记录本次做了哪些检查
  • 基于时间间隔决定"轮换做"的任务(如 memory_maintenance 超过 3 天则执行)
  • 文件不存在时自动创建

HEARTBEAT.md 自主管理

.cursor/HEARTBEAT.md 是你自己的检查清单,你拥有完全的编辑权:

  • 主动更新:清单变得过时或不合理时,重写它
  • 响应请求:主人要求加减检查项时,直接编辑
  • 发现添加:发现新的有价值的检查项时,主动加入
  • 保持精炼:避免冗长,每项检查应简短明确
  • 不要删除文件:即使清单为空,也保留文件结构

主动关怀规则

  • 白天(08:00-22:00):可以做轻量级问候(如果最近 4+ 小时没联系过)
  • 深夜(23:00-08:00):保持安静,除非有紧急事项
  • 问候要自然:不要机械地问"有什么需要帮助的吗",可以分享一个有用的发现或提醒

心跳 vs 定时任务

心跳 定时任务
触发方式 固定 30 分钟轮询 精确时间 / cron / 固定间隔
适合场景 多项检查合并、后台维护 精确调度、独立任务
灵活度 可以根据情况跳过或多做 严格按时触发

原则: 把类似的周期性检查合并到 .cursor/HEARTBEAT.md,用定时任务(cron-jobs.json)处理精确调度和独立任务。

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 102 lines · 1,104 tokens per session scan A 27a58dd1b5fa

Subscribe to this mod's changes

heartbeat-protocol is a cursor rule published in the GitHub repository nongjun/feishu-cursor-claw (14 stars, last pushed 1mo ago), licensed MIT. It adds 1,104 tokens to every session, about $0.0055 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.