UsageAppears in · Band / Pane / ToastAdded

Cache Control

Cache hit meter and expiry countdown above the prompt.

Cache Control · Effect preview · IllustrationIllustrative
> Add pagination to the order list
⏺ I’ll look at the list component first.
cache ██████████ 98% read 80k · wrote 1k · new 300 ⏱ 3:41
5m · warm: keep going
cache ░░░░░░░░░░ 0% read 0 · wrote 52k · model changed
cache ██████████ 98% ⏱ 0:00 · expired: /compact first
❯

Illustration. Actual results depend on the mod, terminal and environment.

Install

Installation is unusual; follow the original author’s instructions

Read the author’s instructions ↗

What it accesses

Based on the author’s documentation, checked when listed; use claude plugin validate to check for yourself.

Reads

Yes

Reads per-request cache usage, rate-limit windows, env vars, and a few keys in ~/.claude.json and settings.

Writes files

Unspecified

README has no permissions section; no file-write calls seen in the code.

Runs commands

Unspecified

README has no permissions section; no process-spawn calls seen in the code.

Network

Unspecified

README has no permissions section; no network calls seen, it only reads usage data.

Introduction

Cache Control is a Claude Code function-hooks mod from claude-code-templates. It draws a cache meter above the prompt: per request, how much the cache served, how much was written and how much went uncached, with a countdown to expiry and advice to keep going, /compact or /clear. /cache opens a pane with a time-left bar and a per-turn table; toasts warn as the cache runs out.

  • The lifetime follows Claude Code's own rules (1 hour on a subscription, 5 minutes on an API key, cloud provider or usage credits, plus the env variables and promptCacheTtl) and self-corrects from request timing.
  • When Claude Code 2.1.290+ idle compaction is armed, the band adds a compaction countdown; the flag is read from ~/.claude.json and nothing shows without it.
  • Options: ttl, warnSeconds, compactAtTokens, band, status, toast, idleCompact.

Install via npx. Not run by us; the preview is illustrative.

Who it is for

  • People who want to avoid rewriting a whole prompt after the cache lapses
  • Users deciding when to compact or clear in long sessions

Requirements

  • Claude Code ≥ 2.1.287
  • Install: npx claude-code-templates@latest --mod observability/prompt-cache-control
  • The idle-compaction countdown needs Claude Code 2.1.290+ with the feature rolled out.