Repository navigation
Description
Extends #70 (Trim Claude Code's tools). That issue trims 15 tools and features. A scan of the installed Claude Code 2.1.319 binary for settings keys and environment variables found more that look like they cut tokens. Every name below comes from strings in the binary. None of their behavior is verified yet, so each one needs the same /context check as #70, and #70's manual checks were done on 2.1.310.
Prompt and tool trims
Same mechanism as #70: a switch per item, nothing trimmed by default, applied to the sessions Claudiu starts without editing the user's Claude Code config.
includeGitInstructions(orCLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS): drops the git section from the system prompt. May affect sessions that commit or open pull requests.autoMemoryEnabled(orCLAUDE_CODE_DISABLE_AUTO_MEMORY): drops the memory instructions.CLAUDE_CODE_DISABLE_CLAUDE_API_SKILLandCLAUDE_CODE_DISABLE_CLAUDE_CODE_SKILL: remove single bundled skills. "Bundled skills" in Trim Claude Code's tools #70 is all or nothing.skillOverrides: set any skill toofforuser-invocable-only. Needs a list of the user's skills with one switch each.CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS: removes the Explore and Plan agent types from the Agent tool description.CLAUDE_CODE_DISABLE_ADVISOR_TOOL: removes the advisor tool. Overlaps the advisor default in Settings: defaults for Claude in Chrome, advisor and auto-compact #63.CLAUDE_CODE_DISABLE_BACKGROUND_TASKS: may removeMonitor(about 1,942 tokens in the article Trim Claude Code's tools #70 cites, which names no switch for it).ENABLE_TOOL_SEARCH: loads tool schemas only when needed. Matters most with many MCP servers.CLAUDE_CODE_DISABLE_CFC_PROMPT: removes the Claude in Chrome prompt. Overlaps the Chrome default in Settings: defaults for Claude in Chrome, advisor and auto-compact #63.CLAUDE_CODE_DISABLE_CLAUDE_MDS,CLAUDE_CODE_DISABLE_ORG_MEMORYandCLAUDE_CODE_DISABLE_POLICY_SKILLS: a "bare session" option that skips instruction files.
Output and thinking caps
BASH_MAX_OUTPUT_LENGTH,MAX_MCP_OUTPUT_TOKENSandCLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENScap Bash output, MCP results and file reads without a hook.MAX_THINKING_TOKENS,CLAUDE_CODE_MAX_OUTPUT_TOKENS,CLAUDE_CODE_DISABLE_THINKINGandCLAUDE_CODE_DISABLE_ADAPTIVE_THINKING. Effort is already in New-session defaults: model, effort, permission mode #71, so this would be a cap on top of it.
Background model calls
promptSuggestionEnabledandCLAUDE_CODE_DISABLE_AGENT_PROGRESS_SUMMARIESlook like model calls the user never sees. A "background calls" group would turn them off.
Context window
autoCompactWindow,CLAUDE_CODE_MAX_CONTEXT_TOKENSandCLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS. A smaller window makes compaction fire earlier, which costs one cache rewrite. Related to idle compaction in Context levers #44 and the auto-compact defaults in Settings: defaults for Claude in Chrome, advisor and auto-compact #63.
Detect settings that raise cost
Warn when the user's environment turns on something that increases cost: any DISABLE_PROMPT_CACHING* variable, CLAUDE_CODE_ENABLE_TOKEN_USAGE_ATTACHMENT, CLAUDE_CODE_TOTAL_TOKENS_REMINDER or fastMode. These are easy to set once and forget.
Decisions
- Build the prompt and tool trims first. The other groups follow.
- The cost-raising detector stays in this issue.
- A trim gets a
CLAUDIU_TOOLS_OFFentry only when Claudiu's own MCP instructions name the trimmed tool, so they never point at something that is gone.
Checklist
- Each name above is checked against Claude Code 2.1.319 and the result is recorded in the measurement comment and below
- Each prompt or tool trim that shrank a request has a switch on the Claude Code tools page, off by default: git instructions, Claude API skill, Explore and Plan agents, advisor tool, background tasks
- The git instructions trim is tested with a session that commits and opens a pull request (manual check, not done)
- Skills can be turned off from a text field on the page. It is a text field, not a list, because Claudiu does not have the built-in skill names to list
- The Bash output cap and the file read cap have settings that leave Claude Code unchanged when empty
- The cost-raising detector shows each setting it found and where it came from
- Unit tests for the settings builder cover every new key
- The page is checked by opening Settings in the running app (not done)
- README lists the new switches (the README does not list the earlier Trim Claude Code's tools #70 switches either)
Measured and not built
autoMemoryEnabledandCLAUDE_CODE_DISABLE_AUTO_MEMORY: no change in a repo without memory files.CLAUDE_CODE_DISABLE_CLAUDE_CODE_SKILL,CLAUDE_CODE_DISABLE_ORG_MEMORY,CLAUDE_CODE_DISABLE_POLICY_SKILLS,CLAUDE_CODE_DISABLE_CFC_PROMPT: no change.- Thinking limits (
MAX_THINKING_TOKENS,CLAUDE_CODE_DISABLE_THINKING): output tokens were the same on a simple prompt, so no effect was shown. MAX_MCP_OUTPUT_TOKENSandCLAUDE_CODE_MAX_OUTPUT_TOKENS: no cheap test, so no effect was shown.- Context window (
autoCompactWindow,CLAUDE_CODE_MAX_CONTEXT_TOKENS,CLAUDE_CODE_IDLE_COMPACT_MIN_TOKENS):CLAUDE_CODE_MAX_CONTEXT_TOKENSchanged nothing in/context, andautoCompactWindowonly moved the window size, so neither is a saving. - Background calls (
promptSuggestionEnabled,CLAUDE_CODE_DISABLE_AGENT_PROGRESS_SUMMARIES): headless runs make no such calls, so there was nothing to count. CLAUDE_CODE_ENABLE_TOKEN_USAGE_ATTACHMENT: added 19 tokens, andCLAUDE_CODE_TOTAL_TOKENS_REMINDERchanged nothing, so the detector leaves both out.fastModewas not measured.CLAUDE_CODE_DISABLE_CLAUDE_MDSshrinks the request but would also drop every project's CLAUDE.md as a global switch. A per-session "bare session" option is the better fit and needs its own decision.
Measured savings built
- Bash output cap of 2,000 characters: about 6,800 fewer tokens on a 3,000-line result.
- File read cap of 2,000 tokens: about 19,000 fewer on a 4,000-line file.
- Three skills off: 1,200 fewer tokens in the skills listing.
Activity
m4rocks commentedon Nov 7, 2026
Measured on Claude Code 2.1.319 in an empty scratch git repo. Method: a tiny Haiku call (
claude -p ... --output-format json), summing input, cache-creation and cache-read tokens of the first request. The baseline was 18,086 tokens on two runs, so the numbers are repeatable. The skill rows come from/context, which reports no model call and rounds to 0.1k.Smaller first request:
CLAUDE_CODE_DISABLE_ADVISOR_TOOL: 1,358 fewer tokensCLAUDE_CODE_DISABLE_BACKGROUND_TASKS: 411 fewerincludeGitInstructions: false: 363 fewerCLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS: 333 fewerCLAUDE_CODE_DISABLE_CLAUDE_API_SKILL: about 300 fewer (skills row in/context)CLAUDE_CODE_DISABLE_CLAUDE_MDS: removes the user CLAUDE.md, 156 tokens in this setupNo change here, so not built until shown otherwise:
autoMemoryEnabled: falseandCLAUDE_CODE_DISABLE_AUTO_MEMORY. The scratch repo had no memory files, so this test says nothing yet.CLAUDE_CODE_DISABLE_CLAUDE_CODE_SKILL,CLAUDE_CODE_DISABLE_ORG_MEMORY,CLAUDE_CODE_DISABLE_POLICY_SKILLS. No org or policy content exists on this account.CLAUDE_CODE_DISABLE_CFC_PROMPT. Chrome was not enabled in the scratch session.ENABLE_TOOL_SEARCH=falsemade/contextgo from 8.3k to 16.7k tokens. Tool search is on by default, so turning it off raises cost. It moves to the cost-raising detector and gets no trim switch.More Claude Code trims: five prompt trims, output caps, skill switche…
m4rocks commentedon Nov 7, 2026
Shipped in #99, released as v0.8.4.
Measured on Claude Code 2.1.319: the nine trims that save tokens cut a first request from 34.3k to 13.0k tokens, and every run of a 7-file task still passed all 30 hidden tests. Each switch on the Claude Code tools page shows high, medium or low savings, and the setup window offers six recommended trims.
Output caps are not built. Every capped run used more tokens, because Claude re-read the cut-off output in smaller calls (30 tool calls instead of 14 with a 10,000-character Bash cap).