code wiki / (root) / nx_cell.nx

nx_cell.nx

buildroot/runtime/nx_cell.nx

9631 B264 linesdepth 3pulls 5 transitivereach 5 importersview sourcekind librarytopic cell
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_tier.nx nx_budget.nx nx_attention_class.nx nx_methyl.nx nx_cell.nx nx_cell_anatomy_compose_test.nx nx_cell_test.nx nx_microbiome.nx nx_microbiome_test.nx nx_tier3_ecology_compose_test.nx

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

95struct NxCell

consts

70const NX_CL_NASCENT: nx_int = 0 // created but not yet running
71const NX_CL_RUNNING: nx_int = 1 // actively executing
72const NX_CL_YIELDING: nx_int = 2 // mid-yield to peer cell
73const NX_CL_SUSPENDED: nx_int = 3 // paused but recoverable
74const NX_CL_ABORTIVE: nx_int = 4 // self-terminating; germline preserves
75const NX_CL_TERMINATED: nx_int = 5 // dead; chromatin may have survived
76const NX_CL_N_STATES: nx_int = 6
80const NX_CELL_OK: nx_int = 0
81const NX_CELL_ERR_BAD_STATE: nx_int = 1
82const NX_CELL_ERR_BAD_TRANSITION: nx_int = 2
83const NX_CELL_ERR_TERMINATED: nx_int = 3

functions

111func nx_cl_state_is_valid(s: nx_int) -> nx_int
117func nx_cl_state_accepts_work(s: nx_int) -> nx_int
122func nx_cl_state_is_terminal(s: nx_int) -> nx_int
129func nx_cell_new(cell_id: nx_int,
158func _cell_transition_allowed(from: nx_int, to: nx_int) -> nx_int
called by 1: nx_cell_transition
192func nx_cell_transition(c: *NxCell, to: nx_int, now_us: nx_size) -> nx_int
203func nx_cell_attach_brane(c: *NxCell, brane_ptr: *u8) -> nx_int
called by 2: mainmain
213func nx_cell_attach_vacuole(c: *NxCell, vacuole_ptr: *u8) -> nx_int
called by 2: mainmain
223func nx_cell_attach_chromatin(c: *NxCell, chromatin_ptr: *u8) -> nx_int
called by 2: mainmain
234func nx_cell_is_self(c: *NxCell,
called by 1: main calls 1: nx_methyl_is_self
244func nx_cell_state(c: *NxCell) -> nx_int
called by 1: main
250func nx_cell_is_terminal(c: *NxCell) -> nx_int
called by 2: mainmain calls 1: nx_cl_state_is_terminal
256func nx_cell_can_work(c: *NxCell) -> nx_int
called by 2: mainmain calls 1: nx_cl_state_accepts_work
262func nx_cell_state_change_count(c: *NxCell) -> nx_int
called by 1: main