Skip to content

How zap decides

cloudranger edited this page Nov 14, 2026 · 1 revision

zap gives every linked worktree one status.

Status Meaning Removed by default?
merged Its work is already in the target branch Yes
empty It never got a commit of its own Yes
missing Git still lists it, but its folder is gone Yes
gone Its branch was deleted on the remote, which often happens when a pull request is merged Only if you add "gone" to rules
idle Unmerged and untouched for idle_after Only in the picker, and only if you add "idle"
active Anything else Never

The status tells you where the work is. zap runs the safety checks to decide whether it may remove the folder.

The target branch

zap measures merges against origin/HEAD, then main, then master, whichever it finds first. To use another branch, pass --target develop or set target in the .zap file.

How it spots a merge

zap tries each of these in order and stops at the first that passes:

  • Fast-forward or merge commit: the branch tip is already in the target.
  • Rebase merge: every commit on the branch has an equivalent patch in the target.
  • Squash merge: merging the branch into the target would change nothing.
  • Pull request: with --gh, GitHub reports a merged pull request whose head commit is the branch tip.

zap explain <path> shows each of these checks for one worktree. See Why zap chose that status.

Merges you haven't pulled yet

If you merged a pull request on GitHub but haven't pulled, your local main doesn't have the work yet, so zap reports the worktree as active. Either pull first, or add:

  • --fetch to fetch every remote before checking
  • --gh to ask GitHub about merged pull requests through the gh CLI

Which agent made it

zap guesses the AGENT column from the folder:

Folder Agent
.claude/worktrees Claude Code
~/.codex/worktrees Codex
~/.cursor/worktrees Cursor
conductor/workspaces Conductor
.t3/worktrees T3 Code

Anything else shows -. The AGENT label has no effect on the status.

Clone this wiki locally