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
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: 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.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| zeromem-0.4.2-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details for zeromem-0.4.2-cp39-abi3-win_amd64.whl |
| zeromem-0.4.2-cp39-abi3-manylinux_2_28_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.28+ x86-64 | Details for zeromem-0.4.2-cp39-abi3-manylinux_2_28_x86_64.whl |
| zeromem-0.4.2-cp39-abi3-manylinux_2_28_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.28+ ARM64 | Details for zeromem-0.4.2-cp39-abi3-manylinux_2_28_aarch64.whl |
| zeromem-0.4.2-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details for zeromem-0.4.2-cp39-abi3-macosx_11_0_arm64.whl |
| zeromem-0.4.2-cp39-abi3-macosx_10_12_x86_64.whl | CPython 3.9 | abi3 | macOS 10.12+ x86-64 | Details for zeromem-0.4.2-cp39-abi3-macosx_10_12_x86_64.whl |
Total release size: 56.5 MB
Release files / zeromem-0.4.2-cp39-abi3-win_amd64.whl
| Download URL | zeromem-0.4.2-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 10.0 MB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
0612adba7f59d2f4790f38a9bf454dc16a744bb563115416d0ba15fc897441e3
|
|
BLAKE2b-256 checksum How to use checksums |
d6f98dcdd3f31db0bff46473c59e5845afcbfea821cdd1191b908ef2ae068b74
|
| 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 11, 2026.
Transparency logRelease files / zeromem-0.4.2-cp39-abi3-manylinux_2_28_x86_64.whl
| Download URL | zeromem-0.4.2-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 |
b49f64fad8f1b97fa5251be2cb66222a2813150177973e7038c7cd68e176b69c
|
|
BLAKE2b-256 checksum How to use checksums |
9921f20276a009abed785cec7837b9000c1b639c073f796e1c87b24ecab38fa7
|
| 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 11, 2026.
Transparency logRelease files / zeromem-0.4.2-cp39-abi3-manylinux_2_28_aarch64.whl
| Download URL | zeromem-0.4.2-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 |
ed3be191407cb6daa31c7955cbc8bee75fe6c55c3b6d5a739731878a92e8ffce
|
|
BLAKE2b-256 checksum How to use checksums |
03561de8d1fe697b3a5d9bd2df1b7659720ea9af317854d0f8266e3326f64d98
|
| 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 11, 2026.
Transparency logRelease files / zeromem-0.4.2-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | zeromem-0.4.2-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 |
f717f359774b69537de6cf122ff1220e7543ec66255d243b4c3d590240fc44b8
|
|
BLAKE2b-256 checksum How to use checksums |
cc3a9fc0a26def60ff003b0bc91b3c223516bf320f1d8af028d12d34d8ab4df7
|
| 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 11, 2026.
Transparency logRelease files / zeromem-0.4.2-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | zeromem-0.4.2-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 |
e941192b0de3759288209e9bf327b22b7f559f795823e1cf80f7cc011bc83351
|
|
BLAKE2b-256 checksum How to use checksums |
f33630f81578858108a8964f88ce687f92aa338a680453a638d462dba278a8bd
|
| 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 11, 2026.
Transparency logSecurity for zeromem 0.4.2
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.
Attestation for zeromem-0.4.2-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 11, 2026.
Transparency logA 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.