Skills beat prompts · 3 September 2026 · 5 min read

Why long agent sessions degrade, and what to do about it

Context doesn't get smarter as it fills up: stale output crowds out live instructions, so split tasks and reset sessions instead of pushing through.

A long agent session doesn't fail because the model got worse mid-conversation. It fails because everything the agent has ever read or produced — full files, failed attempts, stack traces, tool output it no longer needs — stays in the context window, and the live instructions you actually care about end up buried under it. The fix isn't a smarter model. It's managing what stays in the window.

Context rot is measurable, not folklore

Anthropic's own documentation on context compaction states it plainly: "as a conversation grows, response quality degrades" — which is exactly why they built server-side compaction that summarizes older turns once a conversation crosses a configurable input-token threshold, 150,000 tokens by default. That's not a vague warning; it's Anthropic naming the failure mode compaction exists to work around.

The mechanism has been studied directly. The "Lost in the Middle" paper found that model accuracy on retrieval and QA tasks follows a U-shape across the context: performance is best when the relevant information sits at the start or end, and degrades by more than 30% when it's buried in the middle — a pattern that held across six model families including an early Claude model. In an agent session, your task instructions and CLAUDE.md conventions are exactly the kind of thing that starts at the top and then gets buried as turns accumulate.

What actually fills the window

In the figure, the "useful" band — your task, your conventions, the file you're actually editing — barely changes size turn to turn. What grows is the "stale" band underneath it: the full contents of files read three turns ago, a failed approach and its traceback, a tool result that's already been acted on. None of that gets automatically cleared just because it's no longer relevant. It sits there, spreading the model's attention thinner every turn, until either compaction kicks in or the session becomes noticeably worse at following instructions it agreed to five minutes earlier.

Fresh sessions beat pushing through

The practical response is to stop treating one continuous conversation as the default. When you start a genuinely new task, start a new session rather than continuing the old one — the stale band resets to zero instead of carrying forward. Compaction helps you go longer within a single session, but it summarizes under pressure, at the point where the context is already largest and most cluttered; it's a safety net, not a substitute for deciding when a task is actually done.

CLAUDE.md as durable memory, not chat history

The other lever is deciding what should survive a reset. Anything you want the next session to know — a convention you just agreed on, a gotcha you just discovered, a decision about scope — belongs in CLAUDE.md or a task file, not just in the transcript. A fresh session that reads CLAUDE.md starts with the useful band already populated and no stale band at all. A fresh session with no memory file starts blind.

Try it today

  1. Before starting a new, unrelated task in an existing session, stop and open a fresh one instead of continuing.
  2. When the agent discovers a convention or makes a decision worth keeping, ask it to add one line to CLAUDE.md immediately — don't rely on remembering to do it later.
  3. For a task that will take many turns, split it: one session to produce a written plan file, a second fresh session that reads the plan and executes.
  4. If a session is running long, ask the agent to write a short progress summary to a file before you keep going, so you can restart from that file if quality drops.
  5. Watch for the symptom, not just the token count: instructions from early in the session being quietly ignored is the tell that the useful band has been buried.

Where this breaks

Splitting sessions loses genuinely continuous context — an in-progress debugging trace where the next step depends on the exact state of the last one is expensive to reconstruct from a summary. Compaction summaries can also drop a detail a human would have kept, since the summarizer doesn't know what matters to you specifically. And CLAUDE.md only helps if you actually keep it updated; treated as write-once documentation instead of durable working memory, it drifts out of sync with the codebase just as fast as the context window fills up.

Next: onboarding the agent like a senior hire, so a fresh session doesn't start from zero either.