agentleFS
alegaussalegauss/claude-code-usage/.claude/skills/usage-benchmark/SKILL.md

usage-benchmark

Skill1 starsChanged 4 months agoApache-2.0View on GitHub

Measure real Claude Code usage from local transcripts and recalibrate the simulator against it. Use when checking whether index.html's cost model matches reality, refreshing the measured baseline, or answering "what does a task actually cost".

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read-only, dependency-free, nothing leaves the machine.

    line 21
  2. Very specific:

    Every assistant line carries message.usage (input, cache_creation split by TTL, cache_read, output), message.model, effort and requestId.

    line 56
  3. Distinctive:

    Prefer medians for the defaults and mention p90 in the copy.

    line 107

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Usage benchmark

tools/measure-usage.mjs reads the JSONL transcripts Claude Code writes for every session and reports the same quantities index.html models. It exists so the coefficients on the page can be measured rather than asserted.

npm run measure                              # console report
npm run measure:json                         # also writes .usage/facts.json
npm run apply                                # folds it into index.html
npm run recalibrate                          # measure, apply, verify
node tools/measure-usage.mjs --project shio  # one project
node tools/measure-usage.mjs --since 2026-08-01 --until 2026-08-08

Read-only, dependency-free, nothing leaves the machine. .usage/ is gitignored and must stay that way — it carries real project names and spend.

How a measurement reaches the page

apply-measurements.mjs rewrites one delimited block in index.html:

/* ==== measured snapshot: generated by tools/apply-measurements.mjs — do not hand-edit ==== */
var MEASURED = { ... };
/* ==== end measured snapshot ==== */

CACHE_FACTOR, COORD_SHARE, AGENT_SHARE and the high/xhigh rows of EFFORT read from that object, and every figure quoted in slide 10's prose is rendered from it too — so a re-measurement can never leave the copy contradicting the model. Do not hardcode a measured number into the HTML; add it to the snapshot and render it.

The page must not fetch this at runtime: a fetch breaks opening index.html directly, and the raw measurements name real projects. Inline and anonymised is the only shape that satisfies both.

profiles in the snapshot are use-case bands — projects grouped by context weight with the names stripped. Publishing the bands is fine; publishing which client sits in which band is not.

Where the data comes from

~/.claude/projects/<project>/<session>.jsonl                    main thread
~/.claude/projects/<project>/<session>/subagents/agent-*.jsonl  one subagent
~/.claude/projects/<project>/<session>/subagents/workflows/wf_*/agent-*  a workflow

Every assistant line carries message.usage (input, cache_creation split by TTL, cache_read, output), message.model, effort and requestId.

Four traps, all already handled — do not undo them:

  • Profiles alias each other. ~/.claude-pessoal/projects is typically a symlink to ~/.claude/projects. Roots are deduped by realpathSync; without that every session counts twice.
  • One response spans several lines sharing a requestId, each repeating the same usage block. Dedupe by requestId or the totals inflate.
  • Subagents live in different files from the task that spawned them. They are folded back onto the parent session by directory, then onto a task by timestamp. Skip this and fan-out cost vanishes from every per-task figure.
  • A slash command is a task. /loop and friends arrive as a user line wrapped in <command-name>; treating them as noise dropped more than half of all spend into an unattributed bucket. unattributed in the report must stay at 0% — if it climbs, task detection broke.

Measured baseline — 2026-08-08

1,864 tasks / 79,377 requests / $14,619 at list prices, 32 active days across 29 projects. Refresh with npm run recalibrate and update this table.

QuantityPage assumesMeasuredWhere
cache_factor0.24750.133598.2% reads, 1.7% 1h writes
high calls/task1418 (median, solo)p90 148
high output/call4500652across 1,199 tasks
context/call120k default257k323k on shio
COORD_SHARE0.451.4–3.2coordinator outruns a solo chain
AGENT_SHARE0.700.55–0.63agents are leaner than assumed
agents per workflow8 default11 (median)6 workflows on record

The two big errors cancel: context is 2.7x higher than assumed while output per call is 7x lower, so the headline $/task looked plausible for the wrong reasons. Check the internals, not just the total.

The 1-hour cache write costs 2x, not the 1.25x a 5-minute write costs. Claude Code uses the 1h TTL, so MULT in the tool encodes both and the measured cache_factor already reflects the real mix.

Recalibrating the page

chain_cost = calls x (context x input_price x cache_factor + output x output_price)

holds up: with measured constants it reproduces shio's median task within 6% ($5.51 predicted vs $5.86 actual). The shape is right; only the constants were wrong. When updating EFFORT, CACHE_FACTOR, COORD_SHARE or AGENT_SHARE in index.html, update slide 10 in the same edit — it lists every coefficient, and a stale note there is worse than no note.

Prefer medians for the defaults and mention p90 in the copy. Task cost is heavily long-tailed (median $2.71, mean $7.83, p90 $16.98); a mean makes the typical task look twice as expensive as it is.

What the model still does not represent

  • /loop runs, 443 of them at $18.85 median, are 57% of all spend. An autonomous loop is not a task in the page's sense and has no lever on the console.
  • Fan-out is rare in practice — 3.2% of tasks, 0.6% of spend — so the workflow and ultracode multipliers describe a mode that barely runs. Say so rather than presenting them as typical.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.