DeepDiscovery: A Location-Inference Framework for Task-Level Repository Understanding
Jiawei He, Weisong Sun, Mengyu Shi, Jie Jia, Tong Bian, Xikai Yang, Dong Sun
cs.SE, cs.AI
2026-06-22
DeepDiscovery recovers task context by anchoring then expanding, with no persistent index. SWE-bench Verified solve rate moves from 70.4% to 78.6%.
An industrial monorepo can hold 25k+ files and millions of lines. Completing a task usually needs an implementation path: interfaces, business logic, config registration, tests, and cross-module constraints. Semantic search returns lexically close fragments and misses dependency injection, callbacks, and config-to-code bindings. Static call graphs follow explicit edges and still miss framework wiring. Offline vector indexes and prebuilt graphs also lag as commits and branches move.
AMAP restates the job as budgeted recovery of the files, relations, and evidence a task needs, rather than stuffing the most similar chunks into the prompt.
Input is a natural-language task plus the current repo snapshot. Output is a structured context pack with metadata and inclusion rationales. The repo is a multi-relational graph: explicit edges (import, call, inherit, reference), implicit edges (config-to-code, registration, DI wiring, events/callbacks, test-to-implementation), and organizational edges (folders, module boundaries, proximity). Implicit edges come from a fixed rule library and are scored candidates, not hard facts.
Location infers stack and module priors, builds a budgeted compressed view, then ranks anchors with four signals: semantic (embedding plus BM25), structural-summary alignment, rule templates, and a task-conditioned artifact-role prior. Coefficients are picked from a small preset by repo scale, never per task.
Inference expands from anchors by Gain/Cost, and stops when the budget is gone, priority falls below a threshold, or two consecutive steps add no new artifact role or bridge. Context defaults to metadata cards (path, role, neighbors, rationale). Full text is promoted only when local implementation is likely to matter. The design is coverage-before-detail: dumping a few files too early spends the window before bridge config and tests arrive.
No persistent index or prebuilt whole-repo graph is kept. Each run uses the live snapshot.
The method bake-off uses 27 medium tasks with 135 expert gold files, all hosted on Claude Code with Claude Opus 4.6, three runs each. Full Recall Rate (FRR) requires the entire gold file set.
| Method | FRR | Preprocess | Task-time |
| RAG | 84.4% | 7h / 2.26B tokens | 57.2s / 24,991 tokens |
| GraphRAG | 90.2% | 9h / 3.14B | 63.8s / 28,338 |
| AST+GraphRAG | 90.4% | 9h / 3.98B | 44.8s / 29,677 |
| DeepDiscovery | 92.6% | none | 13.2s / 8,826 |
The same module is then plugged into Cline, Cursor, Claude Code, Codex, OpenCode, and Qoder. Large subprojects: 40 tasks, 240 gold files. Medium: 27 tasks, 135 gold files. FRR rises on all six hosts, +1.6 to +9.2 points on large projects and +2.5 to +7.4 on medium ones. Cline large goes 72.5% to 81.7%, OpenCode 82.5% to 87.5%, Claude Code 85.0% to 87.5%, Codex 84.2% to 85.8%. Micro Precision stays near 9–11%; the gain is completeness, not aggressive pruning.
Ablations on the large split, fixed host: full pipeline FRR 85.8%; Location-only 80.0%; no adaptive compression 81.5%; no implicit relations 83.3%; no metadata-first 82.2%.
On SWE-bench Verified, only the repository-understanding component is swapped. Model, prompts, tools, and execution policy stay fixed: 352/500 (70.4%) to 393/500 (78.6%), McNemar p<0.01. Gains concentrate on django (+17), xarray (+6), sympy and scikit-learn (+5 each). matplotlib, pylint, seaborn, and flask barely move.
Coarse localization via compression averages about 70 s, versus about 225 s for broad local search.
You can improve a coding agent without a repo-wide index that races the git log. Pin anchors, then spend budget completing the implementation path. Inside AMAP's 2.67M-line, 25k-file ecosystem, six different hosts all gain FRR. The 8.2-point SWE-bench jump is 41 extra solved tasks after swapping context construction, not a retrieval-leaderboard delta.
The design fits repos that change too fast to amortize offline graphs. On a stable corpus with repeated queries, a prebuilt GraphRAG may still be cheaper.
Gold files are expert annotations from an internal ecosystem, prepared before DeepDiscovery existed. The protocol can be audited; the source cannot be reproduced publicly. 27+40 tasks is a small set, and FRR is brutal: one missing bridge file fails the task. Micro Precision is only about 10%, so recall-oriented expansion admits nearby non-gold files. The authors list three failure modes: weak task text yields bad anchors; implicit expansion pulls structurally adjacent extras; conservative promotion hides details. The rule library is fixed, so a new framework needs new rules. The SWE-bench comparison is a matched swap, not an unconstrained fight with the public leaderboard.