Programming with AI
ENRU
5.4

When to start a new session

and what to carry across

What it is

A new session is the most underrated technique in the whole book. It is free, takes half a minute, and solves a whole class of problems that are otherwise dug out over hours.

Psychologically it is hard to start again: it feels like losing the work done. In fact the only thing lost is what was already in the way.

When it is time

SignWhere from
A third lap of one looparticle 4.9
The AI forgot a requirement from the startarticle 5.3
It contradicts itself in neighbouring repliesarticle 5.3
The task has changed into a different onethe accumulated context is no longer needed
You rolled the code backarticle 4.10
You are repeating the same thing for the third timethe wording isn't getting through

Any one of them is enough. Two together — start without hesitating.

What to carry across

The main rule: carry the state, not the history.

Carry:

  • the current code — the actual version, not the one you discussed;
  • the task, restated in the light of what you found out;
  • the decisions made — as a short list;
  • the dead ends: what you tried and why it didn't work;
  • the tests, if there are any.

Don't carry:

  • the whole conversation;
  • abandoned versions of the code;
  • reasoning that led nowhere.

How it is done

At the end of the old session:

Prompt
Summarise for carrying into a new conversation:
- what has been done
- which decisions were made and why
- what was tried and didn't work
- what is left

Briefly, as a list. Don't repeat the code, I have it.

At the start of the new one:

Prompt
Continuing a task from another conversation. Here is the state:

<summary>

Here is the current code: <code or file path>
Next step: <what we're doing>

Why it works

A new session is not "the AI forgot and got dumber". It is a return to a state with no contradictions in it.

A long conversation holds three versions of one piece of code, two abandoned approaches and a requirement you changed twice. The AI leans on all of it at once — hence the contradictory answers.

A new session holds only the current code and the current task. That is why the first answer there is often better than the tenth in the old one.

What to look for

The conversation carried across instead of the state. Copying the whole dialogue into a new session reproduces the same problem, only faster.

The dead ends not carried across. The most galling loss: without them the new session will propose what already failed.

A new session instead of a better statement. If the task is badly stated, a new conversation won't help — article 3.2 will.

The session not restarted out of stubbornness. "I'll crack it now" on the third lap is the most expensive hour of the day.

Cheat sheet

  • A new session is free and takes half a minute.

  • Time to: the third lap, forgotten requirements, contradictions, a changed task, a rollback.

  • Carry the state, not the history.

  • Always carry the dead ends, or you will get them again.

  • Save the summary to a file, not only to the chat.

  • The first answer in a new session is often better than the tenth in the old one.