Code-Review-Graph: AI Coding Tools için Local-First Kod Zeka Grafiği (23,686 GitHub Stars)
Deep dive into code-review-graph, the local-first code intelligence graph with 23,686 stars. Build a persistent map of your codebase so AI coding tools read only what matters — median 82x token reduction. Works with Claude Code, Cursor, Copilot & more via MCP.
Code-Review-Graph: AI Coding Tools için Local-First Kod Zeka Grafiği (23,686 GitHub Stars)
AI kodlama araçları her code review'da codebase'inizin büyük bölümlerini yeniden okumak zorunda kalıyor. Bu, gereksiz token tüketimi ve yavaş review süreçleri demek. Code-review-graph bu sorunu çözüyor: Tree-sitter ile kodunuzu yapısal bir haritaya dönüştürüyor, değişiklikleri incremental olarak takip ediyor ve AI asistanınıza sadece gerekli context'i MCP üzerinden veriyor.
Sonuç? Median 82x token azaltması (38x-528x arası), sub-2 second incremental updates ve lokal-first mimari. Bugün 1,833 yeni yıldızla GitHub Trending'in zirvesinde.
Problem: AI Coding Tools Neden Bu Kadar Token Yakıyor?
Claude Code, Cursor, Copilot veya Codex gibi AI coding tools, code review yaptığında genellikle naive bir yaklaşım kullanır: "tüm codebase'i oku ve relevant olanları bul". Bu yaklaşım:
- Token israfı: 500 dosyalık bir projede her review'da yüz binlerce token okunur
- Yavaşlık: Büyük monorepo'larda context window limitlerine takılır
- Gereksiz okumalar: Değişiklikle ilgisi olmayan dosyalar da context'e dahil edilir
- Tekrar: Her soruda aynı dosyaları yeniden okumak
Code-review-graph'ın çözümü: Yapısal kod grafiği. Codebase'inizi AST (Abstract Syntax Tree) olarak parse edip, fonksiyonlar, sınıflar, importlar ve call ilişkileri arasında bir graph oluşturuyor. Bir dosya değiştiğinde, graph o dosyanın "blast radius"ını hesaplıyor — yani o değişikliğin hangi fonksiyonları, sınıfları ve testleri etkileyebileceğini tespit ediyor.
Mimari: Tree-sitter → AST → Graph → MCP
1. Tree-sitter ile Parsing
Code-review-graph, Tree-sitter kullanarak kodunuzu AST'ye çevirir. Tree-sitter, incremental parsing yapan, hata toleranslı ve 100+ dil desteği olan bir parser generator.
# Basitleştirilmiş parsing akışı
def parse_file(filepath):
tree = tree_sitter.parse(filepath)
for node in tree.root_node.children:
if node.type in FUNCTION_NODE_TYPES:
graph.add_node(extract_function(node))
elif node.type in CLASS_NODE_TYPES:
graph.add_node(extract_class(node))
elif node.type in IMPORT_NODE_TYPES:
graph.add_edge(extract_import(node))
2. Graph Yapısı
Parse edilen kod, şu node ve edge türleriyle bir graph'a dönüştürülür:
Nodes:
- Functions (fonksiyonlar, metotlar)
- Classes (sınıflar, interfaceler)
- Imports (import statement'ları)
- Call sites (fonksiyon çağrıları)
- Tests (test fonksiyonları)
Edges:
- Calls (A fonksiyonu B'yi çağırıyor)
- Inheritance (A sınıfı B'den türemiş)
- Imports (A dosyası B'yi import ediyor)
- Test coverage (A testi B fonksiyonunu test ediyor)
3. Blast Radius Analizi
Bir dosya değiştiğinde, graph traversal ile o dosyanın "blast radius"ı hesaplanır:
changed_file.py
↓ (import edges)
caller_function()
↓ (call edges)
dependent_class.method()
↓ (test edges)
test_dependent_behavior()
Bu traversal, BFS (Breadth-First Search) veya DFS (Depth-First Search) ile yapılır ve configurable depth/token budget ile sınırlandırılabilir.
4. MCP (Model Context Protocol) Integration
Code-review-graph, MCP server olarak çalışır. Bu, Claude Code, Cursor, Cline, Copilot gibi AI araçlarının graph'ı doğrudan query edebileceği anlamına gelir:
{
"tool": "get_review_context",
"params": {
"commit_sha": "abc123",
"max_tokens": 3500
}
}
MCP server, değişen dosyaları tespit eder, blast radius'ı hesaplar ve sadece gerekli dosyaları context olarak döner.
82x Token Azaltması: Benchmark Sonuçları
Code-review-graph'ın iddiası sadece marketing değil — 6 gerçek open-source repo üzerinde benchmark yapılmış:
| Repo | Naive Corpus Tokens | Graph Query Tokens | Azaltma |
|---|---|---|---|
| fastapi | 951,071 | 2,169 | 528.4x |
| code-review-graph | 208,821 | 2,495 | 93.0x |
| gin | 166,868 | 1,990 | 91.8x |
| flask | 125,022 | 1,986 | 71.4x |
| express | 135,955 | 3,465 | 40.6x |
| httpx | 89,492 | 2,438 | 38.0x |
Median azaltma: ~82x (range: 38x-528x)
Önemli Not: 528x Maximum, Median Değil
Sıkça atıfta bulunulan 528x, fastapi için best-case scenario (en büyük corpus). Tipik sonuç 82x. Bu dürüstlük, projenin güvenilirliğini artırıyor.
Agent Baseline Karşılaştırması
Naive corpus baseline, hiçbir real agent'ın ödemediği bir upper bound. Competent bir agent grep ile identifier'ları bulur ve sadece en relevant dosyaları okur. Code-review-graph, bu realistic baseline'dan bile daha iyi performans gösteriyor.
Incremental Updates: Sub-2 Second Re-indexing
Code-review-graph'ın en güçlü özelliklerinden biri incremental updates. İlk build'den sonra, graph sadece değişen dosyaları re-parse eder:
# İlk build (500 dosya ~10 saniye)
code-review-graph build
# Incremental update (değişen dosyalar ~2 saniye)
code-review-graph update
Nasıl Çalışıyor?
- SHA-256 hash checks: Her dosyanın hash'i saklanır
- Diff detection: Sadece hash'i değişen dosyalar tespit edilir
- Selective re-parsing: Sadece değişen dosyalar re-parse edilir
- Graph update: Değişen node'lar ve edge'ler güncellenir
- Dependent tracking: Değişen dosyaların dependent'ları tespit edilir
2,900 dosyalık bir proje bile 2 saniyeden kısa sürede re-index edilebiliyor.
35+ Dil Desteği
Code-review-graph, Tree-sitter'ın geniş dil desteğini miras alıyor:
Ana diller:
- Python, JavaScript/TypeScript/TSX, Go, Rust, Java
- C/C++, C#, VB.NET, Ruby, Kotlin, Swift
- PHP, Scala, Solidity, Dart, R, Perl
- Lua/Luau, Objective-C, Shell scripts, Elixir
- Zig, PowerShell, Julia, ReScript, GDScript
- Nix, Verilog/SystemVerilog, SQL
Özel formatlar:
- Terraform/OpenTofu (.tf)
- Ansible playbooks/roles/tasks
- Vue/Svelte SFCs
- Astro files
- Jupyter/Databricks notebooks (.ipynb)
- Perl XS (.xs)
Custom Language Support
Eğer repo'nuz henüz desteklenmeyen bir dil kullanıyorsa, .code-review-graph/languages.toml ile custom language ekleyebilirsiniz:
[languages.erlang]
extensions = [".erl"]
grammar = "erlang"
function_node_types = ["function_clause"]
class_node_types = ["record_decl"]
import_node_types = ["import_attribute"]
call_node_types = ["call"]
No fork, no code changes — sadece config dosyası.
Framework-Aware Parsing: PHP/Laravel Örneği
Code-review-graph, sadece syntax'ı değil, framework-specific pattern'leri de anlıyor. PHP projeler için:
- Composer PSR-4 resolution: Repository-bounded import resolution
- Blade template references: Laravel Blade template'larının referansları
- Laravel Route-to-controller: Route definitions'dan controller'lara semantic edges
- Eloquent relationships: Model inheritance ve relationship edges
Bu, generic AST parsing'den çok daha zengin bir graph oluşturuyor.
GitHub Action: CI/CD Integration
Code-review-graph, composite GitHub Action olarak da çalışıyor. Her PR'da otomatik olarak:
- Graph build edilir (cache'lenir)
- Değişiklikler analiz edilir
- Risk-scored review comment post edilir
- Her push'ta comment update edilir (sticky comment)
# .github/workflows/code-review-graph.yml
on:
pull_request:
permissions:
contents: read
pull-requests: write
jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: tirth8205/code-review-graph@v2.3.6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Fail-on-risk: Optional merge gate — high-risk değişiklikler merge'i block edebilir.
Installation ve Usage
Quick Start
pip install code-review-graph
code-review-graph install # Auto-detects Claude Code, Cursor, Copilot, vb.
code-review-graph build # Parse codebase
install komutu:
- Hangi AI coding tools'un kurulu olduğunu tespit eder
- Her biri için doğru MCP config'ini yazar
- Platform-native hooks/skills kurar
- Graph-aware instructions'ı platform rules'a inject eder
Platform-Specific Installation
code-review-graph install --platform codex
code-review-graph install --platform cursor
code-review-graph install --platform claude-code
code-review-graph install --platform gemini-cli
code-review-graph install --platform kiro
code-review-graph install --platform copilot
code-review-graph install --platform copilot-cli
code-review-graph install --platform codebuddy
Uninstall
code-review-graph uninstall --dry-run # Preview
code-review-graph uninstall # Preview + confirmation
code-review-graph uninstall --yes # No prompt
code-review-graph uninstall --all-repos
Watch Mode
code-review-graph watch # Auto-update on file changes
File save'lerde ve commit hook'larda graph otomatik olarak güncellenir.
Advanced Features
Impact Accuracy: 0.71 F1 Score
Blast-radius analysis, graph-derived ground truth'a karşı 0.71 average F1 score elde ediyor:
| Repo | Commits | Avg F1 | Avg Precision | Recall |
|---|---|---|---|---|
| httpx | 2 | 0.864 | 0.786 | 1.0 |
| fastapi | 2 | 0.834 | 0.750 | 1.0 |
| code-review-graph | 2 | 0.734 | 0.584 | 1.0 |
| express | 2 | 0.667 | 0.500 | 1.0 |
| flask | 2 | 0.628 | 0.481 | 1.0 |
| gin | 3 | 0.609 | 0.439 | 1.0 |
Not: Recall 1.0, circular upper bound (ground truth, graph'ın kendisinden türetilmiş). Honest co-change mode (git history'den bağımsız evidence) da ölçülüyor ama henüz canonical stats'a eklenmemiş.
Semantic Search
Optional vector embeddings:
- sentence-transformers
- Google Gemini
- MiniMax
- Any OpenAI-compatible endpoint (Azure, new-api, LiteLLM, vLLM, LocalAI)
Interactive Visualization
code-review-graph visualize
D3.js force-directed graph ile:
- Search
- Community legend toggles
- Degree-scaled nodes
Export formats:
- GraphML (Gephi/yEd)
- Neo4j Cypher
- Obsidian vault with wikilinks
- SVG static graph
- JSON
Hub & Bridge Detection
Graph analysis ile:
- Hubs: En çok bağlantılı node'lar (betweenness centrality)
- Bridges: Architectural chokepoints
- Surprise scoring: Unexpected coupling (cross-community, cross-language, peripheral-to-hub edges)
Knowledge Gap Analysis
- Isolated nodes
- Untested hotspots
- Thin communities
- Structural weaknesses
Execution Flows
Entry point'lardan call chain'leri trace eder, weighted criticality'ye göre sıralar.
Community Detection
Leiden algorithm ile related code cluster'ları. Resolution scaling ile büyük graph'lar için optimize edilmiş.
Oversized communities (>25% of graph) otomatik olarak recursive split edilir.
Memory Loop
Q&A results'ı markdown olarak persist eder, graph query'lerden büyür.
Multi-Repo Registry
Birden fazla repo register edip, hepsinde cross-search yapabilirsiniz.
Multi-Repo Daemon
crg-daemon # Watches multiple repos with health checks and auto-restart
Performance Benchmarks
Build Performance
| Repo | Files | Nodes | Edges | Flow Detection | Search Latency |
|---|---|---|---|---|---|
| express | 141 | 1,910 | 17,553 | 106ms | 0.7ms |
| fastapi | 1,122 | 6,285 | 27,117 | 128ms | 1.5ms |
| flask | 83 | 1,446 | 7,974 | 95ms | 0.7ms |
| gin | 99 | 1,286 | 16,762 | 111ms | 0.5ms |
| httpx | 60 | 1,253 | 7,896 | 96ms | 0.4ms |
500 dosyalık bir proje için ilk build ~10 saniye. Incremental updates <2 saniye.
Limitations ve Trade-offs
1. Small Single-File Changes
Trivial edits için graph context, naive file read'den daha fazla olabilir. Overhead, structural metadata'dan geliyor.
2. Search Quality (MRR 0.35)
Keyword search, çoğu query için top-4'te doğru sonucu buluyor ama ranking iyileştirme bekliyor. Express queries, module-pattern naming yüzünden 0 hits döndürebiliyor.
3. Flow Detection (33% Recall)
Framework ve conventional entry patterns, Python ve PHP/Laravel için en güçlü. JavaScript ve Go flow detection geliştirilmeli.
4. Precision vs Recall Trade-off
Impact analysis deliberately conservative. Large dependency graph'larda bazı false positive'lar olabilir — ama miss etmekten iyidir.
Local-First ve Privacy
Code-review-graph tamamen local çalışır:
- SQLite file in
.code-review-graph/ - No external database
- No cloud service
- Source code hiçbir external service'e gönderilmez
GDPR/HIPAA compliance için ideal.
Comparison: Diğer Code Intelligence Tools
| Feature | Code-Review-Graph | GitHub Copilot | Cursor | Sourcegraph |
|---|---|---|---|---|
| Local-first | ✅ | ❌ | ❌ | ❌ |
| MCP support | ✅ | ✅ | ✅ | ❌ |
| Blast radius | ✅ | ❌ | ❌ | Partial |
| Incremental updates | ✅ | N/A | N/A | ✅ |
| Token optimization | 82x | N/A | N/A | N/A |
| Self-hosted | ✅ | ❌ | ❌ | ✅ |
| Open source | ✅ (MIT) | ❌ | ❌ | ✅ |
Use Cases
1. Large Monorepo Reviews
27,700+ dosyalık bir monorepo'da, graph sadece ~15 dosyayı context'e dahil eder. 27,685 dosya exclude edilir.
2. AI Agent Context Optimization
Claude Code, Cursor veya Copilot ile çalışırken, her query'de yüz binlerce token yerine sadece 2,000-3,500 token context alırsınız.
3. CI/CD Code Review
GitHub Action ile her PR'da otomatik risk-scored review. Merge gate olarak kullanılabilir.
4. Architecture Analysis
Hub/bridge detection ile architectural chokepoint'leri tespit edin. Surprise scoring ile unexpected coupling'leri bulun.
5. Onboarding
New team members için auto-generated architecture overview ve suggested questions.
İlgili CoddyKit Eğitimleri
Code-review-graph'ın teknolojilerini derinlemesine öğrenmek için:
- AI with Python — Python fundamentals ve AI/ML integration
- AI Agents — MCP, AI coding tools ve agent architecture
- TypeScript — MCP protocol understanding için
- Rust — Tree-sitter ve high-performance parsing
Sonuç: Neden 23,686 Stars?
Code-review-graph'ın bu kadar hızlı büyümesinin sebepleri:
- Gerçek problem çözüyor: AI coding tools'un token israfını 82x azaltıyor
- Dürüst benchmarking: 528x maximum, 82x median — hype değil, data
- Local-first: Privacy-focused, GDPR/HIPAA uyumlu
- Broad language support: 35+ dil, custom language config
- Easy integration: Tek komutla Claude Code, Cursor, Copilot setup
- Open source (MIT): Fork'la, customize et, self-host et
- Active development: v2.3.6, regular updates, responsive community
Bugün 1,833 yeni yıldızla GitHub Trending'in zirvesinde. AI coding tools kullanıyorsanız ve token faturanız canınızı sıkıyorsa, code-review-graph'ı denemek için iyi bir zaman.
Links
- GitHub: tirth8205/code-review-graph
- PyPI: code-review-graph
- Website: code-review-graph.com
- Discord: Community
- Docs: Usage, Commands, FAQ
GitHub Stars: 23,686 ⭐ | Forks: 2,297 | License: MIT | Language: Python | Created: February 2026
Bu yazı GitHub Trending'in 21 Temmuz 2026 tarihli verilerine dayanmaktadır.