HY Memory provider plugin for Hermes Agent (native, 100% passive injection)
Project description
HY Memory Provider for Hermes
A native Memory Provider plugin for Hermes Agent — first-class, 100% passive injection.
How it works
Hermes calls prefetch(query) before every LLM turn. This provider:
- searches HY Memory with the query (chat path, three-channel recall),
- formats the hits by layer (
§ [profile]/§ [intent]/§), - lets Hermes inject that block into the system prompt.
No user action required — memory works automatically.
At the end of each turn Hermes calls sync_turn(user, assistant); the provider submits the write to an internal thread pool asynchronously, so the main loop is never blocked.
Install
Two names, don't confuse them:
hermes-hy-memory— the PyPI package youpip install.hy-memory— the provider name Hermes registers it under (set inconfig.yaml).The SDK package
hy-memoryis on public PyPI — a plainpip installworks, no extra index or credentials needed.
The chroma backend needs
sqlite3 >= 3.35(defaultMEMORY_VECTOR_STORE=chroma). On systems with an older sqlite (some CentOS/Linux reportunsupported version of sqlite3):pip install pysqlite3-binaryand swap it in at process entry (import sys; sys.modules["sqlite3"] = __import__("pysqlite3")), or switch toMEMORY_VECTOR_STORE=qdrant/faiss.
1. Install the package
pip install hermes-hy-memory # pulls the hy-memory SDK as a dependency
This registers the hy-memory memory provider with Hermes via entry points.
2. Configure + activate (recommended: the wizard)
Run the standalone wizard — it configures everything and activates the provider for you, so this is the only command you need:
hermes-hy-memory init
The 4-step wizard (LLM → embedding → vector store → mode/userId):
- writes the SDK configuration to
~/.hermes/.env, and - sets
memory.provider: hy-memoryin~/.hermes/config.yamlautomatically.
Requires questionary (pip install "hermes-hy-memory[init]").
Use
hermes-hy-memory(standalone), nothermes hy-memory, for the first run. The Hermes main CLI only exposeshermes hy-memory ...after the provider is active inconfig.yaml— so before activationhermes hy-memory initfails withinvalid choice: 'hy-memory'. The standalonehermes-hy-memorybinary (installed by pip) always works. Once activated, both forms are equivalent.
If you prefer to do it by hand, set memory.provider yourself:
# ~/.hermes/config.yaml
memory:
provider: hy-memory
and set the environment variables manually (see Configuration).
3. Verify
hermes-hy-memory doctor
# once the provider is active, this also works:
hermes hy-memory doctor
Configuration
Environment variables
| Variable | Required | Default | Description |
|---|---|---|---|
HY_MEMORY_USER_ID |
✅ | — | First-level isolation key (your memory namespace) |
HY_MEMORY_AGENT_ID |
❌ | hermes |
Second-level isolation key |
HY_MEMORY_MODE |
❌ | pro |
Processing mode: lite / pro / ultra |
HY_MEMORY_PREFETCH_MAX_CHARS |
❌ | 2000 |
Max chars of injected prefetch text |
HY_MEMORY_SYNC_WORKERS |
❌ | 2 |
sync_turn background thread-pool size |
HY_MEMORY_SHUTDOWN_GRACE_SEC |
❌ | 10 |
Max seconds to wait for in-flight writes on shutdown |
OPENAI_API_KEY (or matching LLM/embedder key) |
✅* | — | Required for pro/ultra; lite only needs the embedder |
*The HY Memory SDK's own LLM/Embedder configuration (see the hy-memory docs).
Environment variables take precedence and can be persisted in ~/.hermes/.env (written automatically by the init wizard).
Processing modes (HY_MEMORY_MODE)
| Mode | Write pipeline | Speed | Recall quality |
|---|---|---|---|
lite |
pure embedding (no LLM) | fastest | vector similarity only |
pro (default) |
LLM fact/identity extraction + reconcile/evolution | medium | profile + fact layers |
ultra |
pro + System2 async cognition (Schema/Intention) | fullest | + cross-domain induction + proactive intent |
⚠️
litemode is not suitable for Hermes passive injection / recall. lite only embeds and skips LLM extraction, so memories stay at theL1_RAWlayer; the SDK'slist/searchfilter outL1_RAW, meaning lite-written memories cannot be recalled byprefetch(writes succeed but search is always empty). Usepro(default) orultrafor Hermes;liteonly fits write-only / no-semantic-recall scenarios.
CLI
After pip install, the hermes-hy-memory subcommands let you run diagnostics and manual operations (outside the Hermes main process):
# health check: env present / client constructs / list works (read-only)
hermes-hy-memory doctor
# manual write
hermes-hy-memory add "I like K-Pop but prefer Jazz"
# manual search
hermes-hy-memory search "music taste" --limit 5
# list recent 20
hermes-hy-memory list
# cross-user test (override env)
hermes-hy-memory search "x" --user-id other_user --agent-id test
When loaded by the Hermes main CLI:
hermes hy-memory doctor
Hooks
| Hook | When | Behavior |
|---|---|---|
prefetch(query) |
before each LLM call | search memory → inject into system prompt |
sync_turn(user, ast) |
end of each turn | submit async write to thread pool |
on_session_end(msgs) |
session end | wait for in-flight + tail extraction |
on_pre_compress(msgs) |
before context compression | same as on_session_end, preserves about-to-be-trimmed content |
on_memory_write(action, target, content) |
Hermes built-in memory commands | add syncs to HY Memory; delete is skipped (target IDs are not interchangeable) |
Tools (LLM-invoked, optional)
| Tool | Purpose |
|---|---|
memory_search(query, limit) |
search memories |
memory_add(content) |
write a memory |
memory_delete(memory_id) |
delete a memory |
memory_list(limit) |
list memories for the current user/agent |
Even with tools disabled, the passive prefetch injection guarantees relevant memories reach every LLM call.
Troubleshooting
provider not initialized or all hooks silently no-op
Run the health check:
hermes-hy-memory doctor
Common causes:
HY_MEMORY_USER_IDnot set- embed/LLM key not set (
OPENAI_API_KEY, etc.) →HyMemoryClient(mode="pro")fails to construct - SDK not installed:
pip install hy-memory
prefetch injects nothing
- There really is no relevant memory — confirm with
hermes-hy-memory list - Query too short (< 3 chars) or in the skip list (
ok/thanks, etc.) — by design - Using
litemode? lite memories stay atL1_RAWand are never recalled — usepro/ultra
sync_turn doesn't seem to write
- Default daemon threads are killed when the main process exits. Use Hermes daemon mode in production
- Raise
HY_MEMORY_SHUTDOWN_GRACE_SECto let shutdown wait a few more seconds - Check the log for
[hermes] sync_turn failed: ...
cross-loop errors (multi-client deployments)
If your Hermes deployment runs multiple HyMemoryClient instances (e.g. a multi-tenant server), use SharedRuntime:
from hy_memory import HyMemoryClient, SharedRuntime
runtime = await SharedRuntime.create(base_config)
client = HyMemoryClient(cfg, runtime=runtime)
A single-process Hermes deployment uses a solo-mode client by default and does not need this.
Comparison with Mem0-style integrations
Mem0's Hermes integration relies on a TypeScript SDK; this plugin uses the Python SDK. HY Memory offers three processing depths — lite/pro/ultra (lite skips the LLM, pro does standard extraction, ultra adds System2 cognition) — whereas Mem0 is single-tier LLM extraction.
Development
cd plugins/native/hermes
python -m pytest tests/ -v
Tests mock HyMemoryClient and need no external dependencies (no OPENAI_API_KEY, no running Qdrant).
Versions
| Plugin | SDK dependency | Notes |
|---|---|---|
| 0.1.6 | hy-memory>=1.2.17 |
init auto-activates memory.provider in config.yaml; docs steer to standalone hermes-hy-memory init (avoids pre-activation invalid choice error) |
| 0.1.5 | hy-memory>=1.2.17 |
Single-level standalone CLI; corrected install docs (real pip + config.yaml flow) |
| 0.1.4 | hy-memory>=1.2.17 |
English README; init wizard (questionary) |
| 0.1.3 | hy-memory>=1.2.17 |
init interactive setup wizard |
| 0.1.2 | hy-memory>=1.2.17 |
Published to public PyPI; channel-dict flatten fix |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hermes_hy_memory-0.1.6.tar.gz.
File metadata
- Download URL: hermes_hy_memory-0.1.6.tar.gz
- Upload date:
- Size: 31.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
529684723d07db9ea865f25a9df9257d712012bcb34b6526d9df81c1c4a085d8
|
|
| MD5 |
3762a2bac67150c5a2b7bfab91d2e49c
|
|
| BLAKE2b-256 |
30c65c53a076d9c6c2059bd8ab285d30305e647bb64edd193297b747a95f6342
|
File details
Details for the file hermes_hy_memory-0.1.6-py3-none-any.whl.
File metadata
- Download URL: hermes_hy_memory-0.1.6-py3-none-any.whl
- Upload date:
- Size: 22.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a489a5c73cae09d569b1589e72ae0598e43cee22448626f6b7a9fdb7bddc903
|
|
| MD5 |
d258dcaaa9f576380fc683c4580565d6
|
|
| BLAKE2b-256 |
2a419da6c90a00c02c6d8c5f745905e36525b47f9f8b4479a618def5ddffdabf
|