code wiki / _hdl_build / nx_battery_grade.nx
nx_battery_grade.nx
buildroot/runtime/_hdl_build/nx_battery_grade.nx
about
nx_battery_grade.nx -- THE UNIVERSAL ANSWER-KEY JUDGE, Nishi first byte up (operator oracle-only law).
One generic grader for every key-scored battery on the model card: F786 reasoning/chat MCQ,
F788 agentic tool-choice, F789 factuality QA. A SEAT or ORACLE only ever writes answer rows;
THIS organ owns the join, the contract and the score -- so a graded number can never be
self-asserted by the thing being measured.
key plane row : id<TAB>expected<TAB>[note] (the answer key)
answer plane row : id<TAB>given<TAB>[epoch]<TAB>[actor] (seat/oracle-written via nx_store_put;
id-replace = dedup at the store layer)
contract: exact string match on col1; UNANSWERED COUNTS AS WRONG (coverage cannot inflate the
score); zero answer rows -> verdict=UNMEASURED (fabrication has no code path); empty key ->
verdict=RED fail-loud. score_pct = correct*100/total-keys. Atomic publish to <outpath>.
nx_battery_grade <keyprefix> <ansprefix> <outpath>
expect_exit: 0 (GREEN|UNMEASURED) | 1 RED | 2 usage license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 3 imports · 0 importers
imports: nx_store_seed_lib.nxnx_seg_store.nxnx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 22 | const KG_CAP: i64 = 1048576 |
| 23 | const KG_OCAP: i64 = 8192 |
| 24 | const KG_PATHCAP: i64 = 256 |
| 25 | const KG_TAB: i64 = 9 |
| 26 | const KG_NL: i64 = 10 |
| 27 | const KG_STDERR: i64 = 2 |
| 28 | const KG_MODE: i64 = 0x1a4 |
| 29 | const KG_D0: i64 = 48 |
| 30 | const KG_B10: i64 = 10 |
| 31 | const KG_NUMB: i64 = 24 |
| 32 | const KG_EXIT_RED: i64 = 1 |
| 33 | const KG_EXIT_USAGE: i64 = 2 |
functions
| 35 | func kg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } called by 1: kg_werr |
| 36 | func kg_werr(s: *u8) -> i64 { sys_write(KG_STDERR, s, kg_slen(s)); return 0 } |
| 37 | func kg_cat(d: *u8, off: i64, s: *u8) -> i64 called by 1: main |
| 43 | func kg_catn(d: *u8, off: i64, v: i64) -> i64 |
| 56 | func kg_eol(buf: *u8, n: i64, i: i64) -> i64 |
| 63 | func kg_eof(buf: *u8, le: i64, i: i64) -> i64 |
| 69 | func kg_slice_eq(a: *u8, as1: i64, ae: i64, b: *u8, bs: i64, be: i64) -> i64 |
| 78 | func kg_lookup(ab: *u8, an: i64, kb: *u8, ida: i64, idb: i64) -> i64 |
| 99 | func main(argc: i64, argv: *i64) -> i64 |