cache-warmer

Reviewed at commit c64f15a New version, not yet reviewed

Keep the main conversation's prompt cache warm by automatically forking its last request, tools denied and billed like any request, shortly before the cache…

Made by
Paul B. Kim
What we checked

Keeps the prompt cache of your main conversation warm by resending its last request shortly before the cache expires, so your next prompt costs less. The refreshes use your plan or API key, run while you are idle (5 per cache lifetime by default, 0 turns them off) and only when the expected saving is at least $0.05. It also sets a 1-hour cache lifetime, whose cache writes cost more.

Review details

Static review of the source at the pinned commit; not run. Delta review of the changes since 4a8924d; the rest carries over from the review at that commit. The only change is two new entries (claude-fable-5-2 and claude-mythos-5-2) in the built-in price table in hooks/warmer.ts, which only feed the cost and saving estimates. Previous review: Registers session.start, command.run (/cache-warmer), config.set (its own keys), turn.start, turn.step (reads usage and model name only, passes the stream through), turn.complete, session.compact, session.end, classic.PostModelSwitch, ui.render (AbovePrompt, Pane), ui.focus, ui.scroll, ui.close. Runtime calls: $.model.fork with a fixed prompt, which resends the conversation prefix to Claude on the same account; $.env.set('CLAUDE_CODE_PROMPT_CACHE_TTL', 5m or 1h), which changes how Claude Code writes the cache for the session; $.session.append writes a one-line notice row into the transcript; $.store for all-time cost totals; $.config.set only on its own cache-warmer.* keys; $.env.get for HOME, CLAUDE_CONFIG_DIR, COLORFGBG and FORCE_PROMPT_CACHING_5M; $.config.list for theme and reduce motion; $.ui for the pane, band and mascot drawing. Debug mode, off by default and toggled in the pane, appends refresh results (model, token counts, cost, outcome) and stop reasons as JSON lines to <config>/cache-warmer/debug/<session>.jsonl; no prompt text is logged. Spending is bounded by the 90% timing, a $0.05 expected-saving rule, the idle limit (max 20) and a run horizon. No network calls of its own, no processes, no downloaded code. No npm dependencies.

What it uses
  • Reads your prompts: no
  • Sees tool calls: no
  • Blocks or changes tool calls: no
  • Reads or writes files: yes
  • Runs programs on your machine: no
  • Calls the model (uses tokens): yes
  • Sends data over the network: no
  • Stores data: yes
  • Shows something on screen: yes
Hooked events
Screenshot of cache-warmer

Keep the main conversation's prompt cache warm by automatically forking its last request, tools denied and billed like any request, shortly before the cache expires; switch its lifetime between 5m and 1h, and show each refresh's cost and estimated saving.

Made this mod? Add a badge to your README

modsforClaude badge for cache-warmer

Paste this into your README. The badge says reviewed once the current version has been reviewed, and links readers to this page.

[![Listed on modsforClaude](https://modsforclaude.com/badge/cache-warmer.svg)](https://modsforclaude.com/mods/cache-warmer/)

← All mods