from .client import Response, SystemOneClient, Usage
from .primitives import choice, noul
from .roster import Skill, shortlist_criteria
SHORTLIST = 3 # candidates carried from the first request into the second
EXCERPT_CHARS = 700 # SKILL.md characters each candidate brings
GATE_THRESHOLD = 0.30 # mean of the three request nouls, below which nothing is suggested
FITS_THRESHOLD = 0.40 # winner's own "does this fit" noul, below which nothing is suggested
FITS_MARGIN = 0.15 # lead the best fits needs over the Choice winner's own to override it
# The cookbook ships 0.40 for neither threshold; it starts both at 0.30 and says to evaluate on
# your own data. Measured here (`tfl sweep`, 50 labelled requests, cache-only): gate 0.30 / fits
# 0.30 gives 88.5% top-1 and 12.5% needless suggestions; moving fits to 0.40 keeps top-1 at
# 88.5% while needless drops to 8.3% with no covered request lost (missed 0.0%). At fits 0.50
# the first legitimate suggestion starts being dropped (missed 3.9%), and any gate above 0.30
# only loses hits. So fits moved; gate stayed where the cookbook put it.
#
# The margin exists because the Choice and the fits nouls can disagree: the Choice picks a
# sibling while fits clearly prefers another (measured live: winner at 0.53-0.54 while the
# right skill sat at 0.68-0.85 — see issue #1). Deciding by max(fits) alone fixes those and
# introduces its own miss (an unrelated skill at 0.72 turning a correct silence into a wrong
# name), so the winner is only overridden when the fits leader clears the bar *and* leads by
# this margin *over a winner that also clears the bar*; a smaller gap is a coin flip between
# two signals, a wrong name costs more than silence, and a lead over a sub-threshold winner
root@213-238-170-219:/home/hermes#