fix: tighten memory and session recall guidance
Remove diary-style memory framing from the system prompt and memory tool schema, explicitly steer task/session logs to session_search, and clarify that session_search is for cross-session recall after checking the current conversation first. Add regression tests for the updated guidance text.
This commit is contained in:
parent
6d8286f396
commit
5319bb6ac4
6 changed files with 66 additions and 16 deletions
|
|
@ -15,10 +15,30 @@ from agent.prompt_builder import (
|
|||
build_context_files_prompt,
|
||||
CONTEXT_FILE_MAX_CHARS,
|
||||
DEFAULT_AGENT_IDENTITY,
|
||||
MEMORY_GUIDANCE,
|
||||
SESSION_SEARCH_GUIDANCE,
|
||||
PLATFORM_HINTS,
|
||||
)
|
||||
|
||||
|
||||
# =========================================================================
|
||||
# Guidance constants
|
||||
# =========================================================================
|
||||
|
||||
|
||||
class TestGuidanceConstants:
|
||||
def test_memory_guidance_discourages_task_logs(self):
|
||||
assert "durable facts" in MEMORY_GUIDANCE
|
||||
assert "Do NOT save task progress" in MEMORY_GUIDANCE
|
||||
assert "session_search" in MEMORY_GUIDANCE
|
||||
assert "like a diary" not in MEMORY_GUIDANCE
|
||||
assert ">80%" not in MEMORY_GUIDANCE
|
||||
|
||||
def test_session_search_guidance_is_simple_cross_session_recall(self):
|
||||
assert "relevant cross-session context exists" in SESSION_SEARCH_GUIDANCE
|
||||
assert "recent turns of the current session" not in SESSION_SEARCH_GUIDANCE
|
||||
|
||||
|
||||
# =========================================================================
|
||||
# Context injection scanning
|
||||
# =========================================================================
|
||||
|
|
|
|||
|
|
@ -9,9 +9,24 @@ from tools.memory_tool import (
|
|||
memory_tool,
|
||||
_scan_memory_content,
|
||||
ENTRY_DELIMITER,
|
||||
MEMORY_SCHEMA,
|
||||
)
|
||||
|
||||
|
||||
# =========================================================================
|
||||
# Tool schema guidance
|
||||
# =========================================================================
|
||||
|
||||
class TestMemorySchema:
|
||||
def test_discourages_diary_style_task_logs(self):
|
||||
description = MEMORY_SCHEMA["description"]
|
||||
assert "Do NOT save task progress" in description
|
||||
assert "session_search" in description
|
||||
assert "like a diary" not in description
|
||||
assert "temporary task state" in description
|
||||
assert ">80%" not in description
|
||||
|
||||
|
||||
# =========================================================================
|
||||
# Security scanning
|
||||
# =========================================================================
|
||||
|
|
|
|||
|
|
@ -9,9 +9,21 @@ from tools.session_search_tool import (
|
|||
_format_conversation,
|
||||
_truncate_around_matches,
|
||||
MAX_SESSION_CHARS,
|
||||
SESSION_SEARCH_SCHEMA,
|
||||
)
|
||||
|
||||
|
||||
# =========================================================================
|
||||
# Tool schema guidance
|
||||
# =========================================================================
|
||||
|
||||
class TestSessionSearchSchema:
|
||||
def test_keeps_cross_session_recall_guidance_without_current_session_nudge(self):
|
||||
description = SESSION_SEARCH_SCHEMA["description"]
|
||||
assert "past conversations" in description
|
||||
assert "recent turns of the current session" not in description
|
||||
|
||||
|
||||
# =========================================================================
|
||||
# _format_timestamp
|
||||
# =========================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue