3days since the last Git and AI fuck-up

Incidents 3 Nov wiped the worktreea human

Four hundred worktrees, one of them in use

Status: swept 400 worktrees. 20 files never came back.

What happened

On 3 November a live run of a worktree cleanup script (DRY_RUN=0 ~/.claude/scripts/wt-sweep.sh) removed 400 linked worktrees across 65 repositories, one of them in use by a coding session that was still running. The session noticed its own directory had gone mid-task.

Why it happened

The script spared a worktree only if its top directory had changed in the last 120 minutes or a running process had its working directory inside it. The session had entered the worktree and gone idle, and its job record named the main checkout, so neither check saw it.

git status --porcelain never lists ignored files, so a worktree whose only unshipped work sat in an ignored deliverables folder counted as clean and went to worktree remove --force.

How it ended

The worktree in use was restored from its branch. A transcript audit found at least 168 files written to ignored paths in the removed worktrees. It rebuilt 126 of them, among other ways by replaying each session’s recorded writes and edits in order, found surviving copies of 18 and could not recover 20. None of the files written with a heredoc came back.

A fix merged on 4 November: the sweep now holds any worktree a session is using and copies ignored deliverables out before removing anything.

From the cut

From the cut: Four hundred worktrees, one of them in useFrom the cut: Four hundred worktrees, one of them in useFrom the cut: Four hundred worktrees, one of them in useFrom the cut: Desk and all.From the cut: Where did my desk go?From the cut: Four hundred worktrees, one of them in useFrom the cut: Four hundred worktrees, one of them in use
The day before 1 NovThe robots agreed the code was badStatus: two bots, one branch, no witnesses.Watch it

The day after: Conflict resolved, commit gone →