Manuscript Offprint
arXiv:2610.36549From Ripple to Boundary: Deterministic Impact Boundaries for LLM-Based Software Evolution
Jiameng Bai , Zhitao Wang , Long Wang , Keyue Qian , Sai Wu
Zhejiang University, Hangzhou, China
WeChat Pay, Tencent, Shenzhen, China
{baijiameng,kyqian,wusai}@zju.edu.cn
{zhitaowang,oliverlwang}@tencent.com
Abstract—The landscape of software evolution is undergoing a fundamental paradigm shift in the era of Large Language Models (LLMs). As industrial software engineering increasingly transitions toward design-driven code generation, the bottleneck of evolution has shifted from writing code to maintaining deterministic consistency between multi-source design assets (e.g., sequence diagrams, class diagrams) and the generated code. When a design asset changes, LLM agents currently lack a deterministic impact boundary to identify which code must be evolved, leading to two failure modes: hallucinating missing changes or breaking unrelated code. Probabilistic approaches—such as semantic retrieval or text-based diffing—fail to capture the structural ripple effects across highly interconnected design dependencies.
To address this, we propose a paradigm shift from probabilistic semantic retrieval to deterministic structural constraints. We formalize the design assets as a Knowledge Graph (KG) and organize them into a content-addressed Merkle Directed Acyclic Graph (DAG). Our key insight reveals a topological isomorphism between the logical ripple effect of a design change and the content hash propagation within the DAG. By leveraging this, we transform ambiguous impact analysis into verifiable structural operations. Through a two-phase diffing process, we extract a precise causal chain that defines the exact modification boundary. This boundary enables deterministic context injection, providing the LLM agent with strictly scoped code and design updates, thereby fundamentally guaranteeing evolution safety. As a by-product, the KG serves as an agent-queryable knowledge base for natural language design retrieval. Early deployment on a large-scale industrial payment platform demonstrates that our mechanism successfully computes the exact impact boundary and generates incremental code modifications that meet the expected design changes.
Index Terms—Software evolution, knowledge graphs, change impact analysis.
I. INTRODUCTION
The landscape of software evolution is undergoing a fundamental paradigm shift. In our domain of industrial payment software development, we have transitioned toward a design-driven code generation paradigm. To make this concrete, consider an API-based transaction system: a sequence diagram captures a specific business use case, where each Message corresponds to an API or function call, often augmented with decision rule tables. Instead of manual coding, developers define these multi-source design assets (sequence diagrams, class diagrams, and rule tables) as the single source of truth, from which LLM agents synthesize and evolve the actual code.
However, as the design asset base scales, this evolutionary paradigm exposes a critical vulnerability during incremental iterations: when a design changes, the LLM agent lacks a deterministic impact boundary. Consider a scenario: a core interface's signature (e.g., its function name or request structure) is modified. Since this interface is invoked by dozens of messages across multiple sequence diagrams, this single logical change triggers a massive ripple effect. In a design-to-code setting, every affected sequence diagram dictates that its corresponding generated code must be evolved accordingly. Traditional approaches fail to capture this structural propagation. Text-based version control operates on physical text, losing logical dependencies. Even when leveraging LLMs to deduce the impact based on semantic similarity or RAG, the results remain probabilistic. Fundamentally, LLMs inherently lack the capability to perform deterministic transitive closure calculations over complex graph structures, making them prone to missing deep cascaded dependencies. This boundary ambiguity leads to two failure modes: under-modification (hallucinating or missing necessary code changes) and over-modification (breaking unrelated shared code).
To address this, we propose a paradigm shift: moving from probabilistic semantic retrieval to deterministic structural constraints. Because design assets are highly interconnected (e.g., a message invokes an interface defined in a class diagram), we model them as a directed graph and store them in a Knowledge Graph (KG) to explicitly capture their complex logical dependencies. Building upon this KG, our key insight is to organize it into a content-addressed Merkle Directed Acyclic Graph (DAG). Inspired by the underlying architecture of Git, each design node is stored via shallow serialization, and its content hash is derived from its own properties and its children's hashes. This structural representation makes the logical ripple effect computable: any leaf-level change inherently alters the hashes of its ancestors. By comparing the hashes of new and old snapshots, our two-phase diffing process efficiently prunes unchanged subtrees and drills down into the modified ones, yielding a precise causal chain of impact (e.g., "Interface X is affected because its request structure changed, consequently affecting Sequence Y").
Corresponding authors.
(a) Multi-Source Design Network
(b) The Ripple Effect
(c) Code Evolution Impact

Fig. 1. The Design Ripple Challenge: (a) A multi-source design network across class diagrams, sequence diagrams, and behavior/logic layers; (b) A single field edit in the Request DataType triggers a structural ripple effect across multiple sequence diagrams; (c) The ripple necessitates incremental code generation.
Crucially, instead of relying on probabilistic agentic search during generation, our system leverages this computed causal chain to perform deterministic context injection. The agent is provided with a pre-packaged specification containing the precise causal chain, the newly fetched design assets, and the existing code, all strictly confined within the computed boundary. This rigid structural constraint eliminates the need for the LLM to “search” for context, ensuring that incremental code evolution is restricted to truly affected regions.
Beyond automated evolution, the constructed KG yields a valuable by-product: it serves as an agent-queryable knowledge base. During the design phase, when developers need to understand complex structural dependencies (e.g., “Which sequences invoke this interface?”), an LLM agent can safely traverse the graph via natural language and multi-step Cypher queries. This unlocks the design assets from static documents into an interactive, dynamic engineering asset, assisting human designers in their daily workflows.
We have deployed this mechanism on a large-scale industrial payment microservice platform. Early evidence from real-world flow modifications demonstrates that our approach effectively constrains the agent's generative process, ensuring that code changes are precisely scoped and safe. By treating design changes as hash propagation over a Merkle DAG, we shift LLM-based software evolution from probabilistic context retrieval to deterministic structural enforcement.
The KG spans three primary layers. First, the Class Diagram layer defines static structures, where an Interface encapsulates complex Request and Response DataTypes. Second, the Sequence Diagram layer orchestrates flows through Messages that invoke these interfaces. Third, the Behavior, Logic & Infrastructure layer manages dynamic business rules (StateMachines, DecisionTables) and encapsulates shared infrastructure capabilities (e.g., login component) invoked by Messages. Because these layers are heavily cross-referenced (e.g., a single Interface is invoked by multiple Messages across different Sequence Diagrams), they form a complex Directed Acyclic Graph (DAG) rather than a simple tree.
B. The Ripple Effect and Boundary Ambiguity. The critical challenge for software evolution arises when any arbitrary asset within this dense graph is modified, rather than just a specific leaf node. Consider the scenario in Figure 1(a): a new field is added to the Request DataType of the submit interface. This single structural edit triggers a massive ripple effect. The interface's structural hash is invalidated, cascading to any Message that binds to it (e.g., Message B0 and C0). This impact propagates upward, altering the entire SequenceDiagram (e.g., Sequence Diagram B and C). As depicted in Figure 1(b), one design edit leads to multiple affected flows. When an LLM agent is tasked with this evolution, it faces the Boundary Ambiguity problem: it must mechanically determine the exact structural boundary of the impacted flows.
C. Code Evolution Impact. In a design-to-code setting, this design ripple directly mandates code evolution. As shown in Figure 1(c), each affected Sequence Diagram corresponds to specific generated code files (e.g., handler_logic_b.cpp). The LLM agent must modify the core implementation (handler_logic_a.cpp) and ensure upstream callers handle the new Request field correctly. If the structural boundary is not precisely computed, two failure modes occur: under-modification (missing callers,

Fig. 2. The proposed workflow. (a) CAS-backed snapshots; (b) Two-phase Diff over Merkle DAG; (c) Per-sequence incremental context; (d) Constrained code evolution; (e) Interactive KG Q&A.
leading to compile or runtime errors) and over-modification (incorrectly altering unrelated flows). To ensure reliable software evolution, we must answer a fundamental question: Given a specific design edit, how can we mechanically compute the exact logical boundary of the impacted flows and code? This requires translating the ambiguous semantic impact into a deterministic structural boundary.
III. APPROACH
The workflow of our approach is illustrated in Figure 2.
3.1 Content-Addressable Representation. To enable deterministic change detection, we model the design Knowledge Graph (KG) as a Merkle DAG. Each node n is assigned a structural hash recursively defined as:
where is the node label, are its scalar properties, and are the hashes of its child nodes. We adopt shallow serialization, storing only the hash pointers of children. This design guarantees that any change propagates upward to alter the root hash. As shown in Figure 2(a), since the file name in CAS is its hash, unchanged subtrees (e.g., the Controller) are naturally reused and stored only once, completely eliminating redundant storage and computation.
3.2 Two-Phase Diff for Causal Boundary. Given the old snapshot and new snapshot , the engine extracts the exact causal boundary via a two-phase algorithm (Algorithm 1). Figure 2(b) illustrates this process.
In Phase 1: Horizontal Scan (Lines 1-4), the engine flattens the snapshots into hash maps (Lines 1) and performs set operations to classify assets into added ( , Line 2), deleted ( , Line 3), and modified ( , Line 4) sets. As shown in Figure 2(b), because the hashes of Controller and Entity remain identical, their entire subtrees are pruned. Only the modified assets (Process() and Review()) enter the drill-down queue.
In Phase 2: Vertical Drill-down (Lines 5-20), the engine iterates over (Line 5) and invokes the DrillDown function. First, it loads and compares the scalar properties (Lines 8-9). If a property change is detected, it is recorded as a root cause (Line 11), such as updating the rule condition from score >= 60 to score >= 70 in Figure 2(b). Next, the function iterates over the union of old and new children (Line 14). If a child exists only in the new version, it is recorded as ADDED (Line 15-16); if it exists only in the old version, it is recorded as DELETED (Line 17-18). For children present in both versions but with different hashes (Line 19), the engine recursively invokes DrillDown (Line 20), continuing the downward traversal (e.g., from Message to DecisionTable). This recursion terminates when all direct property changes and structural additions/deletions are mapped, yielding the causal diff tree illustrated in Figure 2(c).
3.3 Deterministic Context Injection. We deterministically construct the agent's task specification based on the computed causal boundary. Figure 2(c) illustrates this injection for two affected tasks (Process() and Review(). For each task, the injector synthesizes a structured blueprint containing: (1) Incremental Development Constraints: a unified set of guidelines ensuring the agent only modifies the relevant scoped blocks; (2) Causal Rationale: the rendered causal diff tree showing exactly which rules changed and why; and (3) Local Context: the existing code file (e.g., process.cpp) alongside the newly fetched design assets.
3.4 Constrained LLM Code Evolution. The LLM agent
Algorithm 1: Two-Phase Diff for Causal Boundary
Input: Old snapshot , New snapshot
Output: Causal Diff Tree
// Phase 1: Horizontal Scan
1 ;
2 ;
3 ;
4 ;
// Phase 2: Vertical Drill-down
5 foreach do
6 DrillDown(id, , );
7 Function DrillDown(id, , ):
8 ;
9 ;
10 if then
11 Record property change as root cause in ;
12 ;
13 ;
14 foreach do
15 if then
16 Record c as ADDED in ;
17 else if then
18 Record c as DELETED in ;
19 else if then
20 DrillDown(c.id, , );
consumes the injected blueprint to evolve the code. Figure 2(d) demonstrates the execution: guided by the causal rationale (e.g., “R1 changed, R2 added”), the agent modifies the exact logical blocks in process.cpp. Notably, because the DecisionTable (e.g., EligibilityRules) is a shared resource referenced by multiple sequence diagrams, multiple code files simultaneously receive the incremental modification requirements. The rigid boundary prevents the LLM from hallucinating unintended modifications, ensuring global consistency across all dependent files.
3.5 Interactive KG Retrieval as a By-Product. Beyond automated evolution, the KG serves as a queryable knowledge base for designers (Figure 2(e)). We equip a schema-aware agent with an interactive toolset—including schema exploration (explore_schema), intent analysis, parameterized template queries, and multi-step Cypher generation (query_kg). This allows designers to ask natural language questions (e.g., “Which flows use EligibilityRules?”) and retrieve exact evidence paths, unlocking the static design assets as a dynamic, interactive engineering asset.
Finally, we report the feasibility of our Diff engine, code evolution, and KG Q&A in the Early Results panel below.
IV. FUTURE PLANS
While our early results demonstrate feasibility, the evaluation remains qualitative. Our future work will focus on quanti-
Early Results from Industrial Deployment
Diff Engine: We executed 3 mutation operations (add, modify, delete) across all KG node types. The engine successfully captured 100% of the multi-hop causal chains and generated bounded contexts.
Code Evolution: Given the injected diff, the LLM agent completed multi-file modifications on 10+ real-world sequence diagrams, achieving expected changes with zero unintended modifications.
KG Q&A: Deployed end-to-end. Designers queried multi-hop structural paths in natural language and received accurate evidence paths.
(Large-scale quantitative evaluation remains future work.)
tative evaluation and broader software evolution applications.
A. Comprehensive Benchmark. The absence of a standard public dataset for design-to-code evolution is a critical gap. We plan to construct a comprehensive benchmark by designing a suite of multi-level mutation operators. We will perform stratified sampling across all KG node types, injecting both Atomic Operations (add/modify/delete on isolated nodes) and Combined Mutations (multi-node linkage changes) to simulate complex scenarios. By tracing cascaded mutations, we can derive the precise Ground Truth for evaluation.
B. Quantitative Evaluation. Using the above benchmark, we will quantitatively evaluate our system against baselines including LLM autonomous retrieval (e.g., agentic RAG) and full-context prompting. We will measure the Diff engine's Boundary Precision and Recall (accuracy in capturing affected files) and Evolution Safety (compilation pass rate and unintended breaking changes).
C. Generalizing to Other Artifacts. While this paper focuses on design assets, our content-addressed diffing is domain-agnostic. We plan to generalize it to other structured artifacts, such as Database Schema Evolution (cascading to SQL views) and Infrastructure-as-Code (computing the blast radius in microservice topologies). This will further assist LLM agents in dependency-heavy evolution tasks.
V. RELATED WORK
Agentic software evolution [1], [2] is constrained by how agents acquire context during incremental modification. Existing frameworks use iterative planning [3] or graph retrieval [4], [5], discovering dependencies probabilistically. Aegis uses a DAG to route target code files to relevant architecture documents [6]. Our work targets design-to-code evolution: our Merkle DAG propagates design changes to compute the exact code files that must be modified, injecting this boundary as a hard constraint. LLM-assisted requirement diffing [7], traceability-guided generation [8], and knowledge-graph-augmented evolution [9] attempt to handle structural changes, yet none computes a deterministic impact boundary. Data dependency-aware generation from enhanced UML sequence diagrams [10] targets initial code synthesis but not subsequent design evolution. Agent benchmarks and frameworks [11]–[13] further reveal the persistent difficulty of multi-file consistency without a structural contract.
VI. Conclusion
We presented a deterministic structural constraint approach to resolve boundary ambiguity in LLM-driven software evolution. By computing causal impact boundaries via a Merkle DAG and injecting them into agents, we ensure safe, scoped code modifications. Preliminary industrial deployment confirms its feasibility, with future work focused on quantitative evaluation and generalization.
REFERENCES
[1] R. Hoda, “Toward agentic software engineering beyond code: Framing vision, values, and vocabulary,” in Proceedings of the 2026 International Workshop on Agentic Engineering, 2026, pp. 181–185.
[2] S. Sun and M. Staron, “Agentic pipelines in embedded software engineering: Emerging practices and challenges,” in 2026 IEEE International Conference on Software Analysis, Evolution and Reengineering (SANER). IEEE, 2026, pp. 136–146.
[3] R. Bairi, A. Sonwane, A. Kanade, V. D. C, A. Iyer, S. Parthasarathy, S. Rajamani, B. Ashok, and S. Shet, “Codeplan: Repository-level coding using llms and planning,” Proceedings of the ACM on Software Engineering, vol. 1, no. FSE, pp. 675–698, 2024.
[4] J. Li, X. Shi, K. Zhang, G. Li, Z. Jin, L. Li, H. Zhang, F. Liu, Y. Zhang, Z. Tao et al., “Graphcodeagent: Dual graph-guided llm agent for retrieval-augmented repo-level code generation,” arXiv preprint arXiv:2504.10046, 2025.
[5] K. Fedorov, B. Zarubin, and V. Ivanov, “Gracg: Graph retrieval augmented code generation,” in 2025 40th IEEE/ACM International Conference on Automated Software Engineering Workshops (ASEW). IEEE, 2025, pp. 291–298.
[6] fuwasegu, “Aegis: Dag-based deterministic context compiler for ai coding agents,” 2026, npm package: @fuwasegu/aegis. [Online]. Available: https://github.com/fuwasegu/aegis
[7] S. Yue et al., “Llm-assisted workflow for structural difference visualization in evolving software requirements,” in 2026 IEEE 34th International Requirements Engineering Conference (RE). IEEE, 2026, pp. 593–594.
[8] L. Chen, R. Chen, X. Li, S. Li, R. Gong, and L. Wang, “Incrertl: Traceability-guided incremental rtl generation under requirement evolution,” arXiv preprint arXiv:2603.25769, 2026.
[9] J. Kang, Y. Lu, C. Jiang, J. Liu, T. Zhang, B. Jiang, N. Sun, T. Wu, and G. Qi, “Kcoevo: A knowledge graph augmented framework for evolutionary code generation,” in International Conference on Database Systems for Advanced Applications. Springer, 2026, pp. 487–501.
[10] W. Mao, Z. Wang, L. Wang, S. Chen, C. Gao, L. Cao, Z. Liu, Q. Zhang, J. Zhou, and Z. Jin, “Data dependency-aware code generation from enhanced uml sequence diagrams,” arXiv preprint arXiv:2508.03379, 2025.
[11] C. E. Jimenez, J. Yang, A. Wettig, S. Yao, K. Pei, O. Press, and K. Narasimhan, “Swe-bench: Can language models resolve real-world github issues?” in International Conference on Learning Representations, vol. 2024, 2024, pp. 54 107–54 157.
[12] Y. Zhang, H. Ruan, Z. Fan, and A. Roychoudhury, “Autocoderover: Autonomous program improvement,” in Proceedings of the 33rd ACM SIGSOFT International Symposium on Software Testing and Analysis, 2024, pp. 1592–1604.
[13] F. Zhang, B. Chen, Y. Zhang, J. Keung, J. Liu, D. Zan, Y. Mao, J. G. Lou, and W. Chen, “Repocoder: Repository-level code completion through iterative retrieval and generation,” in Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, 2023, pp. 2471–2484.