betaFeedback

WorksComputer Science

RepoTrace: Improving Requirement Tracing in Multi-Round Agent Interactions

Abstract

Code agents have become increasingly capable of performing software engineering tasks through interaction with software environments. However, agents tend to degrade as the number of interaction rounds increases, making it difficult to maintain existing software during iterative modification. We analyze 2,656 agent trajectories in EvoCode-Bench and identify requirement focus misalignment as a recurring failure pattern, where agents struggle to distinguish the primary modification targets of a requirement from unrelated code. We propose Repotrace a requirement-driven repository understanding harness that combines repository structure with requirement semantics to construct a requirement-code correspondence and injects it into the agent context. This correspondence enables code agents to follow the repository architecture, trace requirements across multi-round interactions, and identify the core code elements corresponding to the current requirement. Experiments show that Repotrace improves the mean per-round reward (MPR) across different models (e.g., +19.99 on GLM-5.2) and agent harnesses (e.g., +10.22 on Claude Code). Across rounds, Repotrace increases the average per-round reward from 0.163 to 0.371 on Terminus-2 with DeepSeek-V4-Pro, while reducing average regression errors by 56.78%. We release the source code and agents' trajectories to support future research.

Introduction

Recently, code agents have become increasingly capable of performing software engineering tasks through interaction with software environments [31, 32]. A harness enables code agents to observe the environment, use tools, execute actions, receive execution feedback, and update memory [3]. Through multi-round interaction with the environment, code agents have demonstrated strong capabilities in repository-level code generation, vulnerability discovery, and software testing [1, 2, 9]. Vibe coding shifts software development from one-shot code generation to iterative modification of existing software systems  [39], where software maintenance and evolution are also important parts of the software life cycle [35, 36]. Future software development requires agents not only to satisfy current user requirements, but also to understand the architecture of existing repositories and the potential impact of their modifications.

However, recent studies show that code agents tend to degrade as the number of interaction rounds increases in complex multi-round software engineering tasks [15, 10, 16, 13]. For example, EvoCode-Bench [15] contains 26 stateful tasks and 227 interaction rounds from 12 mainstream code agents. The analysis of failure cases shows that the test pass rate decreases from 46.7% in early rounds to 7.7% in later rounds. Regression Accumulation [10] evaluates 542 tasks over 8 rounds, covering 26,016 interaction instances, and reports that 40%–73% of tasks lose previously satisfied behaviors during multi-round interactions.

Software has two fundamental properties: constructivity and evolvability [12, 11]. Constructivity refers to building software systems that satisfy functional goals based on requirements. Evolvability refers to the ability of software systems to iteratively adapt to changes in requirements, environments, and technologies while maintaining system integrity and consistency. The challenges introduced by software evolvability receive more and more attention, including architecture maintenance and dependency management [8]. Recent studies have explored self-evolving software and recursive self-improvement (RSI), further demonstrating the importance of evolvability [40, 41, 42].

To further understand the challenges faced by code agents during multi-round interactions, we systematically analyze 2,656 agent trajectories from EvoCode-Bench. We identify requirement focus misalignment as a recurring failure pattern. Specifically, code agents struggle to distinguish the primary modification targets of a requirement from related code elements (e.g., classes, functions, and files) that do not require direct modification. As a result, code agents may modify unrelated code or miss necessary synchronized updates. Across failure rounds, 55.16% of code modifications occur outside the modification target files specified by the human oracle (see § 2).

To this end, we propose RepoTrace, a requirement-driven repository understanding harness that improves requirement tracing for code agents in multi-round software tasks. The core idea of RepoTrace is to explicitly guide code agents to establish the correspondence between requirements and the code repository before code modification. Specifically, RepoTrace first builds a structural representation of the code repository from code relations and computes a structural weight for each code element. The weights help identify core elements, extension points, and change propagation across the repository. Next, RepoTrace extracts the potential modification scope from the semantics of the natural-language requirement. Finally, RepoTrace combines requirement semantics with repository structure to construct a requirement-code correspondence and injects it into the agent context. RepoTrace allows code agents to trace the repository architecture across rounds and identify the core code elements corresponding to the current requirements.

We apply RepoTrace to multiple mainstream code agents and conduct experiments on multi-round software tasks. Experimental results show that: Across models, RepoTrace improves the mean per-round reward (MPR) by +19.99 on GLM-5.2 and +4.91 on MiniMax-M3. Across harnesses, RepoTrace improves MPR by +22.25 on Terminus-2 and +10.22 on Claude Code. Across rounds, RepoTrace increases the average per-round reward from 0.163 to 0.371 on Terminus-2 with DeepSeek-V4-Pro, while reducing average regression errors by 56.78%. The main contributions are summarized as follows:

  1. We analyze agent trajectories and identify requirement focus misalignment as a recurring failure pattern during multi-round interactions.

  2. We propose RepoTrace, a requirement-driven repository understanding harness that combines repository structure and requirement semantics to improve requirement tracing for agents.

  3. Experimental results show that RepoTrace improves performance across models and harnesses in multi-round interactions, and reduces regression errors.

Motivating Examples

Figure 1. Two examples of requirement focus misalignment. (a) Unrelated code modification: the agent rewrites a shared dispatcher and omits the existing validate() command. (b) Missing update: the agent adds the output field but omits the code that collects its values.

In this section, we use two real-world examples of multi-round repository modification to illustrate requirement focus misalignment: code agents modify unrelated code or omit necessary updates. The examples are from real-world software development tasks in EvoCode-Bench [15] and include human-written oracle solutions.

Unrelated code modification. In Figure 1(a), the requirement asks the agent to update the rollback behavior and add the snapshot() and restore() functions. The human-written oracle modifies the corresponding logic in pipeline.sh. The agent instead rewrites .pipeline/pipeline.py, a shared command dispatcher that contains commands unrelated to the requirement. During the rewrite, the agent omits the existing validate() command and breaks the validation functionality.

Missing update. In Figure 1(b), the requirement asks each detected anomaly to include an evidence object. For a gradient spike, evidence.window_values records up to five preceding gradient-norm values. The values are collected in detector.go and formatted for output in main.go. The human-written oracle updates both components. However, the agent modifies only the output-related code in types.go and main.go and omits the update to detector.go. Consequently, the output contains the evidence field, but window_values remains empty.

The two examples show two forms of requirement focus misalignment: unrelated code modifications and missing updates. Across failed interaction rounds after Round 1, 55.16% of source-file modifications occur outside the modification target files specified by the human-written oracle (see Appendix § 9 for the experimental details). The finding motivates RepoTrace, which helps code agents identify the code elements corresponding to the current requirement.

Related Work

Code Agents in Multi-Round Interactions

Code agents have demonstrated strong capabilities in software engineering tasks. Commercial products such as Claude Code, Codex and Kimi Code [31, 32, 37] bring agentic coding into daily development practice. From function-level HumanEval [38], to repository-level SWE-bench [33, 43], to long-horizon tasks like Terminal-Bench [34], code agents continuously achieve high scores. Many existing benchmarks focus on single-round, one-shot code generation, where software maintenance and evolution remain important throughout the software life cycle [35, 36]. However, recent studies show that code agents tend to degrade as the number of interaction rounds increases. [13] finds that top-tier models lose roughly 39% of their average success rate compared to single-round settings, and [14] reports a 20%-27% average drop in correct-and-secure outputs across 32 models. Similarly, SlopCodeBench reports that no agent solves all tasks, where the best agent passes only 14.8% of checkpoints, and 77% of trajectories exhibit structural erosion, while 75.5% suffer from verbosity [16]. Complementary studies report consistent findings, including declining accuracy under iterative refinement, low completion rates under stepwise requirement refinement, instruction forgetting, and progressive faithfulness loss to emergent specifications [17, 18, 19, 20].

Requirements Tracing and Repository-Level Code Understanding

Requirements traceability refers to the ability to describe and follow the life of a requirement [47], which is an active research topic in software engineering. Recent studies explore the combination of LLMs with structured methods for requirements tracing. TraceDev proposes a multi-agent framework that links requirements, design models, and code in a heterogeneous traceability graph to explicitly maintain consistency among software artifacts [23]. RAG-based methods further recover requirement trace links in a largely domain-agnostic manner [21, 22]. Existing studies demonstrate the potential of language models in requirements tracing and the impact analysis of change [24]. However, they don’t consider how requirement-artifact consistency should be maintained as requirements evolve over multiple rounds of development.

Meanwhile, repository-level code understanding is another key research direction. GraphCoder proposes the code context graph (CCG), which structures information such as control flow and data dependencies into a graph to improve context retrieval for repository-level code completion [25]. CodexGraph and RANGER organize repositories as knowledge graphs, supporting graph queries and natural-language retrieval [27, 28]. Most recently, LocAgent and DyRetriever allow agents to navigate or perform multi-hop reasoning along dependency graphs, achieving low-cost code localization and context retrieval [29, 30]. Existing methods enhance the understanding of code structure from different angles [26]. However, they primarily target static repositories or one-shot generation, without considering how repository structure should be maintained and updated during multi-round interactions.

RepoTrace

We propose RepoTrace, a requirement-driven repository understanding harness for code agents in multi-round interactions. To address requirement focus misalignment, RepoTrace combines repository structure with requirement semantics before code modification. The agent receives the current requirement together with structural dependencies and information about code elements associated with prior requirements.

Figure 2 illustrates the framework. At round tt, RepoTrace takes the current code repository RtR_t and the natural-language requirement rtr_t. The following subsections introduce three steps: how RepoTrace constructs a structural representation GtG_t of the repository; how RepoTrace extracts requirement entities QtQ_t using the current requirement, the structural representation GtG_t, and prior requirement records; and how RepoTrace combines GtG_t and QtQ_t to construct a requirement-code correspondence message MtM_t, maintain requirement tracing across rounds.

Repository Structure Analysis

Structural representation.

Let VtV_t denote the set of source files collected from RtR_t, and let EtE_t denote the collected directed file relations. A relation (u,v)∈Et(u,v)\in E_t indicates that file uu refers to code in file vv. The representation GtG_t contains these file and relation sets, an index that associates symbols with their defining files, and file-level structural weights. To obtain GtG_t, we first extract the relations and symbol index, then compute the structural weights. We also compare GtG_t with the previous representation to identify structural changes across rounds.

Code relations.

To obtain the file relations and symbol index, RepoTrace collects source-file paths, import declarations, symbol definitions, and candidate call sites from RtR_t. Specifically, we record (u,v)(u,v) when file uu imports code from file vv or contains a candidate call site whose name matches a symbol defined in vv. We resolve repository-local imports and aggregate matched calls into file relations. These relations provide an approximate structural view, and the symbol index connects names in a requirement to repository files.

Structural weights.

To identify core files that may affect dependent files, we compute two structural scores from code relations. We apply PageRank [46] to the file graph formed by nodes VtV_t and relations from EtE_t whose endpoints are both in VtV_t. We also compute the fan-in of each file, defined as the number of distinct files that refer to it. PageRank captures the structural importance of files in the dependency graph, while fan-in measures how many files directly depend on each file. We use PageRank to prioritize files included in the LLM prompt and to order examples of dependent files. We use fan-in to select files referenced by multiple files and to rank the existing-file overview in the agent context. Two scores expose structural dependencies without assuming that structurally important files require modification.

Structural changes.

To reflect code modifications across rounds, RepoTrace reconstructs GtG_t from the current repository before processing each requirement. To identify what has changed, we compare GtG_t with the most recent retained representation GprevG_{\mathrm{prev}}, whose file and relation sets are VprevV_{\mathrm{prev}} and EprevE_{\mathrm{prev}}. We summarize structural changes as

Δt=(Vt∖Vprev,  Vprev∖Vt,  Et∖Eprev,  Eprev∖Et).\begin{equation} \Delta_t = \bigl( V_t \setminus V_{\mathrm{prev}},\; V_{\mathrm{prev}} \setminus V_t,\; E_t \setminus E_{\mathrm{prev}},\; E_{\mathrm{prev}} \setminus E_t \bigr). \tag*{(1)} \end{equation}

The four components record added files, removed files, added relations, and removed relations, respectively. For the first round, the previous file and relation sets are empty. This summary provides structural changes observed before the current modification, including changes made during preceding rounds. The analysis produces the current structural representation GtG_t and the change summary Δt\Delta_t for requirement semantics extraction. For specific examples, see Appendix § 8.1.

Figure 2. Overview of RepoTrace in multi-round interactions. Left: an illustrative sequence of requirements for the same code repository. Right: before each code modification, RepoTrace analyzes repository structure, extracts requirement semantics, and constructs a requirement-code correspondence message MtM_t for the code agent.

Requirement Semantics Extraction

Building on GtG_t and Δt\Delta_t, RepoTrace analyzes the current requirement rtr_t and prior requirements r<tr_{<t}, in order to identify candidate primary modification targets and potentially affected code elements. To connect rtr_t with r<tr_{<t}, RepoTrace retains a history H<t\mathcal{H}_{<t} of earlier requirement records, including their extracted code elements and summaries. RepoTrace combines rtr_t, GtG_t, Δt\Delta_t, and H<t\mathcal{H}_{<t} to produce a structured record of requirement entities:

Qt=Extract⁡(rt,Gt,Δt,H<t).\begin{equation} Q_t = \operatorname{Extract} \bigl(r_t, G_t, \Delta_t, \mathcal{H}_{<t}\bigr). \tag*{(2)} \end{equation}

The record QtQ_t contains candidate target files and symbols, behavior constraints, potentially affected prior code elements, and a requirement summary. These fields represent two roles: candidate primary modification targets and potentially affected prior code elements.

For LLM-based extraction, RepoTrace calls an LLM to analyze the current requirement, a list of files ranked by PageRank, symbol-to-file associations, and a bounded summary of recent requirement records. When prior records exist, RepoTrace also includes a compact summary of Δt\Delta_t in the prompt. The LLM extracts the requirement entities and returns the structured record QtQ_t. If no LLM is configured or extraction fails, a keyword fallback matches file paths and identifiers in rtr_t against the repository index. The fallback compares these matches with historical targets to distinguish newly identified targets from potentially affected prior code elements without using Δt\Delta_t. In both paths, the records retain associations between requirements and code elements across rounds. For specific examples, see Appendix § 8.2.

Agent Context Augmentation across Rounds

The requirement semantics extraction produces QtQ_t, which identifies candidate primary modification targets and potentially affected prior code elements. RepoTrace combines this requirement-specific information with the structural representation GtG_t to construct a requirement-code correspondence message for the code agent. To maintain requirement tracing across rounds, RepoTrace also retains the current structural representation and requirement record for use in subsequent rounds.

Requirement-code correspondence.

The structural representation GtG_t describes code relations, while QtQ_t identifies candidate code elements associated with the current and prior requirements. To provide the code agent with context for the current requirement, we select information from both to construct the requirement-code correspondence message:

Mt=Compose⁡(Gt,Qt),r~t=rt∘Mt,\begin{equation} M_t = \operatorname{Compose}(G_t,Q_t), \qquad \widetilde{r}_t = r_t \circ M_t, \tag*{(3)} \end{equation}

where ∘\circ denotes text concatenation. The message combines four types of information: code relations for files with high fan-in and selected direct dependents; an overview of existing files and candidate new files; potentially affected prior code elements; and verification guidance. We identify candidate new files by comparing the target paths in QtQ_t with VtV_t. The verification guidance asks the agent to build and test the modified repository and suggests a command based on the programming languages in the repository. The message uses selected fields of QtQ_t, rather than reproducing the entire extraction record. The code agent receives the original requirement with this supplemental context and retains responsibility for code modification and verification.

Maintaining records across rounds.

To reuse the current analysis in later rounds, RepoTrace stores the current graph representation and appends the current requirement record to its history after constructing MtM_t and before the code agent executes. The agent then modifies the repository, whose state is observed as Rt+1R_{t+1} at the next round. At that round, RepoTrace reconstructs the repository structure, compares it with the retained graph, and reuses prior requirement records during extraction, repeating the three steps for the next requirement. Graph snapshots and requirement records therefore describe prior analyses, rather than verified completion states. For specific examples, see Appendix § 8.3.

Experiments

To evaluate the effectiveness of RepoTrace, we conduct experiments with multiple code agents on multi-round software tasks. In this section, we introduce the benchmarks, baselines, models, and evaluation metrics. We then present the experimental results and analysis.

Experimental Setup

Benchmarks.

We evaluate code agents on EvoCode-Bench [15], which contains 26 stateful software engineering tasks and 227 evaluated rounds across six technical domains, including ML/MLOps, data engineering, systems and code, scientific computing, testing and automation, and infrastructure and security. Each task contains 5-15 rounds, with the same workspace and agent session preserved across rounds. Each round introduces a new requirement and uses cumulative test cases to verify the current and previous active requirements. A round receives a reward only when all test cases pass.

Baselines and Models.

We integrate RepoTrace into two agent harnesses, Terminus-2 [45] and Claude Code [31], within the Harbor agent environment [44]. We evaluate four models: GLM-5.2 [4], DeepSeek-V4-Pro [5], MiniMax-M3 [7], and Qwen3.7-Max [6]. We access all models via API. All API configurations (e.g., temperature, top-kk, and thinking effort) use the default settings.

Evaluation Metrics.

We follow the evaluation setting of EvoCode-Bench [15].

  1. Mean per-round reward (MPR) ↑\uparrow measures the fraction of passed rounds, where a round is counted as passed only when all test cases pass. The reward is averaged across all tasks.

  2. Final-round completion rate (FCR) ↑\uparrow measures the average test case completion rate of the final round across all tasks. The test cases are cumulative, so completing the final-round test cases means that all requirements in the requirement chain are satisfied.

  3. Perfect-task rate (PTR) ↑\uparrow measures the fraction of tasks in which a single attempt passes every round.

  4. Hard-task rate (HTR) ↓\downarrow measures the fraction of tasks whose per-task score is at most 0.5.

  5. Test Case Score (TCS) ↑\uparrow measures the average test case completion rate of the entire dataset.

  6. Input / Output Tokens (IT / OT) ↓\downarrow measure the total number of input / output tokens used across all rounds of all tasks in the dataset, expressed in millions of tokens (M).

RQ1: To what extent does RepoTrace improve performance across different models?

MPR↑\uparrowFCR↑\uparrowPTR↑\uparrowHTR↓\downarrowTCS↑\uparrowIT(M)↓\downarrowOT(M)↓\downarrow
DeepSeek-V4-Pro14.1411.543.8592.3161.74441.3312.51
w/ RepoTrace36.3934.6215.3861.5473.63319.4816.92
GLM-5.216.193.853.8588.4647.5298.267.62
w/ RepoTrace36.1830.777.6961.5477.33175.6212.30
MiniMax-M323.4223.087.6973.0861.46726.665.89
w/ RepoTrace28.3315.387.6973.0876.761445.577.99
Qwen3.7-Max11.877.690.0092.3167.37227.497.89
w/ RepoTrace11.363.850.0092.3166.06275.649.07

To answer RQ1, we evaluate four representative models with and without RepoTrace on EvoCode-Bench, in order to verify whether RepoTrace improves model performance on multi-round software engineering tasks. Table tab:evocodebench_token reports the results.

RepoTrace brings improvement on stronger models that can effectively exploit repository-level guidance, while the benefit is limited for models that struggle to utilize it. On DeepSeek-V4-Pro, RepoTrace raises MPR from 14.14 to 36.39 (+22.25, about 2.57×2.57\times), with FCR and PTR improving by about 3×3\times and 4×4\times respectively. This shows that the traced repository-level guidance translates into both higher per-round success and more fully completed tasks. The benefit is limited for Qwen3.7-Max, suggesting that the advantage scales with the model’s ability to exploit the injected guidance. The extra token cost is acceptable. On DeepSeek-V4-Pro, RepoTrace reduces IT from 441.33M to 319.48M (−27.61%-27.61\%) while tripling MPR, since repository-level guidance prunes redundant exploration of the codebase. Considering that OT rises only moderately across all models and IT even decreases on the strongest performer, we regard the overall token overhead as acceptable. Overall, RepoTrace improves model performance on EvoCode-Bench with an acceptable efficiency cost.

RQ2: To what extent does RepoTrace improve performance across different harnesses?

AgentMPR↑\uparrowFCR↑\uparrowPTR↑\uparrowHTR↓\downarrowTCS↑\uparrowIO↓\downarrowOT↓\downarrow
Terminus-214.1411.543.8592.3161.74441.3312.51
w/ RepoTrace36.3934.6215.3861.5473.63319.4816.92
Claude Code44.6542.3119.2357.6991.14842.067.99
w/ RepoTrace54.8746.1526.9250.0093.02675.369.44

To answer RQ2, we evaluate RepoTrace on two harnesses (i.e., Terminus-2 and Claude Code, both driven by DeepSeek-V4-Pro) to verify whether the effectiveness of RepoTrace generalizes across different agent harnesses. Table tab:evocodebench_harness reports the results.

RepoTrace improves performance across different harnesses. On the weaker Terminus-2, RepoTrace raises MPR from 14.14 to 36.39 (about 2.57×2.57\times) and PTR from 3.85 to 15.38 (about 4×4\times). On Claude Code, RepoTrace further improves MPR from 44.65 to 54.87 (+10.22 points), suggesting that the repository-level context extracted by RepoTrace complements the context extracted by the harness (see RQ4 and Appendix § 8). Token efficiency improves consistently as well when using DeepSeek-V4-Pro: IT decreases by 27.61%27.61\% on Terminus-2 and by 19.80%19.80\% on Claude Code, while OT rises only slightly on both harnesses. Overall, RepoTrace brings consistent improvement across harnesses at an acceptable efficiency cost.

RQ3: How does RepoTrace’s improvement vary across rounds?

Figure 3, panel 1Vector (PDF) (a) Mean Reward and Mean Pass Rate

Figure 3, panel 2Vector (PDF) (b) Regression Test Accuracy

Figure 3. Results of DeepSeek-V4-Pro on EvoCode-Bench using Terminus-2 and Claude Code, with and without RepoTrace. (a) Mean reward (left axis) and mean pass rate (right axis) over 10 rounds: the average reward and the average fraction of test cases passed per round, each averaged over tasks. (b) Regression test accuracy in multi-round interactions: for each round i∈{2,…,11}i \in \{2,\ldots,11\}, we report the mean pass rate over all test cases belonging to rounds 1,…,i−11,\ldots,i-1, averaged over 26 tasks. Higher values indicate fewer regression errors.

Figure 4. Heatmap of the per-round mean reward for each harness-RepoTrace combination.

To answer RQ3, we analyze the per-round behavior of DeepSeek-V4-Pro on EvoCode-Bench under both harnesses over 10 rounds. Figure 3 reports the per-round mean reward, mean pass ratio, and the regression errors on earlier rounds’ test cases, and Figure 4 visualizes the per-round mean reward of each harness–RepoTrace combination.

RepoTrace mitigates error accumulation and regression across rounds. On Terminus-2, vanilla collapses after the first round, dropping from 0.38 in round 1 to 0.08 ∼\sim 0.15 in rounds 2 to 7. In contrast, RepoTrace maintains a mean reward between 0.29 and 0.50 and leads in all 10 rounds. The regression results further confirm this gap. Vanilla’s pass rate on the test cases of earlier rounds degrades from 84.68 at round 2 to only 14.62 at round 11, while RepoTrace keeps this rate above 80 in every round. Averaged over rounds 2 to 11, RepoTrace improves this pass rate from 57.06 to 89.46 (+32.40 points, a 56.78% relative improvement), which means fewer regression errors. Overall, the benefit of RepoTrace persists as rounds advance, with a steady improvement in both harnesses.

RQ4: How Does RepoTrace Improve Requirement Tracing?

In RQ4, we use a case study to further examine how RepoTrace improves requirement tracing. JobForge is a nine-round software task from EvoCode-Bench. A code agent incrementally develops a Go command-line tool as new requirements arrive. Round 6 adds the schedule subcommand. Round 7 adds the critical subcommand for critical-path analysis while requiring existing functionality to remain correct. We compare Vanilla and RepoTrace trajectories produced with the same requirement chain, model, and execution environment. We independently replayed both trajectories and confirmed their outcomes. Figure 5 compares the code modifications under the two settings.

RepoTrace aligns code modifications focused on the current requirement and reduces unintended changes to existing functionality. In the Vanilla, the agent added critical to the shared command dispatcher but left the existing schedule branch without a call to scheduleCmd(). The command dispatcher routes each subcommand to its implementation. The missing call therefore broke the scheduling functionality introduced in Round 6. In the RepoTrace, the requirement-code correspondence identified cmd/jobforge/critical.go and cmd/jobforge/main.go as candidate primary modification targets, and criticalCmd and related critical-path functions as candidate symbols. The repository structure also showed the existing schedule implementation. Using the correspondence, the agent added a separate dispatch branch for critical and preserved the existing schedule →\rightarrow scheduleCmd() relation. Overall, RepoTrace combines requirement semantics with repository structure to identify primary modification targets and preserve existing functionality, reducing requirement focus misalignment.

Figure 5. Case study of RepoTrace on JobForge. In the Vanilla setting, adding the critical subcommand breaks the existing schedule dispatch. In the RepoTrace setting, the requirement-code correspondence guides the agent to add an independent critical branch while preserving the schedule function, satisfying both the current and prior requirements.

Discussion

In this section, we discuss 1) the applicability of RepoTrace and 2) the role of requirements in agentic software engineering.

As a requirement-driven repository understanding method, RepoTrace can be extended to different harnesses through the requirement-code correspondence produced by RepoTrace. Both humans and code agents can modify the correspondence, allowing RepoTrace to work with different harnesses without directly modifying their execution process. Deeper integration (e.g., using hooks) may provide more control but reduce the range of applicable RepoTrace. Supporting a wider range of harnesses while maintaining effective integration remains an open problem.

Requirements play a central role in agentic software engineering. Code agents need to translate requirements into code changes and retain previous requirements as the software evolves. As the interaction horizon grows, agents may get lost, focus on the most recent requirement, and miss requirements addressed in earlier rounds. Therefore, maintaining requirements throughout software development can help agents preserve their objectives while making new changes. More broadly, requirements provide a persistent source of objectives for agents to build on their previous experience, which is important for RSI.

Conclusion and Future Work

We present RepoTrace, a requirement-driven repository understanding harness that improves requirement tracing in multi-round agent interactions. RepoTrace helps code agents focus on relevant code and preserve existing functionality across interactions. In future work, we plan to: 1) explore how to manage and abstract requirement changes through structured representations, as with code, and 2) study how RepoTrace can help promote RSI.

AI use statement

In preparing this manuscript, we use LLMs to assist with writing and coding. Specifically, LLMs improve clarity, grammar, and phrasing, ensuring the text is concise and readable. The use of LLMs does not influence the technical contributions or the interpretation of experimental findings. All content edited by LLMs was carefully checked by at least two authors.

Specific Examples of RepoTrace

We use JobForge Round 7 to illustrate the three steps in Section 4: repository structure analysis, requirement semantics extraction, and agent context augmentation across rounds. JobForge is a Go command-line tool developed over multiple rounds. Round 6 introduces the schedule subcommand. In Round 7, the requirement r7r_7 asks for a critical subcommand that reports the longest dependency chain by job count and preserves all existing behavior. The following examples connect this requirement to the structural representation G7G_7, requirement entities Q7Q_7, and requirement-code correspondence message M7M_7.

Repository Structure Analysis

Following Section 4.1, the structural representation describes the repository before the current code modification. Figure 6(a) lists the 13 source files in V7V_7, including main.go and schedule.go. All listed paths share the prefix cmd/jobforge/. The structural change summary Δ7\Delta_7 records schedule.go as an added file relative to the preceding snapshot. This entry captures a change observed before Round 7, rather than a file proposed for the current requirement.

Figure 6. Repository structure and selected requirement entities for JobForge Round 7. Panel (a) shows the source-file set V7V_7, and panel (b) shows candidate targets and potentially affected prior code elements from Q7Q_7. The bottom row shows the added-file entry in Δ7\Delta_7. These records distinguish the existing schedule.go file from the candidate new file critical.go.

Requirement Semantics Extraction

To identify code elements associated with r7r_7, the extraction step uses the inputs defined in Section 4.2: the current requirement, repository structure, structural changes, and prior requirement records. Figure 7 shows how the reference prompt organizes these inputs. The file lists and symbol-to-file associations summarize GtG_t; {instruction} supplies rtr_t; and {prev_block} supplies H<tH_{<t} and Δt\Delta_t when prior records exist. The requested JSON fields correspond to the candidate target files and symbols, behavior constraints, potentially affected prior code elements, and summary in QtQ_t.

For JobForge Round 7, the saved extraction record identifies critical.go and main.go as candidate target files, together with symbols such as criticalCmd (Figure 6(b)). The behavior constraints specify the critical-path output and require all existing subcommands to remain unchanged. The affected_prior field is empty: no specific prior code elements are listed in that field. The preservation requirement is therefore represented by a behavior constraint, rather than by an explicit list of affected prior code elements. These fields provide the requirement-specific information used in the next step.

Figure 7. Reference prompt for requirement semantics extraction in Section 4.2. The upper box organizes the extraction inputs and specifies the fields of QtQ_t. The lower box expands {prev_block} with prior requirement records and structural changes. The template wording is retained; line wrapping and Python brace escaping are adjusted for display.

Agent Context Augmentation Across Rounds

The correspondence message connects the candidate targets in Q7Q_7 to the repository described by G7G_7, illustrating the role of MtM_t in Section 4.3. Figure 8 shows excerpts from the actual Round 7 message. Comparing the target paths with V7V_7 identifies critical.go as a candidate new file and main.go as an existing file. The message thus distinguishes creating the requested implementation from modifying existing code.

To retain the context of earlier requirements, the recorded message also includes the Round 6 scheduling requirement and its candidate targets, schedule.go and main.go. Together with the constraint that existing subcommands remain unchanged, this history reminds the agent to preserve scheduling behavior when adding critical. The verification guidance asks the agent to check that affected code still builds and preserves existing behavior. The complete message appears verbatim in the first user input of the Round 7 agent trajectory, alongside the current requirement.

This example shows how prior requirement records supplement the current requirement before code modification. As described in Section 4.3, RepoTrace retains graph snapshots and requirement records for subsequent rounds. These records preserve earlier analyses; they do not certify that the agent has completed a requirement or passed its tests.

Figure 8. Excerpts from the requirement-code correspondence message M7M_7 supplied to the code agent. The message includes prior requirements, repository structure, candidate targets, existing/new-file mappings, and verification guidance. Ellipses mark omitted lines. The empty impact list reflects E7=∅E_7=\emptyset; the original phrase leaf components does not establish the absence of source-code dependencies.

Setting for Requirement Focus Misalignment Analysis

We systematically analyze 2,656 agent trajectories from EvoCode-Bench. Following the terminology used in the main text, each agent trajectory denotes the interaction trace associated with one model–task round. These trajectories cover 26 multi-round software evolution tasks and 12 code models.

For each trajectory at round rr, we define ArA_r as the set of source-code paths modified by the agent and OrO_r as the set modified by the benchmark-provided oracle implementation. We statically extract ArA_r from mutation operations recorded in the agent trajectory and extract OrO_r from the corresponding solve.sh and solution artifacts. File paths are normalized relative to the repository root and deduplicated within each round. We retain source files written in Go, Python, JavaScript/TypeScript, Java, C/C++, Rust, Ruby, PHP, and shell. Tests, third-party dependencies, build outputs, caches, temporary files, and common documentation files are excluded using fixed path-based rules.

Before computing the aggregate metric, we apply a conservative parsing-quality filter. The static parser resolves concrete file paths for 19,431 of the 19,926 detected mutation-related command instances, corresponding to a parsing coverage of 97.52%. We exclude any trajectory containing an unresolved mutation operation because its extracted modification set may be incomplete. This excludes 143 trajectories. One additional trajectory is excluded because its trajectory artifact is unavailable, leaving 2,512 trajectories with reliably extracted path sets.

The main analysis focuses on failed trajectories and excludes Round 1, which often involves repository initialization and has a qualitatively different modification scope from subsequent evolution rounds. This selection results in 1,846 trajectories. We measure file-level deviation from the oracle modification scope as

OffOracle=∑r∣Ar∖Or∣∑r∣Ar∣.\begin{equation} \mathrm{OffOracle} = \frac{\sum_{r} |A_r \setminus O_r|} {\sum_{r} |A_r|}. \tag*{(4)} \end{equation}

Under this setting, 2,132 of the 3,865 agent-modified source-file instances fall outside the oracle modification scope, yielding an off-oracle ratio of 55.16%.

This metric measures disagreement with the modification scope of the benchmark reference implementation; it does not assume that the oracle provides the only valid implementation. The analysis is path-based and does not distinguish content-equivalent, whitespace-only, or comment-only writes. It also cannot verify whether every statically detected command successfully modified the workspace. We therefore report 55.16% as a corpus-level static estimate rather than a full-corpus replay ground truth. In a 30-trajectory calibration, the static and replay estimates under the same failed-trajectory, non-Round-1 setting are 32.26% and 34.29%, respectively.

HTML Report of Repository Changes Across Rounds

We provide an HTML report of the JobForge trajectory in the Supplementary Material. The report organizes repository snapshots by round and displays candidate targets, extracted symbols, potentially affected prior code elements, and added files alongside file and function-call diagrams. Readers can browse the report in a web browser. Code agents equipped with file or browser tools can inspect the same HTML artifact. The supplied report is a static document that supports inspection of the recorded changes.

Figure 9 shows excerpts from Rounds 6–8. The file count increases from 12 to 13 and then 14. In Round 6, schedule.go appears as a candidate target. In Round 7, schedule.go appears in the added-file record, and critical.go becomes a candidate target. In Round 8, critical.go appears in the added-file record. These entries distinguish the targets of a current requirement from file additions observed in a subsequent snapshot. See the Supplementary Material for the complete nine-round report.

Figure 9, panel 1 (a) Round 6: 12 files; schedule.go is a candidate target. Figure 9, panel 2 (b) Round 7: 13 files; schedule.go appears as an added file. Figure 9, panel 3 (c) Round 8: 14 files; critical.go appears as an added file.

Figure 9. Cropped screenshots of three consecutive records in the supplementary HTML report. The report combines extraction fields with function-call graphs re-collected from a reconstructed agent workspace. Its call-edge counts therefore describe the supplementary reconstruction, not the saved file-relation sets in Appendix § 8.1.

Figure 10 and Figure 11 show corresponding file-level details from the reconstructed function-call diagrams. The outer boxes group functions by file. Solid arrows denote cross-file calls, and dashed arrows denote calls within a file. The screenshots retain the original labels and show local regions of the larger diagrams; some cross-file arrows continue beyond the crop boundaries.

Figure 10

Figure 10. The schedule.go region of the Round 7 HTML diagram. The screenshot shows scheduleCmd and functions for parsing worker settings, computing the schedule, and formatting output. This file corresponds to the added-file entry in Figure 9(b).

Figure 11

Figure 11. The critical.go region of the Round 8 HTML diagram. This file corresponds to the added-file entry in Figure 9(c). The full diagram, including connections to other files, is available in the supplementary HTML report.

Figure 12

Figure 12. The overall repository structure and function-call graph for Round 7 in the supplementary HTML report.

References

  1. [1]Anthropic. (2026). 2026 Agentic Coding Trends Report. In Anthropic. https://resources.anthropic.com/hubfs/2026%20Agentic%20Coding%20Trends%20Report.pdfresources.anthropic.com/hubfs/2026%20Agentic%20Coding%20Trends%20Report.pdf
  2. [2]Carlini, N., Lucas, K., Asher, E. B., Cheng, N., Lakhani, H., Forsythe, D., & Guru, K. (2026). Evaluating and Mitigating the Growing Risk of LLM-Discovered 0-Days. In Anthropic. https://www.anthropic.com/research/zero-daysanthropic.com/research/zero-days
  3. [3]Sumers, T. R., Yao, S., Narasimhan, K., & Griffiths, T. L. (2024). Cognitive Architectures for Language Agents. Trans. Mach. Learn. Res., 2024.
  4. [4]GLM. (2026). GLM-5: from Vibe Coding to Agentic Engineering. CoRR, abs/2602.15763.
  5. [5]DeepSeek-AI. (2026). DeepSeek-V4: Towards Highly Efficient Million-Token Context Intelligence. CoRR, abs/2606.19348.
  6. [6]Qwen Team. (2026). Qwen3.7: The Agent Frontier. https://qwen.ai/blog?id=qwen3.7qwen.ai/blog?id=qwen3.7
  7. [7]Lai, X., Xu, W., Yang, Y., Chen, Q., Xu, Y., Zeng, L., Li, X., Sun, H., Zhu, H., Zhang, V., Hu, J., Li, J., Gao, R., Li, Z., Zhu, S., Zhou, J., & Zhao, P. (2026). MiniMax Sparse Attention. https://arxiv.org/abs/2606.13392
  8. [8]Gu, F., Liang, Z., Ma, J., & Li, H. (2026). The Matthew effect of AI programming assistants: A hidden bias in software evolution. International Conference on Learning Representations, 2026, 68445–68470.
  9. [9]Maaz, M., DeVoe, L., Hatfield-Dodds, Z., & Carlini, N. (2026). Finding Bugs Across the Python Ecosystem with Claude and Property-Based Testing. In Anthropic. https://www.anthropic.com/research/property-based-testinganthropic.com/research/property-based-testing
  10. [10]Huang, Y., Ma, L., Tahir, A., Zhang, Q., Xiao, L., & Xiao, L. (2026). Regression Accumulation in Multi-Turn LLM Programming Conversations. CoRR, abs/2607.01855.
  11. [11]Breivold, H. P., Crnkovic, I., & Larsson, M. (2012). Software architecture evolution through evolvability analysis. Journal of Systems and Software, 85(11), 2574–2592.
  12. [12]Yang, F.-Q. (2005). Thinking on the development of software engineering technology. Journal of Software, 16(1), 1–7.
  13. [13]Laban, P., Hayashi, H., Zhou, Y., & Neville, J. (2025). LLMs Get Lost In Multi-Turn Conversation. CoRR, abs/2505.06120.
  14. [14]Rawal, R., Chiang, J. Y. F., Shen, C., Tian, J. S., Mahajan, A., Goldstein, T., & Chen, Y. (2025). Benchmarking Correctness and Security in Multi-Turn Code Generation. CoRR, abs/2510.13859.
  15. [15]Shen, H., Chen, X., Xu, W., Ma, Y., Chen, L., & Li, K. (2026). EvoCode-Bench: Evaluating Coding Agents in Multi-Turn Iterative Interactions. CoRR, abs/2605.24110.
  16. [16]Orlanski, G., Roy, D., Yun, A., Shin, C., Gu, A., Ge, A., Adila, D., Sala, F., & Albarghouthi, A. (2026). SlopCodeBench: Benchmarking How Coding Agents Degrade Over Long-Horizon Iterative Tasks. CoRR, abs/2603.24755.
  17. [17]Wang, S., Wang, Z., Ma, D., Yu, Y., Ling, R., Li, Z., Xiong, F., & Zhang, W. (2026). CodeFlowBench: A Multi-turn, Iterative Benchmark for Complex Code Generation. ACL (1), 4369–4402.
  18. [18]Zhan, Z., Gao, S., Hu, R., & Gao, C. (2025). SR-Eval: Evaluating LLMs on Code Generation under Stepwise Requirement Refinement. CoRR, abs/2509.18808.
  19. [19]Wang, P., Zhang, L., Liu, F., Shi, L., Li, M., Shen, B., & Fu, A. (2025). CodeIF-Bench: Evaluating Instruction-Following Capabilities of Large Language Models in Interactive Code Generation. CoRR, abs/2503.22688.
  20. [20]Yan, L., Chen, X., & Zhang, X. (2026). When the Specification Emerges: Benchmarking Faithfulness Loss in Long-Horizon Coding Agents. CoRR, abs/2603.17104.
  21. [21]Hey, T., Fuchß, D., Keim, J., & Koziolek, A. (2025). Requirements Traceability Link Recovery via Retrieval-Augmented Generation. REFSQ, 15588, 381–397.
  22. [22]Fuchß, D., Hey, T., Keim, J., Liu, H., Ewald, N., Thirolf, T., & Koziolek, A. (2025). LiSSA: Toward Generic Traceability Link Recovery Through Retrieval- Augmented Generation. ICSE, 1396–1408.
  23. [23]Chen, M., Zhang, Y., Xie, Z., Luo, Y., Xu, J., Gao, C., Zhao, K., & Ye, Y. (2026). TraceDev: A Traceability-Driven Multi-agent Framework for Requirement-to-Code Development. CoRR, abs/2607.18886.
  24. [24]Etezadi, R., Abualhaija, S., Arora, C., & Briand, L. C. (2025). LLM-Driven Cost-Effective Requirements Change Impact Analysis. CoRR, abs/2511.00262.
  25. [25]Liu, W., Yu, A., Zan, D., Shen, B., Zhang, W., Zhao, H., Jin, Z., & Wang, Q. (2024). GraphCoder: Enhancing Repository-Level Code Completion via Coarse-to-fine Retrieval Based on Code Context Graph. ASE, 570–581.
  26. [26]Luo, J., Zhang, X., Liu, S., Wu, J., Huang, Y., Huang, Y., Yin, C., Xin, Y., Liu, J., Zhan, Y., Sun, H., Chen, Q., Li, S., & Yang, M. (2025). RPG: A Repository Planning Graph for Unified and Scalable Codebase Generation. CoRR, abs/2509.16198.
  27. [27]Liu, X., Lan, B., Hu, Z., Liu, Y., Zhang, Z., Wang, F., Shieh, M. Q., & Zhou, W. (2025). CodexGraph: Bridging Large Language Models and Code Repositories via Code Graph Databases. NAACL (Long Papers), 142–160.
  28. [28]Shah, P., Ghosh, R., Singhal, A., & Dutta, D. (2025). RANGER - Repository-Level Agent for Graph-Enhanced Retrieval. CoRR, abs/2509.25257.
  29. [29]Chen, Z., Tang, R., Deng, G., Wu, F., Wu, J., Jiang, Z., Prasanna, V. K., Cohan, A., & Wang, X. (2025). LocAgent: Graph-Guided LLM Agents for Code Localization. ACL (1), 8697–8727.
  30. [30]Liu, Z., Jiang, Z., Ye, Z., Wang, H., Liu, J., & Ren, X. (2026). Effective and Efficient Context Retrieval via Partial Dependency Graph for Repository-Level Code Generation. CoRR, abs/2608.01927.
  31. [31]Anthropic. (2026). Claude Code. In Product documentation. https://docs.anthropic.com/en/docs/claude-code/overviewdocs.anthropic.com/en/docs/claude-code/overview
  32. [32]OpenAI. (2026). Codex. In Product documentation. https://openai.com/codexopenai.com/codex
  33. [33]OpenAI. (2024). Introducing SWE-bench Verified. In https://openai.com/index/introducing-swe-bench-verified/. https://openai.com/index/introducing-swe-bench-verified/openai.com/index/introducing-swe-bench-verified
  34. [34]Merrill, M. A., Shaw, A. G., Carlini, N., Li, B., Raj, H., Bercovich, I., Shi, L., Shin, J. Y., Walshe, T., Buchanan, E. K., Shen, J., Ye, G., Lin, H., Poulos, J., Wang, M., Nezhurina, M., Jitsev, J., Lu, D., Menis-Mastromichalakis, O., … Schmidt, L. (2026). Terminal-Bench: Benchmarking Agents on Hard, Realistic Tasks in Command Line Interfaces. CoRR, abs/2601.11868.
  35. [35]Lehman, M. M. (1980). Programs, life cycles, and laws of software evolution. Proceedings of the IEEE, 68(9), 1060–1076.
  36. [36]Lientz, B. P., Swanson, E. B., & Tompkins, G. E. (1978). Characteristics of application software maintenance. Communications of the ACM, 21(6), 466–471.
  37. [37]Moonshot AI. (2026). Kimi Code. In Accessed: 2026-09-07. https://kimi.com/codekimi.com/code
  38. [38]Chen, M., Tworek, J., Jun, H., Yuan, Q., Pinto, H. P. de O., Kaplan, J., Edwards, H., Burda, Y., Joseph, N., Brockman, G., Ray, A., Puri, R., Krueger, G., Petrov, M., Khlaaf, H., Sastry, G., Mishkin, P., Chan, B., Gray, S., … Zaremba, W. (2021). Evaluating Large Language Models Trained on Code. CoRR, abs/2107.03374.
  39. [39]Tang, N., Chen, C., Xu, G., Shi, Y., Huang, Y., McMillan, C., Dong, T., & Li, T. J.-J. (2026). How Coding Agents Fail Their Users: A Large-Scale Analysis of Developer-Agent Misalignment in 20,574 Real-World Sessions. CoRR, abs/2605.29442.
  40. [40]Zhang, J., Hu, S., Lu, C., Lange, R., & Clune, J. (2026). Darwin Gödel machine: open-ended evolution of self-improving agents. International Conference on Learning Representations, 2026, 104223–104294.
  41. [41]Liu, C., Liu, Y., Yan, S., Tresp, V., & Ma, Y. (2026). Mendel Gödel Machine: Recursive Self-Improving Coding Agents via Comparative Evolution. CoRR, abs/2608.07645.
  42. [42]Zhou, T. (2026). Hierarchical Self-Improvement: A Framework for Task-Specific Evolvable Agent Harnesses. CoRR, abs/2608.08466.
  43. [43]Deng, X., Da, J., Pan, E., He, Y. Y., Ide, C., Garg, K., Lauffer, N., Park, A., Pasari, N., Rane, C., Sampath, K., Krishnan, M., Kundurthy, S., Hendryx, S., Wang, Z., Zhang, C. B. C., Jacobson, N., Liu, B., & Kenstler, B. (2025). SWE-Bench Pro: Can AI Agents Solve Long-Horizon Software Engineering Tasks?. CoRR, abs/2509.16941.
  44. [44]Harbor Framework Team. (2026). Harbor: A framework for evaluating and optimizing agents and models in container environments. In Open-source evaluation framework. https://github.com/harbor-framework/harborgithub.com/harbor-framework/harbor
  45. [45]Harbor Framework Team. (2026). Terminus-2. In Harbor reference agent documentation. https://harborframework.com/docs/agents/terminus-2harborframework.com/docs/agents/terminus-2
  46. [46]Page, L., Brin, S., Motwani, R., & Winograd, T. (1999). The PageRank Citation Ranking : Bringing Order to the Web. The Web Conference. https://api.semanticscholar.org/CorpusID:1508503api.semanticscholar.org/CorpusID:1508503
  47. [47]Gotel, O. C. Z., & Finkelstein, A. C. W. (1994). An Analysis of the Requirements Traceability Problem. Proceedings of the 1st International Conference on Requirements Engineering (ICRE), 94–101. https://doi.org/10.1109/ICRE.1994.292398

Paper details

vlnc:W_m5u6fzmr
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

LLMs

View statement
Looking for related papers…
Contents