MAST
Vector Storage Engine

MAST

Single-file vector memory storage for AI applications. ACID transactions, cosine similarity search, and metadata filtering in a library that embeds directly into your agent runtime.

No daemon, no network hop, no separate service. Open a file path, store memories, query by vector similarity, and keep your model provider at the edge where it belongs.

01

Storage

Single file

one .mast database on disk

02

Recall

Cosine similarity

vector search + metadata filters

03

Bindings

Rust, Python, Node, C

plus CLI tooling

04

Core model

Embeddable

library, not a server

Why It Exists

Single-file memory store

MAST gives AI applications a local memory database that opens from a file path instead of requiring a separate service.

No daemon, no network hop

It opens like SQLite. Give it a file path, run queries in-process, and keep the latency and operational footprint low.

Vector search with metadata filters

The core engine focuses on storing memories, cosine-similarity recall, collection isolation, and metadata filtering during search.

Pluggable embedders

The storage layer stays vendor-neutral. Embedders are traits, so OpenAI, Voyage, mock embedders, or your own implementation can sit at the edge.

Core Operations

STORE

Write memory content, embeddings, metadata, tier, and timestamps in one ACID transaction.

RECALL

Run cosine-similarity search within a collection, optionally constrained by metadata filters.

GET

Fetch a memory directly by collection and ULID when you already know the identifier.

INFO

Inspect collection-level stats and database information from the same local engine.

Install

Cargo.toml

Native crate with optional embedders.

# Cargo.toml
[dependencies]
mast-core = { git = "https://github.com/ericc59/mast" }
mast-embed-openai = { git = "https://github.com/ericc59/mast" }  # optional
mast-embed-voyage = { git = "https://github.com/ericc59/mast" }  # optional

Usage

rust

Full native flow: store, recall, get, and inspect.

use mast_core::{Mast, config::MastConfig, types::*, embed::MockEmbedder};
use std::collections::HashMap;

let config = MastConfig::default().with_db_path("my.mast");
let mut mast = Mast::open(config)?;
let embedder = MockEmbedder::new(4);

let memory = mast.store(StoreRequest {
    collection: "notes".into(),
    content: "The quick brown fox".into(),
    embedding: Some(vec![0.1, 0.9, 0.0, 0.0]),
    metadata: HashMap::from([("source".into(), "test".into())]),
    tier: Tier::Active,
}, &embedder).await?;

let results = mast.recall(RecallRequest {
    collection: "notes".into(),
    query: None,
    query_embedding: Some(vec![0.1, 0.9, 0.0, 0.0]),
    limit: 5,
    filter: Some(MetadataFilter::Eq("source".into(), "test".into())),
}, &embedder).await?;

let mem = mast.get("notes", &memory.id)?;
let info = mast.info()?;

mast.close()?;

Architecture

Storage

Single-file ACID storage via redb. Crash-safe copy-on-write B-trees. The file is the database.

Vector index

usearch HNSW indexes with cosine similarity. Per-collection indexes are serialized into redb.

Metadata + embedder boundary

Metadata filters are backed by an inverted index in redb, while embedders stay outside the core through a trait-based interface.

Why It Fits Agent Memory

Agent runtimes need durable local recall: user preferences, prior interactions, retrieved facts, and other memories that should be stored and queried without adding a separate vector database or network service.

Long-term recall

Store user facts, summaries, and prior interactions so agents can retrieve useful context across sessions.

Simple integration surface

Open a file, call store and recall, and keep the memory layer inside the application process.

Local-first operations

Everything lives in one file, which fits local agents that need portable state and low-latency recall.

Key Decisions

Single file, not client-server

You link it into the agent process and open a path. That cuts deployment complexity and keeps recall local.

Collection isolation

Recall in one collection never returns memories from another, so application namespaces stay clean by default.

Core stays vendor-neutral

No cloud SDKs or runtime services in the core engine. Model dependencies stay at the edge.

Stable core, optional integrations

The core engine stays focused. Bindings, CLI, and plugins like OpenClaw sit around it instead of being baked into storage internals.

Benchmarks

Criterion coverage across store, recall, filters, and interface boundaries. Run with cargo bench -p mast-core.

01store_single: single memory write with embedding and index update
02store_batch: batched writes in one transaction
03recall_vector: cosine-similarity retrieval over HNSW
04metadata_filter: filtered search over indexed metadata
05info: collection and database inspection
06ffi + bindings: integration coverage across interfaces
07tests: unit, integration, embedder, CLI, and FFI coverage

Stack

01Rust02redb03usearch04fastembed05PyO306napi-rs07cbindgen