code wiki / (root) / nx_compost.nx

nx_compost.nx

buildroot/runtime/nx_compost.nx

8752 B238 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_compost.nx -- graceful retirement + nutrient harvest from retired primitives. Biology: when an organism dies, its constituent atoms are decomposed by fungi+bacteria and returned to the soil pool, where they're available for re-uptake by living plants. Forests recycle ~90% of their nutrients through this loop. Without compost, ecosystems collapse from depletion. In Nishi: extends [[nx_prune]] (which only REMOVES dead/orphan code) by adding nutrient-harvest -- when a primitive retires, identify its reusable parts (constants, types, helper functions, schemas) and route them back to the substrate pool for adoption by living primitives. This is the difference between "delete file" (current prune) and "compost" (extract value before disposing). Composes [[feedback-forest-meta-vision-drift-lifecycle]] + [[feedback-thymus-sovereignty-audit-soma-germline]] (composted nutrients retain soma/germline class) + [[feedback-regenerative-stewardship- doctrine-captain-moroni]] (recycling is regeneration not extraction) + Cardinal 13 (history is sacred -- compost record is permanent additive log, not destructive delete).

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_tier.nx nx_compost.nx nx_compost_test.nx

imports: nx_syscalls.nxnx_tier.nx

imported by: nx_compost_test.nx

structs

58struct NxNutrient
68struct NxCompostPile

consts

29const NX_CP_NUT_CONST_DEFINITION: nx_int = 0 // sealed enum / const block
30const NX_CP_NUT_TYPE_DEFINITION: nx_int = 1 // struct / type alias
31const NX_CP_NUT_HELPER_FUNCTION: nx_int = 2 // pure utility function
32const NX_CP_NUT_SCHEMA: nx_int = 3 // serialization layout
33const NX_CP_NUT_TEST_SCAFFOLD: nx_int = 4 // assertion patterns / fixtures
34const NX_CP_NUT_DOCUMENTATION: nx_int = 5 // header comment / spec
35const NX_CP_NUT_BENCHMARK: nx_int = 6 // perf harness
36const NX_CP_NUT_N: nx_int = 7
40const NX_CP_STAGE_FRESH: nx_int = 0 // just retired
41const NX_CP_STAGE_DECOMPOSING: nx_int = 1 // nutrients being extracted
42const NX_CP_STAGE_HARVESTED: nx_int = 2 // nutrients reabsorbed
43const NX_CP_STAGE_REFUSED: nx_int = 3 // unsafe to recycle (soma)
44const NX_CP_STAGE_N: nx_int = 4
48const NX_CP_V_OK: nx_int = 0
49const NX_CP_V_REFUSED_GERMLINE: nx_int = 1 // germline never composts
50const NX_CP_V_REFUSED_ACTIVE: nx_int = 2 // not yet retired
51const NX_CP_V_REFUSED_CLIMAX: nx_int = 3 // climax-stage never composts
52const NX_CP_V_INVALID: nx_int = 4
53const NX_CP_V_NULL: nx_int = 5
54const NX_CP_V_N: nx_int = 6
66const NX_CP_N_BYTES: nx_int = 40
79const NX_CP_BYTES: nx_int = 56

functions

83func nx_cp_nut_is_valid(k: nx_int) -> nx_int
89func nx_cp_stage_is_valid(s: nx_int) -> nx_int
called by 1: main
95func nx_cp_v_is_valid(v: nx_int) -> nx_int
called by 1: main
103func nx_cp_new(primitive_id: nx_int,
called by 1: main calls 1: sys_mmap
128func _cp_nutrient_at(p: *NxCompostPile, idx: nx_int) -> *NxNutrient
137func nx_cp_begin_decompose(p: *NxCompostPile) -> nx_int
called by 1: main
148func nx_cp_extract_nutrient(p: *NxCompostPile,
called by 1: main calls 1: nx_cp_nut_is_valid
171func nx_cp_reabsorb(p: *NxCompostPile,
called by 1: main calls 1: _cp_nutrient_at
190func nx_cp_mark_harvested(p: *NxCompostPile) -> nx_int
called by 1: main
199func nx_cp_count_by_kind(p: *NxCompostPile, kind: nx_int) -> nx_int
called by 1: main calls 1: _cp_nutrient_at
211func nx_cp_reused_count(p: *NxCompostPile) -> nx_int
called by 1: main calls 1: _cp_nutrient_at
223func nx_cp_unclaimed_count(p: *NxCompostPile) -> nx_int
called by 1: main calls 1: _cp_nutrient_at
235func nx_cp_stage(p: *NxCompostPile) -> nx_int
called by 1: main