Implement SPEC-09: relaxation / least-worst under infeasibility (Stage 4)#21
Merged
Conversation
…e 4)
Research note docs/research/04-relaxation.md (DEC-11 gate) decides the
soft-constraint formalism: preemptive lexicographic priority over the
must/should/prefer tiers with NO numeric weights — weighted CSP / MAX-SAT /
Archimedean goal programming rejected on honesty grounds (DEC-19). /relax
returns the inclusion-minimal correction-set frontier (not one optimum),
ranked least-worst-first with the must-sacrifice kept but ranked last;
`sacrificed` = exactly the `violated` commitments (computed by the reused
SPEC-07 scorer, not authored); a content-neutral, stated tie-break for
same-tier sacrifices; command-language narratives per MDMP / JP 5-0.
The note corrects course honestly: the SPEC-08 BASE generator routes clear
of the banded regions and cannot enter the mined water, so SPEC-09 authors
an R3m-responsive candidate set (route latitude, vignette §8) while the
sacrifices stay computed by the scorer (DEC-10).
SPEC-09 specified via spec-kit (specs/009-relaxation/) and implemented:
- src/tiers.ts — tier lexicography + inclusion-minimality over sacrifice
sets + stated tie-break (pure, no weights)
- src/relaxCandidates.ts — authored R3m-responsive candidate plans
- src/relax.ts — RelaxService (/relax): generate -> score -> sacrifice ->
inclusion-minimal -> rank -> cited_in/sacrificed_in edges
- src/components/s3Cards.ts — the least-worst cards
- new seam types; no schema change (RelaxationReport/Candidate/Plan exist)
Stage-4 exit holds on Meridian: /relax over R3m returns three
inclusion-minimal least-worst candidates sacrificing C4, C3, C2 (each
`sacrificed` non-empty, computed — re-scoring each plan violates exactly its
set; the {C2,C4}/{C3,C4} supersets are inclusion-dropped), the C2
must-sacrifice ranked last but present, the C3/C4 same-tier tie stated in
tie_break, every card traced back via cited_in/sacrificed_in (G3), never
empty and never a silent drop (G4).
187 tests pass (24 new), typecheck clean; the "least-worst, never silence"
demo moment renders in the gallery. Batch-propagated: CLAUDE.md current
phase, delivery-plan status, gallery. No new register decision.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0162hYgQuqj5XgzoccFr4fL5
|
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 & why
Stage 4 of the build plan — least-worst (thesis B live).
POST /relaxturns an infeasible commitment set into an argument the commander weighs, never an error the machine hides or a scalar it optimises. On the Meridian R3m world (both approaches mined, causeway dropped) no plan satisfies C2, C3 and C4 together;/relaxreturns the three inclusion-minimal least-worst ways forward, each naming what it gives up.Research-first (DEC-11 gate)
docs/research/04-relaxation.mdis authored before implementation and decides:must/should/prefertiers, NO numeric weights. Weighted CSP, partial weighted MAX-SAT, and Archimedean goal programming are rejected on honesty grounds (DEC-19), not scale — a numeric sacrifice weight is a ratio the commander never issued. This spends ASSAY-FIND-2 at the build face.sacrificed= exactly theviolatedcommitments, grounded in the four-stop scale the reused scorer computes;tight/marginalare risks, not sacrifices.should) — because encoding a civil-harm-vs-force-protection ranking into code is the value judgement DEC-19 exists to prevent, in non-numeric clothing.Changes
Specified via spec-kit (
specs/009-relaxation/) and implemented:src/tiers.ts— tier lexicography + inclusion-minimality over sacrifice sets + the stated tie-break (pure, no weights)src/relaxCandidates.ts— authored R3m-responsive candidate plans (routes documented cell-by-cell)src/relax.ts—RelaxService(/relax): generate → score (reusedScoreService) → readviolatedsacrifice sets → inclusion-minimal → rank by tier →cited_in/sacrificed_inedgessrc/components/s3Cards.ts— the S3 least-worst cardsRelaxationReport/RelaxationCandidate/Planalready exist)Stage-4 exit (verified on Meridian)
/relaxover R3m returns three inclusion-minimal least-worst candidates sacrificing C4, C3, C2 — eachsacrificednon-empty and computed (re-scoring each plan violates exactly its set; the{C2,C4}/{C3,C4}supersets are inclusion-dropped), the C2must-sacrifice ranked last but present, the C3/C4 same-tier tie stated intie_break, every card in command language and traced back viacited_in/sacrificed_in(G3), never empty and never a silent drop (G4).Invariants
G4 (least-worst, never silence) upheld by the report shape and validation (empty
candidates/sacrificedfail validation); G2 (no decimal/verdict-token on the card face;marginin the trace drawer); G3 (complete backward chains); G1 (deterministic over(world stamp, commitment ids, seed, engine)); DEC-19 (ordinal tiers, no weights, stated tie-break).Testing
npm test— 187 pass (163 baseline + 24 new: 13tiers, 11relax)npm run typecheck— cleannpm run gallery— the "least-worst, never silence" demo moment renders the three R3m cards from the actual/relaxRegister & propagation
No new register decision — the formalism is decided by DEC-19, the report shape by knowledge model §5/§8 and seam §7/§G (G4), the tie-break rule by DEC-19's own "state it explicitly." Batch-propagated in the same change: CLAUDE.md current-phase line, delivery-plan status, gallery.
🤖 Generated with Claude Code
Generated by Claude Code