PIMP MY IDEBack to dispatches
October 10, 2026 / agent sessions / worktrees

Do not tow the branch with the engine running.

Agent cleanup now belongs inside the editor. The safe version still checks the live process, working tree, branch, and session record as four different things.

Closing a session view does not prove its commands stopped. A merged pull request does not prove its worktree is clean. Inspect both before the tow hook moves.

Cleanup has entered the editor

Visual Studio Code 1.141 adds a worktree cleanup editor for inactive agent sessions. It can filter by inactivity and size. It can also configure automatic cleanup for sessions whose pull requests were merged.[1]

The release notes state what cleanup does. It marks selected sessions done and deletes their worktrees. Restoring a session can recreate its worktree. Active, running, needs-input, and pinned sessions are protected.

The cleanup button joins two records. One belongs to the agent session. The other belongs to Git.

The window is no longer the process

VS Code's Agent Host is a dedicated process that owns agent sessions. A session can continue after its original folder or editor window closes. Several clients can connect to that host while the session remains one live object.[2]

Version 1.141 also adds a Background Shells list for Copilot harness sessions. It shows commands that still run while the agent takes other steps.[1] That list matters during cleanup because a quiet chat panel is no longer proof of a quiet machine.

Git keeps its own ledger

Git describes a linked worktree as a working tree plus administrative metadata. git worktree list reports the checked-out revision, branch, lock state, and whether an entry is prunable. A worktree lock prevents pruning, moving, and deletion.[3]

git worktree prune removes stale administrative records. git worktree remove removes a linked working tree. They are not the same operation. Git also refuses to remove a dirty worktree unless force is used. A cleanup interface should keep these differences visible instead of compressing them into one storage number.

Inspect in the order damage can happen

Check the process first. A background command can still write into the tree. Check the tree second for edits and untracked files. Check the branch third for commits that exist only locally or changes that never reached the intended target. Close the session record last, after the work has an owner and a recovery route.

Age and disk size can sort the queue. They cannot make the disposal decision. A two-day-old clean worktree tied to a running migration deserves a hold. A month-old worktree with an unpushed fix deserves an owner.

Keep the delete command off the checklist

The tow yard below is a teaching fixture. It never deletes a worktree. It produces a review sheet with read-only Git checks and placeholders for the live shell record, exact path, revision, and recovery owner.

Use the sheet before the editor's cleanup action or a manual Git removal. The final state says review candidate, not safe to delete. Real removal still needs evidence from the named host and repository.

Interactive teaching fixture

Worktree tow yard

Traditional purpose: decide whether an old agent worktree can be cleaned up. This version joins process, tree, branch, and session checks on one physical gate and writes a review sheet.

ProcessTreeBranchRecord

Inspection lanes

These are fixture states, not readings from your machine. Move each native radio control to see why a worktree stays parked.

Lane 1Process
Lane 2Tree
Lane 3Branch
Lane 4Record

Read-only Git preflight

Set WT to the exact linked-worktree path. Save the output with the review record.

git worktree list --porcelain
git -C "$WT" status --short
git -C "$WT" branch --show-current
git -C "$WT" log --oneline '@{upstream}..' 2>/dev/null
HOLD IN YARD4 blockers open

Gate readout

A live shell, dirty tree, local work, and missing owner all block review.

Process / running
Tree / dirty
Branch / local
Record / open
HOLD4 blockers
WORKTREE STAYS PARKEDReview the live process before touching the tree. Preserve files and local commits before closing the session record.
Sources read / October 10, 2026 UTC

Source log

Open the evidence boundary
  1. Visual Studio Code 1.141 release notes, released October 7 and read October 10, 2026. This supports the worktree cleanup editor, inactivity and size filters, automatic cleanup setting, protected session states, background-shell list, and restore behavior.
  2. Visual Studio Code, "Introducing the Agent Host for persistent, portable agent sessions", published August 26 and read October 10, 2026. This supports the dedicated host process, session ownership, persistence after a folder or window closes, and synchronized clients.
  3. Git documentation, "git-worktree", read October 10, 2026. This supports linked-worktree metadata, list output, locks, pruning, removal behavior, repair, and the dirty-worktree refusal.
  4. Hacker News discussion, "Nix wrote half of my debugger", read October 10, 2026. The linked article was also read during this editorial pass. It informed the broader review of reproducible developer tooling but does not support the worktree cleanup claims above.
  5. GitHub Trending, read October 10, 2026. It was used for discovery during this pass. Trending placement is not evidence of quality or safety.

Evidence boundary: Pimp My IDE read the named documentation and release notes. We did not enable automatic worktree cleanup, create a Copilot harness session, or delete a worktree. The interactive states are invented. The review sheet contains no removal command.