Skip to content

More Claude Code trims: prompt, tools, output caps and background calls #98

Closed

Description

@m4rocks

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 (or CLAUDE_CODE_DISABLE_GIT_INSTRUCTIONS): drops the git section from the system prompt. May affect sessions that commit or open pull requests.
  • autoMemoryEnabled (or CLAUDE_CODE_DISABLE_AUTO_MEMORY): drops the memory instructions.
  • CLAUDE_CODE_DISABLE_CLAUDE_API_SKILL and CLAUDE_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 to off or user-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 remove Monitor (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_MEMORY and CLAUDE_CODE_DISABLE_POLICY_SKILLS: a "bare session" option that skips instruction files.

Output and thinking caps

  • BASH_MAX_OUTPUT_LENGTH, MAX_MCP_OUTPUT_TOKENS and CLAUDE_CODE_FILE_READ_MAX_OUTPUT_TOKENS cap Bash output, MCP results and file reads without a hook.
  • MAX_THINKING_TOKENS, CLAUDE_CODE_MAX_OUTPUT_TOKENS, CLAUDE_CODE_DISABLE_THINKING and CLAUDE_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

  • promptSuggestionEnabled and CLAUDE_CODE_DISABLE_AGENT_PROGRESS_SUMMARIES look like model calls the user never sees. A "background calls" group would turn them off.

Context window

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_OFF entry 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

  • autoMemoryEnabled and CLAUDE_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_TOKENS and CLAUDE_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_TOKENS changed nothing in /context, and autoCompactWindow only 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, and CLAUDE_CODE_TOTAL_TOKENS_REMINDER changed nothing, so the detector leaves both out. fastMode was not measured.
  • CLAUDE_CODE_DISABLE_CLAUDE_MDS shrinks 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

  1. m4rocks commented on Nov 7, 2026

    @m4rocks
    OwnerAuthor

    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 tokens
    • CLAUDE_CODE_DISABLE_BACKGROUND_TASKS: 411 fewer
    • includeGitInstructions: false: 363 fewer
    • CLAUDE_CODE_DISABLE_EXPLORE_PLAN_AGENTS: 333 fewer
    • CLAUDE_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 setup

    No change here, so not built until shown otherwise:

    • autoMemoryEnabled: false and CLAUDE_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=false made /context go 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.

  2. m4rocks commented on Nov 7, 2026

    @m4rocks
    OwnerAuthor

    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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions