Skip to content

feat: add cleanup --dedup-facts for near-duplicate supersession - #246

Merged
hurttlocker merged 1 commit into
mainfrom
xmate/dedup-facts
Feb 27, 2026
Merged

hurttlocker merged 1 commit into
mainfrom
xmate/dedup-facts

Conversation

@hurttlocker

Copy link
Copy Markdown
Owner

Implements #245.

What changed

  • Added near-duplicate fact dedup support in the store layer:
    • SQLiteStore.DedupFacts(ctx, DedupFactOptions)
    • New reporting types: DedupFactReport, DedupFactMerge
  • Added cleanup CLI flags:
    • --dedup-facts
    • --dedup-threshold <float> (default 0.90)
  • Dedup behavior:
    • Scopes to active facts (superseded_by IS NULL), optional agent filter
    • Groups by normalized (subject, predicate)
    • Compares object similarity; merges to highest-confidence winner
    • Uses SupersedeFact tombstones (no hard delete)
  • Dry-run output now prints actual candidate pairs with:
    • subject, predicate
    • winner object + confidence
    • loser object + confidence
    • similarity score

Tests

  • Added internal/store/facts_dedup_test.go covering:
    • dry-run preview pair reporting
    • live supersede behavior
  • Full suite passes.

Validation

  • go test ./... ✅

@hurttlocker
hurttlocker merged commit 7613c20 into main Feb 27, 2026
4 checks passed
@hurttlocker hurttlocker mentioned this pull request Feb 27, 2026
6 of 9 tasks
@hurttlocker
hurttlocker deleted the xmate/dedup-facts branch March 1, 2026 17:09
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