-
Notifications
You must be signed in to change notification settings - Fork 0
Response timeout causes duplicate memory entries when LLM retries #50
Copy link
Copy link
Open
Labels
Description
Problem
When using the agentic_memory_write tool via an LLM agent (e.g., Claude, GPT), responses frequently take a long time and eventually timeout (MCP error -32001: Request timed out).
The LLM, not knowing whether the write actually succeeded before the timeout, retries sending the same note. This creates duplicate memory entries for the same factual statement.
Steps to Reproduce
- Use an LLM agent connected to agentic-memory MCP
- Call agentic_memory_write with any content multiple times
- Observe MCP timeout error -32001
- LLM retries the same call
- Check stored memories - the note may now exist twice
Expected Behavior
- Either the write succeeds and a timely confirmation is returned, or
- If a timeout occurs, there should be an idempotency mechanism (e.g., content-based deduplication) so retries don't produce duplicates.
Suggested Fixes
- Response time optimization - investigate why writes are slow and reduce latency to stay within MCP timeouts.
- Content deduplication - hash incoming content and skip insertion if an identical memory already exists.
- Idempotency key - allow callers to pass an optional idempotency key so retries are safely ignored.
- Timeout guidance - document recommended MCP client timeout settings for this server.
Impact
- Knowledge base integrity is compromised by duplicate entries.
- Downstream search and linking are polluted with redundant data.
- Agent workflows become unreliable, operators can't tell what was actually stored.
Reactions are currently unavailable