All courses

Why long sessions degrade

Explain why quality drops as context fills. Early instructions get diluted, stale failed attempts mislead, and automatic summarising (compaction) drops details. Recognise the symptoms in a real session.

Builds on: The context window: the agent's working memory

Read it card by card Start the whole course

Two hours in, the agent forgets your rules

You've spent two hours with the agent improving `report.py`, a script that builds a monthly sales CSV. In your first message you wrote: "Never rename the output columns. Another team's spreadsheet reads them." Now the agent renames `total_eur` to `total`. It also proposes a rounding fix you already tried and rejected an hour ago. It was sharp at the start. What changed?

Your rule is now a sliver in a crowd

Nothing broke. The context window filled up. The model doesn't keep your rules on a separate, protected list. Every token in the window competes for its attention. A one-line rule from the start is now a tiny sliver among thousands of lines of code, logs and replies. That's **dilution**. Your failed attempts never left either. The old code and its errors are still in the window and look just as 'real' as the current version.

Three causes and the symptoms they produce

All three come from a filling window: 1. **Dilution**: early instructions become a tiny share of the context and lose influence. 2. **Stale attempts**: failed code and old errors stay in the window and look as current as the real state. 3. **Compaction**: when the window nears its limit, many agents **compact**. They replace older conversation with a shorter summary of it. The summary keeps the gist and drops specifics: exact file names, exact error text, your "never do X". Symptoms: - It breaks a rule you gave early. - It retries an idea that already failed. - It describes a file as it *was*, not as it is. - It asks for things you already gave.

Two symptoms in one late reply

Same session, late on. Rounding each row with `round(x, 2)` is the approach that already failed an hour ago. That's a stale attempt resurfacing. The rename breaks your very first rule, which is dilution or a lossy summary. The agent isn't defying you on purpose: those details are buried or gone. More rounds of arguing add more noise. Starting a clean conversation with a short note of the rules and the dead ends often works better.
▸ You: totals still off by a few cents
⚙ Read: report.py
⚙ Edit: report.py
◂ Agent: Fixed. I went back to round(x, 2)
  on each row, and renamed `total_eur`
  to `total` for clarity.

Suspect the context, not the agent's mood

Long sessions degrade because the window fills. Early instructions get diluted, stale failed attempts mislead, and compaction trades details for a summary. When an agent that started sharp begins forgetting rules or repeating dead ends, suspect the full context first.

On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.