INDEX 10 / 14
Living inside Hermes
A tool call's output becomes part of the model's context, and the model reads and pays for every line of it.
Aphrodite connects to Hermes Agent as a native plugin, not as a proxy you point a client at.
It is the reason the interception lives inside the turn: tool output never hits a wire, so only hook-level registration can catch it before it becomes message history - six hooks, thirteen tools, and an optional context engine, every call forwarded into the Rust dylib.
Two proxy processes still run alongside as subprocesses, and a canonical runtime home under ~/.hermes/aphrodite/ holds the binaries, config, CCR database, directives, and logs.
01 // THE BASELINE // HERMES ALONE
What a raw turn costs
HERMES ALONE - nothing stands between a tool and the model.
That is the baseline cost the other two configurations exist to remove.
Every file read, build log, and JSON blob enters the message history raw, because nothing intercepts it - the agent spends its token budget reading noise instead of reasoning.
02 // THE SURFACE // CAPABILITY BY LANE
The integration surface, capability by capability
01 // HOOKS
Around every turn: pre_tool_call → transforms → pre_llm_call → post_llm_call.
02 // TOOLS
In agent namespace - through the proxy the agent doesn't know about them.
03 // PROXIES
Two proxy processes still run alongside as subprocesses.
04 // ENGINE
Optional third integration point: APHRODITE_CONTEXT_ENGINE=1 turns it on.
- on_session_starttransform_tool_resultpre_llm_calltransform_terminal_outputpost_llm_callpre_tool_call
- aphrodite_retrieveaphrodite_compressaphrodite_statsaphrodite_rebuildaphrodite_filesaphrodite_diffaphrodite_searchaphrodite_directiveaphrodite_testaphrodite_catalogaphrodite_reclassifyaphrodite_prefetchaphrodite_prefetch_status
| CAPABILITY | NATIVE HERMES PLUGIN | GENERIC PROXY |
|---|---|---|
| Tool output compression | transform_tool_result intercepts | proxy only sees HTTP traffic |
| Terminal compression | transform_terminal_output | no visibility |
| Context engine | opt-in; catalog injected via pre_llm_call | unavailable |
| Auto-launch | proxies spawn at plugin load | manual aphrodite command |
| aphrodite_* tools | 13 tools in agent namespace | agent doesn't know about them |
| Prompt injection | directives, nudges, catalog | unavailable |
| CCR storage | token + cache proxy | token + cache proxy |
03 // TWO LANES // THE PLUGIN AND THE PROXY
The lane inside Hermes, and the lane beside it
HERMES + APHRODITE - the plugin lane intercepts output before it becomes message history.
The hooks classify, store, and replace raw output with a type-aware marker of ~15 tokens instead of hundreds, the agent retrieves the full content only when it actually needs it, and the injection assembler adds directives, nudges, and the recall catalog to every turn under a hard byte budget.
HERMES + APHRODITE + THE PROXY - the plugin already spawns both listeners, so the third configuration is running without extra setup: point base_url at :9798 and any OpenAI-compatible client gets the same CCR compression over plain HTTP.
That is the agent-to-agent path - a second agent, a script, or an external tool can converse through the same compressed channel, share the persistent SQLite store (which survives a restart; the plugin lane's inline store is session-scoped), and call the tool relay to retrieve or create CCR entries.
THE LIMIT IS REAL TOO: the proxy only sees HTTP traffic.
- no tool-output interception
- no terminal compression
- no directives
- no context engine
- and SSE streams pass through uncompressed.
Because of that the proxy extends the stack to other callers; it does not replace the hooks inside Hermes.
04 // THE RESULT // SAVED AND PAID FOR
What it saved, and what it costs
22.9%
~22,921
200
05 // LIFECYCLE // SESSION TO SESSION
What happens when you launch Hermes
RESTART THE SESSION TO PICK UP A NEW BUILD.
06 // EVIDENCE // WHAT THE AGENT SEES
The twelve preview shapes
Each line is the format string its own arm prints, character for character: the tallies come first, then whatever the arm could add about them. The extension counts in an ls line are joined with × rather than a letter x, a JSON item count is set tight against the word it counts (5items), a code map joins its structure parts with a pipe, and a search line reports hits, distinct files and the first match location. The numbers are representative; the shapes are the code's, which is what makes them checkable against preview/builders/*.rs rather than taken on trust.
SANITIZED, GENERALIZED SHAPES - REPRESENTATIVE PREVIEW FORMS FROM THE PUBLIC DOCS, NOT SESSION CONTENT.
THE AGENT RETRIEVES FULL OUTPUT WITH aphrodite_retrieve(hash) ONLY WHEN IT ACTUALLY NEEDS IT.
07 // OPT-IN // CONTEXT ENGINE
The optional third integration point
Enable with APHRODITE_CONTEXT_ENGINE=1 .
The engine is the session's middle-turn archiver: when the conversation index fills past engine_threshold_pct , it packs the middle turns (keeping engine_protect_first at the start and engine_protect_last at the end, once engine_min_msgs turns exist) into one compact CCR entry and replaces them with a single marker, so the model sees a short head + marker + tail history.
The archive is in-place but recoverable via aphrodite_retrieve.
- engine_threshold_pct
- 30
- # archive middle turns at % context fill
- engine_protect_first
- 2
- # messages kept at the start
- engine_protect_last
- 5
- # messages kept at the end
- engine_min_msgs
- 8
- # minimum messages before activating
SRC: README.md:91-99, 219-299, 467-482; docs/guides/hermes-integration.md:115-141; docs/proxy/architecture.md:12-31; docs/tool-relay/callbacks.md:89-92.
SRC: README.md:298-299; docs/guides/hermes-integration.md:107-108.