Enhancing Agentic Code Localization with Traceability Recovered from Repository Evolution

Yiming Liu, Binhang Qi, Weiyu Kong, Jiawei Liu, Xinxin Shan, Saijun Gao, Yun LinNeurIPS 2026

TL;DR

Modern AI coding agents usually hunt for bugs by staring at a static snapshot of a codebase, ignoring the rich institutional memory hidden in its commit history. By distilling historical pull requests into clean, structured "traceability records," a new framework called TACO acts like a veteran developer pointing agents straight to the right files. It boosts localization accuracy by over 11–13 percentage points while cutting token costs by roughly 30%.

What Problem Does This Paper Address?

Before an engineer or an AI agent can fix a bug, they have to find where the relevant code lives—a task known as code localization. Today's large repositories are far too massive to stuff into an LLM's context window all at once. Instead, state-of-the-art "agentic" frameworks iteratively search, navigate, and read files much like a human newcomer would.

The catch? These agents almost exclusively look at two things: the bug report and the current snapshot of the code. They suffer from what the authors call a traceability gap. Often, the terminology in a user's bug report (the symptoms) looks nothing like the internal abstractions in the code (the implementation).

Figure 1: Motivating example of traceability-augmented code localization. For a Sphinx issue about incorrect rendering of dict(str, str) in a :param: field, LocAgent follows misleading surface cues such as docstring and param and misses the true fix location. A historical PR for a related :term: rendering problem provides the missing semantic bridge to the same doc-field transformation logic, but raw PR context still contains distracting details and leads to incorrect localization of LocAgent. TACO crystallizes the PR into a compact traceability record—retrievable hints plus a code-level rationale—which guides the agent to the correct code region.

For example, if a user reports a documentation rendering bug involving :param: fields, a snapshot-only agent naturally greps for words like param and docstring, chasing red herrings down the wrong rabbit hole. In reality, the fix lives in an abstract class called DocFieldTransformer. How would anyone know that? Because a historical pull request (PR) fixed a similar rendering issue there months ago. Once code is merged, the reasoning, debates, and vocabulary that bridged the symptom to the code vanish from the snapshot—leaving agents in the dark.

Methods

Simply dumping raw git history into an agent's prompt doesn't work; historical PRs are noisy, full of dead-end discussions, and reference outdated line numbers. To make history useful, the authors built TACO (Traceability Augmented Code Localization), which splits the work into an offline preparation phase and an online search phase.

Figure 2: Overview of TACO. Offline, TACO distills historical pull requests into compact traceability records using an auto-tuned LLM prompt. Retrieval feedback and an LLM judge are used to refine the distillation prompt, and the resulting records are stored in a traceability database indexed by a horizontal semantic index and a vertical topology graph. Online, given a new issue, TACO performs semantic-aware retrieval over historical records and topology-aware retrieval over repository structure, aggregates the resulting candidates with an arbiter, applies temporal alignment and verification to handle version drift, and outputs traceability-guided code locations.
  • Offline Knowledge Crystallization: Instead of indexing raw PR text, TACO uses an LLM to distill historical PRs into compact structured records containing high-value search keywords and architectural rationales (explaining why a function was changed). Crucially, TACO uses prompt auto-tuning: an LLM judge evaluates retrieval quality and iteratively refines the distillation prompt so the generated records are maximally retrievable for future issues. These records are stored in a dual-index database—a Horizontal Semantic Index (linking similar issues) and a Vertical Topology Graph (capturing structural code relationships).
  • Online Synergistic Retrieval: When a new bug arrives, TACO runs a dual-track search—querying both semantic history and repository topology. An arbiter cross-validates and ranks the candidates. Finally, because codebases evolve—files get renamed, functions move—TACO applies temporal alignment to map historical pointers onto the current version of the repository before handing the hints over to the coding agent.

Datasets

TACO is evaluated on two standard, real-world software engineering benchmarks derived from popular Python GitHub repositories:

  • SWE-bench Lite
  • SWE-bench Verified (a human-validated subset of SWE-bench designed for reliable evaluation).

No new datasets are introduced, though TACO mines the historical pull requests natively preceding the benchmark snapshots within those repositories.

Key Insights and Ideas

  • Raw history is a distraction, not a solution: In the authors' motivating Sphinx case study, giving an agent (LocAgent) the raw text of a relevant historical PR still led to failure—the agent got distracted by surface-level chatter and took 14 steps to guess the wrong lines. Giving it TACO's distilled rationale got it to the exact target function in 4 steps.
  • History matters most when the trail goes cold: When analyzing tasks by "traceability length" (how many hops away the bug symptom is from the fix), standard agents plummet in accuracy as the semantic gap widens (trace-2+ and trace-inf). TACO provides its most dramatic rescues precisely on these "disconnected" bugs where static code structure offers zero clues.
Figure 3: Traceability Analysis on SWE-bench Lite. The figure reports Accuracy@5 (%) at File (F) and Function (Fn) levels across different traceability lengths.
  • Better hints mean cheaper agents: Localization isn't just an accuracy game; wandering around a repository burns tokens. Good historical context prevents aimless exploration.

Key Results

Plugged into five state-of-the-art agentic baselines (LocAgent, SWE-Agent, Moatless, OrcaLoca, and OpenHands), TACO delivers substantial across-the-board gains:

  • Higher Accuracy: Exact-match top-1 localization accuracy (Acc@1) jumps by an average of 11.29, 13.20, and 12.87 percentage points at the file, module, and function levels, respectively. On weaker baselines like OpenHands and SWE-Agent, file- and function-level gains frequently exceed 20+ percentage points.
  • Lower Cost & Token Usage: Because agents stop wandering down blind alleys, TACO streamlines exploration for LocAgent and SWE-Agent, cutting token consumption by an average of 29.2% and monetary API costs by 30.4%, all with minimal offline maintenance overhead.

Limitations and Future Work

Not discussed in the paper (within the provided pages; full limitation details reside in the unprovided concluding sections of the manuscript, though the reliance on repositories having an existing pull request history is inherent to the evolutionary approach).

Summary updated

Abstract

While agentic frameworks have advanced repository-level code localization, their reliance on static snapshots often leads to a $\textit{traceability gap}$—the loss of implicit links between issue symptoms and code implementation. To bridge this information deficit, we introduce $\textbf{T}$raceability $\textbf{A}$ugmented $\textbf{Co}$de Localization (TACO), a framework that recovers retrievable and usable traceability from repository evolution to guide localization agents. TACO offline crystallizes historical pull requests into a dual-index knowledge base through a prompt auto-tuning technique, capturing high-value semantic hints and architectural rationales. In the online phase, TACO employs a synergistic dual-track retrieval workflow, cross-validated by an arbiter and aligned temporally to handle version drift. Extensive evaluations on SWE-bench Lite and SWE-bench Verified across five state-of-the-art agentic baselines demonstrate that TACO significantly improves exact-match localization accuracy (Acc@1) by an average of 11.29\%, 13.20\%, and 12.87\% at the file, module, and function levels, respectively. Moreover, TACO significantly streamlines the exploration process, achieving an average reduction of 29.2\% in token usage and 30.4\% in monetary costs, with minimal offline maintenance overhead.
BibTeX
@inproceedings{liu2026enhancing,
  author = {Yiming Liu and Binhang Qi and Weiyu Kong and Jiawei Liu and Xinxin Shan and Saijun Gao and Yun Lin},
  title = {{Enhancing Agentic Code Localization with Traceability Recovered from Repository Evolution}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=UyyXZoIZmv},
}
Figure