docs/integrations/hermes.mdx
Add long-term memory to Hermes Agent — a self-improving AI agent CLI by Nous Research. Hermes has a pluggable memory system, and Mem0 is one of the supported providers. Once enabled, Mem0 automatically learns facts from your conversations and surfaces relevant ones before each turn — all without slowing down the chat.
Hermes runs a built-in memory system (file-based MEMORY.md and USER.md) alongside one external provider. When Mem0 is active, it works additively with the built-in system at three key moments in every conversation turn:
When you send a message, Hermes checks if it already has cached Mem0 search results from the previous turn. If so, those memories are injected into the system prompt so the LLM can see them. This is zero-latency — no waiting for an API call.
Once the LLM finishes responding, Hermes sends the (user message, assistant response) pair to Mem0's API in a background thread. Mem0's server-side LLM automatically extracts facts (e.g., "user prefers Python", "user works at Acme Corp") — you don't have to tell it what to remember.
At the same time as sync, Hermes kicks off a background search on Mem0 to pre-load relevant memories for the next turn. By the time you type your next message, the memories are already cached.
When Mem0 is active, the LLM gets three extra tools it can call during conversations:
| Tool | Description |
|---|---|
mem0_profile | Fetch all stored memories about the user |
mem0_search | Semantic search through memories (supports optional reranking via rerank and top_k parameters) |
mem0_conclude | Store a specific fact verbatim — uses infer=False so no server-side LLM extraction happens |
Install Hermes Agent:
curl -fsSL https://raw.githubusercontent.com/NousResearch/hermes-agent/main/scripts/install.sh | bash
source ~/.bashrc
The mem0ai Python package is automatically installed when you enable the Mem0 provider — no manual pip install needed.
hermes memory setup
Select mem0 as the provider and enter your Mem0 API key when prompted. The wizard writes your config to ~/.hermes/mem0.json.
<Note>Get your API key from <a href="https://app.mem0.ai?utm_source=oss&utm_medium=integration-hermes" rel="nofollow">app.mem0.ai</a>.</Note>
hermes config set memory.provider mem0
echo "MEM0_API_KEY=your-api-key" >> ~/.hermes/.env
Then in your config.yaml:
memory:
provider: mem0
That's it — Mem0 runs automatically from this point.
Configuration is stored in ~/.hermes/mem0.json. Values can also be set via environment variables.
| Key | Env Variable | Default | Description |
|---|---|---|---|
api_key | MEM0_API_KEY | — | Required. Mem0 Platform API key |
user_id | MEM0_USER_ID | hermes-user | User identifier for scoping memories |
agent_id | MEM0_AGENT_ID | hermes | Agent identifier |
rerank | — | true | Enable reranking for memory recall |