Implemented 5-minute short-term caching for relationship inference:
**store.rs**:
- Added relationship_cache SQLite table
- save_relationship_cache(), get_cached_relationship()
- save_all_relationships_cache(), get_cached_all_relationships()
- clear_relationship_cache() - called on memory create/update/delete
- Cache duration: 5 minutes (configurable constant)
**relationship.rs**:
- Modified infer_all_relationships() to use cache
- Added get_relationship() function with caching support
- Cache hit: return immediately
- Cache miss: compute, save to cache, return
**base.rs**:
- Updated tool_get_relationship() to use cached version
- Reduced load from O(n) scan to O(1) cache lookup
**Benefits**:
- Reduces AI load when frequently querying relationships
- Automatic cache invalidation on data changes
- Scales better with growing memory count
- No user-facing changes
**Documentation**:
- Updated ARCHITECTURE.md with caching strategy details
This addresses scalability concerns for Layer 4 as memory data grows.
Layer 5 focuses on sharing AI interactions as "information + personality":
- SharedInteraction: Problem, approach, result with author profile
- ShareableProfile: User essence from Layer 3.5 + Layer 4
- Privacy-first: Share patterns, not raw data
- Use cases: AI-era GitHub Gist, knowledge SNS, persona showcase
Philosophy: People seek both useful information and authentic personality.
Like SNS/streaming, the combination creates value. Information alone is
sterile; personality alone is hollow.
Updated:
- docs/ARCHITECTURE.md: Comprehensive Layer 5 design with data models
- README.md: Added Layer 5 feature overview
- Layer overview diagram updated
- Update README.md with Layer 4 relationship inference features
- Add comprehensive Layer 4 section to ARCHITECTURE.md
- Update implementation strategy to show Phase 4 complete
- Add CLI control flag documentation (--enable-layer4)
- Update version to 0.3.0
- Document personality-aware bond strength calculation
- Add relationship type classification details
Updated README.md and ARCHITECTURE.md to reflect current implementation
status. All three layers are now complete and functional.
Changes:
- README.md: Added Layer 2 (AI Memory) and Layer 3 (Big Five) features
- README.md: Added MCP tools list and usage examples
- README.md: Added Big Five personality traits explanation
- ARCHITECTURE.md: Updated Layer 2 and 3 status to Complete
- ARCHITECTURE.md: Updated implementation strategy phases
- Archived old documentation in docs/archive/old-versions/
Current status:
- Layer 1 ✅ Complete: Pure memory storage
- Layer 2 ✅ Complete: AI interpretation + priority scoring
- Layer 3 ✅ Complete: Big Five personality analysis
- Layer 4 🔵 Planned: Game systems and companion features
- Layer 5 🔵 Future: Distribution and sharing