⚡ IN-PROCESS HERMES PLUGIN · 0 RUNTIME DEPS · PRODUCTION VERIFIED

Deterministic Context Dedup
with ToolRecall (Hermes Plugin).

27.8% of tool outputs in Hermes sessions are byte-identical repeats (and 60.1% of outputs ≥ 2 KB). ToolRecall (Hermes Plugin) fingerprints outputs in-process and swaps duplicates for 2-line stubs with sub-millisecond recall_result restoration — capturing 95.35% deduplication efficiency with zero background daemons.

💡
Running ToolRecall (Full Stack)? Hermes is supported natively out of the box by the unified daemon (ToolRecall Full Stack) via forward proxy & runtime socket — no plugin needed. This in-process plugin is strictly optional, intended only if you want Hermes standalone dedup without running the full background daemon.

Install one, not both. With both active, the same tool result is stubbed twice: core sends full content, the plugin replaces it with its own stub, and core's mcp_dedup counters then credit a full send the model never received. Detection is built in — core reports an enabled Light plugin in toolrecall healthcheck, and Light reports core at load time and in status(). To keep the full stack: hermes plugins disable toolrecall-light. To keep this plugin: stop core and remove its proxy/MCP wiring.
⚡ Quick Start · 2-Step Setup 0 Deps · No Daemon Required
Step 1 · Install Plugin from GitHub Registers v2 hooks
hermes plugins install https://github.com/whiskybeer/toolrecall-light
Step 2 · Verify Active Hook & Run Walkthrough Streak = 5 active
hermes plugins list && python3 ~/.hermes/plugins/toolrecall-light/demo.py
668
Real Agent Sessions
Audited: 100% Production DB
Parsed from production state.db logs.
131,520
Real Tool Outputs
Unique: 72.2% Repeats: 27.8%
Multi-turn bash runs, greps, and file reads.
60.1%
Large Output Dupes (≥2KB)
74.5 MB Saved ~18.6M Toks
36,548 byte-identical repeat tool results.
95.35%
Capture Efficiency
Stubbed: 95.4% Refreshed: 4.6%
Streak = 5 cap eliminates 34,848 re-reads.
Narrated Technical Walkthrough (English Voiceover) & Visual Impact

Watch ToolRecall (Hermes Plugin) Intercept Duplicates in Real Time

Step-by-step walkthrough with English narration showing initial SHA-256 fingerprinting, compact duplicate stub interception, sub-millisecond recall_result restoration, and post_compaction safety guards.

30s Quick Overview · Prompt Tokens & Install
Measured Cross-Turn Billed Ledger
Live Provider Ledger
Hermes core dedups inside a turn, but agent/turn_context.py explicitly calls reset_for_turn() at every turn boundary. Repeated 40 KB results on later turns are re-sent in full. toolrecall-light bridges the gap across the session.
Arm (4 Turns, 40 KB) Turn 1 Turn 4 Prompt Tokens Cost
Vanilla Hermes (s1) 54.8k 428.4k 897,904 $0.00308
+ toolrecall-light (s1) 33.9k 282.7k (−34.0%) 631,951 $0.00236
Vanilla Hermes (s2) 55.7k 423.8k 881,377 $0.00367
+ toolrecall-light (s2) 45.2k 294.0k (−30.6%) 677,073 $0.00233
−23.2% to −29.6%
Total Prompt Tokens
−23.1% to −36.3%
Provider Billed Cost
−30.6% to −34.0%
Final Turn Compaction Relief
0.28 ms
recall_result() Latency
📌 Intra-Turn Note: Hermes core already handles consecutive calls within a single turn. The plugin specifically protects against repeats across turns (long sessions, test loops, builds).
❌ Standard Hermes Execution Turn-Boundary Reset

Per-Turn State Wiped at Boundary

Hermes core dedups tool results within a single turn (via agent/tool_guardrails.py), but agent/turn_context.py explicitly calls reset_for_turn() on every turn. A 40 KB test traceback or compiler output seen on Turn 1 is re-sent in full on Turns 2, 3, and 4.

💥 Result: Cross-turn bloat. 40 KB outputs compound across turns (428k+ prompt tokens by Turn 4), triggering premature context compaction.
✅ Hermes + toolrecall-light Session-Scoped Ground

1-Line Stub Across Turns + On-Demand Recall

toolrecall-light persists (tool, args) content signatures across turns. When a large output repeats in Turn 2, 3, or 4, it emits a 174-byte stub and exposes recall_result(result_id) to restore full content on demand.

⚡ Result: −23% to −30% prompt tokens and −23% to −36% cost across turns, with final-turn context 31% to 34% leaner (measured live provider ledger).
Three Core Mechanisms

Deterministic Interception Pipeline

Pure Python stdlib inside the Hermes runtime. Zero background daemons required.

1. Cryptographic Fingerprinting

Hashes canonical tool arguments and full output bytes via SHA-256. Any 1-byte change in output bypasses stubbing and passes through live.

2. Circuit-Breaker (Streak = 5)

Stubs unchanged outputs up to 5 consecutive times, then forces a full pass-through on the 6th access to prevent stuck agent evaluation loops.

3. Compaction Generation Reset

Listens to the Hermes post_compaction hook when /compress runs, automatically re-serving full content once in the new generation.

Empirical Evidence

Measured Receipts from 131,520 Real Tool Calls

Snapshot of 668 sessions; re-computed 2026-11 over 659 sessions gives 28,866 candidates ≥2 KB, 16,859 exact duplicates, 74.6 MB — i.e. 58.4% (was 60.1%). These are duplicate-payload measurements, not token-savings percentages.

Computed across 668 production Hermes sessions recorded in real developer state.db logs.

Production Corpus Breakdown 668 Sessions
Unique: 94,972 (72.2%) Repeats: 36,548 (27.8%)
72.2% Unique
27.8% Dupes
74.5 MB
Duplicate tool bytes (~18.6M tokens)
2 MB Cap
20× safety margin over max 97.1 KB
Duplicate Payload Size Distribution 100% Fit Under 97.1 KB
p50 (Median Output) 3.3 KB (~850 tok)
p90 (Test Suites & Tracebacks) 18.2 KB (~4,650 tok)
p99 (Lockfiles & Broad Greps) 42.7 KB (~10,900 tok)
Max Observed Candidate 97.1 KB (~24,800 tok)
Metric Observed Empirical Value Operational Significance
Sessions Analyzed 668 Sessions Real software engineering sessions covering bug fixing, refactoring, and test suites.
Total Tool Calls 131,520 Calls Total volume of tool invocations across all session transcripts.
Duplicate Rate (≥ 2,000 chars) 60.1% (74.5 MB) Over 60% of large tool outputs are exact intra-session duplicates (~18.6M redundant tokens).
Cross-Turn Repeats (measured, live ledger) −23.2% to −29.6% Prompt Tokens 4-turn live session, 40 KB repeat once per turn: 631,951 vs 897,904 tokens (−29.6%) and 677,073 vs 881,377 tokens (−23.2%). Billed cost down −23.1% to −36.3%. Final turn prompt tokens down −30.6% / −34.0%.
Intra-Turn Duplicates (core comparison) 0% / Core Alone is Cheaper Hermes core already deduplicates within a single turn (512-char floor). Light plugin does not claim intra-turn gains; its value is solely across turn boundaries where core calls reset_for_turn().
The Optimization Math

Why Default Streak Cap Was Set to 5

Analyzing all 36,548 duplicate calls shows that Streak = 5 hits the 95.35% capture elbow while still protecting against stuck evaluation loops.

Deduplication Capture Rate by Consecutive Stub Cap (N = 36,548 Duplicates) +15.65% Capture vs Streak=2
Streak = 1
58.2% (21,270)
Streak = 2 (Old)
79.7% (29,128)
Streak = 3
89.1% (32,564)
★ Streak = 5
95.35% (34,848)
Hermes Agent Message History — Exact Before & After
# [WITHOUT TOOLRECALL PLUGIN] Turn 04: Agent reruns terminal("pytest tests/test_auth.py") 2,317 bytes (~579 tokens) re-injected into LLM context on every repeat: ============================= test session starts ============================== tests/test_auth.py .....................F............................... [ 62%] E AssertionError: assert 401 == 200 (ExpiredSignatureError: Signature expired) ... [60 lines of identical traceback repeated across turns] ... # [WITH TOOLRECALL PLUGIN] Turn 04: Same command, identical SHA-256 output digest 174 bytes (~43 tokens) billed to prompt context (-92.5% single-turn reduction): [toolrecall-light] identical to the earlier terminal result 50f59afa067a (2317 bytes) in this session. Call recall_result(result_id="50f59afa067a") if you need the full content.
ROI & Savings Calculator

Calculate Your Hermes Token & Dollar Savings

Adjust your agent session parameters to see how much context capacity and API budget toolrecall-light preserves.

Typical autonomous coding issue: 20–50 turns
Test runs, greps, MCP calls per step
Cumulative Context Preserved
54,288
Prompt tokens stripped before hitting the LLM context window.
Billed Dollars Saved / 100 Sessions
$16.29
Pure cumulative API token savings at selected model rate.
Realistic Accounting Note: Measured on live sessions via provider billing ledgers (--usage-file), cross-turn deduplication yields −23% to −36% cost savings and −23% to −30% prompt token reduction across 4-turn sessions, while the final-turn context window remains 31% to 34% leaner—preventing premature compaction on deep debugging tasks. Intra-turn duplicates are handled directly by Hermes core.
Configuration & Security

Zero Config by Default, Fully Overridable

Out of the box, toolrecall-light uses the 5-streak cap, 2 MB payload bound, and parameterized SQLite WAL storage. See SECURITY.md ↗ for the full threat model.

Environment Variable Default Options Description
HERMES_TOOLRECALL_LIGHT 1 1 (on), 0 (off) Master kill-switch for instant runtime bypass.
HERMES_TOOLRECALL_LIGHT_MIN_CHARS 2000 Integer chars Minimum tool output length before deduplication is evaluated.
HERMES_TOOLRECALL_LIGHT_MAX_CHARS 2000000 (2 MB) 0 (unlimited), chars Hard upper bound protecting against OOM output bombs.
HERMES_TOOLRECALL_LIGHT_MAX_STUB_STREAK 5 Integer ≥ 1 Consecutive stubs before forcing full pass-through once.
Quickstart & Verification

Get Started in 3 Structured Steps

Compatible with Nous Hermes v2+ and all model providers (Claude, GPT, Gemini, DeepSeek, GLM, Local LLMs). Zero runtime dependencies or background daemons required.

Step 01 · Install ~5 seconds

Install Plugin from GitHub

Installs directly into ~/.hermes/plugins/toolrecall-light and registers the v2 hooks automatically.

hermes plugins install https://github.com/whiskybeer/toolrecall-light
Step 02 · Verify Zero Config

Confirm Active Registration

Confirm transform_tool_result, post_compaction, and recall_result are active in your Hermes CLI.

hermes plugins list
✓ toolrecall-light [v0.1.1] (streak: 5, max: 2MB)
Step 03 · Test & Run Self-Test

Run Local Walkthrough

Executes a self-contained simulation showing SHA-256 fingerprinting, stub injection, and recall_result recovery.

python3 ~/.hermes/plugins/toolrecall-light/demo.py
Alternative: Manual Git Clone Installation →
$ git clone https://github.com/whiskybeer/toolrecall-light.git ~/.hermes/plugins/toolrecall-light
$ hermes plugins enable toolrecall-light
Running ToolRecall (Full Stack)? ToolRecall (Full Stack) already supports Nous Hermes natively out of the box via proxy and runtime sockets, alongside Claude Code, Antigravity, and Cline. You do not need to install this plugin if you run the full stack daemon. This plugin is purely an optional, lightweight in-process option for users running Hermes standalone without a background daemon.
Explore ToolRecall (Full Stack) →