ctxprune for Hermes (0.4.1, safe-only build)
Lossless rewrite of tool results before they reach the model: runs of identical lines counted, JSON record lists with nested values written as rows on hosted models (each structural rule kept only if it decodes back to the exact original), read_file/terminal JSON wrappers unescaped with every other key kept. patch/edit/memory/todo results are never touched. For claude-opus-* models (or with CTXPRUNE_DEDUP=1): before each LLM call (llm_request middleware) a tool result repeating an earlier one in the same request becomes a reference to it. Stdlib Python, no model, no network.
Generated by ctxprune bundle hermes from ctxprune 0.4.1; don't edit.
The stdlib runtime is vendored in _rt/ (byte copies of the repository's scripts/), so it needs no pip install.
What it does on your machine
- No network calls, no shell commands, no child processes, no credentials, no telemetry.
- Hooks:
transform_terminal_output,transform_tool_result. Middleware:llm_request(cross-turn dedup, see above). - Writes a small state store under
~/.cache/ctxprune(or$CTXPRUNE_STATE) in a 0700 directory: first-render
pins, so a result that was already sent keeps its bytes and the provider's prompt cache stays valid, and a
registry of its own outputs. Nothing else is read or written outside this directory. - Fails open: on any error, or past the per-call time budget (
CTXPRUNE_BUDGET, default 2 s), Hermes gets the
original output, at most with forged[cp:marker lines escaped. CTXPRUNE_OFF=1turns it off.hermes plugins disable ctxpruneremoves it from the pipeline.
What is byte-exact and what isn't, and the measured savings:
README, docs/SAFETY.md.
README from the reviewed commit 10eaef2; it updates when the author re-pins.

riceharvest