
Build a Hermes Memory Provider Plugin
A Hermes memory provider implements the MemoryProvider abstract base class and registers through ctx.register_memory_provider(...). The contract is broader than storing text: it covers availability, initialization, memory tool schemas and routing, configuration fields, lifecycle hooks, and privacy behavior.
Implement the required contract
The provider must expose whether it is available, initialize safely, define any tools it contributes, route those tools, and provide setup-compatible configuration fields. Optional hooks can prefetch context, synchronize turns, handle session end, capture context before compression, mirror built-in memory, and shut down cleanly.
sync_turn() must be non-blocking so a slow remote service does not stall the main conversation. Cloud-backed providers should explain when raw messages, tool calls, and tool results leave the device. Storage paths must derive from the supplied hermes_home, never a hard-coded default profile. Hermes supports one external memory provider at a time.
Implementation checklist
- Implement availability and initialization checks.
- Validate configuration without printing credentials.
- Keep turn synchronization non-blocking.
- Derive local storage from
hermes_home. - Document data sent off-device and retention expectations.
- Handle session end, compression, and shutdown idempotently.
- Fail without breaking the core conversation loop.
Common pitfalls
- Blocking inside
sync_turn(). Remote latency should not freeze the agent. - Hard-coding
~/.hermes. That breaks profile isolation and custom homes. - Hiding cloud data flow. Operators need to know what leaves the device.
- Registering competing external providers. Only one can be active at a time.
- Treating tool success as lifecycle success. Compression and shutdown hooks need separate tests.
Verification
Test availability with and without configuration, initialize in a temporary Hermes home, exercise every registered tool, and simulate slow or failed remote calls. Verify turn sync returns promptly, session-end and shutdown hooks are safe to repeat, and no data lands outside the supplied profile path.
Official reference: Hermes Memory Provider Plugin.
