pi-smart-router 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -473,7 +473,7 @@ See [routing-roadmap.md](docs/routing-roadmap.md) §2 P2 and GitHub [#78](https:
|
|
|
473
473
|
|
|
474
474
|
### P(success) training export (baseline classifier)
|
|
475
475
|
|
|
476
|
-
When `SMART_ROUTER_DATASET=1`, the router records privacy-safe dataset rows and behavioral outcome labels
|
|
476
|
+
When `SMART_ROUTER_DATASET=1`, the router records privacy-safe dataset rows and behavioral outcome labels. Export labeled training data from pi:
|
|
477
477
|
|
|
478
478
|
```bash
|
|
479
479
|
/smart-router export dataset [--limit N]
|
|
@@ -481,23 +481,62 @@ When `SMART_ROUTER_DATASET=1`, the router records privacy-safe dataset rows and
|
|
|
481
481
|
|
|
482
482
|
Each JSONL row joins dataset features with `success_label` and `outcome_signals`. Success means no negative outcome signals were recorded for that `request_id` (for example `model_override` or `feedback_bad` mark failure). Prompt plaintext is never included.
|
|
483
483
|
|
|
484
|
-
|
|
484
|
+
#### Behavioral-first bootstrap (zero manual labels)
|
|
485
485
|
|
|
486
|
-
|
|
486
|
+
Primary path for [#110](https://github.com/beettlle/pi-smart-router/issues/110) (docs slice).
|
|
487
|
+
|
|
488
|
+
Manual `/smart-router feedback good|bad` is **optional**. Passive dogfood signals already captured under `SMART_ROUTER_DATASET=1` (and privacy-safe telemetry-contrib export) are sufficient to train when you have enough rows:
|
|
489
|
+
|
|
490
|
+
| Passive field / signal | Role |
|
|
491
|
+
|------------------------|------|
|
|
492
|
+
| `model_override` | Failure — operator overrode the routed model |
|
|
493
|
+
| `compaction_pin_break` | Neutral/positive context — pin broke at compaction (not a cheap-tier failure by itself) |
|
|
494
|
+
| Loop-escalation proxies (`tool_failure_chain`, pin reason `loop_escalation`) | Failure proxies for stuck tool loops |
|
|
495
|
+
| `stop_reason` / `stop_reason_invalid` / `stop_reason_length` | Execution outcome — invalid or truncated stops mark failure |
|
|
496
|
+
|
|
497
|
+
Optional `feedback_good` / `feedback_bad` only refine labels when the operator chooses to annotate; they are not required for a valid train path. **Do not invent labels** — incomplete exports skip or stay unlabeled rather than fabricating outcomes.
|
|
498
|
+
|
|
499
|
+
**Sample floor:** collect at least **≥30** labeled **economical-tier** rows (`minimum_training_samples.p_success_weights` / `isotonic_calibrator` in [`config/routing-calibration.json.example`](config/routing-calibration.json.example)) before relying on non-neutral `P(success)` or isotonic. Below that floor the classifier returns neutral `P_success_cheap = 0.5`.
|
|
500
|
+
|
|
501
|
+
**Provenance today vs behavioral adoption:** the checked-in `config/p-success-weights.json` remains **synthetic/fixture** (SP-175 — trained on `scripts/fixtures/p-success-synthetic-train.jsonl`, not community dogfood). Treat those weights as an interim dogfood enablement until real passive-signal floors are met and artifacts are retrained/shipped ([#110](https://github.com/beettlle/pi-smart-router/issues/110) train/ship slice — SP-206). Do not claim synthetic rows are behavioral.
|
|
502
|
+
|
|
503
|
+
**SP-206 status (v0.12.0):** **deferred / Partial (B).** Operator had no #95 dogfood exports in this window (labeled economical-tier rows = **0**, floor ≥30). No behavioral `config/p-success-weights.json` or `config/routing-calibration.json` was shipped. See [`spine-tasks/_authoring/release-v0.12.0/behavioral-calibration-partial.md`](spine-tasks/_authoring/release-v0.12.0/behavioral-calibration-partial.md). Leave [#110](https://github.com/beettlle/pi-smart-router/issues/110) open until floors are met; never invent labels.
|
|
504
|
+
|
|
505
|
+
**Zero-manual-label path (aggregate → train → verify):**
|
|
506
|
+
|
|
507
|
+
```bash
|
|
508
|
+
# 1) Opt in + dogfood (no /feedback required) — see docs/qa/shadow-dogfood-protocol.md
|
|
509
|
+
SMART_ROUTER_DATASET=1
|
|
510
|
+
# …sessions with /model smart-router/auto; prefer passive outcomes…
|
|
511
|
+
/smart-router export dataset --limit 200
|
|
512
|
+
/smart-router export telemetry-contrib
|
|
513
|
+
|
|
514
|
+
# 2) Aggregate privacy-safe contrib / exports (reject tainted payloads)
|
|
515
|
+
npm run routing:calibration-aggregate -- --contrib-dir data/contrib
|
|
516
|
+
|
|
517
|
+
# 3) Train when ≥30 economical-tier labeled rows exist
|
|
518
|
+
npm run routing:train-p-success -- --input path/to/export.jsonl --output config/p-success-weights.json
|
|
519
|
+
npm run routing:train-calibration -- --input path/to/aggregated.jsonl
|
|
520
|
+
|
|
521
|
+
# 4) Verify artifact shapes / gates
|
|
522
|
+
npm run routing:verify-calibration -- config/routing-calibration.json
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
#### Operator train / reload (no prompt text)
|
|
487
526
|
|
|
488
527
|
```bash
|
|
489
|
-
#
|
|
528
|
+
# Opt in + dogfood, then export privacy-safe labeled JSONL (features + labels only)
|
|
490
529
|
SMART_ROUTER_DATASET=1
|
|
491
|
-
# …run sessions with /model smart-router/auto
|
|
530
|
+
# …run sessions with /model smart-router/auto (optional: /smart-router feedback)…
|
|
492
531
|
/smart-router export dataset --limit 200
|
|
493
532
|
|
|
494
|
-
#
|
|
533
|
+
# Train standalone weights (≥30 labeled rows required)
|
|
495
534
|
npm run routing:train-p-success -- --input path/to/export.jsonl --output config/p-success-weights.json
|
|
496
535
|
|
|
497
|
-
# Or regenerate the checked-in dogfood weights from the synthetic fixture:
|
|
536
|
+
# Or regenerate the checked-in dogfood weights from the synthetic fixture (interim only):
|
|
498
537
|
npm run routing:train-p-success
|
|
499
538
|
|
|
500
|
-
#
|
|
539
|
+
# Optional: merge isotonic into an existing calibration bundle (does not rewrite hydra/centroids)
|
|
501
540
|
npm run routing:train-p-success -- --input path/to/export.jsonl \
|
|
502
541
|
--calibration-output config/routing-calibration.json
|
|
503
542
|
|