The new broom has a dashboard.
VS Code 1.141, released today, adds a worktree cleanup editor for inactive agent sessions. It can show storage use, filter by inactivity, remove selected worktrees, and configure automatic cleanup for sessions whose pull requests were merged. Active, running, needs-input, and pinned sessions are protected from cleanup.[1]
The feature addresses a real cost of parallel agents. Every isolated session can leave another checkout, dependency tree, generated file set, and build cache behind. A storage warning is useful. It is not a verdict about whether the work is disposable.
A stale session and a disposable patch are different facts.
Read the repository before the calendar.
An inactivity threshold can narrow the list. It cannot tell you whether an untracked fixture matters, whether a branch tip exists elsewhere, or whether a closed pull request was superseded rather than merged. Before cleanup, record the exact worktree path, session state, branch or detached commit, dirty-file summary, and review destination.
VS Code's session guide says that marking a worktree session done preserves its conversation and branch. It also says the editor commits uncommitted changes before removing the worktree, and leaves the worktree in place if preservation or removal fails.[2] That is a product contract worth checking. Keep an independent handle such as the resulting commit, a patch, or another repository backup when the changes matter.
Git has several kinds of cleanup.
git worktree remove removes a linked working tree. Git normally refuses to remove one with modified or untracked files unless force is used. git worktree prune removes stale administrative records for working trees that no longer exist. Locked worktrees are protected from pruning. These commands solve different problems.[3]
Do not translate a storage alert into rm -rf. Let the session manager finish its preservation path. Then inspect Git's view with git worktree list --porcelain. Use force only after the preservation record and deletion target have been reviewed.
Make automatic cleanup earn the key.
Start with manual cleanup on a small set. Exercise one clean merged session, one dirty session, one detached worktree, and one session that must stay pinned. Restore the cleaned session and confirm the checkout returns at the expected revision. Only then consider automatic cleanup.
Keep the rule narrow. A merged pull request is stronger than age alone, but the merge state still needs a repository and branch match. Save the policy, excluded states, preservation method, restore result, reclaimed bytes, and failures. A cleanup job that cannot produce that receipt should remain manual.
Run this impound check.
WORKTREE IMPOUND CHECK 1. Freeze new writes to the selected session. 2. Record session, repository, path, branch, and commit. 3. Inspect modified and untracked files. 4. Preserve valuable changes under an independent handle. 5. Confirm the review or merge outcome against the same branch. 6. Clean through the owning session manager. 7. Restore one cleaned session and verify its revision. 8. Record reclaimed space and any cleanup failure.