Cache report

From woditschka/agentic-coding-reference · View interactive version

Cache report is an AI agent skill from the GitHub repository woditschka/agentic-coding-reference. Generate a per-agent cache-efficiency report for the current Claude Code session. Use when the user asks about cache stats, cache efficiency, prompt-cache performance, token savings, or whether subagents are using cache effectively. Examples: "show cache report", "how's the cache doing", "cache stat

How to use this skill

Skill file

What this does

Runs ~/.claude/cache-report.sh and analyzes the result. The script emits two sections of pure measurement:

The script does no interpretation; the analysis happens in this skill, which weighs the metrics against each other and against pipeline context to surface what's actually actionable.

Companion to the statusline (~/.claude/harness-statusline.sh), which shows live aggregates; this skill is for deeper per-agent analysis on demand.

Process

1. Run the script

Default — current cwd, most recent session (usually the active session):

~/.claude/cache-report.sh

Variants:

| User asks for… | Command |

|---|---|

| A specific session | ~/.claude/cache-report.sh <session_id> |

| A session in another project | ~/.claude/cache-report.sh <session_id> <project_dir> |

| List of available sessions | ~/.claude/cache-report.sh --list |

2. Always show the script output verbatim

Every invocation of this skill must include the full script output inside a fenced code block — Session + Per-agent breakdown, exactly as the script produced it. Do not summarize, paraphrase, or skip rows. The user wants to read the raw table; the interpretation goes on top of the table, not instead of it.

The script auto-detects whether stdout is a TTY — when invoked through a tool wrapper (non-TTY), it emits plain text so the columns stay aligned; in an interactive terminal it adds ANSI bold/dim/color. Either way, no post-processing is needed.

3. Add a Findings section beneath the table

After the verbatim table, append a **Findings** heading followed by a short list of bullets (2-4 items, sometimes zero). Each finding names the agent(s), states what's wrong, and points at the actionable next step. Weigh metrics against each other and against pipeline context — don't mechanically restate the columns.

Signals to look for (treat as guidance, not a checklist — combine them where it makes sense):

| Signal | What it usually means | Suggested next step |

|---|---|---|

| Multi-run agent (Runs ≥ 2) with warm-start < 40% | Fires of that agent were too spread out within the cache TTL (1 hour for Claude Code's writes) to share cache across invocations. | Cluster fires more tightly, or accept the cost as inherent to that agent's role. |

| Single-run agent (Runs == 1) at 0% warm-start | The agent fired once and paid the write premium with no follow-up to read from. If it runs once per feature by design (PRD authoring, gated quality reviews), this is structural and not actionable. Otherwise it points at an agent that should have fired earlier or more often. | Distinguish "by design" from "by accident" — most one-shot agents are intentional. Only flag agent types expected to fire repeatedly. |

| Negative Net savings % on any row | Cache cost more than it saved — the write premium (1.25× at 5-minute TTL, 2.0× at 1-hour) exceeded the 0.10× read savings on that agent. | Stop using that agent for one-shot work, or batch its invocations. |

| Multi-turn agent (median turns > 1) with in-run reuse < 70% | The prefix is being invalidated within a single fire — file re-reads with changed content, tool result ordering, or /compact events mid-run. | Investigate what's churning the prefix mid-fire. |

| Session-wide hit ratio < 75% | Many session tokens missed the cache. If session is short, this is just warmup; if long, structural. | Note context (early session vs. long-running). |

| ⊕ ≈ ⊖ (cache writes ≈ cache reads on an agent) | The agent wrote roughly as much as it read — almost no amortization, even if warm-start % looks OK in aggregate. | Often pairs with low warm-start or single-fire pattern; flag as a volume-weighted concern. |

How to weigh findings:

Format each finding as a bullet under a **Findings** heading. Don't fabricate concerns the data doesn't support.

Output interpretation reference

Pricing multipliers used (relative to base input price): cache write = 1.25× at 5-minute TTL or 2.0× at 1-hour TTL (Claude Code writes at 1h; the script reads the real per-turn split), cache read = 0.10× (the report's flat rate; Fable and Mythos 5.1 and 5.2 list reads at 0.025× and Opus 5.5 at 0.05×, so their rows understate savings slightly), uncached input = 1.00×.

Dependencies

What this skill does NOT do

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.