CLAUDE_CODE_AUTO_COMPACT_WINDOW
A Claude Code environment variable, read out of the shipped bundle. It has been in the build since v2.1.138, including the newest one read.
What it is
Set the [auto-compact window](/docs/en/model-config#set-the-auto-compact-window) in tokens, from 100000 to 1000000. Accepts a plain integer such as 500000 only: a value like 500k reads as 500 and clamps to the 100K minimum. Takes precedence over the /autocompact command, the --autocompact flag, and the autoCompactWindow setting. The status line's used_percentage always measures against the model's full context window, so once this variable is set, that percentage no longer indicates when compaction will run
Anthropic's own wording. Read off Environment variables, captured 2026-08-28.
Presence across releases
| Releases | Reading | Declared type | Default |
|---|---|---|---|
| 2.1.245 – 2.1.250 5 releases | never mined | — | — |
| 2.1.160 – 2.1.243 75 releases | in the build | str | — |
| 2.1.138 – 2.1.159 20 releases | in the build | — | — |
A row reading never mined is a release with no archived bundle behind it. Nothing was read out of it, so nothing here says whether the name was in it. A declared type or a default is only ever what that release's own bundle stated.
Changelog entries naming it
-
v2.1.223Startup warning when CLAUDE_CODE_DISABLE_1M_CONTEXT can't actually be enforced
If your 1M-context disable flag has no effect on your model, startup now tells you and points at the real setting.
named in this entry
Documentation pages
- Environment variables reference table Claude Code CLI
- Use Claude Code on the web mentions it Claude Code CLI
- Connect Claude Code to an LLM gateway mentions it Claude Code CLI
- Model configuration mentions it Claude Code CLI
- Claude Code settings mentions it Claude Code CLI
- Claude Code settings reference mentions it Claude Code CLI
A reference table page is one whose own table defines this name, and it is where the description above came from. A page that mentions it carries the name somewhere in its text and may say nothing about it at all. Every page carrying it.
Names beside it
Every environment variable in the inventory starting claude_code_auto, up to twelve of them.
CLAUDE_CODE_AUTO_CONNECT_IDEOverride automatic [IDE connection](/docs/en/vs-code). By default, Claude Code connects automatically when launched inside a supported IDE's integrated terminal. Set to false to prevent this. Set to true to force a connection attempt when auto-detection fails, such as when tmux obscures the parent terminal. Takes precedence over the [autoConnectIde](/docs/en/settings-reference#autoconnectide) global config setting 2.1.138
CLAUDE_CODE_AUTO_MODE_ARTIFACT_CONSENT_RULEThe rule stopping Claude publishing artifacts you didn't ask for can now be removed remotely. never mined
CLAUDE_CODE_AUTO_MODE_CLASSIFY_ASK_USER_QUESTIONIn auto mode, a question can be classified and handled instead of halting the run. never mined
CLAUDE_CODE_AUTO_MODE_EXTERNAL_PERMISSIONSNo description from anybody. 2.1.160
CLAUDE_CODE_AUTO_MODE_MODELNo description from anybody. 2.1.160
CLAUDE_CODE_AUTO_MODE_OUTCOME_CODESThe switch controlling outcome codes in auto mode now runs through a wrapper with an empty branch. never mined
CLAUDE_CODE_AUTO_MODE_REPO_VISIBILITYAuto mode's awareness of whether your repo is public now has its own environment variable and config field. never mined
Read out of the published npm bundle release by release, and out of Anthropic's own documentation as this site captured it. Nothing on this page is a description anybody here wrote about what the environment variable does. All environment variables.