Platform Engineering24 August 20266 min read

Building Governed AI Agents — Part 12 of 17

Session hygiene is the cheapest AI coding cost control

One task, one session, one short handoff. It costs nothing, requires no platform change, and usually beats every other cost intervention available.

#AI Engineering#Platform Engineering#FinOps#Software Delivery

The most expensive session in the workload Andrew Baker instrumented ran for roughly a week and nearly 6,000 turns. Context grew from under 40,000 tokens to over 900,000. Nobody decided to do that. It happened the way most expensive things happen, one reasonable decision at a time: the session was open, the next task was related, and closing it felt like throwing away useful context.

That instinct is understandable and it is the whole problem.

One task per session, or one session for everythingONE TASK, ONE SESSIONOne taskdefinedFocusedsessionOutput andhandoff noteSessionclosedNext task startsfrom the handoffONE SESSION FOR EVERYTHINGTask 1Task 2context growsTask 3grows furtherTask 4still growingEvery turn paysfor all of itThe cheapest token is the one you never carry into the next turn
The top row is not a productivity technique. It is the cheapest cost control available, and it costs nothing to adopt.

Why the long session feels right

Keeping a session open feels efficient. The agent knows the codebase, remembers the earlier decisions, and does not need to be re-briefed. Starting fresh feels like paying a set-up cost again.

The set-up cost is real but small, and it is paid once. The carrying cost is small per turn and paid every single turn for the rest of the session. Over a few hundred turns the second overwhelms the first by a wide margin, and the crossover happens much earlier than intuition suggests.

There is also a quality argument that is often stronger than the cost one. A session carrying four days of unrelated history is not just expensive, it is worse at the current task. The agent has more material to weigh, some of it contradictory, some of it describing decisions that were later reversed. Long sessions produce more confused work, not less, which is why the fix tends to be adopted willingly once people try it.

Do not carry the filing cabinet into every meeting

The version of this that makes sense to a non-technical stakeholder.

You would not bring every document produced on an account into every meeting about it. You bring the one-page handover: what was decided, what is still open, where things stand. Everything else is available if needed, and does not need to be in the room.

A session handoff is that one-page handover. Not a summary of everything that happened, which recreates the problem in prose form, but the state a new session needs to continue.

What a handoff note carries, and what it dropsThe handoff noteShort enough thatwriting it is nota task of its ownCARRIESThe decision that was madeWhat is still openWhere the work now sitsDROPSEvery file that was readEvery dead end exploredEvery intermediate draft
The dropped column is the expensive one. It is also, almost always, the column nobody would have chosen to pay for twice.

The dropped column is where the money is. Every file that was read, every dead end explored, every intermediate draft: none of it is needed to continue, and all of it is being resent on every turn. Nobody, asked directly, would choose to pay for it twice.

Rules that actually work

A short list, tested against the reality that developers will not follow anything elaborate.

One task, one session. The clearest rule and the one with the largest effect. Define what the task is before starting, and end the session when it is done.

Close after a meaningful milestone. Not after every exchange, which is annoying and unnecessary, but at the natural boundaries: feature done, bug fixed, investigation concluded.

Write a handoff before restarting. Three or four lines. What was decided, what is open, where the work sits. If writing it feels like a task of its own, it is too long.

Do repository exploration in isolated subagents. Large reads are the single biggest source of context steps. Doing them somewhere isolated caps the damage, which is the subject of the subagents article.

Avoid re-reading large files in the main thread. If it is already in context, it does not need reading again. If it is not, consider whether the whole file is needed or just the relevant part.

Set a context-delta alarm. Where the tooling allows it, alert on a large single-turn jump. This catches the specific action that causes most of the harm, at the moment it happens.

Review the top expensive sessions weekly. Ten minutes, one person. The behaviour change comes from seeing your own worst session, not from reading a policy.

Where this stops being about cost

Session hygiene has a governance benefit that is worth naming separately.

A session scoped to one task produces a legible record. Somebody reviewing what happened can read it. A session covering four days of unrelated work across three features produces something nobody will ever read, which means the record exists without being useful.

For teams doing AI-assisted work on anything regulated or client-facing, that legibility matters. "Show me how this change came about" is a reasonable question, and the answer should be a session someone can actually follow. This connects to the wider point in the coding agent harness.

What good looks like

A shared understanding that a session is scoped to a task, not to a day.

Handoff notes that are three lines, not three paragraphs.

Large reads happening somewhere other than the main thread.

An alarm on context delta, so spikes get noticed the same day.

A weekly ten-minute look at the most expensive sessions, by one named person.

Practical checklist

  • Define the task before opening a session, and close it when the task is done
  • Write a three-line handoff instead of carrying context forward
  • Push exploration and large reads into isolated subagents
  • Set an alert on large single-turn context increases
  • Read the top ten sessions weekly and share what caused them
  • Treat a multi-day session as an incident to understand, not a habit to accept

How CloudNala can help

This is the cheapest intervention in the whole series and the one teams adopt fastest, because the evidence is personal: once a developer sees the per-turn view of their own most expensive session, the habit changes without a policy. We usually run that first pass with the team, set up the delta alarm, and leave behind a weekly ten-minute review that one person owns.

The session figures cited here come from Andrew Baker's August 2026 article on instrumenting coding agents.


Work with CloudNala

CloudNala helps organisations move from technology ambition to practical execution across cloud, AI, data, platform engineering and digital services.

Whether you are exploring AI, modernising your cloud environment, building a public-sector digital service, or turning an idea into a working MVP, we can help you shape the roadmap and deliver the next step.

Book an AI Readiness Workshop or write to us at consult@cloudnala.co.za