| name | revamp |
| description | Run a large rewrite, port, or migration using the Bun-in-Rust playbook -- baselines, mechanical-first translation, adversarial diff review, fix-the-process. Use on "rewrite X in Y", "port", "migrate the codebase", "revamp". |
| disable-model-invocation | true |
Revamp -- large rewrites that survive contact
Distilled from Bun's Zig-to-Rust 1.4 rewrite (https://bun.com/blog/bun-in-rust): 1,448 files, 64 parallel agents, 11 days, one coordinating human, zero deleted tests. The principles are language- and model-agnostic -- any executor model works (route per CLAUDE.md model routing; cross-model review applies as everywhere).
1. Baselines before any code
- Freeze a bug ledger: enumerate known defects in the current system first. Post-rewrite triage needs to distinguish "regression" from "was always broken".
- Benchmark the incumbent: throughput, memory, binary/bundle size, latency -- identical workload, identical hardware, recorded numbers. "Feels faster" is not evidence.
- Count the tests: record total assertions now; the rewrite exit gate asserts none were skipped, weakened, or deleted.
2. Tests are the contract, keep them implementation-independent
The suite must NOT be written in/coupled to the thing being replaced. Language-independent tests (e.g. TypeScript tests against a CLI/API surface) let you swap the engine underneath with confidence. If the suite is coupled, decouple it FIRST -- that is phase 0, not overhead.
3. Mechanical first, idiomatic later
Translate 1:1 -- "as if transpiled" -- preserving architecture, names, and structure. Refactor toward idiomatic patterns only AFTER parity is proven. Two transformations at once (port + redesign) makes every failure ambiguous. Big-bang beats incremental when temporary bridge code would outlive its welcome; incremental beats big-bang when the system must ship weekly -- pick deliberately and write the choice down.
4. Trial run before fleet
Port 3 representative files end-to-end with the FULL loop (translate -> compile -> adversarial review -> tests) before scaling to hundreds. The trial calibrates prompts, review checklists, and the work queue; scaling a broken loop scales the breakage.
5. Compiler/typechecker as the work queue
Drive the fleet off mechanical signals: cargo check/tsc error counts per module, ranked. Parallelize across worktrees (one per lane) so executors never collide; forbid executors from running any git command that isn't "commit this specific file" -- no stash, no reset, no cross-lane surgery.
6. Adversarial review with split contexts (non-negotiable)
Implementers see full codebase context; reviewers see ONLY the diff and are instructed to assume it is wrong. Fresh context prevents reviewer bias; this caught use-after-free and numeric bugs before compilation. Maps directly onto this harness's cross-model review: executor implements, a different model (or clean-context instance) attacks the diff.
7. Semantic-equivalence traps
Identical-looking constructs differ across stacks. Hunt deliberately for: assertion/debug constructs that erase side effects in release builds, integer overflow and bounds-check differences, default copy-vs-reference semantics, recursion/stack limits (test pathologically nested inputs, thousands deep), locale/encoding defaults. Every trap found becomes a fixture, not a note.
8. Fix the process, not the output
When an executor produces bad code, do not hand-fix it -- fix the prompt/checklist/queue that produced it and rerun. Hand-fixes don't scale past file ten; process fixes carry the remaining thousand. Human role: read validation reports, spot-check, verify tests weren't skipped in CI, press merge.
Exit gate