Extended Memory struct and database schema to support entity
tracking, which is foundation for Layer 4 relationship system.
Changes to Memory struct (src/core/memory.rs):
- Added related_entities: Option<Vec<String>> field
- Added new_with_entities() constructor for Layer 4
- Added set_related_entities() setter method
- Added has_entity() helper method to check entity membership
- All fields are optional for backward compatibility
Changes to database (src/core/store.rs):
- Added related_entities column to memories table
- Automatic migration for existing databases
- Store as JSON array in TEXT column
- Updated all CRUD operations (create, get, update, list, search)
- Parse JSON to Vec<String> when reading from database
Design rationale:
- "Who with" is fundamental attribute of memory
- Enables efficient querying by entity
- Foundation for Layer 4 relationship inference
- Optional field maintains backward compatibility
- Simple JSON serialization for flexibility
Usage:
Memory::new_with_entities(
content,
ai_interpretation,
priority_score,
Some(vec!["alice".to_string(), "bob".to_string()])
)