How Much Static Structure Do Code Agents Need? A Study of Deterministic Anchoring
Zhihao Lin, Mingyi Zhou, Yizhuo Yang, Li Erran Li
Beihang University
Key points
From the paper's conclusion- These results show that static structure improves code-agent navigation by making exploration more disciplined and reproducible.
Abstract
LLM-based code agents navigate repositories through keyword search but lack access to the structural relationships, such as call graphs, inheritance hierarchies, and configuration dependencies, that organize software systems. This limitation can make agent navigation stochastic and difficult to reproduce across runs. We investigate whether lightweight static analysis can provide deterministic anchors: stable structural facts injected as plain-text comments to guide probabilistic exploration. Starting from Codex as a strong grep-first baseline, we systematically vary the granularity and directionality of structural annotations and measure their effects on localization, navigation behavior, and run-to-run stability. Lightweight call and inheritance topology improves function-level localization by 2.2 percentage points at Func@5 and shortens trajectories by 1.6 interaction rounds. The optimal annotation design depends on repository scale: denser semantic annotations provide diminishing returns, while hub-heavy projects benefit from inverse-only links that avoid excessive forward-edge noise. Structural tags also increase the link-following rate from 0.15–0.18 to 0.21–0.24, reduce run-to-run variance by roughly half, and improve single-run reliability by 3.4 percentage points at Pass@1 on medium-scale repositories, at the cost of approximately 10% more input tokens. These results show that static structure improves code-agent navigation by making exploration more disciplined and reproducible. They support a topology-first design: use lightweight bidirectional structure for medium-scale repositories, prune forward edges in hub-heavy repositories, and reserve dense annotations for tasks involving implicit dependencies.
Read the paper
Discussion
Science Skim's AI key points, plus readers' public thoughts
Readers' thoughts
No reader thoughts yet.
Related papers
- How Should Agents See Code? Rethinking Code Representations for Agentic Software EngineeringarXiv · 2026
- Rivet: Utility-Preserving Context Control for Repository-Level Coding AgentsarXiv · 2026
- The Code of Theseus: Can Agents Rebuild Software from Recovered Design Documents?arXiv · 2026
- AdaptAgent: A Multi-agent, Domain-Guided Reasoning Framework for Code AdaptationProceedings of the ACM on software engineering. · 2026
- Rasoi: Visual Diffs for Evaluating Structural Changes Made by Coding AgentsarXiv · 2026
- GraphScent: Calibrating Directional Relevance Signals for Bounded-Context Code LocalizationarXiv · 2026