nx_treatment_lib.nx
buildroot/runtime/nx_treatment_lib.nx
about
nx_treatment_lib.nx -- THE ONE TREATMENT RULER (ecosystem EC49, 2026-09-16): every capability gets the three-step
treatment -- a PRIMITIVE reachable on the MCP and API surfaces, a WORKFLOW that composes it, an AGENT beat that
runs it -- and a board declares that treatment per rung as DATA the ranker judges.
WHY. Operator 2026-09-16: "make sure its mandatory that they get mcp and api and composable primitives and
workflows and agent treatment in our 1 2 3 step process". A rule a seat must remember is adopted at advice
rates; a ruler in the ranker is adopted at 100 percent, the same way the bar-age and ladder rulers were placed.
ROW (7 fields, on <domain>.plan):
treat|<rung>|mcp=<row>|api=<route>|prim=<lib>|wf=<planid>|agent=<row>
mcp the tool_allowlist.conf row (the MCP surface) the rung's organ answers to; verified against the allowlist
api the API route the row is reached through (the MCP surface IS the API: /api/tools/call name=<row>, /mcp);
verified as: declared AND its mcp row verified, since the route is the registered row
prim the composable primitive (the lib the organ composes) -- the caller verifies the source exists
wf the plan_run plan id whose rows compose the primitive (knowledge/store/plan-<id>-) -- caller verifies
agent the beat that runs it: a clockjobs-/clocksched- row name or a gateroster.conf row; verified against both
a value of - is MISSING; a declared value the check cannot find is ABSENT; a value the check cannot judge is
DECLARED (the caller passed no evidence for that field) -- three negatives, never one word.
VERDICT per row: COMPLETE (five fields PRESENT) | PARTIAL (any field MISSING or ABSENT, named) | FIELDS (a
malformed row). Per board: TREATED (every treat row COMPLETE) | PARTIAL (a declared row unmet: the hard fail,
like a stale bar) | NO-TREATMENT (no treat rows: LABELED, the board opts in by declaring its first). Rungs with
no treat row are counted UNDECLARED and named, never refused: opting in is per rung.
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 1 imports · 5 importers
imports: nx_syscalls.nx
imported by: nx_compare_rank.nxnx_rungclose.nxnx_swcompare_lib.nxnx_treatment.nxnx_treatment_gate.nx
structs
| none |
consts
| 26 | const TRT_I64: i64 = 8 |
| 27 | const TRT_STRIDE: i64 = 24 |
| 28 | const TRT_RUNG_O: i64 = 0 |
| 29 | const TRT_RUNG_L: i64 = 1 |
| 30 | const TRT_MCP_O: i64 = 2 |
| 31 | const TRT_MCP_L: i64 = 3 |
| 32 | const TRT_API_O: i64 = 4 |
| 33 | const TRT_API_L: i64 = 5 |
| 34 | const TRT_PRIM_O: i64 = 6 |
| 35 | const TRT_PRIM_L: i64 = 7 |
| 36 | const TRT_WF_O: i64 = 8 |
| 37 | const TRT_WF_L: i64 = 9 |
| 38 | const TRT_AGENT_O: i64 = 10 |
| 39 | const TRT_AGENT_L: i64 = 11 |
| 40 | const TRT_ST_MCP: i64 = 12 |
| 41 | const TRT_ST_API: i64 = 13 |
| 42 | const TRT_ST_PRIM: i64 = 14 |
| 43 | const TRT_ST_WF: i64 = 15 |
| 44 | const TRT_ST_AGENT: i64 = 16 |
| 45 | const TRT_VERDICT: i64 = 17 |
| 46 | const TRT_NF: i64 = 18 |
| 47 | const TRT_LINE: i64 = 19 |
| 48 | const TRT_TAG: *u8 = "treat" |
| 49 | const TRT_NF_ROW: i64 = 7 |
| 50 | const TRT_F_RUNG: i64 = 1 |
| 51 | const TRT_F_MCP: i64 = 2 |
| 52 | const TRT_F_API: i64 = 3 |
| 53 | const TRT_F_PRIM: i64 = 4 |
| 54 | const TRT_F_WF: i64 = 5 |
| 55 | const TRT_F_AGENT: i64 = 6 |
| 56 | const TRT_MIN_ROW: i64 = 30 // "treat|r|mcp=|api=|prim=|wf=|agent=" plus a newline: the shortest well-formed row |
| 58 | const TRT_F_MISSING: i64 = 0 |
| 59 | const TRT_F_PRESENT: i64 = 1 |
| 60 | const TRT_F_DECLARED: i64 = 2 |
| 61 | const TRT_F_ABSENT: i64 = 3 |
| 63 | const TRT_V_COMPLETE: i64 = 0 |
| 64 | const TRT_V_PARTIAL: i64 = 1 |
| 65 | const TRT_V_FIELDS: i64 = 2 |
| 67 | const TRT_EXIT_TREATED: i64 = 0 |
| 68 | const TRT_EXIT_PARTIAL: i64 = 1 |
| 69 | const TRT_EXIT_NONE: i64 = 3 |
| 71 | const TRT_C_ROWS: i64 = 0 |
| 72 | const TRT_C_COMPLETE: i64 = 1 |
| 73 | const TRT_C_PARTIAL: i64 = 2 |
| 74 | const TRT_C_FIELDS: i64 = 3 |
| 75 | const TRT_C_RUNGS: i64 = 4 |
| 76 | const TRT_C_UNDECLARED: i64 = 5 |
| 77 | const TRT_C_SLOTS: i64 = 8 |
| 78 | const TRT_CH_PIPE: i64 = 124 |
| 79 | const TRT_CH_NL: i64 = 10 |
| 80 | const TRT_CH_TAB: i64 = 9 |
| 81 | const TRT_CH_DASH: i64 = 45 |
| 82 | const TRT_CH_EQ: i64 = 61 |
| 83 | const TRT_CH_HASH: i64 = 35 |
| 84 | const TRT_CH_SEMI: i64 = 59 |
| 85 | const TRT_CH_COMMA: i64 = 44 |
| 86 | const TRT_RUNG_TAG: *u8 = "rung" |
| 87 | const TRT_GREEN: *u8 = "GREEN" |
functions
| 89 | func trt_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 90 | func trt_cap(bytes: i64) -> i64 { return bytes / TRT_MIN_ROW + 1 } |
| 92 | func trt_line_end(buf: *u8, n: i64, p: i64) -> i64 |
| 102 | func trt_field(buf: *u8, p: i64, e: i64, k: i64, off: *i64) -> i64 |
| 117 | func trt_nfields(buf: *u8, p: i64, e: i64) -> i64 called by 1: trt_scan |
| 124 | func trt_span_is(buf: *u8, off: i64, len: i64, lit: *u8) -> i64 |
| 132 | func trt_kv(buf: *u8, off0: i64, len: i64, key: *u8, off: *i64) -> i64 |
| 141 | func trt_value_state(buf: *u8, off: i64, len: i64) -> i64 called by 1: trt_take |
| 147 | func trt_take(buf: *u8, p: i64, e: i64, k: i64, key: *u8, tab: *i64, b: i64, oslot: i64, lslot: i64, sslot: i64, off: *i64) -> i64 |
| 159 | func trt_scan(buf: *u8, n: i64, tab: *i64, cap: i64) -> i64 |
| 196 | func trt_text_has_row(text: *u8, tn: i64, buf: *u8, noff: i64, nlen: i64) -> i64 |
| 216 | func trt_allow_has(allow: *u8, an: i64, buf: *u8, noff: i64, nlen: i64) -> i64 |
| 246 | func trt_judge_row(tab: *i64, r: i64, buf: *u8, allow: *u8, an: i64, roster: *u8, rn: i64, clock: *u8, cn: i64, prim_ok: i64, wf_ok: i64) -> i64 |
| 276 | func trt_find(tab: *i64, rows: i64, buf: *u8, rid: *u8) -> i64 |
| 293 | func trt_census(tab: *i64, rows: i64, plan: *u8, pn: i64, c: *i64) -> i64 called by 4: mainplan_pass_headingmainmain calls 5: sys_mmaptrt_line_endtrt_fieldtrt_span_istrt_find |
| 323 | func trt_partition_sum(c: *i64) -> i64 { return c[TRT_C_COMPLETE] + c[TRT_C_PARTIAL] + c[TRT_C_FIELDS] } |
| 324 | func trt_verdict(c: *i64) -> i64 |
| 329 | func trt_state_name(s: i64) -> *u8 |
| 335 | func trt_verdict_name(v: i64) -> *u8 |
| 340 | func trt_exit_name(v: i64) -> *u8 |
| 346 | func trt_missing(tab: *i64, r: i64, dst: *u8, o: i64) -> i64 |