| name | worktree-health |
| description | Audit linked Git worktrees and explain cleanup readiness with Gocus read-only tools. Use when checking dirty, stale, detached, merged, current, or removable worktrees, or before planning worktree cleanup. |
Worktree Health
Use Gocus to classify every worktree without removing or pruning anything.
Workflow
- Resolve an absolute path inside the target repository.
- Call
audit_worktrees with that path.
- Group results by cleanup status, and lead with anything requiring attention:
dirty: preserve local changes; not safe to remove.
review: detached worktree with unique patch content; investigate before cleanup.
current: cannot be removed from itself.
prunable: stale Git metadata that Git can prune.
merged, branch-preserved, or patch-equivalent: report why the audit considers removal safe.
- Include the path, branch or detached state, change counts, HEAD summary, cleanup reason, and base branch when present.
- If the user asks to clean up, explain that the audit itself is read-only. The Gocus canvas may offer a separate,
explicitly confirmed cleanup control only for results with
cleanup.safeToRemove=true.
Decision Rules
- Never describe a worktree as safe to remove unless
cleanup.safeToRemove is true.
- Treat
cleanup.action as the proposed Git operation, not one that has run.
- Surface
uniquePatchCount, containedBranches, and prunableReason when they explain the decision.
- A clean worktree is not automatically disposable; use the audit classification.
- If the repository has only its current worktree, say so plainly instead of recommending cleanup.
Safety
The audit runs read-only Git commands. It does not call git worktree remove, git worktree prune, or modify branches and files.