Search the documentation
37 pages for /compact.
Titles and paths first, then pages whose text carries it. Each row opens that page as this site last read it.
compaction
Claude Developer Platform · path
build-with-claude/compaction
optimizing-for-cost-and-intelligence
Claude Developer Platform · in the page
about-claude/models/optimizing-for-cost-and-intelligence
…t a [compaction](https://platform.claude.com/docs/en/build-with-claude/compaction) boundary. Changing a [task budget](https://platform.claude.com/docs/en/build-with-claude/task-budgets) partway throug…
memory-tool
Claude Developer Platform · in the page
agents-and-tools/tool-use/memory-tool
…ith [compaction](https://platform.claude.com/docs/en/build-with-claude/compaction), which summarizes older conversation context server-side. Context editing clears specific tool results on the client.…
Log at info level
Claude Developer Platform · in the page
agents-and-tools/tool-use/tool-runner
…side compaction](https://platform.claude.com/docs/en/build-with-claude/compaction), which works with every SDK's tool runner through the `context_management` request parameter. The Python SDK (v1.0 an…
context-editing
Claude Developer Platform · in the page
build-with-claude/context-editing
…side compaction](https://platform.claude.com/docs/en/build-with-claude/compaction) is the primary strategy for managing context in long-running conversations. The strategies on this page are useful fo…
context-windows
Claude Developer Platform · in the page
build-with-claude/context-windows
…side compaction](https://platform.claude.com/docs/en/build-with-claude/compaction) is the primary strategy for context management. ## How the context window works The "context window" refers to all…
overview
Claude Developer Platform · in the page
build-with-claude/overview
…| | [Compaction](https://platform.claude.com/docs/en/build-with-claude/compaction) | Server-side context summarization for long-running conversations. When context…
claude-prompting-best-practices
Claude Developer Platform · in the page
build-with-claude/prompt-engineering/claude-prompting-best-practices
…text compaction](https://platform.claude.com/docs/en/build-with-claude/compaction). </Accordion> ## Tool use ### Tool usage Claude's latest models are trained for precise instruction following and…
task-budgets
Claude Developer Platform · in the page
build-with-claude/task-budgets
…clockwise" href="https://platform.claude.com/docs/en/build-with-claude/compaction"> Manage context in long-running conversations with server-side compaction. </Card> <Card title="Prompt cachi…
api-and-data-retention
Claude Developer Platform · in the page
manage-claude/api-and-data-retention
…nt (compaction)](https://platform.claude.com/docs/en/build-with-claude/compaction) | `/v1/messages` (with `context_management`) | <Eligible>Yes</Eligible>…
introducing-claude-fable-5-and-claude-mythos-5
Claude Developer Platform · in the page
models/fable-5/introducing-claude-fable-5-and-claude-mythos-5
…) * [Compaction](https://platform.claude.com/docs/en/build-with-claude/compaction) * [Vision](https://platform.claude.com/docs/en/build-with-claude/vision) ## Migrating from earlier models Step-by-s…
overview
Claude Developer Platform · in the page
release-notes/overview
…[compaction API](https://platform.claude.com/docs/en/build-with-claude/compaction) in beta, providing server-side context summarization for effectively infinite conversations. Available on Opus 4.6. *…
How the agent loop works
Claude Code CLI · in the page
agent-sdk/agent-loop
…See [hooks](/docs/en/agent-sdk/hooks). * **Manual compaction:** Send `/compact` as a prompt string to trigger compaction on demand. Commands sent this way are ordinary SDK inputs. See [dispatch comman…
Extend agents with skills
Claude Code CLI · in the page
agent-sdk/skills
…e logic coded into the Claude Code process the SDK runs, for example `/compact` * **Bundled skills**: prompt artifacts included with Claude Code, for example `/code-review` * **Your skills**: prompt a…
Best practices for Claude Code
Claude Code CLI · in the page
best-practices
…ode patterns, file states, and key decisions * For more control, run `/compact <instructions>`, like `/compact Focus on the API changes` * To compact only part of the conversation, use `Esc + Esc` or…
Claude Code changelog
Claude Code CLI · in the page
changelog
…ed; it now says other sessions may still show the old name * Fixed `/compact` and "Summarize from here" in sessions started with `--agent` summarizing under the default system prompt instead of the…
Checkpointing
Claude Code CLI · in the page
checkpointing
…eeps you in the same session and compresses context, like a targeted `/compact`. To branch off and try a different approach while preserving the original session intact, use [`/branch`](/docs/en/sessi…
Use Claude Code on the web
Claude Code CLI · in the page
claude-code-on-the-web
…---------------------------------------------------------------- | | `/compact` | Yes | Summarizes the conversation to free up context. Accepts optional focus instructions like `/c…
Commands
Claude Code CLI · in the page
commands
…nversation gets long, `/context` shows what's filling the window and `/compact` summarizes it to free space. Use `/btw` for a side question that shouldn't add to the conversation history. **Run work…
Explore the context window
Claude Code CLI · in the page
context-window
…e rest of the startup content, this listing is not re-injected after `/compact`. Only skills you actually invoked get preserved.', link: '/en/skills' }, { t: 0.12, kind: 'auto', labe…
Manage costs effectively
Claude Code CLI · in the page
costs
…`/resume` to return to it. * **Add custom compaction instructions**: `/compact Focus on code samples and API usage` tells Claude what to preserve during summarization. In a fresh session, `/compact` p…
Message your other Claude Code sessions
Claude Code CLI · in the page
cross-session-messaging
…. * **Commands don't run**: a command in the message's text, such as `/compact`, arrives as plain text. Claude Code never executes it. * **Permission prompts still fire**: if acting on the message req…
Desktop application
Claude Code CLI · in the page
desktop
…summarizes the conversation and continues working. You can also type `/compact` to trigger summarization earlier and free up context space. See [the context window](/docs/en/how-claude-code-works#the-…
Error reference
Claude Code CLI · in the page
errors
…| | `Context limit reached · /compact or /clear to continue`…
Glossary
Claude Code CLI · in the page
glossary
…me` in the prompt. Built-in commands such as `/clear`, `/model`, and `/compact` control the session. You can define your own commands as files in `.claude/commands/`, or install them from a [plugin](#…
How Claude Code works
Claude Code CLI · in the page
how-claude-code-works
…compaction, add a "Compact Instructions" section to CLAUDE.md or run `/compact` with a focus (like `/compact focus on the API changes`). If a single file or tool output is so large that context refil…
Connect Claude Code to an LLM gateway
Claude Code CLI · in the page
llm-gateway-connect
…| Run `/compact` to recover the session. To prevent it, set `CLAUDE_CODE_AUTO_COMPACT_WINDOW` to the gateway's limit; Claude Code clamps…
How Claude remembers your project
Claude Code CLI · in the page
memory
…res Claude Code v2.1.206 or later. ### Instructions seem lost after `/compact` Project-root CLAUDE.md survives compaction: after `/compact`, Claude re-reads it from disk and re-injects it into the s…
Monitoring
Claude Code CLI · in the page
monitoring-usage
…before the context window fills, and this attribute records whether `/compact` reused that prepared summary. `"hit"` means it was reused; `"miss_custom_instructions"`, `"miss_hook"`, and `"miss_not_r…
How Claude Code uses prompt caching
Claude Code CLI · in the page
prompt-caching
…atically. See why a model switch triggers a slow uncached turn, what `/compact` costs, why CLAUDE.md edits don't apply mid-session, and how to check your cache hit rate. Prompt caching makes Claude C…
Continue local sessions from any device with Remote Control
Claude Code CLI · in the page
remote-control
…t. The following work from mobile and web: * Text-output commands: `/compact`, `/clear`, `/context`, `/usage`, `/exit`, `/usage-credits` (prints the billing URL instead of opening a browser), `/reca…
Manage sessions
Claude Code CLI · in the page
sessions
…sending fewer tokens per request: * **Resume from summary**: runs [`/compact`](/docs/en/context-window#what-survives-compaction) immediately. Claude Code sends one summarization request over the ful…
Claude Code settings reference
Claude Code CLI · in the page
settings-reference
….json theme={null} { "autoCompactEnabled": false } ``` The manual `/compact` command keeps working while auto-compact is off. ### `autoCompactWindow` Set how full the context window gets before C…
Extend Claude with skills
Claude Code CLI · in the page
skills
…until you need it. <Note> For built-in commands like `/help` and `/compact`, and bundled skills like `/debug` and `/code-review`, see the [commands reference](/docs/en/commands). **Custom comma…
Customize your status line
Claude Code CLI · in the page
statusline
…After that, it runs again when: * A new assistant message arrives * `/compact` finishes * The permission mode changes * Vim mode toggles * You change the `command` in your `statusLine` settings * A […
Troubleshooting
Claude Code CLI · in the page
troubleshooting
…large codebases. If you're experiencing performance issues: 1. Use `/compact` regularly to reduce context size. If it returns `Not enough messages to compact.`, the conversation has too few turns to…
Use Claude Code in VS Code
Claude Code CLI · in the page
vs-code
…'re using. Claude automatically compacts when needed, or you can run `/compact` manually. * **Extended thinking**: lets Claude spend more time reasoning through complex problems. Toggle it on via the…