LeanKG
LeanKG
Leichter Knowledge Graph für KI-gestützte Entwicklung
LeanKG ist ein Local-First Knowledge Graph, der KI-Programmiertools präzisen Kontext zur Codebasis liefert. Er indiziert Ihren Code, erstellt Abhängigkeitsgraphen und stellt einen MCP-Server bereit, sodass Tools wie Cursor, OpenCode und Claude Code den Knowledge Graph direkt abfragen können. Keine Cloud-Dienste, keine externen Datenbanken.
Wie LeanKG hilft
graph LR
subgraph "Without LeanKG"
A1[AI Tool] -->|Scans entire codebase| B1[10,000+ tokens]
B1 --> A1
end
subgraph "With LeanKG"
A2[AI Tool] -->|13-42 tokens| C[LeanKG Graph]
C -->|Targeted subgraph| A2
endOhne LeanKG: Die KI scannt die gesamte Codebasis (~10.000+ Token). Mit LeanKG: Die KI fragt den Knowledge Graph nach gezieltem Kontext ab (13-42 Token). 98% Token-Einsparung bei der Auswirkungsanalyse.
Installation
Einzeilige Installation (Empfohlen)
curl -fsSL https://raw.githubusercontent.com/FreePeak/LeanKG/main/scripts/install.sh | bash -s -- <target>Unterstützte Ziele:
Ziel | KI-Tool | Automatisch installiert |
| OpenCode AI | Binary + MCP + Plugin + Skill + AGENTS.md |
| Cursor AI | Binary + MCP + Skill + AGENTS.md + Session Hook |
| Claude Code | Binary + MCP + Plugin + Skill + CLAUDE.md + Session Hook |
| Gemini CLI | Binary + MCP + Skill + GEMINI.md |
| Kilo Code | Binary + MCP + Skill + AGENTS.md |
| Google Antigravity | Binary + MCP + Skill + GEMINI.md |
Beispiele:
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 -- claudeInstallation via Cargo oder Build aus dem Quellcode
cargo install leankg && leankg --versiongit clone https://github.com/FreePeak/LeanKG.git && cd LeanKG && cargo build --releaseSchnellstart
leankg init # Initialize LeanKG in your project
leankg index ./src # Index your codebase
leankg watch ./src # Auto-index on file changes
leankg impact src/main.rs --depth 3 # Calculate blast radius
leankg status # Check index status
leankg metrics # View token savings
leankg web # Start Web UI at http://localhost:8080Siehe docs/cli-reference.md für alle Befehle.
Highlights
Auto-Init -- Das Installationsskript konfiguriert MCP, Regeln, Skills und Hooks automatisch
Auto-Trigger -- Session-Hooks injizieren LeanKG-Kontext in jede KI-Tool-Sitzung
Token-effizient -- 13-42 Token pro Abfrage gegenüber 10.000+ bei einem vollständigen Scan der Codebasis
Token-Einsparung -- Bis zu 98% Token-Reduzierung bei der Auswirkungsanalyse
Auswirkungsradius -- Berechnen Sie den "Blast Radius", bevor Sie Änderungen vornehmen
Abhängigkeitsgraph -- Erstellen Sie Aufrufgraphen mit
IMPORTS-,CALLS-,TESTED_BY-KantenMCP-Server -- Stellen Sie den Graphen über das MCP-Protokoll für die Integration in KI-Tools bereit
Mehrsprachig -- Indizieren Sie Go, TypeScript, Python, Rust, Java, Kotlin mit tree-sitter
Siehe docs/architecture.md für Details zum Systemdesign und Datenmodell.
Unterstützte KI-Tools
Tool | Auto-Setup | Session Hook | Plugin |
Cursor | Ja | session-start | - |
Claude Code | Ja | session-start | Ja |
OpenCode | Ja | - | Ja |
Kilo Code | Ja | - | - |
Gemini CLI | Ja | - | - |
Google Antigravity | Ja | - | - |
Codex | Ja | - | - |
Hinweis: Cursor erfordert eine projektbezogene Installation. Die KI-Funktionen arbeiten auf Basis einzelner Workspaces, daher sollte LeanKG in jedem Projektverzeichnis installiert werden, in dem Sie eine KI-Kontextinjektion wünschen.
Siehe docs/agentic-instructions.md für eine detaillierte Einrichtung und das Verhalten des Auto-Triggers.
Web-UI
leankg web --port 9000Visualisieren Sie Ihren Knowledge Graph mit kraftbasiertem Layout, WebGL-Rendering und Community-Clustering.

Siehe docs/web-ui.md für weitere Funktionen.
Kontext-Metriken
Verfolgen Sie Token-Einsparungen, um die Effizienz von LeanKG zu verstehen.
leankg metrics --json # View with JSON output
leankg metrics --since 7d # Filter by time
leankg metrics --tool search_code # Filter by toolSiehe docs/metrics.md für Schema und Beispiele.
Update
# Check current version
leankg version
# Update LeanKG binary via install script
curl -fsSL https://raw.githubusercontent.com/FreePeak/LeanKG/main/scripts/install.sh | bash -s -- updateLive-Demo
Probieren Sie LeanKG ohne Installation aus: https://leankg.onrender.com
Dokumentation
Dokument | Beschreibung |
Alle CLI-Befehle | |
Referenz der MCP-Tools | |
Einrichtung von KI-Tools & Auto-Trigger | |
Systemdesign, Datenmodell | |
Web-UI-Funktionen | |
Metriken-Schema & Beispiele | |
Performance-Benchmarks | |
Feature-Planung | |
Tech-Stack & Struktur |
Anforderungen
Rust 1.70+
macOS oder Linux
Lizenz
MIT
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/FreePeak/LeanKG'
If you have feedback or need assistance with the MCP directory API, please join our Discord server