Coding Agents Don’t Need More Snippets. They Need the Path Through the Repo.

Coding Agents Don’t Need More Snippets. They Need the Path Through the Repo.

Coding agents have a context problem, but the industry keeps describing it as a quantity problem. Bigger windows, larger top-k retrieval, longer file dumps, more embeddings. DeepDiscovery’s argument is sharper: the useful unit of repository understanding is not the snippet. It is the path.

That sounds like a small distinction until you watch an agent fail in a real codebase. It finds the function named in the stack trace, edits a nearby conditional, maybe even adds a test, and still misses the actual fix because the bug lives in the relationship between an abstraction, a config file, a test fixture, and a caller three directories away. The agent had context. It did not have the repo.

The paper, From Fragments to Paths: Task-Level Context Recovery for Large Industrial Codebases, proposes DeepDiscovery, a two-stage Location--Inference framework for recovering task-relevant context in large repositories. First it identifies high-confidence anchors. Then it expands through multi-relational code structure under a context budget, trying to recover the route a competent engineer would follow before making a change.

Top-k chunks are not repo understanding

The reported industrial setting is exactly where naive retrieval starts lying to you: 2.67 million lines of code, more than 25,000 files, multiple large subprojects, and heterogeneous business modules. The authors evaluate 27 medium-scale tasks with 135 manually annotated relevant files and 40 large-subproject tasks with 240 gold relevant files. On internal tasks, DeepDiscovery improves Full Recall Rate by 1.6 to 9.2 percentage points on large subprojects and 2.5 to 7.4 points on medium-scale subprojects.

The more reproducible number is the public SWE-bench Verified result. The DeepDiscovery-equipped system solves 393 of 500 tasks, or 78.6%, compared with 352 of 500, or 70.4%, for the matched baseline. That is an 8.2-point gain and 41 additional resolved tasks. The paper reports repository-level gains including +17 on django, +6 on xarray, +5 on sympy, +5 on scikit-learn, and +4 on sphinx.

Those numbers are useful, but the mechanism matters more than the scoreboard. SWE-bench rewards patches that actually resolve issues. DeepDiscovery’s claim is that better context recovery improves the patching loop because the agent starts from a more faithful map of the problem. This is not just “retrieve more.” In fact, retrieve-more is often the bug. Large context windows make it possible to stuff a repo into the prompt badly. They do not make the model understand which files explain each other.

Human engineers rarely debug by reading the top ten lexical matches. They locate an anchor, then follow structure: imports, call chains, tests, config conventions, naming patterns, framework hooks, and the boring local rules that never made it into documentation. The path is the reasoning substrate. A fragment is just evidence.

The product implication is observability, not another context-size flex

The paper’s caveat is real: the industrial benchmark is private, so LGTM should not treat that evidence like an independently auditable leaderboard. The public SWE-bench Verified result is stronger, but teams still need to validate this class of method against their own repositories. Codebase topology varies wildly. A monorepo with generated code, plugin registries, reflection, and service boundaries does not behave like a library repo with clean imports.

Still, the practitioner takeaway is immediate. If you are evaluating coding agents, stop logging only the final patch and test result. Log the context path. Which files did the agent inspect? Which files did it ignore? Did it find the relevant tests? Did it follow imports or just keyword matches? Did it discover configuration and fixtures before editing implementation? When it failed, was the failure a reasoning error after seeing the right context, or a retrieval error because the right path never entered the run?

That distinction changes what you fix. If the agent saw the right files and still produced a bad patch, you may need a stronger model, better verification, or a different edit strategy. If it never found the relevant files, upgrading the model is an expensive placebo. You need repository indexing, structural expansion, better anchors, or task-specific retrieval.

This also reframes context-window marketing. A 1M-token agent that drags in half the repo can still be worse than a smaller model with disciplined path recovery. Tokens are not free, attention is not magic, and irrelevant context can actively degrade decisions. The best agent control planes will probably combine structural retrieval, compact summaries, test discovery, and explicit path rationales rather than pretending the model should inhale everything and sort it out.

The editorial read: DeepDiscovery is a rejection of snippet retrieval as the default mental model for coding agents. Repo understanding is not “more context.” It is recovering the right path through the codebase before the model starts editing. That is less glamorous than a new model name and much closer to how real engineering work gets done.

Sources: arXiv, SWE-bench, SWE-bench paper, Agentless repository repair context