Skip to content

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

Open
cola-runner wants to merge 2 commits into
NousResearch:mainfrom
cola-runner:codex/fix-15843-memory-action-aliases
Open

fix(memory): accept common LLM aliases for action / new_text#15859
cola-runner wants to merge 2 commits into
NousResearch:mainfrom
cola-runner:codex/fix-15843-memory-action-aliases

Conversation

@cola-runner

Copy link
Copy Markdown
Contributor

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

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists tool/memory Memory tool and memory providers labels Apr 26, 2026
cola-runner and others added 2 commits April 29, 2026 18:48
Per NousResearch#15843, models occasionally surface "Unknown action 'replace'" /
"Unknown action 'update'" errors and lose the ability to clean up
their own memory.  The canonical actions (add/replace/remove) already
work, but the dispatcher was strict about the exact wording.

- 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 operations
  (a few LLMs produce that field name when paired with old_text).
- Echo the rejected action plus the alias hint when nothing matches,
  so the LLM has a chance to recover on the next turn.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Medium — degraded but workaround exists tool/memory Memory tool and memory providers type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants