ai newsFr., 30. Okt.

I Parsed My Local Claude Code JSONL Logs to Find Out Why My Token Quota Evaporates So Fast

If you use Claude Code daily, you have probably experienced at least one of these two moments: On a Pro or Max subscription: Your 5-hour usage window suddenly hits the limit after 45 minutes of what felt like normal coding. On API billing: You pause for 6 minutes to grab coffee or review a diff, ty

dev.toFreitag 04:14 · 30.10.2 Min. Lesezeit
Bild: dev.to

If you use Claude Code daily, you have probably experienced at least one of these two moments:

I wanted to know where the tokens were actually going. Since Claude Code stores raw session transcripts locally as.jsonl files inside ~/.claude/projects, I wrote a parser to inspect every turn, tool call, subagent spawn, and cache event across my sessions.

What I found completely changed how I use Claude Code, and led me to build an open-source, in-process plugin to stop the leaks automatically.

Here are the 3 silent token killers hiding in your.jsonl logs, and how you can audit your own machine in 30 seconds.

Anthropic's prompt caching is the only reason large context windows (200k to 500k tokens) are affordable. When your prompt cache is warm, reading your existing conversation prefix costs 0.10x (a 90% discount).

Look at what happens to a 300,000-token context on Claude Opus 4.6 when that cache expires:

Claude is stateless. Every single turn re-sends the entire conversation history up to that point.

That means a noisy tool output at Turn 5 is not a one-time expense. You pay for it again at Turn 6, Turn 7, Turn 8, all the way to Turn 45:

Even on Turn 1, your context isn't empty. Every installed MCP server injects its full JSON schema and tool descriptions into the system prompt, alongside your CLAUDE.md files and engine reminders. If you have 6 MCP servers enabled and a 400-line CLAUDE.md, you are paying a heavy fixed tax on every single session.

Existing tools only solved parts of the puzzle: ccusage gives great post-mortem tables after your money is gone, and RTK compresses bash output via an external CLI wrapper.

I wanted something that runs 100% inside Claude Code's native process (zero Python, zero external processes per hook, zero network calls, zero telemetry) and protects the entire session lifecycle.

A Claude Code plugin that cuts token cost with context and prompt-cache control, automatic compaction, compression of noisy output and efficient code navigation. It runs entirely inside Claude Code, with no Python and no external process per hook, and integrates with Serena, Graphify, ast-grep and GitHub MCP.

100% Local & Offline: Zero network calls, zero telemetry, and zero external npm dependencies.

Requires Claude Code 2.1.290 or newer ( claude update ).

/plugin install cato --marketplace marcusaguiarmaciel-cmd/cato-plugin Audit your past sessions (instant, read-only): /cato-import /cato Reads your existing local.jsonl transcripts and shows your real 30-day token spend, cache misses by cause (idle TTL expiration, model switches, subagents), and context-band breakdown. Check your setup for token leaks: /cato-doctor Language Reports, warnings and the status line come in English, Portuguese or Spanish. CATO picks the language…

Quelle: dev.to (dev.to). Original öffnen