Skip to content

firelock-ai/kin-db

kin-db — The Semantic Engine for Kin

The semantic engine: graph storage, snapshots, indexing, text + vector search.

The graph is the canonical repository substrate in Kin — not a file index, not a metadata overlay, but the primary source of truth for every entity, relation, and provenance record. kin-db is that substrate: it owns graph storage, snapshot persistence, BM25 lexical retrieval, and ANN vector search, and composes kin-infer for on-device embedding inference. kin (the system of record) and kin-vfs (the transparent filesystem projection) both build on top of it.

License Part of Kin

What is Kin?

Kin is the system of record for AI-written software — your code as a graph of entities, relations, and intents, not a pile of files and diffs. AI agents and humans navigate it semantically, with provenance, review, and governance built in. It coexists with Git and projects graph truth back to a normal filesystem, so any tool works unchanged.

Start at firelock-ai/kin · kinlab.ai

kin-db's role

kin-db owns the canonical graph substrate: entities, relations, provenance, sessions, and their indexes. It is not a general-purpose graph database — it is built specifically to support Kin's semantic repository model, where every function, type, file, and relation is a first-class graph node with a stable identity, content hash, and verifiable Merkle ancestry.

It is the lowest authoritative layer in the open Kin local substrate. kin (the system of record) and kin-vfs (the filesystem projection) build on top of it. It composes kin-search for BM25 lexical retrieval, kin-vector for ANN/embedding retrieval, and kin-infer for on-device embedding inference.

Build

cargo build
cargo test

Feature flags of note:

Flag Default Purpose
vector on HNSW vector index via kin-vector
embeddings on GPU embedding via kin-infer
metal off Apple Metal GPU backend (requires embeddings)
gcs off Google Cloud Storage snapshot backend

Key types

  • InMemoryGraph — the live, mutable graph. Implements GraphStore, EntityStore, ChangeStore, SessionStore, ProvenanceStore, and VerificationStore.
  • TieredGraph — tiered storage wrapper: hot in-memory graph over a configurable cold backend with configurable memory limits.
  • SnapshotManager — atomic snapshot persistence and swap.
  • GraphSnapshot / GraphSnapshotDelta — serializable full and incremental graph states for persistence and sync.
  • RetrievalQuery / unified_retrieve — unified BM25 + vector retrieval entry point with ranking policy applied above this layer.
  • MerkleHash / compute_repo_truth_hash — content-hash verification for tamper detection and citable proof.
  • CodeEmbedder — manages the background embedding worker and interfaces with kin-infer for on-device model inference.

Ecosystem

Repo Role
kin Semantic system of record — CLI, daemon, MCP server, projections
kin-vfs Transparent filesystem projection
kin-editor VS Code extension
kin-lsp Language-server enrichment boundary
kinlab Hosted collaboration and control plane

License

Apache-2.0. Part of the open Kin local substrate.

About

The semantic engine for Kin — graph storage, snapshots, indexing, text + vector search.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

5 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages