feat: context pressure warnings and compaction improvements#2116
feat: context pressure warnings and compaction improvements#2116ticketclosed-wontfix wants to merge 1 commit into
Conversation
|
Thanks for the PR! The core idea here — giving advance notice before compaction fires — is good, but the implementation approach doesn't fit how we handle the message stream. Hermes enforces strict message role alternation, and we're very careful about not injecting synthetic user messages into the conversation mid-loop. The budget pressure system you referenced as a model actually avoids this — it only ever piggybacks on existing tool results and silently drops the warning if there's no tool result to attach to. The fallback to We also don't want to change the model's behavior around compaction — telling it to proactively save state or inform the user about compaction details adds noise to the conversation and can cause the model to prioritize compaction housekeeping over the user's actual task. What we do want is to warn the user (not the model) that compaction is approaching — a simple notification in the CLI output or gateway chat, similar to how budget pressure already prints a console line. We'll implement that ourselves since it touches display/gateway plumbing rather than the message stream. Appreciate the contribution! |
Summary
Adds context pressure warnings and improves the compaction experience.
Changes
last_summarytracking: Exposed on theContextCompressorso post-compaction notifications can reference the summary text.Files Changed
agent/context_compressor.py— Tracklast_summaryfrom compactionhermes_cli/config.py— Bump default threshold 50% → 80%run_agent.py— Context pressure warnings at 50%/70%, post-compaction summary injection, threshold default updateTesting
Tested in production across multi-hour Discord sessions. Context warnings give the model time to proactively persist important information before compaction wipes conversation history.