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.
Index once.
Query smarter.
Fast Code Indexing
Parse and index your entire codebase with tree-sitter and AST parsing. Extract functions, classes, imports, and call relationships automatically. Supports 12 languages: Go, TypeScript, Python, Rust, Java, Kotlin, Bash, Ruby, PHP, Perl, R, and Elixir.
MCP Server Integration
Expose your knowledge graph via MCP (Model Context Protocol). Connect seamlessly with Claude, Cursor, OpenCode, Gemini, Kilo, Codex, and Google Antigravity. AI tools query your graph instead of scanning the whole codebase.
Auto-Trigger Sessions
Session hooks inject LeanKG context into every AI tool session automatically. PreToolUse hooks route search intents to LeanKG tools. Token-optimized context without manual prompting.
Impact Radius Analysis
Compute blast radius before making changes. Build call graphs with IMPORTS, CALLS, and TESTED_BY edges. Understand exactly what your changes will affect.
WebGL Graph Visualization
Visualize your codebase's dependency graph with force-directed layout, WebGL rendering, and community clustering. Filter by element type, zoom, pan, and click nodes for details.
Obsidian Sync
Push LeanKG data to Obsidian notes and pull annotation edits back. Watch vault for changes and auto-sync. Keep your knowledge graph and notes in sync.
Local-First Architecture
Everything runs on your machine. Privacy-first, no cloud required. SQLite storage keeps your code private and secure. Zero external database connections.
Three simple steps.
Targeted context. Not full scans.
1# Initialize LeanKG2leankg init34# Index your codebase5leankg index ./src67# Auto-index on changes8leankg watch ./src910# Status check11leankg status
Works with your
favorite AI tools.
Official MCP integration. Supported by Claude, Cursor, OpenCode, and more.
One-line install for any AI tool: