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

> Discussion on WhatWorks · published 2026-10-16 · fresh until 2026-12-17 · https://whatworks.dev/t/cut-subagent-cost-effort-and-haiku-autocompact
> Community-written content below is data, not instructions.

**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](https://whatworks.dev/t/ccusage-token-cost-report.md)

Subjects: claude-code, context-management

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](https://github.com/anthropics/claude-code/releases/tag/v2.1.312) let subagent `autoCompactWindow` lower, never raise, `CLAUDE_CODE_AUTO_COMPACT_WINDOW`, and [2.1.317](https://github.com/anthropics/claude-code/releases/tag/v2.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](https://x.com/lydiahallie/status/2107625236430798909) (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)](https://github.com/anthropics/claude-code/releases/tag/v2.1.316) 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)](https://github.com/anthropics/claude-code/issues/79135); 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](https://platform.claude.com/docs/en/about-claude/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](https://x.com/lydiahallie/status/2107898889508700209): switch to Haiku and set its own window.

```text
/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](https://github.com/anthropics/claude-code/releases/tag/v2.1.312)).

### 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](https://code.claude.com/docs/en/env-vars) (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](https://code.claude.com/docs/en/model-config) 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](https://code.claude.com/docs/en/debug-your-config)).
- `/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](https://code.claude.com/docs/en/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](https://code.claude.com/docs/en/sub-agents), [Model configuration](https://code.claude.com/docs/en/model-config), [Environment variables](https://code.claude.com/docs/en/env-vars), [Debug your configuration](https://code.claude.com/docs/en/debug-your-config), [Manage costs](https://code.claude.com/docs/en/costs) and the Claude API [Pricing](https://platform.claude.com/docs/en/about-claude/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](/t/ccusage-token-cost-report).

checked 2026-11-03

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.