RARG turns retrieval scores into an execution prior for grep-style agentic search: relevance orders which documents are scanned first and which local matches survive truncation, cutting tool calls roughly 4x versus unrestricted Direct Corpus Interaction (DCI) while raising accuracy.
Suppose you’ve shipped an agent that answers hard questions over your company’s document store. Today you probably do top-k Dense retrieval and hand snippets to the LLM. That works until the decisive fact is a short span the retriever ranked 47th, or requires joining clues across documents. A recent alternative, Direct Corpus Interaction (DCI), drops the retriever entirely and lets the agent run ripgrep and file reads over the raw corpus. It handles multi-hop and exact-match queries better, but scans as if every file were equally promising and burns tool calls. The dominant middle-ground fix, exemplified by RISE, uses retrieval to pre-select a working subset, then lets the agent explore it. This paper argues that still wastes the relevance signal: once inside the workspace, grep is again blind.
The core move is to keep ripgrep as the interaction primitive but let the embedding retriever decide the order in which files are scanned and which matches survive output truncation. Three layers, coarse to fine:
•
Document-level ordering (RARG). A new tool embed_recall(query) ranks up to 10,000 documents with an embedder (Qwen3-Embedding-4B for QA, llama-nv-embed-reasoning-3b for retrieval-heavy tasks) and writes the ranked paths to /tmp/scope_N.txt. The agent is then told to pipe that file into rg. Critically, rg runs multi-threaded by default and emits matches in the order threads finish, destroying the ranking. A rule-based rewrite injects -j1 so scanning is sequential in rank order.
•
Entry-point initialization (RARG+). Alongside the scope file, append the top-10 query-relevant paragraphs (400-1000 chars each, re-embedded and scored) so the agent has concrete text to formulate its first rg pattern rather than guessing keywords cold.
•
Match-level reranking (RARG++). When rg returns more matches than fit the observation budget, rerank a pool of up to 500 matches with an embedder and keep the top 30-60. The rerank query is built by rule: the original scope query plus the rg keywords, joined as Query: [...] RG focus: [kw1][kw2].... A generative variant that asks the LLM to write its own rerank query performed worse.
scope = embed_recall(query) # writes /tmp/scope_N.txt
seeds = top_paragraphs(scope, k=10) # RARG+ only
while not confident:
cmd = llm.next_bash(scope, seeds) # usually cat scope | xargs rg ...
cmd = force_single_thread(cmd) # inject -j1
matches = run(cmd)
matches = rerank(matches, scope.query) # RARG++ only
llm.observe(matches)
return llm.answer()
Relevance never becomes the evidence channel itself: embed_recall returns paths, not content. The LLM still reads evidence through rg and Read.
The usual instinct when retrieval underperforms on hard queries is to either dump more top-k snippets into context or throw the retriever out and let the agent grep freely. This paper shows relevance is most useful not as a content filter but as an execution prior: it should decide traversal order and match visibility inside the agent loop, not which passages the LLM sees. The clearest evidence is behavioral, not the headline accuracy: RARG issues only 1.2-1.6 embed_recall calls per query on strong backbones, versus RISE’s repeated searches, and its hit distribution stays front-loaded on ranked documents while Direct Corpus Interaction (DCI)'s stays flat.
•
Behavior analysis is the load-bearing result. Plotting where each agent’s hits fall along the ranked scope, Direct Corpus Interaction (DCI) is flat (relevance-agnostic scanning), a pure embedding agent is sharply top-concentrated but returns redundant documents, and RARG stays front-loaded while covering more distinct files. RARG++'s match reranking recovers hits from lower-ranked documents whose document-level score buried a locally strong excerpt.
•
On BrowseComp-Plus (100-query, 100K docs) with GPT-5.4-mini, RARG++ reaches 84% accuracy at 23.9 average tool calls, versus 78% at 28.7 for RISE and 78% at 99.1 for Direct Corpus Interaction (DCI). With the full GPT-5.4, RARG++ hits 91%, nine points above RISE.
•
Scaling the corpus to 1M documents (adding 900K long, noisy FineWeb-Edu articles) drops RARG++ from 84% to 79%, but it keeps a 10-point margin over RISE-BM25. Scope recall stays 95-97%; degradation comes from rg matches getting polluted by incidental hits in long noisy documents, not from the retriever.
•
On BRIGHT (reasoning-heavy retrieval), RARG+ wins with 53.36 average nDCG@10, edging the retrieval-specialized NeMo Agent (52.89). Here RARG+ beats RARG++, because match-level reranking narrows the observation budget in a way that helps depth-first QA but hurts breadth-first ranked recall.
•
On the weaker GPT-5.4-nano, embed_recall gets triggered more erratically and the scoped-rg share of Bash calls shrinks. RARG still beats baselines, but the mechanism is clearest on models that follow the multi-stage protocol.
Reach for this when you’re building an agent over a large, mostly-text corpus (docs, wikis, code, filings) where the decisive evidence is often a short span or requires joining clues across files. Instead of choosing between top-k RAG and letting the agent grep freely, keep ripgrep as the primitive but have your retriever write a ranked path list to a scratch file, force -j1, and rerank matches when output would be truncated. The generative rerank-query variant is worth avoiding until someone closes the train-eval gap: it converges fastest but loses ~9 points of accuracy on the paper’s setup.
The authors point to an official RISE implementation on GitHub that they build baselines from, and to NVIDIA’s NeMo Retriever as the BRIGHT baseline. The paper itself does not link a RARG code release, so anyone wanting to reproduce would rebuild against the DCI-Agent-Lite harness described in the method section. Embedders used are off-the-shelf: Qwen3-Embedding-4B for QA-side ranking and reranking, llama-nv-embed-reasoning-3b for BRIGHT-side document ranking. Benchmarks used are public: BrowseComp-Plus and four BRIGHT subsets.
Let the retriever pick the reading order, not the reading list. The mechanism only pays off when the backbone reliably follows the scoped-rg protocol. On weaker instruction-followers the ordering leaks and the accuracy gain shrinks, though it doesn’t vanish.
•
The gains depend on an embedder that’s good at both long-document ranking and short-excerpt reranking. The authors had to mix llama-nv-embed-reasoning-3b and Qwen3-Embedding-4B on BRIGHT because no single model handled both granularities well.
•
Forcing single-threaded rg with -j1 and reranking up to 500 matches per step adds wall-clock latency. Tolerable in the paper’s setup, but a real cost if your corpus is huge or your SLA is tight.
•
Scaling to 1M noisy documents still degraded accuracy across all variants. Match-level reranking only partly absorbed the interference from incidental lexical hits in long distractor documents, so the approach is not a free pass at web scale.
•
Evaluation is entirely on the GPT-5.x family over one QA benchmark and four BRIGHT subsets. Behavior on open-source backbones or open-web search is untested here.