Local-first code knowledge graph · Pre-index once · Serve precise subgraphs

AI coding agents needsurgical context

Pre-index your repo. Serve precise subgraphs over MCP to Cursor, Claude Code, OpenCode, and more — no cloud, no external database. Surgical context, fewer tool calls, blast-radius awareness, 100% local.

F1 Wincontext quality navigationA/B TEST
F1 Wincontext quality impact analysisA/B TEST
57K+elements/sec insert100K NODE TEST
418K+elements/sec retrieveLOAD TEST
345-461xcache speedupCOLD TO WARM
100%local executionNO CLOUD
12languages supportedGO TS PY RS
F1 Wincontext quality navigationA/B TEST
F1 Wincontext quality impact analysisA/B TEST
57K+elements/sec insert100K NODE TEST
418K+elements/sec retrieveLOAD TEST
345-461xcache speedupCOLD TO WARM
100%local executionNO CLOUD
12languages supportedGO TS PY RS
Capabilities

Index once.
Query smarter.

01

MCP-Native Server

85+ tools for search, impact analysis, call graphs, ontology, and architecture visualization. Works with Claude, Cursor, OpenCode, Gemini, and Kilo. Connect instantly—no configuration required.

02

Semantic + Keyword Search

HNSW embeddings for dense-vector retrieval with cross-encoder reranking. Keyword + semantic + ontology search in one query. Find code by intent, not just syntax.

03

Impact Radius Before You Change

Compute blast radius with confidence and severity ratings. Build call graphs with IMPORTS, CALLS, TESTED_BY, and HTTP edges. Know exactly what breaks.

AB
04

Procedural Ontology Auto-Update

Edit ontology/workflows.yaml while serving. Watcher auto-syncs so kg_trace_workflow returns corrected steps without restart. Source of truth YAML.

05

Local-First + Team Deploy

SQLite by default for individuals. Multi-project RocksDB for teams. Docker with embedded http MCP. 100% local execution—no cloud, no external database.

AB
06

Token-Aware Payloads

TOON responses compress subgraphs by ~40%. Targeted MCP payloads match AI token budgets. Precise context instead of full-file dumps.

07

Community Detection & Architecture

Leiden clustering with per-cluster skill context. Map team topology and service dependencies. Export as Mermaid, DOT, GraphML, or Neo4j.

Verified Benchmarks

The numbers speak
for themselves.

Vector-engine A/B gate (100 synthetic agent tasks). Unified agent A/B (19 cases vs grep baseline). Load test on ~100K nodes. Full methodology: docs/benchmark.md

MetricLeanKGWithout LeanKGWinner
Token Reduction−65.0%0%≥ 60% floor
Tool-Call Reduction−84.6%0%≥ 80% floor
Speedup2.50×≥ 2× floor
1M SQ8 ANN P95 Latency~0.055 msN/A< 50 ms
Insert Throughput~57K/sec100K nodes
Retrieve Throughput~419K/secCold → warm 345-461×

Token Reduction

−65%

synthetic agent workload

Tool-Call Reduction

−84.6%

fewer round-trips

Speedup

2.50×

vs grep baseline

Why LeanKG

LeanKG is built for AI agents in teams. MCP-native. Indexed once, served precise subgraphs. No cloud, no external database. Works with Claude, Cursor, OpenCode, Gemini, Kilo, Codex.

−84.6% Calls

Fewer Tool Calls, Surgical Context

Targeted subgraph retrieval instead of file-by-file search. −84.6% fewer tool calls. TOON payloads ~40% smaller. Your AI gets exactly what it needs.

85 Tools

85 MCP Tools, Always Fresh

Search, impact radius, call graphs, ontology, architecture. Procedural workflow auto-sync. Watcher mode keeps graph live as code changes.

100% Local

Local-First, No Cloud Lock-In

SQLite for individuals. RocksDB for teams. Docker with HTTP MCP. 100% local execution. Multi-repo support with zero external databases.

Why Choose LeanKG

  • You pay per token - −65% token reduction, −84.6% tool calls
  • You use Claude, Cursor, OpenCode, Gemini, Kilo - instant MCP setup
  • You need impact radius before shipping - blast-radius analysis with confidence
  • You want local-first no cloud lock-in - SQLite, RocksDB, Docker

Built on Proven Tech

  • Language Support: Rust, Go, C/C++, Java, Kotlin, TypeScript, Python, Ruby, PHP, Dart, Terraform, YAML
  • Storage: Rust + CozoDB + tree-sitter. SQLite or RocksDB backend
  • Protocol: MCP stdio (editor agents) or MCP HTTP (Docker, teams)
  • Deployment: Binary, Docker, or build-from-source. All open-source

Feature Comparison

ToolMCP ToolsToken FormatAndroidMicroservicesProcedural
LeanKG85TOON
codebase-memory-mcp15Standard
GitNexus17Standard
graphifyStdBudget
codegraph1Standard

Built on proven tech

Rust + CozoDB + tree-sitter. Local-first. No SaaS lock-in. Runs as an MCP HTTP server on :9699 or over stdio.

cargo install leankg --release
leankg init
leankg index ./src
leankg serve
Language Support

Works with your
entire codebase.

Full semantic type resolution for Python, TypeScript, Go, Rust, Java, Kotlin, C#, PHP, and C/C++. Syntactic parsing for 158+ languages.

Python

Full

Imports, dataclasses, generics, @property, async/await, Pydantic

TypeScript/JavaScript

Full

Generics, JSX, JSDoc inference, .d.ts, re-exports, method chaining

Go

Full

Generics, embedded structs, interface satisfaction, package resolution

Rust

Full

use declarations, impl blocks, generics, trait bounds, UFCS, std prelude

Java

Full

Imports, class hierarchies, generics, annotations, lambdas, JDK stdlib

Kotlin

Full

Classes, objects, extensions, data classes, scope functions, stdlib

C#

Full

Global usings, records, LINQ, async Task, generics, BCL stdlib

PHP

Full

Namespaces, traits, late-static-binding, PHPDoc inference

C/C++

Full

Macros, typedef chains, templates, namespaces, auto inference

+ 149 more

Syntax

Tree-sitter parsing support for all major languages

Why multiple language levels?

Full support means semantic type resolution powered by Hybrid LSP — the graph understands imports, generics, inheritance, and stdlib types just like an IDE would. Syntax support means tree-sitter parsing captures structure and declarations. Both give you accurate call graphs and dependency tracking.

Process

Three simple steps.
Targeted context. Not full scans.

~/leankg
● leanv0.15
1# macOS / Linux
2curl -fsSL https://raw.githubusercontent.com/FreePeak/LeanKG/main/scripts/install.sh | bash -s -- cursor
3
4# Or for Claude Code
5bash -s -- claude
6
7# For teams / Docker
8bash -s -- docker
Ready
57K+ elements/sec
Integrations

85 MCP tools.
The broadest surface.

More atomic tools than any competitor (1-17). Query with surgical precision instead of blunt grep. Works with Claude, Cursor, OpenCode, Gemini, and more.

Claude Code
AI Tool
Cursor IDE
AI Tool
OpenCode AI
AI Tool
Gemini CLI
AI Tool
Kilo Code
AI Tool
Codex
AI Tool
Google Antigravity
AI Tool
Obsidian
Notes
Docker
Deployment
Tree-Sitter
Parser
RocksDB
Database
MCP Protocol
Standard
GitHub
Repository
Claude Code
AI Tool
Cursor IDE
AI Tool
OpenCode AI
AI Tool
Gemini CLI
AI Tool
Kilo Code
AI Tool
Codex
AI Tool
Google Antigravity
AI Tool
Obsidian
Notes
Docker
Deployment
Tree-Sitter
Parser
RocksDB
Database
MCP Protocol
Standard
GitHub
Repository
GitHub
Repository
MCP Protocol
Standard
RocksDB
Database
Tree-Sitter
Parser
Docker
Deployment
Obsidian
Notes
Google Antigravity
AI Tool
Codex
AI Tool
Kilo Code
AI Tool
Gemini CLI
AI Tool
OpenCode AI
AI Tool
Cursor IDE
AI Tool
Claude Code
AI Tool
GitHub
Repository
MCP Protocol
Standard
RocksDB
Database
Tree-Sitter
Parser
Docker
Deployment
Obsidian
Notes
Google Antigravity
AI Tool
Codex
AI Tool
Kilo Code
AI Tool
Gemini CLI
AI Tool
OpenCode AI
AI Tool
Cursor IDE
AI Tool
Claude Code
AI Tool

One-line install for any AI tool:

curl -fsSL https://raw.githubusercontent.com/FreePeak/LeanKG/main/scripts/install.sh | bash -s -- claude
curl -fsSL https://raw.githubusercontent.com/FreePeak/LeanKG/main/scripts/install.sh | bash -s -- cursor
curl -fsSL https://raw.githubusercontent.com/FreePeak/LeanKG/main/scripts/install.sh | bash -s -- opencode
curl -fsSL https://raw.githubusercontent.com/FreePeak/LeanKG/main/scripts/install.sh | bash -s -- gemini
curl -fsSL https://raw.githubusercontent.com/FreePeak/LeanKG/main/scripts/install.sh | bash -s -- kilo
curl -fsSL https://raw.githubusercontent.com/FreePeak/LeanKG/main/scripts/install.sh | bash -s -- antigravity
docker compose -f docker-compose.rocksdb.yml up
curl -fsSL https://raw.githubusercontent.com/FreePeak/LeanKG/main/scripts/install.sh | bash -s -- update