get_answer
One-call RAG synthesis over the wiki: it retrieves, gates on confidence, and returns a cited 2-5 sentence answer with fallback file targets. The first tool to call on any code question.
Collapses search → read → reason into one round-trip. The tool
retrieves the most relevant wiki pages, enriches the top hits with
symbol docstrings and source excerpts, hands them to the LLM, and
returns a synthesized answer with citations and a confidence label.
If confidence is low, it returns best_guesses, a justified,
per-file candidate list with excerpts, instead of an empty answer,
letting the agent pick one to verify rather than skim the field.
When to call
- Always first on any code question, before
search_codebaseor manual file exploration. - If
confidenceis"medium"or"low", follow up withsearch_codebaseandget_contexton thefallback_targets. - Works best when the question names explicit identifiers (a class, function, or module name).
Parameters
| Parameter | Type | Description |
|---|---|---|
questionrequired | string | The developer's question, in natural language. |
scope | string | Optional path prefix to restrict retrieval (e.g. "src/auth/"). |
repo | string | Repository alias. Usually omitted; pass when the question is about a specific repo in a workspace. |
Returns
| Field | Description |
|---|---|
answer | Synthesized 2-5 sentence answer (empty if synthesis was gated) |
citations | File paths the answer references |
confidence | "high", "medium", or "low" |
retrieval_quality | "high", "partial", or "weak": a separate signal from confidence. confidence says how much to trust the synthesised text; retrieval_quality says whether to re-read the source before acting on it |
fallback_targets | Top file paths from retrieval; agent should get_context on these for verification |
candidates | The ranked shortlist of files retrieval resolved, one {path, lines?} entry each, up to 5. Present whenever retrieval resolved anything, including high-confidence answers where retrieval is deliberately empty. It's where to look next, not evidence the answer is right |
retrieval | Top 5 wiki hits with title, target_path, score, summary, and (for top 2 file pages) symbols with docstrings and source excerpts |
symbol_bodies | When the answer names a function/method/class, the full live body of each question-named symbol, inlined so no get_symbol follow-up is needed |
best_guesses | On a low-confidence, gated response: a per-file candidate list, each with file, why_relevant, score, and (when available) an excerpt, so the agent can pick one to verify instead of skimming several |
episodes | At most one dated fact recorded about this checkout, present only when its scope intersects the answer |
note | Context string explaining why synthesis was skipped or hedged |
_meta | Timing, cache hit, answer hint |
Example
get_answer("how does the authentication flow work?")
get_answer(
"how are database migrations handled?",
scope="backend/",
)Things worth knowing
- Six confidence gates keep the tool honest:
- Dominance ratio: if the top retrieval score isn't 1.2× the second, synthesis is skipped and excerpts returned instead.
- Hedge-phrase detection: if the LLM admits insufficiency in
its own answer,
confidenceis downgradedhigh→low. - Identifier-citation gate: if the question names symbols but
none appear in the top retrieval hits,
confidenceis downgradedhigh→medium. - Value grounding: on value-shaped questions (default / threshold /
limit / how many), every number the answer asserts must appear
somewhere in the retrieved material, or
confidenceis capped atlow. - Citation-source gate: a
high-confidence answer must cite at least one page that contributed real source material (hydrated symbols with signatures/bodies), not just a file summary, or it's downgraded tomedium. - Claim-support / frame grounding: on "why" and mechanism-shaped
questions, a
high-confidence answer must name its mechanism in terms the cited material actually contains; an unsupported term downgrades it tomedium.
- Question-aware symbol promotion: symbols matching identifiers
extracted from the question get longer docstrings (400 chars) and a
40-line source body excerpt, so "how does
Xwork?" questions can be answered without hedging. - Intersection retrieval: relational questions ("how does X talk to Y?") are split into two queries; hits appearing in both get a 2× boost.
- Caching: questions are normalized and hashed; repeat questions hit the answer cache instantly. Hedged cached answers are bypassed for re-synthesis when the symbol pipeline is updated.
- No LLM provider configured? Falls back to retrieval-only:
ranked hits + snippets at
confidence="low". candidatesvsretrieval.retrievalis evidence: enriched hits to re-read when the prose needs checking, and it shrinks as confidence rises.candidatesis navigation: a flatter, longer shortlist of every file retrieval resolved, present even on high-confidence answers.
get_answer is the highest-leverage tool in the set. Most "what does
this codebase do?" or "where is X handled?" questions are answered in
a single call.
get_overview
Architecture summary, module map, entry points, ownership, hotspots, and community structure for an entire repository: the first call your agent should make on any unfamiliar codebase.
get_context
The workhorse tool. Compact, batched context for any set of files, modules, or symbols: docs, ownership, freshness, and optional callers/callees/metrics/community in one call.