What this thread does
Do first: Lower a subagent's effort, give Haiku 5.5 its own /autocompact 100k window, and set CLAUDE_AUTOCOMPACT_PCT_OVERRIDE to compact earlier; check what fills context with /context and /usage (checked 2026-11-03; documented in the Claude Code docs, untested here). As of November 2026.
Anthropic's 2.1.312 notes let subagent autoCompactWindow lower, never raise, CLAUDE_CODE_AUTO_COMPACT_WINDOW, and 2.1.317 makes subagents and teammates on a different model use that model's saved or default effort instead of the session's (checked 2026-11-05).
Three levers
@lydiahallie (Anthropic) posted the first two in early October 2026; the third is from the environment variable reference.
1. Effort per subagent
- Set
effortin a subagent's frontmatter (low,medium,high,xhigh,max, depending on the model). - Or just ask Claude to run a subagent at a given level: since Claude Code v2.1.292 the Agent tool takes an
effortparameter for that one invocation. It overrides the frontmatter and survives a resume. CLAUDE_CODE_EFFORT_LEVELin the environment overrides both, so unset it if your per-subagent levels seem ignored./tasksshows each subagent's model and effort.- Claude Code v2.1.316 (31 October 2026) adds
CLAUDE_CODE_SUBAGENT_EFFORTas a fallback when no effort is named for the subagent, instead of inheriting the parent session's effort. It is not a force-override. This addresses the use case in Emrebener's request #79135 (19 July), with crisnahine's cost report (29 August); that report predates the new setting. Untested here.
Opus 5.5, Sonnet 5.5 and Haiku 5.5 default to medium. Searches, file reads and log digging rarely need more; reviews of tricky logic may need high.
2. A 100K auto-compact window for Haiku 5.5
Anthropic's pricing charges Haiku 5.5 per request by prompt length (cache reads and writes count):
| Haiku 5.5 | Input | Output |
|---|---|---|
| Prompt up to 100,000 tokens | $0.10 / MTok | $0.50 / MTok |
| Prompt over 100,000 tokens | $0.50 / MTok | $2.50 / MTok |
Haiku 5.5 runs with a 1M window and by default auto-compacts only at about 967K tokens. The tip: switch to Haiku and set its own window.
/model haiku
/autocompact 100k
Since v2.1.288, /autocompact saves the window per model under modelSettings in your user settings, so this applies to Haiku only; the tip says it includes Haiku subagents. For one subagent, put autoCompactWindow: 100000 in its frontmatter (v2.1.296+; write a plain integer, 100k is read as 100). CLAUDE_CODE_AUTO_COMPACT_WINDOW sets the global window; from 2.1.312 a subagent's autoCompactWindow can lower it, but cannot raise it (release notes).
3. Compact earlier by percentage
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE takes a number from 1 to 100: the percentage of the auto-compact window at which auto-compaction triggers. Launch with CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=50 claude to compact at about half the window. Per the environment variables reference (Anthropic): "Use lower values like 50 to compact earlier". It can only lower the threshold, so values above the default percentage are ignored (the page does not state the default). It applies only in sessions that compact before the model's context limit, and to main conversations and subagents alike.
Window versus percentage: /autocompact <size> and CLAUDE_CODE_AUTO_COMPACT_WINDOW set an absolute token window (100K to 1M); the percentage is a fraction of whichever window is in effect. The model configuration page says the window variable takes precedence over /autocompact, --autocompact and autoCompactWindow.
See what fills context before tuning
/contextlists everything in the window by category: system prompt, tools, MCP tools, subagents, memory files, skills and messages (Debug your configuration)./usageshows the session's token usage by model; on Pro, Max, Ultra, Team and Enterprise it also attributes recent usage to skills, subagents, plugins and MCP servers, with recommendations (Manage costs). On a subscription the dollar figure is not your bill.- The costs page also suggests
/clearbetween unrelated tasks,/compactwith a focus such as "code samples and API usage", and keeping CLAUDE.md under 200 lines. A subagent's own requests still draw on your usage.
No user reports of the percentage variable beyond these docs; whether it changes Haiku's roughly 967K default is untested.
Caveats
- This is about API billing. On a subscription you don't pay per token, though usage limits still apply.
- Compaction itself costs a summarization request and drops detail. A subagent that needs a long context may do worse when compacted at 100K.
- A single big tool result can still push one request over 100K before compaction triggers.
- Lower effort can mean more mistakes and retries, which costs tokens too. Measure on your own tasks.
Questions for reports
- What effort level do you give search or exploration subagents, and did quality hold?
- After capping Haiku at 100K, how did the share of over-100K requests change in your Console usage?
Related
- The thread on one-hour prompt caching for subagents (
subagentPromptCacheTtl) covers another subagent cost setting. - The thread on advisor, opusplan and subagent models covers which model runs where.
Sources
Claude Code docs Subagents, Model configuration, Environment variables, Debug your configuration, Manage costs and the Claude API Pricing page (all checked 2026-11-03), plus the two linked posts by @lydiahallie (2026-10-07).
- The docs state: the
effortfrontmatter field and its five levels; the Agent tooleffortparameter (needs v2.1.292, overrides the frontmatter, kept on resume, non-fork subagents only);CLAUDE_CODE_EFFORT_LEVELtaking precedence over both;autoCompactWindowin subagent frontmatter (100000 to 1000000, v2.1.296+, plain integer because200kis read as 200, and, before 2.1.312,CLAUDE_CODE_AUTO_COMPACT_WINDOWmade it a no-op);/autocompactsaving per model undermodelSettingssince v2.1.288; Haiku 5.5 auto-compacting at about 967K by default; medium as the default effort for Opus 5.5, Sonnet 5.5 and Haiku 5.5; the Haiku 5.5 price tiers at the 100,000-token prompt threshold, counting cache reads and writes;/tasksshowing each subagent's model and effort. - The Haiku window tip, including that it covers Haiku subagents, rests on the post; the docs describe the per-model setting but do not mention subagents there.
Not for: reporting where tokens and money went across sessions; see ccusage-token-cost-report.
checked 2026-11-03
Started from a post by @lydiahallie, packaged by the editor. Original post