Skip to content
HN On Hacker News ↗

GitHub - localixai/tokendoctor: tokendoctor: the same Claude Code for up to 38% less. A Claude Code plugin that shows what your use overpays, fixes it with a diff you approve, and puts any change back. Runs on your machine.

▲ 34 points • 18 comments • by rsaryev1997 • 1w ago • HN discussion ↗

Pangram verdict · v3.3

We believe this text is mainly AI, with some human-written content.

99 %

AI likelihood · overall

AI
1% human-written 99% AI-generated
SEGMENTS · HUMAN 1 of 13
SEGMENTS · AI 12 of 13
WORD COUNT 1,271
PEAK AI % 100% · §1
Analyzed
Nov 17
backend: pangram/v3.3
Segments scanned
13 windows
avg 98 words each
Distribution
1 / 99%
human / AI fraction
Verdict
AI
Pangram v3.3

Article text · 1,271 words · 13 segments analyzed

Human AI-generated
§1 AI · 100%

The same Claude Code for up to 38% less See what your Claude Code use overpays, fix it, undo it any time.

§2 AI · 100%

Runs on your machine.

§3 AI · 100%

Website · Install · Changelog Measured on its author's six weeks of real use Main-thread cost per request at API list prices, the month before against the week after a 400K window and Sonnet for subagents −38% Context per request 412K → 219K The same sessions replayed at a 400K window: only the window changed −33% of the main thread, −20% of all spend The slide against a summary, the same day of work (bench) −19% cost, −33% time A week of work in bench (27 steps), Claude Code as it ships against every fix applied and the slide −11 to −21% cost (medians of 2 and 3 runs; single runs −40% to +17%), all tests pass There is no one pill. If your sessions rarely pass 400K tokens, the window changes nothing for you; a summary that lands just before you finish can cost more than it saves; your models, effort and work all move the number. So tokendoctor shows you yours first: /tokendoctor:sessions replays your own sessions at smaller windows before anything changes. See /tokendoctor:sessions replays your own sessions at smaller windows and says what each would have saved, then where the tokens went. Fix /tokendoctor:optimize runs 38 checks against the docs and applies the changes you pick, each shown as a diff first. Slide /tokendoctor slide on: where Claude Code would summarize, old tool outputs go instead. No pause, the conversation stays word for word. Undo /tokendoctor undo lists every change tokendoctor made and puts any one back. No model call, no tokens. /tokendoctor:dashboard: every token by day, model, effort, main thread and each subagent, context size and project.

§4 AI · 100%

One local file; this is the author's own.

§5 Human · 0%

Install claude plugin marketplace add localixai/tokendoctor claude plugin install tokendoctor@tokendoctor Update with claude plugin marketplace update tokendoctor and claude plugin update tokendoctor@tokendoctor, then restart Claude Code.

§6 AI · 100%

To try it without installing, clone the repository and run claude --plugin-dir /path/to/tokendoctor. Use Command What it does /tokendoctor:sessions [days] What a smaller window would have saved you (your sessions replayed), then where tokens went over the last 30 days (or days), with findings.

§7 AI · 100%

Read-only.

§8 AI · 100%

/tokendoctor:audit Setting checks by severity, each linked to the docs, a read of your memory and CLAUDE.md, then the usage dashboard.

§9 AI · 100%

Read-only.

§10 AI · 100%

/tokendoctor:dashboard [days] Builds and opens a local dashboard of every session on this machine: spend by day, kind of token, model, reasoning effort, main thread and each subagent type, context size, project and hour, with filters. One HTML file, no network. /tokendoctor:optimize [focus] Proposes up to five changes from your numbers and applies the ones you pick. /tokendoctor [name] [value] Shows the main settings, explains one or changes it. No model call, no tokens. /tokendoctor fix <finding-id> Applies one audit fix after showing it, with a backup of the file. /tokendoctor undo [n] Lists the changes tokendoctor made, newest first, and puts change n back. /tokendoctor is answered by the plugin itself, so it costs nothing. Tab completes the names (window, slide, cache, effort, model, subagents, and /tokendoctor all for the rest) and their values; /tokendoctor window 400k applies as typed, /tokendoctor window reset goes back to the default, --project or --local writes there instead of your user settings. A model name must be an alias (opus, sonnet, haiku) or a claude-… id. optimize changes only settings on the tunable list and /config rows. Every change opens a dialog that shows it and runs only on Apply; with no one to ask, as in a -p run, nothing changes. Hooks and permissions are never on the list. From a shell The plugin's bin/ directory is on the Bash tool's PATH while it is enabled: tokendoctor-audit [--project <dir>] [--json] tokendoctor-sessions [--days <n>] [--project <dir>] [--by day|week] [--json] tokendoctor-set --list | <key> <value>|--unset [--scope user|project|local] [--write] tokendoctor-apply <finding-id> [--scope user|project|local] [--project <dir>] [--write] tokendoctor-undo [--json] | <n> [--write] tokendoctor-replay [--days <n>] [--window 200k,400k] [--json] # what a smaller window would have saved tokendoctor-org-install [--write] [--uninstall] # the slide under a Team/Enterprise login (see below) tokendoctor-selfcheck [--log <file>] [--json] # what really loaded, from a debug log (one small Haiku request, or a log you have) What it costs to keep installed The skills are user-invoked only (disable-model-invocation). claude plugin details tokendoctor@tokendoctor estimates about 235 tokens of always-on cost for the five of them. The plugin has no MCP server. Its hooks module adds the optimize tools (mcp__tokendoctor__*) behind ToolSearch, so only their names are listed until /tokendoctor:optimize loads them. /tokendoctor and the slide run in the hooks module too, with no model call, so they add no tokens. Its one command hook runs tokendoctor-record in the background when a session starts. The hook is async and prints nothing, so it adds no tokens. It appends each finished day's totals to ~/.claude/tokendoctor/history.jsonl, so the trend outlives Claude Code's transcript cleanup. The 38 setting checks Errors are settings that are wrong or ignored, warnings are likely to cost real money, and info is worth a look. Rules that depend on a Claude Code release are skipped on older versions. Finding Severity What it catches settings-unreadable error A settings file that exists but is not valid JSON, so nothing in it applies. compact-threshold-undocumented error autoCompactThreshold is not a Claude Code setting; the real key is autoCompactWindow.

§11 AI · 100%

Fix removes it.

§12 AI · 100%

compact-env-bare-number error CLAUDE_CODE_AUTO_COMPACT_WINDOW below 100,000 (a bare number is tokens, not thousands). compact-window-unset warn Models with a native 1M window compact only near 967K by default. Fix sets 400,000. compact-window-small warn A window so small that frequent compaction breaks the prompt cache. prompt-caching-disabled warn A DISABLE_PROMPT_CACHING* variable is set. subagent-model-force warn Every subagent, including reasoning ones, is forced onto one model. effort-max-in-settings warn effortLevel: "max" is not accepted in settings. Fix uses xhigh. advisor-inactive warn An advisor that will silently not run (telemetry or feature-flag fetching off, advisor below the main model, tool disabled). fast-mode-enabled warn fastMode: true saved as a default, so every session pays the higher fast-mode rate. Fix sets fastModePerSessionOptIn. auto-compact-off warn DISABLE_AUTO_COMPACT or autoCompactEnabled: false: history grows until the model window fills. Fix unsets the setting. tool-search-off warn/info ENABLE_TOOL_SEARCH=false loads every MCP tool definition into every request. explore-default-model info The built-in Explore agent runs on Opus on many accounts. Fix installs a Haiku, read-only override. subagent-model-unset info General-purpose subagents inherit an expensive main model. Fix sets CLAUDE_CODE_SUBAGENT_MODEL=sonnet. main-model-expensive info Opus or Fable as the default; suggests Sonnet. agents-inherit-model info Custom agents with no model run on the main model. heavy-dirs-not-denied info Large target/, dist/, build/, coverage/, .turbo/ directories not excluded from reads. Fix adds permissions.deny rules. large-lockfile-readable info Lockfiles over 200 KB that a model can open in full. Fix adds a deny rule. instructions-long info CLAUDE.md plus its @imports over 200 lines. Path-scoped .claude/rules and skills cut the cost; imports do not. compact-instructions-missing info No # Compact instructions section to steer summaries. context-surface info Many skills, plugins or MCP servers loaded in every session. duplicate-skills info The same skill at user and project level. thinking-tokens-env info MAX_THINKING_TOKENS is ignored on adaptive-reasoning models. prompt-cache-ttl-forced-short info FORCE_PROMPT_CACHING_5M removes the one-hour cache some plans get. agent-teams-enabled info Agent teams multiply token use per teammate. mcp-output-limit-raised info A raised MAX_MCP_OUTPUT_TOKENS. every-tool-hooks info Hooks matching * on a tool event (Pre/PostToolUse, PostToolUseFailure, PermissionRequest) start a process per call. Latency, not tokens. Fix drops them after a dry run; read the warning first if a tool shows agent status from them. idle-compaction-off info idleCompaction: false: a long conversation is not compacted before its one-hour cache expires.

§13 AI · 100%

Fix unsets it.