nx_research_loop.nx source
↩ module page · 95 lines · 8058 B
1// nx_research_loop.nx -- the AUTONOMOUS research-driving feedback loop (operator telos, 2026-06-17).
2// The physics ladders (latency/FLOP/bandwidth) + energy are SENSORS; this is the loop that reads them and
3// autonomously DRIVES research + monitoring:
4// 1. PHYSICS-GAP loop: for each capability, gap-to-floor -> a prioritized RESEARCH TASK (the known lever).
5// At/below the floor -> nothing to optimize in-software -> hand to the frontier scanner.
6// 2. ENERGY loop: energy-per-op vs the floor -> research task (here: RAPL absent in WSL -> "instrument on
7// bare metal" is itself the autonomously-emitted task -- the loop knows what it cannot yet measure).
8// 3. FRONTIER scan (PROVABILITY-GATED): for capabilities ALREADY at the published physics limit, scan the
9// frontier -- INCLUDING fringe/UAP-class claims -- for a higher optimum. The discipline is REPRODUCIBILITY,
10// not belief: a claim is pursued (-> REPRODUCTION task) ONLY if it has a reproducible/testable component
11// above a provability threshold. Unfalsifiable claims (e.g. over-unity, violates thermodynamics) are
12// FILTERED to monitor-only. Borderline-but-testable (low-confidence UAP) -> monitored w/ provability-watch
13// (re-evaluated if evidence strengthens). "We can try to reproduce" -- the gate is try-ability.
14// KAT: physics gaps emit research tasks (compute highest); at-floor caps trigger the frontier scan; the
15// provability gate pursues reproducibles + filters the unfalsifiable; an autonomous prioritized queue results.
16// No hw writes (Rule 26). expect_exit: 0 license_tier: ORIGINAL
17import "nx_syscalls.nx"
18import "nx_itoa_lib.nx" // shared MSB-first emitter (zero-alloc)
19const K_MAGIC_23600: i64 = 23600
20
21func rl_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
22// MIGRATED to the shared emitter (debt 1785563586). The old body mmapped a scratch buffer
23// per call and never freed it. At PAGE granularity that is 4096B leaked PER CALL -- the
24// defect that took 28.5GB of a 36GB host in nx_ts_lumadiff (2MB input, ~3.66M calls).
25// nxi_* is MSB-first, allocates NOTHING, and emits identical bytes including the sign.
26func rl_num(v: i64) -> i64 { nxi_out(v); return 0 }
27func rl_p(a: *i64, i: i64) -> *u8 { return (a[i]) as *u8 }
28
29func main() -> i64 {
30 rl_puts("AUTONOMOUS RESEARCH LOOP: physics-gap + energy feedback drive research; provability-gated frontier scan\n\n" as *u8)
31
32 // ---- capability sensors (seeded from this session's MEASURED physics ladders) ----
33 // gap_x100 = how far from the floor x100 (>100 = off the floor by that ratio; <=100 = at/below the floor).
34 let cn: *i64 = sys_mmap(8*8) as *i64
35 let cg: *i64 = sys_mmap(8*8) as *i64
36 let cl: *i64 = sys_mmap(8*8) as *i64
37 cn[0]="storage-read (latency)\x00" as i64; cg[0]=40; cl[0]="-- at/below 1 DRAM access\x00" as i64
38 cn[1]="storage-write (durable)\x00" as i64; cg[1]=95; cl[1]="-- fsync/disk bound\x00" as i64
39 cn[2]="compute f32 (matmul)\x00" as i64; cg[2]=K_MAGIC_23600; cl[2]="SSE+AVX2+FMA-4acc DONE (16.5x single-thread bit-exact, gap 236x = ~12x off single-CORE peak); remaining=register-resident acc + BARE-METAL multicore (WSL caps ~2x)\x00" as i64
40 cn[3]="memory bandwidth\x00" as i64; cg[3]=114; cl[3]="more cores (8->20)\x00" as i64
41 cn[4]="energy per op\x00" as i64; cg[4]=0-1; cl[4]="instrument RAPL on BARE METAL (unmeasurable in WSL)\x00" as i64
42 let NC: i64=5
43
44 rl_puts(" [1] PHYSICS-GAP + ENERGY loop -> research queue:\n" as *u8)
45 var tasks: i64=0
46 var atfloor: i64=0
47 var i: i64=0
48 while i<NC {
49 rl_puts(" " as *u8); rl_puts(rl_p(cn,i)); rl_puts(": " as *u8)
50 if cg[i] < 0 { rl_puts("UNMEASURED -> RESEARCH TASK: " as *u8); rl_puts(rl_p(cl,i)); rl_puts("\n" as *u8); tasks=tasks+1 }
51 else { if cg[i] > 200 { rl_puts("~" as *u8); rl_num(cg[i]/100); rl_puts("x off floor -> RESEARCH TASK [HIGH]: " as *u8); rl_puts(rl_p(cl,i)); rl_puts("\n" as *u8); tasks=tasks+1 }
52 else { if cg[i] > 100 { rl_puts("~1." as *u8); rl_num(cg[i]-100); rl_puts("x off -> research task [minor]: " as *u8); rl_puts(rl_p(cl,i)); rl_puts("\n" as *u8); tasks=tasks+1 }
53 else { rl_puts("AT/BELOW FLOOR " as *u8); rl_puts(rl_p(cl,i)); rl_puts(" -> hand to FRONTIER scan\n" as *u8); atfloor=atfloor+1 } } }
54 i=i+1
55 }
56
57 // ---- frontier candidates (for at-floor capabilities): claim, provability_x100, has-reproducible-test ----
58 let fn: *i64 = sys_mmap(8*8) as *i64
59 let fp: *i64 = sys_mmap(8*8) as *i64
60 let fr: *i64 = sys_mmap(8*8) as *i64
61 let fwhy: *i64 = sys_mmap(8*8) as *i64
62 fn[0]="photonic / optical memory (sub-ns latency)\x00" as i64; fp[0]=70; fr[0]=1; fwhy[0]="fab a cell + measure latency vs DRAM\x00" as i64
63 fn[1]="room-temp superconductor (LK-99 class)\x00" as i64; fp[1]=60; fr[1]=1; fwhy[1]="synthesize + 4-probe resistance + Meissner\x00" as i64
64 fn[2]="over-unity / free-energy device\x00" as i64; fp[2]=3; fr[2]=0; fwhy[2]="violates thermodynamics; NO reproducible test\x00" as i64
65 fn[3]="UAP exotic metamaterial / propulsion\x00" as i64; fp[3]=35; fr[3]=1; fwhy[3]="IF a sample exists: spectroscopy + isotope ratio reproducible\x00" as i64
66 let NF: i64=4
67 let GATE: i64=50
68
69 rl_puts("\n [2] FRONTIER scan (provability-gated; for capabilities at the published limit):\n" as *u8)
70 var reproduce: i64=0
71 var monitor: i64=0
72 var filtered: i64=0
73 i=0
74 while i<NF {
75 rl_puts(" " as *u8); rl_puts(rl_p(fn,i)); rl_puts(" (prov=" as *u8); rl_num(fp[i]); rl_puts("%): " as *u8)
76 if fr[i]==1 { if fp[i]>=GATE { rl_puts("REPRODUCE -> task: " as *u8); rl_puts(rl_p(fwhy,i)); rl_puts("\n" as *u8); reproduce=reproduce+1 }
77 else { rl_puts("MONITOR + provability-watch (testable but low-confidence): " as *u8); rl_puts(rl_p(fwhy,i)); rl_puts("\n" as *u8); monitor=monitor+1 } }
78 else { rl_puts("FILTERED to monitor-only (no reproducible test): " as *u8); rl_puts(rl_p(fwhy,i)); rl_puts("\n" as *u8); filtered=filtered+1 }
79 i=i+1
80 }
81
82 rl_puts("\n AUTONOMOUS QUEUE: " as *u8); rl_num(tasks); rl_puts(" physics/energy research tasks + " as *u8); rl_num(reproduce); rl_puts(" frontier REPRODUCTIONS | " as *u8); rl_num(monitor); rl_puts(" provability-watch + " as *u8); rl_num(filtered); rl_puts(" filtered-unfalsifiable\n" as *u8)
83 rl_puts(" TOP PRIORITY (largest measured gap): compute f32 ~236x off physics (SSE 4.5x -> AVX2 8.4x -> FMA-4acc 16.5x single-thread, all bit-exact, gap 4335x->236x = ~12x off single-CORE peak); CORRECTED by measurement: compute-bound (not bandwidth) at our sizes; remaining = register-resident accumulator + BARE-METAL multicore (WSL caps scaling ~2x)\n\n" as *u8)
84
85 var pass: i64=0
86 var ttl: i64=0
87 ttl=ttl+1; rl_puts(" T1 physics gaps autonomously emit research tasks (incl compute, the biggest): " as *u8); if tasks>=2 { pass=pass+1; rl_puts("PASS\n" as *u8) } else { rl_puts("FAIL\n" as *u8) }
88 ttl=ttl+1; rl_puts(" T2 at-floor capabilities trigger the frontier scan: " as *u8); if atfloor>=1 { pass=pass+1; rl_puts("PASS\n" as *u8) } else { rl_puts("FAIL\n" as *u8) }
89 ttl=ttl+1; rl_puts(" T3 provability gate: reproducibles pursued, unfalsifiable (over-unity) FILTERED: " as *u8); if reproduce>=2 { if filtered>=1 { pass=pass+1; rl_puts("PASS\n" as *u8) } else { rl_puts("FAIL\n" as *u8) } } else { rl_puts("FAIL\n" as *u8) }
90 ttl=ttl+1; rl_puts(" T4 borderline-but-testable (UAP-class) -> provability-watch, not committed nor discarded: " as *u8); if monitor>=1 { pass=pass+1; rl_puts("PASS\n" as *u8) } else { rl_puts("FAIL\n" as *u8) }
91
92 rl_puts("NX-RESEARCH-LOOP-GATE passed " as *u8); rl_num(pass); rl_puts("/" as *u8); rl_num(ttl)
93 if pass==ttl { rl_puts(" verdict=GREEN (autonomous physics+energy loop drives research; frontier scanned with a try-to-reproduce gate)\n" as *u8); sys_exit(0); return 0 }
94 rl_puts(" verdict=RED\n" as *u8); sys_exit(1); return 1
95}