code wiki / (root) / nx_companion_turn.nx

nx_companion_turn.nx

buildroot/runtime/nx_companion_turn.nx

5004 B96 linesdepth 7pulls 11 transitivereach 1 importersview sourcekind librarytopic companion
docsdependenciesstructsconstsfunctions

about

nx_companion_turn.nx -- R1e CAPSTONE of the ELDER AI companion spine: compose ONE turn's generation context from the three proven organs. This is what makes persona + memory + relationship a coherent BEING rather than parts: given an incoming message, it assembles (1) WHO ELDER IS (persona directive, projected verbatim -- no censor), (2) WHO YOU ARE TO ELDER (relationship state), (3) WHAT ELDER REMEMBERS RELEVANT TO THIS (episodes retrieved by the topic of the incoming message -- grounded recall, not a memory dump), and (4) the incoming message + a stay-in-character instruction. The result is the exact context a sovereign LLM would condition on to produce an in-character, memory-grounded, relationship-aware reply. license_tier: ORIGINAL

dependencies 3 imports · 1 importers

nx_persona.nx nx_companion_memory.nx nx_companion_rel.nx nx_companion_turn.nx nx_companion_turn_gate.nx

imports: nx_persona.nxnx_companion_memory.nxnx_companion_rel.nx

imported by: nx_companion_turn_gate.nx

structs

none

consts

11const K_MAGIC_8192: i64 = 8192

functions

13func ct_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
14func ct_catz(d: *u8, o: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){ d[o+i]=s[i]; i=i+1 } return o+i }
15func ct_catn(d: *u8, o: i64, src: *u8, off: i64, len: i64) -> i64 { var i: i64=0; while i<len { d[o+i]=src[off+i]; i=i+1 } return o+len }
16func ct_alpha(c: u8) -> i64 { if c >= (65 as u8) { if c <= (90 as u8) { return 1 } } if c >= (97 as u8) { if c <= (122 as u8) { return 1 } } return 0 }
20func companion_context_pfx(pp: *u8, mp: *u8, rp: *u8, pid: *u8, user: *u8, inc: *u8, out: *u8, cap: i64) -> i64
94func companion_context(pid: *u8, user: *u8, inc: *u8, out: *u8, cap: i64) -> i64