From 928bd7929946211db0f26a96121662eca81cc6e4 Mon Sep 17 00:00:00 2001 From: zeus Date: Tue, 21 Jul 2026 00:15:17 +0100 Subject: [PATCH] Add schema-trim Hermes plugin Demotes heavy/situational tools from _HERMES_CORE_TOOLS at startup so tool_search (enabled: on) can defer them to the catalog. Reduces first-message tool schema footprint without touching upstream hermes-agent files. Co-Authored-By: Claude Sonnet 4.6 --- __init__.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 __init__.py diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..900653e --- /dev/null +++ b/__init__.py @@ -0,0 +1,40 @@ +"""schema-trim: demote heavy-schema tools from core so tool_search can defer them. + +Removes cronjob and delegate_task from _HERMES_CORE_TOOLS at plugin load time. +tool_search (enabled: on) then puts them in the catalog — name + one-line +description on first message, full schema only when the model needs to call them. + +Handler, check_fn, and all other registration metadata are untouched. +Safe across hermes updates. +""" + +# Tools to demote from "always in schema" to "deferrable via tool_search". +# Only list tools whose full schemas are genuinely expensive and not needed +# on most turns. Keep terminal, file, web, memory, browser in core. +_DEMOTE = ( + # Scheduling / delegation — large schemas, situational + "cronjob", "delegate_task", + # Session history — used reactively, not turn 1 + "session_search", + # Browser automation — most sessions never touch the browser + "browser_navigate", "browser_snapshot", "browser_click", "browser_type", + "browser_scroll", "browser_back", "browser_press", "browser_get_images", + "browser_vision", "browser_console", "browser_cdp", "browser_dialog", + # Skills management — discovery (skills_list) stays core + "skill_manage", "skill_view", + # Niche / media tools + "image_generate", "text_to_speech", "vision_analyze", +) + + +def register(ctx): + try: + from toolsets import _HERMES_CORE_TOOLS + for name in _DEMOTE: + if name in _HERMES_CORE_TOOLS: + _HERMES_CORE_TOOLS.remove(name) + except Exception as exc: + import logging + logging.getLogger(__name__).warning( + "schema-trim: failed to demote core tools: %s", exc + )