mirror of
https://github.com/bitbaum/dotfiles.git
synced 2026-12-04 05:57:35 +01:00
The fleet creates a git worktree per agent session and removes none of them. On 2026-08-26 there were 24, holding 5.2 GB, and every single one belonged to a PR that had already merged — 23 were byte-for-byte clean. That is a recurring manual sweep, so it becomes a script rather than something re-derived from scratch each time the disk gets tight. stranded-work.sh and this are the two halves of one question. That one asks "is any work trapped on this disk?"; this asks "is any checkout still here after its work shipped?" They turn on the same distinction, too: an upstream that is configured but no longer resolves means the branch was pushed and its remote branch deleted. Reading that backwards is what made stranded-work report 24 merged PRs as stranded yesterday. Because this one deletes checkouts, the entire design is the refusal list. A worktree is removable only if it was PUSHED, is CLEAN, is UNUSED, and GitHub says MERGED — and each of those is a case where removing it would have destroyed the only copy of something: no upstream the branch exists on exactly one disk any dirt a worktree is where the unfinished edit lives live session someone is working in it right now not MERGED CLOSED is abandoned, not gone; empty is gh failing, not consent The predicate is pure so all nine tests run without a repo, a network call or a session, including "no argument means dry-run" — if that ever inverts, the first person to run it bare loses every checkout. Verified on the real fleet: 23 removed, 5.2 GB freed, the four it refused being one never-pushed branch, one live session, one dirty tree, and one superseded local branch. Co-authored-by: Claude Opus 5 <noreply@anthropic.com>