Cookbook/Manual Compact Strategy
advanced
5 min

Manual Compact Strategy

optimization
context
performance

Manual Compact Strategy

If you are in the middle of a large feature and let Claude hit its auto-compact limit, it can lose important context and spiral out of control by recreating files or forgetting what it already did.

You can manually run /compact before that happens and give it specific instructions on what you want to accomplish next. Doing this consistently will made the entire experience much more stable.

The best time to run /compact is when you notice you are approaching the context limit or you are coming to the end of a significant task. This allows Claude to keep the most relevant information and continue working without losing track of your progress.

Code Example

>/compact

I'm working on implementing user authentication for my Node.js app. 

Current progress:
- ✅ Set up JWT middleware
- ✅ Created user registration endpoint
- 🔄 Currently working on login validation

Next steps:
- Add password hashing verification
- Implement session management
- Add logout functionality

Please continue with the login validation where we left off.

Quick Steps

  1. Monitor context usage - Watch for signs Claude is approaching limits (repetitive responses, confusion)
  2. Run /compact proactively - Don't wait for auto-compact
  3. Provide clear context - Summarize what's done and what's next
  4. Set specific goals - Give Claude a clear next task to focus on

Master Claude Code with Expert Training

These recipes are from our comprehensive 2-day training course. Learn directly from experts and transform your development workflow.