Add write_soul method to MemorySystem
This commit is contained in:
@@ -572,6 +572,17 @@ def get_memory_context(query: str, max_tokens: int = 2000, **filters) -> str:
|
||||
if not context_parts:
|
||||
return ""
|
||||
|
||||
def write_soul(self, content: str) -> bool:
|
||||
"""Write content to soul.md — Timmy's core identity."""
|
||||
try:
|
||||
SOUL_PATH.parent.mkdir(parents=True, exist_ok=True)
|
||||
SOUL_PATH.write_text(content)
|
||||
logger.info("MemorySystem: Updated soul.md")
|
||||
return True
|
||||
except OSError as exc:
|
||||
logger.error("Failed to write soul.md: %s", exc)
|
||||
return False
|
||||
|
||||
return "Relevant context from memory:\n" + "\n\n".join(context_parts)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user