Worktrees Overview
The full-bleed Worktrees Overview modal: search and filters, multi-select, keyboard navigation, and the bulk close-session and remove-worktree actions.
Worktrees Overview
The Worktrees Overview is a full-bleed modal showing every worktree in the project as a grid of cards, with multi-select and bulk actions. It is built for triage: pick the set you want to act on, run one action across all of them, close the modal.
It is a git-backed-project surface. A workspace with no repository has one place agents run and no overview to open. See Worktrees need a repository.
Opening it
- Shift-Command-O Control-Shift-O Control-Shift-O toggles it.
- Action palette: Toggle Worktree Overview, or Open Worktree Overview to open without toggling.
- Primary worktree card: three-dot menu → Overview.
- The sidebar's filtered-empty states offer an Open overview button, since a filter that hides everything is exactly when you want the wider view.
The modal sizes itself to the viewport and blurs the app behind it. Cards use content-visibility rather than virtualization, so every card is in the DOM but offscreen ones skip layout and paint. That keeps Command-A Control-A Control-A , range selection and find-in-page working across the whole set.
Finding Worktrees
The modal carries its own search bar with the same advanced filter popover as the sidebar: sort, group by type, status, branch type, issues and PRs, sessions, activity and dev server. A Clear button appears in the header whenever a filter is active. Grouped by type, the grid gets section headers with per-section counts, plus an Outside the project section when external worktrees exist.
The title carries the count, and shows both numbers while filtered: (7 of 24).
Three clickable stat chips sit beside the title, each rendered only when its count is above zero:
- N working: a green dot, pulsing when motion isn't reduced.
- N waiting: an amber dot.
- N finished: a blue dot.
Clicking one sets the quick state filter to that state; clicking it again resets to all.
A main toggle (role="switch") drops the primary worktree from the grid. While it is on, the word "main" renders with a strikethrough. Hiding main is how you act on every secondary worktree at once without protecting the primary by hand.
Two empty states matter: no worktrees at all offers a Create worktree button; a filter that matches nothing says how many worktrees are hidden and offers Clear all filters.
Selecting Worktrees
Selection happens in the grid, which is a single tab stop tracking activation through aria-activedescendant.
| Gesture | Action |
|---|---|
| Plain click | Switch to that worktree and close the modal. |
| Shift+click | Range-select from the anchor to the clicked card. |
| Command Control Control +click | Toggle just that card, and set the anchor for the next range. |
| Space | Toggle the focused card without switching. |
| Command-A Control-A Control-A | Select every visible worktree, respecting active filters. |
| Enter | Switch to the focused worktree and close. |
| Esc | Clear the selection if there is one; otherwise close the modal. |
Arrow keys move card to card. Grouped by type, navigation is section-aware: ↑/↓ move within a group and →/← cross into the next or previous one.
Selected cards get a subtle background fill and a neutral inset ring. Accent green is reserved for fleet arming and is never a multi-select indicator here.
Selection lives on the modal and resets when it closes. The anchor survives filter changes, so narrowing and re-widening a filter resumes Shift-click extension from where you were; it resets on window blur. Narrowing the filter drops the now-hidden cards from the selection, so the search bar stays usable for refining the target set mid-selection.
With anything selected, the header swaps to an action bar: N selected with a Clear link on the left, and Close sessions, Remove worktrees and the close button on the right. The footer echoes the bindings in plain text and appends the selection count.
Close Sessions (D1)
Close sessions is a D1 destructive action: one confirm dialog, no typed-name gate. The title reads "Close sessions for N worktrees?" and the description spells out the cost:
Every grid and dock session for the selected worktrees will end. Scrollback is lost for each terminal.
The worktree directories and branches stay. Only the sessions end. The selected set is snapshotted at click time, so a stray click between opening the dialog and confirming can't retarget it.
Remove Worktrees (D3)
Remove worktrees is a D3 destructive action: a type-to-confirm dialog. The body lists every target with its branch name and a warning row for anything dirty or unpushed ("3 uncommitted files · 2 unpushed commits") so the blast radius is visible before you commit to it.
The description is the live consequence:
Each worktree directory is deleted from disk and the branch worktree association is removed. Uncommitted changes are discarded.
You confirm by typing the count, not a branch name: 3 worktrees for three targets, 1 worktree for one. Confirm stays disabled until it matches.
If your selection includes the main worktree, the description says how many targets were excluded instead. Main is filtered out of bulk remove the same way it is protected from single delete.
Removals run four at a time with a 30-second per-item timeout. Each follows the same pipeline as a single delete, including stopping a dev server before git worktree remove: on Windows the dev server's directory lock would otherwise block the removal outright. A hung item can't freeze the confirm button: the timeout releases it and a toast says the run aborted.
What Happens Afterwards
Deleting several worktrees at once collapses into a single summary row and a single inbox entry, rather than one of each per worktree. A bulk triage pass doesn't bury the inbox in near-identical notifications.
Removals that leave live agents behind produce deleted-worktree cards in the sidebar: the terminals keep running and can be dragged onto a live worktree during the countdown. Bulk triage is exactly the case that hits this, so it is worth knowing the sessions are recoverable for a minute rather than gone. Once two or more pile up they collapse into a single group row with one bulk clear.
Abandoning a delete restores that worktree's terminals.