You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Auto-capture: no idempotency key (Stop/PreCompact re-capture loop) + PreCompact/task_context hooks still bypass dedup #80
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%.
Re-verified against current main, not just the description — both gaps are still open:
_embedding_dedup exists only in hooks/stop.py (line 221). hooks/pre_compact.py and hooks/task_context.py still construct MemoryEncoder with no dedup pipeline.
No idempotency key anywhere in the write path (git grep idempot on main is empty).
What changed today that you should rebase onto.#93 and #94 both landed and both touch this area from the other end:
Those cut the junk auto-captures. They do not touch the duplicate ones — the fragment persisted last turn is still re-encoded this turn, because the gate is evaluating content quality, not prior existence. So your framing still holds: they are complementary, not overlapping.
Please send the PR. Going from ~64% to ~0.25% content_hash=0 fresh neurons on a live deployment is the kind of number worth having, and near-duplicate accumulation in the noisiest write path is the memory-poisoning mode this project should care most about.
One request: keep the idempotency key and the pre_compact/task_context dedup wiring as separate commits if that is natural. They are independently reviewable — the first is a behavioural contract, the second is plumbing an existing mechanism into two more call sites — and the first is the one I will want to read carefully.
Worth noting for the rebase: #63 also landed, which brain-scopes every record-id fetch. If your exact-content candidate lookup fetches by id anywhere, it now needs the brain context set.
Status update so nobody duplicates work: this one is yours — we are not implementing it on our side. You said the fix is PR-ready on your fork, and re-implementing it here would waste that and be a poor way to treat the report.
No deadline pressure. When you rebase, the things that landed today and touch your area: #93 (write-gate modes; also edits hooks/pre_compact.py and hooks/stop.py — expect conflicts there), #94 (machine-noise denylist in quality_scorer), #63 (brain-scopes every record-id fetch — relevant if your exact-content lookup fetches by id), and #99 (bounds inline embedding in the write path with asyncio.wait_for, which touches encoder.py near where dedup runs).
Ping here if any of those turns the rebase into more than a mechanical merge and we will sort it out.
Activity
acidkill commentedon Jul 28, 2026
Re-verified against current
main, not just the description — both gaps are still open:_embedding_dedupexists only inhooks/stop.py(line 221).hooks/pre_compact.pyandhooks/task_context.pystill constructMemoryEncoderwith no dedup pipeline.git grep idempotonmainis empty).What changed today that you should rebase onto. #93 and #94 both landed and both touch this area from the other end:
off | shadow | enforceplus a per-intentauto_capture_mode, so the gate can be enforced onintent=autowhile interactive writes stay in shadow. It also toucheshooks/pre_compact.pyandhooks/stop.py, so expect conflicts there.quality_scorer.Those cut the junk auto-captures. They do not touch the duplicate ones — the fragment persisted last turn is still re-encoded this turn, because the gate is evaluating content quality, not prior existence. So your framing still holds: they are complementary, not overlapping.
Please send the PR. Going from ~64% to ~0.25%
content_hash=0fresh neurons on a live deployment is the kind of number worth having, and near-duplicate accumulation in the noisiest write path is the memory-poisoning mode this project should care most about.One request: keep the idempotency key and the pre_compact/task_context dedup wiring as separate commits if that is natural. They are independently reviewable — the first is a behavioural contract, the second is plumbing an existing mechanism into two more call sites — and the first is the one I will want to read carefully.
Worth noting for the rebase: #63 also landed, which brain-scopes every record-id fetch. If your exact-content candidate lookup fetches by id anywhere, it now needs the brain context set.
acidkill commentedon Jul 28, 2026
Status update so nobody duplicates work: this one is yours — we are not implementing it on our side. You said the fix is PR-ready on your fork, and re-implementing it here would waste that and be a poor way to treat the report.
No deadline pressure. When you rebase, the things that landed today and touch your area: #93 (write-gate modes; also edits
hooks/pre_compact.pyandhooks/stop.py— expect conflicts there), #94 (machine-noise denylist inquality_scorer), #63 (brain-scopes every record-id fetch — relevant if your exact-content lookup fetches by id), and #99 (bounds inline embedding in the write path withasyncio.wait_for, which touchesencoder.pynear where dedup runs).Ping here if any of those turns the rebase into more than a mechanical merge and we will sort it out.
fix(smem-hygiene): default the Stop hook's session-summary fallback t…
fix(smem-hygiene): default the Stop hook's session-summary fallback t…