Skip to content

Hermes Agent context engine: the main model writes the compaction handoff on its cached prompt prefix

Merge main into warm notice repair and refresh integration evidence

Elevatormusic844bbe71d7a9
diff --cc CHANGELOG.md
index 44c6974,eb63daf..4bcaf7f
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -4,11 -4,10 +4,15 @@@ All notable changes are listed here. Th
## [Unreleased]
+### Added
+
+- A WARNING for each compaction that does not use the warm path, with its reason (Hermes copies it to `errors.log`).
+- After 3 compactions in a row without the warm path, one notice with a hint for each distinct reason, in the logs and in the status of the next automatic compaction. Later failures update the pending notice and its fixed-summary count until Hermes shows it.
+
+ ### Security
+
+ - Use PBKDF2-HMAC-SHA-256 with a random salt for each plugin load to check API key changes. Captures keep only the digest in memory.
+
## [0.2.0] - 2026-10-06
First public release.
diff --cc README.md
index 502e8ea,dc09428..2640790
--- a/README.md
+++ b/README.md
@@@ -95,6 -95,6 +95,14 @@@ From the server documentation and issu
## Install
++Ask your agent:
++
++```text
++Install this plugin and set it up: https://github.com/Elevatormusic/hermes-warm-compaction
++```
++
++To install it yourself, run this command in a terminal on the computer where Hermes runs, then [select the engine](#select-the-engine):
++
```bash
hermes plugins install Elevatormusic/hermes-warm-compaction#warm_compaction --enable
```
@@@ -167,22 -167,6 +175,24 @@@ warm_compaction: path=warm reason=accep
The engine status (`get_status()`) has the same values in `warm_last`. The log never contains message text, request bodies, or keys.
++Manual `/compress` can report `No changes from compression` when all messages fit in the recent-history tail. Then the plugin has no older history to summarize. The request estimate also includes system instructions and tool definitions, which the plugin does not compress. Use `/context` to see the token counts for each part. This unchanged result does not count as a warm-path failure.
++
+### When the warm path keeps failing
+
+When the warm summary cannot be used, the plugin tries the fallback summary. If that summary cannot be used, it uses the fixed summary. The plugin reports these results:
+
+- Each compaction without the warm path also writes a WARNING with its reason, for example `Warm compaction skipped (provider_error); used the fallback summary`. Hermes copies warnings to `logs/errors.log`.
+- After 3 compactions in a row without the warm path, the plugin writes one WARNING with a hint for each distinct reason. Hermes shows one notice with the status of the next automatic compaction, also when the compaction status is turned off. Later failures update the pending notice until Hermes shows it. For example:
+
+ ```text
+ ⚠ Warm compaction unavailable: the last 3 compactions did not use the warm summary (provider_error: the server refused the warm request (a provider error, or a gateway that needs a cookie)). Compaction continues with the fallback summary. Details: the warm_compaction lines in logs/agent.log.
+ ```
+
+- When the fallback summary could not be used, the notice says how many times, and that those compactions used the fixed summary (no model, less detail).
+- A warm summary can fail the handoff checks even when the server reports cached tokens. The notice describes the summary result. It does not prove a cache miss, a speed change, or that all details were kept.
+- A warm compaction or a session reset ends the streak, and the notice can show again after the next 3 failures. A cancelled attempt does not count, and `warm: false` is not a failure.
+- Manual `/compress` has no status line from the engine: after manual compactions only, the notice is in the logs.
+
## Results
All runs used synthetic conversations of 100,000 or more prompt tokens on unpatched Hermes `45871e10`, one session at a time. The records have metadata only. "DGX" is an OpenAI-compatible server on an NVIDIA DGX that reports cached tokens. "LM Studio 4B" is LM Studio with a Qwen3.5 4B model; it reports no cached-token counter.
diff --cc evidence/plugin-integration.json
index 93a3e3c,64c6706..7d367ab
--- a/evidence/plugin-integration.json
+++ b/evidence/plugin-integration.json
@@@ -1,22 -1,22 +1,22 @@@
{
"check": "standalone warm_compaction plugin on unpatched Hermes Agent",
- "started_utc": "2026-10-07T03:03:46Z",
- "started_utc": "2026-10-06T18:52:13Z",
++ "started_utc": "2026-10-07T03:11:26Z",
"hermes": {
"commit": "45871e100feceb89769536c88e5e6e265226a409",
"clean": true
},
"python": "3.11.14",
- "script_sha256": "08a2bedce89ede3a05576013351c1397e00bef0d50a24e28c9b6c0168d86c8ae",
+ "script_sha256": "33947de293d0167c457f2c8b967c57e4c5064a262357de4129376519b6e2f77d",
"plugin_files_sha256": {
- "warm_compaction/__init__.py": "11e038f05813627b2d1d8b82b3b775ecfe41015746c8e90ed6d452cfdaec65a6",
- "warm_compaction/capture.py": "971abfe0751437701c030be8c23a1c33b5380e06db87cb696bc951ea080007cc",
- "warm_compaction/engine.py": "198ea6567059c8e2700c142e3b5f27705aab9a4472b8cbb6d6e0686279b96e5f",
- "warm_compaction/fallback.py": "3561af9eda01601574bc000155e5fb1e56d38c9a52c46c9bc756cb8686fce2f2",
- "warm_compaction/handoff.py": "9afea62ec2f8ef46cbeefd70b1071bb6c7111fa6fd1cd073e1fb2c7eae30f3c2",
- "warm_compaction/layout.py": "41787f75a1044bade37f01f5f1e9f5329726b15145b9c9b2bdd51c14bda45080",
+ "warm_compaction/__init__.py": "760484ace80b9da77d7397828f69178905c9ac95df7b8114956bde727bd98aef",
- "warm_compaction/capture.py": "3158562b9b4d4ab50c0ec7a6524bbc1b1c364b137c6d8d27c5801220959021c8",
++ "warm_compaction/capture.py": "b7ba65676334da63dacc5cebdd2399f46f85e35545be22fccae9443cebcf7ce0",
+ "warm_compaction/engine.py": "74eb8790e7e77f0213eb7bd28256cbd6d602d30f9edc02b5737391b825b1a9f0",
+ "warm_compaction/fallback.py": "dc2b7fbfdee292601e52549d23d9b7224d40da1d8c06f553f3d0b8e10a23534d",
+ "warm_compaction/handoff.py": "fcab51def8fbcc2b1928957930c9a5c58a4ad202c949fd9f870a77f3b30276ae",
+ "warm_compaction/layout.py": "b49314c5236268247c337d9fae939135c97b47384300dcdfd00b0da0c040db93",
"warm_compaction/plugin.yaml": "d67560fd4625ec80d9e26f3e6d712763e77474f68d469c7e48f09fd3506ccc71",
"warm_compaction/rows.py": "f2ca69a7361affc4fd84388ab9ac718a0e9affa609c87d75efd6e0c25fa860cf",
- "warm_compaction/warm.py": "febc739af4757392f63b2c8daa343b2daf32aeab6864b5f33d63d5cb7e8ceb3a"
+ "warm_compaction/warm.py": "95bc01d954d30e37de7a74a2f0ad7e643b50048c7cb37ea9443748160f020fed"
},
"privacy": "metadata only: names, counts, codes, booleans, and times; no message text",
"scenarios": [
@@@ -76,13 -76,13 +76,13 @@@
"threshold_tokens": 100000,
"context_length": 200000
},
- "compress_seconds": 0.132,
- "compress_seconds": 0.101,
++ "compress_seconds": 0.117,
"warm_last": {
"path": "warm",
"reason": "accepted",
- "elapsed_s": 0.038,
- "elapsed_s": 0.024,
- "prompt_tokens": 33892,
- "cached_tokens": 16946
++ "elapsed_s": 0.035,
+ "prompt_tokens": 33855,
+ "cached_tokens": 16927
},
"session_rotated": false,
"final_session_id": "wc-enable_manual_warm",
@@@ -189,7 -189,7 +189,7 @@@
"install",
"run"
],
- "process_seconds": 61.204
- "process_seconds": 53.442
++ "process_seconds": 67.007
},
{
"scenario": "manual_fallback",
@@@ -248,11 -248,11 +248,11 @@@
"threshold_tokens": 100000,
"context_length": 200000
},
- "compress_seconds": 0.296,
- "compress_seconds": 0.238,
++ "compress_seconds": 0.326,
"warm_last": {
"path": "fallback",
"reason": "provider_error",
- "elapsed_s": 0.156,
- "elapsed_s": 0.109,
++ "elapsed_s": 0.157,
"prompt_tokens": null,
"cached_tokens": null
},
@@@ -260,7 -260,7 +260,7 @@@
"final_session_id": "wc-manual_fallback",
"continuation_keeps_custom_system_text": false,
"fence_denied": {
- "child_process_blocked": 6,
- "child_process_blocked": 4,
++ "child_process_blocked": 5,
"network_host_blocked": 1
},
"fence_blocked_programs": [
@@@ -361,7 -361,7 +361,7 @@@
"install",
"run"
],
- "process_seconds": 47.329
- "process_seconds": 33.695
++ "process_seconds": 43.322
},
{
"scenario": "manual_fixed",
@@@ -419,11 -419,11 +419,11 @@@
"threshold_tokens": 100000,
"context_length": 200000
},
- "compress_seconds": 0.257,
- "compress_seconds": 0.28,
++ "compress_seconds": 0.302,
"warm_last": {
"path": "fixed",
"reason": "provider_error",
- "elapsed_s": 0.11,
- "elapsed_s": 0.141,
++ "elapsed_s": 0.156,
"prompt_tokens": null,
"cached_tokens": null
},
@@@ -532,7 -532,7 +532,7 @@@
"install",
"run"
],
- "process_seconds": 40.416
- "process_seconds": 31.52
++ "process_seconds": 38.463
},
{
"scenario": "auto_tool_loop",
@@@ -620,9 -620,9 +620,9 @@@
"warm_last_1": {
"path": "warm",
"reason": "accepted",
- "elapsed_s": 0.016,
+ "elapsed_s": 0.015,
- "prompt_tokens": 35209,
- "cached_tokens": 17604
+ "prompt_tokens": 34449,
+ "cached_tokens": 17224
},
"warm_last_2": {
"path": "warm",
@@@ -735,274 -736,7 +735,274 @@@
"install",
"run"
],
- "process_seconds": 41.996
- "process_seconds": 34.084
++ "process_seconds": 39.776
+ },
+ {
+ "scenario": "auto_warm_failures",
+ "python": "3.11.14",
+ "status": "passed",
+ "checks": {
+ "listed_in_engine_picker": true,
+ "engine_selected": true,
+ "turn1_final": true,
+ "turn2_final": true,
+ "turn3_final": true,
+ "turn4_final": true,
+ "three_fallbacks_then_warm": true,
+ "one_notice": true,
+ "notice_before_the_fourth_compaction": true,
+ "notice_names_the_reason": true,
+ "notice_describes_the_summary_result": true,
+ "notice_has_no_cache_or_retained_detail_claim": true,
+ "each_refusal_in_agent_log": true,
+ "each_refusal_in_errors_log": true,
+ "notice_in_errors_log": true,
+ "plugin_made_no_blocked_call": true
+ },
+ "requests": [
+ {
+ "seq": 0,
+ "kind": "main",
+ "status": 200,
+ "stream": true,
+ "message_count": 62
+ },
+ {
+ "seq": 1,
+ "kind": "warm",
+ "status": 500,
+ "stream": false,
+ "message_count": 65
+ },
+ {
+ "seq": 2,
+ "kind": "fallback",
+ "status": 200,
+ "stream": true,
+ "message_count": 2
+ },
+ {
+ "seq": 3,
+ "kind": "main",
+ "status": 200,
+ "stream": true,
+ "message_count": 24
+ },
+ {
+ "seq": 4,
+ "kind": "main",
+ "status": 200,
+ "stream": true,
+ "message_count": 26
+ },
+ {
+ "seq": 5,
+ "kind": "warm",
+ "status": 500,
+ "stream": false,
+ "message_count": 29
+ },
+ {
+ "seq": 6,
+ "kind": "fallback",
+ "status": 200,
+ "stream": true,
+ "message_count": 2
+ },
+ {
+ "seq": 7,
+ "kind": "main",
+ "status": 200,
+ "stream": true,
+ "message_count": 28
+ },
+ {
+ "seq": 8,
+ "kind": "main",
+ "status": 200,
+ "stream": true,
+ "message_count": 30
+ },
+ {
+ "seq": 9,
+ "kind": "warm",
+ "status": 500,
+ "stream": false,
+ "message_count": 33
+ },
+ {
+ "seq": 10,
+ "kind": "fallback",
+ "status": 200,
+ "stream": true,
+ "message_count": 2
+ },
+ {
+ "seq": 11,
+ "kind": "main",
+ "status": 200,
+ "stream": true,
+ "message_count": 32
+ },
+ {
+ "seq": 12,
+ "kind": "main",
+ "status": 200,
+ "stream": true,
+ "message_count": 34
+ },
+ {
+ "seq": 13,
+ "kind": "warm",
+ "status": 200,
+ "stream": false,
+ "message_count": 37
+ },
+ {
+ "seq": 14,
+ "kind": "main",
+ "status": 200,
+ "stream": true,
+ "message_count": 36
+ }
+ ],
+ "error": null,
+ "engine": {
+ "name": "warm_compaction",
+ "threshold_tokens": 80000,
+ "context_length": 200000
+ },
+ "outcomes": [
+ [
+ "fallback",
+ "provider_error"
+ ],
+ [
+ "fallback",
+ "provider_error"
+ ],
+ [
+ "fallback",
+ "provider_error"
+ ],
+ [
+ "warm",
+ "accepted"
+ ]
+ ],
+ "notices": [
+ "🗜️ Compacting context — summarizing earlier conversation so I can continue...\n⚠ Warm compaction unavailable: the last 3 compactions did not use the warm summary (provider_error: the server refused the warm request (a provider error, or a gateway that needs a cookie)). Compaction continues with the fallback summary. Details: the warm_compaction lines in logs/agent.log."
+ ],
+ "status_count": 13,
+ "log_counts": {
+ "agent_refusals": 3,
+ "errors_refusals": 3,
+ "errors_notice": 1
+ },
+ "fence_denied": {
+ "child_process_blocked": 5,
+ "network_host_blocked": 1
+ },
+ "fence_blocked_programs": [
+ "git",
+ "pip",
+ "python",
+ "python3"
+ ],
+ "fence_blocked_hosts": [
+ "hermes-assets.nousresearch.com"
+ ],
+ "fence_blocked_callers": [
+ "child_process_blocked from hermes_cli/source_check.py:_git_run < hermes_cli/source_check.py:_git_stdout < hermes_cli/source_check.py:_read_checkout",
+ "child_process_blocked from tools/env_probe.py:_run < tools/env_probe.py:_py_out < tools/env_probe.py:_pip_python_version",
+ "child_process_blocked from tools/env_probe.py:_run < tools/env_probe.py:_py_out < tools/env_probe.py:_python_version_of",
+ "network_host_blocked from hermes_cli/release_channels.py:read < hermes_cli/release_channels.py:read_bytes < hermes_cli/release_channels.py:read_record"
+ ],
+ "fence_socketpairs": 0,
+ "install": {
+ "python": "3.11.14",
+ "enable_path": "plugins.enabled in config",
+ "enabled_keys": [
+ "warm_compaction",
+ "wc_test_tools"
+ ],
+ "validate": [
+ [
+ "manifest",
+ true
+ ],
+ [
+ "manifest fields",
+ true
+ ],
+ [
+ "requires_hermes",
+ true
+ ],
+ [
+ "config schema",
+ true
+ ],
+ [
+ "requires_env",
+ true
+ ],
+ [
+ "loadable",
+ true
+ ],
+ [
+ "python dependencies",
+ true
+ ],
+ [
+ "capability probe",
+ true
+ ],
+ [
+ "declared tools",
+ true
+ ],
+ [
+ "declared hooks",
+ true
+ ],
+ [
+ "declared middleware",
+ true
+ ],
+ [
+ "built-in tool collisions",
+ true
+ ],
+ [
+ "security scan",
+ true
+ ],
+ [
+ "no core override",
+ true
+ ]
+ ],
+ "checks": {
+ "enabled_in_config": true,
+ "installed": true,
+ "validate_ok": true,
+ "security_scan_passed": true,
+ "no_core_override_passed": true
+ },
+ "error": null
+ },
+ "run_interpreter": "launch_python",
+ "exit": [
+ 0,
+ 0
+ ],
+ "phases": [
+ "install",
+ "run"
+ ],
- "process_seconds": 39.63
++ "process_seconds": 37.811
},
{
"scenario": "rollback",
@@@ -1052,19 -786,19 +1052,19 @@@
"threshold_tokens": 100000,
"context_length": 200000
},
- "compress_seconds": 0.208,
- "compress_seconds": 0.149,
++ "compress_seconds": 0.162,
"warm_last": {
"path": "warm",
"reason": "accepted",
- "elapsed_s": 0.031,
- "elapsed_s": 0.016,
- "prompt_tokens": 33882,
- "cached_tokens": 16941
++ "elapsed_s": 0.015,
+ "prompt_tokens": 33845,
+ "cached_tokens": 16922
},
"session_rotated": false,
"final_session_id": "wc-rollback",
"continuation_keeps_custom_system_text": false,
"fence_denied": {
-- "child_process_blocked": 5,
++ "child_process_blocked": 6,
"network_host_blocked": 1
},
"fence_blocked_programs": [
@@@ -1215,7 -949,7 +1215,7 @@@
"stored": 30
},
"fence_denied": {
-- "child_process_blocked": 5
++ "child_process_blocked": 6
},
"fence_blocked_programs": [
"git",
@@@ -1235,10 -969,10 +1235,10 @@@
"run",
"rollback"
],
- "process_seconds": 54.676
- "process_seconds": 38.551
++ "process_seconds": 45.801
}
],
- "finished_utc": "2026-10-07T03:08:31Z",
- "finished_utc": "2026-10-06T18:55:25Z",
++ "finished_utc": "2026-10-07T03:15:58Z",
"passed": true,
"run_folder": "outside repository"
}