hermes-agent/plugins/memory/mem0
Ben Barclay 1289f12812 fix(memory): lazy-install supermemory + mem0 SDKs like honcho/hindsight
The supermemory and mem0 memory providers shipped third-party SDKs
(supermemory / mem0ai) that are not core dependencies, but — unlike the
honcho and hindsight providers — they imported those SDKs directly with
no tools.lazy_deps.ensure() preflight and had no LAZY_DEPS allowlist
entry. On the published Docker image the agent venv is sealed
(HERMES_DISABLE_LAZY_INSTALLS=1) and lazy installs are redirected to a
writable durable target (HERMES_LAZY_INSTALL_TARGET). honcho/hindsight
route through ensure() and install fine there; supermemory/mem0 never
called it, so their SDK was never installed on a hosted instance and the
provider silently reported itself unavailable even with the API key set.

Fixes:
- Add memory.supermemory + memory.mem0 to the LAZY_DEPS allowlist
  (tools/lazy_deps.py), pinned to current PyPI releases.
- Call ensure('memory.<x>', prompt=False) at each SDK-import chokepoint
  (_SupermemoryClient.__init__; Mem0MemoryProvider._create_backend),
  mirroring honcho's wrapped try/except shape.
- Drop the SDK-import gate from supermemory's is_available() — it was a
  chicken-and-egg trap (provider never loaded on a sealed venv, so
  ensure() never ran). Now key-presence only, like honcho/mem0.
- Add matching pyproject extras [supermemory]/[mem0]; update the
  lazy-covered-extras contract test (excluded from [all] by policy).

Tests prove each path fails without the fix and the real sealed-venv
durable-target gate accepts both features.
2026-06-29 00:25:36 -07:00
..
__init__.py fix(memory): lazy-install supermemory + mem0 SDKs like honcho/hindsight 2026-06-29 00:25:36 -07:00
_backend.py feat(mem0): v3 API, OSS mode, update/delete tools, telemetry & review fixes (#15624) 2026-06-22 12:30:47 +00:00
_oss_providers.py feat(mem0): v3 API, OSS mode, update/delete tools, telemetry & review fixes (#15624) 2026-06-22 12:30:47 +00:00
_setup.py revert(windows): roll back terminal-popup PRs #53791 #53810 #53829 (#53853) 2026-06-27 15:59:00 -07:00
plugin.yaml feat(mem0): v3 API, OSS mode, update/delete tools, telemetry & review fixes (#15624) 2026-06-22 12:30:47 +00:00
README.md feat(mem0): v3 API, OSS mode, update/delete tools, telemetry & review fixes (#15624) 2026-06-22 12:30:47 +00:00

Mem0 Memory Provider

Server-side LLM fact extraction with semantic search and hybrid multi-signal retrieval via the Mem0 Platform v3 API.

Requirements

Setup

hermes memory setup    # select "mem0"

Or manually:

hermes config set memory.provider mem0
echo "MEM0_API_KEY=your-key" >> ~/.hermes/.env

Config

Behavioral settings live in $HERMES_HOME/mem0.json (set them via hermes memory setup). Only the secret MEM0_API_KEY belongs in ~/.hermes/.env.

Key Default Description
mode platform platform (Mem0 Cloud) or oss (self-hosted)
user_id hermes-user User identifier on Mem0
agent_id hermes Agent identifier
rerank true Rerank search results for relevance (platform mode only)

OSS (Self-Hosted) Mode

Run Mem0 locally with your own LLM, embedder, and vector store.

Interactive Setup

hermes memory setup
# Select "mem0" → "Open Source (self-hosted)"
# Follow prompts for LLM, embedder, and vector store

Agent-Driven Setup (Flags)

hermes memory setup mem0 --mode oss \
  --oss-llm openai --oss-llm-key sk-... \
  --oss-vector qdrant

Supported Providers

Component Providers
LLM openai, ollama
Embedder openai, ollama
Vector Store qdrant (local/server), pgvector

Flags Reference

Flag Description
--mode platform or oss
--oss-llm LLM provider (default: openai)
--oss-llm-key LLM API key
--oss-embedder Embedder provider (default: openai)
--oss-vector Vector store (default: qdrant)
--oss-vector-path Qdrant local path
--user-id User identifier

Switching Modes

Platform to OSS

hermes memory setup mem0 --mode oss --oss-llm-key sk-...

Or edit $HERMES_HOME/mem0.json directly:

{
  "mode": "oss",
  "oss": {
    "llm": {"provider": "openai", "config": {"model": "gpt-5-mini"}},
    "embedder": {"provider": "openai", "config": {"model": "text-embedding-3-small"}},
    "vector_store": {"provider": "qdrant", "config": {"path": "~/.hermes/mem0_qdrant"}}
  }
}

OSS to Platform

hermes memory setup mem0 --mode platform --api-key sk-...

Dry Run (preview without writing)

hermes memory setup mem0 --mode oss --oss-llm-key sk-... --dry-run

Tools

Tool Description
mem0_list List all stored memories (paginated)
mem0_search Semantic search by meaning
mem0_add Store a fact verbatim (no LLM extraction)
mem0_update Update a memory's text by ID
mem0_delete Delete a memory by ID

Troubleshooting

"Mem0 temporarily unavailable"

Circuit breaker tripped after 5 consecutive failures. Resets after 2 minutes.

  • Platform mode: Check API key and internet connectivity.
  • OSS mode: Check that your vector store (qdrant/pgvector) is running.

OSS: Qdrant connection refused

# If using local Qdrant, check the storage path is writable:
ls -la ~/.hermes/mem0_qdrant

# If using Qdrant server, check it's reachable:
curl http://localhost:6333/healthz

OSS: PGVector connection refused

# Verify PostgreSQL is running and accepting connections:
pg_isready -h localhost -p 5432

OSS: Ollama not reachable

# Check Ollama is running:
curl http://localhost:11434/api/tags

Memories not appearing

  • mem0_add stores verbatim (no extraction). Use sync_turn for LLM extraction.
  • Search uses semantic matching — try broader queries.
  • Check user_id matches between sessions ($HERMES_HOME/mem0.json).