Context Rot

Why long AI sessions slowly get worse, how to spot it, and how to recover with handoff summaries, fresh sessions and a notes file.

13 minLesson 8 of 8
On this page
  1. Why long sessions degrade
  2. Watch it happen
  3. Signs your session has rotted
  4. What to do about it
  5. Common mistakes
  6. Try it yourself
  7. Check yourself
  8. What to practise next

A team spends a whole day in a planning workshop. By five o'clock the whiteboard holds three versions of the timeline, a budget everyone rejected at lunch, and arrows to ideas that were crossed out but not erased. Someone walking in could not tell which plan is current. Even the people who were there start quoting the rejected budget.

Long sessions with an AI assistant go the same way. The first hour is sharp. Two hours and a hundred messages later, it forgets a rule you set early on, brings back a fix you already rejected, and mixes the old version of your code with the new one. The context has rotted.

Why long sessions degrade

Every message, every attempt and every tool result stays in the context and is reread on each call. As the session grows, several things happen at once.

  • Dead ends stay. A wrong approach you abandoned is still there, in full, looking just as authoritative as the right one. The model cannot tell which one you gave up on unless that is clearly said.
  • Old versions pile up. Three drafts of a function or an email sit in the context. Asked to change "the function", the model may edit the wrong one or blend them.
  • Early instructions fade. A rule from message 3 is now a tiny share of a huge context, buried under everything said since. As The Context Window showed, models tend to use a long context less reliably than a short one, and near the limit the app may trim the rule away entirely.
  • Mistakes become examples. If the model made the same error twice earlier, those replies are now part of the text it continues. It tends to keep the pattern.

Watch it happen

A developer fixes a bug with an assistant. The token counts are made up. Track how much of the context is still current.

A debugging session rots, then restartsUse the arrows or ← → keys
each turn: context += new message + replynothing is ever removedfresh session: context = handoff + current code
  1. context
    0goal + rules
    total
    200
    current
    200
    share
    100%

    1The session starts with the goal and the rules: fix the date bug, tests must pass. Everything in the context is current.

  2. context
    0goal + rules
    1attempt A
    total
    1000
    current
    1000
    share
    100%

    2The assistant proposes attempt A, a rewrite of the date parser (800 tokens). For now, it is the current plan.

  3. context
    0goal + rules
    1attempt A
    2error log
    total
    1600
    current
    800
    share
    50%

    3Attempt A fails, with a 600-token error log. A is now a dead end, but its full text stays in the context.

  4. context
    0goal + rules
    1attempt A
    2error log
    3keep API
    total
    1700
    current
    900
    share
    53%

    4The developer adds a constraint: "Keep the public API the same." Attempt A had changed it, which is another reason it was rejected.

  5. context
    0goal + rules
    1attempt A
    2error log
    3keep API
    4attempt B
    total
    2500
    current
    1100
    share
    44%

    5Attempt B works. The error log is now resolved history. Current material: goal, constraint and attempt B, 200 + 100 + 800 = 1,100 tokens.

  6. context
    0goal + rules
    1attempt A
    2error log
    3keep API
    4attempt B
    5tangent
    total
    3100
    current
    1100
    share
    35%

    6A 600-token tangent about logging, unrelated to the bug. Current share drops to about a third.

  7. context
    0goal + rules
    1attempt A
    2error log
    3keep API
    4attempt B
    5tangent
    total
    3100
    current
    1100
    share
    35%

    7The developer asks for one more change. The reply borrows from attempt A, the version that changed the API, because A is still sitting there with plenty of detail to copy.

  8. context
    0handoff
    1attempt B
    total
    1050
    current
    1050
    share
    100%

    8Fresh session. It starts with a 250-token handoff (goal, the API rule, "attempt A failed: changed the API") plus attempt B's code. All of it is current, and the context is a third of the size.

1 / 8

The handoff kept one line from the dead end: that it failed, and why. That line stops the fresh session from trying it again. The 800 tokens of A's code are gone.

Signs your session has rotted

  • It forgets or breaks a rule you set early on.
  • It brings back an approach or a bug you already rejected.
  • It edits an old version of something instead of the latest.
  • You are writing more corrections than requests.
  • Replies get longer, vaguer, and more hedged than at the start.

Two or more together mean it is time to change the context, not argue.

What to do about it

  1. Start fresh with a handoff. Ask the assistant for a short summary, correct it yourself, and paste it into a new chat. A good handoff has the goal, the current state, the decisions and rules, what was tried and failed with the reason, and the next step.
  2. Keep a notes file. For work that spans days, keep the handoff in a file outside the chat: a project brief or a NOTES.md next to your code. Load it at the start of each session and update it at each milestone. Some coding tools load such a file automatically. It is memory that you control.
  3. Edit instead of piling on. If a reply went wrong because of your message, many apps let you edit that message and regenerate. The bad reply leaves the context instead of staying as an example.
  4. Split the work. One task per session. A tangent about logging deserves its own chat.
  5. Restate what matters. When a late request depends on an early rule, repeat the rule in the request. It costs one sentence.
A notes file that survives sessions
# Date bug fix: notes
 
Goal: dates entered as DD/MM must not be read as MM/DD.
Rules: keep the public API unchanged. All tests must pass.
 
Current state: parser fixed in parseDate() (attempt B). Tests pass.
Tried and failed:
- Rewriting the parser (attempt A): changed the public API.
 
Next: add tests for 29 Feb and for two-digit years.

Some apps do part of this for you, often called compaction: when a session nears its limit, older turns are replaced by a summary, and old tool results may be cleared. It helps, but the summary decides for you what matters, so read it for important work.

Pushing on in a rotted sessionIllustrative example. Real replies vary.
You
Still not right. Try again, and remember what I said about the API.
Model
You're right, apologies. Here is an updated version that restructures the date handling with a new DateInput class ...
Fresh session with a handoffIllustrative example. Real replies vary.
You
Notes from a previous session: [the notes file above] Current parseDate() code: [attempt B] Task: add tests for 29 February and for two-digit years. Do not change parseDate's signature.
Model
Here are four new tests. Two cover 29 February (a leap year, which should parse, and a non-leap year, which should be rejected). Two cover two-digit years ...

Common mistakes

Try it yourself

Try it: Write the handoff

You have spent 60 messages planning a team offsite with an assistant, and replies are getting muddled. Here is what actually happened, in no particular order. Write a handoff for a fresh session in under 120 words.

  • Porto was considered, then dropped because flights were too expensive. Lisbon was chosen.
  • Dates: 12 to 14 May. Budget: 400 per person, 9 people.
  • Three people are vegetarian.
  • Hotel 1 was over budget. Hotel 2 had no meeting room. Hotel 3 has not replied yet.
  • A long side discussion about team T-shirts went nowhere.
  • Next: chase Hotel 3, then draft a day-by-day agenda.
Show a sample answer
HandoffIllustrative example. Real replies vary.
You
Context from a previous planning session: Goal: team offsite, 9 people, Lisbon, 12 to 14 May. Budget 400 per person. Constraints: 3 vegetarians; need a meeting room. Decided: Lisbon (Porto dropped: flights too expensive). Hotels: Hotel 1 rejected (over budget). Hotel 2 rejected (no meeting room). Hotel 3 awaiting reply. Next steps: 1. Draft a follow-up email to Hotel 3. 2. Draft a day-by-day agenda for the 3 days. Start with step 1.

Why it works: the decisions and constraints come first, each dead end keeps one line with its reason so it is not retried, and the T-shirt tangent is gone. It ends with a single clear next task, so the fresh session starts working instead of recapping.

Check yourself

Quick check

Late in a long session, the assistant keeps reusing an approach you rejected an hour ago. What is the most likely cause?

Which handoff summary is most useful for a fresh session?

Your project spans two weeks of sessions. What keeps each new session on track with the least effort?

What to practise next

Next time a session starts to drift, write the handoff and start fresh, and compare the next reply. Then move on to What Is an Agent, where a model runs long tool loops on its own and managing context becomes the core of the design.