You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(repos): remove worktrees whose commits are merged without a manual prune #2338
Worktrees of merged work stay on disk. devops repos worktrees prune exists and is safe, but nobody runs it: it is a dry run by default and no routine calls it.
Evidence from devops repos worktrees status --json on this host:
125 worktrees besides the main one. 57 of them are contained in main (their commits are merged), and 3 are dirty.
The directories hold a full virtual environment each: the 107 worktrees under ~/.gemini/antigravity/worktrees/ use 123 GB, the 12 under .data/agent/worktrees/ use 13 GB, and the 3 under .claude/worktrees/ use 3.5 GB.
devops repos worktrees status takes 14 s because it inspects every entry, and git worktree list grows with every worktree. Every agent pays this cost.
Proposed Solution & Architectural Design
Remove a worktree that is clean, not locked, and contained in origin/main, without a manual run of prune.
The design of the pull request chooses where the removal runs. The candidates are the end of devops pr (when the pull request of the branch is merged), devops workspace clean, and the routine tasks in docs/ROUTINE_TASKS.md. The rule is the same in each: the worktree is clean, unlocked and contained, and the worktree of the current directory is never removed.
A worktree that is dirty, locked or not contained stays, and the command reports it.
--dry-run makes no change and lists the worktrees it would remove with their size.
Target Subsystem
SDLC, Git & PR Governance
Existing Tool Considered
git worktree prune removes only entries whose directory is gone. git worktree remove removes one worktree. Neither selects merged work. The existing devops repos worktrees prune already computes contained, so the change reuses it and adds no tool.
Activity
dan-petty commentedon Oct 27, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones on the board.
The candidate proposes a new feature to automate worktree cleanup based on merge status.This change improves repository maintenance and performance but is not critical for immediate operations.The change provides significant disk space savings and performance improvements for agents.Implementation requires integration with existing worktree management logic and proper handling of edge cases.Both items are about worktrees, but the candidate focuses on automatic cleanup while item #2337 addresses worktree creation and conflict prevention.feat(repos): make devops repos worktrees add remove merged worktrees …
chore(main): release 0.8.0 (#2383)