Files
mem0-local-hermes-plugin/AGENTS.md
T
ARIA c79cf43ff8 feat: same-turn memory retrieval in provider mode
prefetch() now reuses the in-flight background search when it matches
the current query, or falls back to a synchronous search (capped at 3s,
split across both requests in case-insensitive mode) so memories are
injected on the same turn instead of one turn behind.

- Track _prefetch_query to scope cached results to their query
- Reset _prefetch_result when starting a new background search to
  prevent stale cross-turn injection after a timed-out join
- Guard background thread writes against superseded queries
- Add optional per-request timeout override to LocalMem0Client
- Update AGENTS.md and README to describe the same-turn flow
2026-08-15 19:52:25 +02:00

2.1 KiB

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

# 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() — Sync retrieval for the current query (same-turn injection); falls back to cached background result when no query is provided
  3. pre_llm_call hook — Sync prefetch for immediate injection (plugin mode)
  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)