Bigger context windows made a lot of problems go away and created one: it is now possible to fill a window with material that actively makes the output worse.
Context is not storage. Everything in the window competes for attention with everything else.
Long sessions degrade#
You will notice this before you can explain it. Around the point where a session has been running for an hour and has been down two dead ends, the agent starts:
- Referring to an approach you both abandoned
- Re-suggesting something you rejected
- Being unable to hold the current requirement because five earlier versions of it are also present
- Getting steadily more agreeable and less useful
The cause is straightforward: the abandoned work is still in the window. To the model, "we tried X and it did not work" and "we are doing X" are both just text about X.
The fix is to start a new session. Not to explain more carefully within the old one.
Before you clear it, get a handoff:
Summarise: what we are trying to do, what we established works, what we ruled out and why, and the exact next step. Write it as instructions for someone with no history here.
Paste that into a fresh session. You keep the conclusions and drop the wreckage.
Include the requirement, not the history#
When you do start fresh, the temptation is to paste everything so nothing is lost. Resist it.
What a new session needs:
- The current requirement, stated once, in its final form
- The files involved
- The constraints and invariants that apply
- What was already tried and briefly why it failed
What it does not need:
- The three earlier phrasings of the requirement
- Full transcripts of failed attempts
- Output from commands that succeeded
- Your reasoning process, unless the conclusion depends on it
Reference files, do not paste them#
If the agent can read the filesystem, name the file. Do not paste its contents.
Pasting has three costs. The content is now duplicated if it also reads the file. The pasted copy goes stale the moment anything edits it — and the model has no way to know which version is current. And you have spent budget on material it could have fetched precisely.
The exception is content the agent cannot reach: a log from production, an error from a system it cannot see, a snippet from a page behind auth. Paste those, and say where they came from.
Give examples of the target, not the origin#
When you want output in a particular shape, one good example of the shape beats a paragraph describing it.
Follow the pattern in
internal/http/users.go— same error handling, same test layout.
That one line carries more than a description would, and it stays accurate as the codebase evolves, because it points at the codebase instead of a copy of it.
One task, one session#
The strongest habit here is unglamorous: finish a task, then clear.
There is a pull toward keeping a session going because it "knows the codebase now". It does not — the files are still on disk and a fresh session reads them in seconds. What the old session has is the debris of the last task, which is now noise.
Signals it is time to clear#
- You have explained the same constraint twice
- It suggests something you explicitly ruled out
- Responses are getting longer and less specific
- It has stopped asking questions and started agreeing with everything
- You are on a different task from the one you started
Any one of those is enough. Get the handoff summary and start again.
What about the memory file?#
Everything in the previous lesson about CLAUDE.md still applies, and it interacts with this directly: anything you find yourself re-explaining across sessions belongs in the memory file, not in the conversation.
That is the real test for what goes in it. If you have typed it twice, write it down once.
Next: knowing when to stop and write it yourself.