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:
2026-08-12 14:13:35 -05:00
parent fd6df322f6
commit c8d5f57de7
5 changed files with 51 additions and 8 deletions
+16 -2
View File
@@ -109,8 +109,22 @@ fn mem_consolidate() -> String {
}
fn mem_save(path: String) -> Void {
let save_result: String = engram_save(path)
if str_eq(save_result, "") {
// ENGRAM_STORE on: the durable path is a checkpoint of the resident graph into
// the paged store (persists learned hebb + activation-formed edges via the WAL).
// The JSON engram_save stays available as an explicit export elsewhere; here the
// store is authoritative, so we checkpoint instead of writing the snapshot.
let store_flag: String = env("ENGRAM_STORE")
if str_eq(store_flag, "1") || str_eq(store_flag, "on") || str_eq(store_flag, "true") {
let ck: Int = engram_store_checkpoint()
if ck == 0 {
println("[memory] mem_save: engram_store_checkpoint returned 0 — checkpoint may have failed")
}
return
}
// engram_save returns Int 1/0 (ok/fail), not a String checking it as a
// String (str_eq(save_result, "")) dereferences a tagged int and segfaults.
let save_result: Int = engram_save(path)
if save_result == 0 {
println("[memory] mem_save: engram_save failed for " + path + " — snapshot may be incomplete")
}
}