Or via environment variables: MEM0_PREFETCH_LIMIT, MEM0_PREFETCH_SCORE_THRESHOLD
Fixes the issue where simple queries like "hello" returned too much memory information.
## Changes
- **Configurable prefetch_limit** (default: 3) - Controls max memories returned on prefetch
- **Configurable prefetch_score_threshold** (default: 60%) - Filters out low-similarity results
- **Error messages** - When Mem0 API is unavailable, AI receives error context to inform user
- **Circuit breaker fix** - No longer trips when API succeeds but no memories match threshold
## Configuration
Via `$HERMES_HOME/mem0-local.json`:
```json
{
"prefetch_limit": 3,
"prefetch_score_threshold": 60
}
```
Or via environment variables: `MEM0_PREFETCH_LIMIT`, `MEM0_PREFETCH_SCORE_THRESHOLD`
- Add prefetch_limit config (default: 3) to control max memories returned
- Add prefetch_score_threshold config (default: 60%) to filter low-similarity results
- Add error messages when Mem0 API is unavailable
- Fix circuit breaker to not trip on successful API calls with no matching memories
- Properly type-convert config values from JSON
✅ No issues found — changes look consistent with the stated intent.
The implementation correctly reflects the commit message:
Configuration: prefetch_limit and prefetch_score_threshold are properly loaded from config/env with defaults (3 and 60).
Logic: The filtering logic r.get("score", 0) >= threshold correctly applies the percentage threshold.
Error Handling: The circuit breaker behavior is updated to return a specific error string instead of an empty string, and this string is formatted consistently in both sync (queue_prefetch_and_get) and async (queue_prefetch) paths.
Circuit Breaker Fix: The code explicitly calls self._record_success() even when filtered is empty (no matches), which aligns with the intent to prevent tripping the breaker on successful API calls that simply return no relevant memories.
Thread Safety: The async prefetch path correctly uses self._prefetch_lock when updating self._prefetch_result.
✅ No issues found — changes look consistent with the stated intent.
The implementation correctly reflects the commit message:
- **Configuration**: `prefetch_limit` and `prefetch_score_threshold` are properly loaded from config/env with defaults (3 and 60).
- **Logic**: The filtering logic `r.get("score", 0) >= threshold` correctly applies the percentage threshold.
- **Error Handling**: The circuit breaker behavior is updated to return a specific error string instead of an empty string, and this string is formatted consistently in both sync (`queue_prefetch_and_get`) and async (`queue_prefetch`) paths.
- **Circuit Breaker Fix**: The code explicitly calls `self._record_success()` even when `filtered` is empty (no matches), which aligns with the intent to prevent tripping the breaker on successful API calls that simply return no relevant memories.
- **Thread Safety**: The async prefetch path correctly uses `self._prefetch_lock` when updating `self._prefetch_result`.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
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.