Skip to content

Implement SPEC-07: the scorer, four-stop verdicts (Stage 3)#19

Merged
IanMayo merged 1 commit into
mainfrom
claude/next-spec-bbbs94
Jul 13, 2026
Merged

Implement SPEC-07: the scorer, four-stop verdicts (Stage 3)#19
IanMayo merged 1 commit into
mainfrom
claude/next-spec-bbbs94

Conversation

@IanMayo

@IanMayo IanMayo commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

What this is

Stage 3, the delivery linchpin (DEC-10): the scorerplan × 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:

reduce a commitment to M = [m_lo, m_hi], satisfied ⟺ margin ≥ 0
robust   iff m_lo > 0        marginal iff m_lo = 0 ≤ m_hi
tight    iff m_lo < 0 ≤ m_hi  violated iff m_hi < 0

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/)

File Role
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 C1–C6; a severed route surfaces as a violated reach, never an Infinity
src/score.ts /score — verdict mapping, banded scores, the knowledge_overrides hook (call-only, persists nothing), the stamp_mismatch comparability guard, scored_from edges (G3), determinism over inputs
src/components/s2Matrix.ts "the honest matrix" — four-stop chips, margin bands on hover, no decimals (G2)
fixtures/plans.json canned P1/P2 handful (delivery plan §3 sanctioned generator fallback)

No schema change — CommitmentVerdict / PlanScore / Plan / Band already exist.

Correctness leg (the reason SPEC-07 exists ahead of the generator)

Hand-computed oracle constants, never regenerated from the scorer:

  • O-1 2 + [4,6] + [3,5] = [9,13] exactly
  • O-2 [9,13] vs at_most 28robust, margin [15,19]
  • O-3 [9,13] vs at_most 12tight; sweeping at_most T 8→14 changes the verdict only at band edges 9 and 13
  • O-4 / G6 containment under widening ([8,14] ⊇ [9,13]) plus a property-based test (fast-check): superset-under-widening, point-realisation membership, and verdict-monotonicity toward uncertainty

The honest matrix over the Meridian handful shows all four stops and the thesis-C collapse (P1's C1/C2 fall to violated under R2's mined strait), rendered in the gallery by the actual scorer.

Verification

  • npm run typecheck clean
  • npm test139 passed (107 SPEC-06 baseline + 32 new across interval / oracle / score / s2Matrix / fixtures)
  • npm run gallery renders the honest-matrix demo moment

SPEC-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.md note; then Stage 4 SPEC-09 relaxation.

🤖 Generated with Claude Code


Generated by Claude Code

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
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-13 06:42 UTC

@IanMayo IanMayo merged commit 5c3f45f into main Jul 13, 2026
3 checks passed
@IanMayo IanMayo deleted the claude/next-spec-bbbs94 branch July 13, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants