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.

Building Assay, the author found it helps to separate three jobs: merge the change onto main; retire the workspace (checking active owners, unpublished work and evidence before removal); and maintain the repository (let Git pack objects and maintain indexes with a sensible recovery window).

Squash merging keeps accepted history concise, but original task commits survive while branches, worktree HEADs or reflogs retain them. Useful starting commands: 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?

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

Original post →

More from coding & agent

coding & agent channel →