hermes - 💡(How to fix) Fix Feature: Add retain_roles config to control which session types trigger memory retain [1 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#19737Fetched 2026-05-05 06:05:26
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×4

Code Example

memory:
  provider: hindsight
  nudge_interval: 10
  retain_roles:
    - user        # direct user conversations (CLI, gateway DMs)
    - gateway     # gateway-managed sessions
    # cron: false  # cron jobs excluded from retain
    # subagent: false  # delegated subagent runs excluded
RAW_BUFFERClick to expand / collapse

Title: Feature: Add retain_roles config to control which session types trigger memory retain

Body:

Problem

Currently, Hindsight auto_retain fires on every session type — including cron jobs and delegated subagent runs. This pollutes the memory bank with task-specific operational data (e.g., stock report outputs, cron job logs) that is not useful for long-term user context and wastes LLM extraction tokens.

Current Behavior

  • _memory_nudge_interval is a global setting that applies to ALL sessions (CLI, gateway, cron)
  • Cron sessions set HERMES_CRON_SESSION=1 but have no memory-specific gate
  • Leaf subagents already skip retain (no memory tool), but the auto_retain in the Hindsight plugin still runs on cron sessions
  • Background review correctly sets _memory_nudge_interval = 0, but this is hardcoded, not configurable

Proposed Solution

Add a retain_roles config option under memory in config.yaml that specifies which session types should trigger auto_retain:

memory:
  provider: hindsight
  nudge_interval: 10
  retain_roles:
    - user        # direct user conversations (CLI, gateway DMs)
    - gateway     # gateway-managed sessions
    # cron: false  # cron jobs excluded from retain
    # subagent: false  # delegated subagent runs excluded

Default should be ["user", "gateway"] to maintain current behavior for interactive sessions while excluding cron and subagents unless explicitly opted in.

Alternative Approaches

  1. A simpler boolean: retain_cron: false — just exclude cron sessions
  2. Use HERMES_CRON_SESSION env var to disable auto_retain at the plugin level
  3. Per-cron-job config: allow retain: false in cron job definitions

Environment

  • Hermes Agent v0.11.x
  • Hindsight plugin (self-hosted)
  • OS: OpenCloudOS 9.2

extent analysis

TL;DR

Add a retain_roles config option to config.yaml to control which session types trigger memory retain in Hindsight.

Guidance

  • Review the proposed retain_roles config option and its default values to ensure they meet your requirements.
  • Consider the alternative approaches, such as using a boolean retain_cron or per-cron-job config, to determine the best solution for your use case.
  • Verify that the HERMES_CRON_SESSION env var is set correctly for cron sessions to ensure proper exclusion from auto_retain.
  • Test the new config option with different session types to ensure the desired behavior.

Example

memory:
  provider: hindsight
  nudge_interval: 10
  retain_roles:
    - user
    - gateway

Notes

The solution assumes that the Hindsight plugin and Hermes Agent are compatible with the proposed config option. Additionally, the retain_roles config option may require updates to the Hindsight plugin or Hermes Agent to function correctly.

Recommendation

Apply the proposed retain_roles config option to control which session types trigger memory retain, as it provides a flexible and configurable solution.

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 Feature: Add retain_roles config to control which session types trigger memory retain [1 participants]