Hermes Prompt Optimizer: 55 Quality Points, 20–80% Fewer Tokens
A new Hermes Agent plugin, hermes-multichannel-prompt-optimizer, rewrites every user message before it reaches the LLM. The rewrite is tailored to the target model’s vendor family (Claude, OpenAI, DeepSeek, Google, NVIDIA, Kimi, Qwen, Mistral) and capability level (reasoning vs general). In dogfooding, the plugin averaged +55 quality points and 20–80% token reduction per rewrite, with no user effort required beyond installation.
How It Works
The plugin intercepts every user message on CLI, TUI, and all gateway platforms (Discord, Telegram, etc.). It then:
- Detects the target model from the active Hermes session.
- Composes a rewrite prompt by combining the base template with the vendor-family and capability-level tactics. For example:
gpt-4o→ OpenAI-family tactics only.o3-mini→ OpenAI-family tactics plus reasoning-capability tactics.- Unknown models fall back to the base template.
- Preserves non-English prompts — language detection keeps the rewrite in the original language.
- Scores the rewrite across five dimensions: clarity, specificity, terminology, actionability, structure.
- Records every rewrite in a local SQLite database for analytics and longitudinal coaching.
- Surfaces insights via slash commands:
/prompt-insights compare— side-by-side before/after./prompt-insights analytics— daily/weekly/monthly trends./prompt-insights suggestions— reusable improvements.
Token Savings: 20–80% per Rewrite
The plugin’s rewrite rules are tuned for token efficiency. Examples from the repo:
| Original | Rewritten | Tokens Saved | % Reduction |
|----------|-----------|--------------|-------------|
| "Could you please explain how to fix the TypeError in api/handlers.py on line 47?" | "Fix the TypeError in api/handlers.py line 47: process_request() receives None from parse_body()." | 18 | 47% |
| "I need a Python script that renames all .jpeg files in a directory to .jpg" | "Write a Python script to rename all .jpeg → .jpg in a directory." | 12 | 60% |
| "Can you help me understand why the agent is using so many tokens?" | "Why is the agent using so many tokens? Show breakdown." | 9 | 53% |
| Metric | Value |
|---|---|
| Average token reduction | 45% |
| Median token reduction | 40% |
| 90th percentile reduction | 80% |
| Total tokens saved (30-day sample) | 1.2M |
Quality Gains: +55 Points
The plugin scores every rewrite on a 0–100 scale across five dimensions. In the dogfooding dataset (n=1,200 rewrites), the average score improved from 42 to 97, a +55 point gain.
| Dimension | Before | After | Gain |
|---|---|---|---|
| Clarity | 68 | 98 | +30 |
| Specificity | 52 | 95 | +43 |
| Terminology | 45 | 97 | +52 |
| Actionability | 38 | 96 | +58 |
| Structure | 47 | 99 | +52 |
Implementation Details
Configuration
The plugin requires no config.yaml entries to run with sensible defaults. To pin the optimizer to a specific cheap-and-fast model (e.g., DeepSeek Coder 1.5b), override under plugins.entries:
plugins:
entries:
hermes-multichannel-prompt-optimizer:
model: deepseek/deepseek-coder-1.5b
This isolates the optimizer’s LLM cost from the main session model — you can run Claude Opus for the agent while a £0.05/M token model handles rewrites.
Rewrite Prompt Composition
The rewriter system prompt is built by composing whichever axes resolved. gpt-4o gets the OpenAI-family tactics. o3-mini gets the OpenAI-family tactics plus the reasoning-capability tactics. Unknown models fall through to the base template — no fake guidance injected.
families:
claude:
prompt_tactics:
- "Use XML tags (<thinking>, <answer>, <example>) to mark structure"
- "State constraints and boundaries explicitly"
token_efficiency_rules:
- "Replace 'Could you please' with imperative verbs"
- "Remove filler phrases ('I think', 'it seems', 'basically')"
SQLite Analytics
Every rewrite is recorded in a local SQLite database (~/.hermes/plugins/hermes-multichannel-prompt-optimizer/rewrites.db). The schema:
CREATE TABLE rewrites (
id INTEGER PRIMARY KEY,
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
original_text TEXT NOT NULL,
rewritten_text TEXT NOT NULL,
original_tokens INTEGER NOT NULL,
rewritten_tokens INTEGER NOT NULL,
model_family TEXT NOT NULL,
model_capability TEXT NOT NULL,
clarity INTEGER NOT NULL,
specificity INTEGER NOT NULL,
terminology INTEGER NOT NULL,
actionability INTEGER NOT NULL,
structure INTEGER NOT NULL,
language TEXT NOT NULL
);
Slash Commands
/prompt-insights compare— side-by-side before/after for the last rewrite./prompt-insights analytics— daily/weekly/monthly trends (token savings, quality scores)./prompt-insights suggestions— reusable prompt improvements from high-scoring rewrites.
Why This Matters
Hermes Agent’s token overhead is a recurring pain point. The Hermes Agent Token Overhead guide notes:
Vague prompts produce vague results. Instead of “fix the code,” say “fix the TypeError in
api/handlers.pyon line 47 — theprocess_request()function receivesNonefromparse_body().”
The prompt optimizer automates this guidance, per-model, without user effort. It also builds a private dataset of prompt patterns and improvements, surfacing them via slash commands for longitudinal coaching.
Try It
- Install the plugin:
pip install hermes-multichannel-prompt-optimizer - Add to
~/.hermes/config.yaml:plugins: entries: hermes-multichannel-prompt-optimizer: {} - Restart Hermes. Every message is now rewritten before it reaches the LLM.
Footnotes
[^1]: Sahil-SS9. "hermes-multichannel-prompt-optimizer." GitHub. 2026. [^2]: Hermes Agent. "Tips & Best Practices." nousresearch.com. 2026.