Skip to main content

Module retrieval

Module retrieval 

Source

Structs§

RenderedRuleBody
The full, agent-consumable body of a recalled rule: the rendered code-spec body (the same template get_rules emits), the structured examples, and the supplementary check/trigger/origin/confidence fields that the chunk-only recall path could not see.
RenderedRuleExample
A single bad/good example pair surfaced on a recalled rule. Mirrors the rule_examples row shape the MCP get_rules tool already returns, so the recall --json and get_rules example surfaces stay aligned.
RetrievalOptions
Retrieve rules with confidence weighting plus hybrid FTS / embedding retrieval.
RuleSearchRetrievalOptions
Options for the CLI/MCP search-style retrieval helper. The helper fans out across repo scopes, applies the shared confidence + age decay inputs at the retrieve_rules_with_confidence layer, merges duplicates, then applies the same lexical re-rank used by the MCP search tools.
ScoredRuleChunk

Enums§

RuleKind
Coarse rule-kind taxonomy used by the time-decay multiplier.

Traits§

PastVerdictRecaller
Thin async seam so tests can substitute a fake cloud recall without actually hitting the network. Blanket-implemented for CloudClient below so real call sites keep using the concrete client directly.

Functions§

apply_explicit_recall_threshold
Adaptive relevance gate for the EXPLICIT recall surfaces — the MCP search_rules tool and the CLI recall command. Mirrors the hook path’s adaptive pruning so an agent never has to weigh five weak rules against an empty answer: irrelevant memory is worse than none.
apply_intent_alignment_gate
Intent-alignment gate for the EXPLICIT recall surfaces — applied BEFORE apply_explicit_recall_threshold on the final, fully-reranked list.
detect_language_from_path
Map a file path (or bare filename) to a canonical language tag. Matches the spelling used in skill tags so QueryFilter.language can round-trip cleanly between the MCP caller and the indexed chunk metadata. Unknown extensions return None — callers pass that through as “no language filter” rather than guessing at a language that’d drop real hits.
effective_confidence
Apply category-aware exponential decay to a raw confidence value.
infer_rule_kind
Lightweight content heuristic. Cheap regex-free token checks so we don’t burn CPU per chunk per query.
merge_past_verdicts
Merge multiple groups of past-verdict recalls into one ranked list.
merge_scored_rule_chunks
Merge multiple groups of scored rule chunks into one ranked list.
render_full_rule_bodies
Fetch and render the full body (code-spec + structured examples + fix/check fields) for each active skill id, keyed by id. Ids that don’t resolve to an active skill are simply absent from the returned map, so the caller can fall back to its chunk-only display for stale index entries.
rerank_scored_rule_chunks_by_lexical_query
retrieve_past_verdicts
Retrieve past verdicts for the current review chunk.
retrieve_past_verdicts_by_text
Text-based recall variant. The server embeds the query itself, avoiding the client/server algorithm + dimensionality drift that plagued the chunk_embedding path when the client lacked a 1536-dim embedder.
retrieve_past_verdicts_by_text_with_team
Text-based recall variant with optional team scope metadata.
retrieve_past_verdicts_with_team
Embedding-based recall variant with optional team scope metadata.
retrieve_rules
Retrieve rules with confidence-weighted ranking. Final score = hybrid rank score with one final confidence tie-breaker. Rules with confidence < 0.2 are excluded (likely rejected).
retrieve_rules_for_search
retrieve_rules_with_confidence
Retrieve rules with confidence weighting plus hybrid FTS / embedding retrieval.