hermes - 💡(How to fix) Fix Memory: auto-compact MEMORY.md when char limit reached [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#28424Fetched 2026-05-20 04:03:48
View on GitHub
Comments
0
Participants
1
Timeline
3
Reactions
0
Participants
Timeline (top)
labeled ×3

Error Message

return {"success": False, "error":

Code Example

# memory_tool.py:247-258
if new_total > limit:
    return {"success": False, "error": 
        f"Memory at {current:,}/{limit:,} chars. "
        f"Replace or remove existing entries first."}
RAW_BUFFERClick to expand / collapse

Problem

MemoryStore.add() in tools/memory_tool.py simply rejects writes when the char limit is hit (default 2,200):

# memory_tool.py:247-258
if new_total > limit:
    return {"success": False, "error": 
        f"Memory at {current:,}/{limit:,} chars. "
        f"Replace or remove existing entries first."}

There is no auto-compaction mechanism — no merging, summarizing, or FIFO eviction. Once full, MEMORY.md silently stops accepting new entries until the user manually cleans it up.

This is different from conversation context compression (compression.threshold), which works automatically but only touches the messages array, not memory files.

Proposal

When MemoryStore.add() detects the limit would be exceeded:

  1. Option A (LLM compact): Fire a lightweight LLM call to merge/summarize existing entries, then retry the add. Like conversation compression, but for memory files.

  2. Option B (FIFO evict): Drop the oldest entry, then retry. Simple but lossy.

  3. Option C (compact-on-nudge): Let the background memory review (every 10 turns) also check usage percentage. If near full, add a compact instruction to the review prompt.

Option C is the least invasive — just add to _MEMORY_REVIEW_PROMPT something like:

If MEMORY.md is over 80% full, merge redundant or stale entries to free space.

Related

  • Issue #5563 mentions the 2,200 char limit is critically small — this is the other half of the fix (not just bigger, but self-maintaining).

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