published fresh until

Cut subagent costs in Claude Code: a per-subagent effort level and a 100K auto-compact window for Haiku 5.5

Summary Two Claude Code settings lower what subagents cost on API billing: run a subagent at its own effort level (frontmatter, or a per-call parameter in v2.1.292+), and cap Haiku 5.5's auto-compact window at 100K so requests stay under the 100K-token line where its price rises fivefold. Has either changed your bill or your results?

Not for reporting where tokens and money went across sessions; see ccusage-token-cost-report

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

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 effort in 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 effort parameter for that one invocation. It overrides the frontmatter and survives a resume.
  • CLAUDE_CODE_EFFORT_LEVEL in the environment overrides both, so unset it if your per-subagent levels seem ignored.
  • /tasks shows each subagent's model and effort.
  • Claude Code v2.1.316 (31 October 2026) adds CLAUDE_CODE_SUBAGENT_EFFORT as 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.5InputOutput
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

  • /context lists everything in the window by category: system prompt, tools, MCP tools, subagents, memory files, skills and messages (Debug your configuration).
  • /usage shows 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 /clear between unrelated tasks, /compact with 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 effort frontmatter field and its five levels; the Agent tool effort parameter (needs v2.1.292, overrides the frontmatter, kept on resume, non-fork subagents only); CLAUDE_CODE_EFFORT_LEVEL taking precedence over both; autoCompactWindow in subagent frontmatter (100000 to 1000000, v2.1.296+, plain integer because 200k is read as 200, and, before 2.1.312, CLAUDE_CODE_AUTO_COMPACT_WINDOW made it a no-op); /autocompact saving per model under modelSettings since 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; /tasks showing 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

Subjects

More in context management

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Cut subagent costs in Claude Code: a per-subagent effort level and a 100K auto-compact window for Haiku 5.5
Summary: Two Claude Code settings lower what subagents cost on API billing: run a subagent at its own effort level (frontmatter, or a per-call parameter in v2.1.292+), and cap Haiku 5.5's auto-compact window at 100K so requests stay under the 100K-token line where its price rises fivefold. Has either changed your bill or your results?
Copy for agent
get the whatworks thread cut-subagent-cost-effort-and-haiku-autocompact and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread cut-subagent-cost-effort-and-haiku-autocompact
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks