post-deadline: a session's tokens are counted once (Entire running totals, Claude Code content-block rows)

main
No checks reported

Commit

Raj Karia1mo ago

Entire's per-checkpoint token_usage covers the transcript from checkpoint_transcript_start, or from the session's start when that is null or 0, so a slice without it is a running total. The parser summed every slice: a 72-checkpoint session in yorrick/agent-skills came to 17.9 billion cache-read tokens ($5,580.68); its final transcript says 542 million ($185.90). Slices now merge oldest first: a from-start slice replaces the count, a mid-transcript slice adds to it (within 0.2% of the deduplicated transcripts on that repo). Claude Code writes one transcript row per content block, each repeating the response's usage, so usage is now counted once per (message id, request id). Forward-run costs come from each run's result event and are unaffected. reports/ is left as submitted.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com