Lecture 13 · 2 min read

Leave Every Session in a Clean State

How a session ends isn't a footnote, it's the opening move of the next one. End it messy and you've handed the next session a cleanup job instead of a running start.

💡Leave the campsite cleaner than you found it

The rule of a good campsite is to leave it ready for the next person: fire out, tools packed, a note about the water. A session that ends messy makes the next one start by cleaning up. Entropy is the default; a clean handoff is the discipline that fights it.


Mess compounds

Leave behind a half-committed tree, a stray background process, and no note about what happened, and the next session opens into confusion. It cannot tell finished work from abandoned attempts, or a running service from a leaked one. Each messy ending makes the next start slower, and the cost compounds across a long task.

flowchart LR
  Green["Feature green"] --> Commit["Commit, tidy the tree"]
  Commit --> Handoff["Overwrite handoff.md"]
  Handoff --> Advance["Advance feature_list.json"]
  Advance --> Resume["Next pass resumes from a clean state"]
Every green feature ends in a committed, documented, resumable state.

The clean-state ritual

End every session deliberately: commit or revert so the tree is clean, stop anything you started, and write a short handoff, what was done, what is next, what is risky. The test of a clean handoff is simple: a fresh session should be able to read it and be productive immediately, with nothing to untangle first.

Definition of clean

Tree committed, no stray processes, and a handoff note that lets the next session start cold. If any of the three is missing, the session is not finished.

Clean handoffs close the loop

This is where the loop becomes compounding instead of fragile. After every green feature, Agentum's engine overwrites .agentum-harness/handoff.md with the current state and advances the feature in feature_list.json before the next one is picked up so a run that spans days is a chain of clean, resumable states, and a restarted daemon reads the board straight back from disk. The run only reaches done when every feature is green. That clean-state discipline is what lets the loop run unattended in tmux and still be trustworthy when you reconnect over the tunnel.

Key takeaways

  • A messy ending hands the next session a debugging problem instead of a starting point.
  • Clean means: tree committed, no stray processes, and a usable handoff note.
  • The test: a fresh session can read the handoff and be productive immediately.
  • Agentum ends every iteration clean, turning a long autonomous run into a chain of safe resume points.

Exercises

  1. Run the checklist. End a session with: tree committed, no stray processes, handoff written. Did all three pass?
  2. Measure entropy. Open a week-old branch. How long before you understand its state? That gap is the cost of messy exits.

Further reading

This lecture reframes the matching chapter of the open Walking Labs course for Agentum. Read the original ↗