shrike clean --base <ref> removes code that this branch made unreachable, anywhere in the repository — including files the branch never touched. Without --all, clean is the same verified workflow as prune; prune remains available under its original name.
Before you start
- A base ref present locally, such as
origin/main. Fetch it first withgit fetch origin mainif needed. - A clean working tree. Worktree mode refuses a dirty tree; use
--in-placewith--allow-dirtyonly when you accept in-tree verification. - At least one project check, configured or discoverable from
package.jsonscripts by tier. With none, the command exits4. - Agreement on the verified caveat: 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. See what the branch orphaned
git merge-base <base> HEAD and falls back to git rev-parse <base>. When --base is omitted, it tries origin/main, main, origin/master, then master. If the ref cannot be resolved, the command exits 4.
2. Review the plan
Plan <id>: N symbols, N files, N lines, one line per batch, and a Blocked count when applicable. The plan is stored under .shrike/ for clean, prune, and verify.
A dry run is also available:
0 when the plan is empty or 1 when it contains batches. With --json it prints the plan object.
If a symbol is listed as blocked or you want to understand why it is live, ask for the proof:
why --json is exactly the engine’s proof object. Blocked items are never deleted automatically.
3. Run the verified cleanup
- Shrike resolves the base, analyzes the merge base and
HEAD, and asks the engine for the branch orphan delta and deletion plan. - A branch worktree is created under
.shrike/worktrees/, and the baseline checks run there before any edit. - Each batch is applied in the worktree and the checks run again. A regression triggers bisection; only the passing remainder is committed.
- Passing batches are committed on
<branchPrefix>-<plan-id without the plan_ prefix>(default prefixshrike/cleanup). The temporary worktree is removed after the run; the commits and receipts stay. - Add
--prto push the branch and open a draft PR withgh.
--json returns { plan, outcome, receipts, branch, worktree }.
Difference from current-state cleanup
Do not use
--all as a substitute for reviewing the branch delta. It can remove code that was already dead before your change.
Options
--no-checks is rejected: verified deletion needs at least one check.
4. Inspect and open the PR
.shrike/receipts/ record the base and head commits, plan and batch IDs, removed symbols and files, per-check results, outcome, rejected items, policy, content hash, and a recovery reference when applicable. The PR body is generated from the same receipts when you use --pr.
The cleanup branch is local unless --pr pushes it. Re-run the project’s checks before review; the receipt records what Shrike ran.
Failure and recovery
If the command exits
5, do not edit the worktree. Run the printed restore command:
Limits and safety
- Only items the engine proves orphaned by this branch are candidates. Protected items, unknown edges, generated files, and public API stay protected.
- Dependencies are advisory. This command never edits
package.jsonfor dependency findings. - A build graph can add liveness evidence but can never authorize a deletion.
- Shrike does not commit to
mainand does not open a PR unless you pass--pr.
Next
- Verified pruning — the batch, check, bisection, and receipt contract.
- Cleanup report — read the branch report.
- GitHub Action — run the delta or a verified prune in CI.