코드 검토 그래프: Claude Code 토큰 사용을 줄이는 영구 코드 그래프

hackernews | | 🔬 연구
#ai 딜 #claude #claude code #code graph #code review #performance #token optimization #gemini #review #tree-sitter #코드 리뷰 #코드베이스 #토큰 최적화 #코드 검토 #코드 그래프
원문 출처: hackernews · Genesis Park에서 요약 및 분석

요약

'code-review-graph'는 AI 코딩 도구가 작업 시 전체 코드베이스를 매번 재검토하여 발생하는 토큰 낭비 문제를 해결하기 위해 개발된 도구입니다. Tree-sitter을 활용해 코드를 구조적인 그래프로 파싱하여 저장하며, 파일 변경 시 '폭발 반경(Blast-radius)' 분석을 통해 영향을 받는 코드만 정확하게 추적해 필요한 문맥을 제공합니다. 초기 구축 후에는 변경된 파일만 증분 업데이트하므로 2초 내에 작업이 완료되며, SQLite 기반의 로컬 저장 방식을 채택해 외부 데이터베이스나 클라우드 의존성 없이도 안정적으로 실행됩니다. 또한 18개 프로그래밍 언어를 지원하고 Claude Code, Cursor 등 6개 주요 플랫폼의 환경설정을 자동 감지하여 간편하게 연동할 수 있습니다.

본문

Stop burning tokens. Start reviewing smarter. Claude Code re-reads your entire codebase on every task. code-review-graph fixes that. It builds a structural map of your code with Tree-sitter, tracks changes incrementally, and gives Claude precise context so it reads only what matters. pip install code-review-graph code-review-graph install # auto-detects and configures all supported platforms code-review-graph build # parse your codebase One command sets up everything. install detects which AI coding tools you have and writes the correct MCP configuration for each one. Restart your editor/tool after installing. To target a specific platform: code-review-graph install --platform cursor # configure only Cursor code-review-graph install --platform claude-code # configure only Claude Code Requires Python 3.10+ and uv. | Platform | Config file | Auto-detected | |---|---|---| | Claude Code | .mcp.json | Yes | | Cursor | .cursor/mcp.json | Yes | | Windsurf | .windsurf/mcp.json | Yes | | Zed | .zed/settings.json | Yes | | Continue | .continue/config.json | Yes | | OpenCode | .opencode/config.json | Yes | Then open your project and ask your AI assistant: Build the code review graph for this project The initial build takes ~10 seconds for a 500-file project. After that, the graph updates automatically on every file edit and git commit. Your repository is parsed into an AST with Tree-sitter, stored as a graph of nodes (functions, classes, imports) and edges (calls, inheritance, test coverage), then queried at review time to compute the minimal set of files Claude needs to read. Blast-radius analysis When a file changes, the graph traces every caller, dependent, and test that could be affected. This is the "blast radius" of the change. Claude reads only these files instead of scanning the whole project. Incremental updates in # Target a specific platform code-review-graph build # Parse entire codebase code-review-graph update # Incremental update (changed files only) code-review-graph status # Graph statistics code-review-graph watch # Auto-update on file changes code-review-graph visualize # Generate interactive HTML graph code-review-graph wiki # Generate markdown wiki from communities code-review-graph detect-changes # Risk-scored change impact analysis code-review-graph register # Register repo in multi-repo registry code-review-graph unregister # Remove repo from registry code-review-graph repos # List registered repositories code-review-graph eval # Run evaluation benchmarks code-review-graph serve # Start MCP server MCP tools Claude uses these automatically once the graph is built. | Tool | Description | |---|---| build_or_update_graph_tool | Build or incrementally update the graph | get_impact_radius_tool | Blast radius of changed files | get_review_context_tool | Token-optimised review context with structural summary | query_graph_tool | Callers, callees, tests, imports, inheritance queries | semantic_search_nodes_tool | Search code entities by name or meaning | embed_graph_tool | Compute vector embeddings for semantic search | list_graph_stats_tool | Graph size and health | get_docs_section_tool | Retrieve documentation sections | find_large_functions_tool | Find functions/classes exceeding a line-count threshold | list_flows_tool | List execution flows sorted by criticality | get_flow_tool | Get details of a single execution flow | get_affected_flows_tool | Find flows affected by changed files | list_communities_tool | List detected code communities | get_community_tool | Get details of a single community | get_architecture_overview_tool | Architecture overview from community structure | detect_changes_tool | Risk-scored change impact analysis for code review | refactor_tool | Rename preview, dead code detection, suggestions | apply_refactor_tool | Apply a previously previewed refactoring | generate_wiki_tool | Generate markdown wiki from communities | get_wiki_page_tool | Retrieve a specific wiki page | list_repos_tool | List registered repositories | cross_repo_search_tool | Search across all registered repositories | MCP Prompts (5 workflow templates): review_changes , architecture_map , debug_issue , onboard_developer , pre_merge_check | Feature | Details | |---|---| | Incremental updates | Re-parses only changed files. Subsequent updates complete in under 2 seconds. | | 18 languages | Python, TypeScript/TSX, JavaScript, Vue, Go, Rust, Java, Scala, C#, Ruby, Kotlin, Swift, PHP, Solidity, C/C++, Dart, R, Perl | | Blast-radius analysis | Shows exactly which functions, classes, and files are affected by any change | | Auto-update hooks | Graph updates on every file edit and git commit without manual intervention | | Semantic search | Optional vector embeddings via sentence-transformers, Google Gemini, or MiniMax | | Interactive visualisation | D3.js force-directed graph with edge-type toggles and search | | Local storage | SQLite file in .code-review-graph/ . No external database, no cloud dependency. | | Wa

Genesis Park 편집팀이 AI를 활용하여 작성한 분석입니다. 원문은 출처 링크를 통해 확인할 수 있습니다.

공유

관련 저널 읽기

전체 보기 →