Skip to content

Implement SPEC-06: compile service, sparse channels (Stage 2)#16

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

Implement SPEC-06: compile service, sparse channels (Stage 2)#16
IanMayo merged 1 commit into
mainfrom
claude/next-spec-gfmn70

Conversation

@IanMayo

@IanMayo IanMayo commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Stage 2 — Compile (knowledge → CompiledWorld)

Research-first (ASSAY-DEC-11): docs/research/02-compile.md is the gate. It decides the sparse channel representation from the Stage-0 dense-world benchmark (a dense CompiledWorld is ~1.2M cells → 84.9 MB, ~19.4 s serialise+hash per recompile — re-measured this session, not viable even in the mock) and from ATP 2-01.3 MCOO doctrine (overlays record deviations, not per-cell attributes). This retires dense Channel.cells and resolves seam contract open item 2.

SPEC-06 was specified through spec-kit (specs/006-compile/) and implemented.

What changed

Schema (LinkML → regenerated types)

  • Channel is now { name, kind, default: Band, regions: RegionOverride[] } — a per-channel default plus named, optionally time-boxed deviations. ChannelCell (dense) is removed.
  • New RegionOverride { region, value: Band, from_step?, until_step?, source? }.
  • New VignetteConfig { grid, channels, regions, subject_map } holds region→cell geometry and subject → (channel, region) routing once, not per world.

Compile service (src/compile.ts)

  • POST /compile (seam §4): knowledge subset + config → CompiledWorld.
  • Refuses contested_knowledge (G5 — completes at the compile refusal what SPEC-05 marked, reusing isCompilable), stale_input (via effectiveStatus), and encoding_violation/waiver_required as defence in depth (reusing the pure checkEncoding); persists nothing on refusal.
  • Firewalls scenario_weight (K14 never reaches a channel); applies a COA excursion as a region-override overlay folded into the stamp.
  • Deterministic stamp over sorted inputs (G1); one compiled_into edge per consumed object + a waives edge per waiver; every RegionOverride names its source, so every channel value is backward-traceable to named knowledge with a named owner (G3). No delta (compile is a read-of-knowledge, seam §4).
  • Nothing dense is ever stored or hashed — region→cell materialisation is a lazy, unstored, score-time function (flagged forward to Stage 3).

Surface & fixtures

  • src/components/channelTrace.ts — the channel-trace surface (region → band pill → backing knowledge + owner), framework-free, arranges projections only.
  • fixtures/vignette-config.json — Meridian grid, per-channel defaults, region geometry, subject map.
  • The compile demo moment renders in the gallery: "contested never compiles", then resolve → recompile.

Verification

  • npm run typecheck clean; npm test 107 passing (14 new compile contract-invariant tests + 3 channel-trace + config validation).
  • All three Stage-2 exits demonstrated on Meridian: K12 contested ⇒ refuse ⇒ resolve ⇒ recompile; byte-identical stamp for identical inputs (order-independent; R2 excursion reproducibly distinct); every channel traces back to named knowledge.
  • The markdown §11 LinkML block and schema/*.yaml remain byte-identical (bodies) per the source-of-truth invariant.

Register discipline

The sparse-channel schema change is a decision, so it is recorded as a flagged register candidate (docs/assay-concept.md §6, item 12) — not asserted in a peer doc (ASSAY-DEC-2). SPEC-06 builds against it under seam open item 2's delegated authority, pending batch ratification (mirroring how note 01's floor entered on landing per DEC-16). Batch propagation swept knowledge-model §7/§11, seam contract open item 2, vignette §8, and the CLAUDE.md current-phase line in this change.

🤖 Generated with Claude Code


Generated by Claude Code

Stage 2 of the ASSAY build. Research-first (DEC-11): docs/research/02-compile.md
decides the sparse channel representation from the Stage-0 dense-world benchmark
(~1.2M cells → 84.9 MB, ~19.4 s serialise+hash per recompile — not viable) and
ATP 2-01.3 MCOO doctrine (overlays record deviations, not per-cell attributes),
retiring dense Channel.cells and resolving seam contract open item 2.

SPEC-06 specified via spec-kit (specs/006-compile/) and implemented:
- Schema: Channel is now {default: Band, regions: RegionOverride[]}; new
  VignetteConfig {grid, channels, regions, subject_map} holds region geometry
  and subject→(channel,region) routing once, not per world. Types regenerated.
- src/compile.ts (CompileService): knowledge subset + config → CompiledWorld.
  Refuses contested_knowledge (G5, completing what SPEC-05 marked, via
  isCompilable), stale_input (effectiveStatus), and encoding_violation/
  waiver_required as defence in depth (reusing the pure checkEncoding);
  firewalls scenario_weight; applies a COA excursion as a region-override
  overlay folded into the stamp. Deterministic stamp over sorted inputs (G1);
  one compiled_into edge per consumed object + a waives edge per waiver, and
  every RegionOverride names its source, so every channel value is
  backward-traceable to named knowledge (G3). No delta (seam §4).
- src/components/channelTrace.ts: the channel-trace surface (region → band →
  backing knowledge with owner). fixtures/vignette-config.json authored.
- Compile demo moment renders in the gallery ("contested never compiles",
  then resolve → recompile). 107 tests pass, typecheck clean.

All three Stage-2 exits demonstrated on Meridian. The sparse-channel schema
change is recorded as a flagged register candidate (concept §6, item 12), built
under seam open item 2's delegated authority pending batch ratification. Batch
propagation: knowledge-model §7/§11, seam contract open item 2, vignette §8,
CLAUDE.md current-phase.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019qeyKmS8aAPLRLxK8wmdHR
@IanMayo IanMayo force-pushed the claude/next-spec-gfmn70 branch from 49f79ed to ee1666e Compare July 12, 2026 20:44
@github-actions

github-actions Bot commented Jul 12, 2026

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

@IanMayo IanMayo merged commit 1559e25 into main Jul 13, 2026
3 checks passed
@IanMayo IanMayo deleted the claude/next-spec-gfmn70 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