Expand description
ctx_explore — FastContext-style bounded, deterministic repo exploration.
Where crate::tools::ctx_compose is a single-shot composer that returns
prose plus inlined symbol bodies, ctx_explore runs a bounded multi-turn
loop and returns compact path:start-end citations (the FastContext
idea, arXiv 2606.14066): the calling agent gets a map of where the answer
lives at a fraction of the tokens, then reads only what it needs.
§Loop
- Query understanding —
parse_task_hints→ keywords + path hints. - Lexical anchor — one broad BM25 search over the resident index.
- Structural expansion — bounded BFS over the static import/call graph, grounded in the lexical hit set (only files that actually match the query are followed). A turn that discovers no new files stops the loop early (coverage saturation).
- Symbol channel — exact AST definitions for each keyword (
find_symbols). - Selection — submodular
greedy_max_coveragepicks the minimal, non-redundant citation set that covers the query terms under a token budget.
§Determinism (#498)
The output is a pure function of (repo content, query, options). Only
side-effect-free paths are used: the BM25 index and the static graph.
It never writes session state and never records Hebbian co-access
(cooccurrence::record_access) — those adaptive signals would make call N+1
differ from call N and are deliberately excluded from the byte-stable block.
Structs§
- Citation
- A single cited source span.
- Explore
Options - Caller-facing knobs.
max_turnsis clamped to a sane range;citation_onlymirrors FastContext’s terse mode (emit only the<final_answer>block). - Explore
Outcome - Result of an exploration run.
Functions§
- handle
- Run a bounded, deterministic exploration for
query. - parse_
final_ answer - Parse the
path:start-endcitations out of an explore answer. Reused by the eval harness to score the Explore arm. Tolerant of the optional trailing label and of text outside the<final_answer>block.