From b5cc404776b6896f85a56f84daf74ecb2c74cd16 Mon Sep 17 00:00:00 2001 From: BukeLy Date: Sun, 31 May 2026 21:16:49 +0800 Subject: [PATCH] refactor(pifs): remove legacy command prompt filter --- pageindex/filesystem/agent.py | 21 +-------------------- tests/test_pifs_agent_stream.py | 22 ---------------------- 2 files changed, 1 insertion(+), 42 deletions(-) diff --git a/pageindex/filesystem/agent.py b/pageindex/filesystem/agent.py index 24598dd..282f67e 100644 --- a/pageindex/filesystem/agent.py +++ b/pageindex/filesystem/agent.py @@ -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(), ] ) diff --git a/tests/test_pifs_agent_stream.py b/tests/test_pifs_agent_stream.py index 8908abd..de93856 100644 --- a/tests/test_pifs_agent_stream.py +++ b/tests/test_pifs_agent_stream.py @@ -273,28 +273,6 @@ class PIFSAgentStreamTest(unittest.TestCase): self.assertIn("cat --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] ""', 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)