gitmyhub

hermes-tool-router

Python ★ 24 updated 22d ago

Conditional tool-schema loading for Hermes Agent to reduce first-turn token bloat by loading only the tools a prompt actually needs, with safe full-surface fallback for long or ambiguous requests.

A Python plugin for the Hermes AI agent that predicts which tools a conversation needs and loads only those groups instead of all definitions, so less token space is wasted before each message.

Pythonsetup: moderatecomplexity 3/5

This project is an add-on for the Hermes AI agent that reduces how many token-consuming tool descriptions are loaded at the start of each conversation. AI agents typically attach the full list of available tool definitions to every request, which occupies token space before the user's message even begins. This router intercepts each request and predicts which tools are actually needed, then tells Hermes to load only those groups rather than everything.

The router runs a small classifier model (either a hosted auxiliary model or a locally running model you configure) that reads the incoming message and predicts which groups of tools are relevant, such as "file", "terminal", or "web". If the classifier is confident enough, Hermes loads only those groups for the first turn. If the classifier is uncertain, if the message is longer than a configurable character threshold (600 by default), or if the prediction is empty, the router falls back to loading all available tools.

There is a recovery mechanism for wrong predictions. If the model tries to call a tool that was not loaded, Hermes detects the missing tool name and adds that tool group on the fly before retrying. A bad prediction therefore costs one extra API call rather than a failed response.

The project ships as a portable plugin that lives outside the main Hermes checkout, along with reference files and scripts for measuring token savings on your own setup. Because savings depend on your Hermes version, enabled tools, and AI provider, the README explicitly tells users to run the included smoke test locally rather than trust numbers from someone else's environment.

There is no automated install script yet. Manual setup involves copying a plugin folder and some reference files into the Hermes directory, then restarting the agent. The project is Python-based, written in English, and has 17 stars on GitHub. The README notes that the folder is not yet published as a package and does not install itself.

Where it fits