Inject operator home dir into system prompt to fix 'my' path resolution
Neuron Soul CI / build (pull_request) Has been cancelled

Resolves #30. The LLM was resolving possessive filesystem references ('my
notes', 'my downloads') against the imprint author's identity in the Engram
graph rather than the actual OS user running the daemon. Add an OPERATOR
IDENTITY section to build_system_prompt() that explicitly states the current
user and home directory, blocking the LLM from inferring the wrong home from
biographical context.
This commit is contained in:
2026-06-28 14:04:37 -05:00
parent a77578e243
commit 53df211e06
+17 -1
View File
@@ -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 {