code wiki / (root) / nx_microbiome.nx

nx_microbiome.nx

buildroot/runtime/nx_microbiome.nx

6621 B194 linesdepth 4pulls 6 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_microbiome.nx -- loose colony of cells with collective function. Per [[feedback-unified-immune-architecture-three-tier]] table row: "soil microbial community / gut+skin+oral microbiome." THE third- tier ecosystem primitive that bridges digital substrate, land stewardship, and human-health domains under a single biology-honest abstraction. DIFFERENT from nx_organism: organism is a single multi-pathway entity with tight coordination. Microbiome is a LOOSE COLLECTION of independent organisms (or cells) that work together statistically without central coordination -- like the gut microbiome's hundreds of bacterial species, or the soil microbiome's thousands. THE DIVERSITY INSIGHT: a healthy microbiome has many distinct cell kinds; a stressed/diseased one is dominated by one or two opportu- nists. Substrate measures kind-diversity as a health metric -- >=4 distinct cell kinds = HEALTHY; 1-3 = STRESSED; 0 distinct = COLLAPSED (sterile). Composes: nx_cell -- microbiome holds many cell pointers nx_organism -- distinct sibling primitive at a different scale nx_immune -- colony-level immune monitors microbiome health nx_aerobic -- stagnant microbiome = anaerobic decomposition trigger nx_attention_class -- diverse attention classes in microbiome = healthy "ecology" of work V1 ships: - struct NxMicrobiome with cells ring (cell pointers + kind tags) - add_cell / remove_cell / find_cell - kind_diversity (count of distinct attention classes present) - health verdict (sealed: HEALTHY / STRESSED / COLLAPSED) Gap list (V1 honest perf verdict): - kind = attention_class in V1; V2 may add per-cell taxonomic tag - no per-cell weight (Shannon entropy ignored; just count distinct) - no temporal-trend tracking (V2 adds rolling-window health)

dependencies 4 imports · 2 importers

nx_syscalls.nx nx_tier.nx nx_attention_class.nx nx_cell.nx nx_microbiome.nx nx_microbiome_test.nx nx_tier3_ecology_compose_test.nx

imports: nx_syscalls.nxnx_tier.nxnx_attention_class.nxnx_cell.nx

imported by: nx_microbiome_test.nxnx_tier3_ecology_compose_test.nx

structs

62struct NxMicrobiomeMember
71struct NxMicrobiome

consts

48const NX_MB_HEALTHY: nx_int = 0 // >=4 distinct kinds
49const NX_MB_STRESSED: nx_int = 1 // 1-3 distinct kinds
50const NX_MB_COLLAPSED: nx_int = 2 // 0 cells (sterile)
51const NX_MB_N_HEALTHS: nx_int = 3
55const NX_MB_OK: nx_int = 0
56const NX_MB_ERR_FULL: nx_int = 1
57const NX_MB_ERR_NOT_FOUND: nx_int = 2
58const NX_MB_ERR_DUPLICATE: nx_int = 3
77const NX_MB_MEMBER_BYTES: nx_size = 32
79const NX_MB_HEALTHY_DIVERSITY_THRESHOLD: nx_int = 4

functions

81func nx_mb_health_is_valid(h: nx_int) -> nx_int
called by 1: main
87func nx_microbiome_new(capacity: nx_size) -> *NxMicrobiome
called by 2: mainmain calls 1: sys_mmap
96func _mb_at(m: *NxMicrobiome, idx: nx_size) -> *NxMicrobiomeMember
100func _mb_find(m: *NxMicrobiome, cell_id: nx_int) -> nx_int
110func nx_microbiome_add(m: *NxMicrobiome,
called by 2: mainmain calls 2: _mb_find_mb_at
125func nx_microbiome_remove(m: *NxMicrobiome, cell_id: nx_int) -> nx_int
called by 1: main calls 2: _mb_find_mb_at
143func nx_microbiome_contains(m: *NxMicrobiome, cell_id: nx_int) -> nx_int
called by 1: main calls 1: _mb_find
153func nx_microbiome_kind_diversity(m: *NxMicrobiome) -> nx_int
called by 3: nx_microbiome_healthmainmain calls 1: _mb_at
174func nx_microbiome_health(m: *NxMicrobiome) -> nx_int
181func nx_microbiome_count(m: *NxMicrobiome) -> nx_size
185func nx_microbiome_count_by_kind(m: *NxMicrobiome, kind: nx_int) -> nx_int
called by 1: main calls 1: _mb_at