Long Sessions Drift
A session that starts sharp gets worse as it grows. The window fills with file contents and command output, the instructions you gave at the start lose their pull, and when the tool compresses the history to make room, the summary keeps the gist and drops the detail.
None of this announces itself. The agent sounds as confident in its sixtieth turn as in its first. What changes is its behaviour, and knowing the signs tells you when to stop pushing and start a fresh session with a short note instead.
The Window Fills
Every file the agent reads and every command it runs stays in the context for the rest of the session. One debugging detour can take more of the window than the whole task: a full run of Cragmoor's 900 tests that prints its progress, three long logs read in search of a timeout, a dozen files opened and found irrelevant. All of it stays, and all of it is read again, in effect, on every turn that follows.
The cost is not only space. Models attend unevenly over long inputs. A 2023 study, "Lost in the Middle", found that performance "is often highest when relevant information occurs at the beginning or end of the input context" and drops when the model has to use information from the middle of a long one. A 2025 evaluation of 18 models reported that performance "consistently degrades with increasing input length". The size of the effect differs between models, and it has not gone away.
Early Instructions Fade
The constraint you set in your first message, "do not touch pricing", is still in the window sixty tool results later. It is also competing with everything that arrived since: files, test output, the agent's own plans. By the middle of the session the agent's edits drift from it. At Cragmoor the drift looks harmless when it happens. The agent needs to round a refund, finds a rounding helper in pricing, and changes its signature to reuse it, inside the one module the task put out of bounds.
Nothing removed the instruction. It lost weight, the way a remark made at nine in the morning loses weight by four in the afternoon in a meeting that never stopped.
Summaries Lose Detail
As of 2026, several tools compact a long session when the window is nearly full: they replace the history with a summary of it and carry on. The summary keeps what summaries keep. "Change the refund window to 12 hours" survives. "The cancellation screen in booking must show the same deadline" is an exception with a reason, and exceptions with reasons are what a summary drops first.
Nothing tells you which details went. One tool's own documentation, listing why an instruction can disappear after compaction, starts with the plainest reason: it "was given only in conversation". That tool re-reads the project instructions file from disk after compacting; instructions you typed into the chat are only as safe as the summary.
The Signs
Drift shows up in behaviour, never in tone. Watch for the agent re-reading files it already read, asking a question you already answered, bringing back an approach you rejected, contradicting a decision made earlier in the same session, or making a mistake you have already corrected once. Any one of these is a reason to stop. Repeating yourself louder adds one more message to a crowded window, and the next sign usually follows within a few turns.
At Cragmoor the signs arrive in a recognisable order. Around the fortieth turn of a long refund session, the agent opens refunds for the third time and summarises it as if seeing it fresh. A few turns later it asks whether bookings made before the change keep the old window, a question Ines answered at the start. Then it proposes a per-gym setting for the window, the approach you turned down an hour earlier. Each step is small, and each one is the session telling you that its early material has stopped counting.
Starting Fresh
End the session and start a new one with a handoff note. The note holds what the next session needs and nothing else: the goal, the decisions with their reasons, the files involved, what is done and committed, what is next, and what was tried and failed. Write it to a file rather than keeping it in your head, so that the new session reads it as its first input and you can check what it says.
Goal: full refund up to 12 h before class (now 24 h). Rule (Ines): every cancellation from ship day; 12 h is in. Decided: one shared window in refunds; booking reads it. Files: refunds, booking, their tests. Not: pricing, migrations. Done, committed: tests at 23 h and 25 h; the shared window. Next: window becomes 12; fix 23-hour and second-zone tests. Dead end: a date switch for old bookings. Ines ruled it out. Known: two schedule tests fail on main. Leave them alone.
Eight lines carry the whole state of the refund change. The constraint about pricing that had faded by turn sixty sits on line four of a short file, and the new session reads it with full weight on its first turn. The dead end is there so the next session does not spend twenty minutes rediscovering it.
Open the new session by pointing at the note and the files it names, and ask for a plan before any change, as Chapter 5 does. Read the plan against the note. If the plan mentions pricing, or a date switch for old bookings, the note did not land, and you know it before a single file has changed. Most of the time the plan matches the note line for line, and the fresh session picks up exactly where the old one should have been.
Fresh by Default
Start a new session at every new task, after a long detour, after the commit that ends a pass of the loop, and whenever a sign appears. A fresh session with a good note costs a minute of writing. A drifted one costs a wrong diff and the time to read it, which Chapter 6 shows is the expensive part of the loop.
The habit also changes how you work inside a session. Knowing you will end it soon, you commit the finished part, write the next step down and keep each session to one step of the task. Chapter 5 cuts the refund change into exactly such steps.
Compaction is the tool summarising the history so the session can go on. It is automatic, and you do not choose what it keeps. Treat it as a sign that a break is overdue.
A handoff note is you writing down what the next session must know. It is deliberate, short, and in a file you can read and correct. Write one at every natural break, before compaction has to happen.
- "A bigger window solves drift." A larger window holds more, but attention over it is still uneven, and an instruction from the first turn still competes with everything that arrived after it.
- "Repeating the instruction fixes it." It adds one more message to a crowded context. A fresh session with the instruction in the note restores it at full weight.
- "Starting over throws away the work." The work is in the files and the commits. What a fresh session throws away is the clutter, and the note carries the decisions across.
- "Compaction keeps everything important." It keeps what summaries keep: goals and outlines. Exceptions and their reasons, such as the screen that must match the refund, are exactly what it drops.
- "The agent will say when it's confused." Drift looks like confidence. The signs are in its behaviour, such as a rejected approach coming back, not in how sure it sounds.
- Start a fresh session for each task and after each committed step. The context then holds only what the next step needs.
- Write a handoff note to a file before ending a long session: goal, decisions with reasons, files, done, next, dead ends.
- Put a critical constraint in the note instead of repeating it in a long session. A fresh context gives it full weight.
- Stop when you correct the same thing twice. That is drift or a loop (Chapter 10), and more messages make both worse.
Knowledge Check
Midway through a long session, the agent edits a helper in pricing, which your first message put out of bounds. What is the best response?
- Repeat "do not touch pricing" in capital letters and ask the agent to continue
- Ask the agent to summarise the whole session so far, then keep working in it
- Discard the edit, write a handoff note with the constraint in it, start fresh
- Switch to a model with a larger context window and carry on with the same session
A tool compacts your session. Which detail is the summary most likely to lose?
- That the task is to change the refund window from 24 hours to 12 hours
- That the files involved are
refunds,bookingand their tests - That the cancellation screen must show the same deadline as the refund
- That the agent has spent the session working on a change to the refund rules
Which behaviour is a sign that a session has drifted?
- The agent brings back an approach you rejected an hour earlier in the session
- The agent asks to read a file that it has not yet opened at any point in this session
- The agent runs the test suite again after each change that it makes to the code
- The agent says it is not sure whether a business rule applies to existing bookings
What belongs in a handoff note for the refund change?
- The full transcript of the session so far, so that nothing at all is lost
- A copy of every file the agent has changed, pasted in so it can start quickly
- Only the goal, since the new session can work out everything else from the code
- The goal, decisions with reasons, files, what is done, what is next, dead ends
You have just committed step two of the refund change after a two-hour session that included a long detour. What should happen before step three?
- Carry on in the same session, since it already holds everything about the task
- Carry on, but repeat the goal and the constraints in your next message
- End the session, write the handoff note, and start step three in a new one
- Ask the tool to compact the session now, then carry on with step three in it
You got correct