worktree-tidy

Installation
SKILL.md

Worktree Tidy

Keep the number of git worktrees down without losing work. Read references/glossary.md first and use its terms in reports.

TIDY=<this skill's directory>/scripts/worktree_tidy.py is the engine (Python 3.9+, standard library only). It decides what is Stale from facts; you show the report, the user chooses, the script removes and checks again before each removal.

Hard rules

  • Remove only what the script reports as removable, and only after the user confirms the list. Exception: the user may explicitly choose hand-removal of a worktree whose blockers is exactly ["recent"]; pass --allow-recent only for those paths. This bypasses only the idle threshold, never any other Blocker, alone or combined with recent. The script still re-assesses blockers and checks dirty and non-regenerable ignored files immediately before removal. remove without --yes is a dry run; pass --yes only after confirmation.
  • Never use git worktree remove --force, rm -rf on a worktree, or a tool's own delete command (Orca's worktree rm also deletes branches). The script uses plain git worktree remove; tools such as Orca drop the worktree from their sidebar on their next scan.
  • Removing a worktree keeps its branch. Pass --delete-branch only when the user asked for it; the script still deletes a branch only when its Request is merged or closed and its tip is reachable from another branch, tag or remote-tracking ref (branchSaved). It re-checks this immediately before deletion; otherwise it keeps the branch and reports branchError.
  • Non-regenerable ignored files block removal (ignored), because plain git worktree remove can silently delete ignored files. Never discard them to make a worktree removable.
  • Never commit, stash or discard changes to make a worktree removable. A dirty worktree is reported for the user to handle.

Workflow

  1. Scan. With no arguments the script scans the repository of the current folder, or the roots in the config file.
Installs
3
GitHub Stars
4
First Seen
Oct 18, 2026