cachelisted
Install: claude install-skill ahundt/autorun
# /ar:cache — Cache Miss / Compaction Protection Skill
<purpose>
A PreToolUse gate that blocks commands when the prompt cache is effectively
cold — saving tokens by preventing full-rate re-reads of context that has
just fallen out of the 5-minute prompt-cache TTL. **Off by default.**
## When to use this skill
Invoke when the user asks about any of:
- setting a cache-miss / cache-hit-ratio threshold
- protecting against compaction-triggered context loss
- `/ar:cache`, `/ar:cache on`, `/ar:cache ok 5m`, `/ar:cache set …`
- "how do I stop Claude from burning tokens after idle time"
- "what is the cache gate", "cache protection"
Harness note: this is a skill, while `/ar:cache` is a runtime autorun command.
Claude Code can usually pass the slash form to hooks. Codex may intercept
unknown slash commands before hooks see them, so use `ar:cache` or
`ar cache ...` in Codex prompts when you need the runtime command.
## 1. Philosophy
- **Off by default.** No block fires unless the user runs `/ar:cache on`.
- **Fail-open.** If usage data is unavailable (old Claude Code version, Gemini
CLI without cache-token fields, malformed JSONL), the gate allows.
- **Reuse, don't reinvent.** The gate uses the same `ScopedAllow` grants,
`parse_scope_args` grammar, `session_state` filelock backend, and
`check_blocked_commands` block UX that `/ar:ok` / `/ar:no` already use.
- **Stay out of the statusline.** The gate does **not** install or modify the
user's `statusLine` setting. An optio