claude-code-king

Offline Telemetry Script — Development skill for Claude Code

Development community

Offline analyzer for Claude Code session transcripts (~/.claude/projects/.jsonl).

How to install Offline Telemetry Script

This entry records only its repository, not the path inside it, so there is no exact command to give. Open claude-code-king/offline_telemetry_script and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Offline Telemetry Script does

Offline analyzer for Claude Code session transcripts (~/.claude/projects/*.jsonl). Pure-stdlib Python, no API calls: per-session tokens, cache hit/churn, estimated USD cost, subagent tree, waste signals (batchable Bash, narration, re-reads). Built for one specific multi-agent workflow; runs anywhere, some signals won't apply.

Alternatives in Development

  • Ccusage — CLI for analyzing Claude Code/Codex usage from local JSONL files 11.8k ★
  • BashClaw — Bash is All You Need 105 ★
  • Bm Stats — Show the basemind dashboard — resource footprint (disk + RAM) and activity (tool calls, per-tool histogram, es 94 ★

README

offline_telemetry_script

Offline analyzer for Claude Code transcripts. Stdlib only, no API calls.

Disclaimer

This was built for the author's own multi-agent workflow: a planning model (Fable) writes plans, an execution model (Opus) implements them, work is split across named agents, and agent reports come back in Romanian. It runs on any Claude Code transcript, and the token/cost/cache numbers are real everywhere. But the waste/governance signals (batchable Bash calls, narration-only turns, re-reads, agent-name grouping) assume that workflow and will look off, or come back empty, on a different one. Comments shaped `🔴 constraint — DECIZII/PATTERNS «section»` point to internal notes that are not included in this repo (DECIZII is the author's decision log, PATTERNS the notes on technical pitfalls).

Why it exists

"I know the numbers look made up. They're not — this is how I got them." The cost/token figures in the accompanying post come from running this script against local transcripts, nothing else.

What the output looks like

Two levels. Per session, a markdown report with cost, turns, the subagent tree, a list of inefficiencies and a short postmortem:

![Peak context: real vs single-context, per version](docs/graph.png)

![Single-session report](docs/session.png)

Across sessions, `--trends` builds a `TRENDS.md`: spend, cache savings and waste per version of the workflow, plus recurring inefficiencies. This is the part that is actually useful: you change a rule in your workflow, then you see in numbers whether the next sessions got cheaper or noisier. You optimize on real data, not on feeling or vibes.

![Trends across all versions](docs/trends_general.png)

![Trends for one version, with waste by category](docs/trends_v1.8.png)

Install / run

Requires Python 3.6+, no dependencies.

python3 session_metrics.py --pricing pricing.json ~/.claude/projects//
python3 session_metrics.py --pricing pricing.json --json --out-dir out/ ~/.claude/