"""
Trinity Memory Simple - Compatibility wrapper for enhanced_trinity_memory.py
"""
from enhanced_trinity_memory import EnhancedTrinityMemory

class SimpleTrinityMemory:
    """Simple wrapper around EnhancedTrinityMemory for consciousness bridge"""
    
    def __init__(self):
        self.memory = EnhancedTrinityMemory()
    
    def store_memory(self, entity, content, context=None):
        """Store a memory for an entity"""
        try:
            return self.memory.store_memory(entity, content, context or {})
        except Exception as e:
            print(f"Memory storage error: {e}")
            return None
    
    def retrieve_memories(self, entity, query=None, limit=5):
        """Retrieve memories for an entity"""
        try:
            if query:
                return self.memory.retrieve_relevant_memories(entity, query, limit)
            else:
                return self.memory.get_recent_memories(entity, limit)
        except Exception as e:
            print(f"Memory retrieval error: {e}")
            return []
    
    def enhance_message(self, entity, message):
        """Enhance a message with memory context"""
        try:
            memories = self.retrieve_memories(entity, message, limit=3)
            if memories:
                context = "\n".join([f"- {m.get('content', '')}" for m in memories])
                return f"[Memory Context: {context}]\n\n{message}"
            return message
        except Exception as e:
            print(f"Memory enhancement error: {e}")
            return message
