Layer 4 provides relationship inference by analyzing memory patterns and user personality. This is an optional layer used when game or companion features are active. Core Philosophy: - Independent from Layers 1-3.5 (optional feature) - Inference-based, not stored (computed on-demand) - Simple calculation using existing data - Foundation for external applications (games, companions, etc.) Implementation (src/core/relationship.rs): - RelationshipInference struct with key metrics: * interaction_count: number of memories with entity * avg_priority: average priority of those memories * days_since_last: recency of interaction * bond_strength: inferred strength (0.0-1.0) * relationship_type: close_friend, friend, acquaintance, etc. * confidence: data quality indicator (0.0-1.0) Inference Logic: - Personality-aware: introverts favor count, extroverts favor quality - Simple rules: bond_strength from interaction patterns - Automatic type classification based on metrics - Confidence increases with more data MCP Tools (src/mcp/base.rs): - get_relationship(entity_id): Get specific relationship - list_relationships(limit): List all relationships sorted by strength Design Decisions: - No caching: compute on-demand for simplicity - No persistence: relationships are derived, not stored - Leverages Layer 1 (related_entities) and Layer 3.5 (profile) - Can be extended later with caching if needed Usage Pattern: - Normal use: Layers 1-3.5 only - Game/Companion mode: Enable Layer 4 tools - Frontend calls get_relationship() for character interactions - aigpt backend provides inference, frontend handles presentation
342 B
342 B