Find the Git worktrees left behind.
Coding agents leave full checkouts and build output behind. residue finds linked Git worktrees, measures their disk use and explains which checks keep them from removal.
Install, then inspect
Homebrew · macOS and Linux
brew install whiteheap/tap/residue
residue needs Git 2.36 or later on PATH. Debian, Ubuntu, Fedora, Arch, prebuilt binaries and building from source are in the other ways to install. Downloads are on the latest release.
Look first
residue scan ~/src/app
~/src/app is an example path: replace it with your repository's path. scan only reads.
residue explain PATH
Replace PATH with one linked worktree's path to see every check, and why it passed or failed.
How it works
-
Find and measure.
residue inspects the linked worktrees Git lists for each repository, and their disk use.
-
Understand the decision.
Each worktree is a candidate, kept, or unknown, with the reason. A check residue could not complete keeps the worktree, the same as a failed one. What makes a worktree a candidate
-
Choose what happens next.
residue removeasks first, checks the worktree again, and hands the deletion togit worktree removewithout--force. With--trash, which--idleturns on, the worktree stays restorable until the trash is purged; otherwise Git deletes it. Read the plan and the limits first. What removal deletes, and what it keeps
residue watch can remove worktrees on its own when a branch lands or the disk runs low, and it deletes without the trash. It runs only when you start it or install it as a service; scan never turns it on. Reclaim storage automatically
Before you remove anything
residue can delete directories. Start with scan and explain, and read the removal limits before you use cleanup. Activity checks cannot see every process or a paused session, and a write can still happen after the final check. Reported reclaimable space is an estimate. residue runs as you; it is not a security boundary between users.