worktree-branch-rationalization

Installation
SKILL.md

worktree-branch-rationalization — collapse the sprawl, lose nothing worth keeping

Harvest first. Delete last. The canonical line plus a few protected branches is the destination.

⚠️ Critical Constraints

  • Harvest before you prune — always. Capture the best content onto a staging branch and commit it before removing any worktree or deleting any branch. Deletion is the last phase, never an early shortcut.
    • Why: a deleted branch's unmerged commits are only recoverable from reflog for a limited window; an orphaned-worktree branch may have the only copy of real work. Pruning first turns recoverable into lost.
    • WRONG: git worktree prune && git branch -D feature-x (delete, then hope it merged).
    • CORRECT: confirm feature-x is contained in staging (git branch --merged staging), then git branch -d feature-x (lowercase -d refuses to drop unmerged work).
  • Never remove a worktree with a dirty or locked working tree. Run git -C <worktree> status --porcelain first; uncommitted changes there are not in any branch.
    • Why: git worktree remove --force on a dirty tree silently discards uncommitted edits — the exact agent-swarm output you are trying to save.
  • Never touch the protected set. The default branch, release/maintenance branches, and any branch with an open PR are off-limits to deletion regardless of merge state.
    • Why: "merged into staging" is not the same as "safe to delete from origin"; protected branches may carry history other people depend on.
  • Use -d not -D as the default. Reserve -D (force) for branches you have individually confirmed are fully harvested.
    • Why: -D skips the "is this merged?" safety check; defaulting to it defeats the whole skill.

Why This Exists

Installs
1
Repository
boshu2/agentops
GitHub Stars
399
First Seen
Jun 7, 2026
worktree-branch-rationalization — boshu2/agentops