Know before your cache goes cold.
After an idle gap, Claude Code's prompt cache expires and the next message rewrites your whole context at the most expensive token rate. Cache Clock shows the countdown and the stake, and tells you what to do on each side of zero.
Install
Needs Claude Code 2.1.251 or newer for the exact countdown (older versions get an estimate from your transcript, marked with ~), plus jq or python3. The installer backs up settings.json, keeps your other settings, and sh ~/.cache-clock/install.sh --uninstall (or pwsh ~/.cache-clock/install.ps1 -Uninstall) restores your previous status line. Read the two scripts before running them: they are short.
macOS · Linux · Windows Git Bash
mkdir -p ~/.cache-clock && cd ~/.cache-clock curl -fsSL --remote-name-all https://limit-autopsy.pages.dev/cache-clock/cache-clock.sh https://limit-autopsy.pages.dev/cache-clock/install.sh sh install.sh
Windows · PowerShell 7 (beta)
Requires PowerShell 7 (pwsh). The Windows PowerShell 5.1 that ships with Windows 10 and 11 won't work; the scripts stop with a clear error. Check with pwsh --version, or install it with winget install Microsoft.PowerShell.
New-Item -ItemType Directory -Force ~/.cache-clock | Out-Null; Set-Location ~/.cache-clock Invoke-WebRequest https://limit-autopsy.pages.dev/cache-clock/cache-clock.ps1 -OutFile cache-clock.ps1 Invoke-WebRequest https://limit-autopsy.pages.dev/cache-clock/install.ps1 -OutFile install.ps1 pwsh ./install.ps1
Or add it by hand
// ~/.claude/settings.json
{
"statusLine": {
"type": "command",
"command": "~/.claude/cache-clock.sh",
"padding": 0,
"refreshInterval": 5
}
}
What each state means
| ● cache 18:42 | Warm. The next message reuses the cached prefix at the cheapest rate. The dollar figure is what a cold rewrite would cost at API list price. |
| ◑ cache 4:10 | Under 5 minutes left on a 1h cache (90 s on a 5m cache). If you are about to step away, reply now or run /compact while it is still warm. |
| ○ cache cold | Expired. Your next message rewrites the full context. In a big thread, /clear plus a short handoff note is usually cheaper than continuing. Compacting now still pays for the cold read. |
| miss: model changed | Shown for 60 s after a cache miss, with Claude Code's own reason: model or tools changed, idle past the TTL, and so on. |
Times come from Claude Code's native prompt_cache status data. Keep-alive behaviour can extend a cache, so treat the countdown as Claude Code's current estimate, not a guarantee.