Checkpoints: undo any agent turn

Every time an agent starts a turn, Woolshed quietly keeps a checkpoint of the folder. See what each turn changed, and undo any of them, with a redo if you change your mind.

changes (the side panel's Changes) shows the focused folder's uncommitted changes and Commit, review comments on them, Ship, and the agent turns in it:

  • A checkpoint is kept as each agent starts a turn (its status goes to working): a commit no branch points to, under the per-checkout ref refs/worktree/woolshed/turns/<ms> (each worktree has its own; the newest 100 are kept). It holds every file git would show, tracked or not (not ignored ones); its message's JSON says which agent, tab and space. Taking one copies the index and runs git add -A on the copy, so the real index, the files and the branch never change, and only files changed since are read again (about half a second in a repo of 30,000 files). The status bar's chip (changes with props {part: "status"}) takes them while the main layout is shown, in one window; "Turn 2m ago" there opens the shown space's turns.
  • Turns (the panel's header) lists them, newest first, with what each changed (to the next turn, the newest to now); click one for its diff. Undo puts every file back as it was before that turn, which undoes the turns after it too (it asks first), new files removed, ignored ones left alone; commits made since go too unless they were pushed. Undo first keeps a checkpoint of how things were ("Before an undo"): its Redo puts them back. Not while an agent is working in that checkout. A pane running an agent shows Undo turn in its header (the dialog: changes with props {part: "turns", root, on?}). Shared "changes.turns" is each agent's newest turn (address -> {root, on, ref, at}).
  • From a shell: git for-each-ref refs/worktree/woolshed/turns lists them; git diff <turn> shows what changed since one. Undo only when the person asks.

Your agents read these same words: Woolshed writes this guide to ~/.config/woolshed/AGENTS.md on every start. In it, “you” is the agent and “the person” is you.