hermes - 💡(How to fix) Fix Plugin: context-resume — Auto-inject conversation context after gateway restart [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#16661Fetched 2026-04-28 06:51:51
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
labeled ×4commented ×1

Code Example

plugins:
  enabled:
    - context-resume
  context-resume:
    auto: true
    max_messages: 100
    max_age_minutes: 60
    max_summary_chars: 8000
RAW_BUFFERClick to expand / collapse

Problem

In gateway mode, when the gateway restarts or a session resets, the agent loses all conversation context. The built-in resume_pending mechanism only prepends a short system note ("your previous turn was interrupted"), but the actual conversation content is not injected into the new session. The agent starts blind.

This is especially painful for long-running conversations on messaging platforms (Feishu, Telegram, Discord, etc.) where users expect continuity.

What this plugin does

context-resume compresses recent messages from the most recently active session and injects them as context — either on-demand via /ctx or automatically via the pre_llm_call hook.

Features

  • /ctx [N] — Slash command that compresses the last N messages from the current session into a readable summary
  • Auto-inject (auto: true) — On the first turn of a new session, automatically finds the most recently active session on the same platform and injects a compressed summary

Compression rules

  • User messages: kept verbatim, truncated to 500 chars
  • Assistant messages: first 300 chars (the conclusion)
  • Tool calls / system messages: dropped entirely
  • Hard cap on output size (configurable, default 8000 chars)

Installation

Copy to ~/.hermes/plugins/context-resume/ and add to config:

plugins:
  enabled:
    - context-resume
  context-resume:
    auto: true
    max_messages: 100
    max_age_minutes: 60
    max_summary_chars: 8000

Comparison with built-in features

FeatureBuilt-in /resumeBuilt-in resume_pendingThis plugin
MechanismSwitch session pointerSystem note on restartCompress & inject messages
Context injection
Requires named session✅ Must /title first
Auto-triggered❌ Manual✅ On restartauto: true
Works on unnamed sessions

Design notes

  • Uses only public SessionDB API (search_sessions, get_messages, get_session) — no private _lock/_conn access
  • Platform-isolated: each platform only resumes its own sessions
  • Subagent sessions filtered out (only top-level conversations)
  • Injection goes into user message via pre_llm_call hook, preserving system prompt cache prefix

Source

👉 https://gist.github.com/qiuscut/d4c268dadb2ed7690a77ee8ea479b705

Feedback welcome

  • Is this something others have needed?
  • Any suggestions on the compression strategy?
  • Would this be a good fit as a bundled plugin?

Happy to open a PR if there's interest.

extent analysis

TL;DR

To resolve the issue of losing conversation context when the gateway restarts or a session resets, consider using the context-resume plugin, which compresses recent messages from the most recently active session and injects them as context.

Guidance

  • The context-resume plugin provides a solution by automatically injecting a compressed summary of recent messages into new sessions, which can be configured to trigger on-demand or automatically.
  • To use the plugin, copy it to ~/.hermes/plugins/context-resume/ and add the necessary configuration to enable it, including setting auto to true for automatic injection.
  • The plugin's compression rules can be adjusted, such as changing the max_messages, max_age_minutes, and max_summary_chars settings to fine-tune the behavior.
  • The effectiveness of the plugin can be verified by testing it with different conversation scenarios, including long-running conversations on various messaging platforms.

Example

No specific code snippet is provided as the plugin's functionality and configuration are described in the issue body.

Notes

The context-resume plugin relies on the public SessionDB API and does not access private session data, making it a relatively safe and non-intrusive solution. However, the compression strategy and configuration settings may need to be adjusted based on specific use cases and requirements.

Recommendation

Apply the context-resume plugin as a workaround to address the issue of losing conversation context, as it provides a functional solution that can be easily integrated and configured.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - 💡(How to fix) Fix Plugin: context-resume — Auto-inject conversation context after gateway restart [1 comments, 2 participants]