Cachebeat logo

Cachebeat

Visit

Cachebeat is a tiny Claude Code skill that keeps the prompt cache warm during idle sessions so the next message is a cheap cache read.

Share:
View alternatives

Cachebeat is a one-file Claude Code skill that arms an inactivity heartbeat so a long session does not drop Anthropic's prompt cache. The repo ARahim3/cachebeat was created 2026-09-14. On 2026-09-16 GitHub listed 5 stars and 0 forks. The README claims MIT; the GitHub API listed no SPDX license file that day, so treat the license as README-stated, not API-confirmed. It showed up on r/ClaudeAI as people hit 5-hour and weekly limits after stepping away.

Anthropic bills cache reads at 0.1x the input rate (the README's published ratio). A cold return re-sends the whole history at full input price. On Pro/Max that same accounting also drains the 5-hour window and weekly quota. 5 stars is a heat signal, not traffic.

Compare Claude Code if you wanted the host, ccusage if you wanted a usage dashboard, or Agent Skills if you wanted a broader engineering pack.

Key Features

  • Inactivity timer, not a metronome: /cachebeat starts one background monitor. Any real turn resets the clock. It fires only after N minutes of true silence, Claude answers in a few words, and the cache TTL restarts.
  • Defaults: 50 minutes idle, auto-stop after 8 hours. /cachebeat 40 sets the idle threshold (clamped 5-55). /cachebeat 40 4 also sets a 4-hour deadline. /cachebeat stop kills it.
  • Install: copy SKILL.md to ~/.claude/skills/cachebeat/ (user) or <project>/.claude/skills/cachebeat/ (project). No extra binary.
  • Verify: Claude Code's token line looks like tok:312.0k/0.0k (total / from cache). A warm return should show a large second number. The README also greps cache_read_input_tokens vs cache_creation_input_tokens in the session jsonl.
  • Self-check: CACHEBEAT_WARN means the beat itself came back uncached, so the session TTL is too short to bridge. CACHEBEAT_EXPIRED ends the monitor.

Limitation: it only helps sessions with the long (1-hour) cache TTL. A 5-minute TTL cannot be bridged. Each beat still costs a small cached-read plus a few output tokens, and those lines stay in later context. Native Windows (non-WSL) is untested. The skill reads ~/.claude/projects/<slug>/<session-id>.jsonl via $CLAUDE_CODE_SESSION_ID, an internal layout, not a documented API.

Use Cases

  • Long Claude Code sessions that babysit training, CI, or downloads while a human sleeps.
  • Pro/Max users who saw one "how's it going?" eat a visible chunk of the 5-hour window after idle.
  • People who should not use it: you are not coming back. The 8-hour deadline exists so an abandoned session does not drip-bill.

Pricing

Piece Price Notes from first-party pages 2026-09-16
Skill $0 Copy SKILL.md. README says MIT. About 5 stars.
Host Your Claude Code plan Pro/Max usage windows still apply. Cache reads are cheaper, not free.
API users Provider input rates README cites cache reads at 0.1x input. Confirm current Anthropic pricing.

Getting Started

  1. mkdir -p ~/.claude/skills/cachebeat and copy SKILL.md there.
  2. In a Claude Code session with long TTL, type /cachebeat.
  3. Step away. When you return, check that the cache-read side of the token line is not 0.0k.
  4. /cachebeat stop if you will not come back.

First-party resource: the README and SKILL.md.

Frequently Asked Questions

Does this replace Claude Code?

No. It is a skill inside Claude Code. The agent still bills your plan.

Why 50 minutes, not every 5?

The idle threshold must stay under the TTL. 50 minutes leaves about 10 minutes of margin on a 1-hour cache. Firing too often wastes tokens; firing too late lands uncached.

Will it help a 5-minute TTL session?

The README says no practical heartbeat can bridge that. Stop it if bills stay uncached.

Alternatives

  • Claude Code: the host. Without it this skill does nothing.
  • ccusage: usage charts, not a cache keepalive.
  • OpenCode Skills: SKILL.md packs for OpenCode, not Claude Code cache.

Tips

  1. Arm it only on sessions you will reopen. The 8-hour stop is the safety net, not a reason to leave it forever.
  2. If you see CACHEBEAT_WARN, stop. The TTL is too short.
  3. Keep replies to a few words. Extra heartbeat tokens are re-read on every later turn.

Conclusion

Cachebeat is a small, honest fix for the idle tax on long Claude Code sessions. Copy one file, type /cachebeat, and come back to a warm cache. Skip it if your sessions are short, your TTL is 5 minutes, or you were not going to return.

Comments

No comments yet. Be the first to comment!