hermes - ✅(Solved) Fix [Bug]: Memory Tool Cannot Delete Old Data - memory tool remove/replace operations failing [1 pull requests, 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#15843Fetched 2026-04-26 05:24:43
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×3commented ×1cross-referenced ×1

Error Message

Error Messages 2. Receive error message: old_text is required for 'remove' action 4. Receive error message: Unknown action 'replace'. Use: add, replace, remove

  • Both remove and replace operations fail with error messages
  • Actual: Error message appears: old_text is required for 'remove' action
  • Actual: Error message appears: Unknown action 'replace'. Use: add, replace, remove
  1. Error handling: If the specified old_text is not found, the tool should return a clear error message indicating the entry was not found The memory tool fails to execute both remove and replace operations with error messages:
  • Error: old_text is required for 'remove' action
  • Error: Unknown action 'replace'. Use: add, replace, remove
  • The error message for replace action suggests it should work (Use: add, replace, remove)

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Fix Action

Fix / Workaround

Workaround Currently, the user has to accept the current state with duplicate entries in memory, as the delete functionality is not working.

PR fix notes

PR #15859: fix(memory): accept common LLM aliases for action / new_text

Description (problem / solution / changelog)

Summary

Per #15843, the memory tool's strict action enum (`add`/`replace`/`remove`) trips up models that emit near-misses like `update` or `delete` and leaves them unable to clean up old memory. The canonical actions are already implemented — this PR just makes the dispatcher tolerant.

  • Map common synonyms onto the canonical names: `create`/`insert`/`save` → `add`, `update`/`edit`/`modify` → `replace`, `delete`/`del`/`rm`/`drop` → `remove`.
  • Accept `new_text` as a `content` alias for replace (some models pair it naturally with `old_text`).
  • Improve the "Unknown action" error to echo the rejected action plus the alias hint so the model has a chance to recover on the next turn.

Test plan

  • `pytest tests/tools/test_memory_tool.py` — 41 passed (was 36, +5 alias tests)

Closes #15843

🤖 Generated with Claude Code

Changed files

  • scripts/release.py (modified, +1/-0)
  • tests/tools/test_memory_tool.py (modified, +36/-0)
  • tools/memory_tool.py (modified, +40/-5)

Code Example

Debug Report: https://paste.rs/BHJKh
Agent Log: https://paste.rs/SPejS

---
RAW_BUFFERClick to expand / collapse

Bug Description

Description The Hermes Agent memory tool is unable to execute delete and replace operations, preventing memory space cleanup.

Error Messages

  1. remove operation: old_text is required for 'remove' action
  2. replace operation: Unknown action 'replace'. Use: add, replace, remove

Steps to Reproduce

  1. Attempt to use memory(action='remove', old_text='...') to delete old entries
  2. Receive error message: old_text is required for 'remove' action
  3. Attempt to use memory(action='replace', old_text='...', new_text='...') to replace entries
  4. Receive error message: Unknown action 'replace'. Use: add, replace, remove

Expected Behavior

  • memory(action='remove', old_text='...') should successfully delete the specified memory entry
  • memory(action='replace', old_text='...', new_text='...') should successfully replace the specified memory entry

Actual Behavior

  • Both remove and replace operations fail with error messages
  • Memory space cannot be cleaned up
  • Old and duplicate memory entries cannot be removed

Impact

  • Memory space cannot be cleaned up
  • Memory space is full (2,026/2,200 characters, 92%)
  • Unable to remove old and duplicate memory entries
  • Memory management functionality is broken

Environment

  • Memory space: 2,026/2,200 characters (92%)
  • Memory entries: 14
  • User profile space: 1,220/1,375 characters (88%)

Additional Context The user attempted to clean up old network configuration entries to free up memory space, but the memory tool failed to execute the delete operations. This prevents proper memory management and cleanup.

Workaround Currently, the user has to accept the current state with duplicate entries in memory, as the delete functionality is not working.

Steps to Reproduce

  1. Check current memory status

    • Run: Check memory space usage (should show memory is near full, e.g., 92%)
    • Observe: Multiple old/duplicate entries exist in memory
  2. Attempt to remove a memory entry

    • Run: memory(action='remove', old_text='[specific old text to remove]')
    • Expected: The specified memory entry should be deleted
    • Actual: Error message appears: old_text is required for 'remove' action
  3. Attempt to replace a memory entry

    • Run: memory(action='replace', old_text='[specific old text]', new_text='[new text]')
    • Expected: The specified memory entry should be replaced with new content
    • Actual: Error message appears: Unknown action 'replace'. Use: add, replace, remove
  4. Verify memory cleanup failed

    • Run: Check memory space usage again
    • Observe: Memory space remains full, old entries still exist
    • Result: Memory cleanup operations are not working

Note: The issue occurs consistently when trying to use remove or replace actions on the memory tool, preventing any memory cleanup operations.

Expected Behavior

The memory tool should successfully execute remove and replace operations:

  1. Remove operation: memory(action='remove', old_text='...') should delete the specified memory entry from memory storage
  2. Replace operation: memory(action='replace', old_text='...', new_text='...') should replace the specified memory entry with new content
  3. Memory cleanup: Users should be able to clean up old and duplicate memory entries to free up memory space
  4. Error handling: If the specified old_text is not found, the tool should return a clear error message indicating the entry was not found

The memory management functionality should work as documented, allowing users to maintain their memory storage by removing outdated or duplicate entries.

Actual Behavior

Actual Behavior

The memory tool fails to execute both remove and replace operations with error messages:

  1. Remove operation fails

    • Command: memory(action='remove', old_text='[text]')
    • Error: old_text is required for 'remove' action
    • Result: No memory entry is deleted, memory space remains unchanged
  2. Replace operation fails

    • Command: memory(action='replace', old_text='[old text]', new_text='[new text]')
    • Error: Unknown action 'replace'. Use: add, replace, remove
    • Result: No memory entry is replaced, memory space remains unchanged
  3. Memory cleanup is impossible

    • Memory space remains at 92% capacity (2,026/2,200 characters)
    • Old and duplicate memory entries cannot be removed
    • Memory management functionality is completely broken
  4. Tool inconsistency

    • The error message for replace action suggests it should work (Use: add, replace, remove)
    • But the tool actually rejects the replace action
    • This indicates a bug in the tool's action validation logic

Impact: Users cannot clean up their memory storage, leading to memory space exhaustion and inability to manage memory entries effectively.

Affected Component

Gateway (Telegram/Discord/Slack/WhatsApp)

Messaging Platform (if gateway-related)

No response

Debug Report

Debug Report: https://paste.rs/BHJKh
Agent Log: https://paste.rs/SPejS

Operating System

debian 13

Python Version

No response

Hermes Version

No response

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

No response

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

extent analysis

TL;DR

The Hermes Agent memory tool's remove and replace operations are failing due to invalid action validation, preventing memory cleanup.

Guidance

  • Verify the memory function's action validation logic to ensure it correctly handles 'remove' and 'replace' actions.
  • Check the function's documentation and implementation to confirm that 'replace' is a supported action, despite being listed in the error message.
  • Test the memory function with different inputs to identify any patterns or edge cases that may be causing the validation issues.
  • Consider adding additional error handling to provide more informative error messages when the specified old_text is not found.

Example

No code example is provided due to the lack of implementation details in the issue.

Notes

The root cause of the issue appears to be related to the action validation logic in the memory function. However, without more information about the function's implementation, it is difficult to provide a more specific solution.

Recommendation

Apply a workaround by manually checking the old_text parameter before calling the memory function to ensure it is not empty, and handle the case where the old_text is not found. This can help mitigate the issue until a more permanent fix can be implemented.

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