A prerequisite for coding agents to perform tasks on large repositories is code localization - the identification of relevant files, classes, and functions to work on. While repository-level code localization has been performed using embedding-based retrieval approaches such as vector search, recent work has focused on developing agents to localize relevant code either as a standalone precursor to or interleaved with performing actual work. Most prior methods on agentic code search equip the agent with complex, specialized tools, such as repository graphs derived from static analysis. In this paper, we demonstrate that, with an effective reinforcement learning recipe, a coding agent equipped with nothing more than a standard Unix terminal can be trained to achieve strong results. Our experiments on three benchmarks (SWE-Bench Verified, Pro, and Lite) reveal that our models consistently achieve superior or competitive performance over 2-18x larger base and post-trained LLMs and sometimes approach performance provided by closed models like Claude Sonnet, even when using specialized scaffolds. Our work particularly focuses on techniques for re-purposing existing coding agent environments for code search, reward design, and RL optimization. We release the resulting model family, CodeScout, along with all our code and data for the community to build upon.
Figures & tables
Figure 1: An overview of code localization performance of various approaches on SWE-Bench Verified. CodeScout achieves superior or competitive results over larger SoTA open-source LLMs and closes the gap with frontier closed-source LLMs.
Method
Language-Agnostic Scaffold
Pure RL post-training
# Tools
LocAgent ( Chen et al., 2025 )
✗
✗
3
CoSiL ( Liu et al., 2025a )
✗
✗
3
OrcaLoca ( Yu et al., 2025 )
✗
✗
5
RepoSearcher ( Ma et al., 2025 )
✗
✗
5
RepoNavigator ( Zhang et al., 2026 )
✗
✓
1
CodeScout (Ours)
✓
✓
1
Table 1: Comparison of repository-level code localization methods. CodeScout is the only approach that directly post-trains LLMs with RL using a simple, programming language-agnostic agent scaffold equipped solely with a bash terminal.
Figure 2: An overview of CodeScout : given a GitHub issue, the LLM agent navigates the pre-PR codebase using a terminal and predicts the relevant set of files, modules, and functions. The reward function computes F1 scores for these three granularities using ground truth locations extracted from the gold issue resolution patch.
Benchmark
Method
File-level F1
Function-level F1
RepoNavigator-7B
51.63
27.49
CodeScout -1.7B
55.46
28.22
RepoNavigator-32B
67.75
34.09
CodeScout -4B
68.52
36.78
CodeScout -14B
68.57
40.32
RepoNavigator + GPT-5-Chat
58.88
31.17
Table 2: Summary of results on SWE-Bench Verified, Pro, and Lite. For all benchmarks and search granularities, CodeScout achieves a new open-source SoTA, with stronger/comparable results over base and post-trained LLMs upto 8-18 × larger , narrowing the gap with and often surpassing closed-source LLMs. The highest metric is bold-faced and 2 nd highest metric is underlined .
Scaffold
LLM
File-level
Module-level
Function-level
F1
Prec.
Rec.
F1
Prec.
Rec.
F1
Prec.
Rec.
Closed-Source LLMs
RepoSearcher
Claude-3.7-Sonnet
32.30
20.24
89.24
-
-
-
26.91
18.64
66.08
RepoNavigator
GPT-5-Chat
58.88
61.87
58.17
-
-
-
31.17
34.56
30.42
Claude-3.7-Sonnet
73.01
75.95
72.26
-
-
-
31.72
34.43
31.03
Claude-Sonnet-4.5
79.94
81.92
80.68
-
-
-
43.62
45.76
43.97
Table 3: Results on SWE-Bench Verified . CodeScout outperforms up to 8 × larger base and post-trained LLMs, narrowing the gap with or surpassing closed-source LLMs. Qwen2.5 results use instruct models. rem adds a submission reminder (§ 4.3 ), † trained with GRPO/GSPO; ‡ RFT from CodeScout -14B; △ RFT from Claude-3.7-Sonnet. The best metric is bold-faced and 2 nd best is underlined .
Scaffold
LLM
File-level
Module-level
Function-level
F1
Prec.
Rec.
F1
Prec.
Rec.
F1
Prec.
Rec.
Closed-Source LLMs
OpenHands-Bash
GPT-5
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
Claude-Sonnet-4.5
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
0.00
OpenHands-Bash rem
GPT-5
61.18
69.10
62.06
42.20
52.86
39.63
35.86
48.91
32.65
Claude-Sonnet-4.5
64.75
75.39
64.49
48.54
61.75
45.39
42.26
58.14
38.06
Table 4: Results on SWE-Bench Pro . CodeScout outperforms base and post-trained LLMs up to 8 × larger across multiple scaffolds, narrowing the gap with closed-source LLMs. Qwen2.5 results use instruct variants. rem reminds the LLM to submit answer (§ 4.3 ), † trained with RL (GRPO/GSPO); ‡ RFT from CodeScout -14B. The highest metric is bold-faced and 2 nd highest metric is underlined .
Scaffold
LLM
File-level
Module-level
Function-level
F1
Prec.
Rec.
F1
Prec.
Rec.
F1
Prec.
Rec.
Closed-Source LLMs
LocAgent
Claude-3.5-Sonnet
31.39
18.83
94.16
29.91
18.18
86.98
27.53
17.08
76.61
OpenHands-Bash
GPT-5
1.09
1.09
1.09
1.09
1.09
1.09
1.09
1.09
1.09
Claude-Sonnet-4.5
0.36
0.36
0.36
0.36
0.36
0.36
0.36
0.36
0.36
OpenHands-Bash rem
GPT-5
77.77
75.73
82.48
67.86
66.09
72.63
61.12
59.43
67.21
Table 5: Results on SWE-Bench Lite . CodeScout achieves better/comparable results over base LLMs upto 18 × larger , narrowing the gap with closed-source LLMs. Qwen2.5 results use instruct models. rem adds a submission reminder (§ 4.3 ), † trained with GRPO/GSPO; ‡ RFT from CodeScout -14B; △ RFT from Claude-3.7-Sonnet. The best metric is bold-faced and 2 nd best metric is underlined .
Figure 3: Distribution of the top-8 most frequent Unix commands used by CodeScout at different training stages. While both LLMs initially use a broad range of Unix utilities, they eventually use a very limited set of commands as training proceeds. CodeScout -14B only uses ripgrep (rg) and sed, whereas CodeScout -4B mainly uses rg, cat, sed, and xargs.
Localization Approach
Resolution Rate ↑
Avg. # Steps ↓
Avg. Input Tokens ↓
Avg. Output Tokens ↓
Qwen3-4B-Instruct
None (Vanilla)
13.40%
16.09
344.37K
2.98K
CodeScout -14B
17.20%
13.91
284.26K
2.78K
Oracle
19.60%
16.41
327.75K
3.17K
Qwen3-Coder-30B-A3B-Instruct
None (Vanilla)
45.20%
51.00
1596.71K
13.49K
Table 6: Issue resolution performance on SWE-Bench Verified: augmenting the agent with relevant code locations achieves higher resolution rate while reducing number step count and token usage. The best metric is bold-faced and 2 nd best metric is underlined .
Appendix figures & tables25 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 4: System prompt for the OpenHands-Bash agent scaffold used by CodeScout (continued on next page).
Figure 5: System prompt for the OpenHands-Bash scaffold used by CodeScout .
Figure 6: User prompt for the OpenHands-Bash scaffold used by CodeScout .
Tool Name
Parameters
Python Type / Constraints
Required
terminal
command
str
✓
security_risk
Literal["UNKNOWN", "LOW", "MEDIUM", "HIGH"]
✓
is_input
bool
✗
timeout
float
✗
reset
bool
✗
localization_finish
locations
List[Dict[str, Optional[str]]]
✓
Appendix
Table 7: Pythonic Tool Schema for the tools used by OpenHands-Bash
Figure 7: Reward curves for RL training of CodeScout -14B.
Figure 8: Reward curves for RL training of CodeScout -4B.
Figure 9: Reward curves for RL training of CodeScout -1.7B.
Figure 10: Training Loss curve during rejection sampling finetuning used to train CodeScout -1.7B-RFT.
Method
Tools
Tool Behaviour
LocAgent ( Chen et al., 2025 )
SearchEntity
Performs keyword-based retrieval to identify relevant code entities.
TraverseGraph
Traverse/parse codebase dependencies by navigating hops in the code graph.
RetrieveEntity
Accesses the complete implementation for a specific entity ID.
CoSIL ( Liu et al., 2025a )
search_class_node
Retrieves the full code snippet of a class given its file path.
search_class_function_node
Extracts implementation details for a specific member function in a class.
search_file_function_node
Fetches the source code for standalone/static functions within a file.
Appendix
Table 8: Comparison of tools used by prior code localization agents and CodeScout . Existing approaches rely on specialized task-specific tools, while CodeScout achieves competitive or superior performance using only a bash terminal typical of coding agents.
Table 9: Ablation study on RL algorithm variants for Qwen3-4B-Instruct-2507 , evaluated on SWE-Bench Pro.
Scaffold + LLM
Return@K
File
Function
F1
Prec.
Rec.
F1
Prec.
Rec.
CoSIL + Qwen2.5-32B-Instruct
1
57.25
64.65
51.36
29.11
42.51
22.13
3
41.60
29.53
70.30
25.35
20.80
32.46
all
30.77
19.34
83.50
22.11
14.85
55.38
Agentless + Qwen2.5-32B-Instruct
1
56.17
63.93
50.08
22.18
32.78
16.75
3
41.46
30.13
66.45
23.51
20.83
26.98
Appendix
Table 10: Comparison of CodeScout with methods that predict a ranked list of top-K locations for different choices of K (Return@K) on SWE-Bench Verified . The setting all refers to the default setting with K = 5 used by these scaffolds.
Figure 11: Example trajectory sampled from CodeScout -14B for the task django__django-13363 (continued on the next page).
Figure 12: Example trajectory sampled from CodeScout -14B for the task django__django-13363 .
Figure 13: Example trajectory sampled from CodeScout -4B for the task django__django-13363 (continued on the next page).
Figure 14: Example trajectory sampled from CodeScout -4B for the task django__django-13363 .
Figure 15: User prompt for OpenHands issue resolution agent in vanilla setup without augmenting it with any localization results (§ 6.1 ).
Figure 16: User prompt for OpenHands issue resolution agent augmented with locations retrieved by CodeScout -14B (§ 6.1 ).
Figure 17: User prompt for OpenHands issue resolution agent augmented with locations retrieved by CodeScout -14B (§ 6.1 ).
Figure 18: User prompt for OpenHands issue resolution agent augmented with oracle locations (§ 6.1 ).
Figure 19: User prompt for OpenHands issue resolution agent augmented with oracle locations (§ 6.1 ).
Figure 20: System prompt of the OpenHands issue resolution agent used for experiments in § 6.1 .
Figure 21: System prompt of the OpenHands issue resolution agent used for experiments in § 6.1 .
Figure 22: System prompt of the OpenHands issue resolution agent used for experiments in § 6.1 .
Figure 23: System prompt of the OpenHands issue resolution agent used for experiments in § 6.1 .
Figure 24: System prompt of the OpenHands issue resolution agent used for experiments in § 6.1 .
Modern LLM coding agents such as Claude Code and OpenHands share a common inefficiency: they spend much of their token budget finding the file to patch, rather than patching it. On SWE-Bench Verified, a 30B OpenHands agent averages 23 rounds and 631K tokens per resolved issue, with many calls spent on grep, glob, and view_file during repository exploration. We introduce CodeGrep, a 14B retrieval agent trained end-to-end with GRPO to issue multi-turn parallel grep, glob, and read tool calls and return candidate files to a frozen downstream coding agent. On all 500 SWE-Bench Verified instances, CodeGrep preserves resolve rate while substantially improving efficiency: 27.0% versus 25.8% for the no-retrieval baseline, with 15% fewer rounds and 19% fewer tokens on resolved instances. Across retrievers, downstream utility follows a precision threshold: BM25 with precision 0.375 degrades the agent, Jina with precision 0.445 is neutral, and CodeGrep with precision 0.677 crosses the threshold at which retrieval begins to reduce rollout cost. To enable this study, we mine supervision from 67K open-source agent trajectories using CATM and build a Git-worktree environment for multi-turn agent RL. In our setting, applying the efficiency signal at the advantage layer rather than the reward layer reduces KL drift and translates cleanly into downstream efficiency. We will release the model, training pipeline, RL environment, and evaluation harnesses.
Wuya Chen, Yihao yang, Yang Cao +1
1Netease Guangzhou AI Lab · 2Independent Researcher
Localizing issue-relevant code regions is a critical step in automated software engineering. However, due to their reliance on sparse trajectory-level signals, existing methods cannot identify which per-turn actions are effective and often discover correct code regions during exploration but fail to commit them. To address these limitations, we propose an action-aware reinforcement learning method that combines a per-turn reward sequence rewarding both the discovery and commitment of gold code regions with an action-level advantage estimation scheme that isolates each action's credit by grouping turns sharing the same exploration context. Extensive evaluations show that our method improves the average F1 over the state-of-the-art (SOTA) by 1.58% on SWE-Bench Verified and 8.55% on SWE-Bench Pro, with our 4B model outperforming baselines up to 8x larger. Our code is available at https://github.com/donian00/A2Agent.
Doyeon Kim, Suyoung Bae, Yumin Lee +1
College of Computing and Informatics Sungkyunkwan University, South Korea
Modern coding agents are usually evaluated by whether they eventually produce a correct patch, but patch generation depends on an earlier context-acquisition stage: finding the repository files needed for the task. We introduce Agent Retrieval Bench, a file-level benchmark for this upstream retrieval problem. Samples are built from real coding-workflow signals and evaluated against frozen base-commit repositories, with relevance defined by what an agent needs next rather than direct query-file semantic similarity. The benchmark covers four positive-retrieval tasks: code2test, comment2context, trace2code, and edit2ripple; a fifth subset evaluates selective retrieval using natural evidence-backed no-gold cases and counterfactual wrong-repository controls. Agent Retrieval Bench contains 427 samples across 25 repositories: 345 positive examples, 50 natural no-gold examples, and 32 counterfactual controls. The corpus includes 308 base-commit snapshots, 392,000 files, and 7.9 million chunks. We evaluate lexical retrieval, RepoMap, open-source embeddings, selective abstention, and logged agent context selection. No single retrieval family dominates: Qwen3-Embedding-4B has the best sample-weighted MRR on positive samples, Qwen3-Embedding-8B the best Recall@20, and RepoMap the best budgeted context yield at 8K tokens, with task-level winners differing substantially. Selective thresholds calibrated with counterfactual controls do not improve selective success on natural no-gold cases, revealing a calibration gap. Logged trajectories also miss every gold file on 27-35 percent of samples. A controlled seed-intervention pilot finds that retrieval-derived initial context yields higher file F1 with less post-seed exploration than random non-gold context, while oracle gold context shows substantial remaining headroom.
Bowen Qin, Yi Xie
1National University of Singapore (NUS) · 2Peking University