# Minigraf

> Embedded single-file graph database with Datalog queries and bi-temporal time travel for AI agents, mobile apps, and the browser.

Minigraf is an open-source embedded graph database from the project-minigraf organization, written in Rust. It stores connected data in a single `.graph` file and is queried with Datalog, with every fact carrying both transaction time and valid time. The latest listed release is v2.0.2.

## What It Is

Minigraf is an embedded library, comparable in spirit to SQLite but for connected data with full history. Data is written as entity-attribute-value facts through `transact` and read through Datalog `query` forms. It can also run as a standalone binary with an interactive REPL, or in memory without a file.

## Query and Time-Travel Model

Queries support recursive rules for multi-hop traversal, window functions such as sum, count, rank and row-number, and prepared statements with `$slot` bind tokens that are parsed and planned once and executed many times. Explicit write transactions are all-or-nothing. Bi-temporal queries such as `:as-of` let you reconstruct what was known at a past transaction, and corrections can be made without losing the original record. A browser-based visualizer lets you step through transaction time and valid time.

## Use Cases and Bindings

For AI agents, the README describes storing beliefs, retracting and correcting them, and replaying past states to audit decisions, and notes it pairs with vector stores in a GraphRAG pattern. For mobile, Kotlin and Swift bindings ship via UniFFI. Other packages cover Python, Node.js, browser WASM (IndexedDB-backed), WASI, Java and C. Python and Rust are Tier 1; the other bindings are labeled experimental Tier 2.

## Scope and Known Limits

By design Minigraf is not distributed or client-server, and is optimised for under about 1M nodes. File-backed databases cap each fact at 4,080 serialised bytes. The README lists a known v2.x issue where multiple values of the same attribute written in one transact can read back as one value, with a fix planned in v3.0.0. Writes are fsync'd by default, with a configurable lower-durability mode for bulk loads.

## Features
- Single-file embedded graph database
- Datalog queries with recursive rules
- Bi-temporal time travel (transaction time and valid time)
- Window functions
- Prepared statements with bind tokens
- All-or-nothing explicit transactions
- Interactive REPL
- Browser WASM and WASI builds
- Language bindings for Python, Node.js, Java, Android, iOS and C
- Configurable fsync durability modes
- Time travel visualizer and browser playground

## Integrations
Python, Node.js, Java/JVM, Android, iOS, WebAssembly, WASI, C

## Platforms
WINDOWS, MACOS, LINUX, ANDROID, IOS, WEB, CLI, DEVELOPER_SDK

## Pricing
Open Source

## Version
2.0.2

## Links
- Website: https://github.com/project-minigraf/minigraf
- Documentation: https://docs.rs/minigraf
- Repository: https://github.com/project-minigraf/minigraf
- EveryDev.ai: https://www.everydev.ai/tools/minigraf
