Work

Neuro-Symbolic Cross-Cutting Modernization: AST-Partitioned Agentic Refactoring and Subtractive Software Evolution in Regulated Systems

Year: 2026
Type: preprint
Abstract: ABSTRACT Context. Cross-cutting modernization of a regulated, 496K-SLOC industrial system (Enterprise-LIMS, 3,562 source files) must simultaneously refactor user-facing text, exception handling, persistence guards, and audit records without violating regulatory invariants. Delegating such repository-wide changes to a coding agent end-to-end is hazardous because natural-language literals are entangled with control flow: we identify 1,409 sites (including 689 fatal control-flow comparisons) where business branches compare against, or key on, localized strings. Approach. We study a three-stage post-freeze modernization campaign (65 commits over a 21-day active window following the Phase IV baseline): (i) Stage 1 (12 days, 36 commits) aligns all 10 business domains, eliminates 414 inline mock/hardcode sites and all 192 static literals, and culminates in a 527-file structural consolidation; (ii) Stage 2 (5 days, 2 commits) freezes governance specifications, dehydrates 4,161 bilingual contract entries via zero-token deterministic scripts, baselines the 1,409 smells into 689 P1 fatal control-flow comparisons and 720 P2 non-branching display mappings, and applies a four-role compiler-AST partitioner (@vue/compiler-sfc + @babel/parser) that routes the remaining 19,334 frontend text nodes into Green deterministic UI (70.58%), Blue dictionary-bound (0.25%), and Yellow context-ambiguous (29.17%) execution channels (cutting ambiguous flags by 44.99% from 10,252 under line-regex scanning to 5,640, with 100.0% semantic precision on a 100-item stratified sample); and (iii) Stage 3 (4-day intensive sprint, 27 commits) pairs a 50-rule verification gate and canonical persistence recipes (Recipe A/B) with 28 deterministic codemods (4,689 LOC, 183 batch runs) and 6,177 targeted agent production edits, eradicating all 689 P1 fatal control-flow string comparisons while deferring the 720 non-branching P2 display maps to sub-application rollouts. Findings. Under whitespace-insensitive, rename-aware four-dimensional diffs (git diff -w -M -C, capturing 31 structural file moves and 28,744 externalized contract lines), pure production code exhibits a 47.46% replacement rate (52.44% in Stage 1 and 56.75% across frontend views), demonstrating that large-scale modernization is replacement-dominated rather than append-only. Economically, while Tier-3 agent disambiguation averages 57,057 billable tokens per production edit (352.44M billable / 7.40B total tokens across 104 code sessions, including 1,012 gate-remediation loops), offloading ~18,463 repetitive sites to Tier-1/Tier-2 scripts achieves a 0.0% syntax error rate and saves between 64.82M net billable tokens under conservative file-batch estimation and 1.05B counterfactual billable tokens under fine-grained site-level estimation. Five regulatory invariants hold across all 115 physical tables, 380 calculation engine and entity classes (1,567 total Java files scanned), and 18,960 nested locale keys at HEAD. Conversely, static call-graph reachability proves that removing a default actor (-1L) from the high-fan-in persistence handler (Ca=14, I=0.125) impacts 47 unauthenticated asynchronous entry points across 35 classes in 11 modules (43 direct DB writes; weighted blast-radius score 28 >= 8), tripping an automated circuit breaker and escalating to an architectural design proposal. Contribution. We contribute (i) a neuro-symbolic division of labor combining zero-token contract dehydration, AST-guided codemods, and surgical agent disambiguation, (ii) a four-dimensional churn decomposition across a three-stage campaign, (iii) a static call-graph and blast-radius criterion for halting unsafe automation, and (iv) a standalone reproducibility package of 20 audited measurement artifacts from a regulated codebase.
Author: Jiang, Chen
Language: English
Open Access status: green
OpenAlex ID: W7225749731
Cites:
Cited by:
Related to: