Code migration agent
Combine deterministic codemods with an agent loop to migrate real repositories to a new language or runtime version, gate on tests and coverage, and publish a failure taxonomy.
The capstone and what it builds on
- 1Code Migration Agent (Repo-Level Language / Runtime Upgrade)The capstone brief
- 2The Agent Loop: Observe, Think, ActPhase 14: Agent engineering
- 3Tool Use and Function CallingPhase 14: Agent engineering
- 4Verification GatesPhase 14: Agent engineering
- 5The Workbench on a Real RepoPhase 14: Agent engineering
- 6Failure Modes: Why Agents BreakPhase 14: Agent engineering
- 7The Autonomous Coding Agent Landscape (2026)Phase 15: Autonomous systems
- 8Action Budgets, Iteration Caps, and Cost GovernorsPhase 15: Autonomous systems
What You'll Build
A migration pipeline that upgrades repositories (for example Python 2 to 3, Java 8 to 17, or a major library upgrade) in two layers: deterministic recipes first, then an agent loop for what recipes cannot fix. Each repo runs in a sandbox; a branch only counts as migrated when tests pass and coverage holds. Failures are classified into a taxonomy with exemplar diffs.
Requirements
- Recipe pass: deterministic rewrites (OpenRewrite for Java, libcst codemods for Python, or established tools such as 2to3 or bump-pydantic as the substrate) committed as a separate
recipecommit. - Sandbox per repo (Docker image with the target runtime) that installs dependencies and runs the build and tests.
- Agent loop with tools
run_build,read_file,edit_file,run_test,git_diffthat classifies each failure (dependency, syntax, test, build tool) and applies a targeted fix, then reruns. - Budget caps per repo on turns (default 20), wall-clock (default 30 minutes) and cost or tokens; any breach stops the run and files it as
budget_exhaustedwith the current diff. - Test and coverage gate: tests must pass and coverage must not drop by more than 2 percentage points versus the original repo; otherwise file as
coverage_regression. - Output per migrated repo: a branch and PR on your fork (or a patch plus PR body) listing which commits came from recipes and which from the agent.
- Failure taxonomy with classes such as
dep_upgrade_required,build_tool_drift,custom_annotation,test_flake,syntax_edge_case,budget_exhausted, each with a count and an exemplar diff. - Baseline: run recipes only (no agent) on the same repos and compare pass rates.
- Metrics: pass rate, mean coverage delta, cost per migrated repo and the fraction of fixes made by recipes vs the agent.
Constraints
- Model-agnostic: any OpenAI-compatible endpoint (including the KatalockAi API) or a local model (for example via Ollama, llama.cpp or vLLM) may be used. No named commercial model is required; record which model you used in the README.
- Hardware: a laptop with Docker. The Python 2 to 3 path is the lightest; Java needs a JDK and Maven or Gradle in the container.
- Substitution: the lesson runs a 50-repo MigrationBench subset. Here at least 8 repositories (public legacy repos, a MigrationBench subset, or small legacy repos you construct, clearly labelled as such) are accepted, as long as each has a test suite.
- Set a cost cap per repo in code and keep total spend small; report actual spend.
Stretch Goals
- Add a lint-clean gate and measure how often a green migration still regresses style.
- Add a minimal-diff pass that trims unnecessary agent changes and report diff-size reduction.
- Extend to a third migration type by swapping the recipe layer.
How to Submit
- Public GitHub repo with
recipes/,sandbox/(Dockerfiles),agent/,runs/(per-repo logs, diffs, taxonomy labels),report/(taxonomy and metrics) andREADME.md. - README: which migration and repos you chose, how to run one repo and the full batch, results vs recipe-only baseline, the taxonomy and limitations.
- Paste the per-repo results table, the taxonomy summary and one full agent log for a repo the recipes alone could not fix.
How It's Reviewed
Professor Katalock reads your repository and the evidence you paste, and scores each criterion out of 100. You pass with a weighted total of 70 or more and no criterion below 40. A copied or padded submission is flagged and fails.
Submit
Push your work to a public GitHub repository with a README that explains how to run it, then paste the evidence below. Up to 3 reviews a day, free.
- Per-repo results table (pass, coverage before and after, cost, turns, recipe vs agent fixes)
- Recipes-only baseline vs full pipeline comparison
- Failure taxonomy summary with counts
- One full agent log for a repo where the agent made the difference
- Short reflection on the hardest failure class and how a new recipe could cover it
Reviews are done by AI against the rubric above. They check the evidence in your repository; they are not a substitute for a human code review, and a review can be wrong. If you think it is, improve the README so the evidence is unmistakable and resubmit.