code wiki / _hdl_build / nx_honesty_grade_lib.nx

nx_honesty_grade_lib.nx source

↩ module page · 88 lines · 4774 B

1// nx_honesty_grade_lib.nx -- the CYNICAL BAR, shared. Operator directive 2026-07-24: "our graders and 2// judges and census are way too positive about our capabilities ... I want them almost cynical ... to 3// correct the optimism that bleeds in on your side ... or at least incredibly accurate." Root cause: an 4// instrument's author (me) is optimistic about the author's own work, and every grader re-invents its own 5// generous PRESENT bar ("a gate passed on SYNTHETIC data" => "capability PRESENT"). This library is the ONE 6// skeptical bar all graders import so the optimism cannot be re-introduced per-instrument. 7// 8// THE DISCIPLINE (import and call hg_grade instead of awarding a level directly): 9// * DEFAULT SKEPTICAL: the unproven/unknown level is HG_ABSENT(0), never PRESENT. Burden of proof is on 10// the optimistic claim, not on the doubter. 11// * A claim is HONORED ONLY UP TO WHAT ITS EVIDENCE SUPPORTS. hg_grade(claimed, evidence) DOWNGRADES a 12// claim whose evidence carries a stub-tell -- so wording can never lift a toy to REAL/PARTIAL. 13// * levels: 0 ABSENT (nothing real) | 1 STUB (a gate passes on synthetic data; unusable at scale) | 14// 2 PARTIAL (real + usable, sub-incumbent scale) | 3 REAL (production-grade AND live vs 15// non-synthetic reality). "gate passes on synthetic" is capped at STUB, PERIOD. 16// No main, no syscalls -> any grader/census/judge imports it. license_tier: ORIGINAL 17 18const HG_ABSENT: i64 = 0 19const HG_STUB: i64 = 1 20const HG_PARTIAL: i64 = 2 21const HG_REAL: i64 = 3 22 23func hg_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } 24func hg_contains(h: *u8, nd: *u8) -> i64 { 25 let hl: i64=hg_slen(h); let nl: i64=hg_slen(nd) 26 if nl==0 { return 0 } 27 var i: i64=0 28 while i+nl<=hl { 29 var k: i64=0; var hit: i64=1 30 while k<nl { if h[i+k]!=nd[k] { hit=0; k=nl } else { k=k+1 } } 31 if hit==1 { return 1 } 32 i=i+1 33 } 34 return 0 35} 36 37// A stub-tell is any phrase in the EVIDENCE that betrays the claim is not production-grade. This is the 38// shared cynicism: one list, so no instrument can quietly omit it. Extend deliberately, never trim. 39func hg_stub_tell(ev: *u8) -> i64 { 40 if hg_contains(ev,"synthetic" as *u8)==1 { return 1 } 41 if hg_contains(ev,"lexicon" as *u8)==1 { return 1 } 42 if hg_contains(ev,"stand-in" as *u8)==1 { return 1 } 43 if hg_contains(ev,"standin" as *u8)==1 { return 1 } 44 if hg_contains(ev,"in-memory" as *u8)==1 { return 1 } 45 if hg_contains(ev,"demo" as *u8)==1 { return 1 } 46 if hg_contains(ev,"mock" as *u8)==1 { return 1 } 47 if hg_contains(ev,"stub" as *u8)==1 { return 1 } 48 if hg_contains(ev,"placeholder" as *u8)==1 { return 1 } 49 if hg_contains(ev,"hardcoded" as *u8)==1 { return 1 } 50 if hg_contains(ev,"hard-coded" as *u8)==1 { return 1 } 51 if hg_contains(ev,"toy" as *u8)==1 { return 1 } 52 if hg_contains(ev,"model of" as *u8)==1 { return 1 } 53 if hg_contains(ev,"no real" as *u8)==1 { return 1 } 54 if hg_contains(ev,"0 real" as *u8)==1 { return 1 } 55 if hg_contains(ev,"not yet" as *u8)==1 { return 1 } 56 if hg_contains(ev,"single-box" as *u8)==1 { return 1 } 57 if hg_contains(ev,"single box" as *u8)==1 { return 1 } 58 return 0 59} 60 61// A REAL claim additionally requires a POSITIVE non-synthetic proof token -- being free of stub-tells is 62// not enough; the evidence must actively cite reality (live/production/real-user/measured-vs-incumbent). 63func hg_has_real_proof(ev: *u8) -> i64 { 64 if hg_contains(ev,"live" as *u8)==1 { return 1 } 65 if hg_contains(ev,"production" as *u8)==1 { return 1 } 66 if hg_contains(ev,"real user" as *u8)==1 { return 1 } 67 if hg_contains(ev,"real-user" as *u8)==1 { return 1 } 68 if hg_contains(ev,"measured vs" as *u8)==1 { return 1 } 69 if hg_contains(ev,"cert-validated" as *u8)==1 { return 1 } 70 if hg_contains(ev,"over the wire" as *u8)==1 { return 1 } 71 return 0 72} 73 74// THE GATE: return the HONEST level for a claim, applying skepticism. claimed is what the author WANTS; 75// the return is what the EVIDENCE earns. Downgrades dominate; nothing is ever upgraded. 76func hg_grade(claimed: i64, ev: *u8) -> i64 { 77 var lvl: i64 = claimed 78 if lvl < HG_ABSENT { lvl = HG_ABSENT } 79 if lvl > HG_REAL { lvl = HG_REAL } 80 // any stub-tell caps the claim at STUB, no matter what was claimed 81 if hg_stub_tell(ev)==1 { if lvl > HG_STUB { lvl = HG_STUB } } 82 // REAL demands an active non-synthetic proof; absent it, cap at PARTIAL 83 if lvl==HG_REAL { if hg_has_real_proof(ev)==0 { lvl = HG_PARTIAL } } 84 return lvl 85} 86 87// production-readiness per-mille from a level sum over n items (max 3 each). Honest denominator. 88func hg_readiness(sum: i64, n: i64) -> i64 { if n<=0 { return 0 } return (sum*1000)/(3*n) }