code wiki / (root) / nx_gatherer.nx

nx_gatherer.nx

buildroot/runtime/nx_gatherer.nx

10215 B296 linesdepth 2pulls 2 transitivereach 4 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_gatherer.nx -- inward-axis compounding primitive. Per [[feedback-hunter-gatherer-meta-primitives-outward-inward-axes]] CARDINAL: "nx_gatherer (inward — iteratively compound substrate ROI like farmer compounds land/crops/animals/machinery)." THE FARMER PRIMITIVE per user 2026-05-17: "gathering as the iterative process that the farmer does of improving their land and crops and animals and machinery to get a higher and higher roi." Gatherer is the INWARD arm: every session adds yield to substrate fields (new primitive shipped, smoke coverage axis +1, ms saved on a hot path, false-positive eliminated). Yields accumulate across sessions like compound interest on land. Composes: nx_hunter -- outward-axis dual; gatherer+hunter together form the session-audit gate nx_gather_journal -- append-only event log of yields nx_metabolism -- ms-saved yields measured against per-site cycle counts nx_palette -- bytes-shaved yields measured against pre/post packing densities nx_pamp / nx_pamp_meta -- false-positive-eliminated yields measured against pre/post detection rates V1 ships: - sealed enum NxGatherFieldKind (5 from cardinal: PRIMITIVE / ISA / SMOKE / METRIC / COMPOST) - sealed enum NxGatherYieldKind (4 from cardinal: MS_SAVED / BYTES_SHAVED / FALSE_POSITIVE_ELIMINATED / COVERAGE_AXIS_PLUS_ONE) - struct NxGatherField + NxGatherer container - sow_field/harvest_yield verbs - cumulative-yield queries (sum across the fields tilled) Gap list (V1 honest perf verdict): - per-season rotation (weekly/monthly/quarterly fallow review) queued -- V1 is one continuous season - compost recycling (prior-arc knowledge informing current) is a tag/kind in V1; deeper compose with archived hunts is V2 (nx_gather_compost specialized primitive)

dependencies 2 imports · 4 importers

nx_syscalls.nx nx_tier.nx nx_gatherer.nx nx_gather_journal.nx nx_gather_journal_test.nx nx_gatherer_test.nx nx_session_audit_compose_test.nx

imports: nx_syscalls.nxnx_tier.nx

imported by: nx_gather_journal.nxnx_gather_journal_test.nxnx_gatherer_test.nxnx_session_audit_compose_test.nx

structs

85struct NxGatherField
99struct NxGatherer

consts

61const NX_GFK_PRIMITIVE: nx_int = 0 // new substrate primitive shipped
62const NX_GFK_ISA: nx_int = 1 // new ISA backend / codegen target
63const NX_GFK_SMOKE: nx_int = 2 // new smoke test added
64const NX_GFK_METRIC: nx_int = 3 // new measurable metric exposed
65const NX_GFK_COMPOST: nx_int = 4 // prior-arc knowledge applied here
66const NX_GFK_N_KINDS: nx_int = 5
70const NX_GYK_MS_SAVED: nx_int = 0
71const NX_GYK_BYTES_SHAVED: nx_int = 1
72const NX_GYK_FALSE_POSITIVE_ELIMINATED: nx_int = 2
73const NX_GYK_COVERAGE_AXIS_PLUS_ONE: nx_int = 3
74const NX_GYK_N_KINDS: nx_int = 4
78const NX_GATHERER_OK: nx_int = 0
79const NX_GATHERER_ERR_FULL: nx_int = 1
80const NX_GATHERER_ERR_BAD_KIND: nx_int = 2
81const NX_GATHERER_ERR_NOT_FOUND: nx_int = 3
106const NX_GATHER_FIELD_BYTES: nx_size = 72

functions

110func nx_gfk_is_valid(k: nx_int) -> nx_int
called by 2: nx_gatherer_sowmain
116func nx_gyk_is_valid(k: nx_int) -> nx_int
124func nx_gatherer_new(capacity: nx_size) -> *NxGatherer
called by 2: mainmain calls 1: sys_mmap
136func _gatherer_at(g: *NxGatherer, idx: nx_size) -> *NxGatherField
142func _gatherer_find(g: *NxGatherer, field_id: nx_int) -> nx_int
158func nx_gatherer_sow(g: *NxGatherer,
188func nx_gatherer_harvest(g: *NxGatherer,
218func nx_gatherer_total_ms_saved(g: *NxGatherer) -> nx_size
called by 2: mainmain calls 1: _gatherer_at
231func nx_gatherer_total_bytes_shaved(g: *NxGatherer) -> nx_size
called by 2: mainmain calls 1: _gatherer_at
244func nx_gatherer_total_fp_eliminated(g: *NxGatherer) -> nx_int
called by 1: main calls 1: _gatherer_at
257func nx_gatherer_total_coverage_delta(g: *NxGatherer) -> nx_int
called by 2: mainmain calls 1: _gatherer_at
270func nx_gatherer_count_by_kind(g: *NxGatherer, kind: nx_int) -> nx_int
called by 1: main calls 1: _gatherer_at
283func nx_gatherer_count(g: *NxGatherer) -> nx_size
293func nx_gatherer_session_emitted(g: *NxGatherer) -> nx_int
called by 2: mainmain