code wiki / _hdl_build / nx_memhealth.nx

nx_memhealth.nx

buildroot/runtime/_hdl_build/nx_memhealth.nx

27916 B719 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_memhealth.nx -- SOVEREIGN health instrument for the laptop-local memory corpus. READ-ONLY. CONVERTED TO nx_memplane_lib 2026-08-07. It now owns only the analysis -- document frequency, the duplicate ladder, the series and co-authorship discriminators, the cross-name index. Walk, name table, link scanner, read, join and the derived-artefact test come from the lib. ⚠THIS ORGAN WAS THE THIRD VICTIM of the dump-suppression bug, precisely because it kept a private hardcoded list while its siblings were converted. The conversion retires that list. WHY IT EXISTS ------------- nx_memcliff keeps MEMORY.md under the harness cliff (25,000 B / 200 lines, both measured). But the index exists to make memories FINDABLE, and a 25,000 B ceiling can only ever NAME about 35 files out of 2,181. Everything else is reached by following links, or not at all -- which makes link integrity the whole retrieval system, and nothing was measuring it. WHAT IT MEASURES (each a defect, not a statistic) * DANGLING FROM THE INDEX -- a pointer in MEMORY.md to a file that does not exist. Every session reads that file, so its pointers are the only ones GUARANTEED to be followed. Gate condition. * DANGLING ANYWHERE -- 373 corpus-wide; the file the index labels "Read FIRST" emitted 11 alone. * ORPHANS -- 581 files nothing points to. Written, then unreachable. * DUPLICATE CANDIDATES -- the ladder below. THE DUPLICATE LADDER, each rung measured rather than assumed: 1 slug prefix only ............ 67 candidates 2 + raw token overlap >=400 ... 13 3 + rarity weighting .......... 10 (true dups rank to the top: 800, 571) 4 + sequence-marker rule ...... 3 plus a CROSS-NAME index (shared rare tokens, no slug similarity required), because ★★★★★★ A SLUG-ANCHORED DETECTOR CANNOT SEE A DUPLICATE THAT WAS NAMED DIFFERENTLY -- AND A DUPLICATE IS EXACTLY THE THING TWO AUTHORS NAME DIFFERENTLY. ⚠ AND ITS CEILING, MEASURED: the two files stating the store law share ZERO rare tokens, so every lexical method here is blind to them. Independent wording is what makes a rediscovery a rediscovery, and it is what defeats lexical detection. Found only by ranked search (nx_memfind). usage: nx_memhealth [--dir <memdir>] [--list] [--dups] exit: 0 = front door intact; 1 = MEMORY.md contains a dangling pointer Sovereign: imports nx_memplane_lib. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_memplane_lib.nx nx_memhealth.nx

imports: nx_memplane_lib.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main mp_streq mp_scan sys_openat_rd sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ mp_is_md mp_len mp_nameptr sys_close mp_put mp_nameptr ↻ mp_hashr mp_len ↻ mp_cat mp_say mp_write_all sys_write ↻ mp_nameptr ↻ mp_is_dump mp_streq ↻ mp_join mp_readf sys_openat_rd ↻ sys_read sys_close ↻ mp_is_derived

structs

none

consts

41const MH_DIR: *u8 = "/mnt/c/Users/elder/.claude/projects/C--Users-elder/memory"
42const MH_IDX: *u8 = "MEMORY.md"
43const MH_FBUF: i64 = 1048576
44const MH_MSG: i64 = 16384
45const MH_DUPPFX: i64 = 22 // shared normalised prefix that flags a near-duplicate slug
46const MH_TOK: i64 = 16384
47const MH_DF: i64 = 262144
48const MH_RARE: i64 = 20 // in >20 of 2181 files (~1%) => template, not topic
49const MH_TOPK: i64 = 10
50const MH_POST: i64 = 16
51const MH_PIDX: i64 = 65536
52const MH_PAIRH: i64 = 262144
53const MH_MINSHARE: i64 = 3

functions

57func mh_tokhas(set: *i64, h: i64) -> i64
called by 1: mh_pairsim
69func mh_tokput(set: *i64, h: i64) -> i64
81func mh_tokenise(buf: *u8, n: i64, set: *i64) -> i64
called by 1: mh_pairsim calls 1: mh_tokput
114func mh_dfslot(dfk: *i64, h: i64) -> i64
called by 1: mh_tokenise_df
126func mh_dfget(dfk: *i64, dfv: *i64, h: i64) -> i64
138func mh_tokenise_df(buf: *u8, n: i64, set: *i64, dfk: *i64, dfv: *i64) -> i64
called by 1: main calls 2: mh_tokputmh_dfslot
173func mh_rarecount(buf: *u8, n: i64, seen: *i64, dfk: *i64, dfv: *i64) -> i64
called by 1: mh_pairsim calls 2: mh_tokputmh_dfget
209func mh_sesshash(buf: *u8, n: i64) -> i64
called by 1: main calls 1: mp_len
253func mh_pairsim(dir: *u8, na: *u8, nb: *u8, fbuf: *u8, fbuf2: *u8,
302func mh_isdigitc(c: u8) -> i64
called by 1: mh_is_series
308func mh_common(a: *u8, b: *u8) -> i64
called by 2: mh_is_seriesmain
317func mh_is_series(a: *u8, b: *u8) -> i64
called by 1: main calls 3: mh_commonmh_isdigitcmp_len
332func mh_cmp(a: *u8, b: *u8) -> i64
called by 1: main
346func mh_norm(dst: *u8, src: *u8) -> i64
called by 1: main
364func mh_post_slot(ptok: *i64, h: i64) -> i64
called by 1: main
376func mh_pair_bump(pk: *i64, pv: *i64, key: i64) -> i64
called by 1: main
388func main(argc: i64, argv: *i64) -> i64