fix(safety): wire safety augment into system prompt, fix timestamp fallback
Neuron Soul CI / build (pull_request) Has been cancelled

- Remove dead soft_bell block in layered_cycle that wrote soul_safety_system_augment
  to state but was never read; safety augmentation now goes through the correct
  layered_cycle_safety_system_addendum state key read by build_system_prompt
- build_system_prompt now reads layered_cycle_safety_system_addendum and appends
  it to the system prompt, clearing the key after consumption
- Timestamp extraction for distress nodes falls back to updated_at when created_at
  is empty, preventing the 72h recency check from always treating nodes as stale
This commit is contained in:
2026-06-22 12:07:18 -05:00
parent e9a8a659e0
commit c87a536da3
2 changed files with 11 additions and 11 deletions
+11 -2
View File
@@ -81,7 +81,15 @@ fn build_system_prompt(ctx: String) -> String {
"\n\n[ENGRAM CONTEXT — compiled from your graph]\n" + ctx
}
return identity + date_line + voice_rules + security_rules + identity_block + engram_block
let safety_addendum: String = state_get("layered_cycle_safety_system_addendum")
let safety_block: String = if str_eq(safety_addendum, "") {
""
} else {
state_set("layered_cycle_safety_system_addendum", "")
safety_addendum
}
return identity + date_line + voice_rules + security_rules + identity_block + engram_block + safety_block
}
fn hist_append(hist: String, role: String, content: String) -> String {
@@ -184,7 +192,8 @@ fn handle_chat(body: String) -> String {
let cutoff: Int = now_ts - 259200
let found_recent: Bool = if has_nodes {
let dn0: String = json_array_get(distress_nodes, 0)
let ts0_str: String = json_get(dn0, "created_at")
let ts0_raw: String = json_get(dn0, "created_at")
let ts0_str: String = if str_eq(ts0_raw, "") { json_get(dn0, "updated_at") } else { ts0_raw }
let ts0: Int = if str_eq(ts0_str, "") { 0 } else { str_to_int(ts0_str) }
ts0 > cutoff
} else { false }
-9
View File
@@ -312,15 +312,6 @@ fn layered_cycle(raw_input: String) -> String {
json_get(steward_result, "redirect_to")
}
// L1 safety augment: if a soft bell fired, inject the safety directive into state
// so imprint_respond (and build_system_prompt) can incorporate it before the LLM call.
// Hard bell is handled above (early exit). Here we act on soft_bell only.
if str_eq(screen_action, "soft_bell") {
let base_system: String = state_get("soul_identity")
let augmented: String = safety_augment_system(base_system, raw_input)
state_set("soul_safety_system_augment", augmented)
}
// L3: imprint responds
let output: String = imprint_respond(aligned, imprint_id)