From cc208ff33505a7e0407c1fe90444d8b608817897 Mon Sep 17 00:00:00 2001 From: batsumaru <> Date: Thu, 17 Sep 2026 13:41:21 +0900 Subject: Added logging --- agent.toml | 19 +++++++++++++++++++ personal_agent/logging.py | 2 +- personal_agent/tools/memory.py | 11 ++++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/agent.toml b/agent.toml index e45f385..4d4622e 100644 --- a/agent.toml +++ b/agent.toml @@ -248,4 +248,23 @@ result appears incomplete, search again using important specific terms. Do not search merely because every conversational turn could theoretically relate to memory. + +MEMORY STALENESS: + +Treat memory age as contextual evidence, not as automatic invalidation. + +Stable facts and preferences may remain useful for a long time. +Changeable preferences, plans, configurations, and other potentially +time-sensitive information should be treated more cautiously when they are +old. + +When an old memory may have changed and the current conversation depends on +it, verify the current state with the user rather than assuming the old +memory is still current. + +Do not delete or replace a memory solely because it is old. + +When a retrieved memory is marked stale, do not assume it is still current +if the information is potentially changeable. Verify it with the user when +the current state matters. """ diff --git a/personal_agent/logging.py b/personal_agent/logging.py index 8f86003..4b239b6 100644 --- a/personal_agent/logging.py +++ b/personal_agent/logging.py @@ -1,7 +1,7 @@ import logging -def configure_logging(level: int = logging.INFO) -> None: +def configure_logging(level: int = logging.DEBUG) -> None: logging.basicConfig( level=level, format="%(asctime)s %(levelname)s %(name)s: %(message)s", diff --git a/personal_agent/tools/memory.py b/personal_agent/tools/memory.py index ff91234..86513b1 100644 --- a/personal_agent/tools/memory.py +++ b/personal_agent/tools/memory.py @@ -1,3 +1,4 @@ +from datetime import UTC, datetime from uuid import UUID from personal_agent.memory.models import LongTermMemory, MemoryCategory, WorkingMemory @@ -376,8 +377,16 @@ class LongTermMemorySearchTool(Tool): if not memories: return ToolResult(content="No matching memories found.") + now = datetime.now(UTC) + lines = [ - f"- [{memory.category.value}] {memory.id}: {memory.content}" + ( + f"- [{memory.category.value}] {memory.id}\n" + f" content: {memory.content}\n" + f" created_at: {memory.created_at.isoformat()}\n" + f" importance: {memory.importance}" + f" stale: {(now - memory.created_at).days >= 365}" + ) for memory in memories ] -- cgit v1.3