# Offline routing evaluations

Run `npm run eval:offline` against the illustrative `examples/router.config.json`. For a local policy experiment, run `npm run eval:offline -- --config path/to/model-router.json`; use `npm --silent run eval:offline -- --json` for machine-readable results (the ordinary `npm run` banner is not JSON). To evaluate a JSON array of your own cases, add `--cases evals/private/cases.json` (the `evals/private/` directory is gitignored).

The 17 cases in `cases/synthetic.ts` use **hand-authored, one-hot assessment signals**, not Jev responses. Expected decisions are regression labels for the example configuration, **not** evidence that any option can complete a task at its advertised cost or quality. The CLI performs no network requests and never invokes the Pi model registry: omitted `eligibleOptionIds` means *assume all configured options are eligible*. Set `eligibleOptionIds: []` to simulate no eligible options; unknown IDs fail closed. Synthetic review cases can supply `reviewScope: {changedFiles, changedLines, directories}` to exercise the optional substantial-review tier without running Git. Configured model identities, DeepSWE scores, costs, weights, and threshold remain illustrative.

Each case has an ID, shareable prompt, source (`synthetic` or `recorded-jev`), independently labeled `expectedCategory`, complete `TaskAssessment` (Choice, three Scores, Noul), and `expectedDecision` (`{status: "selected" | "threshold-unmet", optionId: "..."}` or `{status: "unchanged", reason: "..."}`). JSON cases use the same shape as `cases/synthetic.ts`. For `recorded-jev` cases also supply `recording: {recipient: "OpenRouter" | "TypeSafe", model: "...", questionVersion: 1}`. The parser checks distributions, finite scores/probabilities, expected score consistency, provenance, and the current question version before evaluating. The recorded category match count compares Jev's Choice against **independent** labels. Policy matches compare deterministic selection against the manually labeled outcome; neither metric establishes downstream task quality.

Next, collect a varied set of independently labeled tasks (including difficult, ambiguous, evidence-limited, and non-coding tasks). **Do not send or save real user/session text without explicit consent and a privacy review.** Keep sensitive cases only in a private local dataset. A consent-gated, redacted Jev capture/export workflow is not implemented yet; do not infer real Jev accuracy from synthetic cases. To calibrate the policy, obtain actual per-model task outcomes and comparable per-task cost data, then compare quality/cost tradeoffs and fallback frequency before changing the example's capability scores, costs, weights, or thresholds. Never tune those numbers merely to turn these regression fixtures green.
