Skip to content

feat(extraction): drop candidates that echo a recent manual store - #963

Open
gorkem2020 wants to merge 1 commit into
CortexReach:masterfrom
gorkem2020:feat/manual-echo-guard
Open

feat(extraction): drop candidates that echo a recent manual store#963
gorkem2020 wants to merge 1 commit into
CortexReach:masterfrom
gorkem2020:feat/manual-echo-guard

Conversation

@gorkem2020

Copy link
Copy Markdown
Contributor

Problem

When a user stores a fact manually with memory_store (or memory_update), the same conversation turn usually still flows through auto-capture extraction. The extractor then re-emits the just-stored fact as a candidate, and the pipeline spends judge, dedup, and merge LLM calls deciding what to do with a row that already exists verbatim. In the noisiest case the near-duplicate survives as a second row.

Fix

A small deterministic echo guard:

  • Manual memory_store / memory_update texts are recorded in an in-memory per-agent ring (8 entries, no persistence, no config surface).
  • Extraction candidates near-identical to a recorded text are dropped before the admission judge, with an INFO log line. Matching is deterministic and cheap: normalized containment, token-subset ratio >= 0.9 (both directions), or Jaccard >= 0.75. No LLM calls, no vector reads.
  • The manual row itself is untouched; it was already stored verbatim by the manual-priority lane.

Paraphrase-level echoes (same meaning, different words) are deliberately out of scope: covering them would need embedding lookups and would risk dropping genuinely new memories. The word-level tiers plus the existing dedup layer cover the observed failure shape.

Notes

  • Stacked on #960 (manual-priority supersede) because both touch the same tools.ts region; this diff is the last commit on the branch. Best reviewed after feat(tools): manual-priority supersede for memory_store #960 merges.
  • New unit suite test/manual-echo-guard.test.mjs (17 cases: tier matches, short-text guard, per-agent isolation, ring eviction); registered in the test chain and CI manifest.

🤖 Generated with Claude Code

@gorkem2020
gorkem2020 marked this pull request as ready for review August 29, 2026 12:24
@gorkem2020

Copy link
Copy Markdown
Contributor Author

Recomposed against current master (post-#959/#947 merges) as a single commit carrying only this family's delta. Full suite green locally. Ready for review.

@gorkem2020
gorkem2020 force-pushed the feat/manual-echo-guard branch from 2b40a6a to dfe94e9 Compare August 29, 2026 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant