Skip to content

Add manual cleanup command for Agents Window worktrees #338039

Description

Feature request

Provide an Agents: Clean Up Session Worktrees... command so users can inspect and reclaim worktree storage without waiting for the automatic worktree-limit prompt.

Proposed behavior

  • Make the command available in the Agents Window when the experimental worktree cleanup feature is enabled.
  • Show every safe cleanup candidate: completed, inactive, non-archived sessions that exclusively own their worktrees.
  • Clearly explain why each row is or is not recommended:
    • old, unpinned sessions are recommended and selected by default;
    • recent sessions remain available but are not selected automatically;
    • pinned sessions remain available but are not selected automatically.
  • Show measured worktree disk usage when available.
  • Allow users to select additional recent or pinned sessions intentionally.
  • Keep active, running, archived, and shared-worktree sessions out of the cleanup list.
  • Explain when no worktrees are eligible instead of silently doing nothing.

The automatic prompt should continue to appear only at the unique-worktree threshold and only when at least one recommended old session exists.

Related implementation: #338033

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions