Initial release: Mem0 local server memory provider for Hermes-Agent
- Self-hosted Mem0 integration (no cloud dependency) - Async prefetch with ~40ms latency - Automatic context injection via pre_llm_call hook - Circuit breaker for server resilience - Full tool support: profile, search, conclude
This commit is contained in:
@@ -0,0 +1,194 @@
|
||||
# Mem0 Local Plugin Installed ✓
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Verify Mem0 Server is Running
|
||||
|
||||
```bash
|
||||
curl http://localhost:8000/health
|
||||
```
|
||||
|
||||
If not running:
|
||||
```bash
|
||||
docker run -d -p 8000:8000 mem0ai/mem0:latest
|
||||
```
|
||||
|
||||
For your setup on 10.0.0.150:8889:
|
||||
```bash
|
||||
curl http://10.0.0.150:8889/health
|
||||
```
|
||||
|
||||
### 2. Configure the Plugin
|
||||
|
||||
The installer should have prompted you for configuration. To verify or modify:
|
||||
|
||||
```bash
|
||||
nano ~/.hermes/.env
|
||||
```
|
||||
|
||||
Add or update:
|
||||
```env
|
||||
MEM0_BASE_URL=http://10.0.0.150:8889
|
||||
MEM0_USER_ID=henry_hofmann
|
||||
MEM0_AGENT_ID=hermes
|
||||
```
|
||||
|
||||
Or create a config file:
|
||||
```bash
|
||||
cat > ~/.hermes/mem0-local.json << 'EOF'
|
||||
{
|
||||
"base_url": "http://10.0.0.150:8889",
|
||||
"user_id": "henry_hofmann",
|
||||
"agent_id": "hermes",
|
||||
"rerank": true,
|
||||
"timeout": 10.0
|
||||
}
|
||||
EOF
|
||||
```
|
||||
|
||||
### 3. Restart Hermes Gateway
|
||||
|
||||
```bash
|
||||
hermes gateway restart
|
||||
```
|
||||
|
||||
### 4. Activate Memory Provider
|
||||
|
||||
```bash
|
||||
hermes memory mem0-local
|
||||
```
|
||||
|
||||
Verify it's active:
|
||||
```bash
|
||||
hermes memory status
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
The plugin supports two configuration methods that work together:
|
||||
|
||||
### Method 1: Environment Variables (Primary)
|
||||
|
||||
Edit `~/.hermes/.env`:
|
||||
```env
|
||||
MEM0_BASE_URL=http://10.0.0.150:8889
|
||||
MEM0_USER_ID=henry_hofmann
|
||||
MEM0_AGENT_ID=hermes
|
||||
```
|
||||
|
||||
### Method 2: Config File (Overrides)
|
||||
|
||||
Create `~/.hermes/mem0-local.json` to override specific settings:
|
||||
```json
|
||||
{
|
||||
"base_url": "http://10.0.0.150:8889",
|
||||
"user_id": "henry_hofmann",
|
||||
"agent_id": "hermes",
|
||||
"rerank": true,
|
||||
"timeout": 10.0
|
||||
}
|
||||
```
|
||||
|
||||
**Note**: Config file values override environment variables. Use `.env` for defaults and JSON for overrides.
|
||||
|
||||
Key variables:
|
||||
- `MEM0_BASE_URL` — Local server URL (your setup: `http://10.0.0.150:8889`)
|
||||
- `MEM0_USER_ID` — User identifier for memory scoping (your setup: `henry_hofmann`)
|
||||
- `MEM0_AGENT_ID` — Agent identifier (default: `hermes`)
|
||||
- `rerank` — Enable reranking for higher precision (default: `true`)
|
||||
- `timeout` — Request timeout in seconds (default: `10.0`)
|
||||
|
||||
## How It Works
|
||||
|
||||
Memory injection happens **automatically** without tool calls:
|
||||
|
||||
1. You send a message
|
||||
2. Plugin searches Mem0 in background (~40ms)
|
||||
3. Relevant memories injected into LLM prompt
|
||||
4. LLM responds with full context
|
||||
|
||||
**Example**: If you stored "My favorite anime is Naruto", then ask "Is there a new episode of my favorite anime?", the LLM will receive:
|
||||
|
||||
```
|
||||
Is there a new episode of my favorite anime?
|
||||
|
||||
## Mem0 Memory
|
||||
- My favorite anime is Naruto
|
||||
```
|
||||
|
||||
No tool call needed — instant context!
|
||||
|
||||
## Migration from Hardcoded Config
|
||||
|
||||
Your previous hardcoded configuration:
|
||||
```yaml
|
||||
mem0:
|
||||
enabled: true
|
||||
api_url: http://localhost:8889
|
||||
user_id: henry_hofmann
|
||||
collection_name: hermes_memory
|
||||
mode: local
|
||||
transparent:
|
||||
enabled: true
|
||||
search_threshold: 0.6
|
||||
max_results: 3
|
||||
include_match_score: true
|
||||
injection_format: system_context
|
||||
```
|
||||
|
||||
Is now replaced by the plugin with:
|
||||
- Same functionality via `MEM0_BASE_URL`, `MEM0_USER_ID`
|
||||
- Transparent memory injection via `queue_prefetch()` + `prefetch()`
|
||||
- Configurable via `~/.hermes/mem0-local.json`
|
||||
|
||||
**Note**: The plugin uses a slightly different approach - memories are injected into the user message (not system prompt) to preserve prompt caching efficiency.
|
||||
|
||||
## Next Steps
|
||||
|
||||
- Start a conversation and mention personal facts
|
||||
- Mem0 will automatically extract and store them
|
||||
- Try asking questions that require remembering past conversations
|
||||
- Use `mem0_profile` tool to see all stored memories
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
If memory doesn't work:
|
||||
|
||||
1. **Check server connectivity**:
|
||||
```bash
|
||||
curl http://10.0.0.150:8889/health
|
||||
```
|
||||
|
||||
2. **Check gateway logs**:
|
||||
```bash
|
||||
hermes gateway logs
|
||||
```
|
||||
|
||||
3. **Verify provider is active**:
|
||||
```bash
|
||||
hermes memory status
|
||||
```
|
||||
|
||||
4. **Check plugin is loaded**:
|
||||
```bash
|
||||
hermes plugins list
|
||||
```
|
||||
|
||||
5. **Test manual memory operations**:
|
||||
```bash
|
||||
# In a conversation, ask Hermes to:
|
||||
- "Store that my favorite color is blue"
|
||||
- "What's my favorite color?"
|
||||
```
|
||||
|
||||
## Available Tools
|
||||
|
||||
| Tool | Description |
|
||||
|------|-------------|
|
||||
| `mem0_profile` | Retrieve all stored memories |
|
||||
| `mem0_search` | Search memories semantically |
|
||||
| `mem0_conclude` | Store a fact explicitly |
|
||||
|
||||
---
|
||||
|
||||
**Enjoy your private, self-hosted memory!** 🚀
|
||||
Reference in New Issue
Block a user