phase5: learned class-selection policy (SPEC §13) — rank classes by ledger evidence

crates/policy: reads the append-only ledger and ranks playbook classes by
the Wilson score lower bound of their machine-verified win rate — the same
'quote the lower bound' discipline the rest of the project uses. A class
that won 1/1 does not outrank one that won 8/10 (wider interval); untried
classes fall back to the cheapest-first prior; tried-and-failed classes
rank last. Advisory only — the gates still decide every verdict.

On the current 33-row ledger it ranks class 5 (algorithmic) first, then
class 3, then class 1 — the proven winners — with class 7 (untried) above
the evidence-against classes. Wins count only machine-sanitizer-verified
accepts (conservatively excluding pre-gate accepts and the overturned
comrak-010): the policy trusts the ledger's machine record, not narrative.
4 unit tests (Wilson monotonicity, small-sample penalty, ranking order).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EcKPWQ3MQD4NdEHwar96u2
This commit is contained in:
Claude
2026-07-12 00:24:00 +00:00
parent 5d6c259b30
commit b7297ad31f
7 changed files with 314 additions and 0 deletions
+4
View File
@@ -84,3 +84,7 @@ service-calibrate server doc out *flags:
# dollars and/or latency percentiles, CIs + methodology printed inline.
report run_id *flags:
cargo run -p report -- --run-id "{{run_id}}" {{flags}}
# Learned playbook-class ranking from the ledger (SPEC §13 research fork)
policy *flags:
cargo run -p policy -- {{flags}}