Sessions - xsyetopz/claudetto GitHub Wiki
The plugin claudetto-sessions shows what a Claude Code session costs.
It has two reports and one note.
It works without the core plugin, and it imports nothing from another plugin.
The slices are start-cost, usage, and awareness.
Each report is a CLI, and a command.run hook shows its output with no model turn.
The command /start-cost runs claudetto-start.
It reads a transcript and reports the tokens of the first request, by source: system prompt, tools, skills, agents, and memory files.
The sources are an estimate from the characters of the transcript, and the line First request holds the real token count.
| Exit status | Meaning |
|---|---|
0 |
The report ran, and each bound that was given holds. |
1 |
A bound did not hold, or --text-max could not run. |
2 |
The transcript has no request with usage, so there is no data. |
-
--text-maxfails with status1when the transcript has noprompt_snapshotrecord. The report then says that the check did not run. -
--text-minonly advises. It never changes the exit status.
The command /claudetto-sessions:usage runs claudetto-usage.
It reports the model calls, the tokens that each call reads again from the cache, the cost, and the skills that a period did not use.
The built-in /usage is another command and runs as usual.
- Each label names one count. A turn is a prompt, and a call is one request to the model. The two counts never share a label.
- A call with a model id that has no price keeps its token counts. The report names the model, and its cost does not count in the total.
- The report names the Claude Code versions that the transcript records, and the version of the plugin.
- At each session start, the plugin keeps its version for the session in
$.store, for at most 500 sessions. The command gives this record to the report, and the report counts the sessions of the period by plugin version. A session that started before the record had it counts asnot recorded.
When managed settings install the plugin with appendPlugins, $.session.identity() answers.
Each report then starts with a line that names the account.
A plugin install gets a deny answer, and the reports name no account.
Claude Code shows the rate-limit state, so the plugin does not draw it again.
When the seven-day window reaches 80 percent, the session.measure hook makes one note.
The main agent gets the note once, after the result of its next tool call.
The bound is WEEKLY_WARN_PERCENT in slices/awareness/limits.ts.
Each hook of the plugin catches its errors, writes them to the debug log, and lets the session go on. The plugin writes no stamp into the transcript.
- Add-On Plugins: the list of the add-on plugins.
- Bounds