# THE MIZAN RECORD — SPECIFICATION, ERA ONE (FROZEN 2026-11-13) Status: FROZEN. This document is the authority for era one of the record; the code is one implementation of it and is held to the same conformance vectors as any outside verifier (§18, §21). It is derived from the running implementation (api/vlog.py, api/headset.py, api/provenance.py, api/verdict.py, api/gate.py, api/gate_first.py, api/requirements.py, api/witness.py, tools/witness.py, tools/mirror.py, tools/anchor_vlog.py). Where the implementation at the freeze date does not yet meet a rule stated here, the exact current behaviour is recorded in Appendix A ("Era-one known divergences"). Nothing in this document is invented. Key words MUST / MUST NOT / SHOULD / MAY are RFC 2119. Conformance vectors: §18. Change control: §20. --- ## 0. Scope and identifiers | Thing | Identifier (as emitted) | |---|---| | The log | `log = "mizan-verdict-log-v1"` | | Head hash/tree algorithm string | `alg = "sha256/RFC6962"` | | Record canonical form | `mizan-canon/1` (§2.1) | | Signature set rule | `mizan-head-set/1` (§6.3) | | Witness head document | `mizan-witness-head/1`; witness key document `mizan-witness-key/1` (§13.3, §14) | | Verdict token | `mzv1` (`typ = "mizan.verdict/1"`) (§9) | | Fact claim token | `mzf1` (`v = 1`) (§10) | | Evaluator contract | `mizan-gate-evaluator/v1` (§10.4) | | Rule grammar | `mizan-rule-grammar/v1`; `grammar_hash` (§11) | | Label grammar | `mizan-gate-labels/v1` (§12) | | Ledger extract | `mizan-ledger-extract-v1` (§17, step 6) | | This specification | `mizan-record-spec/era1-2026-11-13` | Everything in this document is verifiable offline from: the public leaves, a served head, the published key set, a witness's key document, and the checkpoint files. No step requires trusting an unsigned JSON answer over a signed object. --- ## 1. Terms - **Leaf** (entry): one committed claim appended to the log; never a result rewritten in place. - **Head** (signed tree head): `{size, root, ts, alg, log}` plus signatures; one is written on every append and served on every read. - **Operator**: the party that signs heads with the key published at `/.well-known/mizan-keys.json`. In era one the operator is MIZAN. - **Witness**: a program (`tools/witness.py`, or the single-file `tools/mirror.py`) that re-derives a head from the public leaves with its own code and key and signs it. - **Mirror registration**: a witness head signed by a key the operator does not hold, accepted by the record at `POST /api/log/witnesses/register` (§14.2). - **Checkpoint**: a head file stamped by outside clocks (RFC 3161 tokens; an OpenTimestamps `.ots` block attestation). - **Subject / measurer / checker**: three 16-hex hashes carried on a fact claim (§10); never names. - **Era**: one frozen specification with its own hash. This document is era one. --- ## 2. Canonical JSON ### 2.1 Record canonical form (`mizan-canon/1`) — leaves, heads, witness heads, tokens ``` canonical(o) = json.dumps(o, sort_keys=True, separators=(",", ":"), ensure_ascii=False, default=str).encode("utf-8") ``` - Object keys MUST be sorted by Unicode code point; arrays keep order. - No insignificant whitespace. Non-ASCII characters MUST be emitted as UTF-8, NOT escaped. - Strings use JSON escapes for `"`, `\`, control characters. - Numbers: a writer MUST emit integers as decimal and floats in shortest round-trip repr (the reference implementation's `repr`; `150.0` is written `150.0`, never `150`). A reader MUST hash a number as the lexeme found in the stored line and MUST NOT reformat it (a JSON parser that collapses `150.0` to `150` computes a different leaf hash; the browser and mirror implementations keep the lexeme as text). Heads and tokens MUST carry only strings, integers, booleans, null and objects/arrays of those; floats MAY appear in a leaf's `extra` (many era-one leaves carry amounts and measures as floats) and inside the `facts` object of an `mzf1` claim and the `extra.facts` object of a `facts` leaf (§10). - `default=str` in the reference implementation renders a non-JSON value through `str()`. A conforming writer MUST NOT rely on this: every value written MUST already be a JSON scalar, object or array. A reader MUST hash the bytes as found. (Divergence A.9.) The browser implementation (`verdict.js`, `canon()`) implements the same: sorted keys, `JSON.stringify` per scalar, numbers kept as their original text so a large integer is not reformatted. Vectors: `canonical_json[]` (object → UTF-8 bytes hex, sha256). ### 2.2 Rule canonical form — compiled requirements only (§11) ``` canonical_rule(o) = json.dumps(o, sort_keys=True, separators=(",", ":")) # ensure_ascii=True: non-ASCII ESCAPED (\uXXXX) ``` This differs from §2.1 in one respect (ASCII escaping). It is what `requirements.canonical` does and what every published rule hash was computed over. In era one both forms are normative for their own objects; a verifier MUST use §2.2 for rule hashes and §2.1 for everything else. Unifying them is era-two work; the hashes of era-one rules are kept forever. --- ## 3. The leaf ### 3.1 Stored record (one JSON object per line of `data/verdict_log.jsonl`) Field order as written (order is irrelevant to hashing; §2.1 sorts): | Field | Type | Meaning | |---|---|---| | `ts` | string, `YYYY-MM-DDTHH:MM:SSZ` UTC | the writer's clock at append (or the historical time of a backfilled leaf). **Not** the operative time (§15.2). | | `kind` | string, one of KINDS (§3.2) | the kind of claim | | `subject` | string | what the leaf is about — an id, a hash, a key hash, a rule hash; never a legal name (§16.2) | | `verdict` | string | the claim's word for this kind (`PASS`, `FAIL`, `JUDGED`, `SEALED`, `PUBLISHED`, `RELEASED`, `OBJECTED`, `MEASURED`, …) | | `gate_class` | string, MAY be `""` | gate class of a mint | | `era` | string, MAY be `""` | era tag of the proof system that produced the claim (`v10`, `v11`, `v12`, …) | | `sha256` | string, MAY be `""` | hash of the artefact the claim is about | | `ident` | string, MAY be `""` | 16-hex hash of the identity that acted (never the identity) | | `extra` | object, OPTIONAL | kind-specific fields; present only when non-empty | | `backfilled_from` | string, OPTIONAL | `registry` or `attempts_ledger` for the first-boot backfill (2026-10-20); absent otherwise | | `index` | integer | position in the log, from 0 — NOT part of the hashed bytes | | `leaf_hash` | hex string (64) | §4 — NOT part of the hashed bytes | **Era tag.** The field `era` MUST be present on every leaf. A reader MUST treat `""` as "era not declared" and MUST NOT infer one. A writer SHOULD set a non-empty `era` on every leaf it writes. (Divergence A.1: the reference writer defaults `era` to `""` for every kind except mint/preview.) ### 3.2 KINDS (41 in era one) `mint, preview, revocation, attestation, bounty, note, check, register, forward, fills, work, link, unlink, requirement, forecast, probe, mandate, actions, authority, outcome, eval, check_interval, group_snapshot, commit, release, pricing_function, dispute_opened, dispute_resolved, reliance, spending_mandate, behaviour, record_opened, record_rollup, record_note, venue_attestation, gate, objection, reply, resolution, facts, admit`. - `facts` — one committed measurement of a subject (§10.1); written by the gate surface module. - `admit` — one admission of a subject to the record under a stated rule (§10c); written by the admission module. Counting note: `python3.13 -c "import vlog, gate_first; len(vlog.KINDS)"` run from the repository on 2026-11-13 returned **40** (`facts` appended by api/gate_first.py at import; `admit` not yet registered at count time). `admit` is the 41st and is registered by the admission module (§10c). A kind is added by appending to the tuple, never by renaming; each kind is written by exactly one module. Readers MUST accept unknown kinds (forward compatibility) and MUST NOT reinterpret a known one. ### 3.3 Denominator first, outcome later A leaf is a committed claim at the moment it is made (a check served, a rule judged, a hold released, a record opened, a measurement taken). An outcome is a LATER leaf that cites the earlier one (`outcome`, `resolution`, `dispute_resolved`, `revocation`, `record_note`); the earlier leaf MUST NOT be edited. The `check_interval` leaf (hourly) seals the ids of checks served in the previous hour; a check id cited later MUST be inside one. --- ## 4. Leaf hash (RFC 6962 §2.1) ``` leaf_bytes = canonical(leaf without "index" and "leaf_hash") # §2.1 leaf_hash = SHA-256( 0x00 || leaf_bytes ) ``` `leaf_hash` is stored on the record for convenience; a verifier MUST recompute it and MUST reject a record whose stored `leaf_hash` or `index` disagrees (audit field `bad_leaves`). Vectors: `leaves[]`. --- ## 5. Merkle tree (RFC 6962 §2.1, SHA-256) ``` node_hash(l, r) = SHA-256( 0x01 || l || r ) root([]) = SHA-256( "" ) = e3b0c442…b855 root([h]) = h root(h[0..n)) = node_hash( root(h[0..k)), root(h[k..n)) ), k = largest power of two with k < n ``` Vectors: `roots` (sizes 0..7), `empty_root`. --- ## 6. The head ### 6.1 Signed fields (the only bytes any head signature is over) ``` core = {"size": , "root": , "ts": , "alg": "sha256/RFC6962", "log": "mizan-verdict-log-v1"} head_bytes = canonical(core) # §2.1 — keys sort to alg, log, root, size, ts ``` `ts` is the time the head was signed (the time of the append, or of a read that found no stored head for the current size). A head MUST be written to `data/verdict_log_heads.jsonl` on every append; `GET /api/log/head` MUST return the last stored head when its (size, root) match the log, else sign and store a fresh one. The stored line is `core + signature` only (§6.2): the set and time (§6.3, §6.4) are served, never stored, so no stored head is rewritten. ### 6.2 Legacy signature field (unchanged forever) ``` "signature": {"key_id": , "alg": "Ed25519", "sig_b64": , "canonical_sha256": , "public_key": "https://studio.mizan.market/.well-known/mizan-keys.json"} sig = Ed25519.sign(operator_private_key, head_bytes) ``` Every verifier (browser `headSig`, SDK `verify_leaf_proof`, `tools/witness.py` step 1, `tools/anchor_vlog.py` stamping `{size, root, ts, alg, log, signature}`) checks exactly this. It MUST stay byte for byte. ### 6.3 Signature SET (`mizan-head-set/1`) ``` "signatures": [ {"key_id": <16 hex>, "alg": "Ed25519", "sig_b64": , "signer": "operator" | "witness", "origin"?: }, ... ] "signatures_rule": {"v": "mizan-head-set/1", "over": "canonical({size, root, ts, alg, log}), the same bytes as `signature`", "quorum": , "keys": {"operator": "/.well-known/mizan-keys.json", "witness": "/key.json"}} ``` - Every entry MUST sign **the same `head_bytes`** (§6.1). The set always holds the operator's signature (identical to §6.2). - A witness entry is merged only when the server flag `MIZAN_HEAD_SET_WITNESSES=1` and the witness's published `heads/latest.json` is for this exact (size, root) with a valid `head_set_signature` (§14). Default: off (n = 1). - `origin` is informational (where the witness publishes its key); verification MUST use only `key_id` and the key table. **Verify rule.** Let Q be the verifier's quorum (`MIZAN_HEAD_QUORUM`; default 1). Build a key table `key_id → raw public key` from the operator key set (§13.1) and any witness key documents the verifier chooses to trust. The head verifies iff at least Q **distinct** `key_id`s in the set have an Ed25519 signature that verifies over `head_bytes`. A head with no `signatures` (an old head) MUST be read as a set of one: its `signature` field. The same key listed twice counts once; an entry whose key is not published or whose signature fails MUST be ignored and SHOULD be reported. Reference implementations: `api/headset.verify_head`, `tools/witness.verify_head_set`, browser `headSigSet()`. Vectors: `heads.cases[]` (8). **Quorum rule.** Once three distinct signers exist (operator plus two witnesses whose keys the operator does not hold), a verifier SHOULD require Q = 2. Before that, Q = 1 is the only quorum that can be met. (Divergence A.2.) A separate, flag-gated (`MIZAN_HEAD_COSIGN_SERVE`, default off) internal three-signer mechanism (`api/head_cosign.py`) adds `cosignatures / cosigners / quorum` fields over DIFFERENT bytes (`b"mizan-head-cosig/1\n" + canonical({v, log, size, root, signer_id, ts})`); it is not part of the set, all three keys are held by the operator, and it is out of scope of this specification unless served. ### 6.4 Time object ``` "time": {"final": , "outside": [ {"source": "freetsa.org" | "DigiCert" | "ots", "kind": "rfc3161" | "block-attestation", "token_ref": "/api/log/anchor//head-.json.tsr" | ".tsr2" | ".ots", "utc": | null, "block"?: , "checkpoint_size": } ], "covering_checkpoint": {"size", "root", "exact": , "stamp_utc"} | null, "latest_checkpoint": {"size", "root", "stamp_utc", "block"} | null, "head": {"size", "root"}, "rule": , "words": } ``` The `source` strings are protocol constants naming the three outside clocks (the first RFC 3161 authority, the second RFC 3161 authority, the block attestation). `final` is defined in §15.3. A head above the latest checkpoint is signed but **not final**; readers MUST show it so. ### 6.5 Other served fields (unsigned, informational) `anchor` (latest checkpoint summary), `counts` (`by_kind`, `verdicts`, `size`), `clock` (§15.1), `algorithms` (`{hash: "sha-256", merkle: "rfc6962 (leaf 0x00, node 0x01)", sig: "ed25519", canon: "…(mizan-canon/1)", head_signed_fields: [size, root, ts, alg, log]}`), `provenance` (added by the response middleware to every JSON reply; its own signature is over the whole body minus itself — §13.2). None of these are signed as part of the head and a verifier MUST ignore them when rebuilding `head_bytes`. --- ## 7. Inclusion proof (RFC 6962 §2.1.1) `GET /api/log/proof/` → `{index, size, leaf, leaf_hash, path[], root, head, verify}`. `path` = sibling hashes from the leaf up, computed as: split at k (largest power of two < n); if `index < k`, proof of the left subtree plus `root(right)`, else proof of the right subtree (index − k) plus `root(left)`. Verify (`vlog.verify_inclusion`, browser `fold`): ``` fn = index; sn = size - 1; r = leaf_hash for p in path: if sn == 0: FAIL if (fn & 1) or fn == sn: r = node_hash(p, r); while fn != 0 and not (fn & 1): fn >>= 1; sn >>= 1 else: r = node_hash(r, p) fn >>= 1; sn >>= 1 OK iff sn == 0 and r == root ``` The verifier MUST then check `root == head.root`, `size == head.size`, and the head (§6.3). Vectors: `inclusion[]` (19). --- ## 8. Consistency proof (RFC 6962 §2.1.2 / RFC 9162 §2.1.4) `GET /api/log/consistency?old=m&new=n` → `{old_size, new_size, old_root, new_root, proof[]}`. The generator **omits `old_root`** from the proof when `m` is a power of two (and `m ≠ n`); the verifier MUST prepend it: ``` if m == n: OK iff old_root == new_root and proof == [] if m == 0 or m > n: FAIL p = proof; if m is a power of two: p = [old_root] + p fn = m - 1; sn = n - 1; while fn & 1: fn >>= 1; sn >>= 1 fr = sr = p[0] for c in p[1:]: if sn == 0: FAIL if (fn & 1) or fn == sn: fr = node_hash(c, fr); sr = node_hash(c, sr); while fn != 0 and not (fn & 1): fn >>= 1; sn >>= 1 else: sr = node_hash(sr, c) fn >>= 1; sn >>= 1 OK iff fr == old_root and sr == new_root and sn == 0 ``` A witness that signed size m MUST verify consistency to size n before signing n (append-only). Vectors: `consistency[]` (11). --- ## 9. Verdict token `mzv1` (`typ = "mizan.verdict/1"`) ``` token = "mzv1." + b64url(claims_bytes) + "." + b64url(sig) claims_bytes = canonical(claims) # §2.1; strings, integers, booleans, null, objects only — never floats signing_input = ASCII bytes of ("mzv1." + b64url(claims_bytes)) sig = Ed25519.sign(operator_private_key, signing_input) b64url = RFC 4648 §5, no padding ``` Claims (as issued): `typ`, `iss: "mizan"`, `kid` (§13), `decision: ALLOW | REFUSE`, `subject`, `grade?`, `reason?`, `rule` (rule hash, §11) when the rule has one, `rule_id`, `bound_to?`, `iat`, `exp` (unix seconds), `head` (root hex read at issue), `ledger_size`, `identity` (compact know-your-agent block), `related_party?`, `mandate?`, `risk?`, `venue_attested?`, `standing` (`{first_seen_utc, days_on_record, leaves, attempts, bars_met, cited_by}`, each `null` when unknown, never 0), `jti` (`"vd_" + sha256(canonical(claims without jti) || request_id)[:24]`). `bound_to`, when present, is `{"payee": , "rule": , "amount"?: }`. It is present when the request carried a payee, an amount, a payer or a nonce. Verify (offline): prefix is `mzv1`; `claims.kid` is in the key set and not retired (a retired key MAY verify a token issued before `retired_utc`); signature over `signing_input`; `typ == "mizan.verdict/1"`; `exp > now`; and, when the verifier knows them, `bound_to.payee` / `bound_to.amount` / `rule` MUST match what it is about to do. The decision shown beside a token MUST equal `claims.decision`. **Binding rule.** A yes SHOULD be bound to payer, amount, nonce, rule and ending; in era one the token binds payee, amount and rule (Divergence A.5: payer, nonce and ending are accepted on the request but are not carried in `bound_to`). Vectors: `mzv1` (valid, tampered, expiry). --- ## 10. Fact claim token `mzf1` and the facts leaf (`v = 1`) ### 10.1 Token ``` token = "mzf1." + b64url(claims_bytes) + "." + b64url(sig) claims_bytes = canonical(claims) # §2.1 signing_input = ASCII bytes of ("mzf1." + b64url(claims_bytes)) sig = Ed25519.sign(measurer's response-signature key, signing_input) CORE_KEYS = ("v", "subject", "measurer", "checker", "self_count", "keeper_only", "kind", "listed_by", "facts", "ts") EXCLUDED_KEYS = ("claims_sha256", "leaf", "leaf_hash", "kid", "exp") core = {k: claims[k] for k in CORE_KEYS} claims = core + {claims_sha256, leaf, leaf_hash, kid, exp} # key set MUST be exactly CORE_KEYS ∪ EXCLUDED_KEYS claims_sha256 = SHA-256( canonical(core) ) # the committed part; never contains itself ``` - `v` MUST be the integer 1. - `subject`, `measurer`, `checker`: 16-hex hashes, `sha256(text)[:16]` — three keys, never conflated, never names. `self_count` (boolean): the measurer is also the subject. `keeper_only` (boolean): the measurer is the record's keeper (nobody outside measures yet). Both MUST be present on every claim. - `kind`: `"agent"` | `"strategy"`. `listed_by`: `"operator"` (the operator lists its own registry record) | `"self"` (the key claimed itself with a `link` leaf). - `facts`: an object with exactly the sixteen FACTS_KEYS, flat, snake_case: `rung, sharpe, max_drawdown_pct, record_days, trades, forward_days, allow_default, delivered_pct, orders, jobs, settled_jobs_90d, settled_pct_90d, open_jobs, disputes, n_life, claimed`. Each MUST be read from the same source the server's settlement reads; `null` = unknown, never 0. A rule clause that needs a null fact MUST be judged not met (`why: unknown:`), per the evaluator contract (§10.4). - `ts`: the measurement time, a UTC string `YYYY-MM-DDTHH:MM:SSZ`; it equals the facts leaf's `extra.measured_utc` (§10.2). `ts` is INSIDE the core. - `exp`: a UTC string `YYYY-MM-DDTHH:MM:SSZ` (not unix seconds), issue time + 24 h. `exp` is OUTSIDE the core. - `leaf` (integer, or `null` when unbound), `leaf_hash` (hex64, or `null`): the facts leaf the claim is bound to (§10.2). - `kid`: §13. In era one the measurer's key is the operator's response-signature key, the same key that signs `mzv1` (Divergence A.6). **Canonicalisation statement.** `claims_sha256` is over `canonical(core)` per §2.1: JSON, keys sorted at every level, separators `,` `:` (no spaces), `ensure_ascii=false`, hashed as UTF-8; floats in `facts` as shortest round-trip repr (JavaScript `Number#toString` agrees for these magnitudes). CORE_KEYS order is irrelevant (§2.1 sorts). `claims_sha256` is never inside the hashed core. ### 10.2 The facts leaf An `mzf1` token alone is a signed statement the log does not commit to. Every fact claim MUST bind to a leaf: ``` facts leaf = {"kind": "facts", "subject": , "verdict": "MEASURED", "ident": sha256(subject)[:16], "extra": {"claims_sha256", "facts": , "measurer", "checker", "self_count", "keeper_only", "kind", "listed_by", "measured_utc"}} ``` - **One leaf per measurement.** The first time a subject's core (compared without `ts`) changes, ONE `facts` leaf MUST be appended; while unchanged the existing leaf MUST be re-used and the claim's `ts` is that leaf's `measured_utc`. The same `(subject, claims_sha256)` MUST NOT be written twice by a conforming writer. Never a name in `extra`. - **Rebuildable.** The core MUST be rebuildable from the leaf alone: `{v: 1, subject: sha256(leaf.subject)[:16], measurer, checker, self_count, keeper_only, kind, listed_by, facts: extra.facts null-filled to FACTS_KEYS, ts: extra.measured_utc}`; its `sha256(canonical(·))` MUST equal `extra.claims_sha256` and `claims.claims_sha256`, and `claims.ts` MUST equal `extra.measured_utc`. - **Pointer rule.** `claims.leaf` MUST be the FIRST facts leaf (lowest index) on the log for `(subject, claims_sha256)`, never a later twin. Twins already on the log (35 written in a concurrent-build race on 2026-11-12) are never pointed to. A verifier that scans the log MUST apply the same rule. - **Budget (operational, not format).** At most `MIZAN_FACTS_LEAF_BUDGET` (60) new facts leaves per hour. A row whose leaf could not be written MUST be served `bound: false, proof: null, state: "not yet written down"` and MUST be painted hollow; it MUST NOT be shown as bound. Rows for unclaimed or test keys are not shown and never get a leaf. - **Deferred measurement.** A budget-deferred measurement is still a committed claim: when its leaf is written, that leaf SHOULD carry the ORIGINAL measurement time as `measured_utc`, so the record's "when" is the measurement, not the write. (Divergence A.10.) - **Supersession.** A claim verifies as written at its leaf. Whether it is the newest measurement is answered by the log, `GET /api/log/facts/{subject}` → `{subject_hash, newest: {index, claims_sha256, measured_utc} | null, first_for_newest}`, never by the token. Rows carry `latest` (true when the row's commitment was the newest at build time). - The row's inline `proof` MUST be the inclusion proof of THAT facts leaf (`proof.index == claims.leaf`), never a registration or another writer's leaf. ### 10.3 Verification (every verifier, the browser included) 1. Prefix `mzf1`; `kid` published (§13.1); Ed25519 over `signing_input`. 2. `v == 1`; `facts` key set == FACTS_KEYS; claims key set == CORE_KEYS ∪ EXCLUDED_KEYS; `exp` in the future. 3. `claims_sha256 == sha256(canonical(core))` with `core = claims minus EXCLUDED_KEYS`. A claim re-signed with a changed core but a stale `claims_sha256` MUST fail (vector `stale_core_hash_token`). 4. `proof.leaf.kind == "facts"`; `proof.leaf.extra.claims_sha256 == claims.claims_sha256`; `sha256(proof.leaf.subject)[:16] == claims.subject`. 5. Rebuild the core from `proof.leaf.extra` (§10.2); `sha256(canonical(rebuilt)) == claims.claims_sha256` and `rebuilt.ts == claims.ts == leaf.extra.measured_utc`. 6. `proof.index == claims.leaf`; `proof.leaf_hash == claims.leaf_hash == sha256(0x00 || canonical(leaf without index/leaf_hash))`; `claims.leaf` is the first facts leaf for this `claims_sha256` (pointer rule). 7. Fold `proof.path` (§7) to `proof.root`; `proof.root == head.root`; the head verifies (§6.3). When the bundled head is behind the live head (the reply is cached 5 s), chain `GET /api/log/consistency?old=&new=` (§8). A row that fails any step MUST paint no mark; a row with `bound: false` paints hollow. A rule MUST be evaluated against signed facts in the verifier, never against a server answer field. (Divergence A.11: the server-side helper `verify_fact_claim` does not itself enforce step 2's expiry check; the contract and this specification require it.) Vectors: `mzf1` (valid / tampered claims / stale core hash; `facts_keys`, `core_keys`, `excluded_keys`). ### 10.4 Evaluator contract (`mizan-gate-evaluator/v1`, `GET /api/gate/evaluator.json`) The published evaluator contract carries `facts_keys`, the fact-claim shape, the rule body grammar, clause semantics, the result shape and the `binding` block whose seven verify steps are the steps of §10.3. Its sha256 is served as `EVALUATOR_HASH` in the head bundle of `GET /api/gate/first`. Where this specification and the contract text differ, this specification governs; they do not differ at the freeze date. ## 10c. Admission leaf (admit) The admission leaf governs WHO may write; the record it enters is unchanged. The vectors file hash is pinned in the sibling file named in §18. ### 10c.1 The write rule (lock §1.6 "toll only at release") Nothing enters the record without being admitted. Admission is itself a leaf. It has a term. Renewal is a new leaf. A lapse is COMPUTED from the term on the governing leaf and is never written. Reading and checking stay free: no GET, no proof, no verify, no `/api/check` is ever gated by admission. Admission says WHO may write; it says nothing about price. This format carries no amount, no currency and no name, and MUST NOT be extended with one. Pricing, when it exists, lives in its own place; the admit leaf carries at most `payment_sha256`, an opaque 64-hex commitment to a payment record held elsewhere (or `null`). ### 10c.2 The leaf (`kind = "admit"`, format `v = "mizan-admit/1"`, FROZEN) Stored record (one line of `data/verdict_log.jsonl`, hashed and tree-folded like every other leaf, §3–§5 of this specification): | field | value | |---|---| | `kind` | `"admit"` (registered additively in api/vlog.py KINDS) | | `subject` | the writer's `key_id` (§C) | | `verdict` | `"ADMITTED"` on the key's FIRST admit leaf; `"RENEWED"` on every later one | | `ident` | `sha256(key_id)[:16]` (lower hex) | | `gate_class`, `era`, `sha256` | `""` | | `extra` | the object below, exactly these eight keys, no others | ``` extra = { "v": "mizan-admit/1", "key_id": , "term_start": , "term_end": , MUST be > term_start "self": true | false, true = one of MIZAN's own keys admitting itself (§F) "payment_sha256": <64 lower hex> | null, "prev": | null, "counter_sig": {"key_id": , "alg": "Ed25519", "sig_b64": } } ``` A leaf with any other key in `extra` (a `name`, an `amount`, a `currency`, a `price`…) is NOT an admit leaf of this format (vector "name field is not in the format"; `admit.check_format()` returns the offending key). ### 10c.3 key_id form (the canonical writer identifier in this codebase) Accepted shape: `^(ag_)?[0-9a-f]{16}$`. Matching is exact on the string. * an agent / operator key: its **agent id** `"ag_" + sha256("mizan-agent:" + user_id)[:16]` (api/agents_registry.agent_id_for) — the id `/api/me` returns, the id leaves carry as a subject, the id MIZAN's own measurer uses (`ag_124a4209266c5c3c`). At the write endpoints the server derives it from the request's bearer key / session (product._current_user → agent_id_for); the writer never states it. * a head key: the bare 16-hex `sha256(raw Ed25519 public key)[:16]` as published at `/.well-known/mizan-keys.json` (api/provenance; live head key `2266fb495f83b0a0`). ### 10c.4 Canonical signature bytes (counter_sig) `counter_sig.sig_b64` is an Ed25519 signature by MIZAN's head key (the same key that signs tree heads; its `key_id` is in `/.well-known/mizan-keys.json`) over ``` canonical({"v", "key_id", "term_start", "term_end", "payment_sha256", "prev"}) ``` taken from the leaf's `extra`, in the record canonical form `mizan-canon/1` (§2.1 of this specification: JSON, sorted keys, separators `(",", ":")`, `ensure_ascii=False`, UTF-8). `self` and `counter_sig` itself are NOT signed fields. Vector: `admit.signed_bytes_utf8_hex`. A verifier MUST reject a leaf whose signature does not verify under a published head key (vector "bad counter-signature (wrong key)"). ### 10c.5 The admitted() rule, renewal, lapse ``` admitted(key_id, at) = the admit leaf L for key_id (subject == key_id) with the HIGHEST index such that term_start(L) <= at < term_end(L); None when no leaf covers `at`. ``` * A leaf that fails the format check (§10c.2) or whose counter-signature does not verify (§10c.4) MUST be ignored by `admitted()`; it stays on the log (append-only) and admits nothing. * `term_start` inclusive, `term_end` exclusive (vector "term_end exclusive"). * Computed from the log on every call; nothing is stored, no state table exists. * **Renewal** = a new leaf: `verdict = "RENEWED"`, `prev` = the index of the key's previous admit leaf (any verdict), its own term. A later leaf governs when it covers `at`; an earlier leaf is never edited (append-only). The chain for a key is the ordered list of its admit leaves (`GET /api/admit/{key_id}.history`). * **Lapse** = `admitted(key_id, now) is None` while the key has at least one admit leaf. A lapse is a computed reading of the terms; there is no "lapsed" leaf and there MUST NOT be one. A lapsed key is readmitted by a new (RENEWED) leaf. * Default term: env `MIZAN_ADMIT_TERM_DAYS` (default 365). `renew_after` served by the API = `term_end − 30 days` (informational). ### 10c.6 The self flag `self: true` marks one of MIZAN's own operator / head keys admitting itself. It is a visible self-count: `GET /api/admit` serves `admitted_count`, `self_count` and `outside_count` separately, and no reader is ever shown a total that folds self-admissions in silently. Written only by the operator CLI (`python3.13 api/admit.py --self `), one leaf per key, counter-signed by the head key like every other admit leaf. Outside keys are NEVER written with `self: true`. Live self-admissions written 2026-11-13 (one leaf each): head key `2266fb495f83b0a0`, measurer/operator key `ag_124a4209266c5c3c` (indices in the CEO log entry of the day). ### 10c.7 Scope of enforcement (env `MIZAN_ADMIT_SCOPE`) | scope | gated writes (method path) | note | |---|---|---| | `release` (default) | `POST /api/release` | lock §1.6: the toll (and so admission) binds only at release | | `write` | `POST /api/release`, `POST /api/requirements` (the app's seal path — what `gatePublish` posts to), `POST /api/gate/compile` | every write | | `off` | nothing | | Refusal: `403 {ok:false, why:"key not admitted to write", admit:"/api/admit/", rule, scope}`. A request carrying no key keeps the handler's own `401` (admission never masks authentication) — except `POST /api/gate/compile` under scope `write`, which has no key of its own and is refused `403` with `admit:"/api/admit/"`. MIZAN's own keys pass because they are self-admitted (§F), not because they are special-cased: the middleware runs the same `admitted()` for every key. ### 10c.8 Endpoints (reads free) * `GET /api/admit` → `{rule, enforce_scope, gated:[...], term_days, admitted_count, self_count, outside_count, format, register}` * `GET /api/admit/{key_id}` → `{key_id, admitted, leaf|null, term_end, renew_after, history:[indices], lapsed, rule}` * `POST /api/admit/register {key_id, payment_sha256}` → `409 {ok:false, why:"admission opens with the price list", format, rule}` until a price list exists. No fee is stated or invented here; no outside key is admitted for free. ### 10c.9 Vectors (`spec/vectors_v1.json["admit"]`, test keys only) Writer `ag_` + sha256("mizan-agent:vector-writer")[:16] for the valid, expired, term_end-exclusive, bad-signature and `name` cases; a second writer `ag_` + sha256("mizan-agent:vector-writer-self")[:16] for the self-admission case, so that case is the key's FIRST leaf (`ADMITTED`, `prev` null). Counter-signer = the vectors' operator test key (seed 0x01…); the "bad signature" case is signed with the witness test key (seed 0x02…). Cases: valid / expired term / term_end exclusive / bad counter-sig / self admission (payment null) / `name` field not in the format. Each case states `expect_format_ok`, `expect_sig`, `expect_covers` at a stated `now`, and the leaf's `leaf_hash` recomputes by §4 of this specification. --- ## 11. Rule canonical form and grammar hash - The compiler (`requirements.compile_text`) MUST be deterministic and public; it returns a wrapper whose `requirement` is the compiled object `{all_of[], any_of[], name, not_understood[]}` (each clause `{profile, bar{…}, min_rung}`). - `rule.formal = canonical_rule(requirement)` (§2.2); `rule.hash = SHA-256(formal)`; `name` (the words, cut at 120) is part of the hashed object, so the same bars under two names have two hashes (`NAME_RULE`). `HASH_RULE` and `NAME_RULE` texts travel with every compile. - `grammar_hash = SHA-256(canonical_rule({grammar: "mizan-rule-grammar/v1", rules: [[profile, pattern, handler]…] in table order, readback: sorted keys, synonyms, profile_hints, endings: ENDING_PATTERNS, hash_rule, name_rule}))`. It is the compiler's rule table as a version string. A party holding (text, grammar_hash) can tell whether recompiling today reproduces the same rule. Endings (yes / no after N days / silence after N days) are clauses of the same grammar. - **Grammar hash in the leaf.** Every `gate` leaf MUST carry `extra.grammar_hash`. Every other rule-bearing leaf SHOULD carry it. (Divergence A.4: a `requirement` leaf carries `extra = {hash, visibility, cites?, cites_hashes?}` and no `grammar_hash`; its subject is `@`.) Vectors: `rule` (object, canonical, sha256). --- ## 12. Label grammar (`mizan-gate-labels/v1`, `GET /api/gate/labels.json`) Inputs: `kind`, `days_on_record`, `leaves`, `proven`. A label MUST be shown only when `leaves` is an integer ≥ 1 (a record with no entry has no label and is not shown). Templates: `strategy` → "a trading strategy"; `strategy_unproven` → "a trading strategy"; `agent` → "an agent". Composition: `"{template}, {span}"`; for a strategy whose signed facts carry `rung NONE` (`proven` false) → `"{template}, {span}, not proven"`, or `"{template}, not proven"` when `days_on_record` is not an integer; for any other kind with a non-integer `days_on_record` → the template alone. Span: `days ≥ 30` → "{n} month{s} measured" with n = days // 30; `days ≥ 1` → "{n} day{s} measured"; else "first day measured"; `{s}` = "s" iff n ≠ 1. A label MUST NEVER contain a name, a number the record does not carry, or a hand-written word. `label_for` in api/gate_first.py is the only producer; `gate._label` reads this table only. --- ## 13. Key publication ### 13.1 Operator key set — `GET /.well-known/mizan-keys.json` ``` {"issuer": "MIZAN", "keys": [{"key_id": , "alg": "Ed25519", "use": "response-signature", "public_key_b64": , "format": "raw 32-byte Ed25519"}, ...passport keys, ...retired keys], "signed_over": …, "verify": …, "scope": …, "rotation": "A rotated key is appended here; old key_ids stay listed with a retired_utc.", "ceremony": {"policy", "successor_pubkey_sha256": , "rule", "emergency", "doc"}} ``` Key id rule: `key_id = SHA-256(raw public key)[:16]` — the same rule for witness keys. Rotation: the successor's raw public key MUST sha256 to the pre-published `successor_pubkey_sha256`; a compromised key MUST be revoked by a signed statement from the successor plus a leaf in the log. A retired key stays listed with `retired_utc`. In era one one key signs heads, `mzv1`, `mzf1` and response provenance (Divergence A.6: measurer keys SHOULD be distinct from the head key). ### 13.2 Response provenance (every JSON reply) `provenance.signature` = Ed25519 over `canonical(body with provenance.signature removed)`; verifiers of heads and tokens MUST NOT confuse it with §6.2 / §9. ### 13.3 Witness key document (`/key.json`, `mizan-witness-key/1`) `{v, witness_key_id, alg: "Ed25519", public_key_b64, format, log, operators_distinct: false | true, operator, operator_statement: "operator.txt", operator_statement_sha256, heads: "heads/latest.json", program}` and, for a distinct operator, `operator_identity{legal_name, lei | domain}`. A LISTED witness origin (`MIZAN_WITNESS_ORIGINS`) counts as a DISTINCT operator only when all three hold: it says so, it publishes a legal identity, and its key id is in the operator-checked list (`MIZAN_WITNESS_DISTINCT_KEY_IDS`). A REGISTERED mirror (§14.2) is distinct by computation, never by declaration. The witnesses reply MUST NOT say two operators while every listed witness has `operators_distinct: false`. --- ## 14. Witness head document and mirror registration ### 14.1 Witness head document (`/heads/.json`, `heads/latest.json`; `v = "mizan-witness-head/1"`) Written only after: (1) the record head verifies (§6.2 and §6.3 at the witness's quorum); (2) every leaf 0..size−1 is re-fetched, every `leaf_hash` and `index` recomputed, and the root folded with the witness's OWN code equals `head.root`; (3) when the witness signed an earlier size m, consistency m→size verified (§8). On any mismatch nothing MUST be written. ``` {"v": "mizan-witness-head/1", "signed": {"root", "size", "ts", "log", "head_sig_sha256": sha256(record signature.sig_b64 text), "witness_key_id", "operator_statement_sha256"}, "signature": {"alg": "Ed25519", "key_id", "sig_b64": Ed25519 over canonical(signed), "canonical_sha256", "public_key": "key.json (same directory)"}, "head_set_signature": {"key_id", "alg": "Ed25519", "sig_b64": Ed25519 over head_bytes (§6.1), "signer": "witness", "over": , "head": {size, root, ts, alg, log}}, "final": , "time": {final, outside[], words}, # read from the record (§6.4), never computed by the witness "about": {"witnessed_utc", "origin", "rederived_leaves", "consistency_from_previous", "operators_distinct", "operator", "how_to_check"}} ``` `GET /api/log/witnesses` reads each configured origin, verifies `signature` with `key.json` (and `witness_key_id == sha256(public_key_b64)[:16]`, `signed.log == log`), compares `signed.root` with the record's own prefix root at `signed.size`, verifies `head_set_signature` over the head bytes for the same (size, root), and reports `operators_distinct` per §13.3. Vectors: `witness_head`. A witness document MAY carry `head_set_signature`: a §6.3 set entry `{key_id, alg, sig_b64, signer: "witness"}` over the record head's bytes (§6.1). It carries no `head` field of its own: the head it signs is the record head whose `size` and `root` equal the document's `signed.size` and `signed.root`, and whose `ts` equals `signed.ts`. A verifier MUST check the entry against that head's bytes, not against the witness document. ### 14.2 Mirror registration — `POST /api/log/witnesses/register` The mirror program's documents are `heads/.json` with `v = "mizan-mirror-head/1"` (the seven signed fields flat, plus `public_key_b64`, `signature` and an optional `head_set_signature`) and `key.json` with `v = "mizan-mirror-key/1"`. A verifier MUST cross-check an in-body `public_key_b64` against the mirror's `key.json` and MUST NOT accept a key from the body alone. A runner of `tools/mirror.py` (or any program producing the same document) MAY post its signed head. The record MUST: require the seven `signed` fields plus `public_key_b64` and `signature`; require `log == "mizan-verdict-log-v1"`, a 64-hex `root`, a 16-hex `witness_key_id` equal to `sha256(public_key_b64 raw)[:16]`, a raw 32-byte key, `size > 0`; verify the Ed25519 `signature` over `canonical({root, size, ts, log, head_sig_sha256, witness_key_id, operator_statement_sha256})` with the key IN THE BODY; refuse (403) any key the operator holds (operator keys current, retired and passport; the operator's own witness keys; the keys of listed witnesses that are not distinct); refuse (409) a size the record has not reached or a root that differs from the record's prefix root at that size; accept an optional `head_set_signature` only when it verifies over `head_bytes` for the same (size, root). An accepted registration MUST be appended to `data/vlog_mirror_registrations.jsonl` — one line per `(key_id, size)`, never deleted, never rewritten; a second post for the same pair is refused (409). Registration writes no leaf. `operators_distinct: true` on a registered key is COMPUTED (the key is not one the operator holds), never declared. A root that was honestly re-derived and still differs is a split, and the runner SHOULD publish it. --- ### 14.3 Static copy of the record (`mizan-record-copy/1`) An operator or anyone else MAY serve a static copy of the whole record: a directory holding `head.json` (a served head, §6), `time.json` (the served time object, §6.4), `keys.json` (the operator key document, §13.1), `leaves.jsonl` (every stored leaf, one per line, exactly as served, in index order, `index` and `leaf_hash` included) and `manifest.json` `{v: "mizan-record-copy/1", written_utc, size, root, origin, copy, files: {: {sha256, bytes}}}`. A reader MUST re-derive the root from `leaves.jsonl` (§4–§5, number lexemes as found), compare it with `head.json`, verify the head's signature set against `keys.json`, and read finality from `time.json` by §15.3. A copy is not a witness: `copy: "operator"` marks a copy the operator holds, and nothing in a copy is counted as an outside key. A served `clock.latest_checkpoint` MAY also carry an `rfc3161` object `{tsa, time_utc}` beside `rfc3161_time_utc`; the two MUST agree. ## 15. Outside time ### 15.1 Checkpoints (`tools/anchor_vlog.py`) Hourly at about :05 UTC since 2026-10-27T19:15Z (daily 2026-10-20..27 before). For the current head at size S the stamper writes `data/vlog_anchors/head-S.json` = exactly `{size, root, ts, alg, log, signature}` (compact JSON) and obtains: `head-S.json.tsr` (RFC 3161, first authority, SHA-512 imprint), `head-S.json.tsr2` (RFC 3161, second authority, SHA-256 imprint, CA pinned by root fingerprint `552F7BDC…9988`), `head-S.json.ots` (OpenTimestamps; `pending` until a Bitcoin block confirms, then upgraded in place — the only file ever rewritten, and only by the calendar's own proof). The record `head-S.json.anchor.json` carries the TSA times, the OTS state/block, `head_size`, `head_root`, `stamped_utc`, `cadence`. Served: `/api/log/anchor//head-.json[.tsr|.tsr2|.ots]` (bytes, octet-stream), `/api/log/anchor/.json` (record), `/api/log/anchors`, `/api/log/time`, and `clock` on the head. **Stamp on change.** Beside the hourly run, `tools/anchor_vlog.py --on-change` runs every 60 s (launchd `com.mizan.vlog-stamp-on-change`, StartInterval 60) and stamps the current head — both RFC 3161 clocks + OTS submit, exactly as the hourly stamp — whenever the head has moved past the latest checkpoint and at least `ON_CHANGE_MIN_S` (300 s) have passed since the last stamp of any kind. It seals no interval and writes no leaf. The witness (`com.mizan.witness`, StartInterval 600) re-derives and signs the head every 10 min. A head therefore becomes final within ≤ 5 min of its last append and witnessed within ≤ 10 min. **Every head sealed in era one SHOULD receive an outside timestamp at or immediately after its append.** (Divergence A.3: the 300 s rate limit.) ### 15.2 Operative time of a leaf (`OPERATIVE_TIME_RULE`) The operative time of leaf i MUST be taken as the stamp of the first covering checkpoint: the first checkpoint whose size exceeds i. Where it carries two RFC 3161 tokens its stamp is the LATER genTime (one dishonest authority cannot move it earlier); its stronger time is the Bitcoin block confirming its `.ots`. Never the leaf's own `ts`. A leaf above the latest checkpoint has no operative time yet. ### 15.3 Final head (`time.final`) A head (size N, root R) is **final** iff a checkpoint C exists such that either - `C.size == N` and `C.root == R` (exact), or - `C.size > N` and the log's own prefix roots satisfy `root(leaves[0..N)) == R` and `root(leaves[0..C.size)) == C.root` (the head is a prefix of the checkpointed tree — the same fact a consistency proof N→C.size proves), and C carries at least one outside clock (an RFC 3161 token or a block attestation). `time.outside` MUST list every clock C carries. A head that is not final is still signed and still binding on the operator; it is not yet timed by anyone else. `GET /api/log/time` also serves the lag: `leaves_since_final` = head.size − size of the latest checkpoint whose root is this log's prefix root and that carries an outside clock; `seconds_since_final` = now − that checkpoint's stamp (later of its two RFC 3161 times); `last_final` = that checkpoint. Verifiers that need "when" MUST use the covering checkpoint's clocks, never `head.ts`. Vectors: `time.cases[]` (6). --- ## 16. Two rules that never change ### 16.1 Never rewritten The log is append-only. A leaf MUST NOT be edited or deleted; a correction, revocation, dispute, objection or outcome is a NEW leaf citing the old one. A head MUST NOT be re-signed over a different root at the same size. The only write that touches existing bytes is the quarantine of a TORN TAIL: an unterminated last line (a writer died mid-write) is moved to `verdict_log.jsonl.torn.` and the file truncated to its last newline before the next append — it was never a committed leaf and never in any head. The audit (`/api/log/audit`) recomputes every hash from the raw file and reports `bad_leaves`, `duplicate_indexes`, `torn_tail`, `memory_matches_file`, `head_matches`. ### 16.2 Under no names A leaf names subjects and identities by hash only. At the single write point the keys that would say WHO operated a measurement MUST be dropped from `extra` (`NEUTRAL_DROP = {measured_by, issuer, operator, issued_by, recorded_by, minting_identity, measured_by_name}`) — future leaves only; older leaves are not rewritten. `ident` and the `mzf1` `measurer`/`checker` hashes still bind the identity. Fact claims and verdicts carry hashes. A label (§12) is never a name. Any surface that needs "who" asks the API, which answers truthfully; the record itself does not say. --- ## 17. Verification procedure (what every verifier does; what the reference implementation passes in vectors) 1. **Keys.** Fetch `/.well-known/mizan-keys.json`; pin `key_id → public_key_b64` (and `successor_pubkey_sha256`). Optionally fetch each trusted witness's `key.json`. A verifier MUST NOT accept a key from the object being verified. 2. **Head.** Fetch `/api/log/head` (or take the `head` inside a proof). Rebuild `head_bytes` from the five fields (§6.1). Verify the set at your quorum (§6.3); an old head is a set of one. Record (size, root). 3. **Time.** Read `head.time` (or `/api/log/time`); treat `final: false` as "signed, not yet timed". For a leaf's operative time use §15.2. To check a clock yourself: `openssl ts -verify -data head-S.json -in head-S.json.tsr -CAfile -untrusted `; `... -in head-S.json.tsr2 -CAfile ` (OpenSSL 3; LibreSSL 3.3 cannot build the second chain); `ots verify head-S.json.ots`. 4. **Leaf.** Fetch `/api/log/proof/`. Strip `index`, `leaf_hash`; compute `leaf_hash` (§4); fold `path` (§7); compare to `head.root` with `size == head.size`. Reject on any mismatch. The leaf's `ts` is the writer's clock, not the operative time. 5. **Append-only.** Keep your last (size, root). Next time fetch `/api/log/consistency?old=m&new=n` and verify (§8) before trusting the new head. A failure is a fork: publish it. 6. **Extract (optional).** `/api/ledger/extract` returns `{extract: "mizan-ledger-extract-v1", log, generated_utc, …, leaf_hashes_sha256, signature}` plus `head`, `anchor`, `anchor_consistency` and `entries` (leaves with paths); verify each path to the extract root, the root to the head, and the extract `signature` (over `canonical(summary)`) with the operator key. 7. **Token.** For `mzv1` (§9) / `mzf1` (§10): split on `.`; decode claims; `kid` in the key set; Ed25519 over the ASCII `"."`; shape; expiry; binding (payee, amount, rule) against what you are about to do; and, for `mzf1`, the inclusion proof beside it (step 4) at the served head (step 2) per §10.3. 8. **Rule.** Hash the rule text's compiled form yourself (§11) and compare with `rule.hash` / `claims.rule`; keep `grammar_hash` with the text. 9. **Witness (optional).** Run `tools/witness.py --once` or `tools/mirror.py` against the public log; publish `key.json`, `operator.txt`, `heads/` on your origin, or register (§14.2); a `head_set_signature` is a set entry any verifier MAY count at quorum ≥ 2. Free, in code, forever: every step above runs with no account, no fee and no call to the operator beyond fetching public files; the SDKs (`sdk/python/mizan/client.py`, `sdk/ts/src/client.ts`) and the browser implement steps 1, 2, 4, 7 offline. --- ## 18. Conformance vectors The era-one vectors file is `mizan-proof/spec/vectors_v1.json`, generated by `tools/record_spec_vectors.py` with DETERMINISTIC TEST KEYS (Ed25519 seeds `01`×32 operator, `02`×32 witness; never the live key; byte-identical on every run). Vector families: `canonical_json`, `leaves`, `roots` (incl. `empty_root`), `inclusion` (incl. one expected failure), `consistency` (incl. power-of-two omission cases and one expected failure), `heads.cases` (legacy, set n=1, set n=2, unpublished witness key, tampered witness signature, quorum 2 on n=1, changed root), `witness_head`, `witness_key_doc`, `keys_doc`, `mzv1` (valid / tampered / expiry), `mzf1` (valid / tampered claims / stale core hash; `facts_keys`, `core_keys`, `excluded_keys`), `rule`, `time.cases`, and the `admit` family (§10c). **Hash pinning.** The sha256 of the vectors file is NOT written inside this document (the vectors are regenerated when the `admit` family lands). It MUST be pinned in the sibling file `MIZAN_RECORD_SPEC_era1.vectors.sha256`, which carries one line: ` vectors_v1.json`. That sibling file's hash is in turn recorded beside this document's own hash at the freeze. A verifier MUST check the vectors file against the pinned hash before trusting a pass. `tools/record_spec_check.py` runs the vectors in two separate processes: `--against api` (api/vlog, headset, verdict, gate_first, requirements) and `--against witness` (tools/witness.py's own re-derivation code plus standalone folds inside the checker). Neither process imports the other's logic. The vector file's sha256 is printed by the checker and MUST equal the pinned value. --- ## 19. Rules carried from the lock register Each item of the lock register has been checked against the implementation on 2026-11-13. Items the implementation meets are stated as normative rules in the body above; items it does not yet meet are stated as rules (SHOULD / MUST) in the body and their exact current behaviour is recorded in Appendix A. Summary: | # | Rule in this specification | Met by the implementation at freeze? | |---|---|---| | T1 | §3.1 era tag on every leaf | No — A.1 | | T2 | §6.3 quorum two-of-three once three signers exist | No (one signer exists) — A.2 | | T3 | §15.1 outside timestamp at or immediately after every append | No (≤ 5 min rate limit) — A.3 | | T4 | §11 grammar hash on every rule-bearing leaf | Partly (`gate` yes, `requirement` no) — A.4 | | T5 | §9 the yes bound to payer, amount, nonce, rule, ending | Partly (payee, amount, rule) — A.5 | | T6 | §13.1 measurer keys distinct from the head key | No — A.6 | | T7 | proof binds to its leaf in-circuit | Era-gated; not in era one — A.7 | | T8 | §2 one canonical form | No (two forms, both normative in era one) — A.8 | | T9 | §2.1 writers never rely on `default=str` | Rule stated; safety net still present — A.9 | | T10 | §10.2 deferred leaf keeps the original `measured_utc`; docstring aligned with CORE_KEYS | No / No — A.10 | | — | §10.3 step 2 expiry enforced by every verifier | Browser/contract yes; server helper no — A.11 | --- ## 20. Change control This document is FROZEN as era one. Its own sha256 and the sha256 of `MIZAN_RECORD_SPEC_era1.vectors.sha256` are computed and published by the operator after the `admit` section (§10c) is folded in; neither hash appears inside this file. - **Errata.** A correction to the TEXT of this document that changes no byte-level rule MUST be published as a dated appendix (`Appendix E-`) with its own sha256, never by editing the frozen body. An erratum MUST NOT change a canonical form, a hash input, a signature input, a field set, a token prefix or a verification step. - **New behaviour.** Any change to a byte-level rule, any new signed object, any change to KINDS other than appending, any change to the vectors other than adding families for behaviour already stated here, is era two: a new frozen document with a new identifier and its own vectors file. Era-one objects verify forever under this document. - **Divergence closure.** When the implementation comes to meet a rule in Appendix A, nothing in this document changes; the operator records the closure (date, commit) in a dated note beside the appendix. --- ## 21. Second implementation An independent verifier MUST be implementable from this text alone, without reading the operator's code. It MUST implement: 1. §2.1 canonical form (and §2.2 for rule hashes only). 2. §4 leaf hash; §5 Merkle root; §7 inclusion verify; §8 consistency verify including the power-of-two `old_root` prepend. 3. §6.1 head bytes; §6.2 legacy signature; §6.3 signature-set verify at a configurable quorum, including the set-of-one reading of an old head, distinct-key counting and unpublished-key rejection. 4. §13.1 key table from the operator key set (key id rule, retired keys) and §13.3 witness key documents. 5. §9 `mzv1` verify (prefix, kid, signature over the ASCII signing input, `typ`, expiry, binding). 6. §10 `mzf1` verify, all seven steps of §10.3, including the core rebuild from the leaf and the pointer rule. 7. §14.1 witness head verify (signature over `canonical(signed)`, `head_set_signature` over head bytes, prefix-root agreement). 8. §15.3 finality from checkpoint records (exact and prefix cases) and §15.2 operative time. 9. §11 rule hash and grammar hash recomputation; §12 label derivation. 10. §10c admission leaf verification as specified there. It MUST pass every vector family listed in §18 against the pinned vectors file, reporting pass/fail per vector, and it MUST fail the vectors marked as expected failures. It MUST NOT import or call the operator's implementation. The operator's own verifier is held to exactly the same vectors: `tools/record_spec_check.py` runs the reference API code and the witness code as two separate processes against the same file, and a release of either that fails any vector is non-conforming. A second implementation that disagrees with the reference on any vector is a defect in one of them to be resolved against THIS TEXT, not against the code. --- ## Appendix A. Era-one known divergences (exact behaviour at the freeze, 2026-11-13) Each entry records what the implementation does today where it does not yet meet a rule stated above. Nothing here weakens the rule; a verifier applies the rule, and these entries say what it will observe on the live record. - **A.1 Era tag.** `vlog.append(..., era: str = "")` stores `"era": era or ""`. Only mint/preview writers pass a value (`v5`/`v10`/`v11`/`v12`). Every other kind, including `facts`, is written with `era == ""`. On 2026-11-11, 4,283 of 4,394 leaves carried `""`. - **A.2 Quorum.** `api/headset.DEFAULT_QUORUM = 1`; `MIZAN_HEAD_QUORUM` is read from the environment, floor 1. One operator signer exists; witness merging into the set is behind `MIZAN_HEAD_SET_WITNESSES` (default `"0"`). The internal cosign mechanism (`api/head_cosign.py`) is behind `MIZAN_HEAD_COSIGN_SERVE` (default off), signs different bytes, and is operated entirely by the operator. - **A.3 Timestamp per append.** `tools/anchor_vlog.py --on-change` (`ON_CHANGE_MIN_S = 300`) stamps only when the head has moved past the latest checkpoint AND ≥ 300 s have passed since the last stamp of any kind; the hourly run stamps at about :05 UTC. A head is final within ≤ 5 min of its last append, not at the append. - **A.4 Grammar hash.** `gate` leaves carry `extra.grammar_hash`. `requirement` leaves (`requirements.publish`, `vlog.append_or_raise("requirement", f"{rid}@{ver}", "PUBLISHED", ...)`) carry `extra = {"hash": , "visibility": }` plus `cites` / `cites_hashes` when the body cites; no `grammar_hash`, no version field (the version is in the subject). - **A.5 Binding fields.** `verdict.py` builds `bound_to = {"payee": norm_payee(payee or subject), "rule": , "amount"?: }` when the request carries a payee, amount, payer or nonce. `payer` and `nonce` are accepted on the request and passed to the settle path but are NOT written into `bound_to`; no ending field exists in the token. - **A.6 One key.** `gate_first.sign_fact_claim` signs with `provenance.sign_bytes`, the operator's response-signature key, and `claims.kid = verdict.key_id()` — the same key that signs heads, `mzv1` and response provenance. The measurer and checker hashes on every claim are `sha256("ag_124a4209266c5c3c")[:16]` (the keeper identity); that identity has no `register` leaf on the log. - **A.7 In-circuit binding.** The proof system of era one (`v12`) does not bind a proof to its leaf in-circuit; this is the first act of the next proof era and is not specified here. - **A.8 Two canonical forms.** `requirements.canonical` uses `json.dumps(body, sort_keys=True, separators=(",", ":"))` (ASCII-escaped); everything else uses §2.1 (UTF-8). Both are normative in era one for their own objects. - **A.9 `default=str`.** `vlog.canonical` and `gate.canonical` keep `default=str`. No writer is known to depend on it; the rule in §2.1 forbids depending on it; the parameter is retained so that an unexpected value fails soft rather than aborting an append. - **A.10 Deferred measurement time; docstring.** `gate_first.facts_leaf` sets `core["ts"] = now` BEFORE the budget check; when the budget refuses, no leaf is written and nothing remembers that time. On a later build a fresh `core["ts"] = now` is taken, so a budget-deferred leaf carries the WRITE time as `measured_utc`, not the original measurement time (the token's `ts` equals the leaf's `measured_utc`, so the pair is internally consistent but later than the first measurement). The module docstring of api/gate_first.py still reads `core = claims minus {ts, leaf, leaf_hash, kid, exp}` and lists `extra {claims_sha256, measurer, checker, facts_keys (count …)}`; the code (`CORE_KEYS`, `EXCLUDED_KEYS`, `LEAF_EXTRA_KEYS`) and the evaluator contract match §10, and §10 is the authority. `core_claims`'s own docstring omits `listed_by` and `ts` from its listed core. - **A.11 Server helper and expiry.** `gate_first.verify_fact_claim` checks prefix, kid, signature, `v`, facts key set, claims key set and `claims_sha256`; it does not check `exp`. The evaluator contract step 2 and the browser evaluator require `exp` in the future; §10.3 requires it of every verifier. - **A.12 Twin facts leaves.** 35 twin `facts` leaves (same `(subject, claims_sha256)`) were written on 2026-11-12 by concurrent first builds before `_FL_LOCK` made lookup + append atomic. They remain on the log (never rewritten); the pointer rule (§10.2) makes them unreferenceable.