Skip to main content

Semantic memory provider for Hermes Agent — float16 embeddings with Q4 quantization

Project description

hermes-semantic-memory

Semantic memory provider for Hermes Agent. Stores conversation turns as float16 embedding vectors and retrieves by semantic similarity — not keyword matching.

Why

Hermes built-in FTS5 memory searches for exact words. "What database do we use?" cannot match "we migrated to Postgres" because the word "database" isn't in the stored text.

hermes-semantic-memory encodes each turn into a 384-dim vector that captures semantic meaning. Float16 storage gives 2x compression vs FP32 with zero retrieval quality loss (Kendall tau 0.99).

Provider Recall@5 MRR Semantic Gap@5
FTS5 (built-in) 0.422 0.265 0.000
hermes-semantic-memory 0.967 0.599 0.933

2.3x recall. 93% prompt bloat reduction at 100 stored turns.

Install

pip install hermes-semantic-memory[embeddings]

This installs sentence-transformers (~80MB, CPU-only). For API-based embeddings:

pip install hermes-semantic-memory

Configure

Add to ~/.hermes/config.yaml:

memory:
  provider: kv_memory

plugins:
  hermes_semantic_memory:
    embedding_backend: auto
    top_k: 5
    storage_mode: fp16

Usage

No explicit memory commands needed. Every turn is captured automatically via a post_llm_call hook. Semantically relevant past turns are prefetched and injected into context before each API call.

hermes -z "My DB password is xyz123, remember it" --yolo
hermes -z "What is my database password?" --yolo
# Agent recalls "xyz123" via hermes_semantic_memory prefetch

Backends

Backend Config Notes
sentence-transformers embedding_backend: auto Default. all-MiniLM-L6-v2, ~80MB, CPU, ~5ms/turn
api embedding_backend: api OpenAI-compatible embedding API

Run Tests

pip install hermes-semantic-memory[dev]
python -m pytest hermes_semantic_memory/tests/ -v
# 60 passed

Benchmarks

python benchmarks/unified_benchmark.py

Measures semantic search recall, prompt bloat, and storage efficiency vs built-in FTS5.

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_semantic_memory-0.1.0.tar.gz (49.8 kB view details)

Uploaded Source

Built Distribution

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

hermes_semantic_memory-0.1.0-py3-none-any.whl (51.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hermes_semantic_memory-0.1.0.tar.gz
  • Upload date:
  • Size: 49.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for hermes_semantic_memory-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2217409214e77212ab77f52ffad85268111cb7c6a334edbfc696dd6f359ae026
MD5 83148d983bfa55579cde304108c1898c
BLAKE2b-256 e4f27496ab7014c3c02b569bade1e3e7c09618a0537a45f3f37a36102bec770c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hermes_semantic_memory-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f6b262cf7f9f1b90e4581bf273e78cab77fac94c6f56d669d6291264277e98a
MD5 93995d19e9679d8ec39da0113b790ca2
BLAKE2b-256 a5dc786eefb04f202fb8d16773666570830fafa63fb9acecd0d0f74dbe9c2daf

See more details on using hashes here.

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