Visual Studio Code 1.141 added a cleanup editor for inactive agent-session worktrees. It shows their size, filters by inactivity, and can remove selected worktrees. Active, running, needs-input, and pinned sessions are protected. A removed session can recreate its worktree when restored later.
Disk cleanup is the visible problem. Custody is the real one.
A worktree isolates code changes. It does not isolate every effect of the task. Package caches may be shared. A development server may still own a port. A database may sit outside the tree. An untracked recording can be the only copy of a reproducer. Deleting the directory answers none of those questions.
Retire the session, not just the folder
Git draws a useful line. git worktree remove refuses an unclean worktree unless the operator forces it. git worktree lock protects a tree that should not be pruned. The porcelain listing gives scripts a stable inventory format. Those controls concern Git state. Your project still owns processes, local services, ignored files, and review status.
The retirement contract needs four checks. Confirm that the accepted change landed. Confirm that tracked and untracked local state has a destination. Stop or transfer the task's processes and services. Then record whether the session can be reconstructed from a commit, pull request, or saved artifact.
Preview before pressure
A new Show HN project called Fresh makes the cleanup plan visible before it acts. Its repository says uncommitted changes stop the run and branches with unmerged work are kept. The project also supports follow-up commands after cleanup. That is a useful direction, but it does not make every repository safe to clean. The commands and project rules still need review.
The broader lesson is simple. Automation should make the retirement test easier to inspect, not turn deletion into a reflex. Size and age can nominate a worktree. Merge state, local residue, process ownership, and a reconstruction handle decide whether it should leave.