code wiki / _hdl_build / nx_build_evidence_gate.nx

nx_build_evidence_gate.nx

buildroot/runtime/_hdl_build/nx_build_evidence_gate.nx

15236 B244 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind gate/prooftopic build
docsdependenciesstructsconstsfunctions

about

nx_build_evidence_gate.nx -- EVIDENCE-CORRELATED GENEALOGY + ORPHAN MAINTENANCE (operator 2026-06-22: "the genealogy needs to help flag and maintain orphans, and orphans need EVIDENCE like how there are social-security correlations in real life"). A lineage claim must be CORROBORATED by multiple independent signals that agree -- like an identity backed by SSN <-> birth-cert <-> name all matching -- not a bare asserted parent=. Per organ we gather 4 evidence signals: E1 EXISTS -- the organ file is real on disk E2 IMPORT-ROOTED -- all its imports resolve (rebuildable from god via the import DAG) E3 REGISTERED -- it has a build-registry record (its SSN-like identity) E4 ANCHORED -- its registry parent= traces to ORIGIN(god) in the genesis tree CORRELATION -> classify: GHOST(record but no file) / ANOMALY(registered yet NOT rebuildable = evidence contradiction = "identity fraud") / CORROBORATED(all agree) / UNREGISTERED(rebuildable but no ID) / FLOATING-ORPHAN(exists but can't rebuild) / WEAK. FLAGGED organs are written to a MAINTAINED watchlist (knowledge/registry/orphan_watchlist.log, refreshed each run) so orphans are tracked over time. GATE w/ NEG-CONTROL: the classifier is tested on synthetic evidence vectors (teeth); GREEN iff every REGISTERED organ's evidence CORRELATES (0 anomalies, 0 ghosts) AND the classifier discriminates. Sovereign: imports only nx_syscalls. license_tier: ORIGINAL expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_build_evidence_gate.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main ep sys_write sys_mmap eread sys_openat_rd sys_read sys_close sys_exit e_kv efind elen elen ↻ estreq sys_openat_wr sys_close ↻ sys_openat_append e_wwrite sys_write ↻ elen ↻ e_organ_path ejoin eexists sys_openat_rd ↻ sys_close ↻ e_import_rooted sys_mmap ↻ eread ↻ efind ↻ e_resolve sys_mmap ↻ ejoin ↻ eexists ↻ e_genhops sys_mmap ↻ e_genparent sys_mmap ↻ e_field estreq ↻ estreq ↻

structs

none

consts

19const GEN: *u8 = "knowledge/registry/genesis_lineage.tsv"
20const REG: *u8 = "knowledge/registry/build_registry.log"
21const WATCH: *u8 = "knowledge/registry/orphan_watchlist.log"
22const ODIR: *u8 = "runtime/_hdl_build"
23const FB: i64 = 262144
24const MAXO: i64 = 8192
25const SLOT: i64 = 160
27const C_GHOST: i64 = 0
28const C_ANOMALY: i64 = 1
29const C_FLOATING: i64 = 2
30const C_UNREG: i64 = 3
31const C_WEAK: i64 = 4
32const C_CORROB: i64 = 5

functions

34func ep(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 1: main calls 1: sys_write
35func elen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
36func epn(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
45func estreq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 }
46func eread(path: *u8, buf: *u8, cap: i64) -> i64
52func eexists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
53func ejoin(pfx: *u8, name: *u8, out: *u8) -> i64 { var o: i64 = 0; var i: i64 = 0; while pfx[i] != (0 as u8) { out[o] = pfx[i]; o = o + 1; i = i + 1 } i = 0; while name[i] != (0 as u8) { out[o] = name[i]; o = o + 1; i = i + 1 } out[o] = 0 as u8; return 0 }
54func efind(buf: *u8, from: i64, to: i64, pat: *u8) -> i64
called by 2: e_kve_import_rooted calls 1: elen
60func e_kv(buf: *u8, ls: i64, le: i64, key: *u8, out: *u8) -> i64
called by 1: main calls 2: efindelen
66func e_field(buf: *u8, ls: i64, le: i64, idx: i64, out: *u8) -> i64
called by 1: e_genparent
73func e_genparent(buf: *u8, n: i64, node: *u8, parent_out: *u8) -> i64
called by 1: e_genhops calls 3: sys_mmape_fieldestreq
83func e_genhops(buf: *u8, n: i64, node: *u8) -> i64
called by 1: main calls 3: sys_mmape_genparentestreq
95func e_resolve(name: *u8) -> i64
104func e_import_rooted(path: *u8) -> i64
called by 1: main calls 4: sys_mmapereadefinde_resolve
126func e_organ_path(name: *u8, out: *u8) -> i64
called by 1: main calls 2: ejoineexists
132func e_getdents(fd: i64, buf: *u8, count: i64) -> i64 { return __syscall(217, fd, buf, count, 0, 0, 0) }
called by 1: main
133func e_isorgan(name: *u8) -> i64
called by 1: main calls 1: elen
140func classify(e1: i64, e2: i64, e3: i64, e4: i64) -> i64
called by 1: main
148func class_str(c: i64) -> *u8
called by 1: main
156func e_wwrite(fd: i64, s: *u8) -> i64 { if fd >= 0 { sys_write(fd, s, elen(s)) } return 0 }
called by 1: main calls 2: sys_writeelen
157func e_wnum(fd: i64, v: i64) -> i64 { let t: *u8 = sys_mmap(28); var m: i64 = v; var k: i64 = 0; if m == 0 { t[0] = 48 as u8; k = 1 } else { while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 } } let o: *u8 = sys_mmap(28); var i: i64 = 0; while i < k { o[i] = t[k - 1 - i]; i = i + 1 } if fd >= 0 { sys_write(fd, o, k) } return 0 }
called by 1: main calls 2: sys_mmapsys_write
159func main() -> i64