Expand description
CLI surfaces for the firstpass binary (SPEC §7.3/§7.4): doctor validates a setup before
you route real traffic through it, and trace reads recent audit records from the store. Both
are kept here (not in the binary) so the judgment is unit-tested.
Structs§
- Attempt
Explanation - Per-attempt slice of a
RouteExplanation. - Check
- One line of the doctor report.
- Doctor
Report - The result of
firstpass doctor. - Evals
Summary - Per-gate and per-rung evaluation summary computed from receipts — the operator’s live eval suite: how each gate is verdict-ing, how often routing escalates, where serves land.
- Predictor
Eval - Aggregate gate verdicts + routing behavior over
traces(enforce only). Prequential evaluation of the per-query gate-pass predictor (ADR 0008 Phase 2) — the honest “is it any good yet” check before the predictor is ever allowed to act. Replays the receipts in order through a fresh predictor: for each attempt with a clear Pass/Fail verdict, predict before update (so every prediction is on data the model has not trained on), then update. Reports AUC (predicted -> passed) and Brier score over those pairs. - Route
Explanation - A structured, agent-readable explanation of a single routing decision — why the ladder
went where it did, built purely from a sealed
Trace. - Savings
Summary - Aggregated spend/savings over a set of traces — the number the operator screenshots.
Pure so it’s unit-testable;
firstpass savingsfeeds it the trace store. - Verify
Report - Outcome of an independent receipt-chain verification — the compliance artifact.
Enums§
- Channel
- How this binary got onto the machine. Upgrading is channel-specific — running the wrong
updater either does nothing or fights the package manager that owns the file — so
firstpass upgradedetects the channel instead of guessing one. - Check
Status - A single doctor check outcome.
Functions§
- command_
on_ path - Whether
programis runnable: an explicit path (contains a separator) that exists, or a bare name found in one ofPATH’s directories. - detect_
channel - Work out how this binary was installed from the path it runs as. Pure: the executable path, the updater probe and the container check are all injected, so every branch is unit-tested without installing anything.
- doctor
- Validate a loaded config against the environment: routing sanity, provider key presence, and
that every configured gate’s command actually exists.
envlooks up environment variables (injected so this is testable). - evaluate_
predictor - Run the prequential predictor evaluation over
traceswith the givenlr/l2. - explain_
trace - Explain one routing decision from its sealed receipt — the “why this model” answer, as
structured data an agent can act on (and the backing for the MCP
explain_routetool). - export_
receipts_ jsonl - Render
tracesas a JSONL receipt export — one sealed receipt per line, in chain order. This is the artifact an operator hands an auditor; the deferred-verdict side table is never included (it is not part of the hashed body). - format_
evals - Render an
EvalsSummaryfor humans (--jsoncallers serialize the struct instead). - format_
savings - Render a
SavingsSummaryfor humans (--jsoncallers serialize the struct instead). - format_
traces - Render the most recent
limittraces as JSON lines — machine-first (SPEC §0.2): each line is a fullTrace, newest last. - parse_
receipt_ jsonl - Parse a JSONL receipt export (one
Traceper line) back into traces, for offline verification. Blank lines are skipped; a malformed line fails loudly with its line number. - summarize_
evals - summarize_
savings - Aggregate spend vs the always-top counterfactual over
traces. - upgrade_
report - The text
firstpass upgradeprints. Separated from the doing so the wording is testable. - verify_
receipts - Independently re-derive the hash chain over
tracesfrom genesis — the same computation an external auditor runs, with no trust in the proxy or the database. A single altered or reordered receipt breaks the chain at its index.