nx_swcompare_gapmap.nx source
↩ module page · 330 lines · 22652 B
1// nx_swcompare_gapmap.nx -- the GENERATIVE gap-finder of Nishi Compare, DOMAIN-PARAMETERIZED. Given a <domain>, it
2// reads knowledge/compare/<domain>.q (to learn the researcher-banked frontier corpus file names) + knowledge/
3// compare/<domain>.axes (label|organ-path|symbol|frontier-keywords, plus an optional "@title <text>" line) -> for
4// each axis measures OUR presence (symbol on disk, mechanical) x FRONTIER MOMENTUM (keyword count over the banked
5// 2024-2026 corpus) -> classifies OPPORTUNITY (absent+hot = where to test/research), COVERED (present), dormant.
6// A NEW domain = a new .q + .axes pair; ZERO new code. Modes: `nx_swcompare_gapmap <domain>` = console + liar-kill
7// (gate); `nx_swcompare_gapmap <domain> html` = emit the /compare/<domain>/frontier page.
8// NOTE: no '#'/'!' in string literals (nx_cc trap). license_tier: ORIGINAL expect_exit:0
9import "nx_syscalls.nx"
10const K_MAGIC_262144: i64 = 262144
11const K_MAGIC_4194304: i64 = 4194304
12const K_MAGIC_65536: i64 = 65536
13const K_MAGIC_4096: i64 = 4096
14const K_MAGIC_1024: i64 = 1024
15const K_MAGIC_2048: i64 = 2048
16const K_MAGIC_3072: i64 = 3072
17const K_MAGIC_100000: i64 = 100000
18
19func w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
20func wc(fd: i64, code: i64) -> i64 { let t: *u8 = sys_mmap(2); t[0] = code as u8; sys_write(fd, t, 1); return 0 }
21func wn(fd: i64, v: i64) -> i64 {
22 var m: i64 = v; if m < 0 { w(fd, "-" as *u8); m = 0 - m }
23 let t: *u8 = sys_mmap(24); var k: i64 = 0; if m == 0 { t[0] = 48 as u8; k = 1 }
24 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 }
25 let o: *u8 = sys_mmap(24); var i: i64 = 0; while i < k { o[i] = t[k-1-i]; i = i + 1 } sys_write(fd, o, k); return 0
26}
27func streq(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 }
28func wj(fd: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { let c: i64 = s[i] as i64; if c == 34 { wc(fd, 92); wc(fd, 34) } else { if c == 92 { wc(fd, 92); wc(fd, 92) } else { if c < 32 { wc(fd, 32) } else { wc(fd, c) } } } i = i + 1 } return 0 }
29func pj3(dst: *u8, a: *u8, b: *u8, c: *u8) -> i64 {
30 var i: i64 = 0; var j: i64 = 0
31 while a[j] != (0 as u8) { dst[i] = a[j]; i = i + 1; j = j + 1 }
32 j = 0; while b[j] != (0 as u8) { dst[i] = b[j]; i = i + 1; j = j + 1 }
33 j = 0; while c[j] != (0 as u8) { dst[i] = c[j]; i = i + 1; j = j + 1 }
34 dst[i] = 0 as u8; return i
35}
36func c_read(path: *u8, buf: *u8, cap: i64) -> i64 {
37 let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 - 1 }
38 var tot: i64 = 0
39 while tot < cap { let r: i64 = sys_read(fd, (buf as i64 + tot) as *u8, cap - tot); if r <= 0 { break } tot = tot + r }
40 sys_close(fd); return tot
41}
42func c_has(buf: *u8, n: i64, needle: *u8) -> i64 {
43 var i: i64 = 0
44 while i < n { var k: i64 = 0; var hit: i64 = 1
45 while needle[k] != (0 as u8) { if i + k >= n { hit = 0; k = 0 - 1; break } if buf[i+k] != needle[k] { hit = 0; break } k = k + 1 }
46 if hit == 1 { if k > 0 { return 1 } } i = i + 1 }
47 return 0
48}
49func c_file_has(path: *u8, needle: *u8, buf: *u8, cap: i64) -> i64 {
50 let n: i64 = c_read(path, buf, cap); if n <= 0 { return 0 }
51 return c_has(buf, n, needle)
52}
53func c_count(buf: *u8, n: i64, needle: *u8) -> i64 {
54 var m: i64 = 0; while needle[m] != (0 as u8) { m = m + 1 }
55 if m == 0 { return 0 }
56 var cnt: i64 = 0; var i: i64 = 0
57 while i + m <= n {
58 var k: i64 = 0; var hit: i64 = 1
59 while k < m { if buf[i+k] != needle[k] { hit = 0; break } k = k + 1 }
60 if hit == 1 { cnt = cnt + 1; i = i + m } else { i = i + 1 }
61 }
62 return cnt
63}
64func load_append(dst: *u8, off: i64, cap: i64, path: *u8) -> i64 {
65 let fd: i64 = sys_openat_rd(path); if fd < 0 { return 0 }
66 var tot: i64 = 0
67 while off + tot < cap { let r: i64 = sys_read(fd, (dst as i64 + off + tot) as *u8, cap - off - tot); if r <= 0 { break } tot = tot + r }
68 sys_close(fd); return tot
69}
70// derive the frontier corpus from <domain>.q bank names: for each "bankname<TAB>url", load knowledge/library/<bankname>.txt
71func load_corpus_from_q(FRONT: *u8, fcap: i64, qpath: *u8, qb: *u8, qcap: i64) -> i64 {
72 let qn: i64 = c_read(qpath, qb, qcap); if qn <= 0 { return 0 }
73 var FN: i64 = 0
74 let nameb: *u8 = sys_mmap(256)
75 let pathb: *u8 = sys_mmap(512)
76 var i: i64 = 0
77 while i < qn {
78 var j: i64 = i
79 var tb: i64 = 0 - 1
80 while j < qn { if qb[j] == (10 as u8) { break } if qb[j] == (9 as u8) { if tb < 0 { tb = j } } j = j + 1 }
81 if qb[i] != (35 as u8) {
82 if tb > i {
83 var k: i64 = 0
84 while (i + k) < tb { nameb[k] = qb[i+k]; k = k + 1 }
85 nameb[k] = 0 as u8
86 pj3(pathb, "knowledge/library/" as *u8, nameb, ".txt" as *u8)
87 FN = FN + load_append(FRONT, FN, fcap, pathb)
88 }
89 }
90 i = j + 1
91 }
92 return FN
93}
94
95func main(argc: i64, argv: *i64) -> i64 {
96 let scap: i64 = K_MAGIC_262144
97 let scratch: *u8 = sys_mmap(scap)
98 var domain: *u8 = "computational" as *u8
99 if argc >= 2 { domain = argv[1] as *u8 }
100 var html: i64 = 0
101 if argc >= 3 { if streq(argv[2] as *u8, "html" as *u8) == 1 { html = 1 } }
102 var jsonm: i64 = 0
103 if argc >= 3 { if streq(argv[2] as *u8, "json" as *u8) == 1 { jsonm = 1 } }
104
105 let qpath: *u8 = sys_mmap(512); pj3(qpath, "knowledge/compare/" as *u8, domain, ".q" as *u8)
106 let axpath: *u8 = sys_mmap(512); pj3(axpath, "knowledge/compare/" as *u8, domain, ".axes" as *u8)
107
108 let fcap: i64 = K_MAGIC_4194304
109 let FRONT: *u8 = sys_mmap(fcap)
110 let qb: *u8 = sys_mmap(K_MAGIC_65536)
111 let FN: i64 = load_corpus_from_q(FRONT, fcap, qpath, qb, K_MAGIC_65536)
112 // scale-law (operator 2026-07-18): NEVER cap silently -- if the corpus filled the loader envelope,
113 // DECLARE it in every output mode (late .q banks partially dropped -> their momentum is a FLOOR).
114 var trunc: i64 = 0
115 if FN >= fcap { trunc = 1 }
116
117 let sbuf: *u8 = sys_mmap(K_MAGIC_65536)
118 let sn: i64 = c_read(axpath, sbuf, K_MAGIC_65536)
119
120 let al: *i64 = sys_mmap(64 * 8)
121 let ap: *i64 = sys_mmap(64 * 8)
122 let ah: *i64 = sys_mmap(64 * 8)
123 let labarena: *u8 = sys_mmap(K_MAGIC_65536)
124 var labpos: i64 = 0
125 let fbuf: *u8 = sys_mmap(K_MAGIC_4096)
126 let kbuf: *u8 = sys_mmap(K_MAGIC_1024)
127 let titleb: *u8 = sys_mmap(256)
128 var tset: i64 = 0
129 var n: i64 = 0
130
131 var i: i64 = 0
132 while i < sn {
133 var j: i64 = i
134 while j < sn { if sbuf[j] == (10 as u8) { break } j = j + 1 }
135 if sbuf[i] == (64 as u8) {
136 // "@title <text>" directive: capture text after the first space
137 var d: i64 = i + 1
138 while d < j { if sbuf[d] == (32 as u8) { break } d = d + 1 }
139 d = d + 1
140 var tp: i64 = 0
141 while d < j { if tp < 255 { titleb[tp] = sbuf[d]; tp = tp + 1 } d = d + 1 }
142 titleb[tp] = 0 as u8
143 tset = 1
144 } else {
145 if sbuf[i] != (35 as u8) {
146 if j > i {
147 var fi: i64 = 0; var fp: i64 = 0
148 var q: i64 = i
149 while q < j {
150 let ch: u8 = sbuf[q]
151 if ch == (124 as u8) { fbuf[fi*K_MAGIC_1024 + fp] = 0 as u8; if fi < 3 { fi = fi + 1 } fp = 0 } else { if fp < 1023 { fbuf[fi*K_MAGIC_1024 + fp] = ch; fp = fp + 1 } }
152 q = q + 1
153 }
154 fbuf[fi*K_MAGIC_1024 + fp] = 0 as u8
155 if fi == 3 {
156 let f0: *u8 = (fbuf as i64) as *u8
157 let f1: *u8 = (fbuf as i64 + K_MAGIC_1024) as *u8
158 let f2: *u8 = (fbuf as i64 + K_MAGIC_2048) as *u8
159 let f3: *u8 = (fbuf as i64 + K_MAGIC_3072) as *u8
160 var lp: i64 = labpos; var c0: i64 = 0
161 while f0[c0] != (0 as u8) { labarena[lp + c0] = f0[c0]; c0 = c0 + 1 }
162 labarena[lp + c0] = 0 as u8
163 al[n] = (labarena as i64 + lp)
164 labpos = lp + c0 + 1
165 ap[n] = c_file_has(f1, f2, scratch, scap)
166 var hits: i64 = 0; var kp: i64 = 0; var r: i64 = 0
167 while r >= 0 {
168 let ch2: u8 = f3[r]
169 var flush: i64 = 0
170 if ch2 == (0 as u8) { flush = 1 }
171 if ch2 == (59 as u8) { flush = 1 }
172 if flush == 1 {
173 kbuf[kp] = 0 as u8
174 if kp > 0 { hits = hits + c_count(FRONT, FN, kbuf) }
175 kp = 0
176 if ch2 == (0 as u8) { r = 0 - 2 }
177 } else { if kp < 1023 { kbuf[kp] = ch2; kp = kp + 1 } }
178 r = r + 1
179 }
180 ah[n] = hits
181 n = n + 1
182 }
183 }
184 }
185 }
186 i = j + 1
187 }
188 if tset == 0 { var c9: i64 = 0; while domain[c9] != (0 as u8) { titleb[c9] = domain[c9]; c9 = c9 + 1 } titleb[c9] = 0 as u8 }
189
190 let order: *i64 = sys_mmap(64 * 8)
191 var z: i64 = 0; while z < n { order[z] = z; z = z + 1 }
192 var s1: i64 = 0
193 while s1 < n {
194 var best: i64 = s1; var s2: i64 = s1 + 1
195 while s2 < n { if ah[order[s2]] > ah[order[best]] { best = s2 } s2 = s2 + 1 }
196 let tmp: i64 = order[s1]; order[s1] = order[best]; order[best] = tmp
197 s1 = s1 + 1
198 }
199 var maxh: i64 = 0
200 if n > 0 { maxh = ah[order[0]] }
201
202 var opp: i64 = 0; var cov: i64 = 0; var dorm: i64 = 0
203 var t: i64 = 0
204 while t < n {
205 if ap[t] == 1 { cov = cov + 1 } else { if ah[t] > 0 { opp = opp + 1 } else { dorm = dorm + 1 } }
206 t = t + 1
207 }
208 let neg: i64 = c_count(FRONT, FN, "zqxjq_wolfram_notacap" as *u8)
209
210 if jsonm == 1 {
211 wc(1, 123)
212 wc(1, 34); w(1, "v" as *u8); wc(1, 34); wc(1, 58); wn(1, 1); wc(1, 44)
213 wc(1, 34); w(1, "domain" as *u8); wc(1, 34); wc(1, 58); wc(1, 34); wj(1, domain); wc(1, 34); wc(1, 44)
214 wc(1, 34); w(1, "title" as *u8); wc(1, 34); wc(1, 58); wc(1, 34); wj(1, titleb); wc(1, 34); wc(1, 44)
215 wc(1, 34); w(1, "kind" as *u8); wc(1, 34); wc(1, 58); wc(1, 34); w(1, "frontier-radar" as *u8); wc(1, 34); wc(1, 44)
216 wc(1, 34); w(1, "corpus_bytes" as *u8); wc(1, 34); wc(1, 58); wn(1, FN); wc(1, 44)
217 wc(1, 34); w(1, "corpus_truncated_at_cap" as *u8); wc(1, 34); wc(1, 58); wn(1, trunc); wc(1, 44)
218 wc(1, 34); w(1, "opportunities" as *u8); wc(1, 34); wc(1, 58); wn(1, opp); wc(1, 44)
219 wc(1, 34); w(1, "axes" as *u8); wc(1, 34); wc(1, 58); wc(1, 91)
220 var ji: i64 = 0
221 while ji < n {
222 let ix: i64 = order[ji]
223 if ji > 0 { wc(1, 44) }
224 wc(1, 123)
225 wc(1, 34); w(1, "axis" as *u8); wc(1, 34); wc(1, 58); wc(1, 34); wj(1, al[ix] as *u8); wc(1, 34); wc(1, 44)
226 wc(1, 34); w(1, "present" as *u8); wc(1, 34); wc(1, 58); wn(1, ap[ix]); wc(1, 44)
227 wc(1, 34); w(1, "momentum" as *u8); wc(1, 34); wc(1, 58); wn(1, ah[ix]); wc(1, 44)
228 wc(1, 34); w(1, "signal" as *u8); wc(1, 34); wc(1, 58); wc(1, 34)
229 if ap[ix] == 1 { w(1, "covered" as *u8) } else { if ah[ix] > 0 { w(1, "opportunity" as *u8) } else { w(1, "dormant" as *u8) } }
230 wc(1, 34)
231 wc(1, 125)
232 ji = ji + 1
233 }
234 wc(1, 93); wc(1, 44)
235 wc(1, 34); w(1, "generated_by" as *u8); wc(1, 34); wc(1, 58); wc(1, 34); w(1, "nx_swcompare_gapmap" as *u8); wc(1, 34)
236 wc(1, 125); wc(1, 10)
237 sys_exit(0); return 0
238 }
239
240 if html == 1 {
241 w(1, "<" as *u8); wc(1, 33); w(1, "DOCTYPE html>\n<html lang=\"en\"><head><meta charset='utf-8'><meta name='viewport' content='width=device-width, initial-scale=1'>\n" as *u8)
242 w(1, "<title>Nishi Compare -- Frontier Radar: " as *u8); w(1, titleb); w(1, "</title>\n<style>\n" as *u8)
243 w(1, ":root{--nx-color-bg:rgb(255,255,255);--nx-color-fg:rgb(22,22,34);--nx-color-accent:rgb(42,77,143);--bg:var(--nx-color-bg);--fg:var(--nx-color-fg);--ac:var(--nx-color-accent);--y:rgb(26,127,55);--n:rgb(179,38,30);--op:rgb(178,106,0);--line:rgb(227,227,234);--soft:rgb(246,247,251)}\n" as *u8)
244 w(1, "*{box-sizing:border-box}body{background:var(--bg);font-family:-apple-system,Segoe UI,Roboto,sans-serif;max-width:1000px;margin:0 auto;padding:0 clamp(14px,4vw,20px) 5vh;color:var(--fg);line-height:1.6;font-size:clamp(15px,0.6vw + 13px,17px)}\n" as *u8)
245 w(1, "h1{font-size:clamp(1.6rem,4vw,2rem);margin:0 0 4px;background:linear-gradient(90deg,var(--ac),var(--op));-webkit-background-clip:text;background-clip:text;-webkit-text-fill-color:transparent;color:transparent}.sub{color:rgb(102,102,102);font-size:clamp(.95rem,2vw,1.05rem);margin:0 0 4px}.crumb{font-size:.85rem;margin-bottom:18px}a{color:var(--ac)}\n" as *u8)
246 w(1, ".skip-link{position:absolute;left:-999px;top:0;background:var(--ac);color:rgb(255,255,255);padding:12px 16px;z-index:9;border-radius:0 0 8px 0}.skip-link:focus{left:0}\n" as *u8)
247 w(1, ".hd{background:linear-gradient(90deg,var(--ac),rgb(9,58,136));border-radius:0 0 12px 12px;margin:0 0 20px}.hd nav{display:flex;gap:8px;flex-wrap:wrap;padding:8px 14px}.hd a{color:rgb(255,255,255);text-decoration:none;padding:10px 12px;border-radius:8px;font-weight:600;min-height:44px;display:inline-flex;align-items:center}.hd a:hover{background:rgba(255,255,255,0.16)}\n" as *u8)
248 w(1, ".meth{background:var(--soft);border:1px solid var(--line);border-radius:12px;padding:14px 18px;margin:18px 0;font-size:.9rem;color:rgb(51,51,51)}\n" as *u8)
249 w(1, ".opp{background:rgb(255,248,235);border:1px solid rgb(240,215,170);border-radius:12px;padding:14px 18px;margin:18px 0}.opp b{color:var(--op)}\n" as *u8)
250 w(1, ".wrap{overflow-x:auto;border:1px solid var(--line);border-radius:12px;box-shadow:0 1px 3px rgba(16,20,28,0.08)}table{border-collapse:collapse;width:100%;min-width:720px;font-size:.93rem}\n" as *u8)
251 w(1, "th,td{padding:9px 12px;text-align:left;border-bottom:1px solid var(--line)}thead th{background:var(--soft);font-weight:600}.cat{font-weight:600}\n" as *u8)
252 w(1, ".sig{font-weight:600;font-size:.8rem;padding:2px 9px;border-radius:20px}.sig.o{background:rgb(245,220,180);color:rgb(120,70,0)}.sig.c{background:rgb(200,235,208);color:rgb(20,100,45)}.sig.d{background:var(--soft);color:rgb(120,120,120)}\n" as *u8)
253 w(1, ".barwrap{background:var(--soft);border-radius:6px;height:16px;width:150px;overflow:hidden}.barf{height:16px;background:var(--ac)}.barf.o{background:var(--op)}.mm{font-size:.8rem;color:rgb(102,102,102)}\n" as *u8)
254 w(1, ".foot{margin-top:28px;color:rgb(136,136,136);font-size:.78rem;border-top:1px solid var(--line);padding-top:14px}\n" as *u8)
255 w(1, ":focus-visible{outline:3px solid var(--ac);outline-offset:2px}main>*{animation:rise .5s ease both}main>*:nth-child(2){animation-delay:.05s}main>*:nth-child(3){animation-delay:.1s}main>*:nth-child(4){animation-delay:.15s}@keyframes rise{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}.wrap,.opp{animation:rise linear both;animation-timeline:view();animation-range:entry 0% cover 22%}@media(prefers-reduced-motion:reduce){main>*,.wrap,.opp{animation:none}}\n" as *u8)
256 w(1, "@media(prefers-color-scheme:dark){:root{--nx-color-bg:rgb(15,15,20);--nx-color-fg:rgb(230,230,238);--line:rgb(38,38,47);--soft:rgb(23,23,31)}.opp{background:rgb(35,28,15);border-color:rgb(90,70,30)}}\n" as *u8)
257 w(1, "</style></head><body>\n" as *u8)
258 w(1, "<a class='skip-link' href='" as *u8); wc(1, 35); w(1, "main'>Skip to content</a><header class='hd'><nav><svg viewBox='0 0 24 24' width='22' height='22' aria-hidden='true' style='color:rgb(255,255,255)'><circle cx='12' cy='12' r='9' fill='none' stroke='currentColor' stroke-width='2'/><path d='M8 12h8M12 8v8' stroke='currentColor' stroke-width='2'/></svg><a href='/'>Nishi Family</a><a href='/compare'>Compare</a></nav></header><main id='main'>\n" as *u8)
259 w(1, "<p class='crumb'><a href='/'>Nishi Family</a> › <a href='/compare'>Compare</a> › Frontier Radar</p>\n" as *u8)
260 w(1, "<h1>Frontier Radar — " as *u8); w(1, titleb); w(1, "</h1>\n<p class='sub'>Where the 2025/26 research frontier is moving, and where Nishi should test, deepen, or research next.</p>\n" as *u8)
261 w(1, "<div class='meth'><b>How this works.</b> The nishi researcher banked the current (2024-2026) frontier for this domain over sovereign TLS (keyless OpenAlex/arXiv). For each capability axis this radar measures <b>frontier momentum</b> = how often the frontier corpus mentions it, times <b>our organ presence</b> (probed on disk). <b>Absent + hot = a research opportunity / where to test</b>. Corpus measured: " as *u8)
262 wn(1, FN); w(1, " bytes. Generated by nx_swcompare_gapmap over a data-only domain spec (" as *u8); w(1, domain); w(1, ".q + " as *u8); w(1, domain); w(1, ".axes) — zero domain-specific code.</div>\n" as *u8)
263 if trunc == 1 { w(1, "<div class='opp'><b>Envelope declared.</b> The banked corpus FILLED the loader cap (" as *u8); wn(1, fcap); w(1, " bytes) and was truncated — momentum counts for late .q banks are a <b>floor, not exact</b>. Trim the .q bank set or raise the cap.</div>\n" as *u8) }
264 w(1, "<div class='opp'><b>Top research opportunities</b> (the 2025/26 frontier is active here and Nishi has no organ yet):<ul>\n" as *u8)
265 var oi: i64 = 0
266 while oi < n {
267 let idx: i64 = order[oi]
268 if ap[idx] == 0 { if ah[idx] > 0 { w(1, "<li><b>" as *u8); w(1, al[idx] as *u8); w(1, "</b> — frontier momentum " as *u8); wn(1, ah[idx]); w(1, "</li>\n" as *u8) } }
269 oi = oi + 1
270 }
271 w(1, "</ul></div>\n" as *u8)
272 w(1, "<h2 style='font-size:clamp(1.05rem,2.5vw,1.25rem);margin:24px 0 10px'>Capability axes</h2>\n" as *u8)
273 w(1, "<div class='wrap'><table><thead><tr><th>Capability axis</th><th>Nishi organ</th><th>Frontier momentum (2025/26)</th><th>Signal</th></tr></thead><tbody>\n" as *u8)
274 var ri: i64 = 0
275 while ri < n {
276 let idx2: i64 = order[ri]
277 w(1, "<tr><td class='cat'>" as *u8); w(1, al[idx2] as *u8); w(1, "</td>" as *u8)
278 if ap[idx2] == 1 { w(1, "<td style='color:var(--y);font-weight:600'>present</td>" as *u8) } else { w(1, "<td style='color:var(--n);font-weight:600'>absent</td>" as *u8) }
279 var pct: i64 = 0
280 if maxh > 0 { pct = (ah[idx2] * 100) / maxh }
281 w(1, "<td><div class='barwrap'><div class='barf" as *u8)
282 if ap[idx2] == 0 { w(1, " o" as *u8) }
283 w(1, "' style='width:" as *u8); wn(1, pct); w(1, "%'></div></div><span class='mm'>" as *u8); wn(1, ah[idx2]); w(1, " mentions</span></td>" as *u8)
284 if ap[idx2] == 1 { w(1, "<td><span class='sig c'>COVERED</span></td>" as *u8) } else { if ah[idx2] > 0 { w(1, "<td><span class='sig o'>OPPORTUNITY</span></td>" as *u8) } else { w(1, "<td><span class='sig d'>dormant</span></td>" as *u8) } }
285 w(1, "</tr>\n" as *u8)
286 ri = ri + 1
287 }
288 w(1, "</tbody></table></div>\n" as *u8)
289 w(1, "<p class='sub' style='font-size:.9rem;margin-top:16px'>Opportunities " as *u8); wn(1, opp); w(1, " · covered " as *u8); wn(1, cov); w(1, " · dormant " as *u8); wn(1, dorm); w(1, "</p>\n" as *u8)
290 w(1, "<p class='foot'>frontier momentum is a mechanical keyword count over real 2024-2026 works; our presence is probed on disk. A discovery signal, not a ranking of importance. Zero JS, zero trackers.</p>\n" as *u8)
291 w(1, "</main></body></html>\n" as *u8)
292 sys_exit(0); return 0
293 }
294
295 w(1, "=== NX-SWCOMPARE-GAPMAP domain=" as *u8); w(1, domain); w(1, " (researcher-fed 2025/26 frontier radar) ===\n" as *u8)
296 w(1, " title="); w(1, titleb); w(1, " frontier corpus="); wn(1, FN); w(1, " bytes axes="); wn(1, n); w(1, "\n" as *u8)
297 if trunc == 1 { w(1, " CORPUS-TRUNCATED-AT-CAP: banks exceed the loader envelope -- late-bank momentum is a FLOOR (declared per scale-law, never silent)\n" as *u8) }
298 var p: i64 = 0
299 while p < n {
300 let idx: i64 = order[p]
301 w(1, " [" as *u8)
302 if ap[idx] == 1 { w(1, "COVERED " as *u8) } else { if ah[idx] > 0 { w(1, "OPPORTUNITY" as *u8) } else { w(1, "dormant " as *u8) } }
303 w(1, "] mom="); wn(1, ah[idx]); w(1, " "); w(1, al[idx] as *u8); w(1, "\n" as *u8)
304 p = p + 1
305 }
306 w(1, " TALLY: opportunities="); wn(1, opp); w(1, " covered="); wn(1, cov); w(1, " dormant="); wn(1, dorm); w(1, "\n" as *u8)
307 let liar_corpus: i64 = (FN > K_MAGIC_100000) as i64
308 let liar_neg: i64 = (neg == 0) as i64
309 // 2026-07-09: a domain may LEGITIMATELY reach opportunities=0 (the llm
310 // domain closed all axes). The old control (opp>=1) then fired a FALSE
311 // RED. When opp==0, prove the classifier CAN still emit OPPORTUNITY:
312 // probe a reserved, guaranteed-absent organ path through the SAME
313 // presence machinery; absent + the domain's own max momentum (>0) must
314 // classify OPPORTUNITY. Real-opportunity domains keep the old path.
315 let liar_opp_real: i64 = (opp >= 1) as i64
316 var liar_opp: i64 = liar_opp_real
317 var syn_used: i64 = 0
318 if liar_opp == 0 {
319 let synp: i64 = c_file_has("runtime/nx__gapmap_synth_absent__.nx" as *u8, "nx_never" as *u8, scratch, scap)
320 if synp == 0 { if maxh > 0 { liar_opp = 1; syn_used = 1 } }
321 }
322 let liar_cov: i64 = (cov >= 1) as i64
323 w(1, " LIAR-KILL: corpus-loaded="); wn(1, liar_corpus); w(1, " neg-control-zero="); wn(1, liar_neg); w(1, " found-opportunities="); wn(1, liar_opp)
324 if syn_used == 1 { w(1, " (ALL-COVERED; synthetic classifier probe green)" as *u8) }
325 w(1, " has-covered="); wn(1, liar_cov); w(1, "\n" as *u8)
326 let ok: i64 = liar_corpus & liar_neg & liar_opp & liar_cov
327 w(1, "NX-SWCOMPARE-GAPMAP domain="); w(1, domain); w(1, " opportunities="); wn(1, opp); w(1, " verdict=")
328 if ok == 1 { w(1, "MEASURED-HONEST (liar-killed) -- researcher-fed frontier radar; opportunities ranked by 2025/26 momentum\n" as *u8); sys_exit(0); return 0 }
329 w(1, "RED (corpus not loaded, neg-control leaked, or no opportunity/covered axis)\n" as *u8); sys_exit(1); return 1
330}