Analyze current context window usage and provide optimization recommendations
Analyzes context window usage and provides optimization recommendations.
/plugin marketplace add melodic-software/claude-code-plugins/plugin install claude-code-observability@melodic-softwareAnalyze the current context window state and provide recommendations for optimization. This helps identify when context is becoming bloated and action is needed.
/check-context
| Usage | Status | Action |
|---|---|---|
| < 50% | HEALTHY | No action needed |
| 50-75% | MONITOR | Consider /compact soon |
| 75-85% | WARNING | Run /compact or /clear |
| > 85% | CRITICAL | Immediate action required |
Claude Code's context typically includes:
| Component | Typical Size | Notes |
|---|---|---|
| System prompt | 15-25k tokens | Base instructions |
| CLAUDE.md files | 5-15k tokens | Memory files |
| Loaded skills | 1-5k tokens | Active skills |
| Conversation history | Variable | Grows with turns |
| Tool results | Variable | Can be large |
| File contents | Variable | From Read operations |
Note: Exact context usage is internal to Claude Code. This command provides estimates based on observable factors:
Factors to consider:
- Conversation length (turns)
- Recent file reads
- Tool output volume
- Loaded skills/memory
Based on observable signals:
Healthy Indicators:
Warning Indicators:
Critical Indicators:
Context Window Analysis
=======================
Estimated Status: {HEALTHY | MONITOR | WARNING | CRITICAL}
Observable Indicators:
Conversation turns: {count}
Recent file reads: {count} files
Tool invocations: {count}
Skills loaded: {list}
Assessment:
{description of current state}
Recommendations:
{prioritized actions}
Available Commands:
/clear - Complete context reset (nuclear option)
/compact - Intelligent summarization (preserves key info)
/cost - View token usage and costs
Tips for Context Management:
- Use /clear between major task switches
- Prefer focused, specific queries over broad exploration
- Let Claude use sub-agents for large operations
- Break large tasks into smaller sessions
Context Window Analysis
=======================
Estimated Status: HEALTHY
Observable Indicators:
Conversation turns: 8
Recent file reads: 3 files
Tool invocations: 12
Skills loaded: 2 (docs-management, command-development)
Assessment:
Context appears healthy. Responses are quick and
accurate. No signs of degradation.
Recommendations:
No action needed. Continue as normal.
Tips:
- Current session is efficient
- Consider /clear before starting a new major task
Context Window Analysis
=======================
Estimated Status: WARNING
Observable Indicators:
Conversation turns: 47
Recent file reads: 23 files
Tool invocations: 156
Skills loaded: 5
Assessment:
Context is getting full. You may notice:
- Slightly slower responses
- Occasional gaps in recalling earlier context
- Auto-compaction may trigger soon
Recommendations:
1. Run /compact to summarize and free space
2. Or run /clear if starting a new task
3. Save important context to a temp file first
Warning Signs to Watch:
- If responses slow further, act immediately
- Watch for truncation or "I don't recall" responses
Context Window Analysis
=======================
Estimated Status: CRITICAL
Observable Indicators:
Conversation turns: 89
Recent file reads: 45 files
Tool invocations: 312
Skills loaded: 7
Auto-compact triggered: 3 times
Assessment:
Context is near capacity. Significant degradation likely:
- Very slow responses expected
- Poor recall of earlier context
- Risk of failed operations
IMMEDIATE ACTION REQUIRED:
Option 1 (Preserve Progress):
1. Document current task state to file
2. Run /compact
3. Resume with focused context
Option 2 (Clean Start):
1. Run /clear
2. Reload only essential context
3. Continue with fresh context
Option 3 (New Session):
1. Note session ID for /resume if needed
2. Start new Claude Code session
3. Fresh 200k token context