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.
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Check it deeper on your machine
It has changed since its scan on 18 Nov 2026.
As a Claude Code plugin, install it and then ask Claude Code:
/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/localixai/tokendoctor with scanskillsafety
Or from a terminal, clone it and run it:
git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/localixai/tokendoctor'
It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.
Badge for your README
Markdown
[](/listings/rsaryev--tokendoctor)HTML
<a href="/listings/rsaryev--tokendoctor"><img src="/api/listings/rsaryev--tokendoctor/badge.svg" alt="findsafeskills safety rating" /></a>Install
Install instructions from the README
As written by the repo's author. findsafeskills has not verified these steps.
claude plugin marketplace add localixai/tokendoctor claude plugin install tokendoctor@tokendoctor
Restart Claude Code and run `/tokendoctor:sessions` to see what your last 30 days would have cost at each window. Nothing changes until you pick it.
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
.claude-plugin/marketplace.json · Manifest · 14 lines
- {
- "name": "tokendoctor",
- "owner": {
- "name": "rsaryev"
- },
- "description": "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.",
- "plugins": [
- {
- "name": "tokendoctor",
- "source": "./",
- "description": "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."
- }
- ]
- }
README.md · README · 125 lines
- <p align="center">
- <picture>
- <source media="(prefers-color-scheme: dark)" srcset="docs/logo.svg">
- <img src="docs/logo-light.svg" width="72" height="72" alt="tokendoctor">
- </picture>
- </p>
- <h1 align="center">tokendoctor</h1>
- <p align="center">
- <strong>The same Claude Code for up to 38% less</strong>
- <br>
- Replays your own past sessions to show what each change would have saved, then changes only what you pick.
- </p>
- <p align="center">
- <a href="https://github.com/localixai/tokendoctor/actions/workflows/ci.yml"><img src="https://github.com/localixai/tokendoctor/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
- <a href="CHANGELOG.md"><img src="https://img.shields.io/github/v/tag/localixai/tokendoctor?label=version" alt="Version"></a>
- <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License: MIT"></a>
- </p>
- <p align="center">
- <a href="#install">Install</a> •
- <a href="https://tokendoctor.localix.ai/docs">Docs</a> •
- <a href="https://tokendoctor.localix.ai">Website</a> •
- <a href="CHANGELOG.md">Changelog</a>
- </p>
- <p align="center">
- <img src="docs/demo.gif" alt="tokendoctor in a real Claude Code session: /tokendoctor:sessions, then the daily trend" width="880">
- </p>
- **Your past sessions decide, not anyone's benchmark.** What a setting saves depends on how you
- work: how long your sessions run, which models you use, what the work is. A number from someone
- else's sessions, mine included, says little about yours. So tokendoctor starts by looking back at
- your own.
- **① Look back at your last 30 days.** `/tokendoctor:sessions` replays every session you had,
- request by request, at compaction windows of 200K, 300K, 400K and 600K, and shows what each would
- have cost. It only reads your transcripts, makes no model calls and changes nothing. The figure is
- an upper bound: a replay can't see work the model would have redone after a summary.
- **② Change only what your sessions show pays, and undo it.** `/tokendoctor:optimize` proposes
- changes from those numbers and checks your settings against Claude Code's docs; it applies only the
- ones you pick, each shown as a diff first. `/tokendoctor undo` puts any of them back.
- **③ Optional: slide instead of summarize.** When Claude Code would stop to summarize the
- conversation, tokendoctor drops old tool output instead and keeps every message. There is no model
- call, so it takes milliseconds, not a minute.
- ## Install
- ```bash
- claude plugin marketplace add localixai/tokendoctor
- claude plugin install tokendoctor@tokendoctor
- ```
- Restart Claude Code and run `/tokendoctor:sessions` to see what your last 30 days would have cost
- at each window. Nothing changes until you pick it.
- ## What it found in mine
- Every request sends the whole conversation to the model. On models with a 1M window, Claude Code
- compacts only near 967K tokens, so the end of a long session is the expensive part. For me, two
- thirds of main-thread cost went to requests with more than 400K in context.
- So I set a 400K window and Sonnet for subagents. Comparing the month before with the week after,
- about 23K and 19K main-thread requests, context per request went from 412K to 219K and cost per
- request fell 38% at API list prices. That's one person's before and after, not a controlled
- experiment.
- The catch is more summaries, and each is a pause: 79 seconds on average in my sessions. That's
- what the slide is for. Your sessions may show something else entirely, which is the point of
- looking at them first.
- ## What the benchmark shows
- On the [benchmark](bench/README.md), Claude Code builds a TypeScript project against tests it
- can't change, so a run counts only if the tests pass. Cost is per task, on Haiku 5.5:
- | Compared | Cost | Time |
- | --- | --- | --- |
- | Slide against a summary, a day of work | −19% | −33% |
- | Slide against a summary, an eval harness | −35% | −28% |
- | Slide against a summary, a short task | +6% | −17% |
- | The settings advice alone, against Claude Code as it ships | dearer in 3 of 4 runs | |
- | The advice and the slide, a week of work | −11% to −21% | |
- Every test passed in every run. The advice alone didn't pay here because these tasks rarely pass
- 400K, which is where the window starts to matter. If your sessions don't either, your replay will
- show it, and you should leave your window alone. Every run, the losing ones too, is in
- [bench/HISTORY.md](bench/HISTORY.md).
- <p align="center">
- <img src="docs/dashboard.png" alt="The author's tokendoctor dashboard: 57% of the spend was Claude re-reading the conversation" width="880"><br>
- <sub><code>/tokendoctor:dashboard</code>: where every token went, by day, model, subagent and project. One local file; this one is mine.</sub>
- </p>
- ## Commands
- | Command | What it does |
- | --- | --- |
- | `/tokendoctor:sessions [days]` | Replays your past sessions (30 days, or `days`) at smaller windows: what each would have saved, then where your tokens went. Reads only. |
- | `/tokendoctor:audit` | Your settings, memory and CLAUDE.md checked against the docs, by severity. Reads only. |
- | `/tokendoctor:dashboard [days]` | Opens a local dashboard of every session on this machine. |
- | `/tokendoctor:optimize [focus]` | Proposes up to five changes from your numbers and applies the ones you pick. |
- | `/tokendoctor [name] [value]` | Shows, explains or changes a setting, with no model call. |
- | `/tokendoctor undo [n]` | Lists every change tokendoctor made and puts one back. |
- Nothing leaves your machine: the only network call is to two public pages of Claude Code's docs,
- once a day. It never switches your models on its own.
- ## Documentation
- **[tokendoctor.localix.ai/docs](https://tokendoctor.localix.ai/docs)** has the rest: the
- [38 checks](https://tokendoctor.localix.ai/docs/audit), every
- [setting](https://tokendoctor.localix.ai/docs/settings),
- [how the slide works](https://tokendoctor.localix.ai/docs/slide) (and Team and Enterprise
- logins), the commands from a shell, the [measurements](https://tokendoctor.localix.ai/docs/proof)
- and the [limits](https://tokendoctor.localix.ai/docs/limits). To work on tokendoctor itself, see
- [CONTRIBUTING.md](CONTRIBUTING.md).
- ## License
- MIT
site/src/pages/kit/samples.ts · Bundled script · 93 lines · 1 finding marked
- import type { Block, Card } from '@/shared/config';
- /** The kit's specimens. They are the template's, not a site's content: a site's copy never
- * changes what the kit shows, only its theme does. */
- export const ONE_WAY: [string, string][] = [['npm', 'npm create example@latest']];
- export const THREE_WAYS: [string, string][] = [
- ['curl', 'curl -fsSL https://example.com/install | sh'],
- Note: Pipes a downloaded script directly into a shell (curl | sh / wget | bash)
- Line 7 on GitHub
- ['brew', 'brew install example'],
- ['npm', 'npm install -g example'],
- ];
- export const BLOCKS: { name: string; text: string; blocks: Block[] }[] = [
- {
- name: 'shell',
- text: 'A session: lines that start with `$` are commands and are highlighted, the rest is output.',
- blocks: [{ lang: 'shell', text: '$ example build --target web "src/**/*.ts" > build.log\n$ echo $?\n0' }],
- },
- {
- name: 'json',
- text: 'Data, highlighted.',
- blocks: [{ lang: 'json', text: '{\n "status": "done",\n "files": 12,\n "cached": true\n}' }],
- },
- {
- name: 'grid',
- text: 'A table in real columns, aligned per column (`align: "rll"`), each cell with a tone of its own.',
- blocks: [
- {
- grid: [
- [['dim', '0'], ['ok', 'done'], ['dim', 'everything passed']],
- [['dim', '1'], ['bad', 'failed'], ['dim', 'a check did not pass']],
- [['dim', '130'], 'interrupted', ['dim', 'stopped by a signal']],
- ],
- align: 'rll',
- },
- ],
- },
- {
- name: 'ui and out',
- text: 'A drawn screen, part by part, and single lines of output. The tones: plain, `dim`, `hi`, `ok`, `bad`, `acc`, `sel`.',
- blocks: [
- { ui: [[['sel', '❯ '], ['hi', 'Deploy to production'], ['dim', ' enter']], [['', ' '], ['', 'Deploy a preview']], [['', ' '], ['dim', 'Cancel']]] },
- { out: '3 checks passed', tone: 'ok' },
- { out: '1 warning: the bundle grew by 4 kB', tone: 'acc' },
- { out: 'took 1.8 s', tone: 'dim' },
- ],
- },
- ];
- export const CARD: Card = {
- tag: 'For whom',
- title: 'A card says one thing',
- text: 'Words on the left, what shows them on the right: a drawn terminal, a picture, a clip or a recording. Code in the text is marked with backticks, like `--flag`.',
- links: [{ label: 'A link to more', href: '#card' }],
- media: { kind: 'terminal', blocks: [{ lang: 'shell', text: '$ example check\n' }, { out: 'ok 12 files, 0 problems', tone: 'ok' }] },
- };
- /** The usage statistics card's words on a site that has not set its own. */
- export const CONSENT = {
- notice: 'We count visits with Google Analytics, only with your yes, to see which pages help.',
- privacy: '#consent',
- };
- export const PROSE = `## A second-level heading
- A paragraph of a docs page, with **strong words**, a [link](#prose), and \`inline code\` such as
- \`--dry-run\`. It keeps to a measure a line is easy to follow in.
- ### A third-level heading
- - A list item.
- - Another, with \`code\`.
- 1. A numbered step.
- 2. The next one.
- \`\`\`sh
- # a code block, with its language and a Copy
- npm run build -- --mode production
- \`\`\`
- \`\`\`ts title="content/site.ts"
- // any common language is highlighted at build time
- const site: SiteConfig = { name: 'sitekit', url: 'https://example.com' };
- \`\`\`
- > [!NOTE]
- > A callout, written as GitHub writes it.
- | Option | Default | What it does |
- | --- | --- | --- |
- | \`--port\` | \`5173\` | Where the dev server listens. |
- | \`--open\` | off | Opens the browser once it is up. |
- `;
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.