Skip to main content

pick_tier

Function pick_tier 

Source
pub fn pick_tier(
    signal: &ToolSignals,
    mode: PickerMode,
    confidence_threshold: f64,
) -> PickOutcome
Expand description

Decide a turn’s tier from its signal.

The rules run in order; the first that fires wins:

  1. Escalate — a hard reason to go capable (critical error / compaction).
  2. De-escalate — a hard reason to go cheap (a settled turn).
  3. Scorer — no hard reason, so weigh the two axes; if confident, follow it.
  4. Fall open — not confident: hand to the classifier, else the default.

Rules 1 and 2 are the two hard shortcuts that skip the scorer — one always escalates, one always de-escalates. Escalate is checked first, so a critical error still wins on a turn whose tests also happened to pass.

Deterministic and pure: the async classifier lives in the caller, so rule 4 returns PickOutcome::ConsultClassifier instead of calling it here. The no_signal case (no tool activity yet) is handled one level up.