refactor(pifs): remove legacy command prompt filter

This commit is contained in:
BukeLy 2026-05-31 21:16:49 +08:00
parent 95e5717ba4
commit b5cc404776
2 changed files with 1 additions and 42 deletions

View file

@ -124,15 +124,6 @@ Tool policy:
- Distinguish default/register metadata from caller-provided custom metadata when the evidence supports it.
"""
LEGACY_SEMANTIC_COMMAND_SURFACE_TERMS = (
"search-summary",
"search-entity",
"search-relation",
"semantic-grep",
"find --name",
"find --relation",
)
STREAM_MODE_ALIASES = {
"": "off",
"none": "off",
@ -273,16 +264,6 @@ def compact_tool_output_preview(
return preview
def agent_visible_command_surface(executor: PIFSCommandExecutor) -> str:
"""Hide legacy semantic command hints from ask/chat default instructions."""
lines = []
for line in executor.describe_available_command_surfaces().splitlines():
if any(term in line for term in LEGACY_SEMANTIC_COMMAND_SURFACE_TERMS):
continue
lines.append(line)
return "\n".join(lines)
def build_agent_initial_context(
filesystem: PageIndexFileSystem,
*,
@ -312,7 +293,7 @@ def build_agent_initial_context(
ensure_ascii=False,
),
"Workspace retrieval capabilities:",
agent_visible_command_surface(executor),
executor.describe_available_command_surfaces(),
]
)

View file

@ -273,28 +273,6 @@ class PIFSAgentStreamTest(unittest.TestCase):
self.assertIn("cat <path> --structure", demo_prompt)
self.assertNotIn("search-summary", demo_prompt)
def test_built_agent_instructions_filter_legacy_semantic_command_surface(self):
class LegacySemanticBackend:
semantic_tool_channels = ("summary", "entity", "relation")
with tempfile.TemporaryDirectory() as workspace:
filesystem = PageIndexFileSystem(
workspace,
semantic_retrieval_backend=LegacySemanticBackend(),
)
instructions = build_pifs_agent_instructions(filesystem)
self.assertIn('browse [-R] <folder> "<query>"', instructions)
for old_command in (
"search-summary",
"search-entity",
"search-relation",
"semantic-grep",
"find --name",
"find --relation",
):
self.assertNotIn(old_command, instructions)
def test_prompt_rejects_find_grep_as_exhaustive_search(self):
self.assertIn("Do not use find | grep as an exhaustive search", AGENT_TOOL_POLICY)
self.assertIn("find output can be scoped or limited", AGENT_TOOL_POLICY)