Skip to content

firelock-ai/kin-db

KinDB

KinDB

Embeddable graph engine for code-aware tools.

KinDB is a purpose-built graph engine in Rust. It provides the storage, indexing, and retrieval substrate for the Kin semantic version control system and now ships as its own Apache-licensed repo.

Alpha -- APIs will evolve. The core engine is proven inside Kin's 1,400+ test suite and validated benchmark sweeps. Standalone source builds now work directly from this repo; the repo-owned kin-model crate ships here alongside kin-db.

CI codecov License: Apache-2.0 Rust Status: Alpha


What KinDB Does

  • In-memory graph engine with HashMap-based adjacency lists and compiled Rust queries (no query language, zero parsing overhead)
  • Snapshot persistence with atomic writes, mmap-backed loads, and an RCU-style snapshot manager
  • Full-text search via Tantivy
  • Vector similarity search via HNSW index
  • Incremental indexing for graph updates without full rebuilds
  • Static schema -- Entity and Relation types known at compile time

Quick Start

# Prerequisites: Rust stable git clone https://github.com/firelock-ai/kin-db.git cd kin-db cargo build --release # Run tests cargo test -p kin-db

This repo now builds standalone. The repo-owned kin-model crate lives here too, so fresh clones do not need any sibling checkout.


Repo Layout

crates/kin-db/ # Main Rust crate src/ types.rs # Re-exports of canonical types from kin-model store.rs # Re-export of the local GraphStore trait surface engine/ # In-memory graph, indexes, traversal storage/ # mmap persistence, RCU snapshots vector/ # HNSW vector similarity search search/ # Full-text search via Tantivy docs/ ARCHITECTURE.md # Current-state notes plus historical KuzuDB->KinDB migration rationale EVALUATION.md # Historical database comparison that led to building KinDB ZERO_COPY_PLAN.md # Performance and memory direction crates/kin-model/ # Shared canonical types consumed by kin-db and Kin 

Optional feature flags in crates/kin-db/Cargo.toml enable Metal, CUDA, and Accelerate-backed embedding/runtime paths.


Design Principles

  • Batch write, continuous read -- optimized for bulk indexing (like kin commit) followed by many reads.
  • No query language -- all queries are compiled Rust functions. No parsing overhead, no runtime interpretation.
  • Static schema -- Entity/Relation types known at compile time. No runtime schema discovery.
  • Narrow scope -- storage and low-level query capability live here. Semantic rules, review logic, and ranking strategy stay in higher layers.

Status

What's solid:

  • In-memory graph with snapshot persistence
  • Concurrent read access via RCU
  • Tantivy-backed full-text search
  • Vector similarity search
  • Used as the storage engine for Kin's full test and benchmark suite

What's evolving:

  • Embedding and vector-search tuning
  • Zero-copy read path optimizations
  • API surface outside Kin

Ecosystem

Only kin and kin-db are shipping in this public alpha. The rest of the stack is supporting infrastructure or planned follow-on surfaces.

Component Status Description
kin Shipping now Semantic VCS -- primary consumer of KinDB
kin-db Shipping now Graph engine substrate (this repo)
kin-code Planned Editor shell
kin-pilot Planned Agent shell
KinLab Planned Hosted collaboration layer

KinDB exists as a separate repo because storage, indexing, retrieval, and the shared kin-model surface are foundational concerns that sit below the higher-level Kin product layers.


Contributing

Contributions welcome. Please open an issue before submitting large changes.

License

Apache-2.0.


Created by Troy Fortin at Firelock, LLC.


"So neither the one who plants nor the one who waters is anything, but only God, who makes things grow." — 1 Corinthians 3:7

Packages

 
 
 

Contributors