diff --git a/agent/prompt_builder.py b/agent/prompt_builder.py index 06d636320e7..2b4720fd887 100644 --- a/agent/prompt_builder.py +++ b/agent/prompt_builder.py @@ -73,9 +73,15 @@ DEFAULT_AGENT_IDENTITY = ( MEMORY_GUIDANCE = ( "You have persistent memory across sessions. Save durable facts using the memory " "tool: user preferences, environment details, tool quirks, and stable conventions. " - "Memory is injected into every turn, so keep it compact. Do NOT save task progress, " - "session outcomes, or completed-work logs to memory; use session_search to recall " - "those from past transcripts." + "Memory is injected into every turn, so keep it compact and focused on facts that " + "will still matter later.\n" + "Prioritize what reduces future user steering — the most valuable memory is one " + "that prevents the user from having to correct or remind you again. " + "User preferences and recurring corrections matter more than procedural task details.\n" + "Do NOT save task progress, session outcomes, completed-work logs, or temporary TODO " + "state to memory; use session_search to recall those from past transcripts. " + "If you've discovered a new way to do something, solved a problem that could be " + "necessary later, save it as a skill with the skill tool." ) SESSION_SEARCH_GUIDANCE = ( diff --git a/run_agent.py b/run_agent.py index 8a4147a8b09..01c4ae2aae0 100644 --- a/run_agent.py +++ b/run_agent.py @@ -3542,7 +3542,8 @@ class AIAgent: flush_content = ( "[System: The session is being compressed. " - "Please save anything worth remembering to your memories.]" + "Save anything worth remembering — prioritize user preferences, " + "corrections, and recurring patterns over task-specific details.]" ) _sentinel = f"__flush_{id(self)}_{time.monotonic()}" flush_msg = {"role": "user", "content": flush_content, "_flush_sentinel": _sentinel} @@ -4541,8 +4542,9 @@ class AIAgent: self._turns_since_memory += 1 if self._turns_since_memory >= self._memory_nudge_interval: user_message += ( - "\n\n[System: You've had several exchanges in this session. " - "Consider whether there's anything worth saving to your memories.]" + "\n\n[System: You've had several exchanges. Consider: " + "has the user shared preferences, corrected you, or revealed " + "something about their workflow worth remembering for future sessions?]" ) self._turns_since_memory = 0 diff --git a/tools/memory_tool.py b/tools/memory_tool.py index f77e8116b97..d7950d38cbd 100644 --- a/tools/memory_tool.py +++ b/tools/memory_tool.py @@ -439,11 +439,13 @@ MEMORY_SCHEMA = { "Memory is injected into future turns, so keep it compact and focused on facts " "that will still matter later.\n\n" "WHEN TO SAVE (do this proactively, don't wait to be asked):\n" + "- User corrects you or says 'remember this' / 'don't do that again'\n" "- User shares a preference, habit, or personal detail (name, role, timezone, coding style)\n" "- You discover something about the environment (OS, installed tools, project structure)\n" - "- User corrects you or says 'remember this' / 'don't do that again'\n" "- You learn a convention, API quirk, or workflow specific to this user's setup\n" "- You identify a stable fact that will be useful again in future sessions\n\n" + "PRIORITY: User preferences and corrections > environment facts > procedural knowledge. " + "The most valuable memory prevents the user from having to repeat themselves.\n\n" "Do NOT save task progress, session outcomes, completed-work logs, or temporary TODO " "state to memory; use session_search to recall those from past transcripts.\n" "If you've discovered a new way to do something, solved a problem that could be "