Canonical: https://botbento.com/usecases/coordinate-a-staged-code-rewrite-with-planner/
Format: Markdown representation of the public HTML page.

# Coordinate a staged code rewrite with planner and reviewer roles

[Coding](https://botbento.com/usecases/coding/) · Advanced

Split a language port into plan, implement, review and verify passes.

A bot takes a request to port a codebase into another language and runs it as a pipeline instead of one long pass. It drafts a module-level migration plan, writes each ported module, reviews the diff against the original behavior, and verifies with build and test commands. It keeps a per-stage log of input and output token use so the effort can be costed, and it stops short of merging or publishing anything.

## Quick answers

**What does it do?** Split a language port into plan, implement, review and verify passes. Result: Migration report with per-stage token.

**What does it need?** Tools: GitHub, Google Sheets, Terminal, Docs. Advanced: more tools and setup. The prompt includes an approval step.

**How do I run it?** When you ask: Port request received. Copy the prompt below into a bot in BotBento.

## How it works

1. When you ask: Port request received
2. Then: Run plan, implement, review, verify
3. Result: Migration report with per-stage token

## Prompt to start with

```text
You coordinate a staged code rewrite. When given a repository and a target language, first produce a module-level migration plan that lists dependencies and ordering. Then, for each module, write the ported code, review the diff against the original behavior, and verify with the project's build and test commands before moving on. Record input and output token use for each stage separately and summarize it at the end. Do not push, merge, open pull requests or delete branches without the user's explicit approval.
```

## Tools it uses

GitHub, Terminal, Docs, Google Sheets

## Works with

BotBento

## Tags

code-migration, multi-agent, code-review, testing, token-usage

## Source

[Rewriting Prime Agent in Rust](https://news.ycombinator.com/item?id=50027694) — Hacker News · checked 2026-11-13

Summarized in our own words. Any results described there are the authors’ own, not measured by BotBento.

Verified 2026-11-13: passed every automated gate and a second-model review (kimi-code/k3.1-pro). Automated, not human review. [How verification works](https://botbento.com/usecases/verification/)

By BotBento Editorial · Added 2026-11-13 · Updated 2026-11-13 · [Suggest a correction](https://botbento.com/contact/)

## Related use cases

- [Legacy code rewrite support with behavior mapping](https://botbento.com/usecases/legacy-code-rewrite-support-with-behavior-mapping/) — Map old behavior first, then draft refactors for engineers to review
- [Plan supervised code changes in a repository](https://botbento.com/usecases/plan-supervised-code-changes-in-a-repository/) — Restate a feature request, draft a plan, and review edits before commit
- [Fix bugs from issue reports with tests](https://botbento.com/usecases/automated-test-driven-bug-fixing-and-pull/) — Reproduce an issue, write a failing test, patch the code, and prepare a PR for review
