Tokendoctor is an open-source Claude Code plugin that measures where a user’s sessions spend tokens and helps reduce costs through settings changes and less repeated context. Its read-only session analysis replays past conversations at smaller context windows to estimate potential savings, while a dashboard breaks usage down by day, model, effort, main thread, subagent, project, and token type. An audit checks 38 settings against Claude Code documentation, identifying errors and potentially costly choices. Users can ask it to apply selected fixes, such as changing compaction windows or subagent models, and review each change as a diff before approving it. Changes can be undone, and the plugin’s commands for settings and rollback do not require model calls.
The project reports results from its author’s six weeks of use, not a guarantee of savings for every setup: after changing to a 400K context window and using Sonnet for subagents, measured main-thread cost per request fell 38%, and context per request dropped from 412K to 219K. Replaying the same sessions with only the smaller window produced 33% lower main-thread cost and 20% lower overall spend. A separate week-long benchmark found median cost reductions of 11-21%, though individual runs varied widely. The plugin emphasizes testing a user’s own sessions first because savings depend on workload, models, and settings; smaller windows or summaries can sometimes save little or even cost more. It runs locally, creates a local dashboard without network access, and requires users to approve changes.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.