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.

9 installs

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://statuslin.es/badge/mods/cache-tax.svg)](https://statuslin.es/mods/cache-tax?utm_source=readme-badge)

Or show the preview card:

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

More like this

Token Weather Usage in Claude Desktop

One line above the prompt: context tokens with their weather, a bar per recent prompt, your 5-hour and 7-day limits against the time elapsed, the prompt cache with its time left, the session cost with the last prompt's share in dollars and in points of the 5-hour limit, the subagents running, and a one-click pill for the GOs Claude proposes. Labels in English, French or Russian. After Token Weather (Anthropic, Apache-2.0) and the ideas of usage-meter (HolyGrail) and prompt-cache-control (Daniel San).

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

╭─ CONTEXT ────────────────────────────────────────────╮ │ ████▊░░░░░░░░░░░░░░░░░ 22% of 200K · GOOD │ ├─ STATS ──────────────────────────────────────────────┤ │ ↓ 44.0K ↑ 1.4K │ $0.41 │ ⏱ 10m 12s │ +128/-34 │ ├─ REPO ───────────────────────────────────────────────┤ │ ◆ Opus 4.8 · main · 16:21 │ ╰──────────────────────────────────────────────────────╯

A boxed multi-line panel with auto-sizing borders: a context section with a gradient bar and status word, a stats section (tokens, cost, duration, lines changed), and a repo section (model, git branch with file counts, clock, vim mode), in a terracotta Claude-brand palette.

Opus 4.8 [high] ~/app main 16:20:55 | ⛁ ██░░░░░░░░ 22% | 5h ●◔○○○ 26% ↻2h7m | 7d ◔○○○○○○ 7% ↻2d1h │ $0.41 ⏱ 10m

Two-line status with a block context bar and quarter-step dot meters (◔◑◕●) for the 5-hour and weekly limits (fill shows usage, color shows whether you are ahead of or behind pace), plus model, effort, git and cost. Needs no jq.

████▊░░░░░░░░░░░░░░░░░ 22% of 200K · GOOD │ ↓ 44.0K ↑ 1.4K │ $0.41 │ ⏱ 10m 12s │ +128/-34 │ 5h 26% ↻2h06m │ 7d 7% ↻2d0h │ ◆ Opus 5.5 · main · 03:53

One-line adaptation of @kyleledbetter's Dreambase Panel: a context bar with status word, token/cost/duration/lines-changed stats, and model + git branch + clock, all on a single line in a terracotta Claude-brand palette.

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.