Problem
Human reviewers keep flagging nits the pipeline should never produce: dead code left after refactors, half-migrated call sites, redundant aliasing, oversized comments (mined from apify-mcp-server PRs #1077, #1073, #1081). Today these are only detected — a reviewer finds them and an inner-loop iteration fixes them. Cheaper to not generate them: a fresh-context simplification pass right after implementation, before reviewers see the diff.
A separate pass beats "implementer, also simplify" because the implementer is anchored on its own code; a fresh context isn't.
Proposal
New optional refiner stage between the implementer and the oracle/review steps:
- Role: same write access as implementer; input
2-design.md + the working diff; preserves functionality exactly — clarity/consistency/dead-code-removal only; writes a one-line note into iter-N/claim.md (or its own small file) listing what it touched.
- Engine: vendor Anthropic's official
code-simplifier agent (claude-plugins-official) as _vendored/code-simplifier/ — VENDORED.md handles attribution — with a scope line binding it to the repo's conventions doc and "clarity outranks line count" (no nested ternaries, no dense one-liners, no concern-merging).
- Wiring:
registry.base.json stage_roles + role-table row + model tiering (sonnet; skip for trivial tier) + one procedure line in the inner loop (step 5, after implementer, before oracle capture so the oracle validates the refined code).
- Reviewers then review the refined diff; nothing bypasses review.
Open questions for the design gate: default-on for which tiers; whether the refiner may touch test files; interaction with final_review_rounds fix passes (probably: refiner runs only on full implementer iterations, not targeted fix rounds).
Depends on the standing-checks/scope-split PR (branch stacked on #7) landing first.
Problem
Human reviewers keep flagging nits the pipeline should never produce: dead code left after refactors, half-migrated call sites, redundant aliasing, oversized comments (mined from apify-mcp-server PRs #1077, #1073, #1081). Today these are only detected — a reviewer finds them and an inner-loop iteration fixes them. Cheaper to not generate them: a fresh-context simplification pass right after implementation, before reviewers see the diff.
A separate pass beats "implementer, also simplify" because the implementer is anchored on its own code; a fresh context isn't.
Proposal
New optional
refinerstage between the implementer and the oracle/review steps:2-design.md+ the working diff; preserves functionality exactly — clarity/consistency/dead-code-removal only; writes a one-line note intoiter-N/claim.md(or its own small file) listing what it touched.code-simplifieragent (claude-plugins-official) as_vendored/code-simplifier/— VENDORED.md handles attribution — with a scope line binding it to the repo's conventions doc and "clarity outranks line count" (no nested ternaries, no dense one-liners, no concern-merging).registry.base.jsonstage_roles+ role-table row + model tiering (sonnet; skip fortrivialtier) + one procedure line in the inner loop (step 5, after implementer, before oracle capture so the oracle validates the refined code).Open questions for the design gate: default-on for which tiers; whether the refiner may touch test files; interaction with
final_review_roundsfix passes (probably: refiner runs only on full implementer iterations, not targeted fix rounds).Depends on the standing-checks/scope-split PR (branch stacked on #7) landing first.