# /autocompact Command

> It sets when the chat is squeezed on its own.

**Field:** Artificial Intelligence  
**Category:** Claude Code  
**Also known as:** /autocompact, Auto-compact window, claude --autocompact

## Think of it like

It is like you pick how full the bin gets. Then you take it out.

## Definition

/autocompact sets how full the context gets before Claude Code compacts it on its own. Pass a size such as 500k, or auto to go back to the size tuned for your model. Without a size, it shows the size now in use. The value is saved in your user settings and works in this session at once.

## Example

Jack's model has a very large window, but he wants a summary sooner. He sets /autocompact 500k. Now the chat is squeezed long before it is full.

## Example code

```console
/autocompact 500k
```

Compact on its own once the context reaches 500k tokens.

## Why it matters

It sets how much of the chat is kept word for word, and when the rest is cut short.

## Common mistake

Thinking it compacts the chat now. It only sets the point where compaction starts. /compact is the one that squeezes it now.

## Three principles

- **Sets the point.** Where compaction starts.
- **A size or auto.** Such as 500k.
- **Saved for later.** In user settings.

## Related terms

- [Auto-Compact](https://learn.benibix.com/term/ai/auto-compact)
- [/context Command](https://learn.benibix.com/term/ai/context-command)
- [Context Window](https://learn.benibix.com/term/ai/context-window)
- [Token (AI)](https://learn.benibix.com/term/ai/token)

## Taught in

- [Context, Recap and Copy](https://learn.benibix.com/learn/ai-claude-code-commands/context-recap-and-copy): Claude Code Commands, 5/17

![A grid of squares filled in colors: system prompt, tools, memory files, messages, then empty squares. A line near the end marks where auto-compact starts.](https://learn.benibix.com/diagrams/cmd-context.svg)

---

Source: https://learn.benibix.com/term/ai/autocompact-command
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.
