prune and clean --base are the same branch cleanup implementation; clean is the public name. Every prune example on this page works the same way with clean. For cleanup of code that already existed before this branch, see Current-state cleanup and clean --all.
Prerequisites
- A plan:
npx shrike plan --base origin/main— see Quickstart. - A clean working tree for worktree mode.
--allow-dirtypermits in-place verification, but worktree mode still refuses a dirty tree. - At least one verification check: either configured in
shrike.config.tsor discovered from repository scripts by tier. With none, the command exits4. - Acceptance of what “verified” means: the configured checks passed after removal relative to a baseline. It does not prove the code is semantically unused in production or that external consumers cannot import it.
1. Review the plan
Blocked list. Blocked items are reported with a reason and are not deleted. shrike proof <symbol> prints a witness path or proof trace for a symbol you are unsure about.
2. Run the verified cleanup
npx shrike prune --base origin/main is the same operation under the original name.
Expected human output includes one Verified <batch-id>: N symbols, N files. line per passing batch, then the branch and worktree path. With --json the result is { plan, outcome, receipts, branch, worktree }.
What happens, in order:
- Shrike re-plans against the same pair of snapshots and stores the plan.
- A baseline of the configured checks is captured (or reused) at
.shrike/baseline.jsonbefore any edit. - Each batch is applied in the worktree. The checks run again and are compared with the baseline by name, command, and signature.
- A regression triggers bisection: the failing units are reverted, the remainder is retried, and only passing edits are committed. Outcomes are recorded as
verified,flaky,rejected,interaction-failure,error, orrevert-failed. - Passing batches are committed on a branch named
<branchPrefix>-<plan-id without the plan_ prefix>(default prefixshrike/cleanup). Add--prto push the branch and open a draft PR withgh.
3. Read the receipts
.shrike/receipts/. Each one records the base and head commits, plan and batch IDs, build evidence, removed symbols and files, per-check results (status, baseline comparison, classification), the outcome, rejected items, the policy, a content hash, and a recovery reference when applicable. --json prints the whole receipt.
npx shrike verify --plan <plan-id> re-runs verification for a saved plan in a fresh worktree and writes new receipts. If the plan was computed on a dirty tree, or HEAD or the merge base no longer matches, verification exits 4 and asks you to re-plan.
4. Recover from a failed revert
Before each batch, Shrike writes a snapshot of the exact bytes of the files it can touch under.shrike/recovery/. When a revert fails, the error and JSON output include the snapshot path and a restore command:
Restored N files from <path>. The command restores only files listed in the snapshot and rejects absolute or traversal paths.
Limits and exit codes
- Items that are entries, public API, generated, unparsed, or reachable through an unknown edge are blocked, not deleted.
- A build graph can add liveness evidence but can never authorize a deletion.
- Shrike does not auto-commit to
main, and does not open a PR unless you pass--pr.
See Exit codes for the full matrix.
Next
- Branch cleanup — the public
cleanworkflow and draft PRs. - Current-state cleanup —
clean --all. - GitHub Actions or configuration.