Topic 1 of 5 · 4 min read
Why long sessions lose the thread
Goal: Recognize the signs that a long chat or agent session has degraded and name the cause from a transcript.
A long session does not get smarter as it grows; it gets noisier, and the model starts to lose the goal, the rules and the decisions you gave it early on.
Check yourself · 1 of 3
Forty turns into a chat, the assistant ignores a formatting rule you gave in the first message. What is the most likely cause?
Why it matters
A chat or an agent session is one growing pile of text. Every message, every pasted file and every tool result is added to it, and the model reads the whole pile again on each turn. The pile has a hard limit, the context window. Long before you hit that limit, quality can slip. Research on long inputs found that models use facts in the middle of a long text less reliably than facts at the start or the end. So the rule you set an hour ago can quietly stop being followed.
The signs
Learn to spot these in a transcript:
- Dropped instructions. You said "answer in British English, no bullet points" at the start. Forty turns later the answers use bullets again.
- Repeated mistakes. You corrected the model, it agreed, and three turns later it makes the same error. The wrong version is still in the pile, and it pulls the model back.
- Forgotten decisions. The team chose option B on Monday. Today the model proposes option A again, as if nothing was settled.
- Drift from the goal. The model is busy with a side issue, such as a lint warning or a formatting detail, and no longer mentions the thing you asked for.
- Tool output flooding. In a coding agent, one test run or one file read can add thousands of lines. The goal is now a few lines surrounded by logs.
What to do first
Name the cause before you fix it. Is the instruction buried, is the pile full of wrong turns, or is it full of bulky output? The fix differs: restate the rule, restart clean, or trim the output.
Before and after
Before (turn 45): "Please continue." The model, buried in logs, starts a new refactor nobody asked for.
After: "Reminder of the goal: fix the failing login test only. Do not refactor. Decisions so far: we keep the old session table; the bug is in the token expiry check." One short message puts the goal and the decisions at the end of the pile, where they are read best.
That reminder is a quick patch. The rest of this skill covers the lasting fixes: summaries, fresh sessions, progress files and built-in compaction.
What goes wrong
- People blame the model's quality and keep arguing with it. More arguing adds more noise.
- People assume a bigger window removes the problem. A larger window holds more, but a noisy pile is still noisy.
- People wait for a hard error. Degradation is gradual; there is no error message for "the model forgot rule 3".
Examples
A rule that quietly stopped working
At turn 3 you write: "Always give prices in euros." At turn 38 the assistant quotes a price in dollars. Nothing broke; the rule is just far back in a long pile. Repeat the rule in a short message, or restart with the rule at the top.
Output that buries the goal
A coding agent runs the full test suite three times. Each run prints a long log. The original request, "fix the date bug in the invoice export", is now a tiny part of what the model reads, and it starts fixing unrelated test failures.
Key points
- The model rereads the whole session on every turn, so every extra message and tool result adds noise.
- Models use details in the middle of long inputs less reliably than details at the start or end.
- Typical signs are dropped instructions, repeated mistakes, forgotten decisions, goal drift and flooding by tool output.
- Name the cause (buried rule, wrong turns, bulky output) before choosing a fix.
- A bigger window delays the problem but does not remove it.
Common mistakes
- Arguing with the model turn after turn instead of changing the session.
- Assuming a larger context window means long sessions are safe.
- Pasting whole files or logs when a few relevant lines would do.
- Waiting for an obvious failure before acting, when drift is gradual.
Check yourself · 2 of 3
In a coding agent session, which sign most clearly shows that tool output is crowding out the goal?
Check yourself · 3 of 3
Turn 52 of a long session. The assistant repeats a mistake you corrected at turn 20. Which first step fits best?
Practice items, not counted towards your mastery.
Start here
- Effective harnesses for long-running agents (Anthropic) (opens in a new tab)ArticleFree
How an agent keeps a progress file and git history so each new session can pick up the work.
- Effective context engineering for AI agents (Anthropic) (opens in a new tab)ArticleFree
Explains compaction, note-taking and sub-agents as ways to keep a long task inside the window.
- Compaction (Claude docs) (opens in a new tab)DocsFree
What server-side compaction does, and how to give it your own summary instructions.
More for this topic
- Lost in the Middle: How Language Models Use Long Contexts (opens in a new tab)PaperFree
Research showing models use information in the middle of a long input less reliably than at the edges.