ReforgeAI is an agentic AI system designed to modernize legacy Java codebases. It automatically analyzes existing code, generates comprehensive documentation and a transformation plan, and then carries out code modernization tasks. The system updates package dependencies, refactors deprecated or inefficient components, migrates to new frameworks, and embeds security best practices. Human feedback ensures accuracy and quality at every stage. 🤖✨
- Features
- Requirements
- Installation
- Usage
- Process Overview
- Human-in-the-Loop Feedback
- Known Issues & Troubleshooting
- Next Steps
- References
- Automated Analysis: Scans legacy code and produces detailed documentation. 📄
- Transformation Plan: Generates a YAML plan outlining modernization steps. 📝
- Automated Refactoring: Updates dependencies, replaces deprecated APIs, and optimizes inefficient code. 🔄
- Framework Migration: Switches to modern language frameworks (e.g., from Java EE to Spring Boot). 🏗️
- Security Best Practices: Incorporates OWASP guidelines and secure coding patterns. 🔒
- Build & Test Integration: Runs builds and unit tests, reporting results for review. ✅
- Human Feedback Integration: Allows reviewers to approve plans and transformations. 👥
To compile and run both the legacy (gen_docs.py) and modern (gen_modern.py) pipelines, you will need:
-
Java Environments
- Java 8 JDK (for legacy code compilation) ☕
- Java 21 JDK (for modernized codebase) 🔧
-
Maven 3.8+ (build tool and dependency manager) 🎯
-
Python 3.8+
openailibrary for LLM integration 🤖pyyamlfor YAML plan generation 📨langtrace-sdk(optional) for monitoring 🔍
-
Git (version control) 🐙
-
Network Access (to pull dependencies and contact AI APIs) 🌐
-
Clone the Repo
git clone https://github.com/your-org/ReforgeAI.git cd ReforgeAI -
Set up Python Env
conda create -n reforgeai python=3.11.7 -y conda activate reforgeai pip install -r requirements.txt
-
Configure API Keys
- Set
OPENAI_API_KEYin your environment, see.env.example.
- Set
- Generate Documentation & Plan
from the src folder:
python3 gen_docs.py temp_codebase/kitchensink/-
Execute Modernization
python3 gen_modern.py
-
Review Changes
- Inspect
plan.yaml, build logs, and test reports. - Accept or provide feedback on transformations.
- Inspect
-
Analysis Phase
gen_docs.pyreads and documents code.- Outputs detailed docs and
plan.yamldraft. 1.1 Plan Review - Human reviewers validate or adjust the plan.
-
Transformation Phase
-
gen_modern.pyexecutes plan tasks:- Dependency updates
- Refactorings
- Framework migrations
- Security enhancements
-
Generates build/test reports for each module.
-
-
Analysis and agents breakdown:
-
Every document includes a feedback section (see
feedback/). -
Critical review points:
- Did the agent read all docs correctly? 🧐 (
feedbackjtasks) - Were the intended changes applied? ✅ (
feedbacktasks)
- Did the agent read all docs correctly? 🧐 (
- Some hardcoded paths: This version has some hardcoded paths, you need to manually change them to make the app run on your local pc.
- Inconsistent Model Outputs: Running
gen_docs.pymultiple times may yield different results. Models may degrade under heavy usage. - Build Agent Hallucinations: Simulated build logs can be inaccurate. Monitor via Langtrace: Traces Dashboard
- Agent Tools Errors: Sometimes the LLm refuses to read docs due to tool selection issues. Restarting the pipeline often helps.
- Folder Cleanup: The agent cannot delete folders. Manual cleanup may be required.
- Implement better path guardrails to avoid file-scope issues.
- Add per-document feedback sections for granular review.
- Explore upgrading to Gemini 2.5 Pro & Claude 3.7 for consistent performance.
- Enhance agent monitoring and error reporting.
For the complete list of improvements/next steps, read:
- MongoDB Launches New Program for Enterprises to Build Modern Applications with Advanced Generative AI Capabilities
- Leveraging Large Language Models for Automated Code Migration and Repository-Level Tasks — Part II: Supplement — Specialized Language Models for Code
- Upgrading Java versions with Amazon Q Developer
- Generative AI in application modernization
- Generative AI: A Transformative Force in Legacy App Modernization
- The Unreasonable Effectiveness of Generative AI in Legacy Application Modernization
- Application Modernization | MongoDB
- Why General-Purpose LLMs Won’t Modernize Your Codebase — And What Will
- Modernizing Legacy Java Applications — Best Practices and Considerations
- janus-llm/janus-llm: Leveraging LLMs for modernization through intelligent chunking, iterative prompting and reflection, and retrieval augmented generation (RAG)
- spring-projects-experimental/spring-boot-migrator: Spring Boot Migrator (SBM) is a tool for automated code migrations to upgrade or migrate to Spring Boot
- This Year in Uber's AI-Driven Developer Productivity Revolution
- facebookresearch/CodeGen: Reference implementation of code generation projects from Facebook AI Research
- facebookresearch/TransCoder: Public release of the TransCoder research project
- Legacy Modernization meets GenAI
- The Unreasonable Effectiveness of Generative AI in Legacy Application Modernization
- Accelerate Legacy App Modernization with Virtusa and AWS Generative AI
- Generative AI: A Transformative Force in Legacy App Modernization
- Granite Code Models: A Family of Open Foundation Models for Code Intelligence
- Leveraging LLMs for Legacy Code Modernization: Challenges and Opportunities for LLM-Generated Documentation
- LLMs: Understanding Code Syntax and Semantics for Code Analysis
- Towards Understanding What Code Language Models Learned
- Code Transformation with Amazon Q
- Leveraging Large Language Models for Automated Code Generation, Testing, and Debugging in Modern Development Pipelines
- CodePlan: Repository-level Coding using LLMs and Planning
- Leveraging Large Language Models for Code Translation and Software Development in Scientific Computing
- janus-llm/janus-llm: Leveraging LLMs for modernization through intelligent chunking, iterative prompting and reflection, and retrieval augmented generation (RAG)
- Leveraging LLMs for Legacy Code Modernization: Challenges and Opportunities for LLM-Generated Documentation
- GPT-Migrate: Convert your Codebase to any language/framework
- joshpxyne/gpt-migrate: Easily migrate your codebase from one framework or language to another
- aws-samples/rearchitecting-modernapps-sample: Sample Application for "Re-Architecting for Containerized Modern Application Workshop"
- Stanford Webinar - Agentic AI: A Progression of Language Model Usage
- Amazon Q – Generative AI Assistant
- konveyor/kai: Konveyor AI - static code analysis driven migration to new targets via Generative AI
- IBM/watsonx-code-assistant: IBM watsonx Code Assistant simplifies and accelerates coding workflows across Python, Java, C, C++, Go, JavaScript, Typescript, and more
- AgiFlow/repo-upgrade: Dependencies Upgrade with multi-agents (CrewAI & Langgraph)
- AGIFlow - Cheaper, Faster AI Application