Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/tools/codebook/README.md # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / tools / codebook / README.md` 42 lines · 3158 bytes Raw Blame History Rendered 1 # tools/codebook: signed layered digit codebook (T-002 items 7-10) 2 3 Native OM-2 (`codebook.om`), built on the seeded SHA-256 core by `build.sh`, proved in Lean 4 4 (`proof/CodebookProof.lean`), tested by `test.sh`, mutation-checked by `mutate.sh`. 5 6 - **Wire.** A code is `(9xx)^k t`: k escape groups 900..999, then one terminal 000..899, every group 7 exactly 3 decimal digits (1 tokenizer token each). A message is codes concatenated with no separator. 8 Fixed width makes it prefix-free; 9xx escapes to the next layer, recursively. 9 - **Where.** Codes ride only in an inbox-line field `ocb2::::` (the last 10 `|` field of a 6-field line). A leftover `ocb1:` line is legacy and never verifies. A bot DM stays one bare trit. 11 - **Codebook.** `codebook.tsv`, append-only `codetypemeaning`; types `r45 inst sig emerg`; 12 `#` lines are comments. Its sha256 is the codebook id. 000-040 are the R45 ids, 041-099 reserved for 13 instruction ids, 1xx signals, 3xx emergencies (power OB/LB are 310/311), 9xx escapes. 14 - **MAC.** HMAC-SHA256(key, `ocb2|cbsha|counter|lane|ts|from|to|tag|text|ref|digits`), key from a file 15 path (mode must be `0600` with no group/other bits; the path must not contain a `boards/` 16 segment). Counter file `STATE/.ctr` is ` ` (strictly increasing counter, 17 and ts ≥ last ts), replaced atomically. `sign` stdin is 9 pipe fields 18 `lane|ts|from|to|tag|text|ref|counter|digits`; `verify` takes an optional lane (`n` or `e`). 19 - **Trit.** `verify` prints ` `; trit 2 only for `ok` with a 3xx code, otherwise 1 (including every `ocb1:` line). 20 21 ``` 22 sh tools/codebook/build.sh # build/codebook/codebook 23 printf '901.12 345\n' | build/codebook/codebook enc # `901012345` 24 printf '`901012345`\n' | build/codebook/codebook dec # 901.12 345 25 build/codebook/codebook sha tools/codebook/codebook.tsv 26 printf 'n|2026-11-15T12:00|omega-lead|a|task|do x|-|7|300\n' | build/codebook/codebook sign tools/codebook/codebook.tsv KEYFILE 27 build/codebook/codebook verify tools/codebook/codebook.tsv KEYFILE STATEDIR < inbox-lines 28 sh tools/codebook/test.sh ; sh tools/codebook/mutate.sh ; lean tools/codebook/proof/CodebookProof.lean 29 ``` 30 31 Round 4 (combined with tools/trit): `codebook.om` is the shared core and `main.om` the command line; 32 `tools/trit/build.sh` compiles the same `codebook.om` into trit. `codebook ext OLD NEW` exits 0 with 33 `ok ` when NEW is a valid codebook that starts with every byte of OLD, else `ERR notprefix` 34 (exit 6) or exit 4 when either file is invalid. `verify` holds `flock(LOCK_EX)` on `STATE/ctr.lock` for 35 the whole verify-and-advance pass and fsyncs STATE after each counter rename. 36 37 Mutation acceptance runs a passing unmutated baseline first. Compile failures, 38 unapplied mutations and test-runner errors never count as kills; a kill needs 39 exit 1 plus the runner's completed failing-assertion summary. Full logs and raw 40 runner exits are retained. A supplied existing mutation work directory is refused 41 without deleting it. `sh tools/codebook/test-mutate.sh` checks these driver 42 refusals with external test-runner stand-ins.