pausa warns before Claude Code's prompt cache goes cold and prices the next message
A CLI and hook set that reads Claude Code transcripts, says how long the prompt cache stays warm, and prices the next message warm vs cold from published rates. 7 of 7 synthetic sessions matched.
By David Discua
Measured in the lab
- 7/7
- synthetic sessions classified as expected
- 18/18
- documented sentences re-found
- 13/13
- price rows matched
- 0.883x
- back-test, actual vs predicted re-write
- 7 of 7 synthetic sessions got their expected cache state
- 18 of 18 documented sentences found on the Claude docs
- 13 of 13 price rows matched the pricing page
- No resume request in the back-test wrote more than 1.2x the prediction
- 500 queued jobs claimed and completed in 1195 ms
From reports/pausabudget-gate.json · run on October 21, 2026. 7 synthetic transcript scenarios with fixed clocks; prices from the Claude pricing page fetched October 21, 2026; timings on darwin x64, Bun 1.4.3
How it is wired
01/03Claude Code logs token usage for every request to a transcript.
A long Claude Code session re-sends its whole context with every message. While the prompt cache is warm, that prefix is billed at the cache-read rate. After a break longer than the cache lifetime, it is written to the cache again at the write rate, and on a 1-hour cache with at least 200,000 tokens of context, Claude Code can compact the conversation after "about 54 minutes" idle. pausa reads the session transcript, says how long the cache stays warm, prices the next message warm and cold from Anthropic's published rates, and offers a cheaper exit: queue the remaining work and /clear. The catch is that cache expiry is an estimate.
The catch
The API counts the cache lifetime from the start of a request, which transcripts do not record. pausa uses the user line logged right before the response, so its deadline errs early. Helper requests can keep the cache warm longer, and the server can evict early. Transcripts are not a public API either; the field names were checked on Claude Code 2.1.296.
Dollar figures are list-price estimates for the context prefix only, with no new prompt, tool output or response priced. On a subscription within plan usage you are not billed per token, so read them as API equivalents. Hooks fire on events, so a warning ahead of a deadline needs pausa watch running in a terminal. The optional Gemini tidy-up of the hand-off text was not run live in this lab.
What we ran (keyless)
bun install --frozen-lockfile
bun run demo
bun run docs:verify
bun run prices:verify
bun run report
From reports/pausabudget-gate.json, generated on October 21, 2026. The scenarios are synthetic transcripts with fixed clocks, priced from the pricing page fetched that day:
| Scenario | Context | TTL | Idle | State | Next deadline | Cold/warm |
|---|---|---|---|---|---|---|
| 1h cache, idle 50m | 231.4K | 1h | 50m02s | expiring | idle compaction in 3m58s | 40.0x |
| 5m cache, idle 4m10s | 120.0K | 5m | 4m12s | expiring | cache expiry in 48s | 25.0x |
| 1h cache, idle 20m | 150.0K | 1h | 20m02s | warm | cache expiry in 39m58s | 40.0x |
| 5m cache, idle 2h | 140.0K | 5m | 2h00m | cold | none | 12.5x |
| 1h cache, 610K context, idle 56m | 610.0K | 1h | 56m02s | compaction_due | cache expiry in 3m58s | 80.0x |
| compacted while idle | 18.5K | 1h | 1h07m | compacted | none | 40.0x |
| OTel input, idle 3m | 214.0K | 5m (default) | 3m00s | warm | cache expiry in 2m00s | 25.0x |
All 7 matched their expected state. The cold/warm ratio follows from the published multipliers. Cache writes cost 1.25x base input on a 5-minute cache and 2x on a 1-hour cache, and reads cost 0.1x, 0.05x or 0.025x depending on the model. docs:verify found 18 of 18 quoted sentences on the docs pages, and prices:verify matched 13 of 13 price rows.
The README also records a back-test on 18 real Claude Code transcripts, aggregate counts only. They had 153 idle gaps longer than the TTL. The resume requests wrote 0.883x the tokens pausa predicted, 132 gaps landed within 20% of the prediction, 21 wrote less, and none wrote more than 1.2x. So the cold estimate errs high.
How it is wired
The reader uses only usage fields and skips subagent lines. The TTL comes from the last cache write, else from documented settings, else 5 minutes. Hooks print a one-line status after each turn, warn on the first prompt after expiry, and never block the session on an error. pausa handoff puts a task file on a directory queue with atomic renames, leases, retries and a dead-letter folder.
Minilab (open source)
Upstream is anthropics/claude-code (153,201 stars, TypeScript, no open-source license listed on GitHub, as of October 24, 2026). Run bun run pausa -- gaps --aggregate on your own transcripts and compare your ratio with the 0.883x above.
Run it yourself
SkilledDragonCorp/pausabudget-gate
Clone, install and run the report with no API keys. The numbers above are what that run writes.
bun install --frozen-lockfile && bun run demoSkilledDragon is not affiliated with Anthropic, Google, Trigger.dev or Hatchet. Dollar figures are list-price estimates, not a bill; re-run the report before relying on them. Marks belong to their owners.
All labs