Remove hardcoded personal references and update README with config options

- Generalized OpenAPI spec reference in client.py
- Removed personal IP addresses and user IDs from README
- Added MEM0_PREFETCH_LIMIT and MEM0_PREFETCH_SCORE_THRESHOLD to documentation
- Updated example configurations with generic values
This commit is contained in:
2026-04-12 17:26:54 +02:00
parent 9d28c9b7a8
commit a1240adbb9
3 changed files with 86 additions and 25 deletions
+69
View File
@@ -0,0 +1,69 @@
# AGENTS.md — Mem0 Local Hermes Plugin
## Structure
Single-file plugin: `__init__.py` contains the `Mem0LocalMemoryProvider` class. HTTP client in `client.py`. Manifest in `plugin.yaml`.
## Key Commands
```bash
# Install from repo
hermes plugins install ARIA/mem0-local-hermes-plugin
# Install from local path (development)
hermes plugins install /path/to/mem0-local-hermes-plugin
# Activate memory provider
hermes memory mem0-local
# Restart gateway after changes
hermes gateway restart
# Verify Mem0 server
curl http://localhost:8000/health
```
## Configuration
**Two-tier config (JSON overrides env):**
1. `~/.hermes/.env` — Primary config
2. `~/.hermes/mem0-local.json` — Optional overrides
**Required env vars:**
- `MEM0_BASE_URL` — Mem0 server URL (default: `http://localhost:8000`)
- `MEM0_USER_ID` — User identifier (default: `hermes-user`)
**Optional env vars:**
- `MEM0_AGENT_ID` — Agent identifier (default: `hermes`)
- `MEM0_PREFETCH_LIMIT` — Max memories to prefetch (default: `3`)
- `MEM0_PREFETCH_SCORE_THRESHOLD` — Min similarity % (default: `60`)
## Architecture
**Memory injection flow:**
1. `queue_prefetch()` — Spawns background thread on user message
2. `prefetch()` — Returns cached result next turn
3. `pre_llm_call` hook — Sync prefetch for immediate injection (fallback context)
4. `sync_turn()` — Non-blocking server-side fact extraction
**Circuit breaker:** 5 consecutive failures → 120s cooldown.
**Dual-context registration:**
- `register_memory_provider()` — When installed in `plugins/memory/`
- `register_tool()` + `pre_llm_call` hook — When installed in `~/.hermes/plugins/`
## Tools
| Tool | Purpose |
|------|---------|
| `mem0_profile` | Get all stored memories |
| `mem0_search` | Semantic search with optional reranking |
| `mem0_conclude` | Store fact verbatim |
| `mem0_delete` | Delete memory by ID |
## Dependencies
- `requests` (via `pip_dependencies` in `plugin.yaml`)
- Hermes gateway with memory provider support
- Self-hosted Mem0 server (Docker image: `mem0ai/mem0:latest`)
+13 -21
View File
@@ -42,10 +42,7 @@ Self-hosted Mem0 memory provider for Hermes-Agent. Provides semantic memory sear
curl http://localhost:8000/health curl http://localhost:8000/health
``` ```
Your setup uses port 8889: Adjust the URL/port as needed for your setup.
```bash
curl http://10.0.0.150:8889/health
```
## Installation ## Installation
@@ -98,12 +95,16 @@ Set in `~/.hermes/.env`:
| `MEM0_BASE_URL` | Local Mem0 server URL | `http://localhost:8000` | | `MEM0_BASE_URL` | Local Mem0 server URL | `http://localhost:8000` |
| `MEM0_USER_ID` | User identifier | `hermes-user` | | `MEM0_USER_ID` | User identifier | `hermes-user` |
| `MEM0_AGENT_ID` | Agent identifier | `hermes` | | `MEM0_AGENT_ID` | Agent identifier | `hermes` |
| `MEM0_PREFETCH_LIMIT` | Max memories to prefetch before LLM call | `3` |
| `MEM0_PREFETCH_SCORE_THRESHOLD` | Min similarity score % to include memory (0-100) | `60` |
Example: Example:
```env ```env
MEM0_BASE_URL=http://10.0.0.150:8889 MEM0_BASE_URL=http://localhost:8000
MEM0_USER_ID=henry_hofmann MEM0_USER_ID=my-user
MEM0_AGENT_ID=hermes MEM0_AGENT_ID=hermes
MEM0_PREFETCH_LIMIT=3
MEM0_PREFETCH_SCORE_THRESHOLD=60
``` ```
### Method 2: Config File (Optional Overrides) ### Method 2: Config File (Optional Overrides)
@@ -111,22 +112,13 @@ MEM0_AGENT_ID=hermes
Create `~/.hermes/mem0-local.json` to override specific settings: Create `~/.hermes/mem0-local.json` to override specific settings:
```json ```json
{ {
"base_url": "http://10.0.0.150:8889", "base_url": "http://localhost:8000",
"user_id": "henry_hofmann", "user_id": "my-user",
"agent_id": "hermes", "agent_id": "hermes",
"rerank": true, "rerank": true,
"timeout": 10.0 "timeout": 10.0,
} "prefetch_limit": 3,
``` "prefetch_score_threshold": 60
Example for your setup:
```json
{
"base_url": "http://10.0.0.150:8889",
"user_id": "henry_hofmann",
"agent_id": "hermes",
"rerank": true,
"timeout": 10.0
} }
``` ```
@@ -218,7 +210,7 @@ After 5 consecutive API failures, the plugin pauses requests for 120 seconds to
### Connection issues ### Connection issues
If your Mem0 server is on a different machine (like your 10.0.0.150): If your Mem0 server is on a different machine:
- Ensure firewall allows connections on port 8889 - Ensure firewall allows connections on port 8889
- Verify the server binds to 0.0.0.0, not just localhost - Verify the server binds to 0.0.0.0, not just localhost
- Check network routing between Hermes-Agent and Mem0 server - Check network routing between Hermes-Agent and Mem0 server
+1 -1
View File
@@ -1,6 +1,6 @@
"""Local Mem0 server HTTP client. """Local Mem0 server HTTP client.
Based on OpenAPI spec from http://10.0.0.150:8889/openapi.json Based on Mem0 server OpenAPI specification.
Endpoints: Endpoints:
- POST /add - Add memory - POST /add - Add memory