santiquiroz

Claude Prompt Cache Keepalive — Development skill for Claude Code

Development community

Agent skill for Claude Code: keep the 1-hour prompt cache warm while you are away, with a ladder of background timers that wake the idle session.

How to install Claude Prompt Cache Keepalive

This entry records only its repository, not the path inside it, so there is no exact command to give. Open santiquiroz/claude-prompt-cache-keepalive and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Claude Prompt Cache Keepalive does

Agent skill for Claude Code: keep the 1-hour prompt cache warm while you are away, with a ladder of background timers that wake the idle session.

Alternatives in Development

  • Investigate Performance — Investigate a Nimbalyst performance problem (freeze, lag, idle CPU, slow op, memory growth) with measured evid 1.6k ★
  • Galatea Garden Wake Bridge — 独立的 Galatea Garden 智能体唤醒桥:订阅 Garden SSE 事件,并通过可替换的 Runtime Adapter 将消息注入 Codex、Claude Code 等 Agent Runtime 225 ★
  • Position Ladder — Position Ladder — Staged Entry & Cost-Basis Management 192 ★

README

keeping-prompt-cache-warm

An agent skill for [Claude Code](https://claude.com/claude-code) that keeps a session's prompt cache alive while you are away, so a large conversation does not have to be re-read from scratch when you come back.

The problem

Claude Code caches the conversation prefix for **exactly 60 minutes** after the last model request. If you leave a long session idle for longer than that (overnight, a meeting, a long background job), the next message re-reads the whole context uncached: slow, and it burns usage quota.

What does and does not work

Verified in the Claude Code VS Code extension on Windows, by reading the session transcript usage (`cache_read_input_tokens` vs `cache_creation_input_tokens`):

Mechanism Wakes an idle session?
Background Bash/PowerShell job (run_in_background: true) when it exits Yes
CronCreate recurring job No: fired 0 times in 8.5 hours
ScheduleWakeup Only inside /loop
Monitor Expires in 30-60 minutes
Subagents / workflows running in the background Do not refresh the main thread cache; only their final notification wakes it

A gap of 60 min 20 s was already enough to lose the cache, so there is no slack beyond the hour.

How it works

The skill arms a **ladder of independent background timers** in one shot (not a chain, so one missed wake does not stop the rest). Each timer:

  • sleeps until its scheduled minute, polling a stop file every minute;
  • holds an OS sleep lock while waiting (Windows SetThreadExecutionState, macOS caffeinate, Linux systemd-inhibit);
  • exits printing KEEPALIVE_TICK, whose completion notification wakes the model for a one-line, tool-free reply that refreshes the cache.

Install

git clone https://github.com/santiquiroz/claude-prompt-cache-keepalive ~/.claude/skills/keeping-prompt-cache-warm

Then just tell Claude something like "I'm going to sleep, keep the cache warm for 8 hours".

The wake