Skip to content

Add build-cache hygiene with dry-run cleanup and retention policy for app-managed worktrees #422

Description

@baron

Impact

App-managed worktrees can leave behind large .build directories after branches are abandoned, merged, or no longer active. Developers can reclaim space manually, but ad-hoc deletion is risky: it is easy to remove build state from a dirty or actively used worktree.

The build-storm mitigation work adds build-cache visibility. The next step is a safe, explicit hygiene flow.

Current behavior

  • Build-cache size/footprint can be inspected.
  • There is no conductor-managed cleanup plan.
  • There is no retention policy.
  • There is no dry-run eligibility report explaining what is safe to remove.
  • Manual cleanup risks touching active, dirty, or in-progress worktrees.

Expected behavior

RepoPrompt CE should provide a safe build-cache hygiene flow for app-managed worktrees.

The default mode should be non-mutating and explain:

  • which .build directories exist
  • how large they are
  • whether they appear stale
  • whether they are eligible for cleanup
  • why a cache is skipped

Actual deletion should require explicit confirmation and should only delete build-cache directories, never source trees or git state.

Proposed scope

Add a conductor-native cleanup planning flow, likely as an extension of build-cache diagnostics.

It should classify worktree build caches using signals such as:

  • dirty vs. clean worktree state
  • active daemon jobs
  • live/bound agent sessions where available
  • branch/worktree staleness
  • age or last build activity
  • cache size

Safety rules should be conservative:

  • skip dirty worktrees
  • skip worktrees with active jobs
  • skip live/bound worktrees
  • never delete worktree source directories
  • require explicit confirmation for mutation
  • default to dry-run

Non-goals

Acceptance criteria

  • A dry-run command reports build-cache candidates with size, eligibility, and skip reason.
  • Dirty worktrees are never eligible for cleanup.
  • Worktrees with active daemon jobs are never eligible for cleanup.
  • Live or bound worktrees are skipped when that state is detectable.
  • Actual deletion requires explicit confirmation.
  • Cleanup removes only build-cache directories, not source trees or git metadata.
  • Post-clean output reports reclaimed space and skipped entries.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:worktreesGit worktree behavior and interfaceenhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions