Skip to content

Reclaim agent git worktrees stranded inside live workspace clones #435

Description

@blooop

Destination

dl --prune reclaims the agent git worktrees under .claude/worktrees/ inside
clones it keeps, without ever losing work or collecting a worktree that is in use.
Done looks like: a dry run that names the bytes, unregistered and prunable
worktrees removed by default, locked ones and ones carrying unpushed commits
reported and skipped unless an explicit flag says otherwise, git worktree prune
run in the clone so metadata and disk do not drift, and the bytes visible in
dl --ls --size before they are a full disk.

Notes

Single-ticket map: known work, no fanning. The spec is #426's Asks list, written
by whoever measured the 104 GB, so there is nothing to decide about what.

Two things a resuming session needs to know:

  • The word "worktree" is already taken in this codebase. WorktreeInfo
    (devlaunch-core/src/domain/model.rs) is devlaunch's legacy name for a
    workspace clone of one branch
    , and PrunePlan::stale_records is a list of
    those. It has nothing to do with the git worktrees this ticket is about. Any
    new type needs a name that does not collide.
  • The host cannot resolve the registered paths, because the worktrees were
    created inside the container and registered as /workspaces/<id>/.... The
    branch refs still live in the clone, so reachability is checkable from the
    host; git worktree remove is not.

Skills this calls for: wf-tdd then wf-review, and constructive-modeling
for the three-category classification, since the surrounding flow models plans
as values whose illegal states are unrepresentable (PrunePlan's fields are
private for exactly that reason).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions