0x0funky

Claude Cache Guard — Security skill for Claude Code

Security community

Claude Code skill that stops prompt-cache thrash: -88% token burn in image-heavy agent sessions, with an audit script that shows exactly which calls nuked your cache.

How to install Claude Cache Guard

This entry records only its repository, not the path inside it, so there is no exact command to give. Open 0x0funky/claude-cache-guard and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Claude Cache Guard does

Claude Code skill that stops prompt-cache thrash: -88% token burn in image-heavy agent sessions, with an audit script that shows exactly which calls nuked your cache.

Alternatives in Security

  • Token Scan — Meme coin and token security scan — checks for rug pull vectors (hidden mint, honeypot, fee manipulation, LP l 3.8k ★
  • Query Token Audit — Audit token security to detect scams, honeypots, and malicious contracts across BSC, Base, Solana, and Ethereu 483 ★
  • Audit Agent Sessions — Analyze all agent sessions from the last 3 days across Claude, Codex, and Gemini 238 ★

README

claude-cache-guard

A Claude Code skill that stops **prompt-cache thrash** — the hidden cost pattern where reading one screenshot inside a long conversation rewrites the entire conversation history at **12.5× the cache-read price**.

Measured results

Real image-heavy production workload, same project / model / day, comparable work batches, before vs after applying the rules:

Metric Before After Δ
Images read in main context 40 (across 22 turns) 1
Cache writes (billed at 1.25×) 18.0M tok 0.74M tok −96%
Output tokens (work produced) 139k 164k +18%
Quota-weighted consumption 27.6M eq-tok 3.4M eq-tok −88%
Estimated cost $276.80 $33.65 −88%
Consumption per unit of output 199 20.5 ≈10× efficiency

Same model, same image resolution, same output quality. (Honest caveat: a real-workload before/after, not a variable-controlled A/B; the "after" also starts from a fresh context — which is itself one of the rules, R6.)

What it does

When Claude is about to read images/screenshots in a session with history — visual QA, render checks, UI verification, diagram review — the skill loads rules that make it:

  1. Batch all image reads into a single message (1 image or 10 = same rewrite cost)
  2. Write findings to a notes file and never re-read an unchanged image
  3. Delegate vision checks to a subagent with a tiny isolated context, so the main session's cached prefix is never invalidated
  4. Keep large tool outputs (build logs, file dumps, base64) out of context
  5. Avoid TTL-expiry wakes and mid-session model/tool changes that nuke the cache

Plus a read-only **audit script** that ranks your recent sessions by estimated cost and flags exactly which calls thrashed the cache and why.

Install

# macOS / Linux
git clone https://github.com/0x0funky/claude-cache-guard ~/.claude/skills/cache-guard
# Windows (PowerShell)
git clone http