Installation
mnestic is published to crates.io as mnestic, but its importable library
name stays cozo. That means every use cozo::… in existing CozoDB-based
code keeps working unchanged — adopting the fork is a dependency swap, not a
rewrite.
Add the crate
# default features = in-memory + SQLite backends
cargo add mnesticBecause the library name is cozo, you import it as:
use cozo::DbInstance;mnestic
If you are migrating an existing CozoDB project, you can keep the dependency
key as cozo using Cargo's rename idiom — see
Migrating from CozoDB.
Python
The PyO3 binding ships abi3 wheels for Linux (x86_64, aarch64), macOS (Intel,
Apple Silicon), and Windows — plus first-party LangChain and LlamaIndex
adapters that expose hybrid_search as a vector store:
pip install mnestic
pip install langchain-mnestic # LangChain VectorStore
pip install llama-index-vector-stores-mnestic # LlamaIndex vector storefrom mnestic import CozoDbPy
db = CozoDbPy("mem", "", "{}")
db.run_script("?[x] <- [[1],[2],[3]]", {}, False)Choosing a backend
mnestic inherits CozoDB's storage backends. Select them with Cargo features:
| Backend | Feature | Persistence | Notes |
|---|---|---|---|
| In-memory | compact (default) | None | Fastest; great for tests and ephemeral graphs. |
| SQLite | compact (default) | File | Single-file, portable, no native build step. |
| RocksDB | storage-rocksdb | Directory | Highest throughput and concurrency; the fork's non-blocking HNSW build path is RocksDB-only. |
# Cargo.toml — enable the RocksDB backend
mnestic = { version = "0.8", features = ["storage-rocksdb"] }Note
RocksDB compiles a C++ dependency, so the first build is slow. The in-memory and SQLite backends need no native toolchain.
Your first query
use cozo::DbInstance;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// engine, path, options — "mem" needs no path
let db = DbInstance::new("mem", "", "")?;
let result = db.run_default("?[x] := x in [1, 2, 3]")?;
println!("{:?}", result.rows);
Ok(())
}To open a persistent store, pass the backend and a path:
// SQLite file
let db = DbInstance::new("sqlite", "mnestic.db", "")?;
// RocksDB directory (requires the storage-rocksdb feature)
let db = DbInstance::new("rocksdb", "mnestic.rocksdb", "")?;Where to next
- Learn the query language in the Tutorial.
- See what the fork adds in What mnestic adds.
- Build a recall pipeline with Hybrid retrieval.