What Changed — The /compact Flag
Claude Code recently introduced a /compact flag that significantly reduces token usage during agentic workflows. When activated, this flag optimizes how Claude Code processes and retains context from your codebase, particularly during extended coding sessions or when working with large repositories.
The flag works by implementing smarter context management—prioritizing relevant code sections, compressing less-critical historical context, and reducing redundant token consumption that typically occurs when Claude Code maintains conversation history alongside your code context.
What It Means For You — More Code, Less Cost
For developers working with substantial codebases, the /compact flag means you can:
- Work with larger files without hitting context window limits
- Maintain longer coding sessions without performance degradation
- Reduce Claude Code usage costs by approximately 40% on token-heavy tasks
- Keep more files open in your working context simultaneously
This is particularly valuable for full-stack developers who need to reference multiple components, APIs, and database schemas simultaneously, or when refactoring across large codebases.
Try It Now — How To Enable /compact
You can activate the compact mode in two ways:
1. CLI Command:
claude code --compact
2. In-session toggle:
During any Claude Code session, simply type:
/compact on
To verify it's working, check your token usage in real-time with:
/stats
You'll see "Compact Mode: Enabled" and noticeably lower token consumption for the same tasks.
When To Use It — And When Not To
Use /compact when:
- Working with codebases over 10,000 lines
- Doing large-scale refactoring
- Running extended debugging sessions
- Cost is a primary concern
Disable /compact when:
- You need maximum reasoning depth on complex problems
- Working on critical security or algorithm design
- The 40% context reduction might omit important historical context
You can toggle it off anytime with:
/compact off
Pro Tip: Combine With /btw
The new /btw command for side conversations works particularly well with /compact enabled. Since /btw creates separate conversation threads, using it alongside /compact lets you explore alternative solutions or ask clarifying questions without bloating your main coding context.
Try this workflow:
/compact on
# Work on your main task
/btw "What's a more efficient algorithm for this?"
# Get answer in side thread, main context stays lean
This combination gives you the benefits of reduced token usage while maintaining the flexibility to explore different approaches.





