Add configurable prefetch limit and score threshold #2
Reference in New Issue
Block a user
Delete Branch "mem0-prefetch-improvements"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes the issue where simple queries like "hello" returned too much memory information.
Changes
Configuration
Via
$HERMES_HOME/mem0-local.json:Or via environment variables:
MEM0_PREFETCH_LIMIT,MEM0_PREFETCH_SCORE_THRESHOLD✅ No issues found — changes look consistent with the stated intent.
The implementation correctly reflects the commit message:
prefetch_limitandprefetch_score_thresholdare properly loaded from config/env with defaults (3 and 60).r.get("score", 0) >= thresholdcorrectly applies the percentage threshold.queue_prefetch_and_get) and async (queue_prefetch) paths.self._record_success()even whenfilteredis empty (no matches), which aligns with the intent to prevent tripping the breaker on successful API calls that simply return no relevant memories.self._prefetch_lockwhen updatingself._prefetch_result.