Skip to main content

Module confidence

Module confidence 

Source
Expand description

Map a stage score onto one [0,1] confidence axis plus a coarse band, shared by the injection phrasing (how forcefully to recommend) and session dedup (whether a re-recommendation clears the HIGH bar).

Two scales reach us: stage-1 cosine (~0.3–0.9, anisotropic — unrelated prompts still sit ~0.5) and stage-2 reranker logits (~-10..+10). They are not comparable, so each gets its own mapping. The reranker mapping is principled (a sigmoid, matching the cross-encoder’s training objective); the cosine mapping is an explicit heuristic — it exists so phrasing/dedup have a single dial, not to claim cosine is a probability.

Enums§

Band
Coarse confidence band, driving phrasing forcefulness.
Stage
Which ranking stage produced a score, selecting its confidence mapping.

Constants§

HIGH
>= this is the High band, and the bar a repeat recommendation must clear (see crate::session::Session::should_recommend).
LEXICAL_CONF
Confidence assigned to a dominant lexical winner. BM25 scores are not comparable across prompts (they scale with query length and term rarity), so a scalar map would be dishonest; the dominance gate (crate::lexical::dominant) has already established this is high-precision, so it reports a fixed High-band confidence — strong enough to drive an assertive directive, deliberately below crate::config::Config::body_inject_min so it stays a directive pointer rather than inlining a full SKILL.md off a lexical signal.
LOW
< this is the Low (tentative) band.

Functions§

band
Band for a confidence value.
of
Confidence in [0,1] for a hit’s score, given the stage that produced it.