feat(intelligence): add personality detector — auto-adjust from conversation signals
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled

- PersonalityConfig with 4 dimensions: tone, proactiveness, formality, humor
- Signal detection from Chinese user messages (e.g. "说简单点" → Simple tone)
- apply_personality_adjustments() returns new immutable config
- build_personality_prompt() injects personality into system prompts
- Integrated into post_conversation_hook for automatic detection
- In-memory persistence via OnceLock (VikingStorage integration TODO)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
iven
2026-04-07 09:36:12 +08:00
parent 80cadd1158
commit af20487b8d
3 changed files with 371 additions and 0 deletions

View File

@@ -58,6 +58,26 @@ pub async fn post_conversation_hook(
crate::intelligence::heartbeat::record_interaction(agent_id);
debug!("[intelligence_hooks] Recorded interaction for agent: {}", agent_id);
// Step 1.5: Detect personality adjustment signals
if !_user_message.is_empty() {
let config = crate::intelligence::personality_detector::load_personality_config(agent_id);
let adjustments = crate::intelligence::personality_detector::detect_personality_signals(
_user_message, &config,
);
if !adjustments.is_empty() {
let new_config = crate::intelligence::personality_detector::apply_personality_adjustments(
&config, &adjustments,
);
crate::intelligence::personality_detector::save_personality_config(agent_id, &new_config);
for adj in &adjustments {
debug!(
"[intelligence_hooks] Personality adjusted: {} {} -> {} (trigger: {})",
adj.dimension, adj.from_value, adj.to_value, adj.trigger
);
}
}
}
// Step 2: Record conversation for reflection
let mut engine = reflection_state.lock().await;