arXiv:2610.41172cs.IROct 2026

Manuscript Offprint

arXiv:2610.41172

Context as Infrastructure: Knowledge Compilation for Retrieval in Agentic Systems with Harnesses

Zhichang Yu, Baining Cao, Sbaaoui Idriss, Qi Wang, Gangqiang Xu, Ling Qin, Xiaoling Jin, An Liu, Shaohao Cai, Xiaoyang Bao, Shengle Chen, Changchang Ding, Pengfei Zhu, Jingxiang Xu, Yifeng Mao, Lu Liu, Hai Jin, Yingfeng Zhang

Zhichang Yu 1^{1}

zhichang.yu@infiniflow.ai

Baining Cao 2^{2}

71295902003@stu.ecnu.edu.cn

Gangqiang Xu 1^{1}

gangqiang.xu@infiniflow.ai

Ling Qin 1^{1}

ling.qin@infiniflow.ai

Sbaoui Idriss 1^{1}

idriss.sbaoui@infiniflow.ai

Xiaoling Jin 1^{1}

xiaoling.jin@infiniflow.ai

Qi Wang 1^{1}

qi.wang@infiniflow.ai

Shaohao Cai 1^{1}

shaohao.cai@infiniflow.ai

Xiaoyang Bao 1^{1}

xiaoyang.bao@infiniflow.ai

An Liu 1^{1}

an.liu@infiniflow.ai

Pengfei Zhu 1^{1}

pengfei.zhu@infiniflow.ai

Jingxiang Xu 1^{1}

jingxiang.xu@infiniflow.ai

Shengle Chen 1^{1}

shengle.chen@infiniflow.ai

Changchang Ding 1^{1}

changchang.ding@infiniflow.ai

Yifeng Mao 1^{1}

yifeng.mao@infiniflow.ai

Lu Liu 1^{1}

lu.liu@infiniflow.ai

Hai Jin 1^{1}

hai.jin@infiniflow.ai

Yingfeng Zhang 1^{1}

yingfeng.zhang@infiniflow.ai

Abstract

Retrieval-augmented generation is becoming agentic. A search harness writes queries, reads what it finds, reformulates, and decides when to stop, and this shift has largely solved the accuracy problem: a harness whose only retrieval tools are BM25 and grep, with MiniMax M3 as the answering model, answers 85% of BrowseComp-Plus and reaches 91% on the multi-hop FRAMES benchmark—two benchmarks whose figures are not comparable—in our runs, without any compiled index and without any vector index. What the shift exposes is a context problem. An undisciplinary loop repeats the same queries, rereads the same documents, and fills the window with passages that are never used; the process consumes tokens but does not become an answer. We argue that the missing layer is knowledge compilation: a configurable ingestion pipeline in which LLMs enrich source documents with context that no chunk contains on its own—navigation hierarchies whose leaves are atomic claims with verbatim evidence, entity graphs, timelines, mind maps, ontologies, wikis, and memory. Compilation is not a better retriever, and it does not need to be: under a competent harness, structural artifacts gave no detectable accuracy gain on FRAMES, and a PageIndex-style outline degraded at FRAMES scale. Compilation is a supply layer. A navigation tree whose leaves are claim-evidence pairs—the mechanism whose effect we can measure here—cuts total query tokens by 91% when the evidence suffices and adds 1.9% when it does not, for a 38% average reduction; the asymmetry implies a 2% break-even sufficiency rate and a measured rate near 43%. A decision gate cuts latency from 140 s to 30 s, although the token saving of substitution is bought with retrieval rounds and carries a latency cost of its own. Ontology, graph, wiki, timeline, mind-map, and memory artifacts pay off in deployment—governance, cross-source integration, onboarding, temporal orientation, continuity—where accuracy benchmarks cannot see them. We describe RAGFlow's compilation pipeline and retrieval harness, which turns the loop into five disciplined stations and keeps the context entering the

model the smallest sufficient set; the two together form what we call an agent-native database: a store that hands the agent compiled, governed context instead of a ranked list of passages.

1 Introduction

Retrieval-augmented generation (RAG) was introduced to ground language models in external knowledge [17], but its center of gravity has moved. In a modern agentic system, retrieval is no longer a single query-to-embedding-to-similarity call. It is a loop in which an LLM writes lexical queries, reads snippets, reformulates, and decides when the collected evidence suffices [18, 29, 32]. We call the component that owns this loop the search harness, and its rise has changed what a retrieval layer is for: once the harness can grep a corpus and read what it finds, the classical objectives of the retrieval layer—better chunking, better embeddings, higher Recall@k—stop being the binding constraint. We build accordingly. This paper contains no vector index and no dense-retrieval leg, and the reason is empirical rather than aesthetic: adding a dense leg lowered accuracy in our runs, in the same direction as the reports of the teams cited below. A harness already performs the semantic step—the agent rewrites the query, reads what it finds, and states what is still missing—so a dense leg adds no signal the loop lacks; it adds a second ranking that competes with the lexical anchor the agent already trusts, at the price of a second index to build and refresh. BM25 and grep are what a harness needs, and every measurement here is taken with them. In our own runs a harness with only BM25, grep, and MiniMax M3 answers 85% of BrowseComp-Plus correctly and reaches 91% on the multi-hop FRAMES benchmark—two benchmarks whose figures are not comparable—without any compiled index, and others report the same saturation [5, 9].

1^{1}InfiniFlow Inc., Shanghai, China

2^{2}East China Normal University, Shanghai, China

RAGFlow project: the system described in this paper is implemented in the open-source RAGFlow project, https://github.com/infiniflow/ragflow.

The first claim of this paper is easy to state and hard to internalize: retrieval is a harness problem before it is an index problem. The index determines what can be found; the harness determines whether finding becomes an answer. A better index cannot fix a loop that never discards a bad query, reads without a budget, or keeps a passage because it was expensive to fetch.

The harness solves accuracy. It does not solve the process of answering. An agentic loop is a search procedure with a language model inside it, and a procedure without discipline degenerates into blind exploration: it rewrites the same keywords, rereads the same document, piles dozens of marginal passages into the context, and finally bets on the model's patience for an answer. Every turn costs tokens, and every irrelevant passage competes with the relevant one for attention [19].

This paper argues that the layer missing from this picture is knowledge compilation: a configurable ingestion pipeline that uses LLMs to enrich source documents with context that is not present in any chunk on its own—navigation trees whose leaves are atomic claims with verbatim evidence, entity relations, timelines, mind maps, ontology labels, synthesized articles, and durable memory. Compilation happens once, upstream of queries, and produces typed artifacts rather than a single index; retrieval then consumes those artifacts instead of raw text. Compilation is the supply side, the harness is the control side, and the tools are the interface between them (Figure 1).

The marginal value has moved from finding to supplying, and the centrality of compilation does not depend on beating search at recall—it does not. Under a competent harness we find that structural artifacts—RAPTOR-style summary trees, PageIndex-style outlines, LLM wikis, and entity-relation graphs—produce no detectable accuracy gain on FRAMES, and that a PageIndex-style table-of-contents index can become a negative asset at FRAMES scale. Structure is not additional evidence; what compilation provides is better context, smaller, provenance-bound, and sufficient for the question at hand.

Two consequences organize the rest of the paper. First, compilation is the subject and the harness is the discipline that makes it usable: we define knowledge compilation as the ingestion-time supply of context, give a taxonomy of artifacts with the ledger on which each should be evaluated, and report a negative result with a mechanism—structural compilation does not improve accuracy under a competent harness, and a PageIndex outline becomes a liability beyond a scale we identify. Second, the mechanism we can measure is claim–evidence compilation: we specify it, give three serving modes, and derive a cost model with a 2% break-even sufficiency rate, a 43% implied FRAMES rate, an amortization rule, and the latency price of substitution.

Scope. Our quantitative claims concern English text corpora, BM25/grep harnesses, and question answering. The deployment claims about ontologies, graphs, wikis, timelines, mind maps, and memory are reported on a separate ledger with named metrics and instrumentation (Table 2); they are not benchmark accuracies and we do not present them as controlled effects. Section 8.8 states the conditions under which we expect the quantitative conclusions to reverse.