Skip to main content

zeromem: tokenless memory system for Hermes Agent

Memory for Hermes Agent. Every message stays word for word in one SQLite file on your machine. Storing and searching cost zero tokens, and your model only pays to read what comes back.

zeromem is a Rust implementation of Zero-Mem by Xiao et al. (paper, official code).

Install

zeromem is in the Hermes plugin catalog:

hermes plugins install zeromem

Then in ~/.hermes/config.yaml:

memory:
  provider: zeromem

The first run downloads a 130MB embedding model into ~/.hermes/memory/zeromem-models.

Switching from another memory provider? Hermes keeps your conversations in its own session history, so you can bring them all in. It costs no tokens, and running it twice won't duplicate anything:

hermes zeromem import        # preview
hermes zeromem import --yes

The provider syncs turns in the background, prefetches evidence before each turn, and gives your agent zeromem_recall, zeromem_stats and zeromem_forget_session. Recall skips the active session since it's already in context, so "last session" means the one before it.

For Spanish or other non-English conversations, set {"model": "multilingual-e5-small"} in ~/.hermes/memory/zeromem.json.

How it works

Messages are saved word for word, indexed three ways and searched on your machine with no LLM calls. Search returns the exact turn. Tokens are only spent when your model reads the result.

Each turn gets indexed three ways: an entity graph, a timeline of turns, windows and episodes, and BM25 plus dense embeddings. A query gets a deterministic profile, routes to a primary view, runs both retrievals, fuses the scores and pulls in linked turns. No step calls an LLM.

Turns are the source of record. The graph, timeline and BM25 rebuild from them on open, so the indexes can't drift from the data.

Paper to code map and deviations
paper module
eq 3-4 entity-context graph graph.rs, ner.rs
eq 5 trace hierarchy hierarchy.rs
eq 6 query profile profile.rs
eq 7 routing route.rs
eq 8-10 graph view (PPR) graph_view.rs
eq 11 hierarchical view hier_view.rs
eq 12-13 fusion fuse.rs
eq 14 evidence closure closure.rs
eq 15-16 calibration calibrate.rs

Defaults follow the paper: gamma 0.6, rho 0.6, top-5 evidence.

Deviations from the paper: spaCy NER is replaced with a heuristic extractor behind a trait, BGE-M3 with bge-small-en-v1.5 through fastembed (a deterministic hash embedder is the offline fallback and what tests use). Both are swappable. multilingual-e5-small is the other built-in dense model, for non-English conversations. Only the dense view changes with it: BM25 stopwords, relative time words, and entity extraction are still English-oriented.

Benchmarks

LoCoMo evidence recall. At about 3k words of context: official code 0.848, zeromem 0.821, BM25 over turns 0.732. At top_k 5: 0.249 before 0.4.0, 0.467 after returning all top_k results, 0.573 after adding BM25 to the graph view.

LoCoMo evidence recall: how many of the gold evidence turns come back, over 1,536 questions (categories 1 to 4), with one store per conversation.

system words retrieved recall
official Zero-Mem about 2,750 0.848
zeromem, top_k 50 about 3,000 0.821
BM25 over turns about 3,000 0.732
zeromem, top_k 5 (default) about 130 0.573

The official code retrieves whole sessions and zeromem retrieves turns, so matched context is the fair comparison. zeromem leads on temporal questions (0.88 vs 0.84) and multi-hop (0.61 vs 0.60). The official code leads on single-hop and open-domain.

What this doesn't show:

  • Answer quality. This measures retrieval only.
  • Other memory systems. They haven't been benchmarked.
  • A clean-room result. Adding BM25 to the graph view came from reading the official code, and matched-context recall was 0.794 before it.
  • Speed. The two use different models: BGE-M3 and spaCy against bge-small and heuristic NER.
Recall by embedder
embedder top_k 5 top_k 50
bge-small-en-v1.5 (default) 0.573 0.821
multilingual-e5-small 0.549 0.807
hash fallback 0.553 0.807

Other ways to use it

Python

uv add zeromem
import zeromem
m = zeromem.ZeroMem("mem.db")
m.ingest_turn("s1", "user", "I moved to Jersey City on February 14, 2022.", 1644796800)
m.query("When did I move?")

CLI

zm --db mem.db ingest turns.jsonl     # {"session_id","speaker","text","ts"}
zm --db mem.db query "When did I move?"
zm --db mem.db stats

Claude Code

One shared store across every project, in ~/.zeromem (override with ZEROMEM_HOME).

cargo install --git https://github.com/ptaranat/zeromem zeromem
claude plugin marketplace add ptaranat/zeromem
claude plugin install zeromem@zeromem
Manual setup and caveats

Add zm hook to Stop and SessionEnd in ~/.claude/settings.json, then run claude mcp add --scope user zeromem -- zm mcp. Verify with just ccsmoke.

Claude Code gives MCP servers no session identity, so recall can echo turns from the current session. Forgetting a session that's still open in another window partly brings it back as that session keeps talking. There's no prompt-time prefetch, so recall is tool-driven.

Build

just test        # offline, hash embedder
just demo        # ingest examples/dungeon-books.jsonl, run queries
just dev         # maturin develop into .venv
cargo build --release

The fastembed feature (default) pulls onnxruntime and downloads bge-small-en-v1.5 on first use. --no-default-features drops both. Opening a store with a different model re-embeds every turn, so switching needs no migration.

Credits

Method from the Zero-Mem paper and official code by Yilin Xiao, Zhehan Zhu, Yujing Zhang, Jin Chen, Zijin Hong, Luyao Zhuang, Qinggang Zhang, Shengyuan Chen, Xiaocao Ouyang, Lingfei Ren, and Xiao Huang. zeromem started as a clean-room implementation from the paper text, before the authors released their code. The 0.4.0 retrieval fixes came from benchmarking against that code once it was out, so later versions aren't clean-room. Integration shape follows mnemosyne.

MIT licensed.

Metadata

Release files for zeromem 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for zeromem 0.4.1
File Actions
zeromem-0.4.1-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for zeromem-0.4.1-cp39-abi3-win_amd64.whl
zeromem-0.4.1-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details for zeromem-0.4.1-cp39-abi3-manylinux_2_28_x86_64.whl
zeromem-0.4.1-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details for zeromem-0.4.1-cp39-abi3-manylinux_2_28_aarch64.whl
zeromem-0.4.1-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for zeromem-0.4.1-cp39-abi3-macosx_11_0_arm64.whl
zeromem-0.4.1-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for zeromem-0.4.1-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 56.5 MB

Release files / zeromem-0.4.1-cp39-abi3-win_amd64.whl

Download URL zeromem-0.4.1-cp39-abi3-win_amd64.whl
Size 10.0 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
ada72466e379c9d6c95559e7725b475d0f2dd469830b325a82d581eb4c91b2f7
BLAKE2b-256 checksum
How to use checksums
b5ac50965e78a6619d4439956fded2ab7ad19e68d744411d26349861dbc02446
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / zeromem-0.4.1-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL zeromem-0.4.1-cp39-abi3-manylinux_2_28_x86_64.whl
Size 12.8 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
9e614c68da415b4b16c3f43906681211178631544ab29f25d444f272a5186dff
BLAKE2b-256 checksum
How to use checksums
5284c0a37ced451b537424cb19f8f401f6513ae3387bbcbd2ce0ff24625860a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / zeromem-0.4.1-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL zeromem-0.4.1-cp39-abi3-manylinux_2_28_aarch64.whl
Size 12.5 MB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
ccede4ec09545895f077b781a07ee7037b164a5c78d6bcfe265e4909f047c446
BLAKE2b-256 checksum
How to use checksums
327910103867702005e0c4b8eb7d138ab907c2926282046a54df82081a5a2bd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / zeromem-0.4.1-cp39-abi3-macosx_11_0_arm64.whl

Download URL zeromem-0.4.1-cp39-abi3-macosx_11_0_arm64.whl
Size 10.1 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
1bb6d5095a710d6ac2746172b8fc93bcf962c8c78c2f64295fdb6dcb39bdfdd1
BLAKE2b-256 checksum
How to use checksums
a34beae16d86fed54031e4e8c9b90b2c58fad32ab5d689c84947b6edd306113c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Release files / zeromem-0.4.1-cp39-abi3-macosx_10_12_x86_64.whl

Download URL zeromem-0.4.1-cp39-abi3-macosx_10_12_x86_64.whl
Size 11.2 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
e5f7111323dd8156efb191447a1ff2d8534e5fd30abf8eb0082e5a57873a9d61
BLAKE2b-256 checksum
How to use checksums
8ea520a506d3ad124303990eea759e6ff105eab11aa01dc61fea99012e1aaaa8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

Security for zeromem 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 5 files in this release have been uploaded with provenance metadata.

Select from 5 files

Attestation for zeromem-0.4.1-cp39-abi3-win_amd64.whl

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 10, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page