Auto-compact keeps your sessions running indefinitely by intelligently summarizing conversations when you approach context limits. Since v2.0.64, compacting is instantβno more waiting. Your work continues seamlessly with all important context preserved.
How Auto-Compact Worksβ
When your conversation approaches the context window limit, Claude Code automatically:
1. Analyzes the conversation to identify key information worth preserving 2. Creates a concise summary of previous interactions, decisions, and code changes 3. Compacts the conversation by replacing old messages with the summary 4. Continues seamlessly with the preserved context
Run multiple autonomous coding agents simultaneously with Verdent's isolated Git worktrees. Each agent tackles different components while maintaining full context awareness, eliminating manual debugging bottlenecks and accelerating feature delivery. Discover Verdent AI (Free Trial)
Three Context Management Optionsβ
- Auto-Compact (Default): Automatic summarization when approaching limits. Best for most users who want hands-off context management
- Manual Compact (
/compact): You control when and how to summarize with specific preservation instructions - Clear (
/clear): Starts a completely fresh conversation with no context preservation - MCP Server Optimization: Disable unused MCP servers to free context tokens before needing to compact (v2.0.10+)
Manual Compact Examples:
# Basic compact
/compact
# Compact with specific preservation instructions
/compact only keep the names of the websites we reviewed
# Compact preserving code patterns
/compact preserve the coding patterns we established
Controlling Auto-Compactβ
You can check or change auto-compact settings in your session:
/config
This shows whether auto-compact is enabled and your current context usage.
What Gets Preservedβ
Auto-compact typically preserves:
- Recent code changes and file modifications
- Project structure and important architectural decisions
- Ongoing task context and current objectives
- Key patterns and naming conventions established
- Important configuration and setup information
What Gets Summarizedβ
Auto-compact condenses:
- Detailed explanations that are no longer immediately relevant
- Debugging sessions that have been resolved
- Exploratory discussions that didn't lead to code changes
- Historical context that's no longer needed for current tasks
Manual Compact Strategiesβ
I use manual compact when I want control over what gets preserved:
- Before major changes:
/compact preserve current architecture decisions - After debugging:
/compact keep the solution we found, remove debugging steps - Project transitions:
/compact focus on the new feature requirements - Proactive context management: Disable unused MCP servers with
/mcpor@server-name disablebefore compacting to maximize available context
The real strategy is to manually compact at strategic times rather than letting auto-compact happen randomly. When auto-compact triggers automatically, it can disrupt your workflow and mess up your current setup. I use /compact at natural breakpoints when I control what gets preserved.
Preventing Compaction: Before resorting to compaction, use /context to identify MCP servers consuming context space but not actively needed. Disabling unused MCP servers can free up significant context space, potentially avoiding the need to compact altogether.
I find it's better to manually compact at logical breakpoints rather than hitting context limits mid-task. Claude's performance degrades significantly when working memory is constrained. See Context Window Depletion for detailed strategies.
Run multiple autonomous coding agents simultaneously with Verdent's isolated Git worktrees. Each agent tackles different components while maintaining full context awareness, eliminating manual debugging bottlenecks and accelerating feature delivery. Discover Verdent AI (Free Trial)
See Also: Context Window Depletion|Claude Code Usage Limits|Memory Management|Context Inspection
