hermes - 💡(How to fix) Fix [Feature]: Trigger background memory review at session boundaries (reset, close, compression) [2 pull requests]

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…

Fix Action

Fixed

Code Example

memory:
  nudge_interval: 10          # existing, unchanged
  review_on_reset: true       # fire on /reset, /new
  review_on_session_end: true # fire on CLI exit, gateway session expiry
  review_on_compression: false # fire after context compression (off by default — compression is already expensive)
RAW_BUFFERClick to expand / collapse

Problem or Use Case

memory.nudge_interval triggers background memory review every N turns, but memory snapshots (USER.md / MEMORY.md) are only reflected in the system prompt at the next session — not mid-conversation. This means a nudge-triggered review during turn 10 of a 12-turn session writes memory that won't be useful until a future session anyway.

Meanwhile, the natural moments when memory is most useful are session boundaries:

  • /reset or /new
  • Session close / CLI exit
  • Gateway session expiry
  • Context compression (which effectively starts a new context window)
  • Session rollover

There is currently no way to trigger a review at these boundaries. Related issues that touch parts of this problem: #18369, #30812, #7192.

Proposed Solution

Add optional config flags to trigger a background memory review at session boundaries, complementing (not replacing) nudge_interval:

memory:
  nudge_interval: 10          # existing, unchanged
  review_on_reset: true       # fire on /reset, /new
  review_on_session_end: true # fire on CLI exit, gateway session expiry
  review_on_compression: false # fire after context compression (off by default — compression is already expensive)

Implementation sketch — the hooks already exist in MemoryManager; the main work is wiring trigger_background_review(agent, review_memory=True) into them, guarded by the new flags:

  • review_on_reseton_session_switch(..., reset=True) call site in run_agent.py
  • review_on_session_endshutdown_memory_provider() in run_agent.py:1951
  • review_on_compressionon_pre_compress() / post-compression path in agent/memory_manager.py:492

Feature Type

Config option

Alternatives Considered

  • nudge_interval alone: fires at arbitrary mid-conversation points; memory isn't reflected until next session anyway, so the timing is often suboptimal.
  • Always review on boundary: too prescriptive — some users may not want the latency cost at shutdown. Hence opt-in flags.

Scope

Small — no new hooks needed, just new config keys and wiring into existing call sites.

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]: Trigger background memory review at session boundaries (reset, close, compression) [2 pull requests]