This PR addresses all code review findings for the mem0-local-hermes-plugin.
Bug Fixes
Missing agent_id in sync_turn(): Added agent_id parameter to client.add() and used it in both mem0_conclude and sync_turn() for consistent memory scoping
Inconsistent field access: Fixed queue_prefetch_and_get() to check both text and memory fields (matching queue_prefetch())
Refactoring
Thread safety: Added dedicated _breaker_lock for thread-safe circuit breaker state access
DRY principle: Extracted _format_search_results() helper to eliminate duplicate search result formatting code
Cleanup: Removed unused _read_filters() and _write_filters() methods
Documentation: Documented unused session_id and query parameters for API compatibility
Testing
All fixes have been manually verified. The plugin continues to work correctly with:
Installing
Four tools (mem0_profile, mem0_search, mem0_conclude, mem0_delete)
pre-llm-hook
This PR addresses all code review findings for the mem0-local-hermes-plugin.
## Bug Fixes
- **Missing agent_id in sync_turn()**: Added `agent_id` parameter to `client.add()` and used it in both `mem0_conclude` and `sync_turn()` for consistent memory scoping
- **Inconsistent field access**: Fixed `queue_prefetch_and_get()` to check both `text` and `memory` fields (matching `queue_prefetch()`)
## Refactoring
- **Thread safety**: Added dedicated `_breaker_lock` for thread-safe circuit breaker state access
- **DRY principle**: Extracted `_format_search_results()` helper to eliminate duplicate search result formatting code
- **Cleanup**: Removed unused `_read_filters()` and `_write_filters()` methods
- **Documentation**: Documented unused `session_id` and `query` parameters for API compatibility
## Testing
All fixes have been manually verified. The plugin continues to work correctly with:
- Installing
- Four tools (mem0_profile, mem0_search, mem0_conclude, mem0_delete)
- pre-llm-hook
- Add agent_id parameter to client.add() and use it in mem0_conclude
- Fix inconsistent field access in queue_prefetch_and_get (check both text and memory)
- Remove unused _read_filters() and _write_filters() methods
- Mark prefetch() query parameter as deprecated (was unused)
✅ No issues found — changes look consistent with the stated intent.
The diff correctly implements all the described fixes:
Thread Safety: The _breaker_lock is correctly initialized and used via with statements in _is_breaker_open, _record_success, and _record_failure.
DRY Principle: The new _format_search_results helper correctly consolidates the duplicate logic for formatting search results (checking both text and memory fields) used in prefetch and queue_prefetch.
Bug Fixes: The agent_id parameter is correctly added to client.add() calls in sync_turn and mem0_conclude, and the LocalMem0Client.add method is updated to accept and payload this parameter.
Cleanup: The unused _read_filters and _write_filters methods are removed.
Documentation: Docstrings are updated to reflect parameter usage and compatibility notes.
No syntax errors, typos, or logic bugs were detected in the added lines.
✅ No issues found — changes look consistent with the stated intent.
The diff correctly implements all the described fixes:
* **Thread Safety**: The `_breaker_lock` is correctly initialized and used via `with` statements in `_is_breaker_open`, `_record_success`, and `_record_failure`.
* **DRY Principle**: The new `_format_search_results` helper correctly consolidates the duplicate logic for formatting search results (checking both `text` and `memory` fields) used in `prefetch` and `queue_prefetch`.
* **Bug Fixes**: The `agent_id` parameter is correctly added to `client.add()` calls in `sync_turn` and `mem0_conclude`, and the `LocalMem0Client.add` method is updated to accept and payload this parameter.
* **Cleanup**: The unused `_read_filters` and `_write_filters` methods are removed.
* **Documentation**: Docstrings are updated to reflect parameter usage and compatibility notes.
No syntax errors, typos, or logic bugs were detected in the added lines.
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.
This PR addresses all code review findings for the mem0-local-hermes-plugin.
Bug Fixes
agent_idparameter toclient.add()and used it in bothmem0_concludeandsync_turn()for consistent memory scopingqueue_prefetch_and_get()to check bothtextandmemoryfields (matchingqueue_prefetch())Refactoring
_breaker_lockfor thread-safe circuit breaker state access_format_search_results()helper to eliminate duplicate search result formatting code_read_filters()and_write_filters()methodssession_idandqueryparameters for API compatibilityTesting
All fixes have been manually verified. The plugin continues to work correctly with:
✅ No issues found — changes look consistent with the stated intent.
The diff correctly implements all the described fixes:
_breaker_lockis correctly initialized and used viawithstatements in_is_breaker_open,_record_success, and_record_failure._format_search_resultshelper correctly consolidates the duplicate logic for formatting search results (checking bothtextandmemoryfields) used inprefetchandqueue_prefetch.agent_idparameter is correctly added toclient.add()calls insync_turnandmem0_conclude, and theLocalMem0Client.addmethod is updated to accept and payload this parameter._read_filtersand_write_filtersmethods are removed.No syntax errors, typos, or logic bugs were detected in the added lines.