Goal
Align basectl clean with the documented completed-run retention contract and Base's destructive-command safety standard.
Background
--keep-last excludes run bundles whose run.json status is running, but --older-than scans the same runs without applying that check. An old active bundle is therefore selected for deletion.
The command also performs deletion by default whenever --older-than or --keep-last is supplied. Base standards require destructive operations to be dry-run by default or require an explicit confirmation flag such as --yes.
Relevant code and docs:
Scope
- Exclude status=running bundles consistently from age and count retention.
- Make deletion dry-run by default or require --yes for real deletion.
- Provide explicit reporting for retained active bundles.
- Keep stale-run recovery separate and intentional.
- Update help, docs, tests, and completions for the chosen consent contract.
Acceptance Criteria
- --older-than never deletes a bundle whose metadata says running.
- --keep-last and --older-than use consistent completed-run semantics.
- A command without explicit deletion consent cannot remove artifacts.
- Dry-run output identifies exactly what would be removed and what active state was retained.
- Combined retention criteria remain deterministic and deduplicated.
Validation
- Focused base_clean pytest tests for running and completed bundles.
- Focused clean BATS/help/completion tests.
- Isolated-cache dry-run and consent smoke tests.
- env -u BASE_HOME ./bin/base-test
- git diff --check
Non-Goals
- Do not automatically classify an old running bundle as stale.
- Do not delete the append-only history index.
- Do not change unrelated branch/worktree pruning contracts.
Project Fields
- Status: Ready
- Priority: P2
- Area: Runtime
- Initiative: Contract Hardening
- Size: S
Agent Assignment
Goal
Align basectl clean with the documented completed-run retention contract and Base's destructive-command safety standard.
Background
--keep-last excludes run bundles whose run.json status is running, but --older-than scans the same runs without applying that check. An old active bundle is therefore selected for deletion.
The command also performs deletion by default whenever --older-than or --keep-last is supplied. Base standards require destructive operations to be dry-run by default or require an explicit confirmation flag such as --yes.
Relevant code and docs:
Scope
Acceptance Criteria
Validation
Non-Goals
Project Fields
Agent Assignment