Problem
The current worktree cleanup UX exposes a safe-looking review surface for explicit cleanup_eligible worktrees, but does not provide an obvious symmetric apply path for exactly that reviewed set.
Observed flow:
workspace worktree add warned that the workspace had hundreds of worktree-like directories and suggested cleanup dry-runs.
- Ran:
studio wp datamachine-code workspace worktree cleanup --dry-run --inventory-only --skip-github --format=json
- The preview reported:
would_remove: 38
cleanup_buckets.explicit_cleanup_candidates: 38
candidates_by_signal.cleanup_eligible: 38
- User approved cleaning those 38 explicit cleanup-eligible worktrees.
- Tried to apply the same bounded inventory cleanup without
--dry-run:
studio wp datamachine-code workspace worktree cleanup --inventory-only --skip-github --format=json
- DMC refused with:
Inventory-only cleanup is review-only. Pass --dry-run, then run full cleanup to apply a reviewed plan.
That refusal is reasonable for safety, but it leaves the operator without a clear way to apply exactly the reviewed cleanup_eligible set.
Why this matters
The recommended next step, "run full cleanup," can expand the decision surface from:
- the 38 explicit lifecycle cleanup candidates just reviewed
into:
- a broader merge/PR signal scan with different candidate discovery behavior.
That makes the safe review surface and safe apply surface asymmetric.
Desired behavior
DMC should offer a clear bounded apply path for the exact category that was reviewed.
Possible shapes:
studio wp datamachine-code workspace worktree bounded-cleanup-eligible-apply --dry-run --limit=50
studio wp datamachine-code workspace worktree bounded-cleanup-eligible-apply --limit=50
or a run-id based workflow:
studio wp datamachine-code workspace cleanup plan --mode=cleanup-eligible --format=json
studio wp datamachine-code workspace cleanup apply <run-id>
Acceptance criteria
- A dry-run that reports explicit
cleanup_eligible worktrees prints the exact safe apply command for that same reviewed class.
- The apply path only removes lifecycle
cleanup_eligible rows unless the operator explicitly asks for broader full cleanup.
- Apply revalidates dirty worktree, unpushed commits, containment, and primary-safety before deletion.
- Apply does not discover unrelated full-cleanup candidates as part of applying the reviewed bounded set.
- Artifact cleanup remains separate and does not remove dependencies from active worktrees by default.
- Error messages avoid "run full cleanup" when the operator is trying to apply a bounded cleanup-eligible preview.
Related operator note
Artifact cleanup dry-run also reported reconstructable artifacts in active worktrees, including active minion worktrees. That behavior may be technically correct, but should remain opt-in/separate from worktree deletion so cleanup during active parallel work does not disrupt running sessions.
Problem
The current worktree cleanup UX exposes a safe-looking review surface for explicit
cleanup_eligibleworktrees, but does not provide an obvious symmetric apply path for exactly that reviewed set.Observed flow:
workspace worktree addwarned that the workspace had hundreds of worktree-like directories and suggested cleanup dry-runs.would_remove: 38cleanup_buckets.explicit_cleanup_candidates: 38candidates_by_signal.cleanup_eligible: 38--dry-run:That refusal is reasonable for safety, but it leaves the operator without a clear way to apply exactly the reviewed
cleanup_eligibleset.Why this matters
The recommended next step, "run full cleanup," can expand the decision surface from:
into:
That makes the safe review surface and safe apply surface asymmetric.
Desired behavior
DMC should offer a clear bounded apply path for the exact category that was reviewed.
Possible shapes:
or a run-id based workflow:
Acceptance criteria
cleanup_eligibleworktrees prints the exact safe apply command for that same reviewed class.cleanup_eligiblerows unless the operator explicitly asks for broader full cleanup.Related operator note
Artifact cleanup dry-run also reported reconstructable artifacts in active worktrees, including active minion worktrees. That behavior may be technically correct, but should remain opt-in/separate from worktree deletion so cleanup during active parallel work does not disrupt running sessions.