CLAUDE_CODE_AUTO_COMPACT_WINDOW vs CLAUDE_AUTOCOMPACT_PCT_OVERRIDE
People think these two do the same thing in two units. One sets the size of the box, and the other sets how full it gets. The window variable sets how many tokens the chat can hold, from 100,000 to 1,000,000. The percent variable sets the point in that window where squeezing starts, and it can only move that point lower. Use the window to cap cost per request, and the percent to squeeze a little sooner.
CLAUDE_CODE_AUTO_COMPACT_WINDOW
It sets how full a chat gets before it is squeezed.
CLAUDE_CODE_AUTO_COMPACT_WINDOW sets how many tokens a chat can hold before Claude Code squeezes it. Pick a value from 100,000 to 1,000,000 tokens. A short form such as 200k needs version 2.1.304 or later. A smaller window squeezes the chat sooner and keeps each request smaller.
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE
It sets the percent full at which a chat is squeezed.
CLAUDE_AUTOCOMPACT_PCT_OVERRIDE sets how full the auto-compact window gets before the chat is squeezed. Give it a percent from 1 to 100. A low value such as 50 squeezes sooner. It can only lower the point, so values above the default are ignored. It works for the main chat and for subagents.
In one line
- CLAUDE_CODE_AUTO_COMPACT_WINDOW
- It sets how full a chat gets before it is squeezed.
- CLAUDE_AUTOCOMPACT_PCT_OVERRIDE
- It sets the percent full at which a chat is squeezed.