← ClaudeAtlas

wt-listlisted

List active worktrees with branch, status, sync state, and staleness info. Use this when the user asks what worktrees exist, wants to see what's in flight, check which branches have worktrees, or asks about stale or forgotten parallel work. Also triggers for `/wt-list [--stale]`.
ThinkVelta/agent-tracker · ★ 1 · AI & Automation · score 71
Install: claude install-skill ThinkVelta/agent-tracker
# Worktree List List all active worktrees with rich context: branch, status, sync state, and staleness detection. **User input:** $ARGUMENTS ## Step 1 — Gather worktree data ```bash git worktree list --porcelain ``` Parse the output to extract for each worktree: - **Path** (`worktree <path>`) - **HEAD commit** (`HEAD <sha>`) - **Branch** (`branch refs/heads/<name>`) or `(detached HEAD)` Identify the main working tree (first entry) and label it as such. If there are no worktrees beyond the main working tree, report: > No additional worktrees found. Use `/wt-open` to create one. Then stop. ## Step 2 — Enrich each worktree For each worktree, gather the following: ### Clean/dirty status ```bash git -C "<path>" status --porcelain 2>/dev/null | wc -l | tr -d ' ' ``` - `0` → "clean" - `>0` → report count of modified files ### Ahead/behind remote ```bash git -C "<path>" rev-list --left-right --count @{upstream}...HEAD 2>/dev/null ``` Output format: `<behind>\t<ahead>`. If no upstream is set, note "no remote". ### Last commit ```bash git -C "<path>" log -1 --format="%cr|%s" 2>/dev/null ``` This gives relative time and subject (e.g., `2 hours ago|add session store`). ### Staleness check ```bash git -C "<path>" log -1 --format="%ct" 2>/dev/null ``` Compare the commit timestamp to now. Flag as **stale** if the last commit is **3 or more days old**. ## Step 3 — Format the output Present each worktree as a block, for example: ```text Active worktrees: main (ma