---
name: coordinate-a-staged-code-rewrite-with-planner
description: "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."
license: CC-BY-4.0
compatibility: "Needs access to: GitHub, Terminal, Docs, Google Sheets."
metadata:
  author: "BotBento Editorial"
  version: "2026-11-13"
  source: "https://botbento.com/usecases/coordinate-a-staged-code-rewrite-with-planner/"
  kind: workflow
  hermes:
    tags: ["code-migration", "multi-agent", "code-review", "testing", "token-usage"]
    category: coding
---
# Coordinate a staged code rewrite with planner and reviewer roles

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

## When to use

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.

## Steps

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

## Instructions

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.

## Source

Summarized in our own words from [Rewriting Prime Agent in Rust](https://news.ycombinator.com/item?id=50027694) (Hacker News, checked 2026-11-13). Any results described there are the authors’ own.

From the BotBento use-case directory: https://botbento.com/usecases/coordinate-a-staged-code-rewrite-with-planner/. Licence: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
