/compact
Compresses your conversation to reclaim context window space. Claude summarises the conversation so far, discards the original messages, and continues with the summary as its new starting point.
$ npx -y skills add LukeRenton/explore-claude-code --agent claude-codeHow it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/compact
Context preview
What this command does when you run it.
Compresses your conversation to reclaim context window space. Claude summarises the conversation so far, discards the original messages, and continues with the summary as its new starting point.
Command definition
compact.md/compact
Compresses your conversation to reclaim context window space. Claude summarises the conversation so far, discards the original messages, and continues with the summary as its new starting point.
Usage
/compact
/compact focus on the database migration work
/compact keep the API design decisions, drop the debugging
How It Works
1. Claude reads the full conversation history 2. It generates a compressed summary, preserving key decisions, code context, and task state 3. The original messages are replaced with the summary 4. `CLAUDE.md` is re-read from disk and re-injected fresh 5. The conversation continues with the summary as context
Optional focus instructions guide what to prioritise in the summary. Without them, Claude uses its own judgement about what matters most.
What Survives Compaction
| Preserved | Lost | |---|---| | `CLAUDE.md` content (re-loaded from disk) | Exact wording of earlier messages | | Key decisions and reasoning | Verbose tool output and debug logs | | Current task state and progress | Intermediate exploration steps | | Code snippets Claude is actively working with | Conversation tone and nuance | | Task list items | One-off instructions given only in chat |
When to Use It
- The context window is getting full and Claude warns about capacity
- You are switching focus within the same session and want to shed old context
- Claude starts "forgetting" earlier instructions or repeating itself
- After a long debugging session, before starting implementation
/compact vs /clear
| | /compact | /clear | |---|---|---| | Conversation history | Summarised and kept | Deleted entirely | | `CLAUDE.md` | Re-loaded | Re-loaded | | Task continuity | Preserved in summary | Lost | | Best for | Reclaiming space mid-task | Starting a completely new task |
Tips
- Anything you want Claude to remember permanently belongs in `CLAUDE.md`, not in conversation. `/compact` preserves CLAUDE.md; it does not preserve one-off chat instructions
- Focus instructions help when your conversation covered multiple topics but you only care about one going forward
- Context compaction also happens automatically when the window fills up. `/compact` lets you trigger it on your terms with guidance about what to keep
Read more
/compact
Compresses your conversation to reclaim context window space. Claude summarises the conversation so far, discards the original messages, and continues with the summary as its new starting point.
Usage
/compact /compact focus on the database migration work /compact keep the API design decisions, drop the debugging
How It Works
1. Claude reads the full conversation history 2. It generates a compressed summary, preserving key decisions, code context, and task state 3. The original messages are replaced with the summary 4. `CLAUDE.md` is re-read from disk and re-injected fresh 5. The conversation continues with the summary as context
Optional focus instructions guide what to prioritise in the summary. Without them, Claude uses its own judgement about what matters most.
What Survives Compaction
| Preserved | Lost | |---|---| | `CLAUDE.md` content (re-loaded from disk) | Exact wording of earlier messages | | Key decisions and reasoning | Verbose tool output and debug logs | | Current task state and progress | Intermediate exploration steps | | Code snippets Claude is actively working with | Conversation tone and nuance | | Task list items | One-off instructions given only in chat |
When to Use It
- The context window is getting full and Claude warns about capacity
- You are switching focus within the same session and want to shed old context
- Claude starts "forgetting" earlier instructions or repeating itself
- After a long debugging session, before starting implementation
/compact vs /clear
| | /compact | /clear | |---|---|---| | Conversation history | Summarised and kept | Deleted entirely | | `CLAUDE.md` | Re-loaded | Re-loaded | | Task continuity | Preserved in summary | Lost | | Best for | Reclaiming space mid-task | Starting a completely new task |
Tips
- Anything you want Claude to remember permanently belongs in `CLAUDE.md`, not in conversation. `/compact` preserves CLAUDE.md; it does not preserve one-off chat instructions
- Focus instructions help when your conversation covered multiple topics but you only care about one going forward
- Context compaction also happens automatically when the window fills up. `/compact` lets you trigger it on your terms with guidance about what to keep
Learn Claude Code by exploring it as it was designed - interactive IDE-style docs for commands, MCP, skills, CLAUDE.md and more.
Repo: LukeRenton/explore-claude-code
Other commands on explore-claude-code.
- /my-command
Review the changes in this PR. Focus on:
Open command - /review-pr
Review the changes in this PR. Focus on:
Open command - /write-tests
Write tests for: $ARGUMENTS
Open command - /BUILT-IN-COMMANDS
Commands baked into Claude Code that execute fixed logic directly. Type `/` at the prompt to see them all, or type `/` followed by any letters to filter. Unlike [bundled skills](^Prompt-driven workflows like /simplify and /batch that use Claude's tools to orchestrate work. See
Open command - /btw
Ask a quick side question about your current work without adding to the conversation history. The question and answer appear in a dismissible overlay and never enter the main context.
Open command - /diff
Opens an interactive diff viewer showing uncommitted changes in your working directory and per-turn diffs from Claude's edits.
Open command

