memorix icon indicating copy to clipboard operation
memorix copied to clipboard

memorix_deduplicate: LLM analysis not implemented despite tool description and config support

Open Lancer-Go opened this issue 8 months ago • 1 comments

Summary

The memorix_deduplicate tool description states:

"Scan active memories for duplicates, contradictions, and outdated information using LLM analysis."

However, after investigating the source code (src/memory/consolidation.ts), the deduplication logic is purely heuristic-based (Jaccard token similarity), with no LLM integration whatsoever. The tool always outputs [heuristic] tags regardless of whether an LLM API key is properly configured.

Environment

  • Memorix version: 1.0.4
    • LLM provider: OpenRouter (confirmed working via /api/v1/auth/key)
      • Config: memorix.yml with llm.provider: openrouter, .env with valid MEMORIX_LLM_API_KEY
        • MCP host also injects MEMORIX_LLM_API_KEY via env

Steps to Reproduce

  • Configure Memorix with a valid OpenRouter API key
    • Store several observations with semantic overlap but different wording
      • Run memorix_deduplicate (with dryRun: true or false)
        • Observe that all results are tagged [heuristic] - no OpenRouter API calls are made Verified by checking OpenRouter Logs dashboard: no API calls were triggered by the deduplicate command.

Expected Behavior

When an LLM API key is configured and memorix_deduplicate is called:

  1. Semantic dedup: Use LLM to detect observations that mean the same thing but use different wording
    1. Contradiction detection: Identify memories that conflict with each other
    1. Outdated info detection: Flag memories that may be superseded by newer information These capabilities are described in the tool's own description but not implemented in consolidation.ts.

Current Behavior

  • consolidation.ts uses only Jaccard similarity on tokenized text
    • No LLM client is imported or called in the deduplication path
      • GitHub code search for "deduplicate" in the repo returns 0 file matches
        • The memorix_store -> Formation Pipeline DOES call the LLM (confirmed via OpenRouter logs), but memorix_deduplicate does not

Suggestion

The heuristic approach works well for obvious text-level duplicates, but two high-value capabilities - contradiction detection and outdated information flagging - fundamentally require LLM reasoning and cannot be achieved with token similarity alone.

A possible approach:

  • Keep heuristic as the fast first pass (current behavior)
    • When LLM is configured, run a second pass on heuristic candidates + borderline cases for semantic analysis
      • Add a dedicated contradiction/staleness scan that sends observation pairs to the LLM Token cost would be minimal (~$0.001-0.003 per dedup run with GPT-4o-mini).

Related

  • Formation Pipeline already successfully uses LLM via the configured API key
    • The memorix_consolidate tool has the same limitation (heuristic only)

Lancer-Go avatar Mar 24 '26 08:03 Lancer-Go

Thanks for the detailed report. This was valid against 1.0.4, but it is no longer accurate on current main / v1.0.5. We re-verified memorix_deduplicate through the real HTTP MCP tools/call path (not just direct source invocation): initialize -> ools/list -> memorix_session_start -> memorix_deduplicate, and the tool now reaches the LLM-backed deduplication path when LLM is enabled. We also fixed a related doctor runtime-reporting issue so the active LLM mode is reported correctly in the CLI. Closing this as resolved in the current release.

AVIDS2 avatar Mar 25 '26 15:03 AVIDS2