You're an hour into an AI chat about a flaky test. The first answers were sharp: the model kept track of the failing test, the file names, the weird timezone edge case and the reason your team doesn't want a bigger refactor right now. Somewhere around the eighth follow-up, things slip. It suggests the change you rejected forty minutes ago. It forgets that the public API can't change. It still sounds completely sure of itself.
Nothing is broken. You've hit the context window bottleneck. Every model has a context window: the text, code, tool output and chat history it can look at while writing its next answer. Fit the task inside that space and the model can feel like a sharp colleague. Let the window fill up with old turns, half-relevant files and stale decisions, and the answers get worse well before you hit any hard limit.
A sibling post, Context Engineering Is Briefing a Smart New Hire, is about choosing what the model should see. This one is about what happens once there's a lot of it: why more context can make answers worse, and how to keep a long session useful.
Everything you send takes up space
The window holds more than your messages. Anthropic's docs for its API list what counts: the system prompt, every message in the conversation (including tool results, images and documents), the tool definitions, and the output the model writes for the current turn (Claude context windows docs, checked November 2026). Coding agents fill it fast. Every file the agent opens, every test run and every grep result gets added on top of the chat.
The same page states the important part plainly: "more context isn't automatically better." As the token count grows, accuracy and recall degrade, which the docs call context rot.
Bigger windows still rot
Windows have grown a lot. As of November 2026, Anthropic's docs list a 1M-token context window as the default for most of its current Claude models, including all the newest ones (a few older models, such as Haiku 4.5, still have 200k). That's room for a big chunk of a codebase. Capacity is one question. Whether the model uses all of that capacity well is another, and the research says it often doesn't:
- In Lost in the Middle (Liu et al., published in TACL), models did best when the relevant information sat at the start or end of the input, and significantly worse when it sat in the middle. That held even for models built for long contexts.
- Chroma's Context Rot report (July 2025) tested 18 models, including GPT-4.1, Claude 4 and Gemini 2.5. Performance got less reliable as input length grew, even on simple retrieval and text-copying tasks. Adding a single distractor, text on the same topic that doesn't answer the question, already lowered performance.
- Anthropic's engineering team describes context as a finite resource with diminishing returns. Every token a transformer reads attends to every other token, so n tokens create n² pairwise relationships, and the model's attention gets stretched thinner as the input grows (Effective context engineering for AI agents, September 2025).
So a bigger window works like a bigger desk. You can spread more papers out. The desk still won't tell you which three papers matter, and every extra page is one more thing the model can trip over.
Pick a working set before you ask
Treat context the way you'd treat memory in a program: keep the working set small and load the rest on demand. Before you ask, decide what has to be in front of the model right now.
For a bug, that's usually:
- the failing test and the exact error output,
- the function you suspect, plus anything it calls that might matter,
- two or three lines on what you've already tried and ruled out,
- the constraints: what must not change, which versions you're on.
For a design question, it's the current constraints, the non-goals and the two or three modules where the decision will land. The rest of the repo can stay one search away. If you want help picking those files in a codebase you don't know yet, this post on using AI to read unfamiliar code covers that step.
Know when to start a fresh chat
Long chats pile up dead weight. Rejected ideas, early guesses and corrections all stay in the transcript, and the model rereads them on every turn. Past a certain point, a fresh session with a short state note beats a chat that technically remembers everything.
Signs you're past that point:
- It brings back an option you already rejected.
- It forgets a constraint you stated early on.
- Its recap of the problem is slightly wrong, and you keep correcting it.
- You've spent the last five messages arguing instead of moving forward.
When you see those, stop arguing and reset. Write a state note, open a new session, paste the note plus only the files that matter, and ask for one narrow next step. A useful note records state. "We discussed auth and performance" is a topic label. This is state:
Goal: fix flaky test checkout.spec.ts on CI only
Known: fails when tests run in parallel; passes alone
Ruled out: timezone (fixed in #412), retry config
Decided: no schema change this sprint
Must not change: public OrderService API
Next: check shared DB fixture in tests/setup.ts
Done when: 20 parallel CI runs pass
Tools are starting to do a version of this for you. Anthropic's API, for example, offers server-side compaction in beta, which summarizes earlier parts of a conversation so it can continue past the limit (docs, as of November 2026). Anthropic's engineering post recommends the same moves for agents: compaction, structured notes kept outside the window, and sub-agents that work in a clean context and hand back a short summary, often 1,000 to 2,000 tokens (Anthropic). An automatic summary is still a summary, so skim it. If your one hard constraint isn't in it, add it back.
Search helps, if someone checks what it found
Retrieval and code search keep the window small by fetching files only when they're needed. Anthropic calls this just-in-time context: the agent holds lightweight references such as file paths and queries, and loads the content with tools when it needs it (Anthropic). It works well, with one catch. Chroma's distractor results are a warning: text that's on topic but wrong pulls performance down. If search brings back the old version of a module or a helper with a similar name, the model can reason from it as if it were the real thing.
So keep a human on the boundary. Glance at what got retrieved before you trust the answer built on it, and remove anything that doesn't belong. The machine finds candidates. You decide what the problem actually includes.
Try this week
- Next time a chat starts repeating rejected ideas, stop after the second one. Write a seven-line state note and start fresh.
- Before asking about a bug, list the working set: test, error, suspect function, what you've ruled out, constraints.
- When an agent pulls in files on its own, read the file list before you read its answer.
- Put the key constraint at the top or bottom of your message instead of burying it in the middle of a long paste.