feat: add Mem0 memory integration CLI commands and client support#2933
Open
kartik-mem0 wants to merge 6 commits intoNousResearch:mainfrom
Open
feat: add Mem0 memory integration CLI commands and client support#2933kartik-mem0 wants to merge 6 commits intoNousResearch:mainfrom
kartik-mem0 wants to merge 6 commits intoNousResearch:mainfrom
Conversation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds comprehensive user-facing docs for the Mem0 integration, following the same structure as the Honcho Memory docs. Covers setup, configuration, tools, CLI commands, troubleshooting, warnings, and a Mem0 vs Honcho comparison table. Adds mem0 to the sidebar under Integrations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…n context injection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds Mem0 Platform integration to Hermes, enabling persistent cross-session memory. The agent extracts facts from conversations, stores them via Mem0's API, and recalls relevant context in future
sessions through semantic search and system prompt injection.
All search and retrieval uses the Mem0 v2 filter API with proper entity scoping. Memories stored with a run_id (from session strategies) are correctly retrieved using OR filters that combine bare
user_id matching with a run_id: "*" wildcard branch — without this, session-scoped memories are invisible to search. The rerank and keyword_search config settings are respected across all search
paths (manager, prefetch, tools, CLI). Mem0 is a fully independent plugin with its own turn context injection (_inject_mem0_turn_context), separate from Honcho.
Related Issue
Fixes #2942
Type of Change
Changes Made
mem0_integration/client.py— Config dataclass (Mem0ClientConfig) with resolution from$HERMES_HOME/mem0.json→~/.hermes/mem0.json→ env vars. SingletonMemoryClientfactory.mem0_integration/manager.py—Mem0MemoryManagerwithadd(),search(),get_profile(),store_fact(), and backgroundprefetch()for system prompt injection.mem0_integration/cli.py—hermes mem0 {setup|status|search|memories|clear}subcommands for interactive setup, connection health check, and memory management from the terminal.tools/mem0_tools.py— Four agent tools:mem0_search,mem0_context,mem0_profile,mem0_conclude. Visible only when Mem0 is enabled.run_agent.py— Mem0 lifecycle hooks: config loading, prefetch on session start, memory ingestion on conversation end, tool registration.hermes_cli/main.py— Registeredmem0subcommand in the CLI argument parser.hermes_cli/doctor.py— Added Mem0 connection health check tohermes doctor.pyproject.toml— Addedmem0aias optional dependency.tests/mem0_integration/test_client.py— 13 tests for config resolution, env fallback, singleton behavior.tests/mem0_integration/test_cli.py— 5 tests for CLI status/search/memories commands.tests/mem0_integration/test_manager.py— 14 tests for add, search, get_profile, store_fact, prefetch, shutdown.tests/tools/test_mem0_tools.py— 15 tests for tool availability, search, context, profile, conclude handlers.How to Test
uv pip install mem0aihermes mem0 setup— enter API key from app.mem0.aihermes mem0 statushermes, mention some personal facts, then end the sessionhermes mem0 search "programming languages"hermes mem0 memoriespytest tests/mem0_integration/ tests/tools/test_mem0_tools.py -v(47 tests, all passing)Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/Aor N/A
Screenshots / Logs