Cache Tax

Keep Claude Code's prompt cache warm on breaks

·

source at b05ec14

·

MIT license

A row above the prompt shows whether your prompt cache is warm and when the next keepwarm ping lands. It pings during breaks and asks before a cold send that would rewrite a large context.

What this mod can do

  • Reviewed at commit b05ec14
  • Sends the conversation to Claude with its own requests, which uses your tokens
  • Reads environment variables
  • Sees each change to /config and can block or rewrite it
  • Sees each prompt you send and can change or drop it
9 more things it can do
  • Reads your settings
  • Remembers data between sessions
  • Asks you questions
  • Adds the /cache-tax command
  • Adds the /keepwarm command
  • Lists the slash commands you can run
  • Adds its own methods for other mods to call
  • Runs on a timer
  • Runs on Claude Code hooks, such as session start
Good to know (3)
  • Every keepwarm ping is a real model request that costs tokens, and its output has no cap.
  • API-key and cloud-provider sessions need promptCacheTtl set to "1h"; subscriptions have it by default.
  • A paid cold write arms keepwarm for three hours on its own; set Auto keepwarm to off in /config to stop it.
Are mods safe?

Preview

Terminal

⎿ cache-tax: keepwarm on for 6h00m, a ping 50m after each idle stretch keeps the cache read, not re-written ⎿ cache-tax: claude-opus-5-5 state warm, 1h00m left context 44,000 tokens cold cost $0.35 to re-write it (warm turn $0.01) keepwarm on, 6h00m left · ping in 50m break-even up to 40 pings at the read rate cost one cold write, about 33h20m of idle at one ping per 50m guard ask first (/cache-tax guard warn to only show the price) session 0 cold writes paid, $0.00 [>] cache-tax · warm · keepwarm 6h00m left · ping in 50m [-]

Claude Desktop

Cache Tax in Claude Desktop

What it does

In the author's words

A Claude Code mod that keeps the one-hour prompt cache warm during breaks and asks before a cold send, showing its estimated rewrite cost. Warming uses model requests and costs tokens. Requires Claude Code 2.1.287+.

What you see
A row above the prompt while keepwarm is armed
Works in
Terminal and Claude Desktop
Slash commands
/cache-tax, /keepwarm
Uses your tokens
A cache-read ping after each 50 idle minutes
Changes files
Nothing
Network access
None
Reviewed commit
b05ec14
Preview recorded with
Claude Code 2.1.309

How it works

  1. /keepwarm arms a window for this session: six hours by default, or /keepwarm 90m
  2. After 50 idle minutes it sends one tool-less fork over the transcript so the cache is read
  3. Each ping's token usage is checked, and pinging stops if nothing was read
  4. Before a cold send over 50,000 tokens, it asks Send anyway or Don't send, with the price

Common questions

Why does a short message after a break cost so much in Claude Code?

When the cached prefix expires, even a short message can trigger a rewrite of the whole earlier context before the answer. The README's Fable 5.1 price row compares a $20 one-hour cache write with a $0.25 cache read per million tokens, so a cold send on a large context costs far more than a warm one.

How long does Claude Code's prompt cache last?

Included subscription usage defaults to a one-hour cache. API-key, usage-credit and cloud-provider sessions default to five minutes, and you can set promptCacheTtl to "1h" for those billing paths.

Do keepwarm pings count against my Claude subscription limits?

Pings are model requests and cost tokens. The README says how a cache read weighs against the 5-hour and weekly limits is not documented, and suggests watching the rate-limit row of your status line during the first window.

How do I stop being asked before a cold send?

/cache-tax guard warn shows the price and sends without asking. /cache-tax guard refuse 5 asks only when the estimate is $5 or more. /keepwarm off stops the pings and forgets the window.

Badge for your README

Own this listing? Add it to your README. The badge shows the install count as it grows.

Reviewed on statuslin.es
[![Reviewed on statuslin.es](https://staging.statuslin.es/badge/mods/cache-tax.svg)](https://staging.statuslin.es/mods/cache-tax?utm_source=readme-badge)

Or show the preview card:

Preview on statuslin.es
[![Preview on statuslin.es](https://staging.statuslin.es/og/mods/cache-tax.png)](https://staging.statuslin.es/mods/cache-tax?utm_source=readme-badge)

More like this

Deck in Claude Desktop

A cockpit for Claude Code: plan bars and subagent strips, context, usage limits with reset countdowns and burn rates, spend, the model route and a pet. Six bar styles, three collapsed looks. CLI and Desktop.

Flightdeck in Claude Desktop

Flightdeck: a live agent dashboard for Claude Code. Main model vitals, an on-call architect, every permission check, subagent cards and swimlanes, a turn receipt and a session log, all from real session events

Session Band in Claude Desktop

Band above the prompt: turn number, output speed, turn and session cost, prompt cache countdown and context fill; notifies before the cache expires.

Opus 4.8 high ✦ │ ctx 22% │ app (main) │ PR #1287 ● │ $0.41 · 10m +128 -34 Session ● ● ● ● ● ● ● ● ○ ○ ○ 74% left Resets in 2h 6m Weekly ● ● ● ● ● ● ● ● ● ● ○ 93% left Resets in 2d 0h

Feature-rich bash status line with model, context bar, session cost (read live from Claude Code, so it stays correct on any model), rate-limit bars, and live tool/agent activity that adapts to terminal width. Source: github.com/JungHoonGhae/claude-statusline

Opus 4.8 │ main │ app │ ▓▓░░░░░░░░ 44k/200k │ $0.41

Catppuccin Frappé–themed status line with model, git branch and dirty flag, folder, a block context bar, and session cost. Source: github.com/danjdewhurst/cc-status-line

Opus 4.8 │ ✍️ 78% │ app (main) │ +128/-34 Cost $0.4100 Tokens in 44.0k │ cache write 5000 │ cache read 2000 │ out 1.4k

Compact status line showing model, context remaining %, directory/git, session time and lines changed, with rate-limit bars or a cost/token breakdown. Source: github.com/susomejias/claude-statusline

Opus 4.8 main 22% $0.41

Color-coded model, branch, context %, and session cost. Example statusline inspired by the Claude Code docs (code.claude.com/docs/en/statusline).