Hermes Warm Compaction
A faster context engine for Hermes Agent.
One DGX server, one model, and 10 synthetic sessions from one task family, each with more than 100,000 tokens. Tokens are the word pieces a model reads. hermes-lcm is another compaction plugin for Hermes. The speed benefit needs the same model and a server with prefix caching.
Sole developer
This open-source plugin (v0.2.0) summarizes long chats in Nous Research's Hermes Agent.
Project dates, tools, and platform
- Released
- October 2026
- Software
- Python, Hermes plugin API
- Runs on
- Unpatched Hermes Agent
Changed requests prevent reuse of the cached chat
Last request
In the server's cache
Built-in summary request
Start differs: all read again
In the cacheRead againBuilt-in prompt
The server keeps the last request in its cache.
The built-in compressor puts a new prompt in front.
The start no longer matches, so the server reads everything.
The changed start makes the server reread the whole chat.
How a changed prefix causes a cache miss
A model server can keep the work it did on a request's prompt. This is a prefix cache. When the next request starts with the same tokens, the server reuses that work and reads only the tokens after the match.
At each compaction, the Hermes built-in compressor sends a separate summary request with its own prompt in front of the chat. That request no longer starts like the cached one, so the server reads the whole chat again. The built-in compressor also cuts long messages before it summarizes them.
Summary instructions follow the cached request
Last request
In the server's cache
Warm request
Only the new part read
New history
Handoff, then the newest rows
In the cacheReadMy instruction and handoff
My plugin appends an instruction to the last request.
A matching start lets the server skip cached rows.
A handoff summary replaces the older rows.
The handoff replaces older rows; recent messages stay unchanged.
Request reuse and the handoff format
At each compaction, the plugin sends the last main-model request of the session again. It adds the rows that came after that request and one handoff instruction at the end. The server can reuse the cached prefix of the earlier request, so it reads only the new rows. In the DGX benchmark, at least 99.9% of each request came from the cache.
The reply is a Markdown handoff with five headings: Goal, User instructions, Current state, Key facts, and Next step. The plugin replaces the older rows with it. A tail of recent rows stays word for word: by default 2.5% of the context window, from 10,000 to 25,000 tokens.
The speedup needs the same model and a server with a prefix cache. The plugin works for manual /compress and for automatic compaction, which starts at half of the context window by default.
Recent messages stay intact through fallback paths
Changes to Hermes
–
Nonedocumented plugin APIs only
- No patch to Hermes code
- No wrapper around it
A missing plugin API
–
Built-incompressor stays in use
- Each API checked at load
- A warning in the log
A failed warm request
–
Fallbacka second way to summarize
- Fallback summary
- Then a fixed summary, no model
Newest messages
–
Exactkept word for word
- Older rows go into the handoff
- 10,000 to 25,000 tokens kept
Message text in the log
–
Noneone line per compaction
- No request bodies or keys
- Which path ran: warm, fallback, or fixed
Documented plugin interfaces keep Hermes unpatched.
A missing interface leaves the built-in compressor in use.
If the warm request fails, a fallback summary runs.
The newest messages stay word for word.
The log never holds message text, request bodies, or keys.
Fallbacks preserve compaction; recent messages stay exact and logs private.
API checks, fallback paths, and private logs
Use documented application programming interfaces (APIs). The plugin registers through the Hermes plugin API. It doesn't patch Hermes code, subclass the built-in compressor, or wrap Hermes code at runtime. It needs Hermes 45871e10, from October 2, 2026, or a later version.
Load safely. At load, the plugin checks each API it uses. If one is missing, it registers nothing, writes a warning to the log, and Hermes keeps its built-in compressor.
Fall back in steps. If the warm request can't run or its reply fails a check, a fallback summary runs through the Hermes auxiliary model route. If that also fails, the plugin writes a fixed-format summary without a model. When Hermes cancels a compaction, the history stays unchanged.
Keep the newest messages. A tail of recent rows stays word for word. By default it's 2.5% of the context window, from 10,000 to 25,000 tokens.
Keep the log private. Each compaction writes one log line that names its path: warm, fallback, or fixed. The log never holds message text, request bodies, or keys. To notice a key change, the plugin keeps a salted PBKDF2-HMAC-SHA-256 digest of the key, never the key itself.
To go back, set the context engine to compressor and start a new session. An integration check runs real Hermes code against a local test server.
The plugin finished first in 10 benchmark sessions
Compaction and the next reply, median on DGX
My plugin finished first in all 10 benchmark sessions.
Facts kept after compaction
- 59/60facts correct, against 50/60 for the built-in compressor and 43/60 for hermes-lcm
- 10/10facts from the middle of a long message, against 0/10 for both
The other two cut long messages before they summarize them.
Compaction on a second server, median
LM Studio with a 4B model. The warm request ran in 9 of 10 chats, and the fallback in the other.
My plugin finished first in all 10 benchmark sessions.
It kept 59 of 60 facts, including mid-message ones.
On a second server, it compacted about twice as fast.
This benchmark measured compaction speed and retained facts.
Benchmark methods, scores, and limits
All runs used synthetic chats of 100,000 or more prompt tokens on unpatched Hermes 45871e10, one session at a time. DGX is an OpenAI-compatible server on an NVIDIA DGX that reports cached tokens. LM Studio ran a Qwen3.5 4B model and reports no cached-token count.
| Measure | My plugin | hermes-lcm | Built-in |
|---|---|---|---|
| Compaction, median | 16.8 s | 43.5 s | 78.5 s |
| Compaction and next reply, median | 27.9 s | 66.1 s | 97.1 s |
| Compacted facts correct | 59/60 | 43/60 | 50/60 |
| Fact in the middle of a long message | 10/10 | 0/10 | 0/10 |
| Standing rule kept in the next reply | 10/10 | 5/10 | 6/10 |
| Fact in the recent rows | 10/10 | 10/10 | 10/10 |
| Next action and its target | 9/10 | 9/10 | 10/10 |
Second benchmark: my plugin / built-in compressor. Median seconds from 10 chats for each engine and mode.
DGX · manual
- Warm request ran
- 10/10 chats
- Compaction
- 10.2 / 32.7 s
- Including the next reply
- 12.5 / 36.9 s
DGX · automatic
- Warm request ran
- 10/10 chats
- Compaction
- 10.1 / 39.9 s
- Including the next reply
- 11.5 / 42.9 s
LM Studio 4B · manual
- Warm request ran
- 9/10 chats
- Compaction
- 20.9 / 34.4 s
- Including the next reply
- 25.2 / 64.5 s
LM Studio 4B · automatic
- Warm request ran
- 9/10 chats
- Compaction
- 21.1 / 41.8 s
- Including the next reply
- 25.7 / 54.9 s
The two benchmarks were separate runs, so their DGX times differ. The results come from one synthetic task family, one session shape, and one model per engine. Cache reuse depends on the server. The three-way benchmark was recorded on October 5, 2026.