Skip to content

The agent that grows with you

fix(file-tools): search_files mentions macOS protected-folder pruning only on macOS

Tekniumd4403afd9fec
diff --git a/tests/tools/test_search_files_schema_platform.py b/tests/tools/test_search_files_schema_platform.py
new file mode 100644
index 00000000000..0b6ab50d050
--- /dev/null
+++ b/tests/tools/test_search_files_schema_platform.py
@@ -0,0 +1,16 @@
+"""search_files advertises macOS protected-folder pruning only on the host that prunes."""
+
+import pytest
+
+from tools.file_tools import SEARCH_FILES_SCHEMA
+
+
+def test_macos_schema_explains_protected_folder_pruning():
+ assert "TCC-protected folders" in SEARCH_FILES_SCHEMA["description"]
+
+
[email protected]("not macos")
+def test_other_hosts_schema_omits_macos_pruning():
+ description = SEARCH_FILES_SCHEMA["description"]
+ assert "macOS" not in description and "TCC" not in description
diff --git a/tools/file_tools.py b/tools/file_tools.py
index 553a79d19b5..ae718bb2cba 100644
--- a/tools/file_tools.py
+++ b/tools/file_tools.py
@@ -26,6 +26,7 @@ from tools.file_operations import (
ShellFileOperations, normalize_read_pagination, normalize_search_pagination)
from tools.file_operations_common import DEFAULT_READ_LIMIT, count_conflict_blocks
from tools import file_state
+from hermes_platform.host import facts
from agent.redact import _is_secret_file_arg, redact_sensitive_text
from tools.file_tools_paths import (
_expand_tilde, _path_resolution_warning, _resolve_base_dir, _resolve_entry_for_task,
@@ -1285,9 +1286,15 @@ def _is_openai_family_main() -> bool:
return "openai/" in model
+# Pruning happens only on a macOS host (``_macos_protected_search_exclusions``), so only that
+# host's schema mentions it; other hosts would pay for a sentence about an OS they are not on.
+_MACOS_SEARCH_NOTE = (" On macOS, broad searches above the user home automatically skip TCC-protected folders (Desktop, "
+ "Documents, Downloads, Library, Movies, Music, Pictures); target one directly when access is intentional."
+ if facts.os_family() == "darwin" else "")
+
SEARCH_FILES_SCHEMA = {
"name": "search_files",
- "description": "Search file contents or find files by name. Use this instead of grep/rg/find/ls in terminal. Ripgrep-backed, faster than shell equivalents. On macOS, broad searches above the user home automatically skip TCC-protected folders (Desktop, Documents, Downloads, Library, Movies, Music, Pictures); target one directly when access is intentional.\n\nContent search (target='content'): Regex search inside files. Output modes: full matches with line numbers, file paths only, or match counts.\n\nFile search (target='files'): Find files by glob pattern (e.g., '*.py', '*config*'). Also use this instead of ls. Discovery order is the fast bounded default; exact global newest-first order is an explicit opt-in and may scan the full tree.",
+ "description": "Search file contents or find files by name. Use this instead of grep/rg/find/ls in terminal. Ripgrep-backed, faster than shell equivalents." + _MACOS_SEARCH_NOTE + "\n\nContent search (target='content'): Regex search inside files. Output modes: full matches with line numbers, file paths only, or match counts.\n\nFile search (target='files'): Find files by glob pattern (e.g., '*.py', '*config*'). Also use this instead of ls. Discovery order is the fast bounded default; exact global newest-first order is an explicit opt-in and may scan the full tree.",
"parameters": {
"type": "object",
"properties": {