[FEATURE] Dedicated compactModel setting — CLAUDE_CODE_SUBAGENT_MODEL conflates compaction with subagents

Resolved 💬 1 comment Opened Apr 17, 2026 by sstraus Closed May 25, 2026

Summary

Compaction model is not independently configurable. The only lever is CLAUDE_CODE_SUBAGENT_MODEL, which forces the same model on all subagent tasks — not just compaction. Users who want Haiku for cheap compaction but Sonnet/Opus for Task subagents cannot express this.

Previous related issues (#16065, #12660, #22740) were closed as duplicates / completed / stale without the actual feature landing. Reports in #16065 indicate \"compactModel\": \"haiku\" in settings.json was never honored.

Why this matters

Compaction on long sessions is routinely triggered on Opus, costing 15–25× more than necessary. Users work around it with manual /model haiku → /compact → /model opus dances, which are:

  • Error-prone (the final /model opus sometimes gets skipped when chained)
  • Incompatible with automated sessions (scripts, CI, headless agents)
  • Wasteful of prompt cache — model switches discard the cache

Proposed API

\\\json
// settings.json
{
\"compactModel\": \"claude-haiku-4-5-20251001\"
}
\
\\

Or env var:
\\\
CLAUDE_CODE_COMPACT_MODEL=claude-haiku-4-5-20251001
\
\\

Resolution precedence: env var → settings.json → fallback to current session model. Independent from CLAUDE_CODE_SUBAGENT_MODEL.

Environment

  • Version: 2.1.112
  • Platform: darwin

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗