add emotional system: auto-reflection, inner_state seeding, instance isolation

- doc/heart.md: emotional system design (motivation, reflection, relationship memory)
- Auto-reflection: every 10 messages, async LLM call updates inner_state
  with feelings and understanding changes (not conversation summary)
- Life Loop emotional motivation: "you care, not because timer fired"
- Remove all instance-specific names from code/docs — persona, name,
  memories are instance data (SQLite), not code
- Rewrite doc/life.md and doc/todo.md for instance isolation principle
This commit is contained in:
Fam Zheng
2026-04-09 21:23:39 +01:00
parent c7fd5460a3
commit c1fd2829dd
5 changed files with 191 additions and 59 deletions

View File

@@ -463,6 +463,16 @@ async fn handle_inner(
}
}
}
// auto-reflect every 10 messages
let count = state.message_count(&sid).await;
if count % 10 == 0 && count > 0 {
let state_c = state.clone();
let config_c = config.clone();
tokio::spawn(async move {
crate::life::reflect(&state_c, &config_c).await;
});
}
}
Err(e) => {
error!(%sid, "openai: {e:#}");