/ Stream
build 2026.12.03 · --:--:-- UTC · RSS

BabbTools for the frontier.

mascot mascot
All materials

derive_context v2 — Stage D prep report

DERIVE-CONTEXT-V2-REPORT.md View the source file

Run: 2026-11-29, Python 3 stdlib only, local. No GitHub writes, no Lab tool work. Code: derive_context.py Per-entry table: derive_context_table.csv Run log: derive_context_run.log Corpus: docs/kernel-model/test/corpus.json, 75 entries, at babbworks/stream main 5d18970 (HEAD verified via the GitHub connector; blob SHA 82c7110c…; content SHA-256 4d1dc36e…, byte-identical to the Stage C local copy). Ground truth F/S/O comes from model.py encode/bits, the same source Stage C used. The harness asserts the corpus hash before running.

Headline

v2 is written, total, deterministic, and honest — and it fails. With the three missing inputs supplied as the seed would have to supply them, it recovers all three context bits on 6 of 75 entries, refuses on 69, and is wrong on 0 as an entry (4 wrong bits, all of them the O bit of QUERY). The only construction that passes is the verb-keyed control: 75/75 by lookup on the verb name. The constraint verdict is therefore:

The no-label-lookup constraint has to go if the 6-bit claim is kept. The stored form is really "6 bits + a verb table" — the context bits are recovered by looking the verb up in the position table, not derived from kind, roles, and frame. Equivalently: keep the constraint, and the 6-bit wire form cannot be frozen — the full context stays in the reference AST, exactly as note 12 §2 already requires until this is proven.

1. v2 design

Signature (extends note 12 §2, which gave derive_context(kind_definition, role_values, log_frame) -> Context | Ambiguous | Invalid):

derive_context(kind_definition, role_values, log_frame,
               *, owner_boundary, frame_anchor, stored6=None) -> Outcome

Outcome.verdict is Context (all three bits 0/1), Ambiguous (at least one bit undecided, with a per-bit reason naming the missing input), or Invalid (the inputs are contradictory/malformed: bad enum in the kind table, a principal both in and out of the boundary, legs that do not balance per unit, no recorder). The function never raises on well-formed input. It never sees the verb name or the position code — the harness enforces this by construction. The stored six bits are passed only to select which role is the O-relevant principal and to check legs balance, never to look up context.

Rules per bit (full statement with rationales in the module docstring):

  • F (frame/world) — from the per-fact frame anchor: the anchor is the log itself, a segment, or an entity whose kind is an apparatus kind → frame (0); an anchor whose kind is a declared subject kind → world (1); otherwise Ambiguous, falling back to kind_definition.frame_domain. No subject kind is declared in the v2 seed table — no kind occurring in the corpus is a subject-matter kind — so the anchor rule can only ever say "frame" or "don't know", never "world", on this corpus.
  • S (sign/substance) — from kind_definition.effect_class ONLY. Quantity presence is deliberately never used: Stage C proved it fails both ways (ACT without use is substance; QUERY with use, ESTIMATE with q USD, AMEND with legs are sign). No kind definition → Ambiguous. No kind in the v2 table has effect_class conserved-effect — defining a unit, even a conserved one, is a representation act — so S=1 is never derived in Mode B. Substance is a property of the described act, and no entity kind in the corpus names an act.
  • M (actual/possible) — NOT derived. M is one of the six stored bits, so it is given, not recovered. There is no M rule in v2 by design.
  • O (self/other) — from the declared owner boundary. The O-relevant principal is the actor, else the grantee (for), else the subject if it is a principal id; for TO facts with legs, the boundary-crossing rule applies (legs spanning the boundary → other; wholly inside → self). Inside the boundary → self; a known principal outside it → other; wildcard / unregistered / absent principal → Ambiguous. The recorder is NOT the comparator — that was CAND-A's error (every CREATE is self regardless of recorder).

The kind table covers the 9 entity kinds occurring in the corpus (genesis, segment, seal, unit, profile, view, meter, actor, pool), built only from the sources' semantics. Two judgement calls are flagged in the code, not hidden: meter → apparatus (the meter is the recording instrument itself), and actor/pool → apparatus (the log's register of actors/pools is apparatus; the entities themselves are world entities — this encodes "facts defining/registering an actor are frame acts", which works only because the corpus never uses kind=actor/pool outside CREATE/GRANT/AMEND). The sensitivity run (§3) measures the cost of the opposite declaration.

The owner boundary is declared per log: Genesis roots + registered actors (acme: {human:ops-lead, human:op-07, host:build-01, agent:claude-07}; conformance: {actor:root}; pack: undeclared — no Genesis, so O is always Ambiguous there). The registry is whole-log, not prefix-only — generous to v2, since a prefix-correct registry would resolve fewer anchors. The registry is set-valued per entity (an entity can hold several kinds; host:build-01 is both actor and pool) after the first run caught a single-kind registry overwriting actor with pool and misclassifying three CREATE/AMEND O-bits — itself a small finding: boundary membership derived from kind registration is order-dependent unless the Register keeps every claim (note 12 §2.2, BKL-02).

2. Results

ModeCorrectAmbiguousWrongInvalid
A — corpus as-is, no v2 inputs07500
B — v2 inputs supplied66900
C — CONTROL, verb-keyed kind table75000

Per-bit, Mode B (correct / ambiguous / wrong): F 51/24/0; S 42/33/0; O 15/56/4. Mode A is 0/75/0 on every bit: total refusal, vacuous.

Mode B correct entries (all three bits, all of them): [3], [4], [5], [6], [7] demo CREATE and [74] "your log" CREATE — all context 000, all CREATEs whose subject is a registered principal. No world fact, no substance fact, and no other fact is ever fully recovered: the 6 correct entries are one context, and the other 41 entries with true context 000 are Ambiguous (mostly CREATEs of non-principal subjects and OPEN/COMMIT/ BIND, whose O is undeterminable — a log has no "self" to compare).

Per-bit detail (Mode B):

  • F 51/24/0. Correct on all 42 kind-carrying entries plus BIND ×2 (anchor is the log), GRANT ×2 and AMEND ×1 (anchor host:build-01), MEASURE ×4 (anchor meter:pdu-4; the other 6 MEASUREs are conformance m1, never registered). Ambiguous on all ACT/QUERY/NOTE/ESTIMATE/PAY/ ACK — their object task-83 / payment-r18ak5 was never registered, so the anchor kind is unknown. Never wrong — because the rule only ever fires on frame acts in this corpus (see §4).
  • S 42/33/0. Correct on exactly the 42 kind-carrying entries (OPEN, COMMIT, CREATE — all sign). Ambiguous on all 33 kind-less entries, including all 10 MEASUREs (true substance), all 6 ACTs (true substance) and both PAYs (true substance). S=1 is never derived.
  • O 15/56/4. Correct on ACT ×6 (actor in boundary), CREATE-principals ×6, PAY ×2 (legs span the boundary), AMEND-host ×1. Ambiguous wherever no principal is determinable (56). Wrong on exactly 4 bits: the O bit of QUERY [13], [14], [68], [69].

Self-test: 8 checks pass (determinism, Ambiguous-on-absence, Invalid ×4: unbalanced legs, contradictory boundary, malformed kind def, missing recorder; no quantity→S fallback).

3. The failing pattern

v2 fails in the same place CAND-A failed, for the same reason: on this corpus F/S/O are constant per verb, while every v2 input is constant across verbs that share it. Computed lemmas (in the harness, not asserted):

  • L1 — stored bits alone cannot determine context. Two stored-6 groups carry mixed FSO: (is,0,0,instant) → {000 CREATE, 101 NOTE} and (to,1,0,instant) → {001 ACK, 111 PAY}. Identical stored bits, different context. This is a proof, not a heuristic failure.
  • L2 — same actor, different O. Actor agent:claude-07: ACT is O=0 (self), QUERY is O=1 (other). No owner-boundary rule over the actor can get both right.
  • L3 — same object, different F. Object task-83: AMEND is F=0, ACT/QUERY/NOTE/ESTIMATE are F=1 (and payment-r18ak5: AMEND F=0 vs PAY F=1). No frame-anchor rule over the object can get both right.
  • L4 — FSO constant per verb: 13/13 verbs single-valued. The verb is the only input that varies exactly as FSO varies.
  • L5/L6 — the verb-proxy artefact. Kind-field presence implies F=0 (42/42) and S=0 (42/42) in this corpus, because kind-carrying facts are all definitional/log verbs (CREATE/OPEN/COMMIT). Mode B's F and S scores are therefore measured on frame/sign facts only; the kind table has no demonstrated ability to say "world" or "substance".

The four wrong O bits are the sharpest instance: QUERY's other is the intended respondent, who is not named in any role of the fact. The corpus does not carry the principal whose membership would decide O. Likewise AMEND vs NOTE on the same object: the difference is the act (amending a claim is about the record; noting is about the work), and nothing in the anchor says which relation the fact bears to its anchor — the corpus carries no defines/uses/amends field.

Sensitivity: declaring actor/pool as subject kinds (the semantically plain reading — actors and pools are world entities) moves F from 51/24/0 to 42/24/9, newly wrong on [3, 4, 5, 6, 7, 9, 24, 72, 74]. Nine entries — the entire CREATE/GRANT/AMEND F score — ride on that one judgement call.

4. Constraint verdict

The no-label-lookup constraint has to go if the 6-bit claim is kept. What v2 shows, run by run:

  • Mode A: without the new inputs, the function is total but vacuous (75× Ambiguous). The inputs Stage C asked for are real and necessary.
  • Mode B: with the new inputs built honestly from non-verb information, the function recovers 6/75 — all one context, all CREATEs — and refuses the rest. The three inputs can each say "frame" or "sign" or "self" about the facts that carry them, but none of them can say "world", "substance", or "other" about a fact whose verb says otherwise, because in this corpus those values arrive only via the verb.
  • Mode C: key the kind table on the verb (kind := verb, FSO from the position table) and it passes 75/75 — by lookup. That is the control that proves the pass requires the verb table.

So the honest statement of the stored form is: 6 bits + a verb table (equivalently, 6 bits + the position table, which maps each verb to its FSO). That is a legitimate design — a 13-verb (in the corpus; 51-verb in the full table) lookup is small and deterministic — but it is not the derivation note 12 describes, and the label-lookup ban would have to be lifted for it. The alternative, keeping the ban, is to retain the full context in the reference AST and not freeze the 6-bit wire form (note 12 §2's own rule, reaffirmed by Stage C). There is no third option visible from this corpus: L1–L4 close off stored-bits-only, actor-only, object-only, and entity-kind-only derivations alike.

5. What v2 needs that the corpus does not carry

  1. A kind-definition table. None exists in the repo. The corpus's kind fields are entity kinds on 42 entries; 33 entries carry no kind at all, and no entry carries a fact kind.
  2. A declared owner boundary. Genesis gives roots only; there is no membership list and no rule for who counts as self. The "your log" slice carries no Genesis at all.
  3. A per-fact frame anchor. No anchor field exists in any entry. The line object is not an anchor: it does not say whether the fact defines, uses, amends, or reads the anchor — the relation that would decide F for AMEND-vs-NOTE.
  4. The O-relevant party for QUERY/ACK/NOTE. The respondent (QUERY), the party whose recording is acknowledged/refused (ACK), and the owner of the noted work (NOTE) are not named in any role.
  5. An act effect class for kind-less facts. ACT/PAY/MEASURE substance vs QUERY/ESTIMATE sign is carried only by the verb.

6. What would have to change in the corpus / seed to supply them

  • Seed (note 12 §2.1 layer 4): publish the kind-definition table as a versioned, content-addressed interpretation pack, with frame_domain / effect_class per kind and a stated falsifier per entry — and decide, in writing, whether the table is keyed by entity-kind (then FSO stays underdetermined per L1–L4) or by fact-kind/verb (then the no-label-lookup constraint is dropped and the stored form is declared "6 bits + verb table").
  • Seed (note 12 §3.3): extend the GENESIS constructor with an explicit owner/membership declaration (not derivable from kind=actor CREATEs — that is order-dependent, §1) and a declared apparatus-kind set, so the boundary and the apparatus are stated, not inferred.
  • AST (note 12 §2.2): add a per-fact frame anchor carrying the fact's relation to its anchor (defines / uses / amends / reads / about). Without the relation, the anchor cannot separate AMEND from NOTE on the same object.
  • Corpus: add the missing roles (QUERY respondent; ACK's concerned party), add kind fields to kind-less facts or a fact-kind field, and — most importantly for any future claim — add counterexample entries that break verb-proxy tables: a world fact about a registered entity (e.g. NOTE about host:build-01), a substance fact carrying a kind, a frame fact about an unregistered entity. As the corpus stands, any table built from kind-field presence scores spuriously (L5/L6), and only such counterexamples can show whether a future derivation is real or another proxy for the verb.
  • Corpus (coverage): the 75 entries exercise 13 of 128 positions and 8 of 16 (F,S,M,O) combinations. A derivation claim over the full grid needs entries that vary one bit at a time — witness pairs sharing all other coordinates (note 19 §7) — which this corpus does not contain.

Files