code wiki / _hdl_build / nx_stackaudit_census.nx
nx_stackaudit_census.nx source
↩ module page · 53 lines · 3005 B
1// nx_stackaudit_census.nx -- CLI: the sovereign full-stack auditor. ONE re-runnable command that
2// re-derives the rung-by-rung stack audit (R0 silicon .. R12 team/autonomy) from REAL evidence logs,
3// prints the rows, appends a durable STACKCENSUS ledger line, and emits web_assets/stack_audit.html.
4// Replaces the Claude-session audit with a standing organ: no Claude in the loop, measured never
5// asserted. Verdict GREEN unless the anti-rot liar-kill fires (a rung's EXPECTED evidence log is
6// missing/unparseable -- rot screams instead of silently greening). Rung REDs (e.g. funcheck's live
7// andelinwest FAIL, llm_capability's ENGINE-not-BRAIN) are honest readings, not census failures.
8// ARGV-FREE (nx_sov_build_run drops argv): all paths are consts in nx_stackaudit_lib.
9// license_tier: ORIGINAL
10import "nx_stackaudit_lib.nx"
11
12func main(argc: i64, argv: *i64) -> i64 {
13 _p("=== NISHI STACK AUDIT -- 1s and 0s up, sourced from knowledge/status/, measured never asserted ===\n" as *u8)
14 let out: *i64 = sys_mmap(128) as *i64
15 let verdict: i64 = sax_census(0, 1, out)
16 let pv: i64 = sax_emit_page(0, SAX_PAGE)
17 let lfd: i64 = sys_openat_append(SAX_LOG, 0x1a4)
18 if lfd >= 0 {
19 _fp(lfd, "STACKCENSUS epoch=" as *u8); _fn(lfd, sys_now_realtime_sec())
20 _fp(lfd, " rungs=" as *u8); _fn(lfd, out[0])
21 _fp(lfd, " green=" as *u8); _fn(lfd, out[1])
22 _fp(lfd, " red=" as *u8); _fn(lfd, out[2])
23 _fp(lfd, " measured=" as *u8); _fn(lfd, out[3])
24 _fp(lfd, " unknown=" as *u8); _fn(lfd, out[4])
25 _fp(lfd, " conflicts=" as *u8); _fn(lfd, out[5])
26 _fp(lfd, " triangulated=" as *u8); _fn(lfd, out[8])
27 _fp(lfd, " tri_conflict=" as *u8); _fn(lfd, out[9])
28 _fp(lfd, " single_src=" as *u8); _fn(lfd, out[10])
29 _fp(lfd, " avg_permil=" as *u8); _fn(lfd, out[6])
30 _fp(lfd, " coverage=" as *u8); _fn(lfd, out[0] - out[4])
31 _fp(lfd, "/" as *u8); _fn(lfd, out[0])
32 _fp(lfd, " page=" as *u8)
33 if pv >= 0 { _fp(lfd, "written" as *u8) } else { _fp(lfd, "skip" as *u8) }
34 _fp(lfd, " src=knowledge/status verdict=" as *u8)
35 if verdict == 0 { _fp(lfd, "GREEN" as *u8) } else { _fp(lfd, "RED" as *u8) }
36 _fp(lfd, "\n" as *u8)
37 sys_close(lfd)
38 }
39 _p("\n SUMMARY rungs=" as *u8); _fn(1, out[0])
40 _p(" green=" as *u8); _fn(1, out[1])
41 _p(" red=" as *u8); _fn(1, out[2])
42 _p(" measured=" as *u8); _fn(1, out[3])
43 _p(" unknown=" as *u8); _fn(1, out[4])
44 _p(" conflicts=" as *u8); _fn(1, out[5])
45 _p(" triangulated=" as *u8); _fn(1, out[8])
46 _p(" tri_conflict=" as *u8); _fn(1, out[9])
47 _p(" single_src=" as *u8); _fn(1, out[10])
48 _p(" avg_permil=" as *u8); _fn(1, out[6])
49 _p("\n durable: knowledge/status/stack_census.log page: web_assets/stack_audit.html verdict=" as *u8)
50 if verdict == 0 { _p("GREEN\n" as *u8) } else { _p("RED (anti-rot liar-kill: expected evidence missing)\n" as *u8) }
51 sys_exit(verdict)
52 return verdict
53}