arXiv:2610.34633cs.SEOct 2026

Manuscript Offprint

arXiv:2610.34633

CodeMeepo: A Multi-Agent Workflow for Repository-Level Code Migration and Optimization

Farzad Habibi, Changrong Wu, Jinzhou Jiang, Guohan Lu

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Farzad Habibi*§, Changrong Wu†, Jinzhou Jiang†, and Guohan Lu‡§

*University of California, Irvine, †Microsoft, ‡OpenAI

*habibif@uci.edu, †{changrongwu, riffjiang}@microsoft.com, ‡lgh@openai.com

§All contributions were made while at Microsoft.

Abstract—Repository-level code migration rewrites an entire project in a new programming language while preserving its observable behavior. This task is challenging because behavior spans interdependent modules, dependencies and build infrastructure must be adapted to the target ecosystem, and the source code often serves as the only specification [1]–[3].

Large language model agents can now attempt these migrations end to end [4], [5], but three challenges remain. First, an agent that writes both the translation and its acceptance tests may overlook the same requirements in both, leaving missing or incorrect behavior undetected. Second, large repositories can exceed a model's context window, and dividing the work into smaller tasks does not ensure that all required behavior is migrated. Third, even behaviorally correct translations may be slower than the original implementation.

We present CODEMEEPO, a multi-agent pipeline designed for complete and efficient migration of large repositories. Each milestone is evaluated against a fixed external oracle that the agents neither author nor modify. A separate parity assessment compares source and target components within the migration scope and adds identified gaps back into the plan as required work. Ordered milestones limit the scope of each task, while cumulative regression checks guard against breaking previously migrated behavior. A benchmark-guided optimization phase addresses performance, followed by full-suite conformance testing and repair. Eight specialized agent roles communicate through file artifacts, while a deterministic state machine governs repair, deferral, scope changes, and termination.

On nine subjects in three language pairs, CODEMEEPO achieves the best pass rate on every subject and passes 18% more tests than a state-of-the-art multi-agent baseline using the same model. On a production daemon, its optimization phase then improves half of the benchmarks, by 25% on average.

Index Terms—multi-agent workflows, software evolution, repository-level code migration, large language models, test oracles, validation

I. INTRODUCTION

Programming-language migration allows organizations to maintain software when its original implementation no longer meets their security, interoperability, or maintainability requirements [1]. Organizations move business applications from COBOL to Java [6], [7], port components between general-purpose languages, and replace C with memory-safe Rust [3]. Such changes are not simply syntactic translations. They must preserve established behavior while replacing dependencies, interfaces, build procedures, and deployment assumptions. Across language pairs, practitioners report that the dominant cost is not writing the target code but establishing that it behaves like the original [2].

Figure

Fig. 1. Repository-level code migration: task and challenges.

Large language models (LLMs) have expanded the range of migration tasks that can be automated. Research has progressed from translating isolated functions [8], [9] to planning repository-wide edits [10] and translating interdependent project components [4], [5]. Multi-agent approaches distribute the work across specialized roles, while retrieval can supply migration-specific knowledge [11]. These developments make repository-level migration a promising application of agentic software engineering, and raise the question this paper addresses: how can agents produce a complete and efficient port of a large repository without human intervention?

Three challenges. Figure 1 illustrates the three challenges that such a port faces. The first challenge is scale. Repository-level code migration requires extensive analysis and planning to coordinate changes across components and dependencies. For large repositories, this work cannot fit within a single model context, and model accuracy degrades as the relevant material is buried in a longer one [12]. The work must therefore be divided into smaller tasks, each with its own plan, whether by call-graph order [4], dependency-aware planning [10], or bounded code chunks [7]. Decomposition makes tasks more manageable, but introduces a coordination challenge: later changes must not break previously migrated behavior, and the system must track and revisit tasks that remain unresolved.

The second challenge is self-validation. When the same agentic process writes both the target implementation and its acceptance tests, both may reflect the same misunderstanding of the source. Generated oracles tend to record the behavior a program exhibits rather than the behavior it should exhibit, so they can encode a defect as though it were the specification [13]. Passing these tests can therefore create false confidence in an incorrect or incomplete translation, and this is compounded by the tendency of language models to produce code that compiles but is semantically wrong [14]. For example, a port may compile and pass its generated tests while omitting a required interface or an error-handling path. We call a translation that appears complete but lacks required behavior a silently unfinished port. The problem is not simply limited test coverage; for generated suites, coverage and mutation scores are themselves unreliable indicators of fault-detection ability [15]. The deeper issue is that the implementation and the tests used to accept it may share the same blind spots. Independent verification tests, source-derived checks, and explicit coverage accounting address different parts of this concern.

The third challenge is efficiency. Behavioral compatibility does not establish that a translated application has acceptable runtime or resource use, and generated code is frequently far less efficient than competent human implementations [16], [17]. A maintainable replacement can still be unsuitable if an inefficient data representation or synchronization strategy substantially increases its operating cost. Performance therefore needs an explicit measurement and refinement process rather than an assumption that it will follow from successful translation.

Our approach. We present CODEMEEPO, a multi-agent workflow that migrates a repository in two phases, each carried out by a team of specialized LLM agents. The translation phase builds a target implementation that reproduces the required behavior of the source. The optimization phase then improves the performance of that implementation. Agents perform the analysis, editing, and assessment, and hand work to one another by writing files rather than by conversing. A deterministic state machine decides which agent runs next and whether a phase may end, applying explicit rules to the outcomes those agents record. Termination is therefore determined by those rules, not by an agent's own judgment that its work is finished.

The translation phase never attempts the whole repository at once. It first analyzes the source, then divides the migration into an ordered sequence of milestones, each one a slice of functionality together with the tests that must pass for it to count as done. Milestones are attempted one at a time, and each is checked against the tests of all earlier milestones as well as its own, so work on one slice cannot silently break another. Whether a slice is finished is judged by a fixed external oracle that the agents may neither author nor modify.

Because a passing suite still cannot show that nothing was left behind, a parity verifier—an LLM judge with no ability to edit code—then compares the components of the source against those of the target and reports whatever is missing or left as a placeholder. Crucially, a reported gap is not merely recorded. It is fed back into the plan as a new milestone, so the pipeline returns to work rather than finishing with a known omission, and the verifier runs again on the result.

The optimization phase begins once the translation is accepted. It alternates measurement against the project’s benchmark with targeted improvement, and then runs the full test suite as a final milestone that can itself be repaired, so performance work cannot quietly trade behavior for speed. The two phases thus meet the three challenges in turn: milestones for scale, independent checks for self-validation, and performance measurement for efficiency.

Across nine subjects in three language pairs, CODEMEEPO achieves the best test pass rate on every subject against ReCodeAgent [5] and four simpler baselines that use the same model. It passes 1,166 of 1,180 Java-to-Python tests, all 63 C-to-Rust tests, and all 105 tests of a production daemon, against 1,029, 47, and 53 for ReCodeAgent. Five rounds of its optimization phase then improve five of the daemon's ten benchmarks by more than 5%, cutting hardware reads by 21.6% and idle CPU use by 12.2%.

In summary, this paper makes the following contributions:

  • CODEMEEPO, a two-phase repository-level migration workflow combining specialized agents with deterministic orchestration and explicit termination criteria.

  • A translation phase addressing scale and self-validation through ordered milestones, cumulative test gates, a fixed external oracle, and parity verification that converts detected gaps into new milestones.

• An optimization phase alternating benchmark measurement and targeted improvement, followed by full-suite conformance testing and repair.

• An evaluation on nine subjects in three language pairs, in which CODEMEEPO has the best pass rate on every subject and passes 18% more tests than ReCodeAgent. On a production daemon, its optimization phase improves half of the benchmarks, by 25% on average.

Section II defines the problem. Section III describes the design. Sections IV and V present the evaluation. Section VI reviews related work and Section VII concludes.

References (48)