code wiki / _hdl_build / nx_capability_placement.nx
nx_capability_placement.nx
buildroot/runtime/_hdl_build/nx_capability_placement.nx
about
nx_capability_placement.nx -- the "TRUE RACI PLACEMENT" governance instrument (operator 2026-07-16:
"make sure everything logically ... is getting true RACI aka what should live in workstreams, in agents,
in apis, in mcp, etc"). RACI answers WHO is accountable; this answers WHERE the capability should LIVE.
The architect (composition) + warden (policy bounds) own it. A standing rubric that gives every capability
a placement verdict + flags misplacements -> prevents future sprawl by construction (every new capability
gets a home BY RULE, not by accident).
THE SURFACES (where a capability can live):
ORGAN -- internal library/primitive/gate/vocab: imported by other organs, NEVER directly exposed
API -- a served network surface (daemon w/ a port): machine-to-machine, HTTP
MCP -- an AGENT-callable tool: the crew/Claude invokes it directly (read=broad, write=cap, destr=ocap+confirm)
WORKSTREAM -- a multi-step, supervised/human-checkpointed BUILD or campaign (WMS work-unit), not a single call
AGENT -- a capability a crew ROLE owns + runs autonomously (nishi_crew dispatch); the role IS the agent
HUMAN -- a person's judgment (operator/sponsor); not automatable
★THE PURE RULE (cp_place), priority-ordered + adversarially GATED (un-gameable):
0. no single Accountable role -> RACI-GAP (assign an owner BEFORE placing -- accountability first)
1. internal (primitive/gate/vocab) -> ORGAN (and if currently MCP -> VIOLATION: over-exposed primitive)
2. multi-step campaign / human-judg. -> WORKSTREAM
3. role-autonomous -> AGENT (dispatch)
4. served (daemon/port) -> API
5. read-only, agent-relevant -> MCP (broad)
6. write/mutating -> MCP + cap-gate
7. destructive/irreversible -> MCP + ocap + confirm (never a bare API/MCP)
The order enforces the doctrine: accountability first, internal-never-exposed, destructive-always-guarded.
nx_capability_placement gate -- adversarial self-test (default)
nx_capability_placement classify <capfile> -- placement verdict + action per crew capability row
license_tier: ORIGINAL module: nishi-core.architect.placement
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 31 | const CP_MAGIC_262144: i64 = 262144 |
| 32 | const CP_MAGIC_262143: i64 = 262143 |
| 35 | const CP_ORGAN: i64 = 1 |
| 36 | const CP_API: i64 = 2 |
| 37 | const CP_MCP: i64 = 3 |
| 38 | const CP_WORKSTREAM: i64 = 4 |
| 39 | const CP_AGENT: i64 = 5 |
| 40 | const CP_HUMAN: i64 = 6 |
| 41 | const CP_RACI_GAP: i64 = 0 |
| 43 | const CP_IO_NONE: i64 = 0 |
| 44 | const CP_IO_READ: i64 = 1 |
| 45 | const CP_IO_WRITE: i64 = 2 |
| 46 | const CP_IO_DESTRUCT:i64 = 3 |
functions
| 48 | func cp_p(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 49 | func cp_pn_i(v: i64) -> i64 { let b: *u8 = sys_mmap(24); var m: i64 = v; var k: i64 = 0; let t: *u8 = sys_mmap(24); if m == 0 { t[0] = 48 as u8; k = 1 } while m > 0 { t[k] = (48+(m%10)) as u8; m = m/10; k = k+1 } var i: i64 = 0; while i < k { b[i] = t[k-1-i]; i = i+1 } sys_write(1, b, k); return 0 } |
| 50 | func cp_streq(a: *u8, b: *u8) -> i64 { var i: i64 = 0; while a[i] != (0 as u8) { if a[i] != b[i] { return 0 } i = i + 1 } if b[i] != (0 as u8) { return 0 } return 1 } |
| 51 | func cp_ends(s: *u8, suf: *u8) -> i64 called by 1: cp_classify |
| 58 | func cp_contains(s: *u8, needle: *u8) -> i64 called by 1: cp_classify |
| 66 | func cp_sname(v: i64) -> *u8 called by 1: cp_classify |
| 77 | func cp_place(has_a: i64, is_human: i64, is_internal: i64, is_multistep: i64, is_role_auto: i64, is_served: i64, io: i64) -> i64 |
| 87 | func cp_guard(io: i64) -> i64 called by 1: cp_gate |
| 94 | func cp_gate() -> i64 |
| 118 | func cp_field(buf: *u8, ls: i64, le: i64, n: i64, out: *u8, cap: i64) -> i64 called by 1: cp_classify |
| 130 | func cp_classify(path: *u8) -> i64 |
| 192 | func main(argc: i64, argv: *i64) -> i64 |