Implement Layer 3.5: Integrated Profile system

Layer 3.5 provides a unified, essential summary of the user by integrating
data from Layers 1-3. This addresses the product design gap where individual
layers work correctly but lack a cohesive, simple output.

Design Philosophy:
- "Internal complexity, external simplicity"
- AI references get_profile() as primary tool (efficient)
- Detailed data still accessible when needed (flexible)
- Auto-caching with smart update triggers (performant)

Implementation:
- UserProfile struct: dominant traits, core interests, core values
- Automatic data aggregation from Layer 1-3
- Frequency analysis for topics/values extraction
- SQLite caching (user_profiles table, single row)
- Update triggers: 10+ new memories, new analysis, or 7+ days old
- MCP tool: get_profile (primary), others available for details

Data Structure:
- dominant_traits: Top 3 Big Five traits
- core_interests: Top 5 frequent topics from memories
- core_values: Top 5 values from high-priority memories
- key_memory_ids: Top 10 priority memories as evidence
- data_quality: 0.0-1.0 confidence score

Usage Pattern:
- Normal: AI calls get_profile() only when needed
- Deep dive: AI calls list_memories(), get_memory(id) for details
- Efficient: Profile cached, regenerates only when necessary
This commit is contained in:
Claude
2025-11-06 06:47:51 +00:00
parent 2aac138185
commit cb46185aa3
4 changed files with 370 additions and 0 deletions

View File

@@ -1,9 +1,11 @@
pub mod analysis;
pub mod error;
pub mod memory;
pub mod profile;
pub mod store;
pub use analysis::UserAnalysis;
pub use error::{MemoryError, Result};
pub use memory::Memory;
pub use profile::{UserProfile, TraitScore};
pub use store::MemoryStore;