nx_hypha.nx
buildroot/runtime/nx_hypha.nx
about
nx_hypha.nx -- bidirectional peer share + receive (point-to-point
mycelium / wood-wide-web).
Per META-CARDINAL feedback-forest-meta-vision-drift-lifecycle: every
EXCHANGE_* mode has a paired RECEIVE_* mode at the same peer. Pure
consumers are throttled per [[feedback-west-industrial-build-
replenish-not-buy-consume]]. A new node gets a "starter quota" of
EXCHANGE_* capability proportional to its niche -- no node arrives
with literally nothing to offer.
Distinct from nx_fruiting (queued): nx_hypha is POINT-TO-POINT peer
share between two specific Nishi nodes. nx_fruiting is MANY-TO-MANY
content-addressed broadcast (mushroom spore release). Both compose
to give the complete underground-mycelium-plus-fruiting-body
distribution architecture.
V1 ships sealed enum of exchange modes + reciprocity discipline
predicate + niche-aware capability gating + per-peer trust state.
Composes:
nx_methyl -- peer-attestation Ed25519 chain (caller-supplied)
nx_niche -- niche gates which EXCHANGE_* modes a peer can offer
nx_attest_silicon -- silicon-trust gates sovereignty-critical exchanges
nx_immune -- runtime defense composes on suspicious-peer signal
Gap list (V1 honest perf verdict):
- actual byte transport is caller-supplied (V2 wires nx_chromatin
content-addressed blocks + nx_http3 / libp2p-class re-derived
transport)
- reciprocity ratio thresholds are operator-tuneable per niche
(V2 makes data-driven)
- "starter quota" for new peer is the niche-default + first 100
interactions; V1 marks the quota; V2 enforces decay
genealogy_id: nishi_metacardinal_2026-05-19_forest_drift_lifecycle
lineage_id: substrate_hypha_v1
nx_safety_envelope:
intended_use: "Bidirectional point-to-point peer exchange
with reciprocity discipline + niche-aware
dependencies 2 imports · 2 importers
imports: nx_syscalls.nxnx_tier.nx
imported by: nx_commons_units_gate.nxnx_hypha_test.nx
structs
| 90 | struct NxPeerExchangeState |
consts
| 57 | const NX_EM_COMPUTE: nx_int = 0 // VRAM / cores / NPU borrow |
| 58 | const NX_EM_STORAGE: nx_int = 1 // content-addressed blocks |
| 59 | const NX_EM_SIGNAL: nx_int = 2 // telemetry / alerts / niche-correction |
| 60 | const NX_EM_CHROMATIN: nx_int = 3 // organelle updates + audit-labels |
| 61 | const NX_EM_PATHWAY: nx_int = 4 // cooperative sub-graph execution |
| 62 | const NX_EM_LABEL: nx_int = 5 // triangulated audit-consensus |
| 63 | const NX_EM_KNOWLEDGE: nx_int = 6 // federated-averaged small-model weights |
| 64 | const NX_EM_INGEST: nx_int = 7 // one-directional consume from foreign substrate |
| 65 | const NX_EM_N_MODES: nx_int = 8 |
| 69 | const NX_EM_DIR_SHARE: nx_int = 0 |
| 70 | const NX_EM_DIR_RECEIVE: nx_int = 1 |
| 71 | const NX_EM_DIR_N_DIRS: nx_int = 2 |
| 75 | const NX_HY_OK: nx_int = 0 |
| 76 | const NX_HY_ERR_INVALID_MODE: nx_int = 1 |
| 77 | const NX_HY_ERR_INVALID_DIRECTION: nx_int = 2 |
| 78 | const NX_HY_ERR_RECIPROCITY_VIOLATION: nx_int = 3 // pure consumer; throttled |
| 79 | const NX_HY_ERR_NICHE_INCAPABLE: nx_int = 4 // this niche can't offer this mode |
| 80 | const NX_HY_ERR_TRUST_INSUFFICIENT: nx_int = 5 // silicon trust below requirement |
| 81 | const NX_HY_ERR_NULL_INPUT: nx_int = 6 |
| 82 | const NX_HY_N_VERDICTS: nx_int = 7 |
| 100 | const NX_HY_PEER_BYTES: nx_int = 56 |
| 101 | const NX_HY_PER_MODE_BYTES: nx_int = 8 |
| 102 | const NX_HY_STARTER_QUOTA_DEFAULT: nx_int = 100 |
functions
| 106 | func nx_em_mode_is_valid(m: nx_int) -> nx_int |
| 114 | func nx_em_dir_is_valid(d: nx_int) -> nx_int |
| 122 | func nx_hy_verdict_is_valid(v: nx_int) -> nx_int called by 1: main |
| 138 | func nx_em_niche_can_offer(niche: nx_int, mode: nx_int) -> nx_int |
| 192 | func nx_hy_peer_state_new(peer_id: nx_int, |
| 222 | func nx_hy_record_exchange(p: *NxPeerExchangeState, |
| 247 | func nx_hy_share_count(p: *NxPeerExchangeState, mode: nx_int) -> nx_int |
| 257 | func nx_hy_receive_count(p: *NxPeerExchangeState, mode: nx_int) -> nx_int |
| 267 | func nx_hy_total_shared(p: *NxPeerExchangeState) -> nx_int |
| 280 | func nx_hy_total_received(p: *NxPeerExchangeState) -> nx_int |
| 301 | func nx_hy_reciprocity_verdict(p: *NxPeerExchangeState) -> nx_int |
| 332 | func nx_hy_reciprocity_verdict_units(p: *NxPeerExchangeState, called by 1: main |
| 356 | func nx_hy_can_initiate_share(p: *NxPeerExchangeState, |