The audit

38 checks of your Claude Code settings against Claude Code's current docs, each finding linked to the page it rests on. The audit only reads; a fix is written only when you apply it.

Run it

/tokendoctor:audit lists the findings by severity, then reads your memory and CLAUDE.md, then shows the usage dashboard. From a shell:

Shell
tokendoctor-audit [--project <dir>] [--json]

A finding that has a fix is applied with /tokendoctor fix <finding-id>, /tokendoctor:apply <finding-id> or tokendoctor-apply, which shows a dry run first:

Shell
$ tokendoctor-apply compact-window-unset
Would change (user): ~/.claude/settings.json
- {}
+ {
+   "autoCompactWindow": 400000
+ }
Dry run. Re-run with --write to apply.

An existing file is copied to <file>.tokendoctor-<timestamp>.bak before it is written, and undo puts the change back.

The 38 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.

FindingSeverityWhat it catches
settings-unreadableerrorA settings file that exists but is not valid JSON, so nothing in it applies.
compact-threshold-undocumentederrorautoCompactThreshold is not a Claude Code setting; the real key is autoCompactWindow. Fix removes it.
compact-env-bare-numbererrorCLAUDE_CODE_AUTO_COMPACT_WINDOW below 100,000 (a bare number is tokens, not thousands).
compact-window-unsetwarnModels with a native 1M window compact only near 967K by default. Fix sets 400,000.
compact-window-smallwarnA window so small that frequent compaction breaks the prompt cache.
prompt-caching-disabledwarnA DISABLE_PROMPT_CACHING* variable is set.
subagent-model-forcewarnEvery subagent, including reasoning ones, is forced onto one model.
effort-max-in-settingswarneffortLevel: "max" is not accepted in settings. Fix uses xhigh.
advisor-inactivewarnAn advisor that will silently not run (telemetry or feature-flag fetching off, advisor below the main model, tool disabled).
fast-mode-enabledwarnfastMode: true saved as a default, so every session pays the higher fast-mode rate. Fix sets fastModePerSessionOptIn.
auto-compact-offwarnDISABLE_AUTO_COMPACT or autoCompactEnabled: false: history grows until the model window fills. Fix unsets the setting.
tool-search-offwarn/infoENABLE_TOOL_SEARCH=false loads every MCP tool definition into every request.
explore-default-modelinfoThe built-in Explore agent runs on Opus on many accounts. Fix installs a Haiku, read-only override.
subagent-model-unsetinfoGeneral-purpose subagents inherit an expensive main model. Fix sets CLAUDE_CODE_SUBAGENT_MODEL=sonnet.
main-model-expensiveinfoOpus or Fable as the default; suggests Sonnet.
agents-inherit-modelinfoCustom agents with no model run on the main model.
heavy-dirs-not-deniedinfoLarge target/, dist/, build/, coverage/, .turbo/ directories not excluded from reads. Fix adds permissions.deny rules.
large-lockfile-readableinfoLockfiles over 200 KB that a model can open in full. Fix adds a deny rule.
instructions-longinfoCLAUDE.md plus its @imports over 200 lines. Path-scoped .claude/rules and skills cut the cost; imports do not.
compact-instructions-missinginfoNo # Compact instructions section to steer summaries.
context-surfaceinfoMany skills, plugins or MCP servers loaded in every session.
duplicate-skillsinfoThe same skill at user and project level.
thinking-tokens-envinfoMAX_THINKING_TOKENS is ignored on adaptive-reasoning models.
prompt-cache-ttl-forced-shortinfoFORCE_PROMPT_CACHING_5M removes the one-hour cache some plans get.
agent-teams-enabledinfoAgent teams multiply token use per teammate.
mcp-output-limit-raisedinfoA raised MAX_MCP_OUTPUT_TOKENS.
every-tool-hooksinfoHooks 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-offinfoidleCompaction: false: a long conversation is not compacted before its one-hour cache expires. Fix unsets it.
bash-output-raisedinfobashOutputMaxChars or BASH_MAX_OUTPUT_LENGTH above the 30,000 default.
code-intelligence-missinginfoThe project has files for a language with an official language-server plugin (typescript-lsp, pyright-lsp, gopls-lsp, …) and it is not enabled.
settings-key-undocumentedwarnA settings key that is not in today's settings reference: misspelled or removed, so it does nothing.
env-undocumentedinfoA CLAUDE_…/ANTHROPIC_…-style variable under env that today's docs do not list.
setting-needs-newer-versionwarnA key or variable the docs say needs a newer Claude Code than the one installed.
slide-blocked-by-guardwarnThe 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.
compact-pct-overrideinfo/warn/errorCLAUDE_AUTOCOMPACT_PCT_OVERRIDE: where it puts the compaction point; a warning below 50%, an error when it is not a percent.
skill-model-switchinfoA skill whose frontmatter names another model: each use reads the conversation uncached on that model. context: fork avoids it.
opusplan-cacheinfoopusplan switches models, and so caches, on every plan-mode toggle.
no-statuslineinfoNo status line. Fix installs tokendoctor-statusline.sh and points statusLine at it (needs jq).

The status line

The no-statusline fix installs one quiet line:

Plain text
Opus 5.5 · api main* · 120k/367k · 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/claude-code-playground as an alternative (needs Claude Code 2.1.287+, shared as-is).

Agents and files the fixes install

templates/statusline.sh is the status line script the fix installs into your Claude config folder. templates/agents/ holds three generic subagents (Explore, test-runner, docs-lookup), each pinned to a small model with read-only or narrow tools. A plugin cannot override a built-in agent or ship settings.json keys such as autoCompactWindow, env or permissions, so the apply step copies the template into ~/.claude/agents/ or .claude/agents/ and edits your settings files itself, with a backup.

Checked against today's docs

Claude Code changes every few days, so the audit does not trust a list frozen into the plugin. It reads the current settings reference and environment variable list from code.claude.com, as Markdown (every docs page is served at …/docs/en/<page>.md, indexed for models at llms.txt). They are cached a day in ~/.claude/tokendoctor/docs; --offline uses the cache only. Only those public pages are fetched; nothing is sent.

From them it flags settings keys Claude Code does not document (settings-key-undocumented: a misspelled or removed key does nothing), variables of Claude Code's own families it does not know (env-undocumented), and keys that need a newer release than yours (setting-needs-newer-version). The /tokendoctor:audit and /tokendoctor:optimize skills read a finding's doc page before they explain or recommend it.

What really loaded

The audit reads a claude --debug log of the last day, if you have one, and tokendoctor-selfcheck makes one: one claude -p request on Haiku with no saved session, or --log <file> to read one you have, at no cost. It shows:

  • which copy of tokendoctor loaded, and in which tier;
  • whether Claude Code's built-in guard was seated, and the order of the mods on compaction;
  • hooks that were skipped;
  • the window Claude Code really compacts at;
  • a skill listing over its budget (descriptions cut short).
Shell
tokendoctor-selfcheck [--log <file>] [--json]