Stage C Audit — the 75-entry kernel-model corpus
Run: 2026-11-29, Python, local only (~/workspace/stream-stage-c/). Sources, all read at babbworks/stream main 7761b9a (HEAD verified first via the GitHub connector; note: main has moved since the earlier 525c084 — PR #7 was merged at 5d18970 and PR #8, the labs spec, at 7761b9a):
docs/kernel-model/test/corpus.json(75 entries),model.py,test_roundtrip.py,test_books.py,demo.json,gen.mjsdocs/kernel-model/DIGEST.md(§8 test results),OVERVIEW.mddesign/stream/relations-and-matrix.mddocs/creation/review/19-generative-world-model-and-matrix.md(note 19)docs/creation/review/12-codeable-unfolding-kernel-plan.md(note 12)
No repo writes were made. The corpus and harness were copied locally for the audit; the originals are untouched. Reproduce with python3 test_roundtrip.py, python3 test_books.py, python3 stage_c.py in this directory.
The claim under test
Note 12 §2 (provisional): the stored fact type is six bits — relation 2 | direction 1 | modality 1 | phase 2 — and the three context bits F (frame/world), S (sign/substance), O (self/other) are derived by a total, deterministic function:
derive_context(kind_definition, role_values, log_frame) -> Context | Ambiguous | Invalid
Constraints (note 12): no label lookup, no wall-clock heuristic. Each valid fact must either derive one context or produce a specified refusal/unknown result. Gate (note 12 §8 / Stage C): "the 6-bit/context derivation is total and unambiguous for the corpus, or the format retains explicit context bits / revises its claim."
The three numbers — kept separate, as specified
| # | Column | Result |
|---|---|---|
| 1 | Full-position recovery — encode(line) gives code c (7 bits) + phase, and decode recovers the verb name | 75 / 75 |
| 2a | Context-bit derivation, as specified — run the sources' derive_context | NOT RUNNABLE — no such function exists in the sources |
| 2b | Context-bit derivation, audit candidates (see below) | Best candidate: 4 / 75 all-three-bits correct; 31 ambiguous, 40 wrong |
| 3 | Round-trip — decode(encode(line)) == line, byte for byte | 74 / 75 |
| — | Verb-name recovery (a fourth, distinct metric — do not conflate with round-trip) | 75 / 75 |
The repo's own harness reproduces the published figures exactly when run here: test_roundtrip.py prints "round trip: 74 identical, 1 not, of 75" and test_books.py prints "identical : True".
74/75 vs 75/75 is two different metrics. Round-trip (74/75) fails on one entry; verb-name recovery (75/75) succeeds on all 75, including that entry. They must never be collapsed into one score.
Column 3 — the one round-trip failure
Entry [40], conformance, NOTE:
in 1752300001 NOTE x {"text":"hi","rec":"actor:root"}
out 1752300001 NOTE x {"rec":"actor:root","text":"hi"}
This is conformance case 04, non-canonical by design — the input keys are not in sorted order, so canonical re-serialisation changes the byte order. The verb, the position (0x4a, instant) and every fact survive; only the byte order differs. It is a failure of the input to be canonical, not of the model. All other 74 entries round-trip byte-for-byte.
Column 1 — full-position recovery, 75/75
Every entry encodes to a code c and phase, and decode returns the original verb name with no label needed (test_roundtrip.py: "labels needed to recover a verb name: {}"). Placement: 65 entries as positions, 10 as "sensing" (all MEASURE, a sample of the power-flow position 0x26).
Coverage warning: the corpus uses only 13 distinct verbs and 13 of the 128 positions, in 15 distinct (code, phase) pairs, and only 8 of the 16 (F,S,M,O) combinations. The corpus is a narrow slice of the grid. Even a perfect score here would be evidence about these 13 positions, not a proof about all 128.
Column 2a — the specified derivation: NOT RUNNABLE
There is no derive_context function in the sources. Note 12 defines the signature and the constraints and says "Define a total, deterministic function" — as an open task. Note 19 §7 states per-split obligations (what each bit would have to rest on) but gives no function. Relations-and-matrix lists "Can the stored bits recover the context?" as an open question: "Deriving frame, sign and self or other from six stored bits needs a stated function over a defined domain, with counterexamples and an ambiguity policy. Success on a corpus is evidence and not a proof."
This is the single most important Stage C finding: the gate cannot pass, because the thing being gated does not exist yet. The audit below (2b) does not substitute for it — it tests whether any plausible function of the allowed inputs could work, to show what the function would have to overcome.
Column 2b — candidate functions (audit constructions, NOT source functions)
Three candidates were constructed by this audit and run with a per-entry trace (full traces in stage-c-table.csv). They are labelled CAND-A/B/C throughout; a pass by a candidate would not prove the claim.
CAND-A — recorder-relative self/other, quantity-based sign/substance, log-internal frame/world
- O: self iff the fact's subject == recorder (
rec); other iff different; ambiguous if no subject is determinable. - S: substance iff the entry carries a conserved quantity (
qwith a conserved unit,legs, oruse); sign otherwise. - F: frame iff the entry concerns the log itself (kind in {genesis, segment, seal}, verb in {OPEN, COMMIT, BIND}, object
log:*/seg-*). This is a kind/verb label lookup, explicitly forbidden by note 12 — flagged wherever it fires.
Result: 4 / 75 correct, 31 ambiguous, 40 wrong.
Per-bit, where determined:
| Bit | Correct | Ambiguous |
|---|---|---|
| F (frame/world) | 33 / 75 | 0 |
| S (sign/substance) | 67 / 75 | 0 |
| O (self/other) | 9 / 44 | 31 |
The 4 "correct" entries are all the same context (F=1, S=0, O=1) — QUERY begin and NOTE instant with no quantity carried. The candidate only works where the true context happens to be the default.
Why CAND-A fails — the pattern, bit by bit
F fails on all 42 frame entries that are not OPEN/COMMIT/BIND. In the corpus, F=0 (frame) is a property of the verb's assigned position — CREATE, GRANT, AMEND, ACK and MEASURE are all frame positions — not of the payload. No kind or role field distinguishes a frame CREATE from a world ACT: both have an actor, a recorder, and no conserved quantity. The log-internal lookup catches only the three log verbs and misses the other 42 frame entries. F cannot be derived from kind/roles as the corpus stands; it is currently carried by the verb's table assignment.
O fails wherever it can be determined (9/44) and is undeterminable in 31 entries. 31 entries have no subject determinable at all — OPEN, COMMIT, MEASURE, PAY, ACK carry no subject in the main fact — so the recorder-relative rule has nothing to compare. Where a subject exists, the rule is mostly wrong: every CREATE in the corpus is O=0 (self) in the position table regardless of whether the created subject equals the recorder (e.g. [4] CREATE human:op-07, recorded by human:ops-lead, is self). O, like F, is currently a property of the verb's assigned position, not of the subject/recorder relationship. Note 19 §7 already warns: "Multiple owners or unknown membership may make the bit ambiguous."
S is the best bit (67/75) and still fails in both directions. Carrying a quantity does not determine S:
ACTwithoutuseis substance (true S=1, candidate says sign) — [12], [16], [67], [70]. The act expends a resource the entry does not itemise.QUERYwithuse,ESTIMATEwith a USD quantity,AMENDwithlegsare sign (true S=0, candidate says substance) — [14], [21], [23], [68]. A query that consumes tokens is still a message; an amended payment is still a claim about a claim. Note 19 §7: "All records are signs; this bit concerns their described act, not their bytes." S depends on the described act — i.e. on the verb's assigned meaning — not on whether a quantity is present.
CAND-B — kind-definition only
Derive all three bits from kind_definition alone. Result: 75/75 ambiguous. Most entries have no kind field at all, and no kind-definition table exists in the corpus (or in the repo) to derive from. There is nothing for the function to read.
CAND-C — log_frame only
log_frame is constant per log (demo / conformance / pack / your log), so it can at most supply a constant F per log and nothing for S or O. Result: 75/75 ambiguous. A single log mixes frame and world facts (the demo log contains OPEN/BIND and PAY/ACT), so a constant per log cannot match both.
The Books — rebuilt from flow facts alone: IDENTICAL
test_books.py over demo.json: today's rules vs flow facts alone produce the identical balance table (host:build-01 −419 J, −14,300 ti, −786 to, −51.6 xs, ops-lead −89 USD; task-83 and vendor:model-api the mirror image), with 3 samples not posted ("samples are looking, possibles are not yet"). Books: identical, as published. This is the strongest result in the audit — the to-fact fold reproduces the ledger without the v1 rules — but it is a result about the 13 positions in the corpus, and about to facts only.
What Stage C does and does not prove
It proves:
- The 75-entry corpus is in the repo (
docs/kernel-model/test/corpus.json) with a working harness (model.py,test_roundtrip.py,test_books.py) — the earlier "not in the repo" report (2026-11-26) is now out of date. - Full-position recovery works on the corpus: 75/75 verb names recovered, no labels needed.
- Round-trip works except the designed non-canonical case: 74/75.
- Books rebuild identically from flow facts alone.
- The context-derivation gate cannot pass as specified, because the
derive_contextfunction does not exist. No candidate function of the allowed inputs (kind definition, role values, log frame) recovers the context on this corpus: best 4/75, with the F and O bits systematically carried by the verb's table assignment rather than by any payload field, and the S bit not determined by carrying a quantity.
It does not prove:
- That the 6-bit scheme is impossible. It proves the function is missing, not that no function could exist. A function would have to draw on something the corpus does not currently carry — e.g. an explicit kind-definition table, a declared owner boundary, or a frame anchor per fact — and note 12's constraints (no label lookup) may themselves need revisiting: if context is recoverable only via the verb, then the stored form is really "6 bits + a verb table", and that should be said plainly.
- Anything about the other 115 positions, the 42 open slots, or domains outside this corpus. Only 13 positions are exercised.
- That the direction bit is settled. D is one of the six stored bits and was taken as given here (from the position table); the direction-bit dispute across inherited specifications is a separate open question and was not tested.
Consequences for the next steps
- Do not freeze the 6-bit wire form. Note 12's own rule: "Until this is proven on the corpus and edge cases, retain the full context in the reference AST and do not freeze the 6-bit wire form." Stage C confirms that condition is not met.
- **The next work is to write
derive_context, not to test it again.** The function needs a defined domain: a kind-definition table, a declared owner/responsibility boundary (for O), a frame anchor per fact (for F), and a rule for S that refers to the described act rather than to the presence of a quantity. Until those inputs exist in the seed, no derivation can be total. - Or revise the claim. If context is in practice recovered from the verb's position, say so: the stored form is 6 bits plus the position table, and the "derivation" is a table lookup. That is a legitimate design — it is just not the derivation note 12 describes, and the label-lookup ban would have to be lifted for it.
- Reader A / Reader B can proceed independently. The reader comparison does not depend on the 6-bit scheme: both readers can carry the full 7-bit position + phase in the reference AST, as note 12 requires.
- Stage C is now done and reproducible.
stage_c.py+stage-c-table.csvin this directory; the three numbers are 75/75, NOT RUNNABLE (best candidate 4/75), 74/75.
Files in this directory
STAGE-C-REPORT.md— this report.stage-c-table.csv— one row per corpus entry (i, src, verb, code, phase, F/S/M/O, rel, D, stored 6 bits, col-1 and col-3 verdicts, CAND-A/B/C scores and traces, full line).stage_c.py— the audit script.stage-c-run.log— the run output.corpus.json,model.py,test_roundtrip.py,test_books.py,demo.json,gen.mjs— copies of the repo files at main7761b9a(SHA-256 of corpus.json:4d1dc36e388222af3e0b4cf1985bc189e83662f4d3c4206d6fb31d55eb2827ec).src-*— the source files as fetched, with the raw connector output alongside.