# Long agent chats get worse: how to restart cleanly

Canonical: [Long agent chats get worse: how to restart cleanly](https://contextingo.com/blog/context-rot-long-ai-chats)

Locale: en

Purpose: Long coding sessions drift: old details crowd out new ones. When to end a chat, what to save first, and how to start the next one from the saved state.

Content updated: 2026-09-03

Source revision: content.ts 2026-09-03

Maintenance owner: the Contextingo site owner

[Topic map](https://contextingo.com/llm/topics/blog.md) · [Complete scoped map](https://contextingo.com/sitemap.md)

Many developers notice the same pattern. The first hour of a session is sharp. Three hours in, the agent repeats itself, forgets a constraint you gave early, or edits something it was told to leave alone. The usual advice is to start a new chat, and the usual problem is that a new chat knows nothing.

## Why a long session drifts

Everything in the session competes for the agent’s attention: your early instructions, dead ends, long tool output, half-finished plans. The more there is, the more likely something important is outweighed by something recent. Exact limits differ per tool and model, so treat any rule of thumb as a hint and watch the behaviour instead.

## Signs it is time to restart

- The agent suggests something you already rejected.
- It asks a question you answered earlier.
- It changes files outside the task.
- You are about to paste a long summary of the session into the chat yourself.

## Save first, then restart

Before you close the chat, make sure what you learned is somewhere the next chat will read it:

- Findings with their source (a file, a commit, a log line).
- Decisions with the reason.
- Failed attempts with why they failed.
- A short checkpoint: what is done, what is next, what is open.

With a Contextingo project connected, the agent saves these with `context_upsert` while it works and `session_checkpoint` when you stop. The new chat calls `session_start` and `context_get` and starts from them, so a restart costs one command instead of a long briefing.

The same mechanism covers the day your usage limit hits mid-task: see [handing off from Claude Code to Codex](/guides/claude-code-to-codex-handoff).

## Questions

### How long is too long for a session?

There is no fixed number that holds across tools and models. Restart when the agent starts repeating itself or ignoring earlier constraints, and make sure the state is saved first.

### Is summarising the chat myself enough?

It works once. It is slow, it depends on your memory of the session, and nobody else benefits. Saving records while working is cheaper and shared.
