nx_research_ledger.nx
buildroot/runtime/nx_research_ledger.nx
about
nx_research_ledger.nx -- rung 1 of "build up the NISHI RESEARCHER to LEARN each rung" (operator standing order 2026-06-16).
module: nishi-core.research.ledger capability: RESEARCH_MEMORY (the researcher compounds knowledge)
The researcher (nx_onsite_research_fetch) does the FETCH leg; this is the LEARNING leg: a durable,
append-only ledger of what each cliff taught us {topic :: cliff :: root-cause :: fix :: source :: outcome}.
Future research calls rl_query(topic) FIRST -> if a finding exists, start from it instead of re-researching
from scratch. That is how the researcher gets better "from the hardware rung up each rung".
Sovereign: pure nx_syscalls file I/O (openat_append/openat_rd/read), no C. Idempotent (upsert by topic ->
safe to run twice = deterministic GREEN x2). Append-only history (CLAUDE.md #13). license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_itoa_lib.nxnx_seg_store.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
| 15 | const K_MAGIC_1024: i64 = 1024 |
| 16 | const K_MAGIC_8192: i64 = 8192 |
| 17 | const K_MAGIC_65536: i64 = 65536 |
| 21 | const LP: *u8 = "knowledge/registry/research_ledger" as *u8 |
functions
| 25 | func rl_cat(dst: *u8, off: i64, s: *u8) -> i64 { var o: i64=off; var i: i64=0; while s[i]!=(0 as u8){dst[o]=s[i];o=o+1;i=i+1} return o } |
| 27 | func rl_strlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 30 | func g_puts(s: *u8) -> i64 { sys_write(1, s, rl_strlen(s)); return 0 } |
| 35 | func g_putn(v: i64) -> i64 { nxi_out(v); return 0 } |
| 37 | func rl_w(fd: i64, s: *u8) -> i64 { sys_write(fd, s, rl_strlen(s)); return 0 } |
| 40 | func rl_count(buf: *u8, n: i64, needle: *u8) -> i64 |
| 54 | func rl_read_all(buf: *u8, maxlen: i64) -> i64 |
| 70 | func rl_upsert(topic: *u8, cliff: *u8, root: *u8, fix: *u8, source: *u8, outcome: *u8) -> i64 |
| 81 | func main() -> i64 |