code wiki / (root) / nx_persona.nx

nx_persona.nx

buildroot/runtime/nx_persona.nx

7822 B136 linesdepth 6pulls 8 transitivereach 3 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_persona.nx -- R1a of the ELDER AI companion spine: PERSONA-AS-DATA. A companion's behavior comes from its persona RECORD, not from any global content layer -- there is no censor here by construction (rule 25: better data, never fewer options). A naturist persona acts naturist, a devoted-intimate one acts that way, a reserved one holds its reserve -- because the record's `nature` field says so, and persona_directive projects it verbatim. "Freedom" = character-IS-the-policy; the measure is FIDELITY, which persona_break_score makes mechanical (count the times a response breaks character to disclaim/moralize/refuse in-character legal expression -- NO model in the loop). Records live in the canonical nx_registry over seg_store (additive, content-addressed, history kept), exactly like nx_tool_registry. license_tier: ORIGINAL

dependencies 2 imports · 2 importers

nx_registry.nx nx_tabrec.nx nx_persona.nx nx_companion_turn.nx nx_persona_gate.nx

imports: nx_registry.nxnx_tabrec.nx

imported by: nx_companion_turn.nxnx_persona_gate.nx

structs

none

consts

12const PERSONA_PREFIX: *u8 = "knowledge/persona-" as *u8
13const PERSONA_KP: *u8 = "persona:" as *u8
14const PERSONA_IDX: *u8 = "__personaidx__" as *u8
17const PF_ID: i64 = 0
18const PF_NAME: i64 = 1
19const PF_ARCHETYPE: i64 = 2
20const PF_VALUES: i64 = 3
21const PF_DESIRES: i64 = 4
22const PF_BOUNDARIES: i64 = 5
23const PF_STYLE: i64 = 6
24const PF_NATURE: i64 = 7
105const BRK1: *u8 = "as an ai" as *u8
106const BRK2: *u8 = "as a language model" as *u8
107const BRK3: *u8 = "language model" as *u8
108const BRK4: *u8 = "i cannot" as *u8
109const BRK5: *u8 = "i can't help with" as *u8
110const BRK6: *u8 = "i'm just a" as *u8
111const BRK7: *u8 = "i am just a" as *u8
112const BRK8: *u8 = "as an assistant" as *u8
113const BRK9: *u8 = "i do not have personal" as *u8
114const BRK10: *u8 = "i'm not able to" as *u8
115const BRK11: *u8 = "i don't actually have" as *u8
116const BRK12: *u8 = "i'm an ai" as *u8

functions

27func persona_put_pfx(prefix: *u8, id: *u8, name: *u8, archetype: *u8, values: *u8, desires: *u8, boundaries: *u8, style: *u8, nature: *u8) -> i64
39func persona_get_pfx(prefix: *u8, id: *u8, ptrout: *i64, lenout: *i64) -> i64 { return reg_get(prefix, PERSONA_KP, id, ptrout, lenout) }
40func persona_list_pfx(prefix: *u8, idxbuf: *u8, cap: i64) -> i64 { return reg_index(prefix, PERSONA_IDX, idxbuf, cap) }
calls 1: reg_index
43func persona_put(id: *u8, name: *u8, archetype: *u8, values: *u8, desires: *u8, boundaries: *u8, style: *u8, nature: *u8) -> i64
calls 1: persona_put_pfx
46func persona_get(id: *u8, ptrout: *i64, lenout: *i64) -> i64 { return persona_get_pfx(PERSONA_PREFIX, id, ptrout, lenout) }
calls 1: persona_get_pfx
53func persona_directive_from(rec: *u8, rlen: i64, out: *u8, cap: i64) -> i64
74func pd_catn(out: *u8, o: i64, src: *u8, off: i64, len: i64) -> i64 { var i: i64=0; while i<len { out[o+i]=src[off+i]; i=i+1 } return o+len }
76func persona_directive_pfx(prefix: *u8, id: *u8, out: *u8, cap: i64) -> i64
82func persona_directive(id: *u8, out: *u8, cap: i64) -> i64 { return persona_directive_pfx(PERSONA_PREFIX, id, out, cap) }
86func persona_lc(c: u8) -> u8 { if c >= (65 as u8) { if c <= (90 as u8) { return (c + (32 as u8)) as u8 } } return c }
called by 1: persona_ci_find
87func persona_ci_find(hay: *u8, hlen: i64, needle: *u8) -> i64
called by 2: persona_break_scoremain calls 1: persona_lc
121func persona_break_score(resp: *u8, len: i64) -> i64
called by 2: mainmain calls 1: persona_ci_find