| name | task-prune |
| description | Inspect and optionally remove completed Doradb task worktrees and their local branches with deterministic safety checks. Use when listing cleanup candidates or pruning implemented, clean, fully pushed task worktrees from the main dispatch checkout; never delete remote branches. |
Task Prune Workflow
Use this skill only from the main dispatch worktree. The underlying tool calls
this operation purge-worktrees; keep that command name unchanged.
Required Flow
- Start with a dry run:
tools/task.rs purge-worktrees
- Require the output to list all worktrees before any removal decision.
- Exclude the
main worktree with reason main_dispatch_branch.
- Inspect every non-main worktree under
.worktrees/ whose basename is a
six-digit task id, using that worktree's own
docs/tasks/<task-id>-*.md document.
- Mark a worktree safe only when all conditions hold:
- its matching task document has
status: implemented;
- the worktree is clean;
- a same-name remote branch exists;
- that remote branch already contains the local tip.
- Report candidates under
safe_to_purge, unfinished, and excluded, with
reasons for every non-safe worktree.
- Apply removal only after explicit user intent:
tools/task.rs purge-worktrees --apply
Removal Boundary
Apply mode may act only on direct children of the dispatch root matching
.worktrees/<six-digit-task-id>. It may remove only:
- the local worktree via
git worktree remove;
- the local branch via
git branch -D.
Never delete a remote branch. Treat missing task documents, non-implemented
status, dirty worktrees, missing remote branches, or unpushed local tips as
hard reasons to retain the worktree.