Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By banyuduv0.2.4In 1 marketplace
Cache-aware cost guard for Claude Code — warns before submitting prompts that may trigger expensive cache rewrites
You run one by typing its /name in Claude Code.
No risk signals detected
Nothing flagged in this plugin's hooks, MCP servers or commands. Other components are not analyzed.
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Cache-aware cost guard for Claude Code. Intercepts tool calls that may cause expensive prompt cache invalidation — warns or blocks operations that read/write large files, protecting your token budget.
Claude Code's prompt caching saves significant costs by reusing previously cached context. But certain operations silently invalidate the cache:
Without visibility into these costs, a single Read of a 100KB file can silently waste thousands of cached tokens — turning a cheap conversation into an expensive one.
Cache Control hooks into Claude Code's PreToolUse and UserPromptSubmit events to estimate the token impact of every file operation before it happens.
Read, Write, Edit, and Bash tool calls to estimate cache impact based on file sizeThe result: visibility into cache costs before they happen, with configurable thresholds to warn or block expensive operations.
Two commands inside Claude Code:
/plugin marketplace install banyudu/claude-cache
/plugin install cache@claude-cache
That's it. Restart Claude Code and Cache Control is active.
npm install -g claude-cache
claude --plugin-dir $(npm root -g)/claude-cache
git clone https://github.com/banyudu/claude-cache.git
cd claude-cache && pnpm install && pnpm run build
claude --plugin-dir ./claude-cache
Cache Control works out of the box with sensible defaults. To customize, create a config file:
~/.claude/cache-control.yaml.claude/cache-control.yamlConfig is evaluated in layers with project > user > default priority:
.claude/cache-control.yaml) — highest priority~/.claude/cache-control.yaml)Thresholds can be fixed token counts or percentages of contextSize.
| Setting | Default | Description |
|---|---|---|
contextSize | 200,000 | Context window size (Sonnet/Opus: 200000, 1M variants: 1000000) |
warnTokens | "20%" | Ask before proceeding |
blockTokens | "50%" | Deny the operation |
warnCumulativeTokens | "100%" | Warn on all subsequent ops |
protectClaudeMd | true | Always ask before modifying CLAUDE.md |
# For Opus-1M / Sonnet-1M
contextSize: 1000000
thresholds:
warnTokens: "20%" # 200,000 tokens
blockTokens: "50%" # 500,000 tokens
warnCumulativeTokens: "100%"
protectClaudeMd: true
tools:
Read:
warnTokens: "30%"
Write:
warnTokens: 20000 # fixed count also works
Long idle periods inside an active session let the Anthropic prompt cache expire — so when you finally come back, the next prompt pays for a full cache rebuild. Cache Control auto-prevents this:
SessionStart hook injects a one-time instruction: arm the warm timer by calling CronCreate (a non-turn-terminating tool) alongside your first reply. Because CronCreate doesn't end the turn, the arm runs inside the reply without swallowing the answer — model-agnostic, and safe even for fast models like Fable. No Stop hook is used, so nothing is injected after any reply — there is no per-turn message.__cache-warm-ping__; the assistant replies ok and re-arms via ScheduleWakeup, so the cache stays warm.warm.maxPings to bound it (e.g. 30 × 3000s ≈ 25h of idle warming, after which the session stops warming for good). You can also stop a long-idle-but-open session at any time with /warm off.maxPings set, the ping carries the cycle count (__cache-warm-ping__ 7/30) — that counter is the only state, so the budget survives compaction.Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
npx claudepluginhub banyudu/claude-cache --plugin cachePlugins from other owners that cover similar ground