Context: surreal-memory in production for our agent swarm (Uruboros), via stdio MCP + Claude Code Stop/PreCompact auto-capture. Open cards; fix ready on our fork.
Since #69 the Stop hook has embedding-based semantic dedup — good. Two gaps remain:
- No idempotency key at the source. The Stop hook fires after every assistant turn and PreCompact on each compaction; both re-read an overlapping transcript tail and re-run
analyze_text_for_memories, re-encoding identical fragments across turns. The embedding dedup in stop.py operates within a single candidate batch, so it does not stop the cross-turn re-capture loop (the same fragment persisted last turn is re-encoded this turn).
- PreCompact and task_context hooks have no dedup at all —
pre_compact.py and task_context.py still construct MemoryEncoder without any dedup pipeline.
Impact: the noisiest write path (auto-captured session summaries) accumulates near-duplicates — the memory-poisoning failure mode — on any host using the default Stop/PreCompact integration.
Fix we're offering (PR-ready on our fork, will align after our 2.11.0 rebase): an idempotency key at the source to break the re-capture loop; dedup wired into pre_compact + task_context; exact-content candidate lookup so exact dups can't escape the word-search window. On our deployment this dropped content_hash=0 fresh neurons from ~64% to ~0.25%.
Context: surreal-memory in production for our agent swarm (Uruboros), via stdio MCP + Claude Code Stop/PreCompact auto-capture. Open cards; fix ready on our fork.
Since #69 the Stop hook has embedding-based semantic dedup — good. Two gaps remain:
analyze_text_for_memories, re-encoding identical fragments across turns. The embedding dedup instop.pyoperates within a single candidate batch, so it does not stop the cross-turn re-capture loop (the same fragment persisted last turn is re-encoded this turn).pre_compact.pyandtask_context.pystill constructMemoryEncoderwithout any dedup pipeline.Impact: the noisiest write path (auto-captured session summaries) accumulates near-duplicates — the memory-poisoning failure mode — on any host using the default Stop/PreCompact integration.
Fix we're offering (PR-ready on our fork, will align after our 2.11.0 rebase): an idempotency key at the source to break the re-capture loop; dedup wired into pre_compact + task_context; exact-content candidate lookup so exact dups can't escape the word-search window. On our deployment this dropped
content_hash=0fresh neurons from ~64% to ~0.25%.