Skip to main content

Module decide

Module decide 

Source
Expand description

Optional decision backend (docs/decision-model-proposal.md §4, rows E1–E3).

A decision (System One) model answers named, typed questions about a state with probabilities — no text generation. The loop uses one, when a host installs it with Engine::with_decider, in three places:

  • E1 — GROUND and VERIFY of LLM drafts: a calibrated noul per draft × cited evidence replaces the LLM’s grounding verdict, and a calibrated noul “is it sound?” supplies VERIFY’s routing number in place of the verifier’s self-reported confidence (the LLM’s keep/kill still runs).
  • E2 — the duplicate and contradiction sweeps widen past token Jaccard and the seeded functional relations, asking “same claim?” / “can both be true?” of the candidate pairs the deterministic rules cannot decide.
  • E3 — a free-text tool failure cause is classified into the closed cause vocabulary with a choice.

A decision model may score; only code gates. Nothing here approves, applies or rolls back: a judged draft is still a pending recommendation, and the engine refuses to auto-apply anything a model judged (Recommendation::judged_by). An uncalibrated backend never omits — a probability from one is not used to drop or propose anything (proposal §2 rule 2); those stages fall back to today’s rule. Fail-soft — a backend error or malformed answer drops that stage’s contribution for the run (LOP-E051, recorded on the run’s DeciderReport), never the run.

This crate has no Areev dependencies, so the seam is a minimal trait over the proposal’s WIRE JSON: {"state": …, "questions": {…}} in, {"answers": {…}, "provider", "model", "calibrated", "latency_ms"} out. The Areev bridge (areev_loop_adapter::LoopDecider) implements it over areev_core::decide::DecisionBackend; a subprocess could implement it just as well.

Structs§

Answered
One validated response.
Decider
The engine’s handle on an installed backend: the typed helpers every stage uses, the per-run counters behind DeciderReport, and the per-run tool-cause cache.
DeciderReport
What the decision backend did during one run — on RunResult::decider, beside the LLM funnel.
JudgedBy
Who judged a recommendation, with what, and what it answered — the attribution record (proposal §2 rule 4) carried on a Recommendation a decision shaped.

Enums§

Ask
A question to ask: (id, instructions) for a noul, or with options for a choice.

Constants§

CAUSE_MIN_P
The probability the argmax of a tool-cause choice must reach to be used; below it the cause stays unknown.
DECIDE_MIN_P
The probability a noul answer must reach for a calibrated decision to ground a draft, route it past VERIFY, or propose a sweep draft. The same number as the LLM verifier’s confidence floor.
DEFAULT_PAIR_CAP
The default per-sweep, per-run cap on pairs sent to the backend.
QUESTIONS_PER_REQUEST
Questions batched into one request by the sweeps and the cause classifier.
TOOL_CAUSES
The closed tool-failure cause vocabulary with the description each option is offered under. Mirrors areev_core::types::FailureCause (the adapter pins the two against each other in a test — this crate cannot import it).

Traits§

DecideBackend
The seam: one wire request in, one wire response out.

Functions§

parse_response
Validate a wire response against what was asked: every id present with the matching type, every probability finite and in [0, 1], choice options drawn from what was offered. Anything else is LOP-E051.

Type Aliases§

CauseVerdict
A classified tool cause: the vocabulary key, its probability, and the decision that produced it — None when the cause stays unknown.