code wiki / _hdl_build / nx_build_evidence_gate.nx
nx_build_evidence_gate.nx
buildroot/runtime/_hdl_build/nx_build_evidence_gate.nx
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
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
structs
| none |
consts
| 19 | const GEN: *u8 = "knowledge/registry/genesis_lineage.tsv" |
| 20 | const REG: *u8 = "knowledge/registry/build_registry.log" |
| 21 | const WATCH: *u8 = "knowledge/registry/orphan_watchlist.log" |
| 22 | const ODIR: *u8 = "runtime/_hdl_build" |
| 23 | const FB: i64 = 262144 |
| 24 | const MAXO: i64 = 8192 |
| 25 | const SLOT: i64 = 160 |
| 27 | const C_GHOST: i64 = 0 |
| 28 | const C_ANOMALY: i64 = 1 |
| 29 | const C_FLOATING: i64 = 2 |
| 30 | const C_UNREG: i64 = 3 |
| 31 | const C_WEAK: i64 = 4 |
| 32 | const C_CORROB: i64 = 5 |
functions
| 34 | func ep(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 35 | func elen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 36 | func epn(v: i64) -> i64 |
| 45 | func 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 } |
| 46 | func eread(path: *u8, buf: *u8, cap: i64) -> i64 |
| 52 | func eexists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 } |
| 53 | func 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 } |
| 54 | func efind(buf: *u8, from: i64, to: i64, pat: *u8) -> i64 |
| 60 | func e_kv(buf: *u8, ls: i64, le: i64, key: *u8, out: *u8) -> i64 |
| 66 | func e_field(buf: *u8, ls: i64, le: i64, idx: i64, out: *u8) -> i64 called by 1: e_genparent |
| 73 | func e_genparent(buf: *u8, n: i64, node: *u8, parent_out: *u8) -> i64 |
| 83 | func e_genhops(buf: *u8, n: i64, node: *u8) -> i64 |
| 95 | func e_resolve(name: *u8) -> i64 |
| 104 | func e_import_rooted(path: *u8) -> i64 |
| 126 | func e_organ_path(name: *u8, out: *u8) -> i64 |
| 132 | func e_getdents(fd: i64, buf: *u8, count: i64) -> i64 { return __syscall(217, fd, buf, count, 0, 0, 0) } called by 1: main |
| 133 | func e_isorgan(name: *u8) -> i64 |
| 140 | func classify(e1: i64, e2: i64, e3: i64, e4: i64) -> i64 called by 1: main |
| 148 | func class_str(c: i64) -> *u8 called by 1: main |
| 156 | func e_wwrite(fd: i64, s: *u8) -> i64 { if fd >= 0 { sys_write(fd, s, elen(s)) } return 0 } |
| 157 | func 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 } |
| 159 | func main() -> i64 |