| name | reduce-tokens |
| description | Audit the Claude Code request payload and cut per-turn token cost by removing tools, MCP connectors, and skills the user doesn't use — applied via settings.json (deny rules + disable flags + skillOverrides). Use when the user says "reduce tokens", "cut token usage / my bill", "trim the context / payload / system prompt", "requests are too big or expensive", "we don't use these MCPs/skills/tools", or types /reduce-tokens. Scans the current conversation and past session transcripts to find what's unused before cutting. |
reduce-tokens
Every Claude Code request ships the same fixed prelude on every turn: all tool schemas, all proactively-loaded skill descriptions, the system prompt, and any connected MCP servers. On a Sonnet session with a full toolset this is ~40k tokens of tools alone before the model reaches the user's problem. This skill measures that prelude, finds what the user never uses, and removes it via settings.json — so the tokens stop being sent.
Mental model: you are trimming the payload, not disabling capability. A tool removed by a bare-name deny rule is gone from the schema Claude sees, but disableBundledSkills and user-invocable-only leave slash commands still typable. Cut proactive weight; keep on-demand access.
Run the five steps in order. Steps 1–2 are mechanical (bulk log reads, tallies) — delegate them to a Sonnet worker per the plan-big/execute-small rule; keep the judgment (steps 3–5) in the main loop.
Step 1 — Measure the baseline
Get the current payload breakdown two ways; use whichever is available:
/context (ask the user to run it and paste, or read from the conversation if already shown). Gives category totals: System tools, Skills, System prompt, Memory. This is the fast before/after number.
- The bundled proxy (
proxy.mjs in this skill dir) for a per-tool byte ranking — the exact cut list. Copy it somewhere writable, then:
ANTHROPIC_BASE_URL=http://localhost:8787 claude in another shell, fire one message, and read the newest logs/*.md — its <audit> block ranks every tool by bytes. Only needed when the user wants precise per-tool numbers; /context categories are usually enough to decide.
Record the starting numbers so you can report the delta at the end.
Step 2 — Scan actual usage (delegate to a Sonnet worker)
The point of this skill is cutting what the user doesn't use — so find out. Have a Sonnet worker tally tool/skill/MCP invocations across recent sessions:
- Session transcripts:
~/.claude/projects/<encoded-cwd>/*.jsonl (the cwd with /,:,. → -). Also scan sibling project dirs if the settings edit is global.
- Extract invoked names:
grep -hoE '"name":"[A-Za-z0-9_]+"' <files> | sort | uniq -c | sort -rn. MCP tools show as mcp__server__tool; skills show as Skill calls (inspect their input for the skill name).
- Also read the current conversation for what's been used this session.
Worker returns: a frequency table of every tool/skill/MCP actually invoked, and — cross-referenced against the removable catalog in reference.md — the set that appears zero times. Zero-use items are cut candidates; frequently-used ones are keeps. Usage data beats guessing.
Step 3 — Decide what to cut
Read reference.md for the full removable catalog, the load-bearing keep-list (never cut these), and the confirm-first list. Rules:
- Never deny a load-bearing tool (Bash/PowerShell, Read/Edit/Write/Glob/Grep, Skill, Agent, the Task* family, EnterWorktree/ExitWorktree). Cutting these breaks the harness.
- Cut anything in the removable catalog with zero usage in the scan.
- For functional-impact items (browser-preview tools, code-review's ReportFindings, plan mode, SendMessage for continuing background agents, WebFetch/WebSearch) — confirm with the user before cutting, naming what they lose. Don't silently remove a capability they rely on.
- Respect the repo: an engine/library repo has different needs than an app repo. Let the project's CLAUDE.md and the usage scan drive it, not a fixed list.
AskUserQuestion may itself be a cut target — if you plan to deny it, ask any confirmation questions in plain text first.
Step 4 — Apply to settings.json
Global cuts go in ~/.claude/settings.json; project-specific ones in .claude/settings.json. Token reduction is usually global. Merge into existing keys — never clobber hooks or other settings.
Mechanics (detail in reference.md):
- Deny individual tools with bare names in
permissions.deny — "NotebookEdit" removes the schema; a scoped rule like "Bash(rm *)" only blocks the call and keeps the schema in the payload. Use bare names to shrink.
- Whole-feature flags:
enableWorkflows: false (drops the large Workflow tool), disableClaudeAiConnectors: true (drops claude.ai MCP connectors — chrome, computer-use, preview, visualize, registry), disableBundledSkills: true (drops the whole Anthropic skill catalog; slash commands stay typable), disableArtifact: true.
- Skills, one at a time:
skillOverrides: { "<name>": "off" } (gone from payload) or "user-invocable-only" (typable, not proactively loaded). Use this to keep a few bundled skills when disableBundledSkills is too broad.
Validate after editing: node -e "require(require('os').homedir()+'/.claude/settings.json')" must parse.
Step 5 — Verify & report
Settings load at startup — the user must restart Claude Code, then run /context to confirm the lower totals (optionally re-run the proxy for the exact per-tool after-number). Report the delta in one line per category (before → after) and note that every dropped skill/feature is still reachable on demand. Tell the user how to reverse any single cut (flip "off" → "user-invocable-only", or remove the deny line).
Notes
- Deferral vs. loading: newer/Opus sessions defer many tools (schemas load only via ToolSearch, ~free until used); a Sonnet session often loads everything inline. Measure on the model the user actually runs — deny rules remove a tool in both modes, so they're the robust fix regardless.
- The settings file getting longer costs nothing — only the tools/skills it removes affect the payload.