Stop burning tokens. Start coding lean.

The knowledge graphto save tokens

Index your codebase once. LeanKG queries only what AI needs with targeted subgraph retrieval. Works with Claude, Cursor, OpenCode, Gemini, Codex, and more.

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

Fast Code Indexing

Parse and index your codebase with tree-sitter AST parsing. Extract functions, classes, imports, and call relationships automatically. Supports 158+ languages including Go, TypeScript, Python, Rust, Java, Kotlin, Bash, Ruby, PHP, Perl, R, and Elixir.

02

Semantic Search with Embeddings

Optional dense-vector retrieval with cross-encoder reranking for contextual code search. Build embedding indices with HNSW support. Query by intent rather than syntax patterns.

03

MCP Server Integration

Expose your knowledge graph via MCP protocol. Connect seamlessly with Claude, Cursor, OpenCode, Gemini, Kilo, Codex, and Google Antigravity. 40 MCP tools available.

AB
04

Auto-Trigger Session Hooks

Full lifecycle hooks inject LeanKG context into every AI session. Setup, SessionStart, PreToolUse, PostToolUse, and Stop hooks. Route search intents automatically.

05

Impact Radius & Blast Analysis

Compute code change impact radius before making changes. Build call graphs with IMPORTS, CALLS, and TESTED_BY edges. Classify risk as critical/high/medium/low.

AB
06

Obsidian Vault Sync

Push LeanKG data to Obsidian notes and pull annotations back. Watch vault for changes and auto-sync. Full bidirectional integration with your knowledge management system.

07

RTK Compression & REST API

Run shell commands with token-saving compression. Full REST API with auth and API key management. Docker support with RocksDB backend for teams.

Verified Benchmarks

The numbers speak
for themselves.

Unified A/B benchmark across 19 test cases spanning all LeanKG tools. 30% input token savings with 3x better token efficiency compared to grep-based code search.

MetricLeanKGWithout LeanKGWinner
Input Token Savings30.0%0%LeanKG
Token Efficiency (tokens/result)2.096.393x better
Latency (simple queries)20.4ms20.2msEqual
Latency (complex queries)8.9s34.9ms⚠️ Heavy
Throughput (Load test)~57.6K/secN/AInsert

Input Token Savings

30%

across all tools

Token Efficiency Gain

3x

better than grep

Load Throughput

57.6K/sec

element insertion

Why LeanKG

Side-by-side positioning against other local knowledge graph tools. Every figure comes from reproducible A/B benchmarks, not marketing copy.

40% Savings

Stop Burning Tokens

TOON format trims payloads by ~40%. 30% fewer input tokens and 3x better token efficiency compared to raw search.

85 vs 17

85 MCP Tools

The broadest atomic surface in the category. Competitors ship 1-17. Query with surgical precision instead of blunt grep.

Purpose-Built

Built for Scale

Android-aware (XML, Hilt, Room). Microservice topologies linked with postmortems. Procedural ontologies alongside code metadata.

When LeanKG Wins

  • You pay per token - let the graph optimize every retrieval
  • You ship Android - only LeanKG understands XML, Hilt, Room, Navigation
  • You run microservices - graph links services to postmortems
  • You need fine-grained tools - impact radius, call graphs, dead code detection

Competitive Strengths

  • codebase-memory-mcp: C/C++ indexing speed (Linux kernel in 3 min)
  • GitNexus: Zero-server browser (WebAssembly + LadybugDB)
  • graphify: Multi-modal (video, PDF, images)
  • codegraph: Swift/React Native bridges across 17 frameworks

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# Initialize LeanKG
2leankg init
3
4# Index your codebase
5leankg index ./src
6
7# Auto-index on changes
8leankg watch ./src
9
10# Status check
11leankg status
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