Problem
Old clean worktrees are easy to forget. The current cleanup surface can identify candidates, but DMC should make age and stale lifecycle state visible enough that hundreds of stale directories do not accumulate silently.
Proposed solution
Add age/staleness reporting to workspace worktree listing and cleanup.
Useful fields:
created_at from DMC metadata when available.
last_touched_at from metadata, git activity, or filesystem mtime.
age_days.
stale_reason such as older_than_threshold, merged_pr, closed_pr, missing_metadata, dirty, unpushed_commits.
estimated_size_bytes.
CLI behavior
Add filters/sorting such as:
wp datamachine-code workspace worktree list --stale --format=json
wp datamachine-code workspace worktree cleanup --dry-run --older-than=14d --sort=size
wp datamachine-code workspace worktree cleanup --dry-run --only=stale
Acceptance criteria
- List output can show stale worktrees without running destructive cleanup.
- Cleanup output can sort candidates by age and by size.
- Worktrees with missing metadata are not silently ignored; they get a remediation hint.
- Human output includes a top-N summary: biggest stale worktrees and oldest stale worktrees.
- JSON output includes age and size fields for automation.
Problem
Old clean worktrees are easy to forget. The current cleanup surface can identify candidates, but DMC should make age and stale lifecycle state visible enough that hundreds of stale directories do not accumulate silently.
Proposed solution
Add age/staleness reporting to workspace worktree listing and cleanup.
Useful fields:
created_atfrom DMC metadata when available.last_touched_atfrom metadata, git activity, or filesystem mtime.age_days.stale_reasonsuch asolder_than_threshold,merged_pr,closed_pr,missing_metadata,dirty,unpushed_commits.estimated_size_bytes.CLI behavior
Add filters/sorting such as:
Acceptance criteria