Skip to content
BENIBIX Learn

Auto-Compact

AI⌨️ Claude CodeClaude Code Concepts

Also known as Compaction, /compact

Claude Code sums up an old chat to make room.

Think of it like

It is like a big pile of notes, cut down to one short page.

Example

Jack has worked for three hours in one session. The context is nearly full, so Claude Code sums up the work so far and keeps going.

Why it matters

It lets a long job keep going after the context is full.

Definition

Auto-compact is how Claude Code makes room when a session's context window is nearly full. It writes a short summary of the chat so far. Then it carries on from that summary. Your CLAUDE.md and your auto memory are loaded again after it. But a rule you only gave in the chat may get lost. You can also run /compact yourself, and say what to keep.

Example code

console
/compact keep the API changes
Compact now, and tell it what matters most.
Near the top, old talk becomes a short summary.

Common mistake

Giving key rules only in chat. Put rules that must last in CLAUDE.md, because a summary can drop a detail.

Key takeaways

  1. 1
    When context is full. Or when you ask.
  2. 2
    A summary. Replaces old talk.
  3. 3
    Files survive. CLAUDE.md is reread.

Compare

Learn it properly