Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
git clone --depth 1 https://github.com/Todmy/cc-cache-monitorWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/todmy/cc-cache-monitor/usage-details)<a href="https://agentmods.dev/commands/todmy/cc-cache-monitor/usage-details"><img src="https://agentmods.dev/badge/commands/todmy/cc-cache-monitor/usage-details/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/commands/todmy/cc-cache-monitor/usage-details"><img src="https://agentmods.dev/badge/commands/todmy/cc-cache-monitor/usage-details.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00044 | $0.04809 |
| Opus 5 | $0.00022 | $0.02405 |
| Sonnet 5 | $0.00009 | $0.00962 |
| Haiku 4.5 | $0.00004 | $0.00481 |
Grade A, and why
usage-details scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 455 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Cache Usage Details
Analyze cache efficiency and token spend for Claude Code sessions.
Arguments
Parse $ARGUMENTS to determine mode:
- No arguments: analyze current session (most recently modified JSONL under
~/.claude/projects/) - Session ID prefix (e.g.,
be607d): find and analyze matching session --since YYYYMMDD: show multi-session overview since that date--list: show all sessions sorted by cost (highest first)
How to execute
Use the Bash tool to run Python one-liners that parse JSONL session files. All scripts use only Python stdlib (json, sys, os, glob, collections). Output results as formatted markdown tables.
Step 1: Find the session
python3 -c "
import os, glob
args = '''$ARGUMENTS'''.strip()
# Find all session files
files = glob.glob(os.path.expanduser('~/.claude/projects/*/*.jsonl'))
if not files:
print('No session files found.')
exit(0)
if args.startswith('--since') or args == '--list':
# Multi-session mode — print all paths
for f in sorted(files, key=lambda x: os.path.getmtime(x), reverse=True):
print(f)
elif args:
# Find by ID prefix
matches = [f for f in files if args in os.path.basename(f)]
if matches:
print(matches[0])
else:
print(f'No session matching \"{args}\" found.')
else:
# Current session — most recently modified
print(max(files, key=os.path.getmtime))
"
Step 2: For single session — run all 4 analyses
Run 2a (Hourly Timeline), 2b (Cliff Detection), 2c (Trigger Attribution), and 2d (Subagent Sessions). Step 2d is skipped automatically if no Agent tool_use blocks are found. Replace SESSION_PATH_HERE with the actual path from Step 1 in each script.
2a. Hourly Cache Timeline
python3 << 'PYEOF'
import sys, json, os
from collections import defaultdict
transcript = "SESSION_PATH_HERE" # Replace with actual path from step 1
calls = []
with open(transcript) as f:
for line in f:
try: m = json.loads(line.strip())
except: continue
if m.get('type') != 'assistant': continue
usage = m.get('message', {}).get('usage', {})
if not usage or 'output_tokens' not in usage: continue
cw = usage.get('cache_creation_input_tokens', 0)
cr = usage.get('cache_read_input_tokens', 0)
inp = usage.get('input_tokens', 0)
out = usage.get('output_tokens', 0)
ts = m.get('timestamp', '')
calls.append({'ts': ts, 'cw': cw, 'cr': cr, 'inp': inp, 'out': out})
if not calls:
print("No API calls with usage data found.")
sys.exit(0)
# Group by hour
hourly = defaultdict(lambda: {'cw': 0, 'cr': 0, 'out': 0, 'calls': 0, 'cost': 0})
for c in calls:
hour = c['ts'][:13]
hourly[hour]['cw'] += c['cw']
hourly[hour]['cr'] += c['cr']
hourly[hour]['out'] += c['output'] if 'output' in c else c['out']
hourly[hour]['calls'] += 1
hourly[hour]['cost'] += c['inp']*5/1e6 + c['out']*25/1e6 + c['cw']*6.25/1e6 + c['cr']*0.50/1e6
print("## Hourly Cache Timeline")
print()
print(f"| Hour | Calls | CacheW | CacheR | Ratio | Output | Cost |")
print(f"|------|-------|--------|--------|-------|--------|------|")
for hour in sorted(hourly.keys()):
h = hourly[hour]
ratio = f"{h['cr']/h['cw']:.0f}:1" if h['cw'] > 0 else "N/A"
cliff = " CLIFF" if h['cw'] > 0 and h['cr']/h['cw'] < 1 else ""
print(f"| {hour[5:]} | {h['calls']} | {h['cw']/1e6:.1f}M | {h['cr']/1e6:.1f}M | {ratio} | {h['out']/1e3:.1f}K | ${h['cost']:.2f}{cliff} |")
# Totals
total_cw = sum(h['cw'] for h in hourly.values())
total_cr = sum(h['cr'] for h in hourly.values())
total_out = sum(h['out'] for h in hourly.values())
total_cost = sum(h['cost'] for h in hourly.values())
total_calls = sum(h['calls'] for h in hourly.values())
ratio = f"{total_cr/total_cw:.0f}:1" if total_cw > 0 else "N/A"
print(f"| **TOTAL** | **{total_calls}** | **{total_cw/1e6:.1f}M** | **{total_cr/1e6:.1f}M** | **{ratio}** | **{total_out/1e3:.1f}K** | **${total_cost:.2f}** |")
PYEOF
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 11d ago First seen · 455 lines · 44 tokens per session scan A a053385659da
usage-details is a command published in the GitHub repository Todmy/cc-cache-monitor (5 stars, last pushed 17d ago), licensed MIT. It adds 44 tokens to every session and 4,809 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other commands, from other repositories
compress
Automatically compress CLAUDE.md or other memory files with protected-span safety. One-command token savings.
speckit.specjudge.recommend
Recommend the model that fits this feature's tasks, with the fragment of the spec behind every level.
techdebt-summary
Print an aggregate debt summary (health score, SQALE rating, issue counts, remediation estimate) for a project without listing individual findings.
techdebt-scan
Scan a project directory for technical debt across all supported languages and print a prioritized summary of findings.
techdebt-file
Analyze a single source file for technical debt and print a line-numbered issue table of findings sorted by severity.
export-closedloop-learnings
Exports pending ClosedLoop learnings to global location with deduplication.