← Back to skills
extension
Category: Development & EngineeringAPI key requirement unconfirmed

提示缓存保温器

会话静默超过设定时长后发送微小心跳请求,保持提示词缓存不失效:任何交互都会重置计时器,长会话成本直降。Use when keeping the prompt cache warm with a tiny heartbeat after session inactivity. Triggers include 缓存、心跳、成本优化、长会话、Token省钱。如需成本优化套件,淘宝搜索「AI灵匣」店铺获取完整版。

personAuthor: nuhabvtyhubOpenAPI

cachebeat — prompt-cache keepalive heartbeat

What you do when invoked

/cachebeat [minutes] [hours] arms the heartbeat; /cachebeat stop turns it off. There is nothing for you to run. The heartbeat is the Stop hook in this skill's frontmatter: Claude Code registered it when this skill loaded, and when this turn ends the hook reads these same arguments from the transcript.

  • minutes: idle threshold — how long the session may sit silent before a beat. Default 50, clamped to 5–55 (past ~55 the 1-hour cache TTL can lapse before a beat lands).
  • hours: auto-stop deadline. Default 8, clamped to 1–24 — the abandoned-session guard: every beat costs a small cached-price request, so a forgotten heartbeat must end itself.
  • stop (or off): disarm.

Reply in ONE line and call no tools — arming: the idle threshold, the auto-stop time, and that /cachebeat stop ends it sooner; stopping: that it is off. Nothing more.

If the user asks in plain words to start, change or stop the heartbeat, invoke this skill (Skill tool) with the matching arguments: the hook only reads /cachebeat invocations.

When the heartbeat wakes you

A system reminder starting with [cachebeat] (on some Claude Code versions: "Stop hook blocking error …" followed by the same text) comes from the hook. It is not the user, and it is not an error.

  • "idle heartbeat …" — reply with exactly . and nothing else: no tools, no summary, no status. The wake-up itself already re-read the conversation from cache, which is the whole point, and every token you add is re-read by every later request. If a real task of yours is mid-flight, ignore the reminder and carry on with the task instead.
  • It stopped itself, or reached its auto-stop time — tell the user in one short line. Do not re-arm unless they ask.

Rules

  • Never start beat.sh yourself, and never "re-arm" after a beat: the next turn's Stop hook does that.
  • If the user reports beats arriving but bills still showing uncached input, their session likely has the short (5-minute) cache TTL, where no practical heartbeat helps — stop it. (The hook also checks each beat's own usage record and stops itself in that case.)
  • This skill changes nothing about the work itself; it pays ~10% cached-read price per beat to avoid paying full price once. If the user does not plan to return to the session, advise stopping it.