hermes-fresh-context
A Hermes Agent context engine plugin that keeps one permanent conversation (such as a Desktop Bot Chat) while starting the model's working context fresh after a human idle gap.
What it does
- Wraps Hermes's built-in
ContextCompressorso normal size-based compaction and manual/compresskeep working. - Exposes an
open_itemstool (add,resolve,list) so the agent can record short-lived decisions, drafts waiting for approval, and promises for later as the conversation goes, and resolve them when done. Open items are stored per conversation with their full text (up to a hard storage cap), capped in count, and expire after 14 days by default unless renewed. - Before answering a new human message, checks how old the previous human message is.
- Ignores non-human messages (cron reports, background process notifications, internal notifications, bot-to-bot DMs, synthetic scaffolding) when measuring the gap.
- Checks for pending state before resetting: unanswered tool calls, running background processes, active delegated subagents, pending approvals or clarify prompts, or an unanswered assistant question/draft.
- When the gap (or optional quiet-hours/overnight boundary) is reached and nothing is pending, replaces the active working context with a short deterministic handoff via Hermes's standard in-place compaction commit. Unresolved open items are listed first, with pattern-based detection kept as a fallback and for running jobs (or empty when nothing is open). Items longer than
max_item_charsare shortened for display with... [shortened]and a note pointing toopen_itemslist; when the whole handoff hitsmax_handoff_chars, a reserved note tells the model to checkopen_itemslistandsession_searchbefore acting on a shortened line. Older turns stay in the same session, stay visible in history, and become searchable viasession_search. - Fails open: any error in fresh-context logic or open-items storage leaves the conversation untouched.
Install
hermes plugins install frendo22/hermes-fresh-context
hermes plugins enable fresh-context
Then set the configuration below and restart the gateway. Tested on Hermes Agent 0.23.4.
Configuration
Add to the target profile's config.yaml:
context:
engine: "fresh-context"
fresh_context:
gap_minutes: 180
# Optional: reset once after local quiet hours end or at a local hour boundary
# quiet_hours:
# start: "23:00"
# end: "07:00"
# overnight_reset_hour: 4
# overnight_min_gap_minutes: 30
max_handoff_chars: 1200
open_items:
enabled: true
max_items: 20
max_item_chars: 200
max_stored_chars: 4000
max_age_days: 14
Flat keys (open_items_enabled, open_items_max_items, open_items_max_item_chars, open_items_max_stored_chars, open_items_max_age_days) and open_items: false are also accepted. Set open_items_max_age_days: 0 (or open_items.max_age_days: 0) to disable expiry.
max_item_chars(default200) is the display limit per item in the handoff. Items longer than this are kept in full in storage, shown in the handoff with... [shortened], and accompanied by a note telling the model to callopen_itemslistfor the full text.max_stored_chars(default4000) is the hard storage limit per item. Only text longer thanmax_stored_charsis truncated onadd(reporting"truncated": true).listreturns the full stored text.- When the whole handoff exceeds
max_handoff_chars(minimum200), space is reserved inside the limit for a note telling the model that the handoff was shortened and that it must read full open items viaopen_itemslistand check archived history viasession_searchbefore acting on a shortened line.
Set context.engine: "compressor" to disable the plugin and return to the built-in compressor.
Existing chats
New chats receive the open_items tool right away. A long-lived chat that was already running before the plugin was enabled (such as an existing Desktop Bot Chat) keeps its earlier tool list across restarts until its tool list is refreshed.
To expose open_items in an existing chat without starting a new one, run:
hermes tools enable context_engine
Desktop, TUI, and CLI chats all use the default cli platform toolsets (pass --platform <name> for a messaging platform, or -p <profile> for a named profile). On the next turn, the chat rebuilds its tool list once, which costs one prompt-cache rebuild. You can also start a new chat instead.
Upgrading from 0.2.0 to 0.2.1 (or changing max_item_chars or max_stored_chars) changes the open_items tool description, which causes one prompt-cache rebuild on the next turn after restart; the tool schema stays static after that.
What it touches
- No network calls, no shell commands, no background processes, no credentials, no telemetry.
- Stores per-conversation open items as JSON files under the active profile's plugin data directory (
<HERMES_HOME>/plugin-data/fresh-context/open_items/), using Hermes's publicplugins.plugin_storage.plugin_data_dirhelper. Whenopen_itemsis disabled, nothing is written to disk and theopen_itemstool is not exposed. - Reads only the active conversation, its own open-items files, and Hermes's in-process state for pending work (background processes, delegated subagents, approvals, clarify prompts).
- The handoff is built deterministically from the open-items list and the conversation, with no extra model call.
- It wraps the built-in
ContextCompressorand reads a few Hermes internals that are not yet part of the public plugin API, so a Hermes release can break it. It fails open when that happens.
Tests
python3 -m unittest discover -s tests
Changes
0.2.1
- Stored full open-item text on
addup toopen_items.max_stored_chars(default4000, flat keyopen_items_max_stored_chars); only that hard limit truncates onaddand reports"truncated": true.listreturns the full stored text. - Changed
open_items.max_item_chars(default200) to a handoff display limit only. Shortened items in the handoff end with... [shortened]and include a note pointing the model toopen_itemslist. - Reserved room inside
max_handoff_charswhen any handoff lines (open items or fallback lines) are cut, adding a note directing the model to read full open items viaopen_itemslistand check archived history viasession_searchbefore acting on a shortened line. - Updated the
open_itemstool description to match while keeping the tool name, actions, and schema shape stable (causes one prompt-cache rebuild after upgrading). - Existing 0.2.0 store files load unchanged. Items already stored truncated by 0.2.0 cannot be restored and are left as-is without a flag (0.2.0 did not store a truncation marker on disk).
0.2.0
- Added the
open_itemstool (add,resolve,list) backed by per-conversation JSON storage under<HERMES_HOME>/plugin-data/fresh-context/open_items/. - Listed unresolved open items first in the fresh-context handoff, with pattern-based detection kept as a fallback and for running jobs.
- Added
fresh_context.open_itemssettings (enabled,max_items,max_item_chars,max_age_days, plus flat keys andopen_items: false).
0.1.0
- Initial release: idle-gap and optional quiet-hours/overnight fresh-context resets wrapping Hermes's built-in
ContextCompressor.
License
MIT
README from the reviewed commit e617bf6; it updates when the author re-pins.

frendo22