Claude's 1M Context Rot Starts at 300-400k Tokens
Performance degrades from context rot at 300-400k tokens (40% of 1M window). Fix with manual compaction instructions, clears for fresh starts, periodic recaps, sub-agents, and rewinds—not auto-compaction which worsens issues.
Context Rot Degrades Agents Early, Causing Four Key Failures
Claude models post-Opus 4.5 have a 1M token context window, up from 200k, allowing more grounding data and longer tasks. But this amplifies context rot: performance drops as context bloats because the model juggles too much information, losing focus. Rot begins at 300-400k tokens—40% of capacity—not near the limit. This triggers:
- Context pollution: Excess info interferes with reasoning, leading to more hallucinations and forgotten instructions.
- Goal drift: Agent ignores original objectives (e.g., UI specs), requiring constant reminders.
- Memory corruption: Internal state faults persist (e.g., outdated file references from sub-agents).
- Decision inaccuracy: Inconsistent choices in similar scenarios (e.g., varying error handling).
Context includes conversation history, claude.md, system prompt, files, and tool outputs. Without management, long-running agents fail predictably. Trigger compaction manually around 300-400k to preempt rot.
Manual Compaction Beats Auto; Pair with Clears and JSON Saves
Auto-compaction is unreliable: it triggers mid-task, strips system prompts/tools, relies on model assumptions, drops key details due to recency bias, and loses tool history specifics. Result: forgotten warnings in debugging or ignored prior errors.
Instead, manually compact with explicit instructions: "Summarize decisions, constraints, issues to carry forward." This ensures Claude prioritizes correctly. Use only when prior context transfers to the next phase.
For fresh starts on unrelated tasks (e.g., tests after debugging), use /clear to wipe everything—no carryover pollution.
Combine for precision: Prompt Claude to extract task, state, constraints, issues into structured JSON schema, save to file, then /clear. New session reads the file for clean, accurate context. Schema enforces consistency over prose summaries, preserving app state auto-compaction misses.
Recaps, Sub-Agents, and Rewinds Maintain Focus and Accuracy
Periodically recap: "Summarize progress, goals, constraints." This refreshes buried info to recent context, combats goal drift/decision inconsistency without bloating.
Delegate to sub-agents for isolation: They handle research/refactoring/summarization in separate windows, returning only final output. Prevents raw data (e.g., web pages) polluting main context. Explicitly prompt: "Delegate to sub-agent." Ideal if intermediates aren't needed.
On errors, rewind ( /rewind or Esc x2) to pre-mistake state, then redirect. Removes bad paths for cleaner compactions, accurate sub-agent handoffs, and consistent state—beats forward corrections that accumulate junk.