What
Compaction is when Claude Code shortens the conversation so it fits in the model's working memory (the context window). The autoCompactWindow setting controls how full that memory gets before this happens.
- A per-model value is looked up at
modelSettings.autoCompactWindow, so different models can have different windows. - Claude Code now records the window actually in force and where it came from, once each time it changes. Possible sources are
env,server,experiment,default,agent_definition,session_override,settings_per_modelandsettings_top_level. The code that works out the window was split up to allow this. - Records of successful compaction gain
autoCompactWindow,autoCompactWindowOriginandarmTriggerfields. - A new helper can prepare a compaction in advance while Claude Code is idle (
armTrigger"idle"). - The list of settings Claude Code reports as set now includes
modelSettings.autoCompactWindowwhen any entry undermodelSettingsdefinesautoCompactWindow, alongsidepermissions.defaultModeandworktree.baseRef.
Why
Several places can set the auto-compact window, from environment variables to settings files to agent definitions. Recording which one won makes it possible to tell why compaction happens when it does, and confirms a per-model setting is recognised.
The entry above is what we published on the day. These lines were added later, as Anthropic's own pages caught up, and they sit beside the original rather than replacing it.
To make one subagent compact earlier than it otherwise would, set `autoCompactWindow` in its [frontmatter](#supported-frontmatter-fields) to a token count from `100000` to `1000000`. If you set [`CLAUDE_CODE_AUTO_COMPACT_WINDOW`](/docs/en/…sub-agents see the edit
* **In scripts and cloud environments**: set [`CLAUDE_CODE_AUTO_COMPACT_WINDOW`](/docs/en/env-vars) to a token count such as `200000`. Unless Claude Code [ignores the value](#claude_code_auto_compact_window-values), the variable takes prec…model-config see the edit
Anthropic's documentation has since written up autoCompactWindow, on Model configuration.