[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-112739":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":14,"stars7d":16,"stars30d":16,"stars90d":15,"forks30d":15,"starsTrendScore":13,"compositeScore":17,"rankGlobal":10,"rankLanguage":10,"license":18,"archived":19,"fork":19,"defaultBranch":20,"hasWiki":19,"hasPages":19,"topics":21,"createdAt":10,"pushedAt":29,"updatedAt":30,"readmeContent":31,"aiSummary":32,"trendingCount":15,"starSnapshotCount":15,"syncStatus":14,"lastSyncTime":33,"discoverSource":34},112739,"tokendoctor","localixai\u002Ftokendoctor","localixai","tokendoctor: the same Claude Code for up to 38% less. Replays your own past sessions to show what each change would have saved, then changes only what you pick","https:\u002F\u002Ftokendoctor.dev",null,"TypeScript",176,12,2,0,105,77.34,"MIT License",false,"main",[22,23,24,25,26,27,28],"claude-code","claude-code-hooks","claude-code-plugin","cost-optimization","developer-tools","token-usage","tokens","2026-11-22 01:29:43","2026-11-23 05:09:11","\u003Cp align=\"center\">\n  \u003Cpicture>\n    \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"docs\u002Flogo.svg\">\n    \u003Cimg src=\"docs\u002Flogo-light.svg\" width=\"72\" height=\"72\" alt=\"tokendoctor\">\n  \u003C\u002Fpicture>\n\u003C\u002Fp>\n\n\u003Ch1 align=\"center\">tokendoctor\u003C\u002Fh1>\n\n\u003Cp align=\"center\">\n  \u003Cstrong>The same Claude Code for up to 38% less\u003C\u002Fstrong>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  See what your Claude Code use overpays, fix it, undo it any time. Runs on your machine.\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Ftokendoctor.dev\">Website\u003C\u002Fa> ·\n  \u003Ca href=\"#install\">Install\u003C\u002Fa> ·\n  \u003Ca href=\"CHANGELOG.md\">Changelog\u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"docs\u002Fdemo.gif\" alt=\"tokendoctor in a real Claude Code session: \u002Ftokendoctor:sessions, then the daily trend\" width=\"880\">\n\u003C\u002Fp>\n\n| Measured on its author's six weeks of real use | |\n|---|---|\n| Main-thread cost per request at API list prices, the month before against the week after a 400K window and Sonnet for subagents | **−38%** |\n| Context per request | **412K → 219K** |\n| The same sessions replayed at a 400K window: only the window changed | **−33%** of the main thread, **−20%** of all spend |\n| The slide against a summary, the same day of work ([bench](bench\u002FREADME.md)) | **−19% cost, −33% time** |\n| A week of work in [bench](bench\u002FREADME.md) (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 |\n\n**There is no one pill.** If your sessions rarely pass 400K tokens, the window changes nothing for\nyou; a summary that lands just before you finish can cost more than it saves; your models, effort\nand work all move the number. So tokendoctor shows you yours first: `\u002Ftokendoctor:sessions` replays\nyour own sessions at smaller windows before anything changes.\n\n\u003Ctable>\n  \u003Ctr>\n    \u003Ctd width=\"25%\" valign=\"top\">\n      \u003Cstrong>See\u003C\u002Fstrong>\u003Cbr>\n      \u003Ccode>\u002Ftokendoctor:sessions\u003C\u002Fcode> replays your own sessions at smaller windows and says what each would have saved, then where the tokens went.\n    \u003C\u002Ftd>\n    \u003Ctd width=\"25%\" valign=\"top\">\n      \u003Cstrong>Fix\u003C\u002Fstrong>\u003Cbr>\n      \u003Ccode>\u002Ftokendoctor:optimize\u003C\u002Fcode> runs 38 checks against the docs and applies the changes you pick, each shown as a diff first.\n    \u003C\u002Ftd>\n    \u003Ctd width=\"25%\" valign=\"top\">\n      \u003Cstrong>Slide\u003C\u002Fstrong>\u003Cbr>\n      \u003Ccode>\u002Ftokendoctor slide on\u003C\u002Fcode>: where Claude Code would summarize, old tool outputs go instead. No pause, the conversation stays word for word.\n    \u003C\u002Ftd>\n    \u003Ctd width=\"25%\" valign=\"top\">\n      \u003Cstrong>Undo\u003C\u002Fstrong>\u003Cbr>\n      \u003Ccode>\u002Ftokendoctor undo\u003C\u002Fcode> lists every change tokendoctor made and puts any one back. No model call, no tokens.\n    \u003C\u002Ftd>\n  \u003C\u002Ftr>\n\u003C\u002Ftable>\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"docs\u002Fdashboard.png\" alt=\"The author's tokendoctor dashboard: 57% of the spend was Claude re-reading the conversation\" width=\"880\">\u003Cbr>\n  \u003Csub>\u003Ccode>\u002Ftokendoctor:dashboard\u003C\u002Fcode>: every token by day, model, effort, main thread and each subagent, context size and project. One local file; this is the author's own.\u003C\u002Fsub>\n\u003C\u002Fp>\n\n## Install\n\n```bash\nclaude plugin marketplace add localixai\u002Ftokendoctor\nclaude plugin install tokendoctor@tokendoctor\n```\n\nUpdate with `claude plugin marketplace update tokendoctor` and `claude plugin update tokendoctor@tokendoctor`, then restart Claude Code. To try it without installing, clone the repository and run `claude --plugin-dir \u002Fpath\u002Fto\u002Ftokendoctor`.\n\n## Use\n\n| Command | What it does |\n| --- | --- |\n| `\u002Ftokendoctor: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. Read-only. |\n| `\u002Ftokendoctor:audit` | Setting checks by severity, each linked to the docs, a read of your memory and CLAUDE.md, then the usage dashboard. Read-only. |\n| `\u002Ftokendoctor: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. |\n| `\u002Ftokendoctor:optimize [focus]` | Proposes up to five changes from your numbers and applies the ones you pick. |\n| `\u002Ftokendoctor [name] [value]` | Shows the main settings, explains one or changes it. No model call, no tokens. |\n| `\u002Ftokendoctor fix \u003Cfinding-id>` | Applies one audit fix after showing it, with a backup of the file. |\n| `\u002Ftokendoctor undo [n]` | Lists the changes tokendoctor made, newest first, and puts change `n` back. |\n\n`\u002Ftokendoctor` is answered by the plugin itself, so it costs nothing. Tab completes the names\n(`window`, `slide`, `cache`, `effort`, `model`, `subagents`, and `\u002Ftokendoctor all` for the rest) and\ntheir values; `\u002Ftokendoctor window 400k` applies as typed, `\u002Ftokendoctor window reset` goes back to the\ndefault, `--project` or `--local` writes there instead of your user settings. A model name must be an\nalias (`opus`, `sonnet`, `haiku`) or a `claude-…` id.\n\n`optimize` changes only settings on [the tunable list](lib\u002Ftunables.mjs) and `\u002Fconfig` 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.\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>From a shell\u003C\u002Fstrong>\u003C\u002Fsummary>\n\nThe plugin's `bin\u002F` directory is on the Bash tool's PATH while it is enabled:\n\n```bash\ntokendoctor-audit [--project \u003Cdir>] [--json]\ntokendoctor-sessions [--days \u003Cn>] [--project \u003Cdir>] [--by day|week] [--json]\ntokendoctor-set --list | \u003Ckey> \u003Cvalue>|--unset [--scope user|project|local] [--write]\ntokendoctor-apply \u003Cfinding-id> [--scope user|project|local] [--project \u003Cdir>] [--write]\ntokendoctor-undo [--json] | \u003Cn> [--write]\ntokendoctor-replay [--days \u003Cn>] [--window 200k,400k] [--json]   # what a smaller window would have saved\ntokendoctor-org-install [--write] [--uninstall]                # the slide under a Team\u002FEnterprise login (see below)\ntokendoctor-selfcheck [--log \u003Cfile>] [--json]                  # what really loaded, from a debug log (one small Haiku request, or a log you have)\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>What it costs to keep installed\u003C\u002Fstrong>\u003C\u002Fsummary>\n\nThe skills are user-invoked only (`disable-model-invocation`). `claude plugin details\ntokendoctor@tokendoctor` estimates about 235 tokens of always-on cost for the five of them. The\nplugin has no MCP server. Its hooks module adds the optimize tools (`mcp__tokendoctor__*`) behind\nToolSearch, so only their names are listed until `\u002Ftokendoctor:optimize` loads them. `\u002Ftokendoctor`\nand the slide run in the hooks module too, with no model call, so they add no tokens. Its one command\nhook runs `tokendoctor-record` in the background when a session starts. The hook is `async` and\nprints nothing, so it adds no tokens. It appends each finished day's totals to\n`~\u002F.claude\u002Ftokendoctor\u002Fhistory.jsonl`, so the trend outlives Claude Code's transcript cleanup.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>The 38 setting checks\u003C\u002Fstrong>\u003C\u002Fsummary>\n\nErrors 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.\n\n| Finding | Severity | What it catches |\n| --- | --- | --- |\n| `settings-unreadable` | error | A settings file that exists but is not valid JSON, so nothing in it applies. |\n| `compact-threshold-undocumented` | error | `autoCompactThreshold` is not a Claude Code setting; the real key is `autoCompactWindow`. Fix removes it. |\n| `compact-env-bare-number` | error | `CLAUDE_CODE_AUTO_COMPACT_WINDOW` below 100,000 (a bare number is tokens, not thousands). |\n| `compact-window-unset` | warn | Models with a native 1M window compact only near 967K by default. Fix sets 400,000. |\n| `compact-window-small` | warn | A window so small that frequent compaction breaks the prompt cache. |\n| `prompt-caching-disabled` | warn | A `DISABLE_PROMPT_CACHING*` variable is set. |\n| `subagent-model-force` | warn | Every subagent, including reasoning ones, is forced onto one model. |\n| `effort-max-in-settings` | warn | `effortLevel: \"max\"` is not accepted in settings. Fix uses `xhigh`. |\n| `advisor-inactive` | warn | An advisor that will silently not run (telemetry or feature-flag fetching off, advisor below the main model, tool disabled). |\n| `fast-mode-enabled` | warn | `fastMode: true` saved as a default, so every session pays the higher fast-mode rate. Fix sets `fastModePerSessionOptIn`. |\n| `auto-compact-off` | warn | `DISABLE_AUTO_COMPACT` or `autoCompactEnabled: false`: history grows until the model window fills. Fix unsets the setting. |\n| `tool-search-off` | warn\u002Finfo | `ENABLE_TOOL_SEARCH=false` loads every MCP tool definition into every request. |\n| `explore-default-model` | info | The built-in Explore agent runs on Opus on many accounts. Fix installs a Haiku, read-only override. |\n| `subagent-model-unset` | info | General-purpose subagents inherit an expensive main model. Fix sets `CLAUDE_CODE_SUBAGENT_MODEL=sonnet`. |\n| `main-model-expensive` | info | Opus or Fable as the default; suggests Sonnet. |\n| `agents-inherit-model` | info | Custom agents with no `model` run on the main model. |\n| `heavy-dirs-not-denied` | info | Large `target\u002F`, `dist\u002F`, `build\u002F`, `coverage\u002F`, `.turbo\u002F` directories not excluded from reads. Fix adds `permissions.deny` rules. |\n| `large-lockfile-readable` | info | Lockfiles over 200 KB that a model can open in full. Fix adds a deny rule. |\n| `instructions-long` | info | `CLAUDE.md` plus its `@imports` over 200 lines. Path-scoped `.claude\u002Frules` and skills cut the cost; imports do not. |\n| `compact-instructions-missing` | info | No `# Compact instructions` section to steer summaries. |\n| `context-surface` | info | Many skills, plugins or MCP servers loaded in every session. |\n| `duplicate-skills` | info | The same skill at user and project level. |\n| `thinking-tokens-env` | info | `MAX_THINKING_TOKENS` is ignored on adaptive-reasoning models. |\n| `prompt-cache-ttl-forced-short` | info | `FORCE_PROMPT_CACHING_5M` removes the one-hour cache some plans get. |\n| `agent-teams-enabled` | info | Agent teams multiply token use per teammate. |\n| `mcp-output-limit-raised` | info | A raised `MAX_MCP_OUTPUT_TOKENS`. |\n| `every-tool-hooks` | info | Hooks matching `*` on a tool event (Pre\u002FPostToolUse, 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. |\n| `idle-compaction-off` | info | `idleCompaction: false`: a long conversation is not compacted before its one-hour cache expires. Fix unsets it. |\n| `bash-output-raised` | info | `bashOutputMaxChars` or `BASH_MAX_OUTPUT_LENGTH` above the 30,000 default. |\n| `code-intelligence-missing` | info | The project has files for a language with an official language-server plugin (`typescript-lsp`, `pyright-lsp`, `gopls-lsp`, …) and it is not enabled. |\n| `settings-key-undocumented` | warn | A settings key that is not in today's settings reference: misspelled or removed, so it does nothing. |\n| `env-undocumented` | info | A `CLAUDE_…`\u002F`ANTHROPIC_…`-style variable under `env` that today's docs do not list. |\n| `setting-needs-newer-version` | warn | A key or variable the docs say needs a newer Claude Code than the one installed. |\n| `slide-blocked-by-guard` | warn | The slide is on, but Claude Code's built-in guard sends compaction past the mods you install (a Team or Enterprise login, or managed settings), so it summarizes instead. Says to run `tokendoctor-org-install`. |\n| `compact-pct-override` | info\u002Fwarn\u002Ferror | `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`: where it puts the compaction point; a warning below 50%, an error when it is not a percent. |\n| `skill-model-switch` | info | A skill whose frontmatter names another model: each use reads the conversation uncached on that model. `context: fork` avoids it. |\n| `opusplan-cache` | info | `opusplan` switches models, and so caches, on every plan-mode toggle. |\n| `no-statusline` | info | No status line. Fix installs `tokendoctor-statusline.sh` and points `statusLine` at it (needs `jq`). One quiet line: `Opus 5.5 · api main* · 120k\u002F367k · cache 1h · 5h 51% · week 35% · $24`. Tokens are shown against the point where Claude Code compacts; `cache 1h` is how long the prompt cache stays warm; a limit adds `→ 100% in 48m` only when, at the recent pace (5h: the last hour, week: the last day), it runs out before it resets. The finding also mentions the `token-weather` mod from [anthropics\u002Fclaude-code-playground](https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fclaude-code-playground\u002Ftree\u002Fmain\u002Fclaude-code\u002Fmods\u002Ftoken-weather) as an alternative (needs Claude Code 2.1.287+, shared as-is). |\n\n`templates\u002Fstatusline.sh` is the status line script the fix installs into your Claude config folder.\n`templates\u002Fagents\u002F` holds three generic subagents (`Explore`, `test-runner`, `docs-lookup`), each\npinned to a small model with read-only or narrow tools. A plugin cannot override a built-in agent\nor ship `settings.json` keys such as `autoCompactWindow`, `env` or `permissions`, so the apply step\ncopies the template into `~\u002F.claude\u002Fagents\u002F` or `.claude\u002Fagents\u002F` and edits your settings files\nitself, with a backup.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>Checked against today's docs and what really loaded\u003C\u002Fstrong>\u003C\u002Fsummary>\n\nClaude Code changes every few days, so the audit does not trust a list frozen into the plugin:\n\n- It reads the current settings reference and environment variable list from code.claude.com, as\n  Markdown (every docs page is served at `…\u002Fdocs\u002Fen\u002F\u003Cpage>.md`, indexed for models at\n  [llms.txt](https:\u002F\u002Fcode.claude.com\u002Fdocs\u002Fllms.txt); a mirror such as context7 re-indexes on its own\n  schedule). Cached a day in `~\u002F.claude\u002Ftokendoctor\u002Fdocs`; `--offline` uses the cache only. Only those\n  public pages are fetched; nothing is sent. It flags settings keys Claude Code does not document\n  (`settings-key-undocumented`: a misspelled or removed key does nothing), variables of Claude Code's\n  own families it does not know (`env-undocumented`), and keys that need a newer release than yours\n  (`setting-needs-newer-version`).\n- It reads a `claude --debug` log of the last day, if you have one, and `tokendoctor-selfcheck` makes\n  one (one `claude -p` request on Haiku with no saved session; `--log \u003Cfile>` reads one you have, at\n  no cost): which copy of tokendoctor loaded and in which tier, whether the built-in guard was seated,\n  the order of the mods on compaction, hooks that were skipped, the window Claude Code really\n  compacts at, and a skill listing over its budget (descriptions cut short).\n- The `\u002Ftokendoctor:audit` and `\u002Ftokendoctor:optimize` skills read a finding's doc page before they\n  explain or recommend it.\n- For whoever maintains tokendoctor, `npm run docs:check` checks every settings key and variable it\n  names against the current docs.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>What the session report finds\u003C\u002Fstrong>\u003C\u002Fsummary>\n\n| Finding | Severity | What it catches |\n| --- | --- | --- |\n| `late-compaction` | warn | Over 30% of main-thread cost spent with more than 400K tokens in context. |\n| `subagents-on-top-model` | warn | Subagents on Opus or Fable making over 5% of all cost. Forks always run on the main model. |\n| `long-sessions` | info | Sessions of 500+ turns, with their share of cost. |\n| `idle-cache-rebuilds` | info | The prompt cache rebuilt after it expired during a break. |\n| `images-read-repeatedly` | info | The same image read three or more times. |\n| `rereads-after-compaction` | info | Files read before a summary and read again within the next 10 requests: what the summary lost. Shown against slides when there are some. |\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>Slide the window instead of compacting\u003C\u002Fstrong>\u003C\u002Fsummary>\n\nOff by default. With `\u002Ftokendoctor slide on` (or `tokendoctor-set tokendoctor.slide true --write`, or\n`\u002Ftokendoctor:optimize`), where Claude Code would compact, the plugin's hooks module elides old tool\noutputs into short pointers instead of summarizing, the way [llx](https:\u002F\u002Fgithub.com\u002Flocalixai\u002Flocalix-cli)\ndoes. Every prompt, answer and decision stays word for word, and there is no summary pause.\n\n- What goes first: reads made stale by a later read or edit of the same file, then what edits wrote\n  (it is on disk), then the oldest outputs. The recent tail, outputs the model has not answered yet\n  and Agent results stay.\n- It frees down to `tokendoctor.slideTo` percent (default 25) of where Claude Code compacts, so slides\n  are rare. Each one re-sends the context once, as a summary does; a pointer is never touched again.\n- `\u002Fcompact` still summarizes, and so does a slide that cannot free enough. Set a smaller window with\n  `autoCompactWindow` (for example 400000) and the slide works from it.\n- It takes idle compaction too (before the hour's cache expires); `\u002Fcompact` and a plugin's\n  `$.session.compact` still summarize.\n- **Team and Enterprise logins, and machines with managed settings.** There Claude Code seats its\n  built-in guard, `cc-plugin-sec-default`, ahead of the mods you install, and it sends compaction past\n  them: the slide cannot run, and the audit and `\u002Ftokendoctor slide` say so. `tokendoctor-org-install`\n  installs tokendoctor as the machine's own mod, which runs after the guard: a root-owned copy in\n  the system folder and `managed-settings.d\u002F50-tokendoctor.json` with `appendPlugins` (dry run first,\n  then one `sudo` command; `--uninstall` undoes it). Where your organization delivers its own managed\n  settings, files are ignored and only an administrator can add it.\n\nIn one real session, at the same size: Claude Code's summary took 367K to 35K in **65.3 s**; the slide\ntook 368K to 36K in **0.04 s**. Summaries in the author's real sessions take 79 s on average (109 of them, 22 September to 1 November).\n\nOn [bench\u002F](bench\u002FREADME.md), Claude Code doing a TypeScript project against fixed acceptance tests,\nHaiku 5.5, a 100K window so that it compacts several times (medians). A short task with one\ncompaction gains time but not money; the longer the work, the more the slide saves:\n\n| Task | Arm | Tests passed | Cost | Time | Waiting on compactions |\n| --- | --- | --- | --- | --- | --- |\n| a day of work (7 requests, 307 tests), 2 runs | summary | 307\u002F307 | $0.186 | 1141 s | 103–137 s |\n| | slide | 307\u002F307 | $0.151 (**−19%**) | 763 s (**−33%**) | under 1 s |\n| evalkit (an eval harness, 238 tests), 5 and 3 runs | summary | 238\u002F238 | $0.149 | 656 s | about 50 s |\n| | slide | 238\u002F238 | $0.096 (**−35%**) | 472 s (**−28%**) | under 1 s |\n| fixkit (12 bugs to find, 238 tests), 5 runs | summary | 238\u002F238 | $0.037 | 154 s | about 16 s |\n| | slide | 238\u002F238 | $0.039 (+6%) | 128 s (**−17%**) | under 1 s |\n\nThe earlier, smaller runs of `node bench\u002Fwindow.mjs` (60 files of 300 lines read one by one, then a\nfollow-up in the same session, 200K window) cost the same both ways:\n\n| Model | Arm | Cost | Compactions | Answers right |\n| --- | --- | --- | --- | --- |\n| Haiku 5.5 (3 runs) | summary | $0.581 | 3 | 5\u002F5 |\n| Haiku 5.5 (3 runs) | slide to 25% | $0.580 | 3.7 | 5\u002F5 |\n| Sonnet 5.5 (1 run) | summary | $2.93 | 3 | 5\u002F5 |\n| Sonnet 5.5 (1 run) | slide to 25% | $2.99 | 3 | 5\u002F5 |\n\nWhat a summary loses, measured with `--task recall`: the session starts with five decisions from the\nperson, the files are deleted after reading, and the follow-up asks for the decisions and eight KEYs the\nmodel noted. Claude Code's summary kept them all: 6\u002F6 and 8\u002F8 in every run on both models. The slide\ndid the same on Haiku 5.5 (3 runs, 2% dearer); on Sonnet 5.5 (1 run) it missed one KEY, which the\nmodel skipped noting in its first reply after a slide. So far no test shows the slide answering better,\nor worse: it saves time and money, not quality.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>Limits\u003C\u002Fstrong>\u003C\u002Fsummary>\n\n- It reads user, project and local settings files, `~\u002F.claude.json` (the MCP server names, to count\n  them, and the plan type, to tell whether Claude Code's guard is seated), the managed settings files\n  in the system folder and the cached server-managed ones (only to find the guard and its own machine\n  copy), and your skill and agent folders. Managed settings it does not check against the rules.\n- The audit fetches two public pages of Claude Code's docs once a day (`--offline` to skip); nothing\n  else goes over the network, and nothing of yours is sent.\n- Whether a rule helps depends on your plan and workload. Findings explain the trade-off and link\n  to the documentation; decide for yourself.\n- Deny rules in `permissions.deny` are best-effort for search tools and do not stop a read through\n  Bash.\n- Costs are dollars at each model's [Claude API list price](https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fabout-claude\u002Fpricing)\n  (`lib\u002Fprices.mjs`: cache reads at 0.05x input on Opus 5.5 and Sonnet 5.5, 0.025x on Fable 5.1,\n  Haiku 5.5 priced by prompt length, fast mode, US-only inference, web search). On a Pro or Max plan\n  that is what the same work would cost on the API: Anthropic does not publish how plan limits weigh\n  each kind of token.\n- Claude Code bills some requests it does not write into transcripts: a summary compaction's own\n  request, titles, the small model that reads a page for WebFetch. Their cost is Claude Code's own\n  session total (its `cost-state` lines) minus the responses in the transcripts, where that total\n  holds; else the summaries are estimated from the context they read. Against the cost Claude Code\n  reported on [bench](bench\u002FREADME.md)'s 78 runs: equal to the cent on 77, 7.7% over on one.\n- Sessions on other machines and transcripts Claude Code has already cleaned up are not counted,\n  except for days already in the history file.\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>Develop\u003C\u002Fstrong>\u003C\u002Fsummary>\n\n```bash\nnpm test               # node's built-in test runner, no dependencies\nnpm run test:mod       # the hooks module's tests (claude plugin test)\nclaude plugin validate .\nbun bench\u002Frun.ts --task fixkit --window 100000 --arm factory --arm factory+slide   # see bench\u002FREADME.md\n```\n\n`test\u002Fprivate.test.mjs` fails if anything git would commit holds an API key or token, a home folder\npath or a temporary folder of the machine: benchmark results come from runs on someone's account, so\nonly their summaries are committed and the transcripts stay local.\n\nThe landing page lives in `site\u002F` (`cd site && npm install && npm run dev`; `npm run build` prerenders\nit, `node scripts\u002Fog.mjs` redraws the social card). The demo is a real session recorded with\nasciinema; `site\u002Fscripts\u002FRECORDING.md` says how to record it again.\n\nRules are pure functions over a snapshot (`lib\u002Frules.mjs`); reading the disk lives in\n`lib\u002Fcollect.mjs` and writing in `lib\u002Fapply.mjs`. Adding a rule means adding one entry and its test.\nSession analysis is in `lib\u002Fsessions.mjs` and `lib\u002Fhistory.mjs`, the settings `tokendoctor-set` may\nchange in `lib\u002Ftunables.mjs`, the `\u002Ftokendoctor` command in `lib\u002Fconsole.mjs`, the replay in\n`lib\u002Freplay.mjs`, the slide in `hooks\u002Fwindow.ts`, and the optimize tools in `hooks\u002Fregister.ts`.\n\n\u003C\u002Fdetails>\n\n## License\n\nMIT\n","tokendoctor 是一款面向 Claude Code 用户的本地化 Token 成本优化工具，通过回放用户历史会话，量化不同上下文窗口、摘要策略等配置对 token 消耗的影响，并提供可预览、可选配、可撤销的优化操作。其核心功能包括会话回放分析（\u002Ftokendoctor:sessions）、多维度检查与差分优化（\u002Ftokendoctor:optimize）、无中断上下文滑动替换（slide）、以及零 token 开销的变更回滚（undo）。所有处理均在本地完成，不上传数据。适用于高频使用 Claude Code 进行长对话、多步开发或子智能体协作的开发者，尤其适合关注 API 成本、上下文效率与调试可逆性的工程场景。","2026-11-24 04:43:59","CREATED_QUERY"]