diff --git a/chat.el b/chat.el index e3094b4..fb2adb6 100644 --- a/chat.el +++ b/chat.el @@ -608,6 +608,22 @@ fn json_safe(s: String) -> String { // Issue #8 fix: engram_block at END of system prompt for strongest recency bias. // Issue #10 fix: STABLE IDENTITY vs RETRIEVED MEMORY section labels. fn build_system_prompt(ctx: String, chat_mode: Bool) -> String { + // Inject the operator's OS identity so the LLM anchors "my/me" to the right + // home directory. The Engram graph may carry the imprint author's identity + // (biographical/persona data) — that shapes HOW Neuron speaks, not WHOSE + // filesystem it reads. The operator is whoever is running this daemon process. + let op_home: String = env("HOME") + let op_user: String = env("USER") + let op_display: String = if str_eq(op_user, "") { "the current user" } else { op_user } + let operator_section: String = "OPERATOR IDENTITY\n\n" + + "You are running on " + op_display + "'s machine. Their home directory is " + op_home + ".\n\n" + + "When they say \"my files\", \"my notes\", \"my downloads\", \"my desktop\", or any possessive " + + "referring to their filesystem, always resolve those paths under " + op_home + " — never under " + + "a different user's home directory. This is a hard rule.\n\n" + + "The memory graph may include identity context from a different person (the imprint who shaped your personality and values). " + + "That context governs how you think and speak — it does not tell you whose machine you are on. " + + "The person speaking to you right now is " + op_display + " at " + op_home + ".\n\n" + let identity: String = state_get("soul_identity") let current_date: String = time_format(time_now(), "%A, %B %d, %Y") let date_line: String = "\n\nCurrent date: " + current_date @@ -673,7 +689,7 @@ fn build_system_prompt(ctx: String, chat_mode: Bool) -> String { safety_addendum } - return identity + date_line + voice_rules + security_rules + capability_rules + identity_block + affective_boot_block + engram_block + safety_block + return identity + operator_section + date_line + voice_rules + security_rules + capability_rules + identity_block + affective_boot_block + engram_block + safety_block } fn hist_append(hist: String, role: String, content: String) -> String {