The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(config): register tool search deferral settings
joaomarcosf7ff7d3f4fac
diff --git a/hermes_cli/config_defaults.py b/hermes_cli/config_defaults.pyindex 7ccc2d07395..5bcb40046d9 100644--- a/hermes_cli/config_defaults.py+++ b/hermes_cli/config_defaults.py@@ -1924,16 +1924,17 @@ DEFAULT_CONFIG = {"kernel_idle_timeout": 1800,"max_session_kernels": 4,},- # Tool Search: deferrable (MCP / non-core plugin) tools are replaced in the model-facing array- # by tool_search / tool_describe / tool_call bridges and surfaced on demand. Core Hermes tools- # (terminal, file tools, todo, memory, browser_*, ...) are NEVER deferred.+ # Tool Search replaces deferred tools in the model-facing array with the+ # tool_search / tool_describe / tool_call bridges and surfaces them on demand.+ # Working-set core tools stay eager, while the explicit ``defer`` list below+ # may include cold, event-triggered built-ins as well as plugin/MCP tools."tools": {"tool_search": {- # Tiered: tier 0 (no deferrable tools) = everything eager; tier 1 = bridge + a+ # Tiered: tier 0 (no deferred tools) = everything eager; tier 1 = bridge + a# name+description manifest when it fits the budget (degrades to names-only); tier 2# (over budget even names-only, e.g. ~3,300-tool APIs) = bare bridge + a# one-line-per-server summary (name + tool count). "auto"|"on" = activate when at least- # one deferrable tool exists ("auto" is an alias of "on" today, reserved for a future+ # one deferred tool exists ("auto" is an alias of "on" today, reserved for a future# budget-gated mode; keep it the default so explicit "on"/"off" pins are unaffected).# "off" = pass-through, no bridge."enabled": "auto",@@ -1952,10 +1953,17 @@ DEFAULT_CONFIG = {# Absolute cap on the embedded listing in tokens (chars/4), regardless of context size.# Range 200..60000."listing_max_tokens": 4000,- # Names of deferrable (MCP / non-core plugin) tools to replace with the tool_search- # bridge. None = curated default set; an explicit list replaces it wholesale- # ([] = defer no core tools). Read by tools/tool_search.py ToolSearchConfig.from_raw.- "defer": None,+ # Tools replaced by the bridge by default. This list intentionally includes cold,+ # event-triggered built-ins; an explicit list replaces it wholesale and [] keeps every+ # tool eager. The runtime fallback in tools/tool_search.py derives from this value.+ "defer": [+ "computer_use", "session_search", "image_generate",+ "todo_list", "process_manage", "cronjob_manage",+ # Desktop GUI surface (desktop_ui + project toolsets)+ "drive_preview", "gui_tour", "desktop_preview", "annotate_preview",+ "show_tip", "desktop_project", "close_terminal",+ "apply_layout", "read_terminal", "read_window_below", "focus_pane",+ ],},# Remote connector discovery/lifecycle through the Nous tool gateway.# The flag is the user's off switch; availability additionally requiresdiff --git a/tests/tools/test_tool_search.py b/tests/tools/test_tool_search.pyindex e44da62f149..db8fb9afb4c 100644--- a/tests/tools/test_tool_search.py+++ b/tests/tools/test_tool_search.py@@ -46,6 +46,21 @@ class TestConfigParsing:assert cfg.enabled == "auto"assert cfg.threshold_pct == 5.0+ def test_default_defer_set_is_shared_with_config_registry(self):+ from hermes_cli.config_defaults import DEFAULT_CONFIG+ from tools.tool_search import ToolSearchConfig, _DEFAULT_DEFERRED_TOOLS++ configured = frozenset(DEFAULT_CONFIG["tools"]["tool_search"]["defer"])+ assert configured+ assert _DEFAULT_DEFERRED_TOOLS == configured+ assert ToolSearchConfig.from_raw(None).effective_defer_tools == configured++ def test_explicit_defer_list_and_empty_list_override_default(self):+ from tools.tool_search import ToolSearchConfig++ assert ToolSearchConfig.from_raw({"defer": ["terminal"]}).effective_defer_tools == {"terminal"}+ assert ToolSearchConfig.from_raw({"defer": []}).effective_defer_tools == set()+def test_bool_true_maps_to_auto(self):from tools.tool_search import ToolSearchConfigcfg = ToolSearchConfig.from_raw(True)diff --git a/tools/tool_search.py b/tools/tool_search.pyindex c51a1eb61a0..4320770c37d 100644--- a/tools/tool_search.py+++ b/tools/tool_search.py@@ -16,6 +16,7 @@ from collections import Counterfrom dataclasses import dataclassfrom typing import Any, Dict, Iterable, List, Optional, Tuple+from hermes_cli.config_defaults import DEFAULT_CONFIGfrom tools.registry import tool_errorfrom tools.tool_search_catalog import (BRIDGE_TOOL_NAMES, CHARS_PER_TOKEN, TOOL_CALL_NAME, TOOL_DESCRIBE_NAME, TOOL_SEARCH_NAME,@@ -127,17 +128,12 @@ def _core_tool_names() -> frozenset[str]:# their schema; once enabled they stay direct unless the deferral list names them._DIRECT_SURFACE_TOOLSETS = frozenset({"desktop_ui", "project"})-# Event-triggered core tools deferred BY DEFAULT (a catalog stub suffices); the ``defer``-# config replaces this wholesale ([] = everything eager). POST-rename names. ``clarify``-# is deliberately absent: A/B showed deferring it collapsed structured-clarify usage-# (18/18 -> 7/18) — the ask-the-user affordance must be ambient, a stub is not enough.-_DEFAULT_DEFERRED_TOOLS = frozenset({- "computer_use", "session_search", "image_generate",- "todo_list", "process_manage", "cronjob_manage",- # Desktop GUI surface (desktop_ui + project toolsets)- "drive_preview", "gui_tour", "desktop_preview", "annotate_preview",- "show_tip", "desktop_project", "close_terminal",- "apply_layout", "read_terminal", "read_window_below", "focus_pane"})+# Event-triggered tools deferred BY DEFAULT (a catalog stub suffices). Keep the curated+# list in DEFAULT_CONFIG so config discovery and runtime behavior cannot drift. An explicit+# ``defer`` list replaces this wholesale ([] = everything eager). ``clarify`` is deliberately+# absent: A/B showed deferring it collapsed structured-clarify usage (18/18 -> 7/18) — the+# ask-the-user affordance must be ambient, a stub is not enough.+_DEFAULT_DEFERRED_TOOLS = frozenset(DEFAULT_CONFIG["tools"]["tool_search"]["defer"])def is_deferrable_tool_name(name: str, defer_tools: Optional[frozenset] = None) -> bool:diff --git a/website/docs/user-guide/features/tool-search.md b/website/docs/user-guide/features/tool-search.mdindex bc73ecd601e..37de8c1ca0b 100644--- a/website/docs/user-guide/features/tool-search.md+++ b/website/docs/user-guide/features/tool-search.md@@ -15,13 +15,16 @@ problem. When activated, MCP and plugin tools are replaced in themodel-visible tools array by three bridge tools, and the model loads eachspecific tool's schema on demand.-:::info Built-in Hermes tools never defer-The tools that make up Hermes' core capability set (`terminal`,-`read_file`, `write_file`, `patch`, `search_files`, `todo`, `memory`,-`browser_*`, `web_search`, `web_extract`, `clarify`, `execute_code`,-`delegate_task`, `session_search`, and the rest of-`_HERMES_CORE_TOOLS`) are *always* loaded directly. Only MCP tools and-non-core plugin tools are eligible for deferral.+:::info Built-in tools and explicit deferral+Hermes keeps its working-set core tools (`terminal`, `read_file`, `write_file`,+`patch`, `search_files`, `todo`, `memory`, `browser_*`, `web_search`,+`web_extract`, `clarify`, `execute_code`, `delegate_task`, and the rest of+`_HERMES_CORE_TOOLS`) loaded directly by default. Cold, event-triggered built-ins+may be deferred when they are named in `tools.tool_search.defer`; the shipped+curated list covers tools such as `computer_use`, `session_search`, and selected+desktop helpers. MCP and non-core plugin tools remain eligible automatically.+An explicit `defer` list replaces the curated list, and `defer: []` keeps every+tool eager.:::## How it works@@ -77,13 +80,14 @@ see the underlying tool, not the bridge.## When does it activate?-Tool Search uses **tiered disclosure**: the presence of *any* deferrable-(MCP/plugin) tool activates the bridge; what scales with catalog size is-how much of the catalog stays visible, not whether schemas defer.+Tool Search uses **tiered disclosure**: the presence of *any* deferred+tool (MCP/plugin or explicitly named built-in) activates the bridge; what+scales with catalog size is how much of the catalog stays visible, not whether+schemas defer.| Tier | Condition | What the model sees || --- | --- | --- |-| **0** | No MCP/plugin tools | Every tool eager, no bridge. Pass-through. |+| **0** | No deferred tools | Every tool eager, no bridge. Pass-through. || **1** | Deferred catalog's listing fits the budget | Bridge + a skills-style manifest of every deferred tool (name + short description, degrading to names-only when over budget). Degradation is **per server**: when one oversized server (Cloudflare) is attached alongside small ones (Linear), the small servers keep their per-tool listings and only the oversized server collapses to a summary line. || **2** | Per-tool listing exceeds the budget even names-only for every server (e.g. Cloudflare's flat API surface alone: ~3,300 tools whose names are ~32K tokens) | Bare bridge + a one-line-per-server summary (server name + tool count), so the model knows which domains are reachable; individual tools are discoverable only through `tool_search`. |@@ -103,16 +107,28 @@ tools:max_search_limit: 25listing: auto # embed a grouped name+description catalog manifestlisting_max_tokens: 4000+ defer: # replace the curated default; [] keeps every tool eager+ - computer_use+ - session_search+ - image_generate+ - todo_list+ - process_manage+ - cronjob_manage```+The default `defer` list also includes the selected desktop GUI helpers listed+in `hermes_cli/config_defaults.py`. It is the single source of truth for the+shipped curated set; the runtime fallback uses the same value.+| Key | Default | Meaning || --- | --- | --- |-| `enabled` | `auto` | `auto`/`on` activate whenever at least one deferrable tool exists; `off` disables entirely (everything stays eager). `auto` is currently an alias of `on` — it is reserved for a future mode that inlines schemas when they fit the context and defers only when they don't. Pin `on` or `off` if you want today's behavior guaranteed across upgrades. |+| `enabled` | `auto` | `auto`/`on` activate whenever at least one deferred tool exists; `off` disables entirely (everything stays eager). `auto` is currently an alias of `on` — it is reserved for a future mode that inlines schemas when they fit the context and defers only when they don't. Pin `on` or `off` if you want today's behavior guaranteed across upgrades. || `threshold_pct` | `5` | Listing budget as a percentage of the active model's context length. Range 0–100. || `search_default_limit` | `5` | Hits returned per query when the model calls `tool_search` without a `limit`. || `max_search_limit` | `25` | Hard upper bound the model can request via `limit` (per query). Range 1–50. || `listing` | `auto` | Embed a skills-style manifest of every deferred tool (name + first sentence of its description, ≤60 chars, grouped by MCP server) in the `tool_search` bridge description. `auto` includes it when it fits the budget (falling back to names-only, then to the tier-2 server summary); `on`/`off` force either way. || `listing_max_tokens` | `4000` | Absolute cap on the embedded listing, regardless of context size. Range 200–60000. Large catalogs degrade to names-only or per-server summaries, keeping full schemas available through search. |+| `defer` | Curated list | Tool names replaced by the bridge by default. The list may include cold built-in tools as well as MCP/plugin tools; an explicit list replaces it, and `[]` disables deferral for every tool. |Per-call array caps are internal safety bounds, not configuration. Over-capcalls return an error so the model can retry with a smaller batch.