All insights

Coding agents

“Context Left Until Auto-Compact” in Claude Code: Meaning and What to Do

Learn what Claude Code documents about auto-compaction, how to inspect context with /context, what to do when the status is low, and how Claude Code behavior differs from production API compaction.

Illustration for Context left until auto-compact claude code

What “Context left until auto-compact” means

Claude Code automatically compacts a long conversation before the context window fills, summarizing conversation history so the session can continue. The /context command shows what is filling the window. [1][2]

The label “Context left until auto-compact” appears to describe the remaining runway before that automatic compaction—that is an interpretation of the wording, not a documented definition of the percentage. The official documentation reviewed here does not explain its exact calculation, denominator, or how to convert it into tokens. Treat it as an approximate status cue, not a precise token budget.

How to check it—and what to do when it is low

Run /context to inspect what is filling the window. If you want to continue in the same conversation, you can let automatic compaction happen or run /compact to summarize deliberately. Compaction carries forward a summary; it does not preserve every earlier message verbatim. [1][2][3]

If you prefer a fresh start, /clear is a separate action. For continuity, first note the task goal, constraints, relevant files, completed work, and next steps, then provide that handoff in the new session. Don’t assume a fresh start summarizes and carries forward the old conversation. [2][4]

Is this a production Claude API feature?

Claude Code’s /context display is part of the Claude Code interface; the API documentation reviewed here does not document that same percentage display as an API response feature. Anthropic separately documents Messages API compaction options: threshold-triggered compaction and compaction requested by the application. These API capabilities are distinct from Claude Code’s display and commands. Availability depends on the API feature and model; check the applicable documentation before designing around one. [5][6][7]

For API selection, decide whether your application needs compaction to occur at a threshold or wants to request a summary itself, then verify the required capability for the model and API route you plan to use. Don’t assume the Claude Code percentage indicator or commands transfer to API calls. The public TokenForge information reviewed here does not establish compatibility with Anthropic’s API compaction features, so no TokenForge-specific compatibility claim is made. [5][6][7][8]

Bottom line: Claude Code documents automatic summarization before the context window fills, and /context shows what is filling that window. The status wording suggests a countdown to auto-compact, but its percentage formula is not defined in the documentation reviewed here. Use /compact to summarize and continue, or /clear for a fresh start. Evaluate production API compaction separately from Claude Code’s interface.

Sources

Best practices for Claude Code

Commands — Claude Code Docs

Explore the context window — Claude Code Docs

How to avoid losing context in Claude Code's auto-compact mode

Compaction overview — Claude Platform Docs

Compaction at a token threshold — Claude Platform Docs

Compaction on demand — Claude Platform Docs

Token Forge Cloud

Contact us