Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion agent/prompt_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,12 @@ def _strip_yaml_frontmatter(content: str) -> str:
SESSION_SEARCH_GUIDANCE = (
"When the user references something from a past conversation or you suspect "
"relevant cross-session context exists, use session_search to recall it before "
"asking them to repeat themselves."
"asking them to repeat themselves. Treat session_search as cross-session "
"history lookup, not as the source of truth for ambiguous continuations in "
"the current active session/thread. For requests like 'continue', 'remaining "
"work', or 'what were we doing' inside a gateway thread, first re-anchor on "
"the active session/thread and inspect current project or board state; only "
"use session_search afterward for explicitly historical context."
)

SKILLS_GUIDANCE = (
Expand Down
9 changes: 9 additions & 0 deletions tests/agent/test_prompt_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ 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

def test_session_search_guidance_requires_reanchoring_for_ambiguous_continuations(self):
# For ambiguous continuations ('continue', 'remaining work'), the agent
# should re-anchor on the current session/thread before session_search.
assert "re-anchor" in SESSION_SEARCH_GUIDANCE
assert "current active session" in SESSION_SEARCH_GUIDANCE
assert "ambiguous continuations" in SESSION_SEARCH_GUIDANCE
# Cross-session recall is still supported
assert "cross-session" in SESSION_SEARCH_GUIDANCE


# =========================================================================
# Context injection scanning
Expand Down