code wiki / _hdl_build / nx_atlas_graphrec_lib.nx
nx_atlas_graphrec_lib.nx
buildroot/runtime/_hdl_build/nx_atlas_graphrec_lib.nx
about
nx_atlas_graphrec.nx -- NATIVE GRAPH-ADJACENCY RECOMBINATION over the eco graph (F225a).
WHY (measured 2026-07-30, debt seq1489): nx_atlas_discover sources candidates from the
commontask catalog -- ~48 task rows yielding 27 classified organs -- while the eco graph
holds 16,580 nodes. A ~614x substrate gap, and the saturation shows in discover's OWN
output: 40 proposals with declared=1, trusted=7, GUESSED=20. Half of every proposal is a
kind INFERRED from the organ name because the real catalog pairs are exhausted. A
recombinator emitting 50pct guesses is not discovering, it is confabulating.
Corroborated externally (July 2026): agent skill-selection accuracy undergoes a PHASE
TRANSITION as library size grows -- routing over a FLAT catalog degrades combinatorially.
The fix is the SUBSTRATE, not the volume.
THIS ORGAN DOES NOT REPLACE nx_atlas_discover. Its header rationale still holds: "the eco
graph sees STATIC import edges; plans compose tools at RUNTIME -- edges the graph cannot
see." So this is the SIBLING mechanism: discover mines RUNTIME composability from the
catalog, graphrec mines STRUCTURAL adjacency from the graph. Distinct ids (GRC vs DSC).
METHOD -- classic link prediction (common neighbours) on the undirected import graph:
candidate (a,b) iff NO direct edge a<->b AND |N(a) INTERSECT N(b)| >= minscore.
A missing edge between two modules with many shared neighbours is the standard signal that
the edge SHOULD exist -- i.e. a real composition opportunity, DERIVED not guessed.
HUB SUPPRESSION: a witness whose degree exceeds GR_HUB_THR is skipped. Hubs (nx_syscalls
and friends) are imported by nearly everything, so they are evidence of nothing; counting
them would make every pair look related and rediscover the same saturation in a new costume.
This is also what bounds the cost: sum over witnesses of deg^2 instead of all-pairs.
PROVENANCE: every row is source=graph. There is no name-guessing path in this organ AT ALL,
so its guess rate is 0 BY CONSTRUCTION -- that is the metric seq1489 says must fall.
Proposals stay status=proposed: promotion still requires a plan run to PROVE the combo.
REFUSAL, NOT A REMINDER: an unloadable or empty graph EXITS 2 rather than printing
"0 proposals", which would read as "nothing to recombine" -- the exact lie to avoid.
NO SILENT CAPS: witnesses skipped as hubs and pair-table overflow are both REPORTED.
license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0
dependencies 3 imports · 1 importers
imports: nx_eco_graph.nxnx_store_seed_lib.nxnx_syscalls.nx
imported by: nx_atlas_graphrec_gate.nx
structs
| none |
consts
| 38 | const GR_MAGIC_2654435761: i64 = 2654435761 |
| 40 | const GR_OUT: i64 = 262144 |
| 41 | const GR_HUB_THR: i64 = 24 |
| 47 | const GR_ENDPOINT_THR: i64 = 512 |
| 48 | const GR_NBUF: i64 = 64 |
| 49 | const GR_PAIRCAP: i64 = 1048576 |
| 50 | const GR_PAIRMASK: i64 = 1048575 |
| 51 | const GR_TOPN: i64 = 40 |
| 52 | const GR_MINSCORE: i64 = 3 |
| 53 | const GR_NAMEMAX: i64 = 128 |
| 54 | const GR_STDERR: i64 = 2 |
| 55 | const GR_ROWS: i64 = 65536 |
| 60 | const GR_OUTP_DEF: *u8 = "knowledge/store/discovery-graph-" as *u8 |
functions
| 62 | func gr_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 64 | func gr_cat(o: *u8, at: i64, s: *u8) -> i64 |
| 71 | func gr_catn(o: *u8, at: i64, v: i64) -> i64 calls 1: sys_mmap |
| 83 | func gr_name(g: *EcoGraph, idx: i64) -> *u8 |
| 88 | func gr_deg(g: *EcoGraph, i: i64) -> i64 { return eg_ce(g, i) + eg_ca(g, i) } |
| 91 | func gr_nbrs(g: *EcoGraph, i: i64, buf: *i64) -> i64 called by 1: gr_propose |
| 103 | func gr_has_edge(g: *EcoGraph, a: i64, b: i64) -> i64 called by 1: gr_propose |
| 113 | func gr_hash_key(k: i64) -> i64 called by 1: gr_propose |
| 127 | func gr_propose(g: *EcoGraph, minscore: i64, topn: i64, ta: *i64, tb: *i64, ts: *i64, stats: *i64) -> i64 |