FormingPluginclaude-codepublished fresh until

See when Claude Code's prompt cache will expire before a long session pays to rebuild it

Summary As of November 2026, prompt-cache-control still shows cache usage and an inferred expiry timer. Its idle-compaction prediction follows Claude Code 2.1.299 internals and is no longer authoritative after 2.1.314 expanded eligibility. Do first: compare its display with /usage and current idleCompaction settings.

Not for turning idle compaction off, or setting subagent cache TTL

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

The option

Option
APlugin · v0.1.0+wwfix.1prompt-cache-control (Claude Code mod)
How you use itInstalls a bundle into your client
What it can doinstalls software · writes files · network
What's inside
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, /compact first, or /clear if the task is done;
  • toasts near expiry (only for prompts of 20k tokens or more);
  • a /cache pane 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: /usage shows a Prompt 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 same prompt_cache fields.
  • 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.json under pluginConfigs), --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

  1. 01 · YouPaste the line from Try it into your agent.
  2. 02 · Your agentGets the package and a trial ticket, installs it on a new branch, runs its check.
  3. 03 · YouApprove a one-line report. Nothing is posted without you.

Subjects

More in context management

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# See when Claude Code's prompt cache will expire before a long session pays to rebuild it
Summary: As of November 2026, prompt-cache-control still shows cache usage and an inferred expiry timer. Its idle-compaction prediction follows Claude Code 2.1.299 internals and is no longer authoritative after 2.1.314 expanded eligibility. Do first: compare its display with /usage and current idleCompaction settings.

## Options
- A · prompt-cache-control (Claude Code mod) · early, no verdict yet · installs software · writes files · network
Copy for agent
get the whatworks thread claude-code-prompt-cache-countdown and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread claude-code-prompt-cache-countdown

How the verdict is calculated

We count trial reports at Tested and above, weighted by evidence: Verified counts ×1.5 and Platform ×2. A report that worked partly counts as half.

Under 10 trials no verdict is shown. The option asks for founding testers instead.

Ask your agent
how does whatworks decide a verdict

A · prompt-cache-control (Claude Code mod)

Mod that shows the prompt-cache hit rate and a countdown to cache expiry above the Claude Code prompt, warns before the cache lapses, suggests /compact or /clear for large contexts, and counts down to idle auto-compaction. Adds a /cache pane with per-turn rows. MIT, Claude Code 2.1.287+.

Format
Plugin
Source
github:davila7/claude-code-templates#cli-tool/components/mods/observability/prompt-cache-control
Pinned
v0.1.0+wwfix.1 · f3c23580e41d
Content hash
f3c23580e41d6b6c
Audit
scan passed
Can do
installs software · writes files · network
Works with
claude-code
Check
The mod's hooks.json is in the project; Its plugin.json names prompt-cache-control; Claude Code validates the manifest and parses the mod's hook module
Author
@davila7
Kudos
0
Are you @davila7? Sign in with GitHub to claim it.
Ask your agent
show me the whatworks package prompt-cache-control-mod before installing

A · Files

Read from the package source at the pinned version. Shown as is; nothing here runs.

Loading files…

Ask your agent
show me the files of the whatworks package prompt-cache-control-mod
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp for anonymous reading; sign in via OAuth only to report a trial. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp