code wiki / _hdl_build / nx_model_card.nx

nx_model_card.nx source

↩ module page · 400 lines · 19136 B

1// nx_model_card.nx -- F785 THE SOVEREIGN MODEL CARD RENDERER (operator 2026-07-20: "model card like 2// Inkling with all the same measurements and breakdowns to comp as we build our capabilities against 3// these models ... nishi sovereign information plane ... emit and publish and host this card from the 4// first byte up natively as capability and keep it fresh"). 5// PURE RENDERER: every byte of content comes from the sovereign plane knowledge/store/modelcard- 6// (25 bench + 10 property + 7 prose + 1 meta rows, hist- provenance) plus the LIVE measured 7// SWE-bench-analog source sites/nishifamily/compare/autograde/api.json -- the b05 NISHI cell is 8// substituted at emit time (keep-it-fresh from the source, never a frozen number). 9// HONESTY BY CONSTRUCTION: a NISHI cell renders MEASURED (green, live artifact) / ANALOG (orange, 10// not head-to-head) / UNMEASURED:F-rung (gray, harness filed) -- fabrication has no code path. 11// nx_model_card -> ATOMIC emit to sites/nishifamily/modelcard.html (beat mode) 12// nx_model_card emit <outpath> -> ATOMIC emit (tmp + renameat) to <outpath> 13// nx_model_card selftest -> in-memory emit + substring teeth, exit 0/3 14// ENVELOPE (declared): plane cap 1MiB, out cap 512KiB, 16-col rows; plane content is 15// operator-trusted (no HTML-escape pass; plane vocabulary carries no < > &). 16// license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0 17import "nx_store_seed_lib.nx" 18import "nx_seg_store.nx" 19import "nx_syscalls.nx" 20import "nx_estate_path.nx" // ep_anchor: the CWD must not decide this organ's verdict 21import "nx_html_head.nx" // seq702: the ONE accessible head; migrate-on-touch 22 23const MC_PREFIX: *u8 = "knowledge/store/modelcard-" as *u8 24const MC_APIJSON: *u8 = "sites/nishifamily/compare/autograde/api.json" as *u8 25const MC_NL: i64 = 10 26const MC_TAB: i64 = 9 27const MC_DASH: i64 = 45 28const MC_ZERO: i64 = 48 29const MC_NINE: i64 = 57 30const MC_BASE10: i64 = 10 31const MC_STDERR: i64 = 2 32const MC_PLANECAP: i64 = 1048576 33const MC_OUTCAP: i64 = 524288 34const MC_SLACK: i64 = 4096 35const MC_SPB: i64 = 256 36const MC_PAIR: i64 = 2 37const MC_NCOLMAX: i64 = 16 38const MC_MODE: i64 = 0x1a4 39const MC_TMPB: i64 = 28 40const MC_UCAP: i64 = 16 41const MC_PATHCAP: i64 = 512 42const MC_ANSOFF: i64 = 10 43const MC_GENOFF: i64 = 17 44const MC_C_AXIS: i64 = 1 45const MC_C_BENCH: i64 = 2 46const MC_C_UNIT: i64 = 3 47const MC_C_INK: i64 = 4 48const MC_C_MFIRST: i64 = 4 49const MC_C_MLAST: i64 = 12 50const MC_C_NISHI: i64 = 13 51const MC_C_NOTE: i64 = 14 52const MC_NCOL: i64 = 15 53const MC_IDX_VERB: i64 = 1 54const MC_IDX_OUT: i64 = 2 55const MC_ARGC_VERB: i64 = 2 56const MC_ARGC_OUT: i64 = 3 57const MC_S: i64 = 115 58const MC_EXIT_EMPTY: i64 = 1 59const MC_EXIT_SELF: i64 = 3 60const MC_MINBYTES: i64 = 12000 61 62func mc_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } 63func mc_werr(s: *u8) -> i64 { sys_write(MC_STDERR, s, mc_slen(s)); return 0 } 64func mc_puts(b: *u8, off: i64, s: *u8) -> i64 { 65 var o: i64 = off 66 var j: i64 = 0 67 while s[j] != (0 as u8) { b[o] = s[j]; o = o + 1; j = j + 1 } 68 return o 69} 70func mc_putsl(b: *u8, off: i64, q: *u8, a: i64, e: i64) -> i64 { 71 var o: i64 = off 72 var i: i64 = a 73 while i < e { b[o] = q[i]; o = o + 1; i = i + 1 } 74 return o 75} 76func mc_puti(b: *u8, off: i64, v: i64) -> i64 { 77 var o: i64 = off 78 var m: i64 = v 79 if m < 0 { b[o] = MC_DASH as u8; o = o + 1; m = 0 - m } 80 let t: *u8 = sys_mmap(MC_TMPB) as *u8 81 var k: i64 = 0 82 if m == 0 { t[0] = MC_ZERO as u8; k = 1 } 83 while m > 0 { t[k] = (MC_ZERO + (m % MC_BASE10)) as u8; m = m / MC_BASE10; k = k + 1 } 84 var i: i64 = 0 85 while i < k { b[o] = t[k - 1 - i]; o = o + 1; i = i + 1 } 86 return o 87} 88func mc_cols(q: *u8, ls: i64, le: i64, sp: *i64) -> i64 { 89 var c: i64 = 0 90 var p: i64 = ls 91 while c < MC_NCOLMAX { 92 var e: i64 = p 93 var s: i64 = 1 94 while s == 1 { if e >= le { s = 0 } else { if q[e] == (MC_TAB as u8) { s = 0 } else { e = e + 1 } } } 95 sp[c*MC_PAIR] = p 96 sp[c*MC_PAIR+1] = e 97 c = c + 1 98 if e >= le { return c } 99 p = e + 1 100 } 101 return c 102} 103func mc_seq(q: *u8, a: i64, b: i64, s: *u8) -> i64 { 104 let sn: i64 = mc_slen(s) 105 if b - a != sn { return 0 } 106 var i: i64 = 0 107 while i < sn { if q[a+i] != s[i] { return 0 } i = i + 1 } 108 return 1 109} 110func mc_pfx(q: *u8, a: i64, b: i64, s: *u8) -> i64 { 111 let sn: i64 = mc_slen(s) 112 if b - a < sn { return 0 } 113 var i: i64 = 0 114 while i < sn { if q[a+i] != s[i] { return 0 } i = i + 1 } 115 return 1 116} 117func mc_find(hay: *u8, n: i64, needle: *u8, from: i64) -> i64 { 118 let m: i64 = mc_slen(needle) 119 if m == 0 { return 0 - 1 } 120 var i: i64 = from 121 while i + m <= n { 122 var j: i64 = 0 123 var ok: i64 = 1 124 while j < m { if hay[i+j] != needle[j] { ok = 0; j = m } else { j = j + 1 } } 125 if ok == 1 { return i } 126 i = i + 1 127 } 128 return 0 - 1 129} 130func mc_uint(buf: *u8, p: i64, n: i64) -> i64 { 131 var i: i64 = p 132 var v: i64 = 0 133 var got: i64 = 0 134 var done: i64 = 0 135 while done == 0 { 136 if i >= n { done = 1 } 137 else { 138 let c: i64 = buf[i] as i64 139 if c >= MC_ZERO { if c <= MC_NINE { v = v * MC_BASE10 + (c - MC_ZERO); got = 1; i = i + 1 } else { done = 1 } } else { done = 1 } 140 } 141 } 142 if got == 0 { return 0 - 1 } 143 return v 144} 145func mc_note(q: *u8, qn: i64, id: *u8, u: *i64) -> i64 { 146 let sp: *i64 = sys_mmap(MC_SPB) as *i64 147 var i: i64 = 0 148 while i < qn { 149 var le: i64 = i 150 var s: i64 = 1 151 while s == 1 { if le >= qn { s = 0 } else { if q[le] == (MC_NL as u8) { s = 0 } else { le = le + 1 } } } 152 if le > i { 153 let nc: i64 = mc_cols(q, i, le, sp) 154 if nc >= MC_NCOL { if mc_seq(q, sp[0], sp[1], id) == 1 { u[0] = sp[MC_C_NOTE*MC_PAIR]; u[1] = sp[MC_C_NOTE*MC_PAIR+1]; return 1 } } 155 } 156 i = le + 1 157 } 158 return 0 159} 160func mc_prose(out: *u8, o0: i64, q: *u8, qn: i64, id: *u8, hd: *u8) -> i64 { 161 var o: i64 = o0 162 o = mc_puts(out, o, "<h2>" as *u8) 163 o = mc_puts(out, o, hd) 164 o = mc_puts(out, o, "</h2><p>" as *u8) 165 let u: *i64 = sys_mmap(MC_UCAP) as *i64 166 if mc_note(q, qn, id, u) == 1 { o = mc_putsl(out, o, q, u[0], u[1]) } else { o = mc_puts(out, o, "(missing plane row - fail-visible)" as *u8) } 167 o = mc_puts(out, o, "</p>" as *u8) 168 return o 169} 170static g_prims: i64 171// FRESHNESS LAW (round-18): a MEASURED number must be RE-DERIVED AT EMIT, never frozen in the plane -- 172// an aging green cell is a false claim. Counts entries in a JSON artifact by its per-entry anchor. 173func mc_count(buf: *u8, n: i64, needle: *u8) -> i64 { 174 let m: i64 = mc_slen(needle) 175 var c: i64 = 0 176 var p: i64 = 0 177 var go: i64 = 1 178 while go == 1 { 179 let i: i64 = mc_find(buf, n, needle, p) 180 if i < 0 { go = 0 } else { c = c + 1; p = i + m } 181 } 182 return c 183} 184func mc_nishi(out: *u8, o0: i64, q: *u8, a: i64, b: i64, lp: i64) -> i64 { 185 var o: i64 = o0 186 if mc_pfx(q, a, b, "live:prims" as *u8) == 1 { 187 if g_prims > 0 { 188 o = mc_puts(out, o, "<td class=\"me\">" as *u8) 189 o = mc_puti(out, o, g_prims) 190 o = mc_puts(out, o, " MCP primitives (live-counted at emit)</td>" as *u8) 191 return o 192 } 193 o = mc_puts(out, o, "<td class=\"un\">UNMEASURED (prim registry unreadable)</td>" as *u8) 194 return o 195 } 196 if mc_pfx(q, a, b, "live:" as *u8) == 1 { 197 if lp >= 0 { 198 o = mc_puts(out, o, "<td class=\"an\">" as *u8) 199 o = mc_puti(out, o, lp) 200 o = mc_puts(out, o, " ANALOG live</td>" as *u8) 201 return o 202 } 203 o = mc_puts(out, o, "<td class=\"un\">UNMEASURED (live source unreadable)</td>" as *u8) 204 return o 205 } 206 if mc_pfx(q, a, b, "UNMEASURED" as *u8) == 1 { 207 o = mc_puts(out, o, "<td class=\"un\">" as *u8) 208 o = mc_putsl(out, o, q, a, b) 209 o = mc_puts(out, o, "</td>" as *u8) 210 return o 211 } 212 if mc_pfx(q, a, b, "MEASURED" as *u8) == 1 { 213 o = mc_puts(out, o, "<td class=\"me\">" as *u8) 214 o = mc_putsl(out, o, q, a, b) 215 o = mc_puts(out, o, "</td>" as *u8) 216 return o 217 } 218 o = mc_puts(out, o, "<td>" as *u8) 219 o = mc_putsl(out, o, q, a, b) 220 o = mc_puts(out, o, "</td>" as *u8) 221 return o 222} 223func mc_axis(out: *u8, o0: i64, q: *u8, qn: i64, ax: *u8, hd: *u8, lp: i64) -> i64 { 224 var o: i64 = o0 225 o = mc_puts(out, o, "<h3>" as *u8) 226 o = mc_puts(out, o, hd) 227 o = mc_puts(out, o, "</h3><div class=\"wrap\"><table><tr><th>benchmark</th><th>unit</th><th>Inkling</th><th>Nemotron 3 Ultra</th><th>Kimi K2.5</th><th>Kimi K2.6</th><th>GLM 5.2</th><th>DeepSeek V4 Pro</th><th>Gemini 3.1 Pro (high)</th><th>Claude Fable 5 (max)</th><th>GPT 5.6 Sol (max/xhigh)</th><th>NISHI</th><th>notes</th></tr>" as *u8) 228 let sp: *i64 = sys_mmap(MC_SPB) as *i64 229 var found: i64 = 0 230 var i: i64 = 0 231 while i < qn { 232 var le: i64 = i 233 var s: i64 = 1 234 while s == 1 { if le >= qn { s = 0 } else { if q[le] == (MC_NL as u8) { s = 0 } else { le = le + 1 } } } 235 if le > i { 236 let nc: i64 = mc_cols(q, i, le, sp) 237 if nc >= MC_NCOL { 238 if mc_seq(q, sp[MC_C_AXIS*MC_PAIR], sp[MC_C_AXIS*MC_PAIR+1], ax) == 1 { 239 found = found + 1 240 o = mc_puts(out, o, "<tr><td class=\"nk\">" as *u8) 241 o = mc_putsl(out, o, q, sp[MC_C_BENCH*MC_PAIR], sp[MC_C_BENCH*MC_PAIR+1]) 242 o = mc_puts(out, o, "</td><td class=\"m\">" as *u8) 243 o = mc_putsl(out, o, q, sp[MC_C_UNIT*MC_PAIR], sp[MC_C_UNIT*MC_PAIR+1]) 244 o = mc_puts(out, o, "</td>" as *u8) 245 var c: i64 = MC_C_MFIRST 246 while c <= MC_C_MLAST { 247 o = mc_puts(out, o, "<td>" as *u8) 248 o = mc_putsl(out, o, q, sp[c*MC_PAIR], sp[c*MC_PAIR+1]) 249 o = mc_puts(out, o, "</td>" as *u8) 250 c = c + 1 251 } 252 o = mc_nishi(out, o, q, sp[MC_C_NISHI*MC_PAIR], sp[MC_C_NISHI*MC_PAIR+1], lp) 253 o = mc_puts(out, o, "<td class=\"m\">" as *u8) 254 o = mc_putsl(out, o, q, sp[MC_C_NOTE*MC_PAIR], sp[MC_C_NOTE*MC_PAIR+1]) 255 o = mc_puts(out, o, "</td></tr>" as *u8) 256 } 257 } 258 } 259 i = le + 1 260 } 261 if found == 0 { o = mc_puts(out, o, "<tr><td colspan=\"13\" class=\"un\">no plane rows for this axis (fail-visible)</td></tr>" as *u8) } 262 o = mc_puts(out, o, "</table></div>" as *u8) 263 return o 264} 265func mc_props(out: *u8, o0: i64, q: *u8, qn: i64) -> i64 { 266 var o: i64 = o0 267 o = mc_puts(out, o, "<div class=\"wrap\"><table><tr><th>property</th><th>Inkling</th><th>NISHI</th><th>evidence</th></tr>" as *u8) 268 let sp: *i64 = sys_mmap(MC_SPB) as *i64 269 var i: i64 = 0 270 while i < qn { 271 var le: i64 = i 272 var s: i64 = 1 273 while s == 1 { if le >= qn { s = 0 } else { if q[le] == (MC_NL as u8) { s = 0 } else { le = le + 1 } } } 274 if le > i { 275 let nc: i64 = mc_cols(q, i, le, sp) 276 if nc >= MC_NCOL { 277 if mc_seq(q, sp[MC_C_AXIS*MC_PAIR], sp[MC_C_AXIS*MC_PAIR+1], "property" as *u8) == 1 { 278 o = mc_puts(out, o, "<tr><td class=\"nk\">" as *u8) 279 o = mc_putsl(out, o, q, sp[MC_C_BENCH*MC_PAIR], sp[MC_C_BENCH*MC_PAIR+1]) 280 o = mc_puts(out, o, "</td><td>" as *u8) 281 o = mc_putsl(out, o, q, sp[MC_C_INK*MC_PAIR], sp[MC_C_INK*MC_PAIR+1]) 282 o = mc_puts(out, o, "</td>" as *u8) 283 o = mc_nishi(out, o, q, sp[MC_C_NISHI*MC_PAIR], sp[MC_C_NISHI*MC_PAIR+1], 0 - 1) 284 o = mc_puts(out, o, "<td class=\"m\">" as *u8) 285 o = mc_putsl(out, o, q, sp[MC_C_NOTE*MC_PAIR], sp[MC_C_NOTE*MC_PAIR+1]) 286 o = mc_puts(out, o, "</td></tr>" as *u8) 287 } 288 } 289 } 290 i = le + 1 291 } 292 o = mc_puts(out, o, "</table></div>" as *u8) 293 return o 294} 295 296func main(argc: i64, argv: *i64) -> i64 { 297 // ANCHOR FIRST (2026-08-04, nx_cwdguard finding): this organ reads a RELATIVE 298 // knowledge/ path, so its answer depended on where it was launched. No-op when 299 // already at the estate root, so the cron/MCP context is unchanged. 300 ep_anchor() 301 var selft: i64 = 0 302 var outp: *u8 = "sites/nishifamily/modelcard.html" as *u8 303 var have_out: i64 = 1 304 if argc >= MC_ARGC_VERB { let v: *u8 = argv[MC_IDX_VERB] as *u8; if v[0] == (MC_S as u8) { selft = 1 } } 305 if argc >= MC_ARGC_OUT { outp = argv[MC_IDX_OUT] as *u8; have_out = 1 } 306 307 let q: *u8 = sys_mmap(MC_PLANECAP) 308 let qn: i64 = sts_load(MC_PREFIX, q, MC_PLANECAP - MC_SLACK) 309 if qn <= 0 { mc_werr("modelcard plane EMPTY (seed knowledge/store/modelcard- first)\n" as *u8); sys_exit(MC_EXIT_EMPTY); return MC_EXIT_EMPTY } 310 311 var lp: i64 = 0 - 1 312 var lgen: i64 = 0 - 1 313 let lb: *i64 = sys_mmap(MC_UCAP) as *i64 314 let jb: *u8 = sys_read_file(MC_APIJSON, lb) 315 if (jb as i64) != 0 { 316 let jn: i64 = lb[0] 317 let qq: i64 = mc_find(jb, jn, "resolve rate?" as *u8, 0) 318 if qq >= 0 { let aa: i64 = mc_find(jb, jn, "\"answer\":\"" as *u8, qq); if aa >= 0 { lp = mc_uint(jb, aa + MC_ANSOFF, jn) } } 319 let gg: i64 = mc_find(jb, jn, "\"generated_unix\":" as *u8, 0) 320 if gg >= 0 { lgen = mc_uint(jb, gg + MC_GENOFF, jn) } 321 } 322 323 g_prims = 0 324 let pblen: *i64 = sys_mmap(MC_UCAP) as *i64 325 let pbuf: *u8 = sys_read_file("knowledge/store/prim_registry.json" as *u8, pblen) 326 if (pbuf as i64) != 0 { g_prims = mc_count(pbuf, pblen[0], "\"primitive_id\":\"" as *u8) } 327 328 let out: *u8 = sys_mmap(MC_OUTCAP) 329 var o: i64 = 0 330 o = nxh_head_open(out, o, "Nishi Model Card" as *u8) 331 o = mc_puts(out, o, "<style>body{background:#0b0f14;color:#d4dae3;font:15px/1.55 system-ui,sans-serif;margin:0 auto;padding:28px;max-width:1180px}h1{font-size:24px;color:#fff}h2{font-size:19px;margin-top:30px;color:#e8edf4;border-bottom:1px solid #232833;padding-bottom:6px}h3{font-size:15px;color:#9fb0c3;margin-top:18px}.m{color:#8a93a3}.note{background:#11161d;border:1px solid #232833;border-radius:8px;padding:10px 14px;font-size:13.5px;color:#aeb7c4;margin-top:10px}table{border-collapse:collapse;width:100%;font-size:12.5px;margin-top:8px}td,th{border-bottom:1px solid #232833;padding:4px 8px;text-align:left;vertical-align:top}th{color:#8a93a3;font-weight:600}.wrap{overflow-x:auto}.me{color:#3fb950;font-weight:700}.an{color:#d29922;font-weight:700}.un{color:#8a93a3}td.nk{color:#e8edf4;font-weight:600}</style>" as *u8) 332 o = nxh_body_open(out, o) 333 o = mc_puts(out, o, "<h1>Nishi Model Card</h1><p class=\"m\">generated " as *u8) 334 o = mc_puti(out, o, sys_now_realtime_sec()) 335 o = mc_puts(out, o, " &middot; derived from the sovereign plane knowledge/store/modelcard- &middot; Inkling-parity axes &middot; renderer nx_model_card (F785) &middot; live SWE-bench-analog source epoch " as *u8) 336 if lgen >= 0 { o = mc_puti(out, o, lgen) } else { o = mc_puts(out, o, "unavailable" as *u8) } 337 o = mc_puts(out, o, "</p><div class=\"note\"><b>How to read:</b> " as *u8) 338 let u: *i64 = sys_mmap(MC_UCAP) as *i64 339 if mc_note(q, qn, "s0" as *u8, u) == 1 { o = mc_putsl(out, o, q, u[0], u[1]) } else { o = mc_puts(out, o, "(missing s0)" as *u8) } 340 o = mc_puts(out, o, "</div>" as *u8) 341 o = mc_prose(out, o, q, qn, "s1" as *u8, "1 &middot; General Information" as *u8) 342 o = mc_puts(out, o, "<h2>2 &middot; System Properties</h2>" as *u8) 343 o = mc_props(out, o, q, qn) 344 o = mc_prose(out, o, q, qn, "s2" as *u8, "3 &middot; Methods of Distribution" as *u8) 345 o = mc_prose(out, o, q, qn, "s3" as *u8, "4 &middot; Training" as *u8) 346 o = mc_puts(out, o, "<h2>5 &middot; Evaluations</h2>" as *u8) 347 o = mc_axis(out, o, q, qn, "reasoning" as *u8, "Reasoning" as *u8, lp) 348 o = mc_axis(out, o, q, qn, "agentic-coding" as *u8, "Agentic &middot; coding" as *u8, lp) 349 o = mc_axis(out, o, q, qn, "agentic-general" as *u8, "Agentic &middot; general" as *u8, lp) 350 o = mc_axis(out, o, q, qn, "factuality" as *u8, "Factuality" as *u8, lp) 351 o = mc_axis(out, o, q, qn, "chat" as *u8, "Chat" as *u8, lp) 352 o = mc_axis(out, o, q, qn, "vision" as *u8, "Vision" as *u8, lp) 353 o = mc_axis(out, o, q, qn, "audio" as *u8, "Audio" as *u8, lp) 354 o = mc_axis(out, o, q, qn, "safety" as *u8, "Safety" as *u8, lp) 355 o = mc_prose(out, o, q, qn, "s4" as *u8, "6 &middot; Safety" as *u8) 356 o = mc_prose(out, o, q, qn, "s5" as *u8, "7 &middot; Bias, Risks and Limitations" as *u8) 357 o = mc_prose(out, o, q, qn, "s6" as *u8, "8 &middot; Legal" as *u8) 358 o = mc_puts(out, o, "<h2>Provenance</h2><p class=\"m\">" as *u8) 359 if mc_note(q, qn, "m01" as *u8, u) == 1 { o = mc_putsl(out, o, q, u[0], u[1]) } else { o = mc_puts(out, o, "(missing m01)" as *u8) } 360 o = mc_puts(out, o, "</p><p class=\"m\">envelope: plane cap 1MiB, out cap 512KiB, 16-col rows; plane content operator-trusted (no HTML-escape pass); the live cell = resolve_pct parsed from /compare/autograde/api.json at emit time; regenerated on the freshness beat.</p></main></body></html>\n" as *u8) 361 362 if selft == 1 { 363 var ok: i64 = 1 364 if mc_find(out, o, "SWE-bench Verified" as *u8, 0) < 0 { ok = 0 } 365 if mc_find(out, o, "UNMEASURED:F786" as *u8, 0) < 0 { ok = 0 } 366 if mc_find(out, o, "StrongREJECT" as *u8, 0) < 0 { ok = 0 } 367 if mc_find(out, o, "8 &middot; Legal" as *u8, 0) < 0 { ok = 0 } 368 if o < MC_MINBYTES { ok = 0 } 369 if ok == 1 { mc_werr("MC-SELFTEST OK verdict=GREEN\n" as *u8); sys_exit(0); return 0 } 370 mc_werr("MC-SELFTEST FAIL verdict=RED\n" as *u8) 371 sys_exit(MC_EXIT_SELF) 372 return MC_EXIT_SELF 373 } 374 if have_out == 1 { 375 let pb: *u8 = sys_mmap(MC_PATHCAP) 376 var po: i64 = ss_cat(pb, 0, outp) 377 po = ss_cat(pb, po, ".nxtmp" as *u8) 378 pb[po] = 0 as u8 379 let fd: i64 = sys_openat_wr(pb, MC_MODE) 380 if fd < 0 { mc_werr("MC-EMIT open FAIL\n" as *u8); sys_exit(MC_EXIT_EMPTY); return MC_EXIT_EMPTY } 381 sys_write(fd, out, o) 382 sys_close(fd) 383 if sys_renameat(pb, outp) < 0 { mc_werr("MC-EMIT rename FAIL\n" as *u8); sys_exit(MC_EXIT_EMPTY); return MC_EXIT_EMPTY } 384 // BEAT HEARTBEAT: append the emit epoch so a LATER session can PROVE the 6h clock actually fires 385 // this organ (entries appearing while no session is active = autonomous). The card CLAIMS it 386 // self-freshens; a claim about automation must be FALSIFIABLE, not asserted. 387 let bb: *u8 = sys_mmap(64) 388 var bo: i64 = mc_puti(bb, 0, sys_now_realtime_sec()) 389 bb[bo] = 10 as u8 390 bo = bo + 1 391 let bfd: i64 = sys_openat_append("knowledge/status/modelcard_beat.log" as *u8, MC_MODE) 392 if bfd >= 0 { sys_write(bfd, bb, bo); sys_close(bfd) } 393 mc_werr("MC-EMIT OK atomic\n" as *u8) 394 sys_exit(0) 395 return 0 396 } 397 sys_write(1, out, o) 398 sys_exit(0) 399 return 0 400}