IP-Preserving Enterprise System Modernization via LLM-Driven Specification Extraction and Multi-target Code Generation
Abstract
We report on the automated modernization of a business-critical terminal operating system deployed across multiple sites of a major European port infrastructure company, comprising a heterogeneous technology stack accumulated over many years of continuous development: over 22,000 source files, about 10,000 of them C#, a multi-layered web forms UI, a complex Oracle database, and extensive operational documentation. Most current LLM-assisted modernization approaches rely on cloud-based models, raising intellectual property and security concerns that prevent adoption in industrial settings. We present a hybrid pipeline in which local LLMs extract a formal four-view specification that keeps proprietary source code entirely on-premises, while cloud models generate target implementations from specifications only, never accessing the legacy codebase. The pipeline extracts structural domain models, behavioral rules, process state machines, and screen presentations across 48 bounded contexts via a two-pass LLM extraction approach. Against a curated reference on a CRM probe, the best local model reaches a structural fidelity of 0.83, while two of seven candidates fail to emit parseable JSON at all; prompt engineering raises the semantic purity of the extracted domain model from 0.71 to 0.94, whereas legacy documentation adds almost nothing. Following a test-first approach, 5,451 behavioral tests were generated from specifications alone before any target implementation, and two runnable application stacks (Python/FastAPI and .NET 8 Blazor) were produced. We report concrete lessons on prompt engineering, structured output generation, and the practical boundaries between automation and manual intervention.