> ## Documentation Index
> Fetch the complete documentation index at: https://pm-plugin.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# /pm:verify-worktrees — Flag Hierarchy Worktrees Left Behind

> A read-only check that lists hierarchy-dispatch worktrees whose work has ended. It flags and never deletes. Needs git 2.36 or later.

Epic-hierarchy orchestration runs each child epic in its own git worktree on a branch named `hierarchy-child/<epic-id>`. A worktree left behind after its work landed keeps its branch checked out and its directory on disk. `verify-worktrees` lists the ones whose work has ended. It is read-only: it flags and never deletes, because a worktree could still hold work the bookkeeping has not caught up with.

**New as a slash command in 0.50.0.** The verb existed before, but had no command doc, so it was reachable only by calling the engine directly.

```bash theme={null}
node "${CLAUDE_PLUGIN_ROOT}/scripts/conductor.mjs" verify-worktrees
```

If `${CLAUDE_PLUGIN_ROOT}` is empty:

```bash theme={null}
ENGINE="${CLAUDE_PLUGIN_ROOT:+$CLAUDE_PLUGIN_ROOT/scripts/conductor.mjs}"; [ -f "$ENGINE" ] || ENGINE=$(ls -t ~/.claude/plugins/cache/*/pm/*/scripts/conductor.mjs 2>/dev/null | head -1); node "$ENGINE" verify-worktrees
```

## What it reports

It prints one JSON document, `{ "orphaned": [{ "path", "branch", "epicId", "reasons" }] }`. A worktree is flagged for either reason, and `reasons` names which:

* `epic-archived` — the epic the branch is named for is archived;
* `branch-merged` — the branch tip is already an ancestor of the current `HEAD`, whatever the epic's status says (the case where `git branch -d` failed with "used by worktree" after the merge).

Only `hierarchy-child/*` branches are considered; any other worktree is yours and is never listed.

## When git cannot list worktrees

Outside a git repository — when git itself answers "not a git repository" — it prints `{ "orphaned": [] }` rather than failing: there are no worktrees there. Any other failure to list them (an older git, dubious ownership, a corrupt repository, git missing from PATH) is refused with git's own message instead of an empty list.

<Warning>
  **Requires git 2.36 or later (0.50.0).** It reads the NUL-terminated listing, `git worktree list --porcelain -z`, so a worktree whose path holds a line feed is reported whole rather than truncated at the break. An older git is refused with git's own message.
</Warning>

## Cleaning up a flagged worktree

```bash theme={null}
git worktree remove <path>
git worktree prune
git branch -d hierarchy-child/<epic-id>
```

See [Multi-agent hierarchy](/guides/multi-agent-hierarchy) for how these worktrees are created.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.