MemMapFS
A database-less, zero-daemon, local-first memory and state synchronisation file system for AI Agents, written in Rust.
Features
| Capability | Implementation |
|---|---|
| Crash-safe persistence | Binary append-only Write-Ahead Log (state.wal) using bincode |
| Zero-copy reads | Raw context blocks read via memmap2 memory mappings |
| Full-text search | Embedded Tantivy inverted index |
| Async-first | Fully non-blocking API built on Tokio |
| Live state broadcast | AgentState published via Tokio watch channel |
Directory Layout
.memmap_fs_root/
├── state.wal # Binary append-only Write-Ahead Log (Serde + Bincode)
├── index/ # Embedded Tantivy full-text inverted index
└── blocks/ # Partitioned raw context memory data chunks
├── chunk_0000.bin
└── chunk_0001.bin
Quick Start
# Cargo.toml
[]
= { = "." }
= { = "1", = ["full"] }
use ;
async
Module Overview
| Module | Responsibility |
|---|---|
lib.rs |
MemMapFS public facade — coordinates all sub-systems |
engine.rs |
MemMapEngine — in-memory BTreeMap index + KV store + watch channel |
storage.rs |
LogManager (WAL) + BlockStorage (chunk files + memmap2 reads) |
search.rs |
SearchProvider — Tantivy index writer and query runner |
error.rs |
MemMapError — unified error type via thiserror |
Running Tests
License
MIT