nx_microbiome.nx
buildroot/runtime/nx_microbiome.nx
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
imports: nx_syscalls.nxnx_tier.nxnx_attention_class.nxnx_cell.nx
imported by: nx_microbiome_test.nxnx_tier3_ecology_compose_test.nx
structs
| 62 | struct NxMicrobiomeMember |
| 71 | struct NxMicrobiome |
consts
| 48 | const NX_MB_HEALTHY: nx_int = 0 // >=4 distinct kinds |
| 49 | const NX_MB_STRESSED: nx_int = 1 // 1-3 distinct kinds |
| 50 | const NX_MB_COLLAPSED: nx_int = 2 // 0 cells (sterile) |
| 51 | const NX_MB_N_HEALTHS: nx_int = 3 |
| 55 | const NX_MB_OK: nx_int = 0 |
| 56 | const NX_MB_ERR_FULL: nx_int = 1 |
| 57 | const NX_MB_ERR_NOT_FOUND: nx_int = 2 |
| 58 | const NX_MB_ERR_DUPLICATE: nx_int = 3 |
| 77 | const NX_MB_MEMBER_BYTES: nx_size = 32 |
| 79 | const NX_MB_HEALTHY_DIVERSITY_THRESHOLD: nx_int = 4 |
functions
| 81 | func nx_mb_health_is_valid(h: nx_int) -> nx_int called by 1: main |
| 87 | func nx_microbiome_new(capacity: nx_size) -> *NxMicrobiome |
| 96 | func _mb_at(m: *NxMicrobiome, idx: nx_size) -> *NxMicrobiomeMember |
| 100 | func _mb_find(m: *NxMicrobiome, cell_id: nx_int) -> nx_int |
| 110 | func nx_microbiome_add(m: *NxMicrobiome, |
| 125 | func nx_microbiome_remove(m: *NxMicrobiome, cell_id: nx_int) -> nx_int |
| 143 | func nx_microbiome_contains(m: *NxMicrobiome, cell_id: nx_int) -> nx_int |
| 153 | func nx_microbiome_kind_diversity(m: *NxMicrobiome) -> nx_int |
| 174 | func nx_microbiome_health(m: *NxMicrobiome) -> nx_int |
| 181 | func nx_microbiome_count(m: *NxMicrobiome) -> nx_size |
| 185 | func nx_microbiome_count_by_kind(m: *NxMicrobiome, kind: nx_int) -> nx_int |