summaryrefslogtreecommitdiff
path: root/personal_agent/tools
diff options
context:
space:
mode:
Diffstat (limited to 'personal_agent/tools')
-rw-r--r--personal_agent/tools/memory.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/personal_agent/tools/memory.py b/personal_agent/tools/memory.py
index c84202f..ff91234 100644
--- a/personal_agent/tools/memory.py
+++ b/personal_agent/tools/memory.py
@@ -252,13 +252,25 @@ class LongTermMemorySaveTool(Tool):
"episodic for meaningful past events."
),
},
+ "importance": {
+ "type": "integer",
+ "enum": [1, 2, 3],
+ "description": (
+ "How useful this memory is likely to be in future "
+ "conversations: 1 = useful but minor, "
+ "2 = normally useful, "
+ "3 = especially important for future behavior. "
+ "Importance measure future usefullness, not emotional intensity."
+ ),
+ },
},
- "required": ["content", "category"],
+ "required": ["content", "category", "importance"],
}
def execute(self, arguments: dict[str, object]) -> ToolResult:
content = arguments.get("content")
category = arguments.get("category")
+ importance = arguments.get("importance")
if not isinstance(content, str):
raise ToolError("content must be a string")
@@ -269,12 +281,18 @@ class LongTermMemorySaveTool(Tool):
if not isinstance(category, str):
raise ToolError("category must be a string")
+ if not isinstance(importance, int) or isinstance(importance, bool):
+ raise ToolError("importance must be an integer")
+
+ if importance not in (1, 2, 3):
+ raise ToolError("importance must be between 1 and 3")
+
try:
memory_category = MemoryCategory(category)
except ValueError:
raise ToolError("category must be 'semantic' or 'episodic'")
- memory = LongTermMemory.create(content, memory_category)
+ memory = LongTermMemory.create(content, memory_category, importance)
self.store.add(memory)
return ToolResult(content=f"Saved memory: {memory.id}")