code wiki / _hdl_build / nx_cap_gap_sov.nx
nx_cap_gap_sov.nx source
↩ module page · 172 lines · 19498 B
1// nx_cap_gap_sov.nx -- SOVEREIGN endpoint/missing-generation finder (operator 2026-06-22: "no more tsvs ...
2// nishi ecosystem only"). REPLACES the deleted endpoint_paths.tsv: the capability path lives in the sovereign
3// content-addressed store nx_seg_store (NOT a flat file). Authored by this organ via ss_begin/ss_add/ss_commit,
4// read back via ss_open/ss_hget, built-status DERIVED from real organ-file existence (so it can't be fiction).
5// Reports the frontier, the next missing generation, and a RACI hand-off. GATE w/ neg-control: a real organ
6// classifies BUILT, a fake one MISSING. Sovereign: imports nx_seg_store (+ nx_syscalls). expect_exit: 0 ORIGINAL
7import "nx_seg_store.nx"
8import "nx_syscalls.nx"
9
10const CAP_STORE: *u8 = "knowledge/store/capability" // sovereign seg_store prefix (segments+manifest, NOT a flat TSV)
11const NSTEPS: i64 = 45
12
13func cp(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
14func clen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
15func cpn(v: i64) -> i64 {
16 let bb: *u8 = sys_mmap(28); var m: i64 = v
17 if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m }
18 let t: *u8 = sys_mmap(28); var k: i64 = 0
19 if m == 0 { t[0] = 48 as u8; k = 1 }
20 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 }
21 var i: i64 = 0; while i < k { bb[i] = t[k - 1 - i]; i = i + 1 }
22 sys_write(1, bb, k); return 0
23}
24func cstreq(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 }
25// cat decimal v into buf at off; returns new off (for the frontier-summary file the visual reads)
26func nbuf(buf: *u8, off: i64, v: i64) -> i64 {
27 var o: i64 = off; var m: i64 = v
28 if m < 0 { buf[o] = 45 as u8; o = o + 1; m = 0 - m }
29 let t: *u8 = sys_mmap(28); var k: i64 = 0
30 if m == 0 { t[0] = 48 as u8; k = 1 }
31 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 }
32 var i: i64 = 0; while i < k { buf[o] = t[k - 1 - i]; o = o + 1; i = i + 1 }
33 return o
34}
35func cexists(path: *u8) -> i64 { let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 } sys_close(fd); return 1 }
36func cjoin(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 }
37// BUILT-by-organ-file: the real artifact exists on disk (grounds the status; "-" = no organ = missing)
38func org_resolve(name: *u8) -> i64 {
39 if cstreq(name, "-" as *u8) == 1 { return 0 }
40 let p: *u8 = sys_mmap(512)
41 cjoin("runtime/_hdl_build/" as *u8, name, p); if cexists(p) == 1 { return 1 }
42 cjoin("runtime/" as *u8, name, p); if cexists(p) == 1 { return 1 }
43 cjoin("runtime/wiki/" as *u8, name, p); if cexists(p) == 1 { return 1 }
44 return 0
45}
46// key = "cap:AIM:<k>"
47func cap_key(k: i64, out: *u8) -> i64 {
48 var o: i64 = 0; let pfx: *u8 = "cap:AIM:" as *u8; var i: i64 = 0
49 while pfx[i] != (0 as u8) { out[o] = pfx[i]; o = o + 1; i = i + 1 }
50 if k == 0 { out[o] = 48 as u8; o = o + 1 } else { let t: *u8 = sys_mmap(16); var m: i64 = k; var n: i64 = 0; while m > 0 { t[n] = (48 + (m % 10)) as u8; m = m / 10; n = n + 1 } var j: i64 = 0; while j < n { out[o] = t[n - 1 - j]; o = o + 1; j = j + 1 } }
51 out[o] = 0 as u8; return 0
52}
53// extract the idx-th '|'-delimited field of src[0..slen) into out (NUL-term)
54func cap_field(src: *u8, slen: i64, idx: i64, out: *u8) -> i64 {
55 var f: i64 = 0; var i: i64 = 0
56 while f < idx { if i >= slen { out[0] = 0 as u8; return 0 } if src[i] == (124 as u8) { f = f + 1 } i = i + 1 }
57 var o: i64 = 0; var g: i64 = 1
58 while g == 1 { if i >= slen { g = 0 } else { if src[i] == (124 as u8) { g = 0 } else { out[o] = src[i]; o = o + 1; i = i + 1 } } }
59 out[o] = 0 as u8; return 1
60}
61func sa(w: *i64, key: *u8, val: *u8) -> i64 { ss_add(w, 1, key, val, clen(val)); return 0 }
62
63// SEED the capability path into the sovereign store (authored here = "author by organ"; data home = seg_store).
64// value = "node|organ_file|note"; organ "-" means genuinely-missing. Built-status is derived at read time.
65func cap_seed() -> i64 {
66 let w: *i64 = ss_begin()
67 sa(w, "cap:AIM:1" as *u8, "CAP-NF-GEMM|nx_nofloat_gemm.nx|no-float integer GEMM" as *u8)
68 sa(w, "cap:AIM:2" as *u8, "CAP-NF-NORM|nx_nofloat_layernorm_gate.nx|RMSNorm/LayerNorm" as *u8)
69 sa(w, "cap:AIM:3" as *u8, "CAP-NF-SOFTMAX|nx_nofloat_softmax_gate.nx|fixed-point softmax" as *u8)
70 sa(w, "cap:AIM:4" as *u8, "CAP-NF-ATTENTION|nx_nofloat_attention_gate.nx|attention sublayer" as *u8)
71 sa(w, "cap:AIM:5" as *u8, "CAP-NF-FFN|nx_nofloat_llm.nx|FFN sublayer (SiLU)" as *u8)
72 sa(w, "cap:AIM:6" as *u8, "CAP-NF-STACK|nx_nofloat_qwen_stack_gate.nx|24-layer stack" as *u8)
73 sa(w, "cap:AIM:7" as *u8, "CAP-NF-EMBED|nx_nofloat_qwen_forward_gate.nx|token embeddings" as *u8)
74 sa(w, "cap:AIM:8" as *u8, "CAP-NF-TOKENIZER|nx_nofloat_tok.nx|BPE tokenizer" as *u8)
75 sa(w, "cap:AIM:9" as *u8, "CAP-NF-FORWARD|nx_nofloat_qwen_forward_gate.nx|full forward->argmax" as *u8)
76 sa(w, "cap:AIM:10" as *u8, "CAP-NF-TEXT|nx_nofloat_qwen_text_gate.nx|text->text inference" as *u8)
77 sa(w, "cap:AIM:11" as *u8, "CAP-NF-FIDELITY|nx_nofloat_qwen_fidelity_gate.nx|faithfulness vs ref Qwen" as *u8)
78 // --- TRAINING rungs, GROUNDED on real organ existence (2026-06-22 correction: the prior "CAP-NF-TRAIN|-"
79 // was a LIE -- it hardcoded missing WITHOUT checking nx_nn_train / nx_autograd_tensor / nx_nofloat_autograd) ---
80 sa(w, "cap:AIM:12" as *u8, "CAP-NF-TRAIN-1LAYER|nx_nn_train.nx|no-float single-layer GD (hand-coded analytic gradient)" as *u8)
81 sa(w, "cap:AIM:13" as *u8, "CAP-NF-AUTOGRAD|nx_nofloat_autograd.nx|GENERAL no-float reverse-mode autograd (Q16 tape; ports the FLOAT nx_autograd_tensor to integer)" as *u8)
82 sa(w, "cap:AIM:14" as *u8, "CAP-NF-XFORMER-OPS|nx_nofloat_xformer_gate.nx|no-float backward for the transformer nonlinearities softmax/silu/rmsnorm (gradcheck-verified)" as *u8)
83 sa(w, "cap:AIM:15" as *u8, "CAP-NF-ATTN-CORE|nx_nofloat_attn_gate.nx|single-head CAUSAL attention backprop: QK^T/AV matmuls + scaled causal softmax (gradcheck-verified)" as *u8)
84 sa(w, "cap:AIM:16" as *u8, "CAP-NF-ATTN-ROPE|nx_nofloat_rope_gate.nx|RoPE backward + RoPE composed into the attention block (gradcheck-verified)" as *u8)
85 sa(w, "cap:AIM:17" as *u8, "CAP-NF-BLOCK|nx_nofloat_block_gate.nx|FULL pre-norm transformer block (attn+RoPE+SwiGLU-FFN+residuals) backprops + trains end-to-end (gradcheck incl full chain)" as *u8)
86 sa(w, "cap:AIM:18" as *u8, "CAP-NF-LM|nx_nofloat_lm_gate.nx|a tiny TRANSFORMER LM (embed+block+LM-head+cross-entropy) trains end-to-end on next-token, CE 72126->441 (gradcheck full-chain dL/dE)" as *u8)
87 sa(w, "cap:AIM:19" as *u8, "CAP-NF-ADAMW|nx_nofloat_adamw_gate.nx|Q16 AdamW optimizer; measured exceed vs SGD on ill-conditioned training (bit-exact)" as *u8)
88 sa(w, "cap:AIM:20" as *u8, "CAP-NF-MULTIHEAD|nx_nofloat_multihead_gate.nx|multi-head causal attention (slice/concat head-split) backprops + trains" as *u8)
89 sa(w, "cap:AIM:21" as *u8, "CAP-NF-DEEPSTACK|nx_nofloat_deepstack_gate.nx|a DEPTH-2 transformer LM trains end-to-end (deep backprop through both blocks, AdamW)" as *u8)
90 sa(w, "cap:AIM:22" as *u8, "CAP-NF-REALCORPUS|nx_nofloat_corpus_gate.nx|char-level LM trains on REAL text (26-char sequence, V=26): CE 416089->62141, 80% next-char acc" as *u8)
91 sa(w, "cap:AIM:23" as *u8, "CAP-NF-GENERATE|nx_nofloat_generate_gate.nx|autoregressive argmax decode reproduces the trained text (target==GENERATED, self-asserted)" as *u8)
92 sa(w, "cap:AIM:24" as *u8, "CAP-NF-SAMPLE|nx_nofloat_sample_gate.nx|temperature SAMPLING decode (LCG + softmax-temp + inverse-CDF): empirical==softmax to 5/1000, reproducible, temp-responsive" as *u8)
93 sa(w, "cap:AIM:25" as *u8, "CAP-NF-GENERALIZE|nx_nofloat_generalize_gate.nx|HELD-OUT rule generalization: learns periodic rule, predicts unseen same-rule string 65% >>chance, beats wrong-rule control (teeth)" as *u8)
94 sa(w, "cap:AIM:26" as *u8, "CAP-NF-PROSE|nx_nofloat_prose_gate.nx|trains on REAL English prose (words+spaces, V=10) at scale dm=24: CE 793495->91918, next-char 48% (~5x chance, ~2x freq-baseline)" as *u8)
95 sa(w, "cap:AIM:27" as *u8, "CAP-NF-INCONTEXT|nx_nofloat_incontext_gate.nx|IN-CONTEXT copy head: echoes NEVER-SEEN random sequences 100% (vs 17% chance), robust across seeds = in-context learning basis" as *u8)
96 sa(w, "cap:AIM:28" as *u8, "CAP-NF-INDUCTION|nx_nofloat_induction_gate.nx|DOWNGRADED (3rd adversarial review + varying-position rebuild): content-INDUCTION NOT achieved at tiny scale -- with the repeat at a VARYING position the 2-block model scores ~chance (60/300 vs chance 50, == copy-back-1 61), so the old fixed-position 90% was a position artifact. The REAL in-context capability is copy-back-1 echo (CAP-NF-INCONTEXT, 100% unseen). This gate is now the honest RED test." as *u8)
97 sa(w, "cap:AIM:29" as *u8, "CAP-NF-GRAMMAR|nx_nofloat_grammar_gate.nx|the AFFORDABLE LANDING (researcher-grounded, TinyStories): learns a constrained grammar + GENERATES coherent novel sentences (ANVANV...) 100%, held-out 100%" as *u8)
98 sa(w, "cap:AIM:30" as *u8, "CAP-NF-BPE|nx_nofloat_bpe_gate.nx|R2 efficiency (researcher roadmap): learned BPE sub-word compression 4.73x LOSSLESS = fewer tokens/text = cheaper training + longer context" as *u8)
99 sa(w, "cap:AIM:31" as *u8, "CAP-NF-DISTILL|nx_nofloat_distill_gate.nx|R3 distillation: soft-target student matches teacher distribution (L1 18129) vs hard-label (184247) = ~10x = transfers dark knowledge" as *u8)
100 sa(w, "cap:AIM:32" as *u8, "CAP-NF-LANDING|nx_nofloat_landing_gate.nx|MEASURED LANDING: held-out perplexity 2.77 vs info-floor 2.62 vs uniform 8.0 = near-OPTIMAL no-float LM on its domain (the affordable land, standard metric)" as *u8)
101 sa(w, "cap:AIM:33" as *u8, "CAP-NF-BPELM|nx_nofloat_bpe_lm_gate.nx|CAPSTONE end-to-end pipeline (R1+R2): text->BPE(3.4x compress)->no-float LM learns tokens(CE 6343->1086, 5.8x)->detok LOSSLESS byte-exact. Sovereign efficient text pipeline wired" as *u8)
102 sa(w, "cap:AIM:34" as *u8, "CAP-NF-QUANT|nx_nofloat_quant_gate.nx|efficient sovereign inference (BitNet-grounded): INT8 post-training quant preserves quality (CE 1024 ~= full 1018); TERNARY {-1,0,1} via QAT reaches near-optimal (CE 990) where naive PTQ collapses (6633) = the BitNet b1.58 insight reproduced" as *u8)
103 sa(w, "cap:AIM:35" as *u8, "CAP-NF-KVCACHE|nx_nofloat_kvcache_gate.nx|fast sovereign inference: KV-cache incremental decode = bit-EXACT vs full recompute, 3.8x fewer projection MACs (11680->3040) = O(T) not O(T^2); teeth: corrupt cache changes output" as *u8)
104 sa(w, "cap:AIM:36" as *u8, "CAP-NF-KVCACHE-INT8|nx_nofloat_kvcache_int8_gate.nx|memory-efficient long-context inference: int8 KV-cache (8x smaller, 8 vs 64 bits) preserves ALL decisions (12/12 == full) while ternary cache degrades (6/12) = int8 is the right precision; cache genuinely used" as *u8)
105 sa(w, "cap:AIM:37" as *u8, "CAP-NF-BENCH|nx_nofloat_bench.nx|HONEST measured benchmark vs Unsloth-class (cited eff_*.raw), ADVERSARIAL-CORRECTED: EXCEED=2 (determinism bit-exact-by-construction vs float non-assoc; sovereignty zero-deps) PARITY=3 (int8,kv-cache,bit-width=BitNet-parity) BEHIND=3 (scale,throughput,ecosystem) = S-class exceed on design-goal axes, no-wave" as *u8)
106 sa(w, "cap:AIM:38" as *u8, "CAP-NF-LADDER|nx_nofloat_ladder.nx|CONSOLIDATION capstone: grounds the whole ladder on RUN-EVIDENCE (9/9 headline status-logs GREEN), prints categorized scorecard + honest S-class verdict; doc knowledge/research/2026-06-23-nofloat-deepmind-ladder-RESULTS.md" as *u8)
107 sa(w, "cap:AIM:39" as *u8, "CAP-NF-SERIALIZE|nx_nofloat_serialize_gate.nx|sovereign model PERSISTENCE: own binary save/load (magic+sizes+raw i64+checksum), round-trip BIT-IDENTICAL + checksum integrity + corruption-detectable teeth = deployable no-float models" as *u8)
108 sa(w, "cap:AIM:40" as *u8, "CAP-NF-CENSUS|nx_nofloat_census.nx|LIVING liar-killed neg-controlled census, 2x-ADVERSARIAL-REVIEWED: EXCEED=2 (DETERMINISM airtight + SOVEREIGNTY scoped[vs GPU-stacks; PARITY vs llama.cpp; not zero-dep]) PARITY=6 (bit-width-vs-BitNet, int8, kv, kv-mem, persistence, integer-only-inference-vs-Jacob-2017) BEHIND=3; novel=integer-only TRAINING; every axis grounded on a real organ+log" as *u8)
109 sa(w, "cap:AIM:41" as *u8, "CAP-NF-AUDIT|nx_nofloat_audit.nx|META verification-of-verification, REBUILT after 2nd review called v1 tautological: now RUNTIME-grounded (reads census run-log) + CORPUS-COMPLETE enumeration (every incumbent incl Jacob/eff_intonly cited -- catches cherry-picks) + real teeth; honest = audit-lint not proof" as *u8)
110 sa(w, "cap:AIM:42" as *u8, "CAP-NF-ADVERSARY|nx_nofloat_adversary.nx|DURABLE sovereign adversarial reviewer (Nishi OWNS it, not one-time subagents): 4 automated wave-detectors -- LOG-DISCIPLINE (caught 8 unconditional-log gates) + HELD-OUT/anti-memorization (caught LM+deepstack 'learned' on fixed seqs) + SELECTIVE-BASELINE (corpus-completeness) + ASTERISK-DISCIPLINE (every EXCEED must carry the MINORITY-PATH asterisk: float is mainstream, wins on scale/capability; our exceed is niche) + non-vacuity; each caught real waves; re-runnable forever" as *u8)
111 sa(w, "cap:AIM:43" as *u8, "CAP-NF-HWLADDER|nx_nofloat_hwladder.nx|HARDWARE-RUNG-UP ladder silicon->AI (R0 no-FPU/never-brick -> R1 toolchain -> R2 int-math -> R3 autograd -> R4 transformer -> R5 int-only-training -> R6 efficient-infer; R7 scale=honest frontier), 7/7 grounded. HARDWARE-CONDITIONAL exceed (asterisk): EXCEED on no-FPU/edge/FPGA silicon (float=soft-float liability, hw_*.raw), BEHIND on GPU. compiler has NO float type -> binary needs 0 FPU" as *u8)
112 sa(w, "cap:AIM:44" as *u8, "CAP-RISCV-BACKEND-R1|nx_riscv_decode.nx|SOVEREIGN RISC-V backend rung 1 (the sovereign path -- NO gcc/objdump/sh): our OWN rv64im ENCODER (nx_riscv_emit: 8 core instrs == canonical machine code) + our OWN DECODER (nx_riscv_decode: round-trips the encoder 6/6, reads back the emitted no-float Q16 matvec kernel [ld,ld,mul,srai,add,addi] as native RISC-V, teeth catch corruption). Ecosystem verifies itself. RUNG 2: nx_riscv_elf writes a real loadable rv64 ELF (machine=RISC-V, e_flags=0 no-FPU, PT_LOAD R+X) validated by our OWN ELF reader. RUNG 5: nx_riscv_emu (our own rv64im emulator) EXECUTES that ELF -> exit 40, LOOP CLOSED, no qemu. RUNG 4 DONE: nx_riscv_codegen lowers an IR (Q16 qmul) via REGALLOC + instruction-selection -> RISC-V -> ELF -> runs (exit 6 = 2.0*3.0 int part), retargets to 12 when the IR input changes (teeth). RUNG 3 DONE: nx_riscv_loop lowers a LOOP with a back-edge branch (bge) -> runs sum 1..5=15, N=10=55 (control flow works). Full sovereign loop: IR->regalloc->encode(+branches)->ELF->execute. Backend rungs R1-R5 COMPLETE. CONSOLIDATED onto general nx_riscv_lib (rule 15: encoders/lower/emulator/ELF = ONE shared capability, all 6 organs import it); nx_riscv_gate = sovereign toolchain verifier (reads green-only status logs, no shell). Remaining: nx_cc FRONT-END (parse arbitrary .nx -> this IR) = the last rung to a real sovereign RISC-V compiler" as *u8)
113 sa(w, "cap:AIM:45" as *u8, "CAP-AI-FRONTIER|-|R4-FULL scale-up. FINDING 2026-06-23 (EXHAUSTIVELY tested -> COMPUTE-GATED): richer 16-word grammar plateaus ppl~9 (<< uniform, learns structure) but never near floor ppl3.76. RULED OUT (all plateau): SGD low/high/decay-lr, AdamW Q16/Q32+warmup, DEPTH-2, batch-averaging, FFN-COMPLETE block, AND WIDTH dm=64 (CE 2542 WORSE -- the 4x-bigger model is UNDERTRAINED at tractable compute). That is the clean MECHANISM: bigger capacity is buildable but training it needs proportionally more compute than tractable -> R4-FULL = genuine GPU-SCALE COMPUTE, operator-gated (NOT optimizer/depth/architecture). Matches the Unsloth benchmark (1 BEHIND axis = scale). s-class EXCEED stands on sovereignty/determinism/bit-width. (MISSING)" as *u8)
114 ss_commit(CAP_STORE, w, sys_now_realtime_sec())
115 return 0
116}
117
118func main() -> i64 {
119 cp("=== nx_cap_gap_sov: SOVEREIGN endpoint/missing-generation finder (data in nx_seg_store, no TSV) ===\n" as *u8)
120 cap_seed()
121 let h: *i64 = ss_open(CAP_STORE)
122 let pq: *i64 = sys_mmap(16) as *i64
123 let lq: *i64 = sys_mmap(16) as *i64
124 var built: i64 = 0; var missing: i64 = 0; var frontier: i64 = 0; var frontier_ok: i64 = 1
125 var have_next: i64 = 0; var next_node: *u8 = sys_mmap(64); var next_order: i64 = 0
126 var k: i64 = 1
127 while k <= NSTEPS {
128 let key: *u8 = sys_mmap(64); cap_key(k, key)
129 if ss_hget(h, key, pq, lq) == 1 {
130 let val: *u8 = pq[0] as *u8; let vl: i64 = lq[0]
131 let node: *u8 = sys_mmap(96); let organ: *u8 = sys_mmap(96); let note: *u8 = sys_mmap(160)
132 cap_field(val, vl, 0, node); cap_field(val, vl, 1, organ); cap_field(val, vl, 2, note)
133 let isb: i64 = org_resolve(organ)
134 if isb == 1 { built = built + 1; if missing == 0 { frontier = k } else { frontier_ok = 0 } cp(" [BUILT] " as *u8) }
135 else { missing = missing + 1; if have_next == 0 { var z: i64 = 0; while node[z] != (0 as u8) { next_node[z] = node[z]; z = z + 1 } next_node[z] = 0 as u8; next_order = k; have_next = 1 } cp(" [MISSING] " as *u8) }
136 cpn(k); cp(" " as *u8); cp(node); cp(" <= " as *u8); cp(organ); cp(" -- " as *u8); cp(note); cp("\n" as *u8)
137 }
138 k = k + 1
139 }
140 cp(" FRONTIER (deepest built) = order " as *u8); cpn(frontier); cp(" BUILT=" as *u8); cpn(built); cp(" MISSING=" as *u8); cpn(missing); cp("\n" as *u8)
141 if have_next == 1 {
142 cp(" >> NEXT MISSING GENERATION = " as *u8); cp(next_node); cp(" (order " as *u8); cpn(next_order); cp(")\n" as *u8)
143 cp(" >> RACI: R=SIM-AI A=Nishi-PM C=Librarian I=operator\n" as *u8)
144 } else { cp(" >> ENDPOINT REACHED.\n" as *u8) }
145
146 // write the frontier summary for the visual (nx_genealogy_tree reads this): built<TAB>total<TAB>next_node
147 let fbuf: *u8 = sys_mmap(256)
148 var fo: i64 = nbuf(fbuf, 0, built)
149 fbuf[fo] = 9 as u8; fo = fo + 1
150 fo = nbuf(fbuf, fo, built + missing)
151 fbuf[fo] = 9 as u8; fo = fo + 1
152 if have_next == 1 { var z: i64 = 0; while next_node[z] != (0 as u8) { fbuf[fo] = next_node[z]; fo = fo + 1; z = z + 1 } } else { fbuf[fo] = 45 as u8; fo = fo + 1 }
153 fbuf[fo] = 10 as u8; fo = fo + 1
154 let ffd: i64 = sys_openat_wr("knowledge/status/cap_frontier.txt" as *u8, 420)
155 if ffd >= 0 { sys_write(ffd, fbuf, fo); sys_close(ffd); cp(" wrote knowledge/status/cap_frontier.txt (frontier summary for the visual)\n" as *u8) }
156
157 // neg-control: org-existence has teeth
158 let ncr: i64 = org_resolve("nx_nofloat_gemm.nx" as *u8)
159 let ncf: i64 = org_resolve("nx_zzz_nonexistent.nx" as *u8)
160 cp(" neg-control: built(nx_nofloat_gemm.nx)=" as *u8); cpn(ncr); cp(" (expect 1) built(fake)=" as *u8); cpn(ncf); cp(" (expect 0)\n" as *u8)
161
162 var ok: i64 = 1
163 if built < 1 { ok = 0 }
164 if missing < 1 { ok = 0 }
165 if frontier_ok != 1 { ok = 0 }
166 if ncr != 1 { ok = 0 }
167 if ncf != 0 { ok = 0 }
168 cp(" verdict=" as *u8)
169 if ok == 1 { cp("GREEN (path lives in seg_store; built/missing derived from real organs; frontier contiguous; teeth)\n" as *u8); sys_exit(0); return 0 }
170 cp("RED\n" as *u8)
171 sys_exit(1); return 1
172}