Effective AI agent performance depends on maintaining high signal-to-noise ratio in the context window. Even with large contexts, noise degrades performance.
Claude Code currently offers only "Compact" - a nuclear option that rebuilds the entire conversation from scratch. This is like having only git rebase -i --root when you often just need git rebase -i HEAD~5.
Think of context management like git without files - just the commit messages:
- Conversation messages = Commits
- Context compaction = Interactive rebase (squashing commits)
- Sub-agents = Feature branches that squash merge back
Current tools:
- ✓ Compact entire conversation (
git rebase -i --root) - ✓ Sub-agents with compressed returns (branch + squash merge)
- ✗ Compact recent section (
git rebase -i HEAD~5)
Allow compacting from any conversation point, not just from the beginning.
Example: Just spent an hour debugging with 50 back-and-forth messages? Compact just that section into "Fixed auth bug" while preserving the context before it.
This is exactly what developers do with git - clean up recent messy commits without touching the rest of history.
Selective rebasing enables:
- Surgical cleanup after verbose tasks
- Maintained context - keep relevant history, compress only the noise
- Familiar workflow - developers already think this way with git
Instead of losing everything with nuclear Compact, we get precise control over our conversation history.