prompt-cache-control

prompt-cache-control · by claude-code-templates

Shows how much of each request's prompt the cache served vs wrote, counts down to expiry, and suggests /compact or /clear before it lapses.

❯ /plugin marketplace add SeongGwangJu/k-mods
❯ /plugin install prompt-cache-control@k-mods

Run /reload-plugins to apply it to an open session. Needs Claude Code 2.1.287 or later.

Notes

  • The TTL (how long the cache is kept) is estimated automatically from environment variables, settings and account type (subscription/API key), and it corrects itself by watching the intervals between requests.
  • A 1-second timer runs, but it redraws only when the displayed content changes, so an idle session costs nothing.

What it can do on your machine

Mods run unsandboxed with your permissions. These labels come from static analysis.

Reads env/settingsReads files
Static analysis

Events handled

command.run{command=cache}session.endsession.startturn.stepui.closeui.pressui.render{component=AbovePrompt}ui.render{component=Pane}

Environment variables read

CLAUDE_CODE_PROMPT_CACHE_TTLDISABLE_PROMPT_CACHINGDISABLE_PROMPT_CACHING_HAIKUDISABLE_PROMPT_CACHING_OPUSDISABLE_PROMPT_CACHING_SONNETENABLE_PROMPT_CACHING_1HFORCE_PROMPT_CACHING_5MHOME