ReCodeAgent: A Multi-Agent Workflow for Language-agnostic Translation and Validation of Large-scale Repositories
ReCodeAgent is a language-agnostic framework for autonomous repository-level code translation and validation. It leverages static analysis combined with Large Language Model (LLM) agents to perform high-quality code translation across multiple programming languages efficiently. To simplify the translation task, ReCodeAgent employs a multi-agent workflow with specialized agents (Analyzer, Planning, Translator, Validator) that work together to understand source code structure, plan the translation strategy, implement the translation, and validate functional equivalence.
For re-running and evaluating ReCodeAgent on more projects, we recommend using our Dockerfile to build a docker image. All required dependencies are installed during docker build, making it easier for users to interact with ReCodeAgent.
To build a new image from scratch and run it inside a container:
bash scripts/start_docker.sh <agent_name> <tool_name> <project_name> <source_language> <target_language>
bash docker_shell.sh <agent_name>.<tool_name>.<project_name>.<source_language>.<target_language>We provide the results of ReCodeAgent from our experiments on Zenodo:
results.zip: Translations of ReCodeAgent and other ablation agents for all projects, agent trajectories, graphectory analysis, and cost analysis.results.xlsx: More detailed results of ReCodeAgent, including per tool and project results.
The main experiments in ReCodeAgent use Claude Code as its LLM agent powered by Claude Sonnet model. We use AWS Amazon Bedrock as provider to interact with the Claude model. To reproduce our results, you are required to make sure your AWS account has Claude model enabled in your desired region. Please configure your credentials by running aws configure and pasting your AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, region, and model information. You might need to install the awscli package if you haven't already.
To use ReCodeAgent with open-source models or other closed-source models (not limited to Claude via Bedrock), you can integrate OpenRouter by updating the env block in .claude/settings.local.json:
"env": {
"OPENROUTER_API_KEY": "<api-key>",
"ANTHROPIC_MODEL": "<model-id>",
"ANTHROPIC_BASE_URL": "https://openrouter.ai/api",
"ANTHROPIC_AUTH_TOKEN": "<api-key>",
"ANTHROPIC_API_KEY": "",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "<model-id>",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "<model-id>",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "<model-id>",
"CLAUDE_CODE_SUBAGENT_MODEL": "<model-id>"
}Replace <api-key> with your OpenRouter API key and <model-id> with the OpenRouter model identifier (for example, anthropic/claude-sonnet-4 or an open-source model slug from the OpenRouter catalog). Remove any Bedrock-specific variables (such as CLAUDE_CODE_USE_BEDROCK) when switching to OpenRouter.
ReCodeAgent can be configured with other LLM agents and models. Please configure your agent in src/utils/model_utils.py and src/utils/cmd_utils.py.
ReCodeAgent supports multiple translation tools and language pairs:
- crust: C to Rust translation
- alphatrans: Java to Python translation
- skel: Python to JavaScript translation
- oxidizer: Go to Rust translation
The project is organized as follows:
recodeagent/
├── .claude/ # Claude Code configuration
├── configs/ # Configuration files and prompt templatesfor experiments
├── data/
│ └── tool_projects/ # Source and target projects organized by tool
├── docker-env/ # Docker build and configuration scripts
├── results/ # Experiment results and trajectories
├── scripts/ # Shell scripts for running experiments
├── src/
│ ├── agents/ # Agent implementations
│ │ ├── recodeagent/ # Multi-agent pipeline
│ │ └── baseagent/ # Baseline agent
│ ├── analysis/ # Result analysis tools
│ ├── mcp/ # MCP servers for language analysis
│ └── utils/ # Utility functions
├── CLAUDE.md # Claude Code memory
└── README.md
Please run the following command to reproduce RQ1 results for a given agent, tool, and project:
bash scripts/start_docker.sh <agent_name> <tool_name> <project_name> <source_language> <target_language>After translation and validation is complete, you can run tests in the target PL to reproduce RQ1 results. Or alternatively, you can unzip results.zip and then refer to the results/recodeagent_translations/ directory for the translations. For all tools except Oxidizer, we obtain validated developer tests from their artifacts. For Oxidizer, we translate and verify tests which are available in data/oxidizer_translations/.
Please download test name mapping from the provided results.xlsx file on Zenodo and place it in results/recodeagent_translations/data/tool_projects/<tool>/<project>/test_name_mapping.csv. Then, run the following command to reproduce RQ2 results for a given tool and project.
bash scripts/run_test_comparison.sh <project>The test comparison results will be stored in results/recodeagent_translations/data/tool_projects/<tool>/<project>/test_comparison_report.json.
Please run the following command to reproduce RQ3 results after unziping results.zip:
python src/analysis/ablation.pyThe ablation study contains two distinct results: (1) the effectiveness of ReCodeAgent compared to other ablation agents. We produced these results by running RQ1 with different <agent_name> (e.g., noanalyzer, noplanning, novalidator, baseagent-condensed, baseagent-concat) and extracted test pass rates similar to RQ1. (2) the process-centric analysis of agent trajectories using Graphectory artifacts. We provide the graphectory analysis results in results/ablation_study/graphectory_analysis/.
Please run the following command to reproduce RQ4 results after unziping results.zip:
python src/analysis/cost.py The cost analysis is based on the trajectories and reports of ReCodeAgent generated during RQ1. We collected all trajectories and reports from experiments and stored them in results/trajectories/.
You can evaluate ReCodeAgent on other projects. Please make sure you have:
- Source projects stored under
data/tool_projects/<tool>/<project>/<source_language>/ - Appropriate build systems (Makefile, Maven, npm, Cargo, etc.) installed during
docker build
If you need to experiment with other programming languages not supported by ReCodeAgent:
- Add MCP language server configuration in
configs/claude_mcp_config.jsonunderDockerfile - Update the Dockerfile to install language-specific tools and compilers
- Add language-specific analysis tools if needed
- Update prompt templates in
configs/prompt_templates.yaml
ReCodeAgent uses several MCP servers.
- Language Servers: For each supported language (rust-analyzer, gopls, pylsp, jdtls, clangd, typescript-language-server)
- project-analyzer: Custom MCP server for analyzing project structure
- crust-test-runner: Custom MCP server for running C tests against Rust translations in CRUST tool
To add more MCP servers:
- Implement the server in
src/mcp/ - Configure it in
configs/claude_mcp_config.jsonunderDockerfile - Update the Dockerfile if system dependencies are needed
- Update agent prompts to utilize the new server capabilities
For questions or issues, please open an issue on our GitHub repository.