Deterministic Automation, Not AI Alone, Powers Safe Code Modernization at Scale
Generative AI tools help with new code but lack the precision needed for large-scale modernization. Pairing AI with deterministic refactoring frameworks like OpenRewrite is essential for safe, repeatable transformation across enterprise codebases.

Software teams operate under conflicting pressures: accelerate delivery while stewarding aging, fragile codebases. Leadership often equates faster deployment with higher quality, so when velocity drops, it signals eroding code health. The outcome is predictable: mounting technical debt, overwhelmed developers, and dangerous, slow upgrade cycles.
As AI tools proliferate in development workflows, a critical question emerges: Do they genuinely advance code modernization, or do they simply speed up risky changes? The answer requires understanding where each approach excels—and where it fails.
The Modernization Challenge
Most large organizations carry years or decades of accumulated technical debt. Systems may function, but they resist change. Outdated dependencies, fragile interfaces, and code written for obsolete platforms—Java 6, early Spring Boot—constrain evolution.
Software naturally grows more complex over time. Teams sacrifice design to meet deadlines. Organizations expand, business needs shift, and supporting tools become stale. Some debt originates internally; much is imposed externally through frequent OSS updates, deprecated vendor APIs, and aging frameworks riddled with security vulnerabilities.
The industry has shifted from treating software as one-time projects to managing it as continuously evolving products. Maintenance now consumes nearly half of developer time—handling upgrades, deprecations, patches, and security fixes across multiple repositories with inconsistent tooling. Many necessary changes never happen; they're logged, deprioritized, or left incomplete, creating persistent risk.
The real bottleneck isn't developer capacity. It's that modern systems lack the architecture to support frequent, safe, and scalable transformation.
What Generative AI Brings—and Doesn't
Over 90% of developers now rely on AI assistants like GitHub Copilot, Amazon Q, or similar tools. These excel at generating boilerplate, completing code, drafting documentation, and helping teams navigate unfamiliar libraries.
Yet generative AI falls short for modernization at scale. These models are probabilistic; they lack native awareness of build systems, dependency graphs, or code formatting conventions. They cannot reliably determine which changes are safe across hundreds of repositories or predict downstream breakage.
In regulated industries or systems handling critical workloads, even minor AI-introduced errors carry severe consequences. Human review, testing, and validation remain mandatory for every change. This manual overhead prevents scaling modernization to enterprise needs.
Determinism as the Missing Piece
Generative AI shines when building new features. Large-scale modernization demands precision over creativity.
OpenRewrite, an open-source refactoring framework, addresses this gap. It parses source code with compiler-level accuracy, producing a Lossless Semantic Tree (LST)—a complete structural representation capturing syntax, semantics, types, and formatting.
OpenRewrite's foundation consists of recipes: deterministic programs encoding search and transformation logic. These recipes are testable, versionable, and applicable consistently across single applications or thousands of repositories. They follow explicit rules to transform code with guaranteed accuracy and reproducibility.
With OpenRewrite, code compilation after transformation is assured, not hoped for. The framework understands code structure deeply and applies changes that are structurally and semantically sound.
Recent AI coding agents like Claude Code have dramatically reduced the effort to create custom recipes. Tasks that once required hours can now be drafted in minutes.
Anchoring AI in Codebase-Specific Data
AI models lack inherent visibility into individual codebases. They cannot see dependency graphs, build configurations, or architectural patterns. Their output reflects probability, not structure. Reliable modernization with AI requires more than prompts—it demands structured access to compiler-accurate code information.
Moderne's Moddy multi-repo AI agent exemplifies this approach. Rather than replicating general-purpose assistants like Copilot or Amazon Q, Moddy leverages semantic data unique to each customer's codebase to analyze and reason about entire systems.
Moddy orchestrates modernization across repositories. Given a prompt—"Upgrade all Spring services to version 3" or "Locate deprecated crypto usages"—it processes recipe outputs across the codebase, pinpoints necessary changes, and directs safe transformations using deterministic recipes.
Moddy's power derives from grounding in actual codebase richness via OpenRewrite, where recipes function as tools extracting structured insights and executing precise transformations. This grounding matters fundamentally. Language models remain probabilistic; that constraint persists regardless of rapid evolution.
As LLMs commoditize, lasting value shifts from models themselves to the data and systems supplying them. Their utility depends entirely on context quality. Without structured codebase access, AI operates disconnected from full system architecture.
Deploying AI for Modernization Effectively
Executives face relentless AI product pitches and internal demands to adopt latest coding assistants. But achieving genuine software quality and engineering productivity gains requires strategic choices.
The right approach depends on the modernization problem:
- Deploy generative AI for replatforming and new code creation. It excels at reverse engineering legacy systems, designing new components, or rewriting code across languages (COBOL to Java, Perl to Python).
- Apply deterministic refactoring automation like OpenRewrite for modernizing existing systems. This suits removing deprecated APIs, upgrading frameworks, and remediating vulnerable libraries while ensuring safe, repeatable change at scale.
Across all use cases, adopt these principles:
- Empower developers with control over large-scale change. Deterministic tools and tested recipes build automation trust. When developers see exactly what transforms and why—across one or thousands of repositories—they confidently approve and execute changes at scale.
- Treat structured code data as your highest asset. Accurate, lossless code representations unlock searchability, automation, and safe modernization. Structured code data should be infrastructure.
- Merge AI with deterministic execution. Let AI assist with navigation, pattern discovery, summarization, and orchestration. Use rules-based recipes for precise searching, source data gathering, and verifiable, accurate changes.
- Make modernization continuous, not episodic. Embed it into your software lifecycle so systems evolve safely over time.
When AI receives proper tools, data, and guardrails, it becomes a genuine partner in modernization—enabling safer, cleaner, more adaptable code regardless of scale.
Source: The New Stack