code-remover
Code remover — evidence-based dead-code PR
Finds code nothing calls, tries hard to prove it IS used, deletes only what survives — one commit each, suite green after every one — and writes a PR a reviewer can check line by line. Two human gates; dry_run stops before any push.
| Source | templates/code-remover/workflow.yaml |
| Category | development |
| Trigger | manual (wfx run) · schedule 0 6 * * 1 |
| Steps | 13 |
| Human approval before | remove, publish |
| Providers named | claude-cli, codex-cli |
Use it
Section titled “Use it”wfx templates code-removerwfx new code-remover --as my-code-removerwfx dryrun my-code-removerWhat it does
Section titled “What it does”Evidence-based dead-code removal. Machine finders (deadcode, staticcheck U1000, go mod tidy -diff, knip) inventory candidates; machine checks search every tracked file, call shapes, indirect use and history; an agent tries to prove each one is used; a calibrated classifier scores what is left and a decision table decides remove / keep / bug / needs-a-human. After a person approves the plan, each removal is its own commit with the suite green after it, re-proven independently, reviewed by a different model, and described in a PR whose every claim is checked against the evidence. Nothing is pushed until a person approves.
What you fill in
Section titled “What you fill in”- scope: point it at one module or directory — cleanup agents do best on a portion of the repo
- the publish step’s base branch, if your default branch is not what
ghreports - TYPESAFE_API_KEY in the env store (wfx env set TYPESAFE_API_KEY) for the calibrated verdicts
Inputs
Section titled “Inputs”| Input | Type | Default | Required | Meaning |
|---|---|---|---|---|
repo_path |
string | |||
repo_url |
string | |||
base_branch |
string | |||
scope |
string | "." |
||
max_removals |
integer | 10 |
||
pr_prefix |
string | "[dead-code]" |
||
dry_run |
boolean | true |
||
isolate |
boolean | true |
| # | Step | Kind | Skills | Gates |
|---|---|---|---|---|
| 1 | baselineBaseline build and test counts |
shell (run:) |
exitCode = 70 → failexitCode = 78 → skip to report |
|
| 2 | inventoryInventory candidates (dead-code-finder) |
shell (run:) |
exitCode = 70 → failexitCode = 78 → skip to report |
|
| 3 | checksMachine usage checks |
shell (run:) |
exitCode = 70 → fail |
|
| 4 | proveProve each candidate IS used (usage-prover) |
agent on claude-cli |
usage-prover repo-navigator |
|
| 5 | planJudge and plan (JEV + decision table) |
shell (run:) |
exitCode = 70 → failexitCode = 78 → skip to report |
|
| 6 | removeRemove the approved candidates (safe-remover) |
agent on claude-cli |
safe-remover |
human approval first |
| 7 | verifyProve the branch (before vs after) |
shell (run:) |
exitCode = 70 → fail |
|
| 8 | reviewAdversarial review on a different model (change-reviewer) |
agent on codex-cli |
change-reviewer |
approved = false → needs_input |
| 9 | write_prWrite the cleanup PR (cleanup-pr-writer) |
agent on claude-cli |
cleanup-pr-writer |
|
| 10 | claimsRe-check every claim (JEV) and the numbers |
shell (run:) |
exitCode = 20 → needs_inputexitCode = 70 → fail |
|
| 11 | dry_run_stopStop here on a dry run |
shell (run:) |
exitCode = 78 → skip to report |
|
| 12 | publishPush and open the PR (pr-publisher) |
agent on claude-cli |
pr-publisher |
human approval first |
| 13 | reportReport |
shell (run:) |
Human gates
Section titled “Human gates”removewaits forwfx approve <run-id>(orwfx reject <run-id> -m "why") before it runs.publishwaits forwfx approve <run-id>(orwfx reject <run-id> -m "why") before it runs.reviewpauses for input whenapprovedisfalse: “The codex reviewer blocked the branch: {{ .Output.verdict }}”. Resume withwfx answer <run-id> -m "...".claimspauses for input whenexitCodeis20: “PR claims not supported by the evidence — {{ .Output.stdout }}”. Resume withwfx answer <run-id> -m "...".