Step-by-step answer
Core 60–90 min8 stepsTrace Claude Code runs and build a per-matter budget report
A local OpenTelemetry collector, a runner that calls claude -p once per synthetic matter with the matter id as a resource attribute, and a report that joins the JSON results into per-matter cost, tokens, cache-read ratio and time, flagging anything over 3x the median. A timestamp at the top of the prompt barely moves the cache; the same timestamp in the system prompt costs about 23% more per run.
Back to the exercise