code wiki / _hdl_build / nx_work_retro_lib.nx

nx_work_retro_lib.nx

buildroot/runtime/_hdl_build/nx_work_retro_lib.nx

8904 B182 linesdepth 3pulls 3 transitivereach 2 importersview sourcekind librarytopic work
docsdependenciesstructsconstsfunctions

about

nx_work_retro_lib.nx -- the PAST axis: a retroactive sweep that COVERS WHAT WAS MISSED. It walks the active organ dir, and for every .nx cross-checks whether its name is ACCOUNTED FOR anywhere in the durable record (any memory doc *.md + the live worklog). A RECENT organ that appears NOWHERE is FLAGGED as a candidate uncaptured workstream -- exactly the class the 2026-06-18 hand sweep found (5 arcs with no memory file). LIAR-KILL by construction: unaccounted recent work is never silently dropped, it is surfaced. The recency gate stops the sweep from drowning in long-settled helper organs (only fresh, unrecorded work is a real loss). REUSE (DRY): the getdents64 + fstatat(mtime@88) walk, bounded file read, and substring find are the proven nx_ws_index_lib primitives (wme_getdents/wme_read/wme_find/wme_join/wme_len). Sovereign. license_tier: ORIGINAL

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_ws_index_lib.nx nx_work_retro_lib.nx nx_work_retro.nx nx_work_retro_gate.nx

imports: nx_syscalls.nxnx_ws_index_lib.nx

imported by: nx_work_retro.nxnx_work_retro_gate.nx

structs

none

consts

14const WR_MAGIC_65536: i64 = 65536
16const WR_CORPUSCAP: i64 = 12582912 // 12MB: all memory *.md + worklog concatenated (accounted-set)
17const WR_MAXORG: i64 = 8192 // max .nx in a sweep dir
18const WR_SLOT: i64 = 256
21const WR_ACCOUNTED: i64 = 0 // name found in the record -> known, not lost
22const WR_FLAGGED: i64 = 1 // recent AND unrecorded -> candidate uncaptured work
23const WR_STALE: i64 = 2 // unrecorded but old -> not a fresh loss (don't flag)

functions

25func wr_is_md(name: *u8) -> i64
called by 1: wr_load_corpus calls 1: wme_len
33func wr_is_nx(name: *u8) -> i64
called by 1: wr_sweep calls 1: wme_len
43func wr_strip_nx(name: *u8, out: *u8) -> i64
called by 1: wr_sweep calls 1: wme_len
54func wr_ends_with(s: *u8, suf: *u8) -> i64
called by 1: wr_is_helper calls 1: wme_len
67func wr_is_helper(basename: *u8) -> i64
called by 1: wr_sweep calls 1: wr_ends_with
88func wr_classify(basename: *u8, mt: i64, corpus: *u8, clen: i64, now: i64, window: i64) -> i64
called by 2: mainwr_sweep calls 1: wme_find
96func wr_load_corpus(memdir: *u8, worklog: *u8, buf: *u8, cap: i64) -> i64
135func wr_sweep(sweepdir: *u8, corpus: *u8, clen: i64, now: i64, window: i64, flagged_buf: *u8, flagcap: i64, stats: *i64) -> i64