Loading lesson…
Long agent sessions degrade in predictable ways. Learn what context rot looks like, why it happens even with million-token windows, and the compaction discipline that keeps quality high.
Claude 4.7 has a million-token window. GPT-5 has 400k. You can hand them an entire codebase. They will read it. They will also forget half of it by the time they finish writing the answer. Long context is necessary, not sufficient — and it actively degrades reasoning quality past a point.
| Context used | Typical behavior | Quality |
|---|---|---|
| 0-30k tokens | Sharp, follows instructions, recalls everything | Best work |
| 30k-100k | Slight blurring of details from early turns | Still strong |
| 100k-300k | Mistakes earlier file contents, makes up function names | Mixed |
| 300k-1M | Confidently wrong about half of what you fed in | Roll the dice |
Attention costs scale roughly quadratically with context length. To stay tractable, models use various sparse attention tricks. These work great in benchmarks ("find the needle in the haystack") but degrade in real reasoning where you need to combine ten facts spread across the haystack. The model can still find each one. Combining them is harder.
# Mid-session compaction prompt for Claude Code, Cursor, Codex
"Pause. Summarize this session into a working brief:
1. What is the goal? (one sentence)
2. What constraints have we agreed on? (bullets)
3. What files have we touched and how? (file -> change)
4. What is the current bug or open question?
5. What should NOT be touched?
Return only the brief. I'll start a fresh session with it."The model writes its own handoff note. Then you start fresh and paste it in.A 200-line CLAUDE.md, AGENTS.md, or `.cursor/rules` file at the project root is read on every session. It survives compaction. It survives session resets. Anything you find yourself repeating to the agent — conventions, scripts, gotchas — belongs in that file, not in the context window.
# Session hygiene checklist (run mentally, every 30 min)
1. Has the agent forgotten any earlier constraint? -> compact + re-state it.
2. Are we still on the original goal? -> re-state goal, drop tangents.
3. Has the file state diverged from what the agent thinks it is? -> show `git status`, force re-read.
4. Is the agent repeating itself? -> compact and reset.
5. Have we been at this >1 hour with no commit? -> hard reset.A 30-second check that prevents most multi-hour disasters.Long context is a runway, not a destination. Land before you crash.
— An agentic systems engineer
The big idea: bigger context windows are a tool, not a free pass. Treat every session as a perishable resource. Compact aggressively, persist conventions in project-memory files, and start fresh when the agent's recall starts to slip. The work you save is your own.
15 questions · take it digitally for instant feedback at tendril.neural-forge.io/learn/quiz/end-coding-debug-context-rot-creators
What is the core idea behind "Context Rot — Why Long Sessions Get Stupid"?
Which term best describes a foundational idea in "Context Rot — Why Long Sessions Get Stupid"?
A learner studying Context Rot — Why Long Sessions Get Stupid would need to understand which concept?
Which of these is directly relevant to Context Rot — Why Long Sessions Get Stupid?
Which of the following is a key point about Context Rot — Why Long Sessions Get Stupid?
Which of these does NOT belong in a discussion of Context Rot — Why Long Sessions Get Stupid?
Which statement is accurate regarding Context Rot — Why Long Sessions Get Stupid?
What is the key insight about "Recency bias is real" in the context of Context Rot — Why Long Sessions Get Stupid?
What is the key insight about "Claude Code's /compact" in the context of Context Rot — Why Long Sessions Get Stupid?
Which statement accurately describes an aspect of Context Rot — Why Long Sessions Get Stupid?
What does working with Context Rot — Why Long Sessions Get Stupid typically involve?
Which of the following is true about Context Rot — Why Long Sessions Get Stupid?
Which best describes the scope of "Context Rot — Why Long Sessions Get Stupid"?
Which section heading best belongs in a lesson about Context Rot — Why Long Sessions Get Stupid?
Which section heading best belongs in a lesson about Context Rot — Why Long Sessions Get Stupid?