code wiki / _hdl_build / nx_capability_placement.nx

nx_capability_placement.nx

buildroot/runtime/_hdl_build/nx_capability_placement.nx

12986 B201 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic capability
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_capability_placement.nx

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

main cp_gate cp_p sys_write cp_place cp_guard sys_exit cp_streq cp_p ↻ cp_classify sys_openat_rd cp_p ↻ sys_mmap sys_read sys_close cp_field cp_streq ↻ cp_ends cp_contains cp_place ↻ cp_sname cp_pn_i sys_mmap ↻ sys_write ↻

structs

none

consts

31const CP_MAGIC_262144: i64 = 262144
32const CP_MAGIC_262143: i64 = 262143
35const CP_ORGAN: i64 = 1
36const CP_API: i64 = 2
37const CP_MCP: i64 = 3
38const CP_WORKSTREAM: i64 = 4
39const CP_AGENT: i64 = 5
40const CP_HUMAN: i64 = 6
41const CP_RACI_GAP: i64 = 0
43const CP_IO_NONE: i64 = 0
44const CP_IO_READ: i64 = 1
45const CP_IO_WRITE: i64 = 2
46const CP_IO_DESTRUCT:i64 = 3

functions

48func 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 }
called by 3: cp_gatecp_classifymain calls 1: sys_write
49func 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 }
called by 1: cp_classify calls 2: sys_mmapsys_write
50func 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 }
called by 2: cp_classifymain
51func cp_ends(s: *u8, suf: *u8) -> i64
called by 1: cp_classify
58func cp_contains(s: *u8, needle: *u8) -> i64
called by 1: cp_classify
66func cp_sname(v: i64) -> *u8
called by 1: cp_classify
77func cp_place(has_a: i64, is_human: i64, is_internal: i64, is_multistep: i64, is_role_auto: i64, is_served: i64, io: i64) -> i64
called by 2: cp_gatecp_classify
87func cp_guard(io: i64) -> i64
called by 1: cp_gate
94func cp_gate() -> i64
called by 1: main calls 4: cp_pcp_placecp_guardsys_exit
118func cp_field(buf: *u8, ls: i64, le: i64, n: i64, out: *u8, cap: i64) -> i64
called by 1: cp_classify
130func cp_classify(path: *u8) -> i64
192func main(argc: i64, argv: *i64) -> i64