Skip to content

feat: structured multi-memory actions for dedup pipeline#321

Merged
win4r merged 2 commits intoCortexReach:masterfrom
AliceLJY:feat/dedup-actions
Mar 23, 2026
Merged

feat: structured multi-memory actions for dedup pipeline#321
win4r merged 2 commits intoCortexReach:masterfrom
AliceLJY:feat/dedup-actions

Conversation

@AliceLJY
Copy link
Collaborator

Summary

Extends dedup to support secondary actions on multiple existing memories in one decision.

  • New DedupAction type: { matchIndex, action: "merge"|"delete", reason }
  • LLM can now return actions: [...] alongside the primary decision
  • Delete-first execution order prevents merging into a to-be-deleted memory
  • Per-action error handling: one failure doesn't abort the rest
  • Fully backward compatible: no actions field = existing behavior

Test plan

  • 8 unit tests for types, validation, execution order
  • Manual test: verify LLM returns actions when multiple memories overlap

Ref: memory-lancedb-pro-enhancements Feature 2

🤖 Generated with Claude Code

AliceLJY and others added 2 commits March 23, 2026 19:10
Extends the dedup LLM response to support an optional "actions" array that
can target multiple existing memories in a single dedup decision. For example,
"merge with memory 1, delete outdated memory 2".

Changes:
- src/memory-categories.ts: new DedupAction type, actionsExecuted in ExtractionStats
- src/extraction-prompts.ts: add actions array to dedup prompt output schema
- src/smart-extractor.ts: parse + validate actions from LLM response,
  executeSecondaryActions() with delete-first ordering and per-action error handling
- test/dedup-actions.test.mjs: 8 tests (types, validation, execution order)

Backward compatible: missing "actions" field works exactly as before.

Ref: https://github.com/CortexReach/memory-lancedb-pro-enhancements Feature 2

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1. [High] Pre-resolve memory IDs at dedup time instead of re-querying
   store.list() later — prevents index drift causing wrong memory deletion
2. [Medium] Restrict secondary actions to "delete" only — "merge" was
   accepted but never executed, causing misleading stats
3. [Medium] Tighten dedup prompt to only mention "delete" as valid action

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@win4r win4r merged commit be66e0c into CortexReach:master Mar 23, 2026
3 checks passed
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.

2 participants