The Core Problem: Context Loss & Session Amnesia
Claude Code operates within a 200K token context window. Every message, every file read, every error, every retry — it all accumulates in that window. There is no automatic garbage collection.
After approximately 60 minutes of active use, the context window begins filling with:
- Failed attempts and error messages
- Verbose file contents from every read operation
- Correction history and patch-over-patch sequences
- Stale conversation turns no longer relevant to the task
As the context fills, the original instructions get pushed further away from the model's attention. By hour 2, Claude literally cannot "see" what you told it at the beginning. This is why it loses track of your architecture, contradicts itself on design decisions, and exhibits what developers call "context drowning" — the agent is submerged in noise and can no longer surface the signal.
The Degradation Timeline
All instructions fresh. High-quality output.
Subtle drift begins. May repeat suggestions or miss constraints.
Architectural decisions forgotten. Agent begins contradicting earlier work.
Agent patching its own patches. Session effectively corrupted.
Why CLAUDE.md Alone Doesn't Fix This
The CLAUDE.md system prompt is loaded at session start, but it occupies tokens in the same context window. As the session grows, even the system prompt gets less attention weight.
"System prompts are natural language suggestions, not deterministic constraints. Under context pressure, agents routinely bypass text-based instructions."
The Governance Solution
Runtime governance prevents context rot through deterministic enforcement, not natural language suggestions:
- 1. Checkpoint Rotation — automatically prune stale context at 65% utilization while preserving architectural state
- 2. Semantic Reset — emergency context purge at 85% that reloads core instructions
- 3. Patch Chain Detection — halt execution when an agent patches the same file 3+ times
- 4. Session Duration Limits — mandatory checkpoints every 30 minutes