hermes - 💡(How to fix) Fix memory: No archive path when removing entries from bounded MEMORY.md — deletion is permanent, no bridge to Hindsight [1 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…

Error Message

  1. Add a new entry → receives "success": false, "error": "Memory at X/Y chars. Adding this entry... would exceed the limit."
  • Warn when MEMORY.md exceeds 90% capacity (preventive)
  • Surface the gap in the overflow error message: "Consider using hindsight_retain to archive entries before removing them"

Root Cause

  1. on_memory_write() hook exists in MemoryProvider ABC (agent/memory_provider.py:274) but Hindsight does NOT implement it — only sync_turn() (conversation auto-extraction).
  2. auxiliary.flush_memories was removed in v0.12.0 (PR #15696, see RELEASE_v0.12.0.md:169) — the config block in config.yaml is dead.
  3. memory remove has no archive path — the entry is popped from the list and the file is persisted. No hook fires.

Fix Action

Fixed

Code Example

def on_memory_write(self, action, target, content, metadata=None):
    if action == "remove":
        self._retain_queue.put({
            "text": f"[ARCHIVED from {target}] {content}",
            "tags": ["archived", f"source:{target}"],
        })
RAW_BUFFERClick to expand / collapse

Problem

When MEMORY.md reaches its character limit (default 2,200, configurable), the memory tool blocks new add operations, forcing users to manually delete old entries via memory(action="remove"). These deleted entries are permanently lost — there is no archive, offload, or bridge path to any long-term memory backend (Hindsight, Honcho, etc.).

The Categorical Gap

The built-in memory tool and Hindsight serve fundamentally different purposes:

SystemStoresNature
MEMORY.md (builtin)Rules, preferences, env facts, workflows"How things should be done"
Hindsight (PostgreSQL)Session summaries, events, observations"What happened"

They are orthogonal, not redundant. Hindsight cannot replace MEMORY.md, and MEMORY.md deletions cannot be recovered from Hindsight.

Evidence from a production deployment

  • MEMORY.md: 3,490/3,500 chars (99.7% full), 42 entries
  • Hindsight: 28,713 records (daemon PID 1601480, healthy)
  • 4 entries have NO redundancy elsewhere (not in SOUL.md, USER.md, or AGENTS.md):
    1. Feishu MEDIA path whitelist + format restrictions + kanban.db root cause
    2. Network proxy configuration (Codex→8118, Stotik→7890, PubMed→直连)
    3. Cherry-pick iron rule (PR→cherry-pick→push→switch→delete→verify→restart)
    4. AI fabrication prevention (Grok/DeepSeek systematic fabrication, countermeasures)

Recall Verification

8 targeted hindsight_recall queries for memory rule content returned event records (cherry-pick operations, PR activity, Kanban notifications) — never the rule text itself. Hindsight stores "what the agent DID", not "what the agent MUST do".

Root Cause

  1. on_memory_write() hook exists in MemoryProvider ABC (agent/memory_provider.py:274) but Hindsight does NOT implement it — only sync_turn() (conversation auto-extraction).
  2. auxiliary.flush_memories was removed in v0.12.0 (PR #15696, see RELEASE_v0.12.0.md:169) — the config block in config.yaml is dead.
  3. memory remove has no archive path — the entry is popped from the list and the file is persisted. No hook fires.

Steps to Reproduce

  1. Fill MEMORY.md close to memory.memory_char_limit
  2. Add a new entry → receives "success": false, "error": "Memory at X/Y chars. Adding this entry... would exceed the limit."
  3. Run memory(action="remove", old_text="<existing entry>") → entry is deleted from file
  4. Query Hindsight for the deleted entry's content → returns event records, NOT the rule text
  5. The deleted entry is irrecoverable

Suggested Fix

Implement on_memory_write() in HindsightMemoryProvider to auto-archive removed entries:

def on_memory_write(self, action, target, content, metadata=None):
    if action == "remove":
        self._retain_queue.put({
            "text": f"[ARCHIVED from {target}] {content}",
            "tags": ["archived", f"source:{target}"],
        })

This preserves the entry in Hindsight with proper tags, making it retrievable via hindsight_recall even after removal from MEMORY.md.

Alternative approaches:

  • Add action="archive" to the memory tool: read entry → hindsight_retain → remove
  • Warn when MEMORY.md exceeds 90% capacity (preventive)
  • Surface the gap in the overflow error message: "Consider using hindsight_retain to archive entries before removing them"

Related Issues

  • #28424 "Memory: auto-compact MEMORY.md when char limit reached" — addresses LLM summarization, not Hindsight offload
  • #32064 "Fix bounded memory: durable unlimited user memory with retrieval" — addresses overflow write paths, not deletion archival
  • #23378 "Bounded memory overflow does not trigger automatic consolidation" — addresses auto-consolidation, not archive bridge
  • #15696 removed flush_memories entirely

Environment

  • Hermes Agent: server-mainline branch (synced with upstream/main)
  • Memory provider: hindsight (local_external mode, port 8888)
  • MEMORY.md: 3,490/3,500 chars
  • Hindsight: 28,713 records

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 memory: No archive path when removing entries from bounded MEMORY.md — deletion is permanent, no bridge to Hindsight [1 pull requests]