Skip to content
BENIBIX Learn

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.

AI⌨️ Claude Code

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.

Example
Jack runs on a 1M model, but long chats get slow and costly. He sets the window to 300,000, so chats are squeezed well before that.
Why it matters
A huge window can cost a lot per request. A smaller one keeps each turn lean.
Full entry
AI⌨️ Claude Code

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.

Example
Lucy finds Claude gets sloppy late in long chats. She sets this to 60, so the chat is squeezed while it is still sharp.
Why it matters
Squeezing early keeps the chat small. A model often works better with less in front of it.
Full entry

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.