Skip to main content

Module retrieval

Module retrieval 

Source
Expand description

Retrieval — lexical scoring + CALIBRATED confidence.

Ports the Python scorer (haystack = id/title/summary/aliases; exact + partial field checks; per-term bonus + coverage; bands strong≥45 / weak≥25 / fallback). Adds the calibration the Python version lacks: the top hit is demoted strong → ambiguous when a runner-up scores within 0.7× of it — so a coin-flip query stops reporting strong.

Structs§

CompoundAnchor
CompoundOmittedAnchor
CompoundSubgraph
GroundIndex
Precomputed, graph-invariant inputs to grounding — the per-node BM25F token fields and lowercased titles. Built ONCE per graph via GroundIndex::build; grounding many queries against one graph reuses it instead of rebuilding it every call.
Hit
OmittedContextCandidate
RankerConfig
BM25F ranker parameters. INJECTED, never read from the environment: the kernel is pure, so Default is the frozen calibration and any override is passed in by the caller (the dev-only parameter sweep via eidos-eval-runner --k1/--b/--weights). This is what makes “same inputs → same scores” hold without depending on ambient process state.
RelationMatch
Subgraph

Enums§

Confidence
Scope
Which nodes are candidates for grounding. Docs excludes code symbols (Function/Type/Trait/Module); Code keeps only them; Section keeps only sub-doc heading blocks; Subkind keeps only nodes whose open domain subkind matches (e.g. “skill”, “agent”). All is every CANONICAL unit — it deliberately EXCLUDES sections (they’re a sub-granularity that would flood the candidate set and displace skills/docs; opt in with Section).

Functions§

apply_floor
Adaptive confidence floor — a presentation filter, applied at the surface (MCP/CLI), NOT in the retrieval/eval path. The engine always returns the full ranked list so the eval can measure rank-2+ recall honestly; the surface uses this to drop trailing noise before showing results.
ground
Ground a query against the graph: ranked hits with calibrated confidence. Builds a fresh GroundIndex each call — convenient for one-shot use. To ground many queries against one graph, build the index once and call ground_with (the eval harness and a warm server do this).
ground_scoped
Like ground_with, restricted to the candidates a scope admits (docs-only / code-only). Scope::All is identical to ground_with. Scope is a pre-filter on which nodes are scored; IDF/df stays corpus-wide (distinctiveness is a global property of the graph).
ground_subgraph
Ground, then expand along edges (bidirectional, depth/width-bounded BFS) to surface the connected evidence chain — the deterministic “associative reading” of AriGraph/SAGE. limit anchors, depth hops, width neighbours expanded per node per hop.
ground_with
Ground using a precomputed GroundIndex — the hot path. Byte-for-byte identical results to ground; the only difference is that the graph-invariant inputs are supplied, not rebuilt.