Claude Code Context Management Guide
A guide for maximizing context window efficiency.
Reference location:
.claude/references/CONTEXT_MANAGEMENT.md
A guide for maximizing context window efficiency.
🚀 Quick Reference (Top 5)#
| Command/Shortcut | Purpose | Frequency |
|---|---|---|
/compact | Context compression (when conversation gets long) | ⭐⭐⭐ |
Esc Esc | Stop Claude (when going wrong direction) | ⭐⭐⭐ |
/fork | Parallel task branching | ⭐⭐ |
Tab | Show/hide thinking process | ⭐⭐ |
@filename | Quick file reference | ⭐⭐ |
Core Principles#
"Context window is precious - turn off what you don't use"
1. Don't Over-Configure#
- Configuration is architecture, not fine-tuning
- Only enable what's needed
- Disable unnecessary MCP/Plugins
2. MCP Server Management#
| Recommendation | Description |
|---|---|
| Configured | 20-30 |
| Active | Only 5-6 per project |
| Total tools | Keep under 80 |
Reason: 200k context shrinks to ~70k with 80 tools enabled
3. Currently Active MCP (5)#
{
"enabledMcpjsonServers": [
"figma",
"flutter-inspector",
"flutter-inspector-console",
"coui-flutter",
"zenhub"
]
}
Leveraging Parallel Workflows#
/fork - Task Branching#
Handle multiple tasks simultaneously:
- Main: Flutter UI development
- Fork 1: Serverpod API development
- Fork 2: Writing tests
git worktree - Independent Development#
git worktree add ../feature-auth feature-auth
# Claude runs independently in each worktree
tmux - Long-running Tasks#
tmux new -s dev # Create session
# Claude runs melos build here
tmux attach -t dev # Check logs later
Subagent Optimization#
Scope Limiting Principle#
- Fewer tools = more accuracy
- Specify only needed tools
- Apply single responsibility principle
Agent Structure Example#
---
name: bloc
tools: Read, Edit, Write, Glob, Grep # 필요한 것만!
model: inherit
skills: flutter-patterns, swr-pattern
---
Using Hooks (Automation)#
Recommended Hooks for Dart Development#
{
"PostToolUse": [
{
"matcher": "Edit && .dart",
"hooks": ["dart format", "dart analyze"]
}
],
"Stop": [
{
"matcher": "*",
"hooks": ["check modified files for print statements"]
}
]
}
Useful Commands#
| Command | Description |
|---|---|
/compact | Manual context compression |
/rewind | Revert to previous state |
/statusline | Status bar (branch, context%) |
/checkpoints | File-level undo points |
Keyboard Shortcuts#
| Shortcut | Function |
|---|---|
Ctrl+U | Delete line |
! | Quick bash access |
@ | File search |
/ | Slash commands |
Shift+Enter | Multi-line input |
Tab | Toggle thinking display |
Esc Esc | Stop Claude |
Optimization Checklist#
- Keep active MCP to 5-6 or fewer
- Disable unnecessary agents
- Use tmux for long-running tasks
- Use
/forkor worktree for parallel tasks - Run
/compactperiodically
Related Documents#
settings.local.json- MCP activation settingsCLAUDE.md- Complete project guide