Who cleans up coding agents' branches and worktrees? Assay shares a workflow

fuckme · reddit · 2026-10-11

With agentic development, multiple coding agents create branches, checkpoint commits and worktrees all day. After a PR merges, local branches, review checkouts and recovery records linger: leftover worktrees eat disk, and tools scanning refs or walking retained history have more to process (though an old branch doesn't slow every Git command).

Building Assay, the author found it helps to separate three jobs:

Squash merging keeps accepted history concise, but original task commits survive while branches, worktree HEADs or reflogs retain them.

Starting inventory commands:

bash

git worktree list --porcelain

git branch -vv

git count-objects -vH

Assay is building ownership checks, workspace retirement and maintenance into its agent-work management tools — practices useful even with plain shell scripts. Open question: what should signal a workspace is safe to retire — merged PR, completed review, retention period, or explicit owner sign-off?

Related event: Assay Team Shares Git Worktree Cleanup Workflow for Multi-Agent Development(2 posts)→

Original post →

More from coding & agent

coding & agent channel →