Search Strategy Optimization

Making an agent’s search loop converge — fewer repeated queries, fewer rereads, less context spent on passages that never get used — rather than making any single retrieval call better. Context as Infrastructure - Knowledge Compilation for Retrieval in Agentic Systems with Harnesses calls the component that owns the loop the search harness and argues that “retrieval is a harness problem before it is an index problem”: the index decides what can be found, the harness decides whether finding becomes an answer.


Why the loop needs discipline

Once an agent writes lexical queries, reads results, reformulates and decides when it has enough, the classical retrieval objectives — better chunking, better embeddings, higher Recall@k — stop being the binding constraint. In the paper’s runs, a harness with only BM25 and grep reaches 85% on BrowseComp-Plus and 91% on FRAMES; work such as Direct Corpus Interaction reports the same saturation. The cost moves to the process: an undisciplined loop either stops on the first plausible passage or never stops, rewriting the same query and filling the window with passages that are individually relevant and collectively useless.

Who owns what

The paper splits responsibilities by what each side can be trusted with:

  • The framework owns invariants — evidence prefetch, sufficiency judgment, discarding insufficient blocks, removing tools useless on this corpus, degrading model calls under budget, assigning citation IDs, composing a fallback answer. A model “cannot be trusted to enforce its own budget or number its own citations reliably.”
  • The model owns semantic judgments — choosing query terms and reading order, judging relevance, stating what evidence is still missing.

Mixing the two — asking the model to enforce a budget, or the engine to judge relevance — is named as the usual source of unreliable agents.

The five stations

RAGFlow’s harness sends every query through, in order:

  1. Capability check — if a corpus has no compiled artifacts, navigation, graph and outline tools are not exposed, not even their descriptions.
  2. Evidence prefetch — one flat, corpus-wide evidence recall before the model decides how to search. Never routed through a tree: a small tree sends every question to the same one or two documents.
  3. Evidence gate — admit or discard the whole block (Evidence Sufficiency).
  4. Tool loop — parallel retrieval actions per turn, with a step limit and wall-clock budget so the loop converges by construction.
  5. Deterministic close — if the loop ends abnormally, the framework composes an answer from the evidence in hand.

Tools organized by failure, not implementation

Each tool must remove one named failure, with one symptom and one metric; two tools removing the same failure are one tool configured twice, and a tool that removes none “is a demo”. The failures covered: vocabulary mismatch, localization at scale, relations across sources, temporal ambiguity, synthesis burden, and tool or syntax error. The design rejects letting the model choose freely among many tools: the harness decides which tools are admissible, the model decides how to use them.

The zero-hit principle

A zero-hit result is a property of the tool, not a fact about the corpus. The harness explains the zero and retries along a fallback ladder — relax the filter, switch from compiled to raw lexical search, widen the time window — before the model may conclude the corpus is silent. This targets the common false negative where an agent gives up because a tool was misconfigured.

No dense leg

The paper runs no dense-retrieval leg anywhere: in their runs adding one lowered accuracy. Their reasoning is that the agent’s reformulation already does the semantic step, so a second ranking is something the loop must reconcile rather than a gain. Recall came instead from anchor depth (20 chunks helped, 30 added nothing) and the union of a chunk-anchored and a claim-text lexical leg; fixed page caps (16, 32) hurt recall.