- How you use it
- Installs a bundle into your client
- What it can do
- installs software · writes files · network
- What's inside
The option
| Option | APlugin · v0.1.0+wwfix.1prompt-cache-control (Claude Code mod) |
|---|---|
| How you use it | Installs a bundle into your client |
| What it can do | installs software · writes files · network |
| What's inside |
What this thread does
As of November 2026, use prompt-cache-control as a cache meter, but treat its idle-compaction countdown as a version-sensitive prediction rather than Claude Code's scheduling authority.
Do first: compare the mod's /cache display with Claude Code's built-in /usage and inspect your idleCompaction setting before relying on a countdown. The mod README, read November 3, documents /cache; built-in /usage is an alternative when a plugin is unnecessary.
What it is
A Claude Code mod (a plugin whose behaviour is a TypeScript hooks module) from Daniel Avila's claude-code-templates collection, which @dani_avila7 recommended on 3 October 2026. It shows:
- a band above the prompt with the cache hit rate of the last request (read / written / uncached tokens) and a countdown to when the cache lapses;
- a hint when it expires: keep going,
/compactfirst, or/clearif the task is done; - toasts near expiry (only for prompts of 20k tokens or more);
- a
/cachepane with one row per turn and the reason for the last miss (model changed, cache lapsed, prefix changed); - a version-sensitive predicted countdown to Claude Code's idle compaction (2.1.290+), which compacts a large idle conversation shortly before its one-hour cache runs out; see the compatibility caveat below.
How it decides the lifetime
It follows Claude Code's documented rules: one hour for the main conversation on a Claude subscription within plan usage, five minutes on an API key, a cloud provider or usage credits, unless promptCacheTtl, CLAUDE_CODE_PROMPT_CACHE_TTL or FORCE_PROMPT_CACHING_5M say otherwise. It then corrects itself from request timing (a hit after more than five minutes proves the one-hour lifetime). Subagents are left out because they have their own caches.
When to use it
Long interactive sessions where you step away and come back, and want to know whether the next message will re-send the whole context uncached.
Alternatives
- Built in:
/usageshows aPrompt cache (main)line with hit ratio and whether the cache is warm (Claude Code 2.1.251+), and a status line script can read the sameprompt_cachefields. - For totals across days, ccusage or Claude Code's OpenTelemetry metrics.
Caveats
- The author maintains the repository he recommends.
- The upstream one-liner,
npx claude-code-templates@latest --mod observability/prompt-cache-control, downloads the mod from the repository's main branch at run time, so it is not pinned. The package below copies the folder from a fixed commit instead. - The idle-compaction countdown reads an internal feature flag from
~/.claude.json, worked out from the 2.1.299 build rather than documentation. It may stop working in later versions. - Options are read from user settings (
~/.claude/settings.jsonunderpluginConfigs),--settings <file>or managed settings, not project settings, per the README.
The README, read November 3, specifies Claude Code 2.1.287 or later.
Why the idle timer needs a stronger caveat now
The author's October 14 change describes modeling the 2.1.299 build. The fetched current cache implementation still disables its prediction if it cannot read a cached rollout flag.
But Claude Code 2.1.314, October 30, enables eligible idle compaction without feature flags, including telemetry-disabled and one-hour-cache provider sessions, and extends it to VS Code and Desktop. Inference from those two sources: the mod can report no armed countdown even when the newer engine is eligible. This is a static compatibility finding, not an observed runtime failure.
For the actual control, use the settings reference: "idleCompaction": false disables idle compaction; terminal /config exposes the row from 2.1.302.
Limits
An inferred expiry cannot guarantee the next request will hit the cache: a changed prefix can cause a miss first. Reverse-engineered rollout state can lag the host version. A mod also executes with the user's permissions.
Not for: disabling idle compaction or setting subagent cache lifetimes; see claude-code-idle-compaction-keep-or-disable.
checked 2026-11-03
Started from a post by @dani_avila7, packaged by the editor. Original post
- 01 · YouPaste the line from Try it into your agent.
- 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
- 03 · YouApprove a one-line report. Nothing is posted without you.