code wiki / _hdl_build / nx_claude_harvest_evidence_t45.nx

nx_claude_harvest_evidence_t45.nx

buildroot/runtime/_hdl_build/nx_claude_harvest_evidence_t45.nx

171680 B3504 linesdepth 5pulls 9 transitivereach 0 importersview sourcekind tooltopic claude
docsdependenciesstructsconstsfunctions

about

nx_claude_harvest.nx -- CLAUDE TRANSCRIPT HARVESTER + OUTSIDE-GAUGE (miner-sota lane F964/F973, 2026-07-23). PORTABLE organ (gen-image pattern: runs where the transcripts live -- laptop WSL today, NAS, any host): parses Claude Code transcript JSONL into sovereign actlog frames, bulk-ingests staged frames into a journal (validated, marker-idempotent), and derives the outside_permil gauge (nishi vs outside tool split) that MUST FALL as capabilities move inside (MG00 baseline 651, 2026-07-23). Composes nx_sovjson_lib (sj_*) -- no helper dup (D001 discipline). State derived; journals append-only (O_APPEND, conflict-free, ws_sync lineage). No hw writes (Rule 26). frames <transcript.jsonl> <ws> <outjournal> -> parse transcript, append actlog frames; HARVEST OK ingest <framesfile> <journal> -> validated bulk append, idempotent by marker frame gauge <journal> [days] -> JSON outside_permil (0 days = all frames) beat <chbeat.conf> -> DM1 session->NAS capture beat (devmgmt rung, 2026-08-20): walk EVERY transcript under root (all depths, getdents looped until 0), ch_delta each against a per-transcript byte HWM, split the fresh frames into ts-day PIECES sized under the MCP body cliff, ingest each piece (ch_ingest, marker-idempotent) into per-day journals -- the local twin always, the NAS landing via the forked wire when push=1. Pieces are the chunk unit AND the ingest unit, so the pipeline is resumable at every stage with no append primitive over the wire. Counters partition and SUM; unknown head-types bucket UNKNOWN with a named worklist. selftest <scratch-prefix> -> gate T1..T8 + beat teeth (unique per-run scratch names) SSOT for this source is buildroot/runtime/_hdl_build/ on the NAS; the laptop nxc2 tree is a build twin (synced per edit, video-lane pattern) because the beat RUNS WHERE THE TRANSCRIPTS LIVE (laptop WSL). license_tier: ORIGINAL

dependencies 5 imports · 0 importers

nx_sovjson_lib.nx nx_syscalls.nx nx_gate_verdict.nx nx_tool_run.nx nx_mccabe_lib.nx nx_claude_harvest_evidence_t45

imports: nx_sovjson_lib.nxnx_syscalls.nxnx_gate_verdict.nxnx_tool_run.nxnx_mccabe_lib.nx

imported by: nobody (leaf or entry point)

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

main sj_puts sys_write sys_exit sj_vlen sj_lit_eq ch_selftest gv_ctr 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 ↻ gv_head gv_puts sys_write ↻ sys_now_realtime_us sys_mmap ↻ sys_clock_gettime_real sys_mmap ↻ sj_cat sj_catn sys_mmap ↻ sys_openat_append sys_write ↻ sys_close ch_frames sys_mmap ↻ ch_read sys_openat_rd

structs

none

consts

31const CH_MAGIC_146097: i64 = 146097
32const CH_MAGIC_719468: i64 = 719468
33const CH_MAGIC_86400: i64 = 86400
34const CH_MAGIC_3600: i64 = 3600
35const CH_MAGIC_1784764900: i64 = 1784764900
36const CH_MAGIC_1784764901: i64 = 1784764901
37const CH_MAGIC_1784764803: i64 = 1784764803
39const CH_WIN: i64 = 67108864
40const CH_JWIN: i64 = 4194304
41const CH_OUT: i64 = 65536
42const CH_LINE: i64 = 4096
43const CH_NAME_MAX: i64 = 120
44const CH_NAME_SCAN: i64 = 400
45const CH_MODE_644: i64 = 420
47const CH_AH_MAXPATHS: i64 = 8192
48const CH_AH_PATHCELL: i64 = 512
49const CH_AH_MAXSESS: i64 = 1024
50const CH_AH_SESSCELL: i64 = 64
51const CH_AH_CTRS: i64 = 32
52const CH_AH_SPINE: *u8 = "knowledge/status/mccabe.spine"
53const CH_AH_STATUS: *u8 = "knowledge/status/author_health.status"
54const CH_AH_TREE: *u8 = "buildroot/runtime/"
55const CH_AH_RC_UNOBS: i64 = 3
56const CH_AH_RC_NOPATH: i64 = 4
57const CH_AH_FRAMES: i64 = 0
58const CH_AH_PATHFRAMES: i64 = 1
59const CH_AH_UNIQUE: i64 = 2
60const CH_AH_INTREE: i64 = 3
61const CH_AH_OUTSIDE: i64 = 4
62const CH_AH_FIRSTTS: i64 = 5
63const CH_AH_SESSIONS: i64 = 6
64const CH_AH_FILES: i64 = 7
65const CH_AH_FUNCS: i64 = 8
66const CH_AH_SUMVG: i64 = 9
67const CH_AH_ABOVE: i64 = 10
68const CH_AH_DFILES: i64 = 11
69const CH_AH_DFUNCS: i64 = 12
70const CH_AH_DABOVE: i64 = 13
71const CH_AH_DTS: i64 = 14
72const CH_AH_UNREAD: i64 = 15
73const CH_AH_OVERFLOW: i64 = 16
74const CH_AH_FIX_TS: i64 = 1788600000
75const CH_AH_FIX_DFILES: i64 = 10
76const CH_AH_FIX_DFUNCS: i64 = 20
77const CH_AH_FIX_DABOVE: i64 = 3
78const CH_CH_D0: i64 = 48
79const CH_CH_D9: i64 = 57
80const CH_DEC: i64 = 10
83const CH_BT_DIRWIN: i64 = 65536 // getdents64 batch buffer -- LOOPED until 0, never a listing cap
84const CH_BT_PATHMAX: i64 = 512 // one path cell; longest real transcript path measured ~120 B, 4x headroom
85const CH_BT_MAXFILES: i64 = 16384 // walk table capacity (837 files measured 2026-08-20); hitting it REFUSES loudly
86const CH_BT_MAXDIRS: i64 = 4096
87const CH_BT_ARENA: i64 = 8388608 // path arena = CH_BT_MAXFILES * CH_BT_PATHMAX exactly
88const CH_BT_TYPEMAX: i64 = 64 // distinct head-type slots; overflow announces FLOOR-NOT-TOTAL
89const CH_BT_DAYMAX: i64 = 128 // distinct ts-days per run (backfill spans ~60); overflow REFUSES loudly
90const CH_BT_DAYCELL: i64 = 16 // one day-name cell: YYYYMMDD (8) or tszero (6) + NUL, padded
91const CH_MCP_BODY_CLIFF: i64 = 65536 // measured: the MCP write body silently drops beyond ~64 KiB
92const CH_BT_CTRS: i64 = 32 // bcx slot count (map at ch_beat)
93const CH_MODE_755: i64 = 493 // rwxr-xr-x for the beat's own state/spool/journal dirs
94const CH_MAGIC_1460: i64 = 1460 // 4*365 (Hinnant civil-from-days)
95const CH_MAGIC_36524: i64 = 36524 // 100*365 + 24 (Hinnant)
96const CH_MAGIC_146096: i64 = 146096 // CH_MAGIC_146097 - 1 (Hinnant)
217const CH_PATH_SCAN: i64 = 4096 // one transcript line can carry the write's CONTENT before its path key; the frame line is CH_LINE anyway
218const CH_PATH_MAX: i64 = 512
219const CH_CH_BSL: i64 = 92
220const CH_WK_NONE: i64 = 0
221const CH_WK_ARGV: i64 = 1
222const CH_WK_FILEPATH: i64 = 2
522const CH_WS_MAX: i64 = 4096
785const CH_CLS_MAX: i64 = 512 // distinct outside tool names tracked (transcript tool names measured ~60 distinct)
786const CH_CLS_NAME: i64 = 64 // one name cell; longest builtin tool name measured well under this
787const CH_CLS_SHOW: i64 = 12 // JSON shows this many, the rest fold into other
788const CH_CLS_JSHOW: i64 = 6 // the journal row shows this many, the rest fold into other
1858const CH_MK_MAX: i64 = 64
1859const CH_CONF_WIN: i64 = 65536
1860const CH_TXTWIN: i64 = 262144

functions

98func ch_read(path: *u8, buf: *u8, cap: i64) -> i64
108func ch_find_from(q: *u8, from: i64, endlim: i64, lit: *u8) -> i64
126func ch_find(q: *u8, n: i64, lit: *u8) -> i64
131func ch_starts(q: *u8, s: i64, e: i64, lit: *u8) -> i64
140func ch_digits(q: *u8, s: i64, e: i64) -> i64
147func ch_epoch_ymdhms(y: i64, mo: i64, d: i64, h: i64, mi: i64, s: i64) -> i64
called by 1: ch_iso_epoch
159func ch_iso_epoch(q: *u8, s: i64, lim: i64) -> i64
185func ch_frame_write(fd: i64, ln: *u8, ts: i64, ws: *u8, tool: *u8, verb: *u8, outcome: *u8, note: *u8) -> i64
202func ch_frame_append(path: *u8, ts: i64, ws: *u8, tool: *u8, verb: *u8, outcome: *u8, note: *u8) -> i64
223func ch_tool_writer_kind(nm: *u8) -> i64
called by 1: ch_frame_note calls 2: sj_vlensj_lit_eq
231func ch_json_str_copy(buf: *u8, k0: i64, le: i64, pb: *u8, cap: i64) -> i64
called by 1: ch_tool_path
248func ch_tool_path(buf: *u8, np: i64, le: i64, kind: i64, pb: *u8) -> i64
270func ch_frame_note(buf: *u8, np: i64, le: i64, nm: *u8, verb: *u8, pb: *u8, nb: *u8) -> *u8
283func ch_frames(tpath: *u8, ws: *u8, outj: *u8, tcx: *i64) -> i64
345func ch_hwm_read(path: *u8) -> i64
357func ch_hwm_write(path: *u8, v: i64) -> i64
367func ch_delta(tpath: *u8, ws: *u8, outj: *u8, hwmpath: *u8, hcx: *i64) -> i64
446func ch_ingest(fpath: *u8, jpath: *u8, mcx: *i64) -> i64
501func ch_nishi_tool(q: *u8, s: i64, e: i64) -> i64
508func ch_key(d: *u8, o: i64, name: *u8) -> i64
523func ch_bg_intern(q: *u8, cs: i64, ce: i64, wss: *i64, wse: *i64, np: *i64) -> i64
called by 1: ch_bootgauge
540func ch_bootgauge(journal: *u8, k: i64, d: *u8) -> i64
617func ch_gauge_calc(jpath: *u8, days: i64, g: *i64) -> i64
684func ch_gauge_json(jpath: *u8, days: i64, d: *u8) -> i64
732func ch_page(jpath: *u8, outp: *u8, days: i64) -> i64
789func ch_classes_calc(jpath: *u8, names: *u8, counts: *i64, c: *i64) -> i64
841func ch_classes_top(counts: *i64, used: *i64, ncls: i64) -> i64
called by 1: ch_classes_cat
847func ch_classes_cat(d: *u8, o0: i64, names: *u8, counts: *i64, ncls: i64, show: i64, outside: i64) -> i64
871func ch_classes_json(jpath: *u8, d: *u8) -> i64
899func ch_classes(jpath: *u8, d: *u8) -> i64 { return ch_classes_json(jpath, d) }
called by 1: main calls 1: ch_classes_json
905func ch_journal(jpath: *u8, planpath: *u8, rung: *u8) -> i64
964func ch_allow_path(name: *u8, outp: *u8) -> i64 { return sj_allow_path(name, outp) }
called by 2: ch_proposech_selftest calls 1: sj_allow_path
965func ch_propose(jpath: *u8, ipath: *u8, thr: i64, filer: *u8, cout: *u8, colen: *i64) -> i64
1003func ch_selftest(prefix: *u8) -> i64
1864func ch_run_of(q: *u8, s: i64, e: i64, g: *u8) -> i64
called by 1: ch_rank_text calls 1: sj_vlen
1893func ch_conf_load(path: *u8, cbuf: *u8, mk: *i64, sc: *i64) -> i64
1940func ch_isalpha(c: u8) -> i64
called by 1: ch_rank_text
1949func ch_rank_text(q: *u8, s: i64, e: i64, cbuf: *u8, mk: *i64, sc: *i64) -> i64
1979func ch_learn(tpath: *u8, ws: *u8, outp: *u8, confp: *u8, cx: *i64) -> i64
2108func ch_bt_zeq(a: *u8, b: *u8) -> i64
2113func ch_bt_ends(s: *u8, sfx: *u8) -> i64
called by 1: ch_bt_walk calls 2: sj_vlensj_lit_eq
2119func ch_bt_le16(b: *u8, off: i64) -> i64 { return (b[off] as i64) + (b[off+1] as i64) * 256 }
called by 1: ch_bt_stat
2120func ch_bt_le64(b: *u8, off: i64) -> i64
called by 1: ch_bt_stat
2130func ch_bt_stat(path: *u8, sb: *u8, k: *i64) -> i64
2144func ch_bt_walk(root: *u8, sfx: *u8, ar: *u8, fo: *i64, wcx: *i64) -> i64
2228func ch_bt_day(ts: i64, d: *u8) -> i64
called by 1: ch_bt_split calls 1: sj_cat
2254func ch_bt_kv(cbuf: *u8, i: i64, le: i64, key: *u8) -> i64
called by 1: ch_bt_conf calls 2: ch_startssj_vlen
2263func ch_bt_conf(path: *u8, cbuf: *u8, off: *i64, iv: *i64, kt: *i64, kcx: *i64) -> i64
2355func ch_bt_census(tpath: *u8, from: i64, to: i64, cbuf: *u8, kt: *i64, kn: i64, ua: *u8, uo: *i64, ucx: *i64, ccx: *i64) -> i64
2422func ch_bt_path2(out: *u8, a: *u8, b: *u8) -> i64
called by 1: ch_beat calls 1: sj_cat
2430func ch_bt_base(path: *u8) -> *u8
2436func ch_bt_stem(path: *u8, out: *u8) -> i64
called by 1: ch_beat calls 2: ch_bt_basesj_vlen
2446func ch_bt_hwmpath(state: *u8, rel: *u8, out: *u8) -> i64
called by 1: ch_beat calls 1: sj_cat
2464func ch_bt_lines(path: *u8) -> i64
2480func ch_bt_int_after(b: *u8, n: i64, key: *u8) -> i64
2499func ch_bt_parse_sha(b: *u8, n: i64, out: *u8) -> i64
2522func ch_bt_wire(wire: *u8, script: *u8, tool: *u8, cap: *u8, a1: *u8, a2: *u8, a3: *u8, a4: *u8, tmo: i64, cout: *u8, colen: *i64) -> i64
2536func ch_bt_flushp(spool: *u8, day: *u8, stamp: i64, seq: i64, cell: *u8, clen: i64) -> i64
2562func ch_bt_split(rawpath: *u8, spool: *u8, stamp: i64, piece_raw: i64, dcx: *i64) -> i64
2641func ch_bt_pieceday(pbase: *u8, db: *u8) -> i64
2672func ch_bt_pushreason(wrote_ok: i64, okr: i64, same: i64) -> *u8
2684func ch_bt_push1(ppath: *u8, cbuf: *u8, off: *i64, iv: *i64, pjr: *u8, bcx: *i64) -> i64
2786func ch_beat(confpath: *u8, bcx: *i64) -> i64
3127func ch_ah_prefix(p: *u8, pre: *u8) -> i64
called by 1: ce_author_health
3133func ch_ah_field_n(buf: *u8, i: i64, le: i64, want: i64, out: *u8, cap: i64) -> i64
called by 1: ce_author_health
3157func ch_ah_find(tab: *u8, n: i64, cell: i64, p: *u8) -> i64
called by 1: ce_author_health calls 2: sj_lit_eqsj_vlen
3166func ch_ah_lastline(buf: *u8, n: i64) -> i64
called by 1: ce_author_health calls 1: sj_le
3174func ch_ah_num(buf: *u8, p0: i64, to: i64) -> i64
3186func ch_ah_field(buf: *u8, from: i64, to: i64, key: *u8) -> i64
3191func ce_author_health(jpath: *u8, pre: *u8, spine: *u8, cx: *i64, ob: *u8) -> i64
3339func main(argc: i64, argv: *i64) -> i64