# CLAUDE_AUTOCOMPACT_PCT_OVERRIDE

> It sets the percent full at which a chat is squeezed.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** CLAUDE_AUTOCOMPACT_PCT_OVERRIDE environment variable

## Think of it like

It is like you empty the bin when it is half full. You do not wait till it spills.

## Definition

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.

## Example code

```bash
export CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=50
claude
```

Squeeze the chat at half full.

## Why it matters

Squeezing early keeps the chat small. A model often works better with less in front of it.

## Common mistake

Setting 95 to squeeze later. It can only make it sooner, so a high value is ignored.

## Three principles

- **1 to 100.** Percent of the window.
- **Only lowers it.** High values ignored.
- **Subagents too.** Same rule.

## Related terms

- [CLAUDE_CODE_AUTO_COMPACT_WINDOW](https://learn.benibix.com/term/ai/claude-code-auto-compact-window-variable)
- [Auto-Compact](https://learn.benibix.com/term/ai/auto-compact)
- [Context Window](https://learn.benibix.com/term/ai/context-window)

## Told apart from

- [CLAUDE_CODE_AUTO_COMPACT_WINDOW vs CLAUDE_AUTOCOMPACT_PCT_OVERRIDE](https://learn.benibix.com/compare/claude-code-auto-compact-window-variable-vs-claude-autocompact-pct-override-variable): 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.

![The auto-compact window and its percent set when a chat is squeezed. Output room comes off the top.](https://learn.benibix.com/diagrams/env-context-window.svg)

---

Source: https://learn.benibix.com/term/ai/claude-autocompact-pct-override-variable
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-16
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
