agentleFS
localixailocalixai/tokendoctor/AGENTS.md

tokendoctor

AGENTS.md71 starsChanged 3 days agoMITView on GitHub

A Claude Code plugin from Localix Lab: it shows what a person's Claude Code use overpays, fixes it with a diff they approve, and puts any change back. Everything runs on their machine; the plugin sends nothing anywhere. GitHub localixai/tokendoctor, site https://tokendoctor.dev. The site has its own commands in site/ (npm run check before a push that touches it). - Numbers come from measurement. Every figure on the README and the site is from a real run (bench/, or tokendoctor-replay…

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.

    Of the AGENTS.md files we read, the 31,439 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repository8 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Numbers come from measurement: Every figure on the README and the site is from a real run (bench/, or tokendoctor-replay over real …

    line 37
  2. Very specific:

    Few model runs, never in bulk: No loops of model evaluations to tune a rule: read transcripts deterministically.

    line 47
  3. Very specific:

    Nothing leaves the machine: No telemetry, no network call except Claude Code's docs for the audit (a day's cache).

    line 53

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

tokendoctor

A Claude Code plugin from Localix Lab: it shows what a person's Claude Code use overpays, fixes it with a diff they approve, and puts any change back. Everything runs on their machine; the plugin sends nothing anywhere. GitHub localixai/tokendoctor, site https://tokendoctor.dev.

Layout

PathWhat it is
.claude-plugin/plugin.json (the plugin), marketplace.json (this repo is its own marketplace), the icon
skills/The slash commands: sessions, optimize, audit, apply, dashboard
bin/tokendoctor-* commands the skills and hooks call; each is a thin entry into lib/
lib/Everything that counts and decides: transcripts, replay, rules, the audit's docs, apply, undo
hooks/The hooks module (register.ts) and the slide (window.ts)
templates/The dashboard page, the status line, agent files the advice can write
test/Node tests for lib/ and bin/ (npm test)
tests/The hooks module's tests (npm run test:mod, through claude plugin test)
bench/The benchmark: real Claude Code on fixed tasks, scored by acceptance tests
site/tokendoctor.dev
llx/Not this repository: an ignored clone of another one, kept beside the work

Commands

Command
npm testlib/ and bin/. Run it before every push; CI runs it on Node 20 and 22.
npm run test:modThe hooks module, on a copy of the plugin without bench/tasks. Needs claude.
npm run docs:checkEvery settings key and variable tokendoctor names, against Claude Code's current docs. Network.
npm run validateclaude plugin validate . --strict: the manifests, and the hooks module and tests/ type-checked against the running Claude Code's types. Passes; keep it so (import a plugin file without its .ts suffix, and build the engine's values in full, as tests/register.test.ts's helpers do).
claude --plugin-dir .Try the working tree in a real session without installing it.

The site has its own commands in site/ (npm run check before a push that touches it).

Rules

  • Numbers come from measurement. Every figure on the README and the site is from a real run (bench/, or tokendoctor-replay over real sessions), and the README's table says which. Change a number only with the run that supports it. The headline is "up to 38% less"; the same words are in package.json, .claude-plugin/plugin.json, marketplace.json, the README and the site.
  • Every benchmark run is recorded, stopped and failed ones too: keep bench/results/<run>/run.json (with a note on what was stopped and why), then regenerate bench/HISTORY.md (bun bench/run.ts --history). Never delete a result folder.
  • The baselines are fixed. Claude Code without tokendoctor is measured once, in bench/baselines.json. run.ts runs only tokendoctor's arm by default; run --arm factory or --arm advised again only when Claude Code or the model changes, and only when asked.
  • Few model runs, never in bulk. No loops of model evaluations to tune a rule: read transcripts deterministically. At most 3 claude -p at once, with --strict-mcp-config --no-session-persistence (ten at once froze a 24 GB laptop). Ask before a run that starts Claude processes.
  • The demo is a real recording of a real session with real data, made with asciinema (site/scripts/RECORDING.md). Never stage one. Check the cast for private data before it ships.
  • Nothing leaves the machine. No telemetry, no network call except Claude Code's docs for the audit (a day's cache). A transcript's paths and account details stay out of the repo (bench/results/*/*/ is ignored for that reason).
  • Every change can be put back. Whatever apply writes, undo lists and restores; a new kind of change ships with its undo and a test of both.
  • Claude Code's names are checked, not remembered. A settings key or variable the audit names goes through npm run docs:check before release.

Releasing

Bump version in package.json and .claude-plugin/plugin.json together, move the changelog's Unreleased under the version, commit "release x.y.z: ...", tag vx.y.z and push. A person updates with claude plugin marketplace update tokendoctor.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.