claude-memory-mcp/src
Viktor Barzin 1c0193f011
Some checks failed
ci/woodpecker/push/deploy Pipeline failed
ci/woodpecker/push/build Pipeline failed
fix(recall): cap default limit to 30 + relevance-bound OR-broadening
memory_recall was returning almost the entire store instead of a small
set of relevant matches. Two compounding causes, both fixed here:

1. Default limit was 10000 (commit d03a77a "effectively unlimited").
   recall_memories/MemoryRecall and the memory_recall MCP tool now
   default to 30 (ceiling stays 10000 for callers that opt in).

2. The OR-broadening fallback (fires when the precise AND-match is
   sparse) ordered by the importance hybrid and padded up to `limit`,
   so with limit=10000 it flooded results with high-importance but
   irrelevant memories. It now orders OR-matches by ts_rank(relevance)
   DESC and applies a minimum-rank floor (OR_BROADEN_MIN_RANK=0.01) to
   drop rows that merely contain a query word incidentally.

Tests: add test_recall_default_limit_is_capped (asserts 30 passed to
fetch) and test_recall_or_broadening_is_relevance_bounded (asserts the
OR query is relevance-ordered + rank-floored). Full suite 176 green,
ruff + mypy clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 18:48:11 +00:00
..
claude_memory fix(recall): cap default limit to 30 + relevance-bound OR-broadening 2026-06-04 18:48:11 +00:00