Skip to content

[Bug]: Memory Tool Cannot Delete Old Data - memory tool remove/replace operations failing #15843

@aflypenstudio

Description

@aflypenstudio

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existstool/memoryMemory tool and memory providerstype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions