Claude Session Report: Claude Didn't Do the Counting

A report on your Claude Code sessions looks like Claude counted every token, but a bundled script does the counting and writes one file before Claude opens anything. Claude's job is reading that file and explaining what matters.

1:58 video2 min readWatch on YouTube

You might guess that a Claude session report works because Claude reads your session logs and counts every token itself. The video says it does not. A bundled script does the counting, and Claude's job begins only after that script has written its answer.

The tempting picture

The session-report skill sounds like Claude read through your logs and tallied every number itself: tokens, cache hits, subagent calls, all counted in its head. The video sets this up as the naive framing and then tests it.

Delete the script and the report is gone

The test is simple. Delete analyze-sessions.mjs from the skill folder and the report does not merely get worse. It cannot run at all. There is no other way inside the skill to get those numbers, because Claude was never the one counting them.

The middleman file

The script analyze-sessions.mjs reads your raw session data and writes one answer to /tmp/session_report.json before Claude ever opens a report. That file is the middleman, holding the already-computed answer.

The skill contains three files: the script, a SKILL.md, and template.html.

What Claude actually does

Claude's real job starts after the JSON file exists. It reads the file, skims the totals, which cover overall usage, usage by project, by subagent, and by skill, and decides what is worth explaining.

The report's moving parts, such as sorting a table, expanding a row, and drawing a bar out of characters, are already live in the template file Claude copies in. So Claude's work is the numbers and the narrative, not the sorting code. The JSON file written by the script is still sitting inside the finished report untouched, and every number on the page traces back to it rather than to Claude's reasoning.

Neither direction is proof

The video closes with two caveats. A report that looks right does not prove Claude read every line of your session logs, since it read one script's summary. And a report that is wrong does not prove Claude reasoned badly, because the script may have computed something you did not expect and Claude relayed it faithfully.

Key takeaways

  • A bundled script, not Claude, counts the tokens, cache hits, and subagent calls.
  • The script reads raw session data and writes one computed answer before Claude opens a report.
  • Without analyze-sessions.mjs, the report cannot run at all.
  • Claude reads the JSON, skims the totals, and decides what is worth explaining.
  • The template already handles sorting, expanding rows, and bars, so Claude writes words, not markup.
  • Every number on the page traces back to the script's file.
  • A correct-looking report does not prove Claude read every log line, and a wrong one does not prove bad reasoning.

Try it yourself

Ask Claude to run the session-report skill on your own Claude Code sessions, covering tokens, cache, subagents, skills, and the priciest prompts. Tell it to read the skill first and walk you through exactly what it will do before it does it. Run it against your own session history, not the video's example.

Chapters

  1. 0:00The naive framing: "Claude counts every token itself"
  2. 0:11Sounds like Claude did the counting
  3. 0:21Broken, with a case — delete the script, the report is gone
  4. 0:33The anchor: the middleman file — the script's already-computed answer
  5. 0:46Read it, then skim it
  6. 0:57The template already moves — Claude's job is words, not markup
  7. 1:09The anchor returns — same file, unchanged
  8. 1:20Both directions — neither one is proof
  9. 1:34Carry-out
  10. 1:41Your turn
  11. 1:53Outro
Full transcript(auto-generated, with timestamps)

The naive framing: "Claude counts every token itself"

[0:00]You guess Claude reads your session logs and counts every token itself to build the report. It doesn't. A bundled script does that counting. So, does session report count every token itself? Say

Sounds like Claude did the counting

[0:11]Claude has a session report skill, and it sounds like Claude read through your logs and tallied every number itself. Tokens, cash hits, sub-agent calls, all counted in its head. But delete analyze

Broken, with a case — delete the script, the report is gone

[0:21]Sessions.mjs from the skill folder, and the report doesn't get a little worse. It can't run at all. There's no other way inside the skill to get those numbers, because Claude was never the one counting them.

The anchor: the middleman file — the script's already-computed answer

[0:33]Here's the file that actually does the counting, analyze sessions.mjs. It reads your raw session data and writes one answer /tmp/session_report.json before Claude ever opens a report.

Read it, then skim it

[0:46]Claude's real job starts after that file exists. Read it, skim the totals, overall usage by project, by sub-agent, by skill, and decide what's actually worth explaining. The report's moving parts, sorting a

The template already moves — Claude's job is words, not markup

[0:58]Table, expanding a row, drawing a bar out of characters, already live in a template file Claude copies in. Claude's job is the numbers and the narrative, not the sorting code. So, that JSON

The anchor returns — same file, unchanged

[1:09]File, the one the script wrote before any of this started, is still sitting inside the finished report untouched. Every number on the page traces back to it, not to Claude's reasoning. A report

Both directions — neither one is proof

[1:20]That looks right doesn't prove Claude read every line of your session logs, it read one script's summary. And a report that's wrong doesn't prove Claude reasoned badly. The script may have computed something you didn't expect, and Claude just relayed it faithfully. A session report isn't

Carry-out

[1:35]Claude counting your tokens, it's a script that counts and Claude that explains what the count means.

Your turn

[1:41]Your turn. Paste this into Claude. Run the session report skill on my Claude code sessions, tokens, cash, sub-agents, skills, the priciest prompts. Read the skill first and walk me through exactly what you'll do before you do it. Claude

Outro

[1:54]Session report, Liam in for bear.

More from Extending Claude — Skills, Plugins & Connectors

Humanitarians AI Lyrical Literacy Project