# Claude Code Prompt Cache Report

> See exactly where your Claude Code sessions lose their prompt cache, what each break cost, and how to stop it.

Claude Code Prompt Cache Report is a paid AI agent skill on Agensi by Minh Phạm Việt Hoàng, in LLM Ops. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $1 (one-time purchase)
- Creator: [Minh Phạm Việt Hoàng](https://www.agensi.io/creators/minhph581)
- Category: [LLM Ops](https://www.agensi.io/skills/llm-ops)
- Version: 1.0
- Last updated: 2026-11-29
- Security: scan passed (2026-11-19); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/claude-code-prompt-cache-report
- Tags: llm-ops, prompt-engineering, claude-code, prompt-caching, token-optimization, cost-analysis, usage-limits, cache-hit-rate

## About this skill

Claude Code resends your whole conversation on every request. When the prompt
cache is warm, that costs a fraction of normal input. When it goes cold, the next
request pays to rewrite everything, often 100k+ tokens at once. It happens
silently: no error, just a bigger bill or a usage limit that arrives sooner.

This skill makes it visible. Ask Claude "why was this session so expensive?" or
"show my cache report for this week", and it runs a local report on your own
Claude Code transcripts, then explains the result in plain language:

- **Cache hit rate** per session and what caching saved you
- **Every cache break**: when it happened, how many tokens were rewritten, and
  what it cost beyond a normal cache read
- **The likely cause** of each break:
  - idle past the cache lifetime (5 min or 1 h)
  - model switch
  - compaction
  - effort or thinking change
  - MCP server, plugin or system prompt change
  - an edited earlier message (shows how far the cache still matched)
- **A fix for each cause**, plus at most three habits worth changing

In the author's own sessions over one week, cache breaks were about a third of
the estimated cost, almost all from returning after the 1-hour cache had expired.

### Example output

Real output from the author's sessions (shortened):

```
Cache hit rate  94.5%
Est. cost       $8.70 (no cache: $48.19)

Cache breaks    4, +$4.00 vs cache reads
  11-10 20:31  rewrote 115.2k  +0.90
    - cache expired: 2h19m idle, TTL 1h
  ...
  11-11 16:06  rewrote 140.8k  +1.10
    - cache expired: 15h50m idle, TTL 1h
```

Weekly view, worst sessions first:

```
start        hit%   cost  breaks  break $
11-10 17:44  94.5  $8.70     4     $4.00
11-14 17:37  91.6  $6.29     3     $3.10
...
Total cost     $46.93
Cache breaks   $14.97 (31.9%)
```
### What's included

- `SKILL.md`: when to run the report, how to read it, how to explain it
- `scripts/cache_report.py`: the report (single session, all sessions,
  `--days N`, `--json`, custom prices)
- `references/fixes.md`: what to do for each cause of a cache break

### Privacy and safety

- Runs entirely on your machine. Reads `~/.claude/projects` only, never writes to it.
- No network calls, no telemetry, no dependencies: Python standard library only.
- Does not change your settings or CLAUDE.md.

### Requirements

- Claude Code with local transcripts (default)
- Python 3.8+

## Requires

- Claude Code
- Python 3.8+

Tested on macOS; Windows not tested yet.

## Known limitations

Costs are estimates from list prices, not your actual bill. Break causes are best guesses from what the transcript records; some breaks can only be labeled as an unnamed prefix change. It reports past sessions, not the live cache timer. If a future Claude Code update changes the transcript format, the report may need an update.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the Claude Code Prompt Cache Report skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### How exactly does this skill help me save money on Claude Code?

It reads your local Claude Code session transcripts and lists every cache break: when it happened, how many tokens were rewritten, what it cost, and the likely cause (idle past the cache lifetime, model switch, compaction, effort change, tool or system prompt change, edited history). Your agent then explains the biggest ones and the habit that prevents each.

### I'm on Pro / Max, not paying per token. Is this useful?

Yes. Cache breaks use up your usage limits the same way they would raise an API bill. Dollar figures are list-price estimates, so read them as relative cost.

### Do I need to upload my session logs anywhere?

No. The script runs on your machine, reads ~/.claude/projects and makes no network calls. Only the summary report is shown to your agent, like the output of any command you run in Claude Code.

### Is this compatible with Cursor, Codex, Aider or other agents?

No. It analyzes Claude Code's session transcripts (CLI, desktop app and IDE extensions all write them). Other agents can load the skill but have no transcripts for it to read.

### What are the technical requirements to use this tool?

Claude Code and Python 3.8+. Standard library only: nothing to install, no API keys.

### Does it work for subagents?

Yes. Subagent transcripts are included, and their caches are analyzed separately.

### Will it keep my cache warm automatically?

No. It shows what happened and why. For a live countdown while you work, the skill points to the free open-source cache-warm mod.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
