soul: engram-store wiring (soul client path) + elc-fold source fixes
- soul.el/memory.el: ENGRAM_STORE-gated store boot/checkpoint (client path) + fix a latent memory.el segfault (engram_save returns Int, was str_eq'd as a pointer). - sessions.el/safety.el/chat.el: fix malformed El constructs that hung the elc fold (unterminated string literals, block-expression, undefined distill_transcript).
This commit is contained in:
@@ -885,7 +885,7 @@ fn handle_chat(body: String) -> String {
|
||||
|
||||
// Cross-session affective context: on session start (no history yet), check engram
|
||||
// for recent distress signals within 72h and prepend a care directive if found.
|
||||
let affective_prefix: String = {
|
||||
let affective_prefix: String = if true {
|
||||
// Runs every turn. Uses correct BellEvent/PositiveEvent tags.
|
||||
let aff_now_ts: Int = time_now()
|
||||
let aff_cutoff: Int = aff_now_ts - 259200
|
||||
@@ -940,7 +940,7 @@ fn handle_chat(body: String) -> String {
|
||||
"[RECENT CONTEXT: User recently shared exciting or joyful news. Acknowledge and celebrate with them when relevant.]\n\n"
|
||||
} else { "" }
|
||||
}
|
||||
}
|
||||
} else { "" }
|
||||
|
||||
let ctx: String = engram_compile(activation_seed)
|
||||
let system: String = affective_prefix + build_system_prompt(ctx, true)
|
||||
@@ -2086,6 +2086,18 @@ fn handle_chat_as_soul(body: String) -> String {
|
||||
// The soul's engram activates on the transcript content — its own recall,
|
||||
// not external injection. The system prompt is just identity.
|
||||
//
|
||||
// distill_transcript — reduce a full room transcript to the salient tail that
|
||||
// should drive engram activation. Minimal implementation: keep the last 4000
|
||||
// characters (the recent exchange + trailing question). A full transcript still
|
||||
// activates correctly; this just bounds the activation seed for long rooms.
|
||||
fn distill_transcript(transcript: String) -> String {
|
||||
let tlen: Int = str_len(transcript)
|
||||
if tlen <= 4000 {
|
||||
return transcript
|
||||
}
|
||||
return str_slice(transcript, tlen - 4000, tlen)
|
||||
}
|
||||
|
||||
// After responding, the soul records what it said in its own engram.
|
||||
// That is how it learns. Not from being told about the room.
|
||||
fn handle_dharma_room_turn(body: String) -> String {
|
||||
|
||||
Reference in New Issue
Block a user