Sessions, turns, and clearing
The session is the real unit of agent work. Learning to end one is a bigger skill than learning to start one.
A session is one bounded run of interaction: it starts empty, accumulates history, and ends when you clear it. A turn is one of your messages plus everything the agent does before handing control back — which may be thirty tool calls or none.
Almost everything in this course is expressed in sessions. "One task per session" is the core operating rule, and it follows directly from Lesson 2.4: a session is exactly the thing that accumulates context and therefore degrades.
Shape a session deliberately
OPEN state the goal, the constraint, and the files involved.
6 lines, not 60. Name what "done" means.
LOAD let it read exactly what it needs. Point, do not dump.
PLAN ask for the approach before any edit. Correct the plan, not the code.
WORK let it implement and run the check command itself.
CLOSE review the diff, commit, and clear.The step people skip is PLAN, and it is the cheapest correction point in the whole process. Fixing a wrong approach costs four lines at plan time and a full re-implementation afterwards.
Clearing
Clearing means ending the session and starting with an empty context. It is not an admission of failure; it is the main hygiene practice.
Clear when: the task is done; the approach changed; you notice any dumb-zone symptom; you are switching to an unrelated problem; you just edited standing instructions; a long debugging detour is finished and you are back to the original task.
Do not clear when: you are mid-task and the context is still clean and relevant. Clearing has a real cost — the agent has to re-establish what it knew — which is why Module 06 covers carrying context over properly rather than just dropping it.
The debugging detour
This is the most common context poisoning in practice. You are implementing a feature; something breaks; you spend fifteen turns chasing a stack trace through unrelated files; you fix it; you return to the feature. The window now contains your feature work plus a large pile of irrelevant debugging, and the agent's attention is split between them for the rest of the session.
Handle it deliberately: finish the debugging, note the cause in one line, clear, and restart the feature session with that line included.
Try it
For the next five tasks, write the OPEN block before you type anything into the agent — goal, constraint, files, definition of done. Five lines. Then compare turn counts against your usual sessions. Most people cut them roughly in half.
Takeaways
- One task per session, with an explicit open and a deliberate close.
- Correct the plan, not the code — it is the cheapest intervention point.
- A finished debugging detour is a reason to clear, carrying one line of what you learned.
What makes the PLAN step worth the extra turn it costs?
It surfaces a wrong approach while it is still four lines of text. After implementation the same correction costs a full re-write plus the dead approach sitting in your context window competing for attention. It is the highest-return turn in a session.
A course by Pieter Zandbergen