
Hidden cost of context drift
The signs your session is gradually losing accuracy — and the restart hygiene that compounds.
Why long sessions decay
A session that's sharp at hour 1 isn't the same session at hour 5. Working memory has accumulated intermediate context — drafts, dead ends, in-progress reasoning. that increasingly competes with the original task and constraints. The agent doesn't notice the decay; the operator often doesn't either, until shipped output reveals the drift after the fact.
The decay is structural, not motivational. No amount of operator discipline prevents the gradual loss of session-start context across hours of working memory. The fix isn't to push harder — it's to detect drift and restart cleanly before output suffers.
Restart is engineering hygiene, not failure. A 10-minute structured restart usually ships better output than the next 60 minutes of pushed-through work. The discipline is recognizing the moment.
Three drift signals
Watch for any of these. One signal is a soft restart trigger; two or more is hard.
| Signal | What it indicates | How to detect |
|---|---|---|
| Forgotten constraints | Session-start context has dropped from working memory | Agent proposes something you explicitly ruled out and doesn’t remember the rule |
| Compounding hallucinations | Working memory has accumulated wrong facts as established truth | Ground-truth check: agent can’t verify a recent claim against the actual code |
| Scope drift | Session has lost its anchor; conversation is wandering | Anchor check: agent can’t cleanly name the original task and how current work serves it |
The signals usually appear in order. Forgotten constraints come first (1-3 hours). Hallucinations next (3-5 hours). Scope drift last (5+ hours). Catching the early signals saves the session; catching the late ones means you've already shipped some compromised work.
Three drift patterns
Specific failure modes and how each manifests. Hover any card to see the diagnosis.
The forgotten constraint
The compounding hallucination
The slowly broadening scope
The fix in all three: periodic checks, structured restart when checks fail, persistent rules that outlive sessions. The mechanical layer (CLAUDE.md, working-notes, anchor protocol) carries what working memory can't.
The drift check
The diagnostic. Run at the 60-minute mark and every ~60 minutes after. ~30 seconds per question. The single biggest advantage in long-session work.
Do a drift check on the current session.
Three questions:
1. GROUND TRUTH: pick a claim you made in the last 30
minutes. Verify it against the actual code or
files. Did the verification pass cleanly, or did
you hedge / substitute / discover it was wrong?
2. ANCHOR: what was the original task this session?
Is the current work serving it, or have we
drifted into adjacent topics?
3. CONSTRAINTS: list every hard constraint named at
session start. For each, can you verify you've
honored it through the session?
If any of the three answers is hedged or wrong,
restart is the right call. Don't push through —
restart hygiene compounds, push-through doesn't.Three questions, ~90 seconds total. Hedged answers trigger a clean restart.
Most operators don't run periodic drift checks at all and lose the early-warning signal entirely. Operators who add the anchor protocol to CLAUDE.md and run the check periodically catch drift in the soft-trigger window — restart costs 10-15 minutes instead of an afternoon of compromised output.
Annotated transcript
A real conversation: operator notices long-session decay, agent walks through the three signals and proposes a structured restart cycle. Click any pinned annotation to expand the "why this turn matters" commentary.
Three operator turns, three agent turns. Result: a periodic drift-check protocol + a structured restart pattern that preserves progress.
- operator
I've noticed my long sessions get less accurate over time. Output that was crisp at the start gets vague by hour 4-5. How do I tell when I should restart vs push through?
- agent
Three signals to watch for. Any one of them is a signal to restart. Two or more is a hard restart trigger:
1. Forgotten constraints. I propose something you explicitly ruled out at session start, and don't remember the rule when challenged. Means working memory has dropped session-start context.
2. Compounding hallucinations. I refer to functions, files, or facts that don't exist as if they were real. Working memory has accumulated wrong facts that downstream reasoning depends on.
3. Scope drift without re-anchoring. Conversation has wandered from the original task and nothing has pulled it back. The session has lost its purpose.The restart isn't a failure — it's hygiene. Long sessions decay. The discipline is to detect the decay and restart cleanly, not push through.
- operator
How do I detect drift before the output gets bad? I want to catch it on the way down, not after I've shipped something wrong.
- agent
Two diagnostic moves, run periodically (every 60-90 min in long sessions):
1. Ground-truth check. Pick a recent claim I made. Ask me to verify it against the actual code. "Show me the function definition you're referencing." If I can show it cleanly, working memory matches reality. If I hedge or substitute, working memory has drifted — restart.
2. Anchor check. Ask: "What was the original task this session? Is the current work serving it, or have we drifted?" If I can name the task and current work serves it, no drift. If I can't name the task or my answer feels strained, the session has drifted — restart or pivot explicitly.Both checks take ~30 seconds. Run them at hour 1, hour 2, then every hour after. Most operators don't run them at all and lose the early-warning signal.
- operator
What does a clean restart look like? I don't want to lose all the progress in working memory.
- agent
Restart is structured, not destructive:
1. Summarize current state to a markdown file. Three sections: what's been shipped, what's in progress, what's the next concrete next step. Save to the project's working notes. ~5 min.
2. Capture any rules learned this session that should outlive it. New constraints, gotchas, names of things, anything that won't be derivable from the code. Add to CLAUDE.md or a working-rules file. ~5 min.
3. Close the session. Optionally hard-close (kill the process and start fresh).
4. Open a new session, read the working notes file first. The new session loads the summary, sees what's shipped and what's next, picks up there. CLAUDE.md and rules file ensure constraints are reloaded.The whole restart cycle is 10-15 minutes. The output quality after restart is usually visibly better than the last 30 minutes before restart.
Restart hygiene — the structured cycle
Restart isn't destructive when it's structured. The cycle below preserves progress to disk and reloads cleanly into the new session. ~10-15 minutes total.
STRUCTURED RESTART CYCLE
1. SUMMARIZE (~5 min)
Write a working-notes.md (or equivalent) with:
- Shipped this session: <list>
- In progress: <task, state, next>
- Concrete next step: <one action for new session>
2. EXTRACT RULES (~5 min)
Write any constraints / gotchas / names that
should outlive the session:
- To CLAUDE.md if they're project-wide
- To a working-rules file if they're temporary
3. CLOSE (~1 min)
Optionally hard-close the session — kill the
process. Forces a clean reload.
4. REOPEN (~3 min)
Start a new session
First action: read working-notes.md
Confirm: shipped state matches reality, in-progress
state matches reality, next step is clear
Begin from "Concrete next step"
Total: ~10-15 minutes. Output quality after restart
is usually visibly higher than the last 30 minutes
before restart.
DO NOT:
- Try to "compress" the session by asking the agent
to summarize within the same session — the
summarization itself is drifted
- Restart without the summarize step — you'll lose
progress and have to rebuild
- Restart without rule extraction — the next session
will hit the same gotchas
The summarize step is the load-bearing one. Without it, restart feels like loss. With it, restart feels like a checkpoint — the next session opens with full context and the previous session's rules now live in CLAUDE.md, available to every future session.
Prompt kit
Three prompts for detecting drift, running structured restarts, and installing periodic anchor checks. Save in your CLAUDE.md or a personal snippets file.
Do a drift check on the current session.
Three questions:
1. GROUND TRUTH: pick a claim you made in the last 30
minutes. Verify it against the actual code or
files. Did the verification pass cleanly, or did
you hedge / substitute / discover it was wrong?
2. ANCHOR: what was the original task this session?
Is the current work serving it, or have we
drifted into adjacent topics?
3. CONSTRAINTS: list every hard constraint named at
session start. For each, can you verify you've
honored it through the session?
If any of the three answers is hedged or wrong,
restart is the right call. Don't push through —
restart hygiene compounds, push-through doesn't.Summarize the current session for a clean restart.
Output to working-notes.md or equivalent.
Three sections:
## Shipped this session
- <commit / artifact / decision> — one line each
- <commit / artifact / decision>
## In progress (state at restart)
- <task name>: <where we are, what's next, blockers>
## Concrete next step (for the new session)
- <one specific action the new session should take
first to pick up where this one ended>
## Rules learned this session (add to CLAUDE.md)
- <constraint or gotcha that should outlive the
session>
- <name of a thing or pattern worth remembering>
The new session reads this file first and picks up
from "Concrete next step." CLAUDE.md gets the rules
appended.Add this to my CLAUDE.md so long sessions auto-check
for drift:
## Anchor check protocol
In sessions longer than 60 minutes, every ~60 minutes,
self-check:
1. Restate the original task this session
2. Restate the active hard constraints from session
start
3. Identify the current work and whether it serves
the task
If any restatement feels strained, surface it to me:
"It looks like the session may be drifting — original
task was X, current work is Y. Pivot, table, or
restart?"
I decide whether to push through, pivot explicitly,
or restart. Don't try to fix drift silently — surface
it so I can decide.Apply this — your next long session
Recurring exercise. Run the drift check on long sessions. Restart cleanly when checks fail. Track the quality delta.
Your first drift hygiene pass
Each step takes 5-15 minutes. Progress saves automatically.
- 01On your next session longer than 90 minutes, run the drift check at the 60-minute mark.All three questions. ~30 seconds each. Note whether any answer was hedged.
- 02If any answer was hedged, run a structured restart. Use the second prompt in the kit.Don't try to push through. Restart is hygiene. The restart cycle is 10-15 minutes including the summary and rule capture.
- 03Add the anchor check protocol to your CLAUDE.md so future long sessions self-check.Use the third prompt in the kit. The mechanical check fires whether or not you remember to run it manually.
- 04After 30 days, audit your session length distribution. Are sessions longer or shorter than before?Most operators discover their sessions naturally shorten after adopting drift hygiene — the work stays clean and the restart isn't a wall.
- 05Track at least one metric of restart-related quality: shipped artifacts per long session, or rework rate.Without measurement, drift discipline is just opinion. With measurement, you can show the discipline pays back — or kill it if it doesn't.