code wiki / _hdl_build / nx_compare_rank_artifact_20260910.nx
nx_compare_rank_artifact_20260910.nx source
↩ module page · 1226 lines · 82310 B
1// nx_compare_rank.nx -- THE ROADMAP RANKER: priority computed from the boards, never chosen by a seat.
2//
3// Operator 2026-08-18: "we need sota best of breed prioritization and ranking from the foundation first
4// bit up in our compares to drive our roadmaps ... it needs to push back on your random doing of low
5// priorities" and "we cant keep having you do random shit and say its effective". A seat picking rungs
6// by whatever is cheapest with parts in-tree is the defect; this organ makes the compare COMPUTE the
7// order from data the boards already carry and PUBLISH it where every seat, MCP caller and RACI row
8// reads it. It decides nothing itself: the math is nx_dr_ocm (DR-6 opportunity-cost ranker,
9// Priority=(V*M)/C, integer deterministic -- REGISTERED-DARK until today, adopted here) and the plane
10// write is nx_store_put; this organ only DERIVES the three inputs per open rung, all from data:
11//
12// THE MATHEMATICS (v5, 2026-08-18 -- operator: "a full mathematical system on opportunity cost,
13// clustering, foundation-up capabilities, best-of-breed research as of August 2026", not a seat's
14// coefficients). Every term is COUNTED or a RATIO of board data; the only chosen constant left is
15// RANK_COST_UNKNOWN and it fires only on a plan row that declared no cost (a labeled data defect).
16// value v = deficit + CoD + option + enables (all from matrix codes + dep rows)
17// deficit = sum of rival codes on the rung's row (2 leads, 1 present, 0 absent): value at stake
18// CoD = deficit x (rivals LEADING / rivals total): WSJF cost-of-delay -- the fraction of the
19// field already ahead is the time-criticality; every unit open, that many rivals widen it
20// option = 1, ONLY when every rival is absent: the lead itself, held by nobody -- its unlocking
21// value is already the enables leg below (one leg each; a v5 draft double-charged it)
22// enables = number of OTHER open rungs whose transitive dependency closure contains this rung:
23// the foundation-first / opportunity-enablement leg (WSJF) and the compound-option leg
24// (real-options portfolio theory), counted from dep rows
25// momentum m = 1 + declared dependencies already MEASURED present (substrate landed; never 0 because
26// nx_dr_ocm multiplies and a zero would hide the rung)
27// cost c = the plan's own est u in tenths, DIVIDED by the rung's cluster size (open rungs sharing
28// the same organ file share substrate: read once, one build lane, one gate to extend --
29// graph clustering on the organ column, measured never labelled); unestimated -> labeled
30// sponsor = the operator's sponsor- plane coefficient (PR6), applied to value, every firing row named
31// priority = nx_dr_ocm( v x sponsor, m, c ) = (V x M x 1000)/C with forgone-best-alternative and
32// budget-aware greedy selection (DR-6, integer deterministic)
33// critical path: the FIRST unmet product version's milestone rungs + transitive open deps rank
34// before everything else (ver| rows) -- staged delivery 0.1 -> 1.0 -> 2.0.
35// Provenance: WSJF/cost-of-delay (SAFe LPM), real-options R&D portfolio valuation with project
36// interdependencies (Blau et al.; OptFolio-class DSS), integer-programming portfolio selection under
37// budget (knapsack form -- dr_ocm's greedy is the bounded-effort stand-in), dependency-graph enablement.
38// pmdash.refs carries the citations. What is NOT here, honestly: uncertainty distributions (PTRS-style
39// success probabilities per rung) -- the estate has no measured per-rung success rate yet; PR7's
40// actuals-write-back is the data that makes that term possible, and it will be added when the data
41// exists rather than invented now.
42//
43// The output is the PRINTED TABLE (every rung's full derivation, v/m/c and where each came from, so the
44// number can be argued from its inputs) plus ONE PLANE ROW per domain in comparerank-<domain>:
45// id=<domain>, title=the #1 rung, status=its priority, scope=the #1 rung id, note=the ordered queue.
46// One row = one segment commit; a per-rung row was measured stalling the fleet in D-state on
47// 2026-08-18 (syscalls per unit of output, §F). Whole population per domain, no sampling.
48//
49// usage: nx_compare_rank <domain> [budget_tenths] (runs from nishihost cwd; reads
50// buildroot/knowledge/compare/<domain>.plan + .matrix; forks ./nx_dr_ocm_cli.elf and ./nx_store_put.elf)
51// exit: 0 ranked+published | 2 usage | 3 plan/matrix unreadable | 4 ranker fork failed | 5 BAR-STALE (a declared bar
52// older than the current month with no this-month barscan attestation: the board refuses to hand out work)
53// | 6 LADDER-PARTIAL (a declared ladder to SOTA left half-declared: an undated target or a rung with no role)
54// license_tier: ORIGINAL No hw writes (Rule 26).
55import "nx_syscalls.nx"
56import "nx_tool_run.nx"
57// CE2 (2026-08-23): the estate's adoption ladder -- ONE classifier shared with nx_catalog and the page
58import "nx_catalog_lib.nx"
59import "nx_symdecl_lib.nx"
60// BAR FRESHNESS (2026-09-06): the one ruler for bar age, composed here so a stale bar refuses the work queue
61import "nx_barfresh_lib.nx"
62// LADDER TO SOTA (2026-09-06): the one ruler for dated best-in-class and frontier targets and a role on every rung
63import "nx_ladder_lib.nx"
64import "nx_swcompare_lib.nx" // reuse source identities and declared graph validation
65const RANK_EXIT_BAR_STALE: i64 = 5 // a declared bar older than the current month with no this-month attestation: the board hands out no work
66const RANK_EXIT_LADDER_PARTIAL: i64 = 6 // a declared ladder to SOTA left half-declared (an undated target, a rung with no role): refused the same way
67
68// POPULATION CAPS REMOVED 2026-08-23 (lane F): the former RANK_MAX_RUNGS=64 / RANK_MAX_ROWS=64 /
69// RANK_FIELD_MAX=24 / RANK_FILE_CAP=262144 / RANK_SRC_CAP=524288 / RANK_QUEUE_CAP=8192 were SILENT
70// caps -- browser.matrix carries 76 rows, so every row past 64 was invisible and its rung read
71// UNMAPPED (measured: BR20 bpd_download, whose watch row exists). Every population bound is now
72// DERIVED from the data it bounds: files are read whole by sys_read_file (sized from the file, cannot
73// short-read), row/rung/field arrays are sized from the line and pipe census of the loaded bytes, and
74// every buffer that holds a composed string is sized from the lengths of what it composes. The only
75// bounds that remain are fork CAPTURES (a pipe has no knowable size): each is named for its one
76// purpose, sized from the population that produces it, and ANNOUNCES when it fills.
77const RK_DEC_MAX: i64 = 20 // max decimal digits of an i64 (19) plus a sign: the width of one
78 // rk_catn/rk_pn number, the unit every composed-string bound counts in
79const RK_NUMBUF: i64 = RK_DEC_MAX + 4 // one number rendered to text + NUL + slack for the '-' and terminator
80// (RANK_EXCEED_BONUS retired 2026-08-18: the exceed lane is now valued as a REAL OPTION -- one plus the
81// downstream rungs it enables -- derived from the dependency graph instead of a chosen constant.)
82const RANK_COST_UNKNOWN: i64 = 100 // 10.0 u: an unestimated rung is treated as EXPENSIVE, labeled --
83 // the ONE remaining chosen constant, and it only ever affects rungs
84 // whose plan row failed to declare a cost (a labeled data defect)
85const RANK_DEFAULT_BUDGET: i64 = 300 // 30.0 u -- above every plan's full-parity figure, so the greedy
86 // selection reports the whole ordering (budget filtering is the
87 // caller's lever via argv[2])
88const RANK_STORE_FIELDS: i64 = 8
89// ONE RUNG NOTE is literals + numbers + plane-sourced text. The constants below are COUNTED from this
90// source (scratchpad count_lits.py over every `rk_cat(nb, ...)` / `rk_catn(nb, ...)` site, 2026-08-23):
91// RK_NOTE_LITERALS = 531 the summed source length of the 26 literal appends (a source-length bound)
92// RK_NOTE_NUMS = 13 rk_catn sites on the note path, each at most RK_DEC_MAX bytes
93// RK_SPONSOR_ROW_LITERALS = 11 the literal bytes ONE applying sponsor row adds (" sponsor[" ":" "]"); the
94// row's own id and weight come from the plane, so the plane's length bounds them
95// The caller sizes a note as literals + nums*RK_DEC_MAX + splen + rows*RK_SPONSOR_ROW_LITERALS + the
96// dom/id/sym/organ strings it echoes. Re-count when a note literal is added; the count is the contract.
97const RK_NOTE_LITERALS: i64 = 531
98const RK_NOTE_NUMS: i64 = 13
99const RK_SPONSOR_ROW_LITERALS: i64 = 11
100const RANK_FORK_CAP: i64 = 4096 // captured stdout of one nx_store_put / nx_pm_intake fork: their
101 // receipts are one line; a fill is ANNOUNCED (CAPTURE-FULL) not dropped
102// the ranker's JSON: one object per open rung -- 8 keys (89 literal bytes incl. braces and the separating
103// comma) plus 8 numbers -- and a fixed header/footer (195 literal bytes plus 5 numbers); COUNTED from
104// nx_dr_ocm_cli's emitter (scratchpad count_ocm.py, 2026-08-23). The capture is sized from nopen, and a
105// fill is REFUSED loudly (a ranking read as a prefix is worse than no ranking).
106const RK_OCM_OBJ_BYTES: i64 = 89 + 8 * RK_DEC_MAX
107const RK_OCM_HDR_BYTES: i64 = 195 + 5 * RK_DEC_MAX + 16
108// CE2/CE6 (2026-08-23): a rung whose symbol is PRESENT but whose organ is short of full adoption (built and
109// never promoted, promoted and never registered, a lib imported only by its gate) used to count DONE here --
110// the board could not see a partial deploy at all. Such rungs now also print as FINISH rows (state + remedy)
111// ahead of the ranked queue, land in the plane note as F[state]ID, and in the stamped artefact
112// buildroot/knowledge/compare/<dom>.rank that the page renders as "Do this next". NO coefficient changed:
113// v/m/c, the critical path and the order of open rungs are untouched; FINISH is a separate, cheaper class.
114const RANK_FIX_PER_RUNG: i64 = 64 + 10 * RK_DEC_MAX // row skeleton: kind, pipes, numbers, newline
115// One persisted `unmapped|<id>|<sym>|<reason>` row: the literal bytes only. The two VARIABLE parts,
116// id and sym, are added as measured rk_slen terms at the cap loop rather than being guessed here --
117// the same shape the rest of that loop already uses, so this cannot under-size on a long symbol.
118// Measured literal: "unmapped|" 9 + "|" 1 + "|" 1 + "no-matrix-row-carries-this-symbol" 33 + LF 1 = 45.
119const RANK_UNMAPPED_ROW: i64 = 48
120// RAISED 256 -> 512 (2026-09-01) to carry the one-line unmapped COUNT header that now precedes the
121// stamp. The tail is fixed-size text, so this is arithmetic, not a guess: the count line is ~110 bytes
122// plus a rendered integer, and 256 had no room for it beside the stamp it was sized for.
123const RANK_FIX_TAIL: i64 = 512 // the stamped last line + the unmapped count line
124const RANK_PM_TOP: i64 = 3 // critical rungs filed into pm intake per run: enough to drive
125 // the next sessions, few enough that intake stays a queue not a dump
126
127func rk_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
128func rk_puts(s: *u8) -> i64 { sys_write(1, s, rk_slen(s)); return 0 }
129func rk_pn(v: i64) -> i64 {
130 let t: *u8 = sys_mmap(RK_NUMBUF) as *u8
131 var m: i64 = v; var w: i64 = 0
132 if m < 0 { t[w] = 45 as u8; w = w + 1; m = 0 - m }
133 if m == 0 { t[w] = 48 as u8; sys_write(1, t, w + 1); return 0 }
134 let d: *u8 = sys_mmap(RK_NUMBUF) as *u8
135 var k: i64 = 0
136 while m > 0 { d[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 }
137 var j: i64 = 0
138 while j < k { t[w] = d[k-1-j]; w = w + 1; j = j + 1 }
139 sys_write(1, t, w); return 0
140}
141func rk_cat(d: *u8, o: i64, s: *u8) -> i64 { var i: i64 = 0; var oo: i64 = o; while s[i] != (0 as u8) { d[oo] = s[i]; oo = oo + 1; i = i + 1 } d[oo] = 0 as u8; return oo }
142func rk_catn(d: *u8, o: i64, v: i64) -> i64 {
143 let t: *u8 = sys_mmap(RK_NUMBUF) as *u8
144 var m: i64 = v; var k: i64 = 0; var oo: i64 = o
145 if m < 0 { d[oo] = 45 as u8; oo = oo + 1; m = 0 - m }
146 if m == 0 { d[oo] = 48 as u8; oo = oo + 1; d[oo] = 0 as u8; return oo }
147 while m > 0 { t[k] = (48 + (m % 10)) as u8; m = m / 10; k = k + 1 }
148 while k > 0 { k = k - 1; d[oo] = t[k]; oo = oo + 1 }
149 d[oo] = 0 as u8
150 return oo
151}
152func rk_streq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] == b[i] { if a[i] == (0 as u8) { return 1 } i = i + 1 } return 0 }
153func rk_starts(s: *u8, p: *u8) -> i64 { var i: i64 = 0; while p[i] != (0 as u8) { if s[i] != p[i] { return 0 } i = i + 1 } return 1 }
154// WHOLE-FILE READ, sized from the file (sys_read_file: lseek END, cannot short-read; +16 slack so the
155// in-place NUL-splitting below may write one past the last byte). Returns the byte count, -1 if
156// unreadable, and hands the buffer back through outb. The former rk_read took a caller CAP and
157// stopped there in silence -- a 262144-byte plan or a 524288-byte organ source read as a PREFIX.
158func rk_read_all(path: *u8, outb: *i64) -> i64 {
159 let lenp: *i64 = sys_mmap(16) as *i64
160 let b: *u8 = sys_read_file(path, lenp)
161 outb[0] = b as i64
162 if (b as i64) == 0 { return 0 - 1 }
163 return lenp[0]
164}
165// line census of a loaded buffer: newlines + 1 -- an upper bound on rows/rungs/ms/ver rows, DERIVED
166func rk_lines(b: *u8, n: i64) -> i64 {
167 var c: i64 = 1
168 var i: i64 = 0
169 while i < n { if b[i] == (10 as u8) { c = c + 1 } i = i + 1 }
170 return c
171}
172// pipe census: the most '|' on any one line + 2 -- the field-slot bound for rk_split, DERIVED
173func rk_max_pipes(b: *u8, n: i64) -> i64 {
174 var best: i64 = 0
175 var cur: i64 = 0
176 var i: i64 = 0
177 while i < n {
178 if b[i] == (10 as u8) { if cur > best { best = cur } cur = 0 } else { if b[i] == (124 as u8) { cur = cur + 1 } }
179 i = i + 1
180 }
181 if cur > best { best = cur }
182 return best + 2
183}
184// split a NUL-terminated line on '|' IN PLACE (same contract as the compare generator's splitpipe)
185func rk_split(s: *u8, fld: *i64, maxf: i64) -> i64 {
186 var c: i64 = 1; fld[0] = s as i64; var i: i64 = 0
187 while s[i] != (0 as u8) { if s[i] == (124 as u8) { s[i] = 0 as u8; if c < maxf { fld[c] = (s as i64) + i + 1; c = c + 1 } } i = i + 1 }
188 return c
189}
190// "1.5" -> 15, "2" -> 20, "-" -> -1 (tenths of a unit; one decimal is all the plans use)
191func rk_tenths(s: *u8) -> i64 {
192 if s[0] == (45 as u8) { return 0 - 1 }
193 var v: i64 = 0; var i: i64 = 0; var any: i64 = 0; var frac: i64 = 0 - 1
194 while s[i] != (0 as u8) {
195 let c: i64 = s[i] as i64
196 if c >= 48 { if c <= 57 { if frac < 0 { v = v * 10 + (c - 48) } else { if frac == 0 { v = v * 10 + (c - 48); frac = 1 } } any = 1 } }
197 if c == 46 { frac = 0 }
198 i = i + 1
199 }
200 if any == 0 { return 0 - 1 }
201 if frac < 0 { v = v * 10 }
202 if frac == 0 { v = v * 10 }
203 return v
204}
205func rk_int(s: *u8) -> i64 { var v: i64 = 0; var i: i64 = 0; while s[i] != (0 as u8) { let c: i64 = s[i] as i64; if c >= 48 { if c <= 57 { v = v * 10 + (c - 48) } } i = i + 1 } return v }
206// symbol match: the matrix row's symbol is either "<sym>" (present) or "_ABSENT_:<sym>" (watched)
207func rk_sym_is(rowsym: *u8, sym: *u8) -> i64 {
208 if rk_streq(rowsym, sym) == 1 { return 1 }
209 if rk_starts(rowsym, "_ABSENT_:" as *u8) == 1 { if rk_streq((rowsym as i64 + 9) as *u8, sym) == 1 { return 1 } }
210 return 0
211}
212
213// presence measured EXACTLY as the emitter measures it: the symbol exists as a top-level function
214// declaration in the organ's source. The matrix DATA keeps its _ABSENT_ watch spelling forever --
215// the flip is a MEASUREMENT at emit -- so a ranker that reads the data state calls every landed rung
216// open (measured on first run: done=0 of 22 with ig_room_solve, gp_collect2 and ntb_bake_pbr all
217// live). Re-measure, never trust the spelling.
218func rk_measure(org: *u8, sym: *u8) -> i64 {
219 let pb: *u8 = sys_mmap(rk_slen(org) + 16) // "buildroot/" (10) + org + NUL
220 var o: i64 = rk_cat(pb, 0, "buildroot/" as *u8)
221 o = rk_cat(pb, o, org)
222 // ONE RULER (2026-08-23, lane L): the declaration test lives in nx_symdecl_lib and is the SAME
223 // function the matrix generator, the sota watch section and the regen's comparewatch plane call.
224 // The claim above ("EXACTLY as the emitter measures it") was measured FALSE on lang LN8 -- the
225 // emitter used a substring -- and is now true by construction rather than by assertion.
226 let rl: *i64 = sys_mmap(16) as *i64
227 if sd_present(pb, sym, rl) == 1 { return 1 }
228 return 0
229}
230// DARK CONTRACT (2026-09-06, operator: a permanent fix, we do not build and lose capability to darkness): the organ
231// the row names EXISTS and was read, but does not declare the symbol under a rule that can judge -- something shipped
232// there under another name. The SAME arithmetic the matrix generator (cell state dk) and the regen's comparewatch
233// plane (state DARK) use: sd_present returns -1 unreadable / 0 read-and-absent / 1 present, and the JS rule's
234// abstention is folded to 0, so a JSDECL rule is excluded -- a rung the ruler cannot judge is open, never dark.
235func rk_dark(org: *u8, sym: *u8) -> i64 {
236 let pb: *u8 = sys_mmap(rk_slen(org) + 16)
237 var o: i64 = rk_cat(pb, 0, "buildroot/" as *u8)
238 o = rk_cat(pb, o, org)
239 let rl: *i64 = sys_mmap(16) as *i64
240 let st: i64 = sd_present(pb, sym, rl)
241 if st != 0 { return 0 }
242 if rl[0] == SD_RULE_JSDECL { return 0 }
243 return 1
244}
245// rk_sponsor_term -- PR6: the operator's SPONSORSHIP as a ranker coefficient (feedback law
246// 2026-08-18: a verdict that is not a row is a verdict the next ranking ignores). Reads the sponsor-
247// plane through nx_store_put load (the CLI lane; the MCP load verb reads planes empty), each row
248// id<TAB>title<TAB>sev<TAB>weight<TAB>actor<TAB>scope<TAB>note. A row APPLIES to a rung when its scope
249// is this domain or "all" AND (its note or title names the rung's id, its symbol, or its domain).
250// Weights are the coarse vocabulary plus2/plus1/minus1/minus2 (a coefficient, not a science; a fine
251// scale would invite tuning theater). Multiplier = SPONSOR_BASE + sum(weights) in units of
252// SPONSOR_BASE, floored at 1 so a minus can demote but never zero a value (a zeroed value hides the
253// rung from the ranker -- demotion must stay visible). Returns the multiplier x SPONSOR_BASE; the
254// caller applies v = v * m / SPONSOR_BASE and prints m so the coefficient is arguable from its rows.
255const SPONSOR_BASE: i64 = 4 // plus2 = +50%, plus1 = +25%, minus1 = -25%, minus2 = -50%
256const SPONSOR_PLANE_CAP: i64 = 262144
257func rk_has(hay: *u8, needle: *u8) -> i64 {
258 let nl: i64 = rk_slen(needle)
259 if nl == 0 { return 0 }
260 var i: i64 = 0
261 while hay[i] != (0 as u8) {
262 var k: i64 = 0
263 var same: i64 = 1
264 while k < nl { if hay[i+k] != needle[k] { same = 0; k = nl } else { if hay[i+k] == (0 as u8) { same = 0; k = nl } } k = k + 1 }
265 if same == 1 { return 1 }
266 i = i + 1
267 }
268 return 0
269}
270func rk_sponsor_term(plane: *u8, plen: i64, dom: *u8, rid1: *u8, sym: *u8, nb: *u8, no0: i64, noOut: *i64) -> i64 {
271 var mult: i64 = SPONSOR_BASE
272 var no: i64 = no0
273 var applied: i64 = 0
274 var p: i64 = 0
275 while p < plen {
276 var e: i64 = p
277 while e < plen { if plane[e] == (10 as u8) { break } e = e + 1 }
278 plane[e] = 0 as u8
279 let ln: *u8 = (plane as i64 + p) as *u8
280 p = e + 1
281 if ln[0] != (0 as u8) {
282 // split on TAB
283 let f: *i64 = sys_mmap(16 * 8) as *i64
284 var c: i64 = 1; f[0] = ln as i64; var i: i64 = 0
285 while ln[i] != (0 as u8) { if ln[i] == (9 as u8) { ln[i] = 0 as u8; if c < 16 { f[c] = (ln as i64) + i + 1; c = c + 1 } } i = i + 1 }
286 if c >= 7 {
287 let scope: *u8 = f[5] as *u8
288 var inscope: i64 = 0
289 if rk_streq(scope, dom) == 1 { inscope = 1 }
290 if rk_streq(scope, "all" as *u8) == 1 { inscope = 1 }
291 if inscope == 1 {
292 var names: i64 = 0
293 if rk_has(f[6] as *u8, rid1) == 1 { names = 1 }
294 if rk_has(f[6] as *u8, sym) == 1 { names = 1 }
295 if rk_has(f[1] as *u8, sym) == 1 { names = 1 }
296 // a domain-scoped row with no rung name applies to the whole domain
297 if rk_streq(scope, dom) == 1 { names = 1 }
298 if names == 1 {
299 var w: i64 = 0
300 let ws: *u8 = f[3] as *u8
301 if rk_streq(ws, "plus2" as *u8) == 1 { w = 2 }
302 if rk_streq(ws, "plus1" as *u8) == 1 { w = 1 }
303 if rk_streq(ws, "minus1" as *u8) == 1 { w = 0 - 1 }
304 if rk_streq(ws, "minus2" as *u8) == 1 { w = 0 - 2 }
305 mult = mult + w
306 applied = applied + 1
307 no = rk_cat(nb, no, " sponsor[" as *u8); no = rk_cat(nb, no, f[0] as *u8); no = rk_cat(nb, no, ":" as *u8); no = rk_cat(nb, no, ws); no = rk_cat(nb, no, "]" as *u8)
308 }
309 }
310 }
311 }
312 }
313 if mult < 1 { mult = 1 }
314 if applied == 0 { no = rk_cat(nb, no, " sponsor=none" as *u8) } else { no = rk_cat(nb, no, " sponsor_mult_x4=" as *u8); no = rk_catn(nb, no, mult) }
315 noOut[0] = no
316 return mult
317}
318// ---- PR11: THE SELF-SUFFICIENCY TERM ------------------------------------------------------------
319// Operator 2026-08-20: "where would be the best investment that drives the most self sufficiency
320// down". Recorded interpretation (feedback-foundation-and-autonomous-frontier-2026-08-20): drive
321// outside DEPENDENCY down / sovereignty UP. A rung whose organ stands on outside dependency delivers
322// a capability that does not survive the internet going away, or that only exists while a seat drives
323// it -- and rule 1 of that same memo says such a rung is MISPRICED, not merely noted. So the price
324// changes here, in the ranker, rather than on a separate board nobody consults.
325//
326// Input: nx_selfsuff's ledger (knowledge/status/selfsuff.ledger, or argv[3]), rows
327// dep|domain|organ|outside_dep|seat_only|seat_freq|claude_loop|hosts
328// Only TWO of those columns feed the coefficient, and the exclusion is measured, not stylistic:
329// outside_dep -- distinct non-sovereign hosts the organ dials in string literals, plus distinct
330// carriers it touches at ONE HOP. Sparse, RE-MEASURED 2026-08-20 against the fixed
331// census (the 90-of-556 figure this line used to carry came from a build that no
332// longer exists): 33 of 560 with-source organs carry ANY measured dependency --
333// 26 outside_dep units + 18 claude_loop organs = 44 dependency units.
334// ⚠ The ledger also now carries a TRANSITIVE net_dep column (0 none / 1 direct /
335// 2 via-helper). It is DELIBERATELY NOT read here: it answers "what breaks with no
336// internet", which is a different question from "how much outside dependency does
337// this rung stand on", and folding it in would re-price every rung in the estate
338// off the back of a measurement change rather than a decision.
339// claude_loop -- seat_only AND a WITNESS frame in the action record. Evidence-positive.
340// seat_only -- DELIBERATELY NOT USED. Measured at 92% of subjects, and A SIGNAL THAT FIRES ON
341// EVERYTHING DISCRIMINATES NOTHING; as a penalty it would demote nearly every rung
342// by the same amount, which is a no-op on ordering wearing the costume of rigour.
343//
344// THERE ARE NO CHOSEN WEIGHTS, on purpose -- there is no number here for a later seat to tune toward
345// a nicer answer:
346// SELFSUFF_BASE = SPONSOR_BASE's quarter vocabulary. ONE coefficient scale in this organ, not two.
347// SELFSUFF_FLOOR = the sponsor term's floor, for the sponsor term's reason: a zeroed value HIDES a
348// rung from the ranking, and a demotion must stay VISIBLE.
349// SELFSUFF_PEN_CAP = SELFSUFF_BASE - SELFSUFF_FLOOR. Not a knob: any larger value is unreachable
350// because the floor clamps first, and any smaller one would make the floor
351// unreachable, silently capping the term below its own vocabulary.
352//
353// d == 0 => multiplier == SELFSUFF_BASE => the value is UNCHANGED. That is the POSITIVE CONTROL, and
354// it is the tooth that matters: A TERM THAT PENALISES EVERYTHING PASSES EVERY NEGATIVE TEST.
355const SELFSUFF_BASE: i64 = 4
356const SELFSUFF_FLOOR: i64 = 1
357const SELFSUFF_PEN_CAP: i64 = SELFSUFF_BASE - SELFSUFF_FLOOR
358// (SELFSUFF_LEDGER_CAP=4194304 retired 2026-08-23: the ledger is a FILE and is read whole by rk_read_all)
359// compare b[s..e) against a NUL-terminated literal WITHOUT writing into the buffer -- the ledger is
360// read once and shared by every rung, so a parser that NUL-splits in place would corrupt the next
361// lookup (the sponsor term hands out copies for exactly this reason; not needing copies is cheaper).
362func rk_ss_eqf(b: *u8, s: i64, e: i64, lit: *u8) -> i64 {
363 var i: i64 = 0
364 var p: i64 = s
365 while p < e {
366 if lit[i] == (0 as u8) { return 0 }
367 if b[p] != lit[i] { return 0 }
368 p = p + 1
369 i = i + 1
370 }
371 if lit[i] == (0 as u8) { return 1 }
372 return 0
373}
374func rk_ss_atoi(b: *u8, s: i64, e: i64) -> i64 {
375 var v: i64 = 0
376 var neg: i64 = 0
377 var p: i64 = s
378 while p < e {
379 let c: i64 = b[p] as i64
380 if c == 45 { neg = 1 } else { if c >= 48 { if c <= 57 { v = v * 10 + (c - 48) } } }
381 p = p + 1
382 }
383 if neg == 1 { return 0 - v }
384 return v
385}
386// Returns the multiplier in units of SELFSUFF_BASE; the caller applies v = v * m / SELFSUFF_BASE.
387// Every row that fired is printed BY ID (domain/organ) beside the number, so the coefficient is
388// arguable from its evidence rather than taken on trust -- the sponsor term's contract, kept.
389func rk_selfsuff_term(led: *u8, ln: i64, dom: *u8, org: *u8, nb: *u8, no0: i64, noOut: *i64) -> i64 {
390 var no: i64 = no0
391 if ln <= 0 {
392 no = rk_cat(nb, no, " selfsuff=UNOBSERVED(no ledger -- run nx_selfsuff census)" as *u8)
393 noOut[0] = no
394 return SELFSUFF_BASE
395 }
396 let fs: *i64 = sys_mmap(16 * 8) as *i64
397 var found: i64 = 0
398 var outd: i64 = 0
399 var loopd: i64 = 0
400 var p: i64 = 0
401 while p < ln {
402 var e: i64 = p
403 var fnd: i64 = 0
404 while fnd == 0 { if e >= ln { fnd = 1 } else { if led[e] == (10 as u8) { fnd = 1 } else { e = e + 1 } } }
405 if found == 0 { if rk_starts((led as i64 + p) as *u8, "dep|" as *u8) == 1 {
406 var nf: i64 = 1
407 fs[0] = p
408 var q: i64 = p
409 while q < e { if led[q] == (124 as u8) { if nf < 16 { fs[nf] = q + 1; nf = nf + 1 } } q = q + 1 }
410 if nf >= 8 {
411 if rk_ss_eqf(led, fs[1], fs[2] - 1, dom) == 1 { if rk_ss_eqf(led, fs[2], fs[3] - 1, org) == 1 {
412 outd = rk_ss_atoi(led, fs[3], fs[4] - 1)
413 loopd = rk_ss_atoi(led, fs[6], fs[7] - 1)
414 found = 1
415 } }
416 }
417 } }
418 p = e + 1
419 }
420 if found == 0 {
421 // NOT the same state as a missing ledger, and NOT the same as zero dependency: this organ was
422 // never in the census population. Say which, and do not price what was not measured.
423 no = rk_cat(nb, no, " selfsuff=NO-LEDGER-ROW(organ absent from the census population)" as *u8)
424 noOut[0] = no
425 return SELFSUFF_BASE
426 }
427 var dep: i64 = outd + loopd
428 if dep < 0 { dep = 0 }
429 var pen: i64 = dep
430 if pen > SELFSUFF_PEN_CAP { pen = SELFSUFF_PEN_CAP }
431 var mult: i64 = SELFSUFF_BASE - pen
432 if mult < SELFSUFF_FLOOR { mult = SELFSUFF_FLOOR }
433 no = rk_cat(nb, no, " selfsuff[row=" as *u8); no = rk_cat(nb, no, dom); no = rk_cat(nb, no, "/" as *u8); no = rk_cat(nb, no, org)
434 no = rk_cat(nb, no, " outside_dep=" as *u8); no = rk_catn(nb, no, outd)
435 no = rk_cat(nb, no, " claude_loop=" as *u8); no = rk_catn(nb, no, loopd)
436 no = rk_cat(nb, no, " pen=min(dep,base-floor)=" as *u8); no = rk_catn(nb, no, pen)
437 no = rk_cat(nb, no, " mult_x4=" as *u8); no = rk_catn(nb, no, mult)
438 if dep == 0 { no = rk_cat(nb, no, " SOVEREIGN-NO-PENALTY" as *u8) }
439 no = rk_cat(nb, no, "]" as *u8)
440 noOut[0] = no
441 return mult
442}
443// walk one comma-separated rung-id token: resolve to a rung index; return 1 if that rung is OPEN
444// (not measured present); mode 1 additionally marks it on the critical path.
445func rk_list_one(idstr: *u8, mode: i64, rid: *i64, nr: i64, rdone: *i64, crit: *i64) -> i64 {
446 if idstr[0] == (0 as u8) { return 0 }
447 if idstr[0] == (45 as u8) { return 0 }
448 var r: i64 = 0
449 while r < nr {
450 if rk_streq(rid[r] as *u8, idstr) == 1 {
451 if rdone[r] == 0 { if mode == 1 { crit[r] = 1 } return 1 }
452 return 0
453 }
454 r = r + 1
455 }
456 return 0
457}
458// walk a whole comma list; returns how many listed rungs are OPEN (mode 1 also marks them critical)
459func rk_list_scan(ls: *u8, mode: i64, rid: *i64, nr: i64, rdone: *i64, crit: *i64) -> i64 {
460 let tmp: *u8 = sys_mmap(rk_slen(ls) + 2) // one token is never longer than the whole list
461 var di: i64 = 0
462 var dj: i64 = 0
463 var any: i64 = 0
464 var go: i64 = 1
465 while go == 1 {
466 let c: i64 = ls[di] as i64
467 if c == 44 { tmp[dj] = 0 as u8; any = any + rk_list_one(tmp, mode, rid, nr, rdone, crit); dj = 0 }
468 else { if c == 0 { tmp[dj] = 0 as u8; any = any + rk_list_one(tmp, mode, rid, nr, rdone, crit); go = 0 }
469 else { if c != 32 { tmp[dj] = ls[di]; dj = dj + 1 } } }
470 di = di + 1
471 }
472 return any
473}
474
475// the longest ver| label: the stage text one queue entry can carry ("later" is 5; a label may be longer)
476// ---- CE6: THE ORDER, AS AN ARTEFACT A PAGE CAN READ (2026-08-23) ----
477// One truncate-write per run (tmp + fsync + rename: a reader never sees a half file), canonical last line
478// = the stamp, so a consumer anchors by POSITION and never greps an append-only journal (the
479// nx_deploy_ready lesson). Path is the generator's tree: buildroot/knowledge/compare/<dom>.rank.
480func rk_write_rank(dom: *u8, buf: *u8, n0: i64, nr: i64, ndone: i64, nopen: i64, nfinish: i64, tgt: i64, vlab: *i64) -> i64 {
481 var n: i64 = n0
482 n = rk_cat(buf, n, "# asof=" as *u8); n = rk_catn(buf, n, sys_now_realtime_sec())
483 n = rk_cat(buf, n, " domain=" as *u8); n = rk_cat(buf, n, dom)
484 n = rk_cat(buf, n, " target_version=" as *u8)
485 if tgt >= 0 { n = rk_cat(buf, n, vlab[tgt] as *u8) } else { n = rk_cat(buf, n, "-" as *u8) }
486 n = rk_cat(buf, n, " rungs=" as *u8); n = rk_catn(buf, n, nr)
487 n = rk_cat(buf, n, " done=" as *u8); n = rk_catn(buf, n, ndone)
488 n = rk_cat(buf, n, " open=" as *u8); n = rk_catn(buf, n, nopen)
489 n = rk_cat(buf, n, " finish=" as *u8); n = rk_catn(buf, n, nfinish)
490 n = rk_cat(buf, n, " ranker=nx_dr_ocm\n" as *u8)
491 let dl: i64 = rk_slen(dom)
492 let outp: *u8 = sys_mmap(dl + 48)
493 var oo: i64 = rk_cat(outp, 0, "buildroot/knowledge/compare/" as *u8); oo = rk_cat(outp, oo, dom); oo = rk_cat(outp, oo, ".rank" as *u8)
494 let tmp: *u8 = sys_mmap(dl + 56)
495 var to: i64 = rk_cat(tmp, 0, outp); to = rk_cat(tmp, to, ".tmp" as *u8)
496 let fd: i64 = sys_openat_wr(tmp, MODE_0644)
497 if fd < 0 { rk_puts("RANK ARTEFACT WRITE-FAILED: cannot open " as *u8); rk_puts(tmp); rk_puts("\n" as *u8); return 0 - 1 }
498 var w: i64 = 0
499 while w < n {
500 let r: i64 = sys_write(fd, ((buf as i64) + w) as *u8, n - w)
501 if r <= 0 { sys_close(fd); rk_puts("RANK ARTEFACT WRITE-FAILED: short write\n" as *u8); return 0 - 1 }
502 w = w + r
503 }
504 sys_fsync(fd)
505 sys_close(fd)
506 if sys_renameat(tmp, outp) != 0 { rk_puts("RANK ARTEFACT WRITE-FAILED: rename\n" as *u8); return 0 - 1 }
507 rk_puts("RANK artefact wrote=" as *u8); rk_pn(n); rk_puts(" of=" as *u8); rk_puts(outp); rk_puts(" finish=" as *u8); rk_pn(nfinish); rk_puts("\n" as *u8)
508 return 0
509}
510func qcap_stage_max(vlab: *i64, nver: i64) -> i64 {
511 var best: i64 = 5
512 var k: i64 = 0
513 while k < nver { let l: i64 = rk_slen(vlab[k] as *u8); if l > best { best = l } k = k + 1 }
514 return best
515}
516
517func main(argc: i64, argv: *i64) -> i64 {
518 if argc < 2 { rk_puts("usage: nx_compare_rank <domain> [budget_tenths] [selfsuff_ledger] [--artifact-only]\n" as *u8); return 2 }
519 let dom: *u8 = argv[1] as *u8
520 if sg_id(dom,rk_slen(dom)) == 0 { rk_puts("RANK REFUSED: invalid domain identifier\n" as *u8);return 2 }
521 var budget: i64 = RANK_DEFAULT_BUDGET
522 var ssledp: *u8 = "knowledge/status/selfsuff.ledger" as *u8
523 var artifact_only: i64 = 0;var positional: i64 = 0;var argi: i64 = 2
524 while argi < argc {
525 let arg: *u8 = argv[argi] as *u8
526 if rk_streq(arg,"--artifact-only" as *u8)==1 { artifact_only=1 } else {
527 if positional==0 { budget=rk_int(arg) } else { if positional==1 { ssledp=arg } else { rk_puts("RANK REFUSED: unexpected argument\n" as *u8);return 2 } }
528 positional=positional+1
529 }
530 argi=argi+1
531 }
532 if artifact_only==1 { rk_puts("RANK mode=artifact-only task_queue_writes=0 readiness=UNVERIFIED; ranking is prioritization, not execution authorization\n" as *u8) }
533 // ---- read the plan ----
534 let dlen: i64 = rk_slen(dom)
535 let pp: *u8 = sys_mmap(dlen + 48) // "buildroot/knowledge/compare/" (28) + dom + ".matrix" (7) + NUL
536 var po: i64 = rk_cat(pp, 0, "buildroot/knowledge/compare/" as *u8); po = rk_cat(pp, po, dom); po = rk_cat(pp, po, ".plan" as *u8)
537 let pbp: *i64 = sys_mmap(16) as *i64
538 let pn: i64 = rk_read_all(pp, pbp)
539 let pbuf: *u8 = pbp[0] as *u8
540 if pn <= 0 { rk_puts("RANK REFUSED: no plan at " as *u8); rk_puts(pp); rk_puts("\n" as *u8); return 3 }
541 // ---- read the matrix ----
542 let mp: *u8 = sys_mmap(dlen + 48)
543 var mo: i64 = rk_cat(mp, 0, "buildroot/knowledge/compare/" as *u8); mo = rk_cat(mp, mo, dom); mo = rk_cat(mp, mo, ".matrix" as *u8)
544 let mbp: *i64 = sys_mmap(16) as *i64
545 let mn: i64 = rk_read_all(mp, mbp)
546 let mbuf: *u8 = mbp[0] as *u8
547 if mn <= 0 { rk_puts("RANK REFUSED: no matrix at " as *u8); rk_puts(mp); rk_puts("\n" as *u8); return 3 }
548 let captured: *SgPlan = sg_parse(pbuf,pn,0 as *u8,0,mbuf,mn)
549 if (captured as i64)==0 { rk_puts("RANK REFUSED: input capture unavailable\n" as *u8);return 7 }
550 if sg_valid(captured)!=1 { rk_puts("RANK REFUSED: malformed, missing, duplicate or cyclic authored graph\n" as *u8);return 7 }
551 // ---- DERIVED population bounds: rows <= lines of the matrix, rungs/ms/ver <= lines of the plan,
552 // fields per row <= pipes on the widest line -- counted from the loaded bytes, never a constant ----
553 let max_rows: i64 = rk_lines(mbuf, mn)
554 let max_rungs: i64 = rk_lines(pbuf, pn)
555 var max_fields: i64 = rk_max_pipes(mbuf, mn)
556 let pf: i64 = rk_max_pipes(pbuf, pn)
557 if pf > max_fields { max_fields = pf }
558 // ---- index matrix rows: symbol -> (present, sum of rival codes, all-absent) ----
559 let msym: *i64 = sys_mmap(max_rows * 8) as *i64
560 let morg: *i64 = sys_mmap(max_rows * 8) as *i64
561 let mdef: *i64 = sys_mmap(max_rows * 8) as *i64
562 let mall0: *i64 = sys_mmap(max_rows * 8) as *i64
563 let mlead: *i64 = sys_mmap(max_rows * 8) as *i64
564 let mpres: *i64 = sys_mmap(max_rows * 8) as *i64
565 var mrows: i64 = 0
566 var ncol: i64 = 0
567 let fld: *i64 = sys_mmap(max_fields * 8) as *i64
568 var p: i64 = 0
569 while p < mn {
570 var e: i64 = p
571 while e < mn { if mbuf[e] == (10 as u8) { break } e = e + 1 }
572 mbuf[e] = 0 as u8
573 let line: *u8 = (mbuf as i64 + p) as *u8
574 p = e + 1
575 if line[0] == (64 as u8) { if rk_starts(line, "@cols " as *u8) == 1 { let cf: *i64 = sys_mmap(max_fields * 8) as *i64; ncol = rk_split((line as i64 + 6) as *u8, cf, max_fields) } }
576 else { if line[0] != (0 as u8) { if line[0] != (35 as u8) {
577 let cnt: i64 = rk_split(line, fld, max_fields)
578 if cnt >= 5 + ncol { if mrows < max_rows {
579 msym[mrows] = fld[2]
580 morg[mrows] = fld[1]
581 var dsum: i64 = 0
582 var allz: i64 = 1
583 var nlead: i64 = 0
584 var cj: i64 = 0
585 while cj < ncol { let cv: i64 = rk_int(fld[4 + cj] as *u8); dsum = dsum + cv; if cv > 0 { allz = 0 } if cv >= 2 { nlead = nlead + 1 } cj = cj + 1 }
586 mdef[mrows] = dsum
587 mall0[mrows] = allz
588 mlead[mrows] = nlead
589 mpres[mrows] = 1
590 if rk_starts(fld[2] as *u8, "_ABSENT_" as *u8) == 1 { mpres[mrows] = 0 }
591 mrows = mrows + 1
592 } }
593 } } }
594 }
595 // ---- walk plan rungs: collect id/title/sym/exec/est/deps ----
596 let vlab: *i64 = sys_mmap(max_rungs * 8) as *i64
597 let vms: *i64 = sys_mmap(max_rungs * 8) as *i64
598 var nver: i64 = 0
599 let msid: *i64 = sys_mmap(max_rungs * 8) as *i64
600 let msrungs: *i64 = sys_mmap(max_rungs * 8) as *i64
601 var nms: i64 = 0
602 let rid: *i64 = sys_mmap(max_rungs * 8) as *i64
603 let rtitle: *i64 = sys_mmap(max_rungs * 8) as *i64
604 let rsym: *i64 = sys_mmap(max_rungs * 8) as *i64
605 let rexec: *i64 = sys_mmap(max_rungs * 8) as *i64
606 let rest: *i64 = sys_mmap(max_rungs * 8) as *i64
607 let rdeps: *i64 = sys_mmap(max_rungs * 8) as *i64
608 var nr: i64 = 0
609 // THE BAR AND LADDER RULERS READ A PRISTINE COPY. rk_split in the rung walk below NUL-terminates every FIELD of every
610 // rung| row in place, so once that loop has run pbuf no longer spells "rung|" anywhere: a ruler handed pbuf counts zero
611 // rungs and reports every rungrole| row as an orphan. MEASURED live 2026-09-06 on a fully declared board: targets=3
612 // rungs=0 orphans=34 verdict=PARTIAL, a false refusal from the hook that exists to refuse half-declared ladders. The copy
613 // is taken BEFORE the walk; sotabar|, sotatarget| and rungrole| rows were never mutated, which is why the bar hook
614 // happened to read correctly and the ladder hook did not -- the same buffer, two answers, decided by which rows the
615 // ranker itself parses.
616 let prist: *u8 = sys_mmap(pn + 1)
617 var pci: i64 = 0
618 while pci < pn { prist[pci] = pbuf[pci]; pci = pci + 1 }
619 prist[pn] = 0 as u8
620 p = 0
621 while p < pn {
622 var e2: i64 = p
623 while e2 < pn { if pbuf[e2] == (10 as u8) { break } e2 = e2 + 1 }
624 pbuf[e2] = 0 as u8
625 let ln: *u8 = (pbuf as i64 + p) as *u8
626 p = e2 + 1
627 if rk_starts(ln, "rung|" as *u8) == 1 { if nr < max_rungs {
628 let c2: i64 = rk_split(ln, fld, max_fields)
629 if c2 >= 8 {
630 rid[nr] = fld[1]; rtitle[nr] = fld[2]; rsym[nr] = fld[3]; rexec[nr] = fld[5]
631 rest[nr] = rk_tenths(fld[6] as *u8)
632 rdeps[nr] = fld[7]
633 nr = nr + 1
634 }
635 } }
636 // ver|<label>|<ms-id>: the PRODUCT VERSION ladder (operator 2026-08-18: critical paths to 0.1
637 // then 1.0 then 2.0 drive delivery, digital and physical). Order in the file IS the ladder.
638 if rk_starts(ln, "ver|" as *u8) == 1 { if nver < max_rungs {
639 let c3: i64 = rk_split(ln, fld, max_fields)
640 if c3 >= 3 { vlab[nver] = fld[1]; vms[nver] = fld[2]; nver = nver + 1 }
641 } }
642 // ms|<id>|<label>|<cum>|<rung,rung,...>
643 if rk_starts(ln, "ms|" as *u8) == 1 { if nms < max_rungs {
644 let c4: i64 = rk_split(ln, fld, max_fields)
645 if c4 >= 5 { msid[nms] = fld[1]; msrungs[nms] = fld[4]; nms = nms + 1 }
646 } }
647 }
648 if nr == 0 { rk_puts("RANK REFUSED: plan has no rung rows\n" as *u8); return 3 }
649 // BAR FRESHNESS -- THE HARD FAIL (operator 2026-09-06: "make sure its a hard fail to use anything less than current
650 // month unless there is nothing current month" and "this needs to become the way that the logic forces you from the
651 // /compare domain"). The plan's sotabar| rows carry their source month and its barscan| rows attest what THIS month's
652 // listing returned; nx_barfresh_lib is the one ruler. A domain that declared bars and let them go stale gets NO ranking
653 // and NO pm filing: the board refuses to hand out work until the bar is the current month's or its fallback is attested
654 // this month. A domain with no bar rows is LABELED, never refused -- it opts in by declaring its first bar (a fleet-wide
655 // refusal on day one would be the permanently-red detector everyone learns to ignore). prist is the pristine copy taken
656 // before the rung walk (rk_split NUL-terminates every field in place); the ruler reads both line endings.
657 let bfc: *i64 = sys_mmap(BF_C_N * 8) as *i64
658 let bfnb: i64 = bf_count_rows(prist, pn, BF_BAR_TAG)
659 let bfoff: *i64 = sys_mmap((bfnb + 1) * 8) as *i64
660 let bfym: *i64 = sys_mmap((bfnb + 1) * 8) as *i64
661 let bfst: *i64 = sys_mmap((bfnb + 1) * 8) as *i64
662 let bfseen: *i64 = sys_mmap((bfnb + 1) * 8) as *i64
663 let bfcur: i64 = bf_now_ym()
664 bf_classify(prist, pn, bfcur, bfoff, bfym, bfst, bfseen, bfc)
665 let bfv: i64 = bf_verdict(bfc)
666 rk_puts("BARFRESH bars=" as *u8); rk_pn(bfc[BF_C_BARS]); rk_puts(" fresh=" as *u8); rk_pn(bfc[BF_C_FRESH]); rk_puts(" attested=" as *u8); rk_pn(bfc[BF_C_ATTESTED]); rk_puts(" stale=" as *u8); rk_pn(bfc[BF_C_STALE]); rk_puts(" unattested=" as *u8); rk_pn(bfc[BF_C_UNATTESTED]); rk_puts(" malformed=" as *u8); rk_pn(bfc[BF_C_MALFORMED]); rk_puts(" sum=" as *u8); rk_pn(bf_partition_sum(bfc)); rk_puts(" scans_this_month=" as *u8); rk_pn(bfc[BF_C_SCANS_CUR]); rk_puts(" verdict=" as *u8); rk_puts(bf_verdict_name(bfv)); rk_puts("\n" as *u8)
667 if bfv == BF_EXIT_NOBAR { rk_puts("BARFRESH NO-BAR: this plan declares no sotabar| row, so its bars are UNMEASURED -- LABELED, ranking proceeds; declare the field's current-month bar (sotabar|<id>|<YYYY-MM>|<subject>|<what it says>|<ref>|<note>) to opt into the hard fail\n" as *u8) }
668 if bfv == BF_EXIT_STALE {
669 rk_puts("RANK REFUSED: BAR-STALE -- a bar on this board is older than the current month and no barscan| row dated this month attests that the current month has nothing newer for its listing. The board hands out no work on a stale bar: run nx_barfresh " as *u8); rk_puts(dom); rk_puts(" for the per-bar states, fetch and READ the current month's listing (nx_research_fetch, pinned as a .refs row), then land a current sotabar| row or a barscan|<today>|<ref>|newest=<month> attestation\n" as *u8)
670 return RANK_EXIT_BAR_STALE
671 }
672 // LADDER TO SOTA (operator 2026-09-06: "how you framed it here is how all the /compare domains should be emitting with
673 // clarity on what dependencies from the first byte up all grow us each rung up to sota with a clear target on what is
674 // best in class and what is frontier"). sotatarget| rows name the dated targets and rungrole| rows give every rung its
675 // role toward one; nx_ladder_lib is the one ruler. A board that declared its ladder and left it half-declared (an
676 // undated target, a rung with no role, a role or class outside the vocabulary) is refused like a stale bar; a board with
677 // no ladder is LABELED and ranked -- it opts in by declaring its first target.
678 let ldnt: i64 = bf_count_rows(prist, pn, LD_TARGET_TAG)
679 let ldnr: i64 = bf_count_rows(prist, pn, LD_RUNG_TAG)
680 let ldc: *i64 = sys_mmap(LD_N_COUNT * 8) as *i64
681 let ldtoff: *i64 = sys_mmap((ldnt + 1) * 8) as *i64
682 let ldtcls: *i64 = sys_mmap((ldnt + 1) * 8) as *i64
683 let ldtst: *i64 = sys_mmap((ldnt + 1) * 8) as *i64
684 let ldroff: *i64 = sys_mmap((ldnr + 1) * 8) as *i64
685 let ldrrole: *i64 = sys_mmap((ldnr + 1) * 8) as *i64
686 let ldrtgt: *i64 = sys_mmap((ldnr + 1) * 8) as *i64
687 let ldrst: *i64 = sys_mmap((ldnr + 1) * 8) as *i64
688 ld_classify(prist, pn, ldtoff, ldtcls, ldtst, ldroff, ldrrole, ldrtgt, ldrst, ldc)
689 let ldv: i64 = ld_verdict(ldc)
690 rk_puts("LADDER targets=" as *u8); rk_pn(ldc[LD_N_TARGETS]); rk_puts(" best_in_class=" as *u8); rk_pn(ldc[LD_N_BIC]); rk_puts(" frontier=" as *u8); rk_pn(ldc[LD_N_FRONTIER]); rk_puts(" undated=" as *u8); rk_pn(ldc[LD_N_UNDATED]); rk_puts(" badclass=" as *u8); rk_pn(ldc[LD_N_BADCLASS]); rk_puts(" rungs=" as *u8); rk_pn(ldc[LD_N_RUNGS]); rk_puts(" placed=" as *u8); rk_pn(ldc[LD_N_PLACED]); rk_puts(" unplaced=" as *u8); rk_pn(ldc[LD_N_UNPLACED]); rk_puts(" badrole=" as *u8); rk_pn(ldc[LD_N_BADROLE]); rk_puts(" badtarget=" as *u8); rk_pn(ldc[LD_N_BADTARGET]); rk_puts(" sum=" as *u8); rk_pn(ld_partition_sum(ldc)); rk_puts(" substrate=" as *u8); rk_pn(ldc[LD_N_SUBSTRATE]); rk_puts(" arm=" as *u8); rk_pn(ldc[LD_N_ARM]); rk_puts(" contender=" as *u8); rk_pn(ldc[LD_N_CONTENDER]); rk_puts(" superseded=" as *u8); rk_pn(ldc[LD_N_SUPERSEDED]); rk_puts(" orphans=" as *u8); rk_pn(ldc[LD_N_ORPHANS]); rk_puts(" verdict=" as *u8); rk_puts(ld_verdict_name(ldv)); rk_puts("\n" as *u8)
691 if ldv == LD_EXIT_NOLADDER { rk_puts("LADDER NO-LADDER: this plan names no sotatarget| row, so what best-in-class and the frontier ARE is UNDECLARED -- LABELED, ranking proceeds; declare a dated best-in-class and a dated frontier target (sotatarget|<id>|<class>|<sotabar id>|<statement>|<ref>) and a rungrole|<rung>|<role>|<target>|<why> row per rung to opt into the hard fail\n" as *u8) }
692 if ldv == LD_EXIT_PARTIAL {
693 rk_puts("RANK REFUSED: LADDER-PARTIAL -- this board declared its ladder to SOTA and left it half-declared: a target without a sotabar row, a class or role outside the vocabulary, a rung with no rungrole row, or a rungrole row naming no rung or no target. The board hands out no work on a half-declared ladder: run nx_ladder " as *u8); rk_puts(dom); rk_puts(" for the per-target and per-rung states and complete the declaration\n" as *u8)
694 return RANK_EXIT_LADDER_PARTIAL
695 }
696 // ---- derive v/m/c per OPEN rung (a rung whose symbol is measured PRESENT is done: skipped, counted) ----
697 let ov: *i64 = sys_mmap(nr * 8) as *i64
698 let om: *i64 = sys_mmap(nr * 8) as *i64
699 let oc: *i64 = sys_mmap(nr * 8) as *i64
700 let oidx: *i64 = sys_mmap(nr * 8) as *i64
701 let onote: *i64 = sys_mmap(nr * 8) as *i64
702 let rdone: *i64 = sys_mmap(nr * 8) as *i64
703 let rmi: *i64 = sys_mmap(nr * 8) as *i64
704 // DARK CONTRACT per rung (2026-09-06, operator: a permanent fix, we do not build and lose capability to darkness):
705 // 1 when the rung's matrix row names an organ that EXISTS and was read but does not declare the contracted
706 // symbol -- something shipped under another name; printed on the rung line so the repoint is priced as work.
707 let rdark_r: *i64 = sys_mmap(nr * 8) as *i64
708 var nopen: i64 = 0
709 var ndone: i64 = 0
710 // PASS A: measure every rung's presence first, so the momentum pass can read ANY dependency's
711 // state regardless of declaration order.
712 var i: i64 = 0
713 while i < nr {
714 var mi: i64 = 0 - 1
715 var q: i64 = 0
716 while q < mrows { if rk_sym_is(msym[q] as *u8, rsym[i] as *u8) == 1 { mi = q; q = mrows } q = q + 1 }
717 var done: i64 = 0
718 if mi >= 0 {
719 if mpres[mi] == 1 { done = 1 }
720 else {
721 var symp: *u8 = msym[mi] as *u8
722 if rk_starts(symp, "_ABSENT_:" as *u8) == 1 { symp = (symp as i64 + 9) as *u8 }
723 done = rk_measure(morg[mi] as *u8, symp)
724 if done == 0 { rdark_r[i] = rk_dark(morg[mi] as *u8, symp) }
725 }
726 }
727 rdone[i] = done
728 rmi[i] = mi
729 if done == 1 { ndone = ndone + 1 }
730 i = i + 1
731 }
732 // ---- CE2: ADOPTION of every DONE rung (present by symbol) -- FULL or PARTIAL, judged by the shared
733 // classifier (program ladder / library importer reach / gate execution surfaces), memoised per organ ----
734 let ads: *i64 = sys_mmap(CLB_N * 8) as *i64
735 clb_load(ads)
736 let rfin: *i64 = sys_mmap(nr * 8) as *i64
737 let rtok: *i64 = sys_mmap(nr * 8) as *i64
738 let rrem: *i64 = sys_mmap(nr * 8) as *i64
739 let mname: *i64 = sys_mmap(nr * 8) as *i64
740 let mtok: *i64 = sys_mmap(nr * 8) as *i64
741 let mful: *i64 = sys_mmap(nr * 8) as *i64
742 let mrem: *i64 = sys_mmap(nr * 8) as *i64
743 var mc: i64 = 0
744 var nfinish: i64 = 0
745 var fi: i64 = 0
746 while fi < nr {
747 rfin[fi] = 0
748 rtok[fi] = "" as *u8 as i64
749 rrem[fi] = "" as *u8 as i64
750 if rdone[fi] == 1 { if rmi[fi] >= 0 {
751 let oname: *u8 = sys_mmap(CLB_TOK_CAP)
752 cl_name_of_path(morg[rmi[fi]] as *u8, oname, CLB_TOK_CAP)
753 var hit: i64 = 0 - 1
754 var mk: i64 = 0
755 while mk < mc { if rk_streq(mname[mk] as *u8, oname) == 1 { hit = mk; mk = mc } mk = mk + 1 }
756 if hit < 0 {
757 let tokb: *u8 = sys_mmap(CLB_TOK_CAP)
758 let remp: *i64 = sys_mmap(8) as *i64
759 let ful: i64 = clb_classify(oname, ads, tokb, remp)
760 mname[mc] = oname as i64; mtok[mc] = tokb as i64; mful[mc] = ful; mrem[mc] = remp[0]
761 hit = mc
762 mc = mc + 1
763 }
764 rtok[fi] = mtok[hit]
765 rrem[fi] = mrem[hit]
766 if mful[hit] != CLB_FULL { rfin[fi] = 1; nfinish = nfinish + 1 }
767 } }
768 fi = fi + 1
769 }
770 // the stamped artefact: sized from the rows it will hold, never a cap
771 let binding_cap: i64 = rk_slen("# inputs_v=1 plan_sha256= plan_bytes= matrix_sha256= matrix_bytes=\n") + sg_len(captured.plan_sha) + sg_len(captured.matrix_sha) + RK_DEC_MAX*2
772 var rkcap: i64 = RANK_FIX_TAIL + rk_slen(dom) + 64 + binding_cap
773 var rkz: i64 = 0
774 // + RANK_UNMAPPED_ROW and a SECOND id/sym pair per rung (2026-09-01): every rung can now also emit
775 // an `unmapped|<id>|<sym>|...` row, and id and sym appear in BOTH that row and its rank| row. Budget
776 // for the worst case -- every rung unmapped -- because a cap that assumes some rungs are carried
777 // would under-size exactly on the board that most needs this row.
778 while rkz < nr { rkcap = rkcap + RANK_FIX_PER_RUNG + RANK_UNMAPPED_ROW + rk_slen(rid[rkz] as *u8) + rk_slen(rid[rkz] as *u8) + rk_slen(rtitle[rkz] as *u8) + rk_slen(rsym[rkz] as *u8) + rk_slen(rsym[rkz] as *u8) + rk_slen(rtok[rkz] as *u8) + rk_slen(rrem[rkz] as *u8); rkz = rkz + 1 }
779 let rkbuf: *u8 = sys_mmap(rkcap)
780 var rko: i64 = rk_cat(rkbuf, 0, "# " as *u8); rko = rk_cat(rkbuf, rko, dom); rko = rk_cat(rkbuf, rko, ".rank -- NX-DERIVED: regenerated artefact, not authored memory (nx_compare_rank). rows: finish|id|title|sym|state|remedy . rank|n|stage|id|priority|v|m|c|title|sym . unmapped-count|n|why . unmapped|id|sym|reason (a rung NO matrix row carries: priced at zero, so the dimension is invisible to every consumer -- the count is emitted even when it is 0, because a declared zero proves the check ran and silence does not) . last line = stamp\n" as *u8)
781 rko=rk_cat(rkbuf,rko,"# inputs_v=1 plan_sha256=" as *u8);rko=rk_cat(rkbuf,rko,captured.plan_sha)
782 rko=rk_cat(rkbuf,rko," plan_bytes=" as *u8);rko=rk_catn(rkbuf,rko,pn)
783 rko=rk_cat(rkbuf,rko," matrix_sha256=" as *u8);rko=rk_cat(rkbuf,rko,captured.matrix_sha)
784 rko=rk_cat(rkbuf,rko," matrix_bytes=" as *u8);rko=rk_catn(rkbuf,rko,mn);rko=rk_cat(rkbuf,rko,"\n" as *u8)
785 var fp: i64 = 0
786 while fp < nr {
787 if rfin[fp] == 1 {
788 rk_puts(" F [FINISH] " as *u8); rk_puts(rid[fp] as *u8); rk_puts(" state=" as *u8); rk_puts(rtok[fp] as *u8); rk_puts(" | " as *u8); rk_puts(rtitle[fp] as *u8); rk_puts(" [" as *u8); rk_puts(rsym[fp] as *u8); rk_puts("] " as *u8); rk_puts(rrem[fp] as *u8); rk_puts("\n" as *u8)
789 rko = rk_cat(rkbuf, rko, "finish|" as *u8); rko = rk_cat(rkbuf, rko, rid[fp] as *u8); rko = rk_cat(rkbuf, rko, "|" as *u8); rko = rk_cat(rkbuf, rko, rtitle[fp] as *u8); rko = rk_cat(rkbuf, rko, "|" as *u8); rko = rk_cat(rkbuf, rko, rsym[fp] as *u8)
790 rko = rk_cat(rkbuf, rko, "|" as *u8); rko = rk_cat(rkbuf, rko, rtok[fp] as *u8); rko = rk_cat(rkbuf, rko, "|" as *u8); rko = rk_cat(rkbuf, rko, rrem[fp] as *u8); rko = rk_cat(rkbuf, rko, "\n" as *u8)
791 }
792 fp = fp + 1
793 }
794 // sponsor plane, loaded ONCE through the CLI lane (a fork per rung would be N forks for one read)
795 let spav: *i64 = sys_mmap(8 * 8) as *i64
796 spav[0] = "./nx_store_put.elf" as *u8 as i64
797 spav[1] = "sponsor-" as *u8 as i64
798 spav[2] = "load" as *u8 as i64
799 spav[3] = 0
800 let splane: *u8 = sys_mmap(SPONSOR_PLANE_CAP)
801 let splen: *i64 = sys_mmap(16) as *i64
802 splen[0] = 0
803 tr_run_capture("./nx_store_put.elf" as *u8, spav, splane, SPONSOR_PLANE_CAP - 1, splen)
804 let splines: i64 = rk_lines(splane, splen[0]) // the most rows any note could name: every row of the plane
805 // a capture that fills its pipe budget is a PREFIX: say so (the plane is a fork, its size unknowable)
806 if splen[0] >= SPONSOR_PLANE_CAP - 1 { rk_puts("SPONSOR plane CAPTURE-FULL at SPONSOR_PLANE_CAP -- rows past the cap are NOT applied, LABELED\n" as *u8) }
807 // a plane that failed to load is UNOBSERVED, not empty: say so once, rank without the term
808 if splen[0] <= 0 { rk_puts("SPONSOR plane UNOBSERVED (load returned nothing) -- ranking without the sponsorship term, LABELED\n" as *u8) }
809 // PR11: the self-sufficiency ledger, read ONCE. A plain file read, not a plane fork: the ledger is
810 // a derived artefact with ONE writer (nx_selfsuff census), so it needs neither a segment commit nor
811 // a fork per rung, and under the load this estate actually runs at that difference is the whole
812 // cost of the term.
813 let ssbp: *i64 = sys_mmap(16) as *i64
814 var ssn: i64 = rk_read_all(ssledp, ssbp) // the WHOLE ledger (a file, sized from itself)
815 let ssbuf: *u8 = ssbp[0] as *u8
816 if ssn < 0 { ssn = 0 }
817 if ssn <= 0 { rk_puts("SELFSUFF ledger UNOBSERVED (nothing at " as *u8); rk_puts(ssledp); rk_puts(") -- ranking without the self-sufficiency term, LABELED per rung\n" as *u8) }
818 else { rk_puts("SELFSUFF ledger " as *u8); rk_puts(ssledp); rk_puts(" bytes=" as *u8); rk_pn(ssn); rk_puts("\n" as *u8) }
819 // ---- ENABLEMENT (foundation-first, from the dependency graph): for each open rung, how many OTHER
820 // open rungs have it in their transitive dependency closure. A rung that unblocks five others is
821 // worth five downstream deliveries -- this is the WSJF "opportunity enablement" leg and the real-
822 // options "compound option" value, both COUNTED from dep rows, never chosen. O(n^2) closure walk
823 // over nr rungs (nr is the plan's own count; the former "<=64" was the cap this lane removed).
824 let enab: *i64 = sys_mmap(nr * 8) as *i64
825 var ez: i64 = 0
826 while ez < nr { enab[ez] = 0; ez = ez + 1 }
827 var a6: i64 = 0
828 while a6 < nr {
829 if rdone[a6] == 0 {
830 // closure of a6's deps: mark reachable open rungs
831 let reach: *i64 = sys_mmap(nr * 8) as *i64
832 var z6: i64 = 0
833 while z6 < nr { reach[z6] = 0; z6 = z6 + 1 }
834 rk_list_scan(rdeps[a6] as *u8, 1, rid, nr, rdone, reach)
835 var it6: i64 = 0
836 while it6 < nr {
837 var grew: i64 = 0
838 var b6: i64 = 0
839 while b6 < nr {
840 if reach[b6] == 1 {
841 var pre6: i64 = 0; var q6: i64 = 0
842 while q6 < nr { pre6 = pre6 + reach[q6]; q6 = q6 + 1 }
843 rk_list_scan(rdeps[b6] as *u8, 1, rid, nr, rdone, reach)
844 var post6: i64 = 0; q6 = 0
845 while q6 < nr { post6 = post6 + reach[q6]; q6 = q6 + 1 }
846 if post6 > pre6 { grew = 1 }
847 }
848 b6 = b6 + 1
849 }
850 if grew == 0 { it6 = nr }
851 it6 = it6 + 1
852 }
853 // every rung in a6's closure enables a6: credit each
854 var c6: i64 = 0
855 while c6 < nr { if reach[c6] == 1 { enab[c6] = enab[c6] + 1 } c6 = c6 + 1 }
856 }
857 a6 = a6 + 1
858 }
859 // ---- rival total for the cost-of-delay ratio (from @cols) ----
860 var nriv: i64 = ncol
861 if nriv < 1 { nriv = 1 }
862 // PASS B: derive v/m/c for the open rungs
863 i = 0
864 while i < nr {
865 let mi: i64 = rmi[i]
866 if rdone[i] == 1 { } else {
867 var v: i64 = 0
868 // the note is literals + numbers + (sponsor rows named verbatim, bounded by the plane's own
869 // length) + (the organ path the selfsuff term echoes): sized from those parts, never a cap
870 var nbcap: i64 = RK_NOTE_LITERALS + RK_NOTE_NUMS * RK_DEC_MAX + splen[0] + splines * RK_SPONSOR_ROW_LITERALS + rk_slen(dom) + rk_slen(rid[i] as *u8) + rk_slen(rsym[i] as *u8) + 16
871 if mi >= 0 { nbcap = nbcap + rk_slen(morg[mi] as *u8) }
872 let nb: *u8 = sys_mmap(nbcap)
873 var no: i64 = 0
874 if mi >= 0 {
875 // COST OF DELAY (WSJF): the deficit is the value at stake; the fraction of rivals already
876 // LEADING (code 2) on this row is the time-criticality -- every day open, that many rivals
877 // widen the gap. CoD = deficit x leading / rivals, in the same integer units as deficit,
878 // plus the deficit itself as the base value. Both from the matrix codes.
879 let lead: i64 = mlead[mi]
880 let cod: i64 = mdef[mi] * lead / nriv
881 v = mdef[mi] + cod
882 if rdark_r[i] == 1 { no = rk_cat(nb, no, "DARK-CONTRACT(organ exists, symbol undeclared: repoint the rung AND its row to the real entry point, or rename the function) " as *u8) }
883 no = rk_cat(nb, no, "deficit=" as *u8); no = rk_catn(nb, no, mdef[mi])
884 no = rk_cat(nb, no, " cod=deficit*leading/rivals=" as *u8); no = rk_catn(nb, no, cod)
885 // REAL-OPTION VALUE (exceed lane): a row NO rival has is an option on a lead; its value
886 // is what it unlocks -- the enablement count in deficit units, plus one for the lead
887 // itself. DERIVED, replacing the former constant bonus.
888 // the option is the LEAD itself (1) on top of the enablement every rung already carries
889 // below -- counting enables inside the option AND as its own leg double-charged exceed
890 // rows (measured 2026-08-18: R14 printed option=1+enables=8 AND +enables=7). One leg each.
891 if mall0[mi] == 1 { v = v + 1; no = rk_cat(nb, no, " +option(all rivals absent: a lead nobody holds)=1" as *u8) }
892 } else { no = rk_cat(nb, no, "UNMAPPED(no matrix row carries this symbol) value=0" as *u8) }
893 // ENABLEMENT: downstream open rungs this one unblocks (foundation-first, from dep rows)
894 v = v + enab[i]
895 no = rk_cat(nb, no, " +enables=" as *u8); no = rk_catn(nb, no, enab[i])
896 // momentum: 1 + deps measured present
897 var mom: i64 = 1
898 let ds: *u8 = rdeps[i] as *u8
899 if ds[0] != (45 as u8) {
900 // deps are comma-separated rung ids; resolve each to its symbol, then to matrix presence
901 let dtmp: *u8 = sys_mmap(rk_slen(ds) + 2)
902 var di: i64 = 0; var dj: i64 = 0
903 var run: i64 = 1
904 while run == 1 {
905 if ds[di] == (44 as u8) { dtmp[dj] = 0 as u8; dj = 0
906 var r2: i64 = 0; while r2 < nr { if rk_streq(rid[r2] as *u8, dtmp) == 1 { if rdone[r2] == 1 { mom = mom + 1 } r2 = nr } r2 = r2 + 1 }
907 } else { if ds[di] == (0 as u8) { dtmp[dj] = 0 as u8; run = 0
908 var r3: i64 = 0; while r3 < nr { if rk_streq(rid[r3] as *u8, dtmp) == 1 { if rdone[r3] == 1 { mom = mom + 1 } r3 = nr } r3 = r3 + 1 }
909 } else { dtmp[dj] = ds[di]; dj = dj + 1 } }
910 di = di + 1
911 }
912 }
913 no = rk_cat(nb, no, " momentum=1+deps-present=" as *u8); no = rk_catn(nb, no, mom)
914 var cst: i64 = rest[i]
915 if cst <= 0 { cst = RANK_COST_UNKNOWN; no = rk_cat(nb, no, " cost=UNESTIMATED->" as *u8); no = rk_catn(nb, no, RANK_COST_UNKNOWN) } else { no = rk_cat(nb, no, " cost_tenths=" as *u8); no = rk_catn(nb, no, cst) }
916 // CLUSTER COHERENCE: open rungs whose matrix rows name the SAME organ file share substrate
917 // (one read of the code, one build lane, one gate to extend). Cost is divided by the cluster
918 // size for every member -- adjacent scheduling pays the shared setup once. Measured from the
919 // organ column, never labelled by hand; a singleton cluster divides by 1.
920 if mi >= 0 {
921 var clu: i64 = 0
922 var k7: i64 = 0
923 while k7 < nr { if rdone[k7] == 0 { if rmi[k7] >= 0 { if rk_streq(morg[rmi[k7]] as *u8, morg[mi] as *u8) == 1 { clu = clu + 1 } } } k7 = k7 + 1 }
924 if clu > 1 { cst = cst / clu; if cst < 1 { cst = 1 } no = rk_cat(nb, no, " cluster=" as *u8); no = rk_catn(nb, no, clu); no = rk_cat(nb, no, "->cost/cluster=" as *u8); no = rk_catn(nb, no, cst) }
925 }
926 if v <= 0 { v = 0 }
927 // PR6: sponsorship coefficient (x4 fixed-point), applied to VALUE so a standing order moves
928 // the ordering the way the operator meant, and every row that fired is printed by id
929 if splen[0] > 0 {
930 let noo: *i64 = sys_mmap(16) as *i64
931 // the term NUL-splits its buffer in place: hand it a COPY so the plane stays intact for
932 // the next rung (one load, N cheap copies -- never N forks, never a corrupted re-read)
933 let scopy: *u8 = sys_mmap(splen[0] + 16)
934 var cz: i64 = 0
935 while cz < splen[0] { scopy[cz] = splane[cz]; cz = cz + 1 }
936 scopy[splen[0]] = 0 as u8
937 let sm: i64 = rk_sponsor_term(scopy, splen[0], dom, rid[i] as *u8, rsym[i] as *u8, nb, no, noo)
938 no = noo[0]
939 v = v * sm / SPONSOR_BASE
940 }
941 // PR11: the self-sufficiency coefficient (x4 fixed-point), applied to VALUE so a rung that
942 // ships a capability standing on outside dependency is priced for what it actually
943 // delivers. Floored at SELFSUFF_FLOOR: it DEMOTES, it never hides. A rung whose organ has
944 // zero measured dependency comes back at SELFSUFF_BASE and its value is untouched.
945 if mi >= 0 {
946 let noo2: *i64 = sys_mmap(16) as *i64
947 let ssm: i64 = rk_selfsuff_term(ssbuf, ssn, dom, morg[mi] as *u8, nb, no, noo2)
948 no = noo2[0]
949 v = v * ssm / SELFSUFF_BASE
950 } else { no = rk_cat(nb, no, " selfsuff=NO-MATRIX-ROW(no organ to look up)" as *u8) }
951 ov[nopen] = v; om[nopen] = mom; oc[nopen] = cst; oidx[nopen] = i; onote[nopen] = nb as i64
952 nopen = nopen + 1
953 }
954 i = i + 1
955 }
956 // ---- CRITICAL PATH: the first version whose milestone rungs are not all measured present is the
957 // TARGET; its open rungs plus their transitive open dependencies are the path. Everything else is
958 // real work for a LATER version and ranks after -- the version ladder, not a seat's taste, decides.
959 let crit: *i64 = sys_mmap(nr * 8) as *i64
960 var cz: i64 = 0
961 while cz < nr { crit[cz] = 0; cz = cz + 1 }
962 var tgt: i64 = 0 - 1
963 var vv: i64 = 0
964 while vv < nver {
965 var mm: i64 = 0 - 1
966 var s5: i64 = 0
967 while s5 < nms { if rk_streq(msid[s5] as *u8, vms[vv] as *u8) == 1 { mm = s5; s5 = nms } s5 = s5 + 1 }
968 if mm >= 0 { if tgt < 0 {
969 let unmet: i64 = rk_list_scan(msrungs[mm] as *u8, 0, rid, nr, rdone, crit)
970 if unmet > 0 { tgt = vv; rk_list_scan(msrungs[mm] as *u8, 1, rid, nr, rdone, crit) }
971 } }
972 vv = vv + 1
973 }
974 // transitive closure over declared deps (only OPEN deps join the path)
975 var itc: i64 = 0
976 while itc < nr {
977 var ch: i64 = 0
978 var a5: i64 = 0
979 while a5 < nr {
980 if crit[a5] == 1 {
981 let before: i64 = rk_list_scan(rdeps[a5] as *u8, 0, rid, nr, rdone, crit)
982 if before > 0 {
983 // count marks added by mode 1: re-scan marking; ch set if any newly marked
984 var b5: i64 = 0
985 var pre: i64 = 0
986 while b5 < nr { pre = pre + crit[b5]; b5 = b5 + 1 }
987 rk_list_scan(rdeps[a5] as *u8, 1, rid, nr, rdone, crit)
988 var post: i64 = 0
989 b5 = 0
990 while b5 < nr { post = post + crit[b5]; b5 = b5 + 1 }
991 if post > pre { ch = 1 }
992 }
993 }
994 a5 = a5 + 1
995 }
996 if ch == 0 { itc = nr }
997 itc = itc + 1
998 }
999 rk_puts("=== NX-COMPARE-RANK domain=" as *u8); rk_puts(dom); rk_puts(" rungs=" as *u8); rk_pn(nr); rk_puts(" done=" as *u8); rk_pn(ndone); rk_puts(" open=" as *u8); rk_pn(nopen); rk_puts(" finish(done-but-partially-adopted)=" as *u8); rk_pn(nfinish); rk_puts(" (partition sums: done+open=rungs; finish is a subset of done) matrix_rows=" as *u8); rk_pn(mrows); rk_puts(" fields_max=" as *u8); rk_pn(max_fields); rk_puts(" (derived bounds: rows<=matrix lines, rungs<=plan lines -- no cap)\n" as *u8)
1000 if tgt >= 0 { rk_puts("TARGET VERSION " as *u8); rk_puts(vlab[tgt] as *u8); rk_puts(" (milestone " as *u8); rk_puts(vms[tgt] as *u8); rk_puts(") -- critical-path rungs rank FIRST; the rest are staged later\n" as *u8) }
1001 else { if nver > 0 { rk_puts("ALL DECLARED VERSIONS MET -- ranking by value alone\n" as *u8) } else { rk_puts("NO ver| ladder in the plan -- add ver rows to stage the roadmap; ranking by value alone (LABELED)\n" as *u8) } }
1002 if nopen == 0 {
1003 rk_puts("RANK: nothing open -- every rung's symbol is measured present\n" as *u8)
1004 if rk_write_rank(dom, rkbuf, rko, nr, ndone, nopen, nfinish, tgt, vlab)!=0 { return 8 }
1005 return 0
1006 }
1007 // ---- fork nx_dr_ocm with the triples ----
1008 let av: *i64 = sys_mmap(8 * (4 + 3 * nopen + 2)) as *i64 // argv0, budget, 3 per open rung, NULL
1009 av[0] = "./nx_dr_ocm_cli.elf" as *u8 as i64
1010 let bs: *u8 = sys_mmap(RK_NUMBUF); rk_catn(bs, 0, budget)
1011 av[1] = bs as i64
1012 var ai: i64 = 2
1013 var k: i64 = 0
1014 while k < nopen {
1015 let sv: *u8 = sys_mmap(RK_NUMBUF); rk_catn(sv, 0, ov[k]); av[ai] = sv as i64; ai = ai + 1
1016 let sm: *u8 = sys_mmap(RK_NUMBUF); rk_catn(sm, 0, om[k]); av[ai] = sm as i64; ai = ai + 1
1017 let sc: *u8 = sys_mmap(RK_NUMBUF); rk_catn(sc, 0, oc[k]); av[ai] = sc as i64; ai = ai + 1
1018 k = k + 1
1019 }
1020 av[ai] = 0
1021 // capture sized from the population: one JSON object per open rung + header/footer (see the consts)
1022 let out_cap: i64 = RK_OCM_HDR_BYTES + nopen * RK_OCM_OBJ_BYTES
1023 let out: *u8 = sys_mmap(out_cap)
1024 let olen: *i64 = sys_mmap(16) as *i64
1025 let rank_rc: i64=tr_run_capture("./nx_dr_ocm_cli.elf" as *u8, av, out, out_cap - 1, olen)
1026 if rank_rc!=0 { rk_puts("RANK REFUSED: prioritization child failed\n" as *u8);return 4 }
1027 if olen[0] <= 0 { rk_puts("RANK REFUSED: nx_dr_ocm returned nothing\n" as *u8); return 4 }
1028 if olen[0] >= out_cap - 1 { rk_puts("RANK REFUSED: nx_dr_ocm output FILLED its derived capture (RK_OCM_OBJ_BYTES/HDR undersized for this emitter -- the ranking would be a prefix)\n" as *u8); return 4 }
1029 // ---- parse the ranking: sequence of {"rank":R,"id":I,...,"priority":P,...} objects, in rank order ----
1030 // walk "\"id\":" occurrences; the object's rank and priority follow/precede in a fixed field order
1031 let rank_of: *i64 = sys_mmap(nopen * 8) as *i64
1032 let pri_of: *i64 = sys_mmap(nopen * 8) as *i64
1033 var z: i64 = 0
1034 while z < nopen { rank_of[z] = 0; pri_of[z] = 0; z = z + 1 }
1035 var oi: i64 = 0
1036 var currank: i64 = 0
1037 while oi + 8 < olen[0] {
1038 if out[oi] == (34 as u8) { if out[oi+1] == (114 as u8) { if out[oi+2] == (97 as u8) { if out[oi+3] == (110 as u8) { if out[oi+4] == (107 as u8) { if out[oi+5] == (34 as u8) { if out[oi+6] == (58 as u8) {
1039 var jj: i64 = oi + 7; var rv: i64 = 0
1040 var gj: i64 = 1
1041 while gj == 1 { if jj < olen[0] { if out[jj] >= (48 as u8) { if out[jj] <= (57 as u8) { rv = rv * 10 + ((out[jj] as i64) - 48); jj = jj + 1 } else { gj = 0 } } else { gj = 0 } } else { gj = 0 } }
1042 currank = rv
1043 } } } } } } }
1044 if out[oi] == (34 as u8) { if out[oi+1] == (105 as u8) { if out[oi+2] == (100 as u8) { if out[oi+3] == (34 as u8) { if out[oi+4] == (58 as u8) {
1045 var jj2: i64 = oi + 5; var idv: i64 = 0
1046 var gj2: i64 = 1
1047 while gj2 == 1 { if jj2 < olen[0] { if out[jj2] >= (48 as u8) { if out[jj2] <= (57 as u8) { idv = idv * 10 + ((out[jj2] as i64) - 48); jj2 = jj2 + 1 } else { gj2 = 0 } } else { gj2 = 0 } } else { gj2 = 0 } }
1048 if idv < nopen { rank_of[idv] = currank }
1049 } } } } }
1050 if out[oi] == (34 as u8) { if rk_starts((out as i64 + oi) as *u8, "\"priority\":" as *u8) == 1 {
1051 var jj3: i64 = oi + 11; var pv: i64 = 0
1052 var gj3: i64 = 1
1053 while gj3 == 1 { if jj3 < olen[0] { if out[jj3] >= (48 as u8) { if out[jj3] <= (57 as u8) { pv = pv * 10 + ((out[jj3] as i64) - 48); jj3 = jj3 + 1 } else { gj3 = 0 } } else { gj3 = 0 } } else { gj3 = 0 } }
1054 // the id for this object was the last id seen: attribute priority to it
1055 var lastid: i64 = 0 - 1
1056 var back: i64 = oi
1057 while back > 0 { if out[back] == (34 as u8) { if rk_starts((out as i64 + back) as *u8, "\"id\":" as *u8) == 1 { var jb: i64 = back + 5; var iv: i64 = 0; var gb: i64 = 1; while gb == 1 { if jb < olen[0] { if out[jb] >= (48 as u8) { if out[jb] <= (57 as u8) { iv = iv * 10 + ((out[jb] as i64) - 48); jb = jb + 1 } else { gb = 0 } } else { gb = 0 } } else { gb = 0 } } lastid = iv; back = 0 } } back = back - 1 }
1058 if lastid >= 0 { if lastid < nopen { pri_of[lastid] = pv } }
1059 } }
1060 oi = oi + 1
1061 }
1062 // ---- print in rank order + publish the plane ----
1063 // THE PREFIX IS A PATH AND MUST BE SPELLED IN FULL. Measured 2026-08-23: the bare "comparerank-<dom>"
1064 // resolved against the CWD, so every published order landed at the nishihost ROOT (segments beside the
1065 // binaries), knowledge/store/comparerank-* read EMPTY, and a seat concluded the ranker committed nothing.
1066 let pfx: *u8 = sys_mmap(dlen + 48) // "knowledge/store/comparerank-" (28) + dom + NUL
1067 var pfo: i64 = rk_cat(pfx, 0, "knowledge/store/comparerank-" as *u8); pfo = rk_cat(pfx, pfo, dom)
1068 // ---- two-pass order: critical-path rungs first (in ranker order), then the rest ----
1069 let ord: *i64 = sys_mmap(nopen * 8) as *i64
1070 var no2: i64 = 0
1071 var pass2: i64 = 0
1072 while pass2 < 2 {
1073 var rr2: i64 = 1
1074 while rr2 <= nopen {
1075 var f2: i64 = 0
1076 while f2 < nopen {
1077 if rank_of[f2] == rr2 {
1078 var isc: i64 = crit[oidx[f2]]
1079 if pass2 == 0 { if isc == 1 { ord[no2] = f2; no2 = no2 + 1 } }
1080 else { if isc == 0 { ord[no2] = f2; no2 = no2 + 1 } }
1081 f2 = nopen
1082 }
1083 f2 = f2 + 1
1084 }
1085 rr2 = rr2 + 1
1086 }
1087 pass2 = pass2 + 1
1088 }
1089 var r: i64 = 1
1090 var published: i64 = 0
1091 var pmfiled: i64 = 0
1092 // the queue note holds one entry per open rung: "#" r "[" stage "]" id "=" pri " " -- sized from the
1093 // ids and stage labels it will actually hold (RK_DEC_MAX per number), so it cannot fill and the
1094 // former ...TRUNCATED-AT-CAP suffix has no path to fire: the row IS the whole order now
1095 var qcap: i64 = 16
1096 var qk: i64 = 0
1097 while qk < nver { qcap = qcap + rk_slen(vlab[qk] as *u8); qk = qk + 1 } // the longest stage label <= sum of labels
1098 var qk2: i64 = 0
1099 while qk2 < nopen { qcap = qcap + 8 + 2 * RK_DEC_MAX + rk_slen(rid[oidx[qk2]] as *u8) + qcap_stage_max(vlab, nver); qk2 = qk2 + 1 }
1100 var qk3: i64 = 0
1101 while qk3 < nr { if rfin[qk3] == 1 { qcap = qcap + 4 + rk_slen(rid[qk3] as *u8) + rk_slen(rtok[qk3] as *u8) } qk3 = qk3 + 1 }
1102 let qbuf: *u8 = sys_mmap(qcap)
1103 var qlen: i64 = 0
1104 var qf: i64 = 0
1105 while qf < nr { if rfin[qf] == 1 { qlen = rk_cat(qbuf, qlen, "F[" as *u8); qlen = rk_cat(qbuf, qlen, rtok[qf] as *u8); qlen = rk_cat(qbuf, qlen, "]" as *u8); qlen = rk_cat(qbuf, qlen, rid[qf] as *u8); qlen = rk_cat(qbuf, qlen, " " as *u8) } qf = qf + 1 }
1106 var qtop: i64 = "-" as *u8 as i64
1107 var qtoptitle: i64 = "-" as *u8 as i64
1108 var qtoppri: i64 = 0
1109 while r <= no2 {
1110 let found: i64 = ord[r - 1]
1111 if found >= 0 {
1112 let ri: i64 = oidx[found]
1113 var stg: *u8 = "later" as *u8
1114 if crit[ri] == 1 { if tgt >= 0 { stg = vlab[tgt] as *u8 } }
1115 rk_puts(" #" as *u8); rk_pn(r); rk_puts(" [" as *u8); rk_puts(stg); rk_puts("] " as *u8); rk_puts(rid[ri] as *u8); rk_puts(" priority=" as *u8); rk_pn(pri_of[found])
1116 rk_puts(" v=" as *u8); rk_pn(ov[found]); rk_puts(" m=" as *u8); rk_pn(om[found]); rk_puts(" c=" as *u8); rk_pn(oc[found])
1117 rk_puts(" | " as *u8); rk_puts(rtitle[ri] as *u8); rk_puts(" [" as *u8); rk_puts(rsym[ri] as *u8); rk_puts("] " as *u8); rk_puts(onote[found] as *u8); rk_puts("\n" as *u8)
1118 rko = rk_cat(rkbuf, rko, "rank|" as *u8); rko = rk_catn(rkbuf, rko, r); rko = rk_cat(rkbuf, rko, "|" as *u8); rko = rk_cat(rkbuf, rko, stg); rko = rk_cat(rkbuf, rko, "|" as *u8); rko = rk_cat(rkbuf, rko, rid[ri] as *u8)
1119 rko = rk_cat(rkbuf, rko, "|" as *u8); rko = rk_catn(rkbuf, rko, pri_of[found]); rko = rk_cat(rkbuf, rko, "|" as *u8); rko = rk_catn(rkbuf, rko, ov[found]); rko = rk_cat(rkbuf, rko, "|" as *u8); rko = rk_catn(rkbuf, rko, om[found]); rko = rk_cat(rkbuf, rko, "|" as *u8); rko = rk_catn(rkbuf, rko, oc[found])
1120 rko = rk_cat(rkbuf, rko, "|" as *u8); rko = rk_cat(rkbuf, rko, rtitle[ri] as *u8); rko = rk_cat(rkbuf, rko, "|" as *u8); rko = rk_cat(rkbuf, rko, rsym[ri] as *u8); rko = rk_cat(rkbuf, rko, "\n" as *u8)
1121 // ONE PLANE ROW PER DOMAIN, accumulated here and committed ONCE after the loop. The v5 draft
1122 // committed one row PER RUNG -- 19 fsync'd segment commits per domain, x7 domains, x the gate's
1123 // fixture -- and on 2026-08-18 that serialised into D-state store puts (wait_on_page_bit) that
1124 // stalled the fleet, the gate and the ship loop for an hour on a saturated array. Count the
1125 // syscalls per unit of output (§F): the printed table already carries every derivation, pm
1126 // intake carries the top rows; the plane needs the ORDER, and the order is one row.
1127 let qo0: i64 = qlen
1128 qlen = rk_cat(qbuf, qlen, "#" as *u8); qlen = rk_catn(qbuf, qlen, r); qlen = rk_cat(qbuf, qlen, "[" as *u8); qlen = rk_cat(qbuf, qlen, stg); qlen = rk_cat(qbuf, qlen, "]" as *u8); qlen = rk_cat(qbuf, qlen, rid[ri] as *u8); qlen = rk_cat(qbuf, qlen, "=" as *u8); qlen = rk_catn(qbuf, qlen, pri_of[found]); qlen = rk_cat(qbuf, qlen, " " as *u8)
1129 if r == 1 { qtop = rid[ri]; qtoptitle = rtitle[ri]; qtoppri = pri_of[found] }
1130 // NISHI PM DRIVES (operator 2026-08-18): the top RANK_PM_TOP critical-path rungs are FILED
1131 // into the pm intake journal, so the work queue every seat reads starts from the ranking,
1132 // not from a seat's taste. Idempotence is the journal's triage lane's problem by design --
1133 // re-ranking re-asserts the same ask, which is a re-prioritisation signal, not noise.
1134 if artifact_only==0 { if r <= RANK_PM_TOP { if crit[ri] == 1 {
1135 let pav: *i64 = sys_mmap(8 * 8) as *i64
1136 // dom + " rank#" r + " stage=" stg + " " id + " " title + " priority=" pri + " sym=" sym
1137 let pt: *u8 = sys_mmap(rk_slen(dom) + rk_slen(stg) + rk_slen(rid[ri] as *u8) + rk_slen(rtitle[ri] as *u8) + rk_slen(rsym[ri] as *u8) + 2 * RK_DEC_MAX + 48)
1138 var pto: i64 = rk_cat(pt, 0, dom); pto = rk_cat(pt, pto, " rank#" as *u8); pto = rk_catn(pt, pto, r)
1139 pto = rk_cat(pt, pto, " stage=" as *u8); pto = rk_cat(pt, pto, stg)
1140 pto = rk_cat(pt, pto, " " as *u8); pto = rk_cat(pt, pto, rid[ri] as *u8)
1141 pto = rk_cat(pt, pto, " " as *u8); pto = rk_cat(pt, pto, rtitle[ri] as *u8)
1142 pto = rk_cat(pt, pto, " priority=" as *u8); pto = rk_catn(pt, pto, pri_of[found])
1143 pto = rk_cat(pt, pto, " sym=" as *u8); pto = rk_cat(pt, pto, rsym[ri] as *u8)
1144 pav[0] = "./nx_pm_intake.elf" as *u8 as i64
1145 pav[1] = "ask" as *u8 as i64
1146 pav[2] = "knowledge/status/pm_intake.jrnl" as *u8 as i64
1147 pav[3] = "nx_compare_rank" as *u8 as i64
1148 pav[4] = pt as i64
1149 pav[5] = 0
1150 let pout: *u8 = sys_mmap(RANK_FORK_CAP)
1151 let polen: *i64 = sys_mmap(16) as *i64
1152 tr_run_capture("./nx_pm_intake.elf" as *u8, pav, pout, RANK_FORK_CAP - 1, polen)
1153 if polen[0] >= RANK_FORK_CAP - 1 { rk_puts("PM intake receipt CAPTURE-FULL at RANK_FORK_CAP (receipt truncated, filing counted)\n" as *u8) }
1154 if polen[0] > 0 { pmfiled = pmfiled + 1 }
1155 } } }
1156 }
1157 r = r + 1
1158 }
1159 rk_puts("PM filed=" as *u8); rk_pn(pmfiled); rk_puts(" of top " as *u8); rk_pn(RANK_PM_TOP); rk_puts(" critical rungs into knowledge/status/pm_intake.jrnl\n" as *u8)
1160 // the ONE plane commit: id=<domain>, title=the #1 rung, sev=1, status=its priority, note=the ordered
1161 // queue "#r[stage]RUNG=priority ..." -- the whole order in one row, one segment commit
1162 if artifact_only==0 { if no2 > 0 {
1163 let sav: *i64 = sys_mmap(8 * 16) as *i64
1164 let spr: *u8 = sys_mmap(RK_NUMBUF); rk_catn(spr, 0, qtoppri)
1165 var sncap: i64 = 6 + qlen + 16 + 2 // "queue=" + the queue + " target_version=" + NUL
1166 if tgt >= 0 { sncap = sncap + rk_slen(vlab[tgt] as *u8) }
1167 let sn: *u8 = sys_mmap(sncap)
1168 var sno: i64 = rk_cat(sn, 0, "queue=" as *u8); sno = rk_cat(sn, sno, qbuf)
1169 if tgt >= 0 { sno = rk_cat(sn, sno, " target_version=" as *u8); sno = rk_cat(sn, sno, vlab[tgt] as *u8) }
1170 sav[0] = "./nx_store_put.elf" as *u8 as i64
1171 sav[1] = pfx as i64
1172 sav[2] = "put" as *u8 as i64
1173 sav[3] = "nx_compare_rank" as *u8 as i64
1174 sav[4] = dom as i64
1175 sav[5] = qtoptitle
1176 sav[6] = "1" as *u8 as i64
1177 sav[7] = spr as i64
1178 sav[8] = "pm" as *u8 as i64
1179 sav[9] = qtop
1180 sav[10] = sn as i64
1181 sav[11] = 0
1182 let sout: *u8 = sys_mmap(RANK_FORK_CAP)
1183 let solen: *i64 = sys_mmap(16) as *i64
1184 tr_run_capture("./nx_store_put.elf" as *u8, sav, sout, RANK_FORK_CAP - 1, solen)
1185 if solen[0] >= RANK_FORK_CAP - 1 { rk_puts("plane receipt CAPTURE-FULL at RANK_FORK_CAP (receipt truncated, publish counted)\n" as *u8) }
1186 if solen[0] > 0 { published = 1 }
1187 } }
1188 // PERSIST THE UNCARRIED-DIMENSION FINDING (2026-09-01) -- the ranker already KNEW this and threw it away.
1189 // A rung whose symbol no matrix row carries takes the UNMAPPED branch above and is priced at ZERO, but
1190 // it said so only on stdout: the .rank ARTIFACT had no field for it. So the one signal that names the
1191 // "measured, but carried by no column" defect died with whatever terminal ran the ranker -- for all 96
1192 // domains, on every run.
1193 // WHY THIS OUTRANKS THE ROWS IT PRINTS: that defect is exactly how /compare/search carried NO latency
1194 // row at all while its own declared 3000ms consumer bar (knowledge/uat_journeys.conf: search-query)
1195 // FAILED 41 consecutive hourly runs. The published critical path was computed on input that omitted
1196 // the only axis that was failing, and a seat had to NOTICE. Persisting it makes the artifact say so.
1197 // ★AN INSTRUMENT THAT PRINTS A FINDING BUT DOES NOT PERSIST IT HAS NOT PUBLISHED IT.
1198 // THE COUNT IS EMITTED EVEN WHEN ZERO: a declared zero is evidence the check RAN, while silence is
1199 // indistinguishable from the check being absent -- the estate's own abstain-never-acquit law. And the
1200 // count carries a NAMED WORKLIST, one row per offender, because a count without a worklist is not
1201 // actionable.
1202 // STRICTLY ADDITIVE, AND THE STAMP STAYS LAST: these rows are appended BEFORE rk_write_rank writes the
1203 // stamp, so every positional reader that takes the final line is unaffected, and no rank| row changes,
1204 // so a consumer parsing only rank| rows cannot even notice this.
1205 var unm: i64 = 0
1206 var uq: i64 = 0
1207 while uq < nr { if rmi[uq] < 0 { unm = unm + 1 } uq = uq + 1 }
1208 rko = rk_cat(rkbuf, rko, "unmapped-count|" as *u8)
1209 rko = rk_catn(rkbuf, rko, unm)
1210 rko = rk_cat(rkbuf, rko, "|rungs whose symbol NO matrix row carries: priced at zero, invisible to consumers\n" as *u8)
1211 uq = 0
1212 while uq < nr {
1213 if rmi[uq] < 0 {
1214 rko = rk_cat(rkbuf, rko, "unmapped|" as *u8)
1215 rko = rk_cat(rkbuf, rko, rid[uq] as *u8)
1216 rko = rk_cat(rkbuf, rko, "|" as *u8)
1217 rko = rk_cat(rkbuf, rko, rsym[uq] as *u8)
1218 rko = rk_cat(rkbuf, rko, "|no-matrix-row-carries-this-symbol\n" as *u8)
1219 }
1220 uq = uq + 1
1221 }
1222 rk_puts("RANK unmapped=" as *u8); rk_pn(unm); rk_puts(" rung(s) no matrix row carries -- now PERSISTED in the artifact, not merely printed\n" as *u8)
1223 if rk_write_rank(dom, rkbuf, rko, nr, ndone, nopen, nfinish, tgt, vlab)!=0 { return 8 }
1224 rk_puts("RANK published=" as *u8); rk_pn(published); rk_puts(" row(s) (one per domain, the whole order in its note) plane=" as *u8); rk_puts(pfx); rk_puts(" ranker=nx_dr_ocm rule=(deficit+CoD+option+enables)*sponsor*selfsuff*(1+deps-landed)/(est_tenths/cluster) provenance=WSJF+real-options+dep-graph+sovereignty-ledger (header + pmdash.refs)\n" as *u8)
1225 return 0
1226}