Skip to main content

Mnemory persistent memory plugin for Hermes Agent

Project description

Hermes Agent Plugin -- Mnemory

A Hermes Agent plugin that provides long-term semantic memory backed by a mnemory server.

Features

  • Auto-Recall: Automatically fetches relevant memories and injects them into the system prompt before each agent turn
  • Auto-Capture: Extracts and stores memories from conversations after each exchange (fire-and-forget)
  • 16 Explicit Tools: memory_search, memory_find, memory_ask, memory_add, memory_add_batch, memory_update, memory_delete, memory_delete_batch, memory_list, memory_categories, memory_recent, memory_save_artifact, memory_get_artifact, memory_get_artifact_url, memory_list_artifacts, memory_delete_artifact
  • Compaction-safe: Detects context compression and re-injects memories automatically
  • Graceful degradation: If mnemory is offline, the agent continues working normally

Prerequisites

A running mnemory server accessible via HTTP.

Install

pip (recommended)

pip install hermes-mnemory

The plugin is auto-discovered via the hermes_agent.plugins entry point.

Directory install

Copy this directory to your Hermes plugins folder:

cp -r integrations/hermes ~/.hermes/plugins/mnemory

Configure

Add to your ~/.hermes/.env:

MNEMORY_URL=http://localhost:8050
MNEMORY_API_KEY=your-api-key  # optional if auth is disabled

Environment Variables

Variable Default Description
MNEMORY_URL (required) Mnemory server URL
MNEMORY_API_KEY "" Bearer token for authentication
MNEMORY_USER_ID "" User ID (required when API key is wildcard or auth disabled)
MNEMORY_AGENT_PREFIX hermes Value sent as X-Agent-Id header
MNEMORY_AUTO_RECALL true Auto-inject memories into context
MNEMORY_AUTO_CAPTURE true Auto-extract memories from conversations
MNEMORY_RECALL_FIND_FIRST true Use AI-powered search on first turn (higher quality, slower)
MNEMORY_RECALL_SEARCH_MODE search Search mode for subsequent turns: find or search
MNEMORY_SCORE_THRESHOLD 0.5 Min relevance score for recalled memories (0.0-1.0)
MNEMORY_INCLUDE_ASSISTANT true Send assistant messages for extraction
MNEMORY_MANAGED true Include behavioural instructions in system prompt
MNEMORY_TIMEOUT 60 HTTP request timeout in seconds

How It Works

  1. on_session_start: Pre-fetches instructions and core memories from /api/recall in a background thread (non-blocking)
  2. pre_llm_call: Two-phase recall per turn:
    • Awaits the init recall (instructions + core memories) if still pending
    • Sends the current user message as a search query to /api/recall for topical memories
    • First turn uses AI-powered find mode (configurable via MNEMORY_RECALL_FIND_FIRST), subsequent turns use fast search mode (configurable via MNEMORY_RECALL_SEARCH_MODE)
    • Search results are replaced each turn (not accumulated) -- the server deduplicates via session tracking
    • Returns context via {"context": "..."} for injection into the system prompt
  3. post_llm_call: Extracts the last user+assistant exchange and sends to /api/remember for background extraction
  4. on_session_end: Cleans up session state

Compaction handling

The plugin detects context compression by tracking conversation history length. When the history shrinks between turns (indicating Hermes compressed the context), the plugin resets its mnemory session and re-fetches core memories, ensuring memories survive compaction.

Built-in Memory Coexistence

This plugin does not disable Hermes's built-in memory system (MEMORY.md / USER.md). They can coexist -- mnemory provides richer semantic search and cross-session memory, while the built-in system provides a simple scratchpad.

To disable the built-in memory when using mnemory, set in ~/.hermes/config.yaml:

memory:
  memory_enabled: false
  user_profile_enabled: false

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hermes_mnemory-0.1.0.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hermes_mnemory-0.1.0-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file hermes_mnemory-0.1.0.tar.gz.

File metadata

  • Download URL: hermes_mnemory-0.1.0.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hermes_mnemory-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1df8ce952785a76aabe4abf98039e90a9f7905b2fc28d1834562d780dd40f0a7
MD5 167fa987c11abb4d6044715d703ac339
BLAKE2b-256 04269a7052f02bf76cd3f87bd31cb651482bcfdebacbf39d8797db8e55f88659

See more details on using hashes here.

Provenance

The following attestation bundles were made for hermes_mnemory-0.1.0.tar.gz:

Publisher: python-publish.yml on fpytloun/mnemory

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hermes_mnemory-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: hermes_mnemory-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hermes_mnemory-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 56d17b0b5842c7e3f1202239404ad76247c4913fc5546ccb917c43642a2c6acd
MD5 cbc272f3f61ea7cda53d256a8062fbfe
BLAKE2b-256 dc1b448060e3950e06ab377c54892d923b7151f3146004bf573bfb812e668107

See more details on using hashes here.

Provenance

The following attestation bundles were made for hermes_mnemory-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on fpytloun/mnemory

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page