Introduce a dedicated compactModel setting to allow independent configuration of the model used for compaction. Currently, the CLAUDE_CODE_SUBAGENT_MODEL setting conflates compaction with subagent tasks, preventing users from optimizing costs by using different models (e.g., Haiku for compaction, Sonnet/Opus for subagents).
## 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\"