code wiki / _hdl_build / nx_memfix.nx
nx_memfix.nx
buildroot/runtime/_hdl_build/nx_memfix.nx
about
nx_memfix.nx -- repair PROVABLY-SAFE dangling links in the laptop-local memory corpus.
CONVERTED TO nx_memplane_lib 2026-08-06. It now owns only what is specific to it: the normalised
name index and the two repair classes. The scanner, name table, walk and dump list come from the
lib, because six hand-copies of those drifted and the drift was the bug.
SEPARATE ORGAN FROM nx_memhealth ON PURPOSE: the instrument stays read-only, so a repair bug can
never corrupt the measurement that would reveal it.
★★★★★★ A WRONG LINK IS WORSE THAN A DEAD ONE -- A DEAD LINK FAILS LOUDLY WHEN FOLLOWED, A WRONG
LINK SILENTLY DELIVERS A DIFFERENT MEMORY. So repair is restricted to the classes where the answer
is unique and mechanical, and everything else is reported, never guessed:
A DOUBLE-EXTENSION -- target ends ".md.md" and stripping one ".md" names an existing file (5)
B NORMALISED-EXACT -- differs from exactly ONE file by case/punctuation/WHITESPACE (19/26 occ)
★ class B is not renames: it is LINKS WRAPPED ACROSS TWO LINES, where the author's markdown
wrapped and the newline landed inside the target. The intent is unambiguous and the file is
right there; only the whitespace is wrong.
C unique-substring (29/53) · D ambiguous (14/26) · E absent (121/292) -- ALL REPORT-ONLY.
Class E cannot be repaired at all: those files were DELETED, not renamed (only 2 of 37 legacy
names resolve), so "repairing" them would fabricate the doctrine they cite.
⚠ DUMPS ARE SKIPPED (added at conversion). The derived artefacts are regenerated wholly on each
run, so rewriting links inside them is churn that the next regeneration discards -- and it would
count toward the repair total, inflating a number that is supposed to mean "authored corpus fixed".
SAFETY: dry-run by default; a .bak-memfix copy written BEFORE each file is touched; atomic
tmp+renameat install; refuses any target whose normalised form matches more than one file; the
replacement is always the literal name of a file that exists right now.
usage: nx_memfix [--dir <memdir>] [--apply] [--list]
exit: 0 = clean or repaired; 1 = a write failed
Sovereign: imports nx_memplane_lib. license_tier: ORIGINAL
dependencies 1 imports · 0 importers
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
structs
| none |
consts
| 35 | const MF_DIR: *u8 = "/mnt/c/Users/elder/.claude/projects/C--Users-elder/memory" |
| 36 | const MF_FBUF: i64 = 1048576 |
| 37 | const MF_OBUF: i64 = 2097152 |
| 38 | const MF_MSG: i64 = 8192 |
functions
| 42 | func mf_hashnorm(p: *u8, n: i64) -> i64 called by 1: main |
| 63 | func mf_nput(nk: *i64, nv: *i64, h: i64, idx: i64) -> i64 called by 1: main |
| 74 | func mf_nget(nk: *i64, nv: *i64, h: i64) -> i64 called by 1: main |
| 87 | func main(argc: i64, argv: *i64) -> i64 |