nx_cell.nx
buildroot/runtime/nx_cell.nx
about
nx_cell.nx -- THE base computational unit.
Per [[feedback-naming-discipline-no-industry-competitor-overlap]]:
"nx_cell" is the foundational biology primitive replacing "container"
in the cardinal naming taxonomy. Every other primitive references it
semantically but until now it was conceptual; this file makes the
cell concrete.
A cell is the substrate's atomic unit of compute + isolation +
life-cycle. Each cell has:
- identity (cell_id, methyl mark for self-verification)
- intent (attention_class — foreground/background/idle classification)
- boundary (brane — capability tokens for what crosses)
- storage (vacuole — sealed content-addressed bytes)
- backup (chromatin — pre-failover snapshot)
- lineage (parent_pathway_id — the cell-graph membership)
- lifecycle (state machine: NASCENT → RUNNING → YIELDING/SUSPENDED
→ ABORTIVE → TERMINATED, with chromatin survivable across the
terminal transition)
Per Captain Moroni doctrine: cells are the unit of accountability.
Every observable substrate event happens in or between cells; every
audit trail is keyed by cell_id; every defensive action targets a
specific cell.
Composes:
nx_methyl -- self-marker validates this cell is substrate-self
nx_brane -- capability membrane controlling IO
nx_vacuole -- the cell's sealed storage
nx_chromatin -- backup state for failover
nx_pathway -- multi-cell graphs of which this cell is a member
nx_budget -- the cell's declared resource ceiling
nx_attention_class -- the cell's declared priority class
nx_immune -- colony tracks each cell's state
nx_abortive -- terminal-state machine composes here
V1 ships the struct + state-machine transitions + accessors.
Behavior verbs (run/yield/suspend/etc) are caller-driven; cell
itself doesn't schedule -- nx_pathway and the surrounding substrate
do that.
dependencies 5 imports · 5 importers
imports: nx_syscalls.nxnx_tier.nxnx_budget.nxnx_attention_class.nxnx_methyl.nx
imported by: nx_cell_anatomy_compose_test.nxnx_cell_test.nxnx_microbiome.nxnx_microbiome_test.nxnx_tier3_ecology_compose_test.nx
structs
| 95 | struct NxCell |
consts
| 70 | const NX_CL_NASCENT: nx_int = 0 // created but not yet running |
| 71 | const NX_CL_RUNNING: nx_int = 1 // actively executing |
| 72 | const NX_CL_YIELDING: nx_int = 2 // mid-yield to peer cell |
| 73 | const NX_CL_SUSPENDED: nx_int = 3 // paused but recoverable |
| 74 | const NX_CL_ABORTIVE: nx_int = 4 // self-terminating; germline preserves |
| 75 | const NX_CL_TERMINATED: nx_int = 5 // dead; chromatin may have survived |
| 76 | const NX_CL_N_STATES: nx_int = 6 |
| 80 | const NX_CELL_OK: nx_int = 0 |
| 81 | const NX_CELL_ERR_BAD_STATE: nx_int = 1 |
| 82 | const NX_CELL_ERR_BAD_TRANSITION: nx_int = 2 |
| 83 | const NX_CELL_ERR_TERMINATED: nx_int = 3 |
functions
| 111 | func nx_cl_state_is_valid(s: nx_int) -> nx_int |
| 117 | func nx_cl_state_accepts_work(s: nx_int) -> nx_int |
| 122 | func nx_cl_state_is_terminal(s: nx_int) -> nx_int |
| 129 | func nx_cell_new(cell_id: nx_int, |
| 158 | func _cell_transition_allowed(from: nx_int, to: nx_int) -> nx_int called by 1: nx_cell_transition |
| 192 | func nx_cell_transition(c: *NxCell, to: nx_int, now_us: nx_size) -> nx_int |
| 203 | func nx_cell_attach_brane(c: *NxCell, brane_ptr: *u8) -> nx_int |
| 213 | func nx_cell_attach_vacuole(c: *NxCell, vacuole_ptr: *u8) -> nx_int |
| 223 | func nx_cell_attach_chromatin(c: *NxCell, chromatin_ptr: *u8) -> nx_int |
| 234 | func nx_cell_is_self(c: *NxCell, |
| 244 | func nx_cell_state(c: *NxCell) -> nx_int called by 1: main |
| 250 | func nx_cell_is_terminal(c: *NxCell) -> nx_int |
| 256 | func nx_cell_can_work(c: *NxCell) -> nx_int |
| 262 | func nx_cell_state_change_count(c: *NxCell) -> nx_int called by 1: main |