nx_gatherer.nx
buildroot/runtime/nx_gatherer.nx
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
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
| 85 | struct NxGatherField |
| 99 | struct NxGatherer |
consts
| 61 | const NX_GFK_PRIMITIVE: nx_int = 0 // new substrate primitive shipped |
| 62 | const NX_GFK_ISA: nx_int = 1 // new ISA backend / codegen target |
| 63 | const NX_GFK_SMOKE: nx_int = 2 // new smoke test added |
| 64 | const NX_GFK_METRIC: nx_int = 3 // new measurable metric exposed |
| 65 | const NX_GFK_COMPOST: nx_int = 4 // prior-arc knowledge applied here |
| 66 | const NX_GFK_N_KINDS: nx_int = 5 |
| 70 | const NX_GYK_MS_SAVED: nx_int = 0 |
| 71 | const NX_GYK_BYTES_SHAVED: nx_int = 1 |
| 72 | const NX_GYK_FALSE_POSITIVE_ELIMINATED: nx_int = 2 |
| 73 | const NX_GYK_COVERAGE_AXIS_PLUS_ONE: nx_int = 3 |
| 74 | const NX_GYK_N_KINDS: nx_int = 4 |
| 78 | const NX_GATHERER_OK: nx_int = 0 |
| 79 | const NX_GATHERER_ERR_FULL: nx_int = 1 |
| 80 | const NX_GATHERER_ERR_BAD_KIND: nx_int = 2 |
| 81 | const NX_GATHERER_ERR_NOT_FOUND: nx_int = 3 |
| 106 | const NX_GATHER_FIELD_BYTES: nx_size = 72 |
functions
| 110 | func nx_gfk_is_valid(k: nx_int) -> nx_int |
| 116 | func nx_gyk_is_valid(k: nx_int) -> nx_int |
| 124 | func nx_gatherer_new(capacity: nx_size) -> *NxGatherer |
| 136 | func _gatherer_at(g: *NxGatherer, idx: nx_size) -> *NxGatherField |
| 142 | func _gatherer_find(g: *NxGatherer, field_id: nx_int) -> nx_int |
| 158 | func nx_gatherer_sow(g: *NxGatherer, |
| 188 | func nx_gatherer_harvest(g: *NxGatherer, |
| 218 | func nx_gatherer_total_ms_saved(g: *NxGatherer) -> nx_size |
| 231 | func nx_gatherer_total_bytes_shaved(g: *NxGatherer) -> nx_size |
| 244 | func nx_gatherer_total_fp_eliminated(g: *NxGatherer) -> nx_int |
| 257 | func nx_gatherer_total_coverage_delta(g: *NxGatherer) -> nx_int |
| 270 | func nx_gatherer_count_by_kind(g: *NxGatherer, kind: nx_int) -> nx_int |
| 283 | func nx_gatherer_count(g: *NxGatherer) -> nx_size |
| 293 | func nx_gatherer_session_emitted(g: *NxGatherer) -> nx_int |