| name | context-degradation |
| description | Token-range severity zones (Green/Yellow/Orange/Red/Critical) with detection checklist, early warning indicators, and corrective routing actions for context window degradation |
| version | 1.2.0 |
| category | Performance & Optimization |
| agents | ["context-compressor","planner","router"] |
| user_invocable | true |
| invoked_by | both |
| tools | ["Read","Write","Skill"] |
| tags | ["context","tokens","degradation","compression","performance","thresholds"] |
| best_practices | ["Check at every phase boundary, not just when problems appear","Treat 2+ early warning indicators as one zone higher","Spawn fresh subagent rather than continuing in critical zone"] |
| error_handling | graceful |
| verified | true |
| lastVerifiedAt | "2026-03-01T00:00:00.000Z" |
| source | builtin |
| trust_score | 100 |
| provenance_sha | 0218e724e27c08a5 |
Context Degradation Monitor
Detects context window degradation and prescribes corrective actions before accuracy drops.
Severity Zones
Thresholds are expressed as a percentage of the context window budget. For a 200K window, Claude Code's auto-compact fires at ~187K (~93.5%, i.e., contextWindow - 13K).
| Zone | Usage % | ~Tokens (200K) | Status | Action |
|---|
| Green | < 65% | < 130K | Healthy | Normal operation |
| Yellow | 65–80% | 130K–160K | Caution | Begin selective compression |
| Orange/Red | 80–90% | 160K–180K | Warning | Compress aggressively; summarize completed phases; spawn fresh subagent if needed |
| Critical | 90–93% | 180K–186K | Severe | Halt complex reasoning; compress immediately; do not attempt multi-step tasks |
| Auto-compact | > 93% | > 186K | Imminent | Claude Code auto-compact will fire; initiate post-compact recovery (see below) |
Reference: Claude Code constant AUTOCOMPACT_BUFFER_TOKENS = 13,000. Auto-compact fires at contextWindow - 13K, so for a 200K window that is 187K (93.5%). "Lost in the middle" effect: middle tokens have 20–40% lower recall past ~100K.
Early Warning Indicators
Symptoms that context degradation is affecting output quality (regardless of token count):
- Repeated tool calls — Agent re-reads files already read in same session
- Contradictory reasoning — Later steps contradict earlier decisions
- Missing prior context — Agent "forgets" task scope or constraints stated at session start
- Over-explanation — Agent re-explains concepts already established
- Stale references — Agent references file paths or task IDs that were resolved earlier
If 2+ indicators are present, treat as one zone higher than token count suggests.
Corrective Routing by Zone
Yellow (65–80%):
- Invoke
Skill({ skill: 'context-compressor' }) at the current phase boundary
- Remove completed phase content from active context