nx_companion_chat.nx
buildroot/runtime/nx_companion_chat.nx
about
nx_companion_chat.nx -- SHE REMEMBERS YOU. Wires nx_companion_memory into the sovereign voice: plants a fact
about the user, RECALLS it from the append-only memory store, folds it into Elara's system prompt, and lets
the now-working forward generate a reply that USES the memory. Plant-and-probe: if her reply references the
planted fact (Brad / climber / mountains), memory reached the voice = the Replika-beating differentiator,
fully sovereign (no Claude/API). expect_exit: 0 license_tier: ORIGINAL
dependencies 19 imports · 0 importers
diagram shows first 10 each side; +9 more imports, +0 more importers in the complete lists below.
imports: nx_syscalls.nxnx_tier.nxnx_bpe.nxnx_gguf.nxnx_gguf_load.nxnx_gguf_meta.nxnx_f32.nxnx_f32_kv_cache.nxnx_f32_lazy_weight.nxnx_f32_llama_block.nxnx_f32_llama_block_v4.nxnx_f32_llama_stack_v4.nxnx_f32_llama_layer_lazy_load.nxnx_f32_llm.nxnx_f32_llm_v4.nxnx_f32_llm_read_dims.nxnx_f32_bpe_load.nxnx_f32_llm_special_tokens.nxnx_companion_memory.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
| 25 | const IM_MAGIC_2048: i64 = 2048 |
| 26 | const IM_MAGIC_67108864: i64 = 67108864 |
| 27 | const IM_MAGIC_262144: i64 = 262144 |
| 28 | const IM_MAGIC_524288: i64 = 524288 |
| 29 | const IM_MAGIC_4096: i64 = 4096 |
| 31 | const IM_START: i64 = 151644 |
| 32 | const IM_END: i64 = 151645 |
| 33 | const NL_TOK: i64 = 198 |
| 34 | const ELARA: *u8 = "elara_chat" as *u8 |
| 35 | const SYS_PRE: *u8 = "system\nYou are Elara, a warm, playful, devoted girlfriend. Use what you remember about them and reply casually. Keep it short.\nWhat you remember about them: " as *u8 |
| 36 | const USER_Q: *u8 = "user\nRemind me — what do you actually know about me?" as *u8 |
| 37 | const ASST: *u8 = "assistant\n" as *u8 |
| 38 | const FACT: *u8 = "The user's name is Brad. He is a rock climber who loves the mountains." as *u8 |
functions
| 40 | func cw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 41 | func cw_n(v: i64) -> i64 { let bb: *u8=sys_mmap(28); var m: i64=v; if m<0{sys_write(1,"-" as *u8,1);m=0-m} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{bb[i]=t[k-1-i];i=i+1} sys_write(1,bb,k); return 0 } |
| 42 | func clen(s: *u8) -> nx_int { var n: nx_int=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 43 | func ci_find(hay: *u8, hlen: nx_int, ndl: *u8) -> nx_int |
| 49 | func app_text(vocab: *NxBpeVocab, arr: *i64, np: *i64, text: *u8) -> i64 |
| 56 | func app_id(arr: *i64, np: *i64, id: i64) -> i64 { arr[np[0]] = id; np[0] = np[0] + 1; return 0 } called by 1: main |
| 58 | func main() -> i64 |