ctx_explore
Core ToolsIterative, deterministic code exploration → compact file:line citations. Runs a bounded multi-turn loop (BM25 + static call/import graph + AST symbols) and returns a <final_answer> block of `path:start-end` spans instead of bodies. USE WHEN: locating WHERE behavior lives across many files, cheaply. vs ctx_compose: compose inlines bodies in one shot; explore returns citations over N turns (far fewer tokens). citation=true emits only the block.
Output contract
Deterministic, byte-stable `path:start-end` citations selected by coverage (citation-only mode available). Output is a function of repository content, so the provider prompt-cache prefix stays stable.
Implementation
Source paths in the LeanCTX repository:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
citation | boolean | No | Emit only the <final_answer> citation block |
max_turns | integer | No | Exploration depth (1-8, default 3) |
path | string | No | Project root |
query | string | Yes | Natural-language question or symbol names |
Call shape
Derived from the input schema: required parameters, plus the most common optional ones.
ctx_explore(query="<query>", citation=true, max_turns=N) Examples
Explore how a feature works
ctx_explore query="how does the proxy compress responses?" Returns the most relevant code regions as path:start-end citations, grounded by graph expansion around the lexical hits.
Citation-only for minimal tokens
ctx_explore query="where is the shell allowlist enforced?" citation=true Emits only the final citation block (path:start-end ranges) without snippet bodies.
Go deeper on a broad question
ctx_explore query="how does session memory persist across restarts?" max_turns=5 Raises the exploration depth (1-8, default 3) so the graph BFS expands further from the lexical seed.
CLI Equivalent
This tool is also available via the CLI:
lean-ctx explore Related Tools
2a84390033a7d883231244eba9ecc520763d8ad0a5eca8a1fbde6a5f5c5281d8 ← Back to all tools