code wiki / (root) / nx_organism.nx

nx_organism.nx

buildroot/runtime/nx_organism.nx

12699 B344 linesdepth 6pulls 11 transitivereach 5 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_organism.nx -- ecosystem-wide pathway + symbiote container. Biological analogue: an organism is the multi-pathway entity that coordinates many pathways across many tissues with shared homeostasis. In Nishi terms: an organism holds N nx_pathways (Nishi-native cells) AND N nx_symbiotes (foreign processes integrated into the ecosystem like Steam-hosted NMS, Chrome, OBS) and arbitrates resources across the WHOLE union. THIS IS THE ECOSYSTEM-WIDE OPTIMIZATION SUBSTRATE. Per user 2026-05- 19: "i want it work across the whole nishi ecosystem and then across the whole nishi ecosystem + (nishi native and non native things that are integrated)." Single host machine running Nishi cells + Steam + NMS + dev tools simultaneously: organism is the layer that decides which gets displaced when the host's VRAM crosses 90%. Composes: nx_pathway -- each contributes its own cells + budgets nx_symbiote -- foreign-process virtual cells with observed (not promised) resource consumption nx_budget -- organism has its OWN host-aggregate budget (the physical hardware ceiling) nx_evict_journal -- organism-level events log here nx_attention_class -- per-cell + per-symbiote class drives priority nx_treaty -- bilateral agreements between organism members V1 ships a flat container with built-in arbitration. The hypothalamus (master regulator) function is folded in as nx_organism_pick_dis- placement; if it grows, a separate nx_hypothalamus primitive is extracted. Gap list (V1 honest perf verdict): - no actual host-resource probe (host_budget supplied by caller) - no peer-mesh federation (one organism per host) - flat membership (no nested organism-of-organisms) - no fairness scheduling within same attention class genealogy_id: nishi_cardinal_2026-05-19_ecosystem_wide + biology_multi_pathway_organism lineage_id: substrate_organism_v1

dependencies 7 imports · 5 importers

nx_syscalls.nx nx_tier.nx nx_budget.nx nx_attention_class.nx nx_evict_journal.nx nx_pathway.nx nx_symbiote.nx nx_organism.nx nx_ecosystem_compose_test.nx nx_organism_test.nx nx_reclaim.nx nx_reclaim_test.nx nx_sovereign_compose_test.nx

imports: nx_syscalls.nxnx_tier.nxnx_budget.nxnx_attention_class.nxnx_evict_journal.nxnx_pathway.nxnx_symbiote.nx

imported by: nx_ecosystem_compose_test.nxnx_organism_test.nxnx_reclaim.nxnx_reclaim_test.nxnx_sovereign_compose_test.nx

structs

86struct NxOrganism

consts

57const NX_MAGIC_1024: i64 = 1024
61const NX_ORG_OK: nx_int = 0
62const NX_ORG_ERR_FULL: nx_int = 1
63const NX_ORG_ERR_NOT_FOUND: nx_int = 2
64const NX_ORG_ERR_BAD_MEMBER: nx_int = 3
73const NX_DISP_NONE: nx_int = 0 // no displacement needed
74const NX_DISP_NATIVE_CELL: nx_int = 1
75const NX_DISP_SYMBIOTE: nx_int = 2

functions

99func nx_organism_new(host_budget: *NxBudget,
called by 3: mainmainmain calls 1: sys_mmap
119func _organism_pathway_at(o: *NxOrganism, idx: nx_size) -> *NxPathway
124func _organism_symbiote_at(o: *NxOrganism, idx: nx_size) -> *NxSymbiote
129func _organism_pathway_set(o: *NxOrganism, idx: nx_size, p: *NxPathway) -> nx_int
135func _organism_symbiote_set(o: *NxOrganism, idx: nx_size, s: *NxSymbiote) -> nx_int
143func nx_organism_add_pathway(o: *NxOrganism, p: *NxPathway) -> nx_int
called by 3: mainmainmain calls 1: _organism_pathway_set
153func nx_organism_add_symbiote(o: *NxOrganism, s: *NxSymbiote) -> nx_int
called by 3: mainmainmain calls 1: _organism_symbiote_set
167func nx_organism_total_ram_max(o: *NxOrganism) -> nx_size
187func nx_organism_total_vram_max(o: *NxOrganism) -> nx_size
213func nx_organism_total_observed_ram(o: *NxOrganism) -> nx_size
234func nx_organism_host_pressure_q10(o: *NxOrganism, kind: nx_int) -> nx_int
273func nx_organism_pick_displacement(o: *NxOrganism,
324func nx_organism_count_members(o: *NxOrganism) -> nx_size
called by 3: mainmainmain
330func nx_organism_total_observed_vram(o: *NxOrganism) -> nx_size