👾 Inspiration
Legacy software is everywhere, but modernizing it is not as simple as rewriting old code. Important business rules are often hidden inside years of existing logic, and changing even a small function can break behavior that users depend on.
I wanted to build something that could understand why legacy code works the way it does before attempting to modernize it. That led me to GhostPatch, an AI-powered modernization system that doesn't just fix old code, but also verifies whether those changes are actually safe.
👻 What it does
GhostPatch uses NVIDIA Nemotron to analyze, modernize, and verify legacy Python code through an agentic workflow.
Users can import a repository, inspect its dependencies and potential issues, and generate a modernization plan before approving any changes.
I developed three core features:
- Ghost Memory: Extracts hidden business rules from existing code, tests, and documentation while tracking evidence, contradictions, and uncertainty.
- Ghost Signals: Analyzes synthetic user activity to identify recurring errors, retries, and potential changes in user behavior.
- Ghost Trials: Generates behavioral test scenarios and compares original and modernized code to identify preserved behavior, intended changes, and unexpected differences.
GhostPatch connects these findings into a verification process where users can review proposed changes, inspect code differences, and download patches and evidence reports.
🛠️ How I built it
I built GhostPatch using Next.js, TypeScript, and Tailwind CSS for the frontend, with Python and FastAPI handling repository analysis, agent orchestration, and modernization workflows.
I integrated NVIDIA Nemotron through NVIDIA's hosted API to reason about legacy code, identify modernization opportunities, generate plans, and assist with controlled code changes and repairs.
For verification, I used Docker to run baseline and modified tests in isolated environments for a trusted sample repository. This allowed me to compare actual execution results instead of relying entirely on the AI's assessment.
I also implemented structured evidence tracking, behavioral scenario generation, approval controls, and downloadable reports to connect proposed modifications to their supporting information.
For the frontend, I designed a cyberpunk-inspired experience with interactive visuals and animations to make the modernization process easier to understand.
⚡ Challenges I ran into
One of my biggest challenges was figuring out how to distinguish an actual bug from behavior that the original software intentionally supports. Existing tests can pass even when the underlying business logic no longer matches what users need.
Another challenge was preventing the AI from making assumptions based on incomplete information. User behavior, documentation, and existing code can contradict one another, so I needed a way to track uncertainty instead of treating every observation as a requirement.
I also had to manage code execution and AI-generated changes safely. Rather than executing arbitrary uploaded repositories, I restricted executable verification to trusted samples and required human approval before applying modifications.
Integrating the animated frontend while preserving the existing backend workflows was another challenge, especially when keeping the visual experience consistent with actual execution states.
💗 Accomplishments that I'm proud of
I'm especially proud that GhostPatch evolved beyond a basic AI code refactoring tool into a system that considers the behavior and business logic behind the code.
I implemented Ghost Memory, Ghost Signals, and Ghost Trials as connected parts of the modernization process, allowing the system to move from discovering hidden rules to investigating potential issues and independently verifying proposed changes.
I also built a working NVIDIA Nemotron integration, controlled patch generation, Docker-based verification, repair attempts, and downloadable evidence reports.
One of my favorite accomplishments was creating a fictional eligibility-system demonstration where the original tests pass, but additional behavioral trials reveal a potential mismatch between the existing implementation and intended policy. This helped demonstrate why passing existing tests isn't always enough.
🧠 What I learned
This project taught me that successful AI-powered modernization requires much more than generating cleaner code.
I learned about harness engineering, where an AI model operates within a structured system of tools, constraints, evidence, and verification rather than making decisions independently.
I also learned how difficult it can be to interpret user behavior. Repeated actions or errors may indicate a problem, but they don't automatically explain what the correct solution should be.
Most importantly, I learned that preserving software behavior requires understanding both what the code currently does and what the software is actually supposed to do.
🚀 What's next for GhostPatch
I want to expand GhostPatch beyond its current Python-focused prototype to support additional programming languages and larger legacy codebases.
I also plan to improve Ghost Signals with real, privacy-conscious usage instrumentation and longer-term behavior monitoring, allowing the system to identify changes across different time periods.
Other future improvements include broader sandboxed execution, more comprehensive behavioral test generation, persistent project history, and GitHub pull request integration.
My long-term goal is to make GhostPatch a reliable modernization environment where AI can help bring legacy software into the future without losing the important behavior that made it work in the first place.
Built With
- docker
- fastapi
- git
- github
- javascript
- nemotron
- next.js
- nvidia
- python
- react
- restapi
- tailwindcsss
- three.js
- typescript