KB-59D6

Record Encoding Spec (recheck-6 blocker C)

6 min read Revision 1

04 - Record Encoding Spec (recheck-6 blocker C)

Load-bearing copy: doc 00 §Record encoding schema + the manifest roster + the closed key-classification schema. This doc is the complete per-record table so no human interpretation remains.

Universal record rules

Every digest input = domain_tag (one ASCII line ending LF) + records. Each record = its fields joined by a single TAB (0x09) + one LF (0x0A). Every field value passes the Field rejection policy (doc 02): no null (explicit token instead), no empty string, no TAB/LF/CR/NUL/backslash, no reserved token; paths are full canonical document_id. Records are emitted in the named sort order except the manifest, which is emitted in fixed roster order with sorted sub-records. UTF-8; CRLF/CR→LF before hashing; ends in exactly one trailing LF. SHA-256 lowercase hex (shasum -a 256 == python hashlib).

Per-record-type schema

record type domain tag fields (fixed order) allowed values (grammar) sort key NULL / empty
membership FIX7_ACTIVE_AUTHORITY_MEMBERSHIP_V1 document_id document_id document_id asc n/a (always present)
active document FIX7_ACTIVE_AUTHORITY_CORPUS_V1 document_id, doc_status, active_section_id_or_range, kb_revision, normalized_active_content_sha256 per doc 02 grammars; kb_revision allows SELF_HOST_PIN_BY_EXCLUDE_REGION_HASH; sha allows SEAL_AT_CODEX_RECHECK_7 until sealed document_id asc no null, no empty
marker FIX7_MARKER_FENCE_REGISTRY_V1 document_id, marker_kind, marker_literal marker_kind enum; marker_literal ^<!--.*-->$ (document_id, marker_kind, marker_literal) asc no null, no empty
superseded boundary FIX7_SUPERSEDED_BOUNDARY_V1 superseded_id, fence_range superseded_id=<document_id>#S<k>; fence_range=L<b>-L<e> (b<e) superseded_id asc no null, no empty
superseded whole-doc (inside manifest) SUPERSEDED_WHOLE_DOC, document_id literal + document_id document_id asc no null, no empty
guard set FIX7_GUARD_SET_V1 = normalized_active_content_sha256(doc 06); guard_set_revision = doc 06 kb_revision sha / revision n/a no null
envelope manifest FIX7_ACTIVE_AUTHORITY_ENVELOPE_MANIFEST_V1 the MANIFEST_BOUND roster (below) as manifest_key \t value scalars + sorted sub-records per-field grammar; fixed constants exact-match fixed roster order (sub-lists sorted) no null, no empty
detached seal FIX7_CODEX_DETACHED_SEAL_V1 seal fields (doc 06) as seal_key \t value, EXCL detached_seal_sha256 + signature per-field grammar fixed seal order no null, no empty

superseded_id ordinal k is the 1-based position of the SUPERSEDED region within the doc (ascending begin-line). fence_range lines are the extractor's 1-based normalized lines. This moves the old prose "fenced SUPERSEDED blocks inside 00 and 12" out of the whole-doc list and into byte-exact L-ranges.

Manifest = closed roster, fixed order

canonical_encoding_version; seal_version; blueprint_id; envelope_state; approved_status; approval_epoch; approved_by_role; approved_at_utc; parent_recheck_checkpoint_id; approved_by_recheck_checkpoint; next_required_recheck_on_change; digest_algorithm; full_document_hash_policy; active_corpus_membership_sha256; active_corpus_sha256; marker_fence_registry_sha256; superseded_boundary_sha256; guard_set_revision; guard_set_sha256; the per-active-doc tuples (sorted); the superseded_non_authority whole-doc list (sorted); then the single anchor flag detached_seal_anchor.any_change_requires_new_recheck. The manifest EXCLUDES itself (envelope_manifest_sha256), detached_seal_sha256, and the seal-layer checkpoint revision/content (acyclic — doc 05). Each scalar carries its manifest_key, so a reorder or a mis-keyed value is detectable.

Closed envelope key-classification schema (blocker B closed)

Every key at every nesting level is in exactly one class; unknown/extra/missing/wrong-class → fail closed (G-ENVELOPE-MANIFEST-AUTHORITY-COMPLETE + G-RECORD-ENCODING-CLOSED):

  • MANIFEST_BOUND — every roster field above.
  • SEAL_LAYER_READBACK_PROTECTEDenvelope_manifest_sha256; detached_seal_anchor.codex_checkpoint_id (== bound approved_by_recheck_checkpoint); detached_seal_anchor.codex_checkpoint_kb_revision (== live checkpoint revision via read-back); detached_seal_anchor.signature; detached_seal_anchor.detached_seal_sha256.
  • NON_AUTHORITY_DIAGNOSTIC — per-doc full_document_sha256; detached_seal_anchor.codex_checkpoint_content_sha256_excluding_seal; notes[].
  • STRUCTURAL_CONTRACT_PROSEdetached_seal_anchor.contract (declared non-authority).

This is what removes Codex's "authority-bearing field leaves semantic discretion to the verifier": every key is now bound, read-back-protected, or explicitly declared non-authority — no discretion.

Back to Knowledge Hub knowledge/dev/reports/architecture/t1-fix7-blueprint-patch-after-codex-recheck-6-byte-exact-envelope-2026-06-09/04-record-encoding-spec.md