Skip to main content

Hermes Agent memory provider plugin backed by Cashew thought-graph memory.

Project description

hermes-cashew

A Hermes Agent memory provider plugin that stores conversation context in a local Cashew thought graph with semantic search and automatic context recall. Get from zero to a working install in under five minutes.

v0.7.0 adds think cycles on a periodic interval. v0.8.0 re-enables the sleep cycle with a ground-up refactored implementation — vectorized cross-linking, batched DB writes, ~4s at 7K nodes.

Prerequisites

  • Hermes Agent installed
  • cashew-brain>=1.0.0 — installed automatically by hermes plugins install
  • sqlite-vec — optional, enables semantic search (install below if wanted)

Install

hermes plugins install magnus919/hermes-cashew

This clones the repository to ~/.hermes/plugins/cashew/ and registers the plugin entry point. After install, restart the gateway:

hermes gateway restart

Register with Hermes

After installing, set cashew as the active memory provider:

hermes config set memory.provider cashew
hermes gateway restart

Or use the interactive setup (v0.2.0 now includes cashew in the provider picker):

hermes memory setup

Zero-Config Startup

hermes-cashew works out of the box — all 31 configuration keys have sane defaults. Create ~/.hermes/cashew.json only if you want to override them:

cat > ~/.hermes/cashew.json << 'EOF'
{
  "cashew_db_path": "cashew/brain.db",
  "embedding_model": "sentence-transformers/all-MiniLM-L6-v2",
  "recall_k": 5,
  "user_domain": "cli/user",
  "ai_domain": "cli/ai",
  "sync_queue_timeout": 30,
  "vec_dimension": 384,
  "gc_interval_turns": 100,
  "gc_delete_probability": 0.01,
  "enable_query_decomposition": true,
  "max_tokens_per_node": 512,
  "feature_bfs_retrieval": true,
  "feature_semantic_search": true,
  "feature_context_summarization": false,
  "max_depth": 3,
  "similarity_threshold": 0.7,
  "max_nodes_per_query": 20
}
EOF

Full Config Reference

Key Default Description
cashew_db_path cashew/brain.db Path to SQLite DB, relative to hermes_home
embedding_model sentence-transformers/all-MiniLM-L6-v2 Embedding model for retrieval
recall_k 5 Max nodes returned per recall query
sync_queue_timeout 30 Seconds to wait for sync worker drain on shutdown
user_domain cli/user Domain label for user messages
ai_domain cli/ai Domain label for AI messages
vec_dimension 384 Embedding dimension (fixed for v0.2.0)
gc_interval_turns 100 GC run frequency
gc_delete_probability 0.01 Node deletion probability per GC
enable_query_decomposition true Enable query decomposition
max_tokens_per_node 512 Token limit per context node
feature_bfs_retrieval true Enable BFS graph traversal
feature_semantic_search true Enable sqlite-vec semantic search
feature_context_summarization false Enable context summarization
max_depth 3 Max BFS traversal depth
similarity_threshold 0.7 Minimum similarity score
max_nodes_per_query 20 Maximum nodes per query

Environment variables override config values: prefix any key with CASHEW_ (e.g. CASHEW_RECALL_K=10).

Verify the Install

hermes gateway restart   # ensure gateway picks up the new plugin
hermes memory status

Expected output shows Provider: cashew with Plugin: installed and Status: available.

How It Works

hermes-cashew provides two LLM-accessible tools:

  • cashew_query — searches the local thought graph for context relevant to the current conversation. Uses sqlite-vec for semantic search when available, with keyword fallback on macOS or when the extension is unavailable.
  • cashew_extract — explicitly persists a conversation turn into the graph. The agent can call this when it judges a turn contains worth-remembering knowledge.

Both tools are registered automatically when Hermes loads the plugin. On each session start, prefetch() retrieves relevant context from the graph and injects it into the system prompt.

Privacy Controls (Optional)

Nodes in the thought graph can carry tags. The cashew_query tool accepts an exclude_tags parameter to filter out nodes with specific tags from results:

{"query": "prior decisions", "exclude_tags": ["vault:private"]}

This works in both the upstream retrieval path (sqlite-vec / BFS) and the keyword fallback. Common use cases:

  • Privacy: Tag sensitive nodes with vault:private to exclude them from group or shared contexts
  • Domain isolation: Exclude nodes from specific domains during broad queries
  • Declassification: Remove exclusion to reveal previously private nodes

LLM Integration (Optional)

By default, hermes-cashew uses heuristic-only extraction — it stores conversation turns without LLM involvement. To enable LLM-powered features (typed nodes, think cycles, sleep synthesis), configure an auxiliary model in Hermes' own config.yaml:

auxiliary:
  memory:
    provider: openrouter          # any Hermes-supported provider
    model: openai/gpt-4o-mini     # any model available on that provider

Then add the role name to cashew.json:

{
  "cashew_db_path": "cashew/brain.db",
  "llm_aux_role": "memory"
}

The plugin reads your Hermes config, resolves the API key from the appropriate environment variable, and constructs an OpenAI-compatible callable for upstream cashew-brain. No credentials are stored in the plugin config.

What this enables upstream:

  • LLM extraction — structured knowledge extraction with typed nodes, confidence scores, tags, and domain assignment
  • Think cycles — cross-domain synthesis, generates insight nodes from clusters of related knowledge. Runs every think_interval sync turns (default 10). Configure via cashew.json:
    {"llm_aux_role": "memory", "think_interval": 10}
    
    Set think_interval to 0 to disable.
  • Sleep synthesis — Runs at session end via on_session_end() when sleep_cycles: true. Nine-phase consolidation pipeline: cross-linking, dedup, garbage collection, permanence evaluation, core memory promotion, and LLM-powered dream generation. Processes 7K nodes in ~4 seconds (vs hours in the upstream O(N²) implementation). Work-capped at 2,000 nodes per cycle — converges gradually over multiple sessions.

Without llm_aux_role, the plugin uses heuristic-only extraction — no API calls, no LLM cost, zero-config.

Design note: The auxiliary.memory convention is provider-agnostic. Any memory provider plugin can declare llm_aux_role and reference the same auxiliary.memory section, making this a standard pattern across the Hermes plugin ecosystem.

Semantic Search (Optional)

sqlite-vec is an optional SQLite extension that enables vector similarity search. Without it, cashew falls back to keyword-based retrieval — still functional, but less precise.

Install:

pip install sqlite-vec

You may also need to enable load extension support in your SQLite build:

sqlite3_config(SQLITE_ENABLE_LOAD_EXTENSION)

If sqlite-vec is not available at runtime, you'll see this INFO log on startup:

sqlite-vec not available; semantic search will use fallback

This is normal and expected on systems without sqlite-vec support.

Uninstall

hermes plugins remove cashew
hermes config set memory.provider built-in   # revert to built-in memory
rm -rf ~/.hermes/cashew   # optional: remove the local graph data

Troubleshooting

Plugin: NOT installed in hermes memory status

  1. cashew-brain not installed in Hermes venvhermes plugins install does not automatically install Python package dependencies into Hermes's venv. Install it manually:

    ~/.hermes/hermes-agent/venv/bin/python3 -m ensurepip
    ~/.hermes/hermes-agent/venv/bin/python3 -m pip install cashew-brain
    
  2. Stale pycache or entry point not registered — If cashew-brain is installed but the plugin still shows NOT installed:

    cd ~/.hermes/plugins/cashew && \
      ~/.hermes/hermes-agent/venv/bin/python3 -m pip install -e .
    hermes gateway restart
    

Status: not available

The plugin is available when cashew-brain is importable. Check:

~/.hermes/hermes-agent/venv/bin/python3 -c "from core.context import ContextRetriever; print('ok')"

If this fails, cashew-brain is not installed in the Hermes venv (see above).

Hermes-agent venv has no pip

Hermes-agent creates a minimal venv without pip. Bootstrap it first:

~/.hermes/hermes-agent/venv/bin/python3 -m ensurepip
~/.hermes/hermes-agent/venv/bin/python3 -m pip install <package>

Do not run pip install from outside the venv targeting the hermes python, or the package will land in the wrong environment.

Embedding model download on first use

cashew-brain bundles sentence-transformers. The first retrieval operation may trigger a ~500 MB embedding model download. To avoid this in automated environments:

HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1 HF_DATASETS_OFFLINE=1 hermes ...

Development

git clone https://github.com/magnus919/hermes-cashew
cd hermes-cashew
pip install -e ".[dev]"   # macOS
python3 -m pip install -e ".[dev]"   # Linux
pytest                      # run the test suite

Tests require no network access and mock the embedding model automatically (HF_HUB_OFFLINE=1 is set by tests/conftest.py).

Architecture Notes

The plugin uses a dual-path loading strategy to support both pip install -e . (development) and hermes plugins install (flat-entry loader):

  • pip / test path: Python's namespace package mechanism resolves plugins.memory.cashew to plugins/memory/cashew/__init__.py via sys.path
  • flat-entry path: Hermes loads ~/.hermes/plugins/cashew/__init__.py as _hermes_user_memory.cashew. The root __init__.py detects this context and exec's the nested implementation with sys.modules patched so relative imports resolve correctly

License

See LICENSE.

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_cashew-0.8.2.tar.gz (96.6 kB view details)

Uploaded Source

Built Distribution

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

hermes_cashew-0.8.2-py3-none-any.whl (45.2 kB view details)

Uploaded Python 3

File details

Details for the file hermes_cashew-0.8.2.tar.gz.

File metadata

  • Download URL: hermes_cashew-0.8.2.tar.gz
  • Upload date:
  • Size: 96.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hermes_cashew-0.8.2.tar.gz
Algorithm Hash digest
SHA256 0c4850100d481cdfee23382df4e4b0c6e9b4f5b82803cade11add81128ac0fce
MD5 c31b01c42598fc38ede9a929a4ef41c1
BLAKE2b-256 b70b03622aea5c98617bf80cedb2199a3562ed91869eff71b8346bbee2383db7

See more details on using hashes here.

Provenance

The following attestation bundles were made for hermes_cashew-0.8.2.tar.gz:

Publisher: release.yml on magnus919/hermes-cashew

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_cashew-0.8.2-py3-none-any.whl.

File metadata

  • Download URL: hermes_cashew-0.8.2-py3-none-any.whl
  • Upload date:
  • Size: 45.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hermes_cashew-0.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cb23ee3610e7d060cee1daff40b0d6deed29d41ea585f526e11784683a175403
MD5 1f075a69bded9b64945c5665c7e2bace
BLAKE2b-256 8274898967d94826fb4614f5d6e386996dce7c6843db21d602f0769966c9a593

See more details on using hashes here.

Provenance

The following attestation bundles were made for hermes_cashew-0.8.2-py3-none-any.whl:

Publisher: release.yml on magnus919/hermes-cashew

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