code wiki / _hdl_build / nx_examiner_report.nx
nx_examiner_report.nx source
↩ module page · 89 lines · 6389 B
1// nx_examiner_report.nx -- the EXAMINER self-grades the team (the grading cluster's last NO-EVIDENCE
2// role). ANTICHEAT BY CONSTRUCTION: the Examiner does NOT invent grades -- it aggregates ONLY the
3// hard evidence OTHER roles already produced in durable logs (the Auditor's maturity levels, the
4// Critic's countersign, the bench's mechanically-issued verdicts, the proof ledger). Any source that
5// is ABSENT is reported "ungraded -- no evidence", never a number. Output: a durable EXAMINER report
6// to knowledge/status/examiner_report.log + an honest team verdict. Sovereign-buildable (syscalls).
7// license_tier: ORIGINAL
8import "nx_syscalls.nx"
9const K_MAGIC_2097168: i64 = 2097168
10const K_MAGIC_2097152: i64 = 2097152
11func _p(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
12func _pn(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=48+(m%10);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(1,bb,k); return 0 }
13func _fp(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 }
14func _fn(fd: i64, v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m}; let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48;k=1}; while m>0{t[k]=48+(m%10);m=m/10;k=k+1}; var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1}; sys_write(fd,bb,k); return 0 }
15func ex_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
16func ex_read(path: *u8, buf: *u8, cap: i64) -> i64 {
17 let fd: i64 = sys_openat_rd(path)
18 if fd < 0 { return 0 - 1 }
19 var n: i64 = 0
20 var go: i64 = 1
21 while go == 1 { let base: i64 = buf as i64; let r: i64 = sys_read(fd, (base + n) as *u8, cap - n); if r <= 0 { go = 0 } else { n = n + r } if n >= cap { go = 0 } }
22 sys_close(fd)
23 return n
24}
25func ex_has(buf: *u8, n: i64, pat: *u8) -> i64 {
26 let pl: i64 = ex_slen(pat)
27 var i: i64 = 0
28 while i + pl <= n { var k: i64 = 0; var hit: i64 = 1; while k < pl { if buf[i+k] != pat[k] { hit = 0; k = pl } else { k = k + 1 } } if hit == 1 { return 1 } i = i + 1 }
29 return 0
30}
31func ex_count(buf: *u8, n: i64, pat: *u8) -> i64 {
32 let pl: i64 = ex_slen(pat)
33 var i: i64 = 0
34 var c: i64 = 0
35 while i + pl <= n { var k: i64 = 0; var hit: i64 = 1; while k < pl { if buf[i+k] != pat[k] { hit = 0; k = pl } else { k = k + 1 } } if hit == 1 { c = c + 1 } i = i + 1 }
36 return c
37}
38// one examined dimension: cite a source fact (found/absent) + the derived grade word
39func ex_line(lfd: i64, dim: *u8, source: *u8, found: i64, grade: *u8) -> i64 {
40 _p(" " as *u8); _p(dim); _p(": " as *u8)
41 if found == 1 { _p(grade); _p(" (from " as *u8); _p(source); _p(")\n" as *u8) }
42 else { _p("ungraded -- no evidence (" as *u8); _p(source); _p(")\n" as *u8) }
43 _fp(lfd, "EXAMINER dim=" as *u8); _fp(lfd, dim)
44 _fp(lfd, " grade=" as *u8); if found == 1 { _fp(lfd, grade) } else { _fp(lfd, "UNGRADED" as *u8) }
45 _fp(lfd, " source=" as *u8); _fp(lfd, source); _fp(lfd, "\n" as *u8)
46 return found
47}
48func main() -> i64 {
49 _p("=== EXAMINER SELF-GRADE (aggregates OTHER roles' durable evidence; never self-asserts) ===\n" as *u8)
50 let buf: *u8 = sys_mmap(K_MAGIC_2097168)
51 let lfd: i64 = sys_openat_append("knowledge/status/examiner_report.log" as *u8, 0x1a4)
52 if lfd < 0 { _p(" examiner log open failed\n" as *u8); sys_exit(1); return 1 }
53 _fp(lfd, "EXAMINER-RUN epoch=" as *u8); _fn(lfd, sys_now_realtime_sec()); _fp(lfd, "\n" as *u8)
54 var graded: i64 = 0
55 // 1. synthesis: the bench's mechanically-issued EXCEED verdict (the one genuine S-class-exceed)
56 var n: i64 = ex_read("knowledge/status/synth_bench.log" as *u8, buf, K_MAGIC_2097152)
57 let exceed: i64 = 0 + ex_has(buf, n, "S-CLASS-EXCEED-ACHIEVED" as *u8)
58 graded = graded + ex_line(lfd, "code-synthesis" as *u8, "synth_bench.log" as *u8, exceed, "S-CLASS-EXCEED (vs Claude, blind suite)" as *u8)
59 // 2. security: the Auditor's maturity summary (honest PRODUCTION ceiling)
60 n = ex_read("knowledge/status/maturity_audit.log" as *u8, buf, K_MAGIC_2097152)
61 let secprod: i64 = 0 + ex_has(buf, n, "highest=PRODUCTION" as *u8)
62 graded = graded + ex_line(lfd, "security-stack" as *u8, "maturity_audit.log" as *u8, secprod, "PRODUCTION (no triangulation = not S-class, honest)" as *u8)
63 // 3. claims integrity: the Critic countersigned the verdicts
64 n = ex_read("knowledge/status/critic_log.log" as *u8, buf, K_MAGIC_2097152)
65 let counter: i64 = 0 + ex_has(buf, n, "COUNTERGRADE verdicts=STAND" as *u8)
66 graded = graded + ex_line(lfd, "claims-integrity" as *u8, "critic_log.log" as *u8, counter, "COUNTERSIGNED (Critic confirmed the verdicts)" as *u8)
67 // 4. provability: the proof ledger held all claims
68 n = ex_read("knowledge/status/proof_ledger.log" as *u8, buf, K_MAGIC_2097152)
69 let hold: i64 = 0 + ex_has(buf, n, "ALL-CLAIMS-HOLD" as *u8)
70 graded = graded + ex_line(lfd, "provability" as *u8, "proof_ledger.log" as *u8, hold, "ALL-CLAIMS-HOLD (every grader re-proves green)" as *u8)
71 // 5. site quality: the gate's 1000-permil
72 n = ex_read("knowledge/status/site_quality.log" as *u8, buf, K_MAGIC_2097152)
73 let q1000: i64 = 0 + ex_has(buf, n, "permil=1000" as *u8)
74 graded = graded + ex_line(lfd, "site-quality" as *u8, "site_quality.log" as *u8, q1000, "PRODUCTION (NN/g+WCAG 13/13)" as *u8)
75 // honest team verdict
76 _p(" --- TEAM VERDICT (Examiner): " as *u8); _pn(graded); _p("/5 dimensions evidence-graded; " as *u8)
77 if exceed == 1 { _p("1 mechanically-issued EXCEED (synthesis); the rest PRODUCTION -- NOT broad S-class. Honest.\n" as *u8) }
78 else { _p("no EXCEED evidence found.\n" as *u8) }
79 _fp(lfd, "EXAMINER-VERDICT dimensions_graded=" as *u8); _fn(lfd, graded)
80 _fp(lfd, " exceed_count=" as *u8); _fn(lfd, exceed)
81 _fp(lfd, " honest_note=one-exceed-synthesis-rest-production-not-broad-sclass\n" as *u8)
82 sys_close(lfd)
83 _p(" Examiner durable output: knowledge/status/examiner_report.log\n" as *u8)
84 // gate: at least 4 of 5 dimensions must have evidence (else the team's self-exam is hollow)
85 if graded >= 4 { sys_exit(0); return 0 }
86 _p(" SELF-EXAM HOLLOW (too few dimensions have durable evidence)\n" as *u8)
87 sys_exit(1)
88 return 1
89}