Implement SPEC-07: the scorer, four-stop verdicts (Stage 3)#19
Merged
Conversation
Research note 03-score-plan.md (DEC-11 gate) decides the four-stop verdict mapping as signed margin bands, signs-only — robust iff m_lo>0, marginal iff m_lo=0, tight iff m_lo<0<=m_hi, violated iff m_hi<0 — the unique rule that satisfies oracle O-3 (the verdict changes only at band edges, no interior cut, because a pure interval gives no honest midpoint to cut at — DEC-15). The note also settles (cell,time) route evaluation over a time-expanded graph (closing note 02's forward flag) and reserves epsilon-dominance for SPEC-08 plan comparison, never for verdicts. SPEC-07 specified via spec-kit (specs/007-score/) and implemented: - src/interval.ts: closed-interval arithmetic on pure bands; inclusion-monotone and sound by construction (G6); no mean/mid/most-likely operation exists. - src/materialise.ts: lazy score-time (cell,time) channel resolution over the sparse world; nothing dense stored or hashed. - src/metrics.ts: reach-step / exposure / fires / state metric families for the Meridian commitments C1-C6; a severed route surfaces as a violated reach. - src/score.ts: /score service — verdict mapping, banded PlanScores, the knowledge_overrides perturbation hook (call-only, persists nothing), the stamp_mismatch comparability guard, scored_from edges (G3), determinism over inputs. A plan that fails a must is a success with a violated verdict. - src/components/s2Matrix.ts: the honest matrix — four-stop chips, margin bands on hover, no decimals (G2). Wired into the gallery demo moment. - fixtures/plans.json: canned P1/P2 handful (delivery plan §3 fallback). Correctness leg holds: oracle O-1 ([9,13]), O-2 (robust, margin [15,19]), O-3 (four-stop sweep) reproduced exactly from hand-computed constants; O-4 propagation-honesty (G6) under property-based testing (fast-check). 139 tests, typecheck clean. No schema change — verdict/score/plan shapes already exist. SPEC-07 asserts no new register decision. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UQbHcPP3Wjq4Cvkg4bRKFt
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this is
Stage 3, the delivery linchpin (DEC-10): the scorer —
plan × world × scenario → CommitmentVerdict[] + PlanScore[]. The research-first gate (DEC-11) is satisfied first, then SPEC-07 is specified via spec-kit and implemented, with the vignette §9 oracle cases as the independent correctness leg.The gate:
docs/research/03-score-plan.md(DEC-11)Decides the four-stop verdict mapping — the design latitude O-3 explicitly delegated to Stage-3 research — as signed margin bands, signs-only:
This is the unique four-stop rule that satisfies O-3 (the verdict changes only at band edges, never inside the band) — because a pure interval gives no honest interior point to cut at (DEC-15: no midpoint, ever). The note also settles
(cell,time)route evaluation over a time-expanded graph (closing note 02 §3's forward flag) and reserves ε-dominance for SPEC-08 plan comparison, never for a verdict against the commander's threshold.Implementation (
specs/007-score/)src/interval.tssrc/materialise.ts(cell,time)channel resolution over the sparse world; nothing dense stored or hashedsrc/metrics.tsviolatedreach, never anInfinitysrc/score.ts/score— verdict mapping, banded scores, theknowledge_overrideshook (call-only, persists nothing), thestamp_mismatchcomparability guard,scored_fromedges (G3), determinism over inputssrc/components/s2Matrix.tsfixtures/plans.jsonNo schema change —
CommitmentVerdict/PlanScore/Plan/Bandalready exist.Correctness leg (the reason SPEC-07 exists ahead of the generator)
Hand-computed oracle constants, never regenerated from the scorer:
2 + [4,6] + [3,5] = [9,13]exactly[9,13]vsat_most 28⇒ robust, margin [15,19][9,13]vsat_most 12⇒ tight; sweepingat_most T8→14 changes the verdict only at band edges 9 and 13[8,14] ⊇ [9,13]) plus a property-based test (fast-check): superset-under-widening, point-realisation membership, and verdict-monotonicity toward uncertaintyThe honest matrix over the Meridian handful shows all four stops and the thesis-C collapse (P1's C1/C2 fall to
violatedunder R2's mined strait), rendered in the gallery by the actual scorer.Verification
npm run typecheckcleannpm test— 139 passed (107 SPEC-06 baseline + 32 new across interval / oracle / score / s2Matrix / fixtures)npm run galleryrenders the honest-matrix demo momentSPEC-07 asserts no new register decision — the mapping is decided in the research note under the latitude vignette §9/O-3 delegated to Stage-3.
Next
SPEC-08 — handful generator + banded non-dominated organisation (sacrificial scope), over the same
03-score-plan.mdnote; then Stage 4 SPEC-09 relaxation.🤖 Generated with Claude Code
Generated by Claude Code