code wiki / _hdl_build / nx_analyst_register.nx
nx_analyst_register.nx source
↩ module page · 55 lines · 5837 B
1// nx_analyst_register.nx -- GOVERNED registration of the NISHI ANALYST organ + its roster seat.
2// Engineer gate = the three elfs built THIS invocation (analyst gate 18/18, case 001 8/8, roster
3// 7/7 incl. the analyst-blur guard) all exit 0; Council admits; Librarian allocs via cl_next_idx
4// (never a manual idx -- the collision lesson) + dual-writes live+journal. license_tier: ORIGINAL
5import "nx_cap_register.nx"
6import "nx_capreg_librarian.nx"
7import "nx_syscalls.nx"
8
9func anr_run(path: *u8) -> i64 {
10 let pid: i64 = sys_fork()
11 if pid == 0 {
12 let dn: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4)
13 if dn >= 0 { sys_dup3(dn, 1, 0); sys_dup3(dn, 2, 0) }
14 let argv: *i64 = sys_mmap(32) as *i64; argv[0] = path as i64; argv[1] = 0
15 let envp: *i64 = sys_mmap(16) as *i64; envp[0] = 0
16 sys_execve(path, argv, envp); sys_exit(127)
17 }
18 let st: *i64 = sys_mmap(16) as *i64
19 sys_wait4(pid, st, 0)
20 return st[0]
21}
22
23func main() -> i64 {
24 var allok: i64 = 1
25 if anr_run("/tmp/nx_analyst_gate.sov.elf" as *u8) != 0 { allok = 0 }
26 if anr_run("/tmp/nx_analyst_case_ac.sov.elf" as *u8) != 0 { allok = 0 }
27 if anr_run("/tmp/nx_roster_full_test.sov.elf" as *u8) != 0 { allok = 0 }
28 cr_w(1, "ENGINEER: analyst gate + case 001 + roster(analyst seat) all-pass=" as *u8); cr_wn(1, allok); cr_w(1, "\n" as *u8)
29 let eng: i64 = ig_engineer(1, 1, 1, allok)
30 let dec: i64 = ig_decision(eng, ig_council(eng, 1, 1, 2), 1)
31 if dec != IG_INGEST { cr_w(1, "HELD\n" as *u8); sys_exit(1) }
32 if cr_can_register(5, 2, 6, dec) != 1 { cr_w(1, "REFUSED\n" as *u8); sys_exit(1) }
33 let lp: *u8 = "/tmp/nishi_cap_registry.log" as *u8
34 let jp: *u8 = "knowledge/status/cap_registry_durable.log" as *u8
35
36 let idx1: i64 = cl_next_idx(lp, jp)
37 let ok1: i64 = cl_register_dual(lp, jp, idx1, 5,
38 2, "GEN NISHI-ANALYST V0 (arc=ANALYST; the market-researcher renamed + given its real job: EXPLAIN). Operator: 'determine why an AC is so expensive when it is simpler than a computer -- REAL answers, not regurgitated media common-wisdom; trace supply chain, labor, benchmark, find the shenanigans.' nx_analyst.nx = deterministic cost-ledger trace organ: parent/value/kind ledgers where every node EARNED its number (NARRATIVE=uncorroborated claim NEVER admitted as cost -> becomes a Researcher fetch-task; MEASURED=>=2 independent sources; DERIVED=computed from measured children); ledger must CLOSE arithmetically (an_closure_fails, ppm tolerance); the UNEXPLAINED RESIDUAL is computed + NAMED never smoothed (that is where margin-stacking lives); verdicts deterministic EXPLAINED/SHENANIGAN/UNDERTRACED/BROKEN; paradox lens an_paradox_q10 turns 'simpler yet pricier' from a vibe into a measured per-complexity ratio. ENGINEER gate nx_analyst_gate 18/18 sovereign GREEN (4 verdicts fire for the right reasons, common-wisdom tamper RED, arithmetic-break tamper RED, double-count guard, hand-computed paradox KAT, determinism x2) + durable anchor analyst_gate.log wired as Examiner arc row ANALYST (10/10 arcs gated-green). Researcher GATHERS (V_RESEARCH), Analyst EXPLAINS (V_ANALYZE) -- clean partition" as *u8)
39 if ok1 != 1 { cr_w(1, "DUAL-WRITE-1 FAILED\n" as *u8); sys_exit(1) }
40 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, idx1); cr_w(1, " REGISTERED -- ANALYST organ\n" as *u8)
41
42 let idx2: i64 = cl_next_idx(lp, jp)
43 let ok2: i64 = cl_register_dual(lp, jp, idx2, 5,
44 2, "GEN ANALYST-CASE-001 AC-vs-PC (first real case through the Analyst organ). Question: why does an installed 3-ton central AC cost $5,750 when a MORE complex desktop costs $800? TRACED LEDGER (corroborated >=2 sources/row, US 2025): equipment-at-distributor $2100 [acdirect/hvacdirect], materials+disposal $300, burdened labor $1050 (DERIVED -- the one un-corroborated row, fetch-task owed), contractor gross margin $2300 (~40% installs [profitabilitypartners/simpro 200+ P&Ls]). Ledger CLOSES, 0 narrative admitted, coverage 817 permil, residual 182 permil -> VERDICT=SHENANIGAN (named not smoothed). FINDINGS the trace supports: machine = only 37% of price; gatekept distribution (consumer cannot buy at distributor price); mandatory pro-install bundles a 40%-gross-margin service on every unit; AC service/margin layer ~7x the PC margin layer (Dell CSG 6.1% / HP PS 4.5-5.5% FY2025 SEC); paradox q10=98124 (~96x pricier per unit complexity). Common wisdoms KILLED by the mechanism: refrigerant-cost + raw-materials-inflation = narrative nodes, 0 admitted. 8/8 self-checks sovereign; report knowledge/status/analyst_ac_vs_pc.log; fetch-tasks T1 BLS-labor T2 part-counts T3 live-fetch-S1-S8-own-TLS = rung A1 debt (delegated fetch+extract is the honest boundary)" as *u8)
45 if ok2 != 1 { cr_w(1, "DUAL-WRITE-2 FAILED\n" as *u8); sys_exit(1) }
46 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, idx2); cr_w(1, " REGISTERED -- Case 001 AC-vs-PC\n" as *u8)
47
48 let idx3: i64 = cl_next_idx(lp, jp)
49 let ok3: i64 = cl_register_dual(lp, jp, idx3, 4,
50 2, "CON ROSTER-ANALYST-SEAT -- the 20-role roster updated: MARKET-RESEARCHER=FIND-OPPORTUNITY renamed ANALYST=EXPLAIN (verb id 19 kept, partition stays clean; opportunity-finding is one INPUT to the role, EXPLAIN is its verb). nx_roster_full_test now 7/7 (was 6/6): new T7 = analyst-blur guard -- EXPLAIN distinct from SEARCH/JUDGE/AUDIT and folding the Analyst back into the Researcher is CAUGHT as exactly one conflating pair (the same honesty pattern that guards Racing/Referee). 20 roles, 0 conflating pairs, eval-cluster distinct, roster-clean=1 sovereign GREEN. Supersedes the MARKET-RESEARCHER seat in CAPREG233" as *u8)
51 if ok3 != 1 { cr_w(1, "DUAL-WRITE-3 FAILED\n" as *u8); sys_exit(1) }
52 cr_w(1, "CAPREG idx=" as *u8); cr_wn(1, idx3); cr_w(1, " REGISTERED -- roster ANALYST seat\n" as *u8)
53 sys_exit(0)
54 return 0
55}