LogoSkills

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/ShortcutPurposeFrequency
/compactContext compression (when conversation gets long)⭐⭐⭐
Esc EscStop Claude (when going wrong direction)⭐⭐⭐
/forkParallel task branching⭐⭐
TabShow/hide thinking process⭐⭐
@filenameQuick 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#

RecommendationDescription
Configured20-30
ActiveOnly 5-6 per project
Total toolsKeep 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: bloc
---

Using Hooks (Automation)#

{
   " PostToolUse " : [
    {
       " matcher " :  " Edit  & &   .dart " ,
       " hooks " : [ " dart format " ,  " dart analyze " ]
    }
  ],
   " Stop " : [
    {
       " matcher " :  " * " ,
       " hooks " : [ " check modified files for print statements " ]
    }
  ]
}

Useful Commands#

CommandDescription
/compactManual context compression
/rewindRevert to previous state
/statuslineStatus bar (branch, context%)
/checkpointsFile-level undo points

Keyboard Shortcuts#

ShortcutFunction
Ctrl+UDelete line
!Quick bash access
@File search
/Slash commands
Shift+EnterMulti-line input
TabToggle thinking display
Esc EscStop Claude

Optimization Checklist#

  • Keep active MCP to 5-6 or fewer
  • Disable unnecessary agents
  • Use tmux for long-running tasks
  • Use /fork or worktree for parallel tasks
  • Run /compact periodically

  • settings.local.json - MCP activation settings
  • CLAUDE.md - Complete project guide