

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
1# CLAUDE.md - Project Context for Claude Code23## Project Overview45**code-review-graph** is a persistent, incrementally updated, local-first knowledge graph for token-efficient code review through MCP and the CLI. It parses codebases using Tree-sitter and targeted fallbacks, builds a structural graph in SQLite, and exposes compact context to AI coding tools including Claude Code, Codex, Cursor, Windsurf, Zed, Continue, OpenCode, Gemini CLI, Qwen, Kiro, Qoder, and GitHub Copilot.67## Graph Tool Usage (Token-Efficient)8When using code-review-graph MCP tools, follow these rules:91. First call: `get_minimal_context(task="<description>")` — costs ~100 tokens, gives you the full picture.102. All subsequent calls: use `detail_level="minimal"` unless you need more.113. Prefer `query_graph_tool` with a specific target over broad `list_*` calls.124. The `next_tool_suggestions` field in every response tells you the optimal next step.135. Target: ≤5 tool calls per task, ≤800 total tokens of graph context.1415## Architecture1617- **Core Package**: `code_review_graph/` (Python 3.10+)18 - `parser.py` — Tree-sitter multi-language AST parser plus targeted fallbacks for broad source-language and notebook support19 - `custom_languages.py` — Config-driven custom language support (`.code-review-graph/languages.toml`, see docs/CUSTOM_LANGUAGES.md)20 - `graph.py` — SQLite-backed graph store (nodes, edges, weighted-score impact analysis)21 - `tools/` — 30 MCP tool implementations split by domain22 - `main.py` — FastMCP server entry point, registers 30 tools + 5 prompts23 - `incremental.py` — Git-based change detection, file watching24 - `embeddings.py` — Optional vector embeddings (local sentence-transformers, OpenAI-compatible endpoints, Google Gemini, MiniMax)25 - `visualization.py` — D3.js interactive HTML graph generator26 - `cli.py` — CLI entry point (install/init, build, update, postprocess, embed, watch, status, visualize, serve/mcp, wiki, detect-changes, register, unregister, repos, eval, daemon)27 - `flows.py` — Execution flow detection and criticality scoring28 - `communities.py` — Community detection (Leiden algorithm or file-based grouping) and architecture overview29 - `search.py` — FTS5 hybrid search (keyword + vector)30 - `changes.py` — Risk-scored change impact analysis (detect-changes)31 - `refactor.py` — Rename preview, dead code detection, refactoring suggestions32 - `hints.py` — Review hint generation33 - `prompts.py` — 5 MCP prompt templates (review_changes, architecture_map, debug_issue, onboard_developer, pre_merge_check)34 - `wiki.py` — Markdown wiki generation from community structure35 - `skills.py` — Multi-platform install/config generation and shipped skill metadata36 - `registry.py` — Multi-repo registry helpers37 - `migrations.py` — Database schema migrations (v1-v9)38 - `tsconfig_resolver.py` — TypeScript path alias resolution3940- **VS Code Extension**: `code-review-graph-vscode/` (TypeScript)41 - Separate subproject with its own `package.json`, `tsconfig.json`42 - Reads from `.code-review-graph/graph.db` via SQLite4344- **Database**: `.code-review-graph/graph.db` (SQLite, WAL mode)4546## Key Commands4748```bash49# Development50uv run pytest tests/ --tb=short -q # Run tests51uv run ruff check code_review_graph/ # Lint52uv run mypy code_review_graph/ --ignore-missing-imports --no-strict-optional5354# Build & test55uv run code-review-graph build # Full graph build56uv run code-review-graph update # Incremental update57uv run code-review-graph status # Show stats58uv run code-review-graph serve # Start MCP server59uv run code-review-graph wiki # Generate markdown wiki60uv run code-review-graph detect-changes # Risk-scored change analysis61uv run code-review-graph register <path> # Register repo in multi-repo registry62uv run code-review-graph repos # List registered repos63uv run code-review-graph eval # Run evaluation benchmarks64```6566## Code Conventions6768- **Line length**: 100 chars (ruff)69- **Python target**: 3.10+70- **SQL**: Always use parameterized queries (`?` placeholders), never f-string values71- **Error handling**: Catch specific exceptions, log with `logger.warning/error`72- **Thread safety**: `threading.Lock` for shared caches, `check_same_thread=False` for SQLite73- **Node names**: Always sanitize via `_sanitize_name()` before returning to MCP clients74- **File reads**: Read bytes once, hash, then parse (TOCTOU-safe pattern)7576## Security Invariants7778- No `eval()`, `exec()`, `pickle`, or `yaml.unsafe_load()`79- No `shell=True` in subprocess calls80- `_validate_repo_root()` prevents path traversal via repo_root parameter81- `_sanitize_name()` strips control characters, caps at 256 chars (prompt injection defense)82- `escH()` in visualization escapes HTML entities including quotes and backticks83- SRI hash on D3.js CDN script tag84- API keys only from environment variables, never hardcoded8586## Test Structure8788- `tests/test_parser.py` — Parser correctness, cross-file resolution89- `tests/test_graph.py` — Graph CRUD, stats, impact radius90- `tests/test_tools.py` — MCP tool integration tests91- `tests/test_visualization.py` — Export, HTML generation, C++ resolution92- `tests/test_incremental.py` — Build, update, migration, git ops93- `tests/test_multilang.py` — Broad language parsing tests, including SFCs, notebooks, SQL, Perl XS, and modern systems/web languages94- `tests/test_custom_languages.py` — Config-driven custom languages (languages.toml loader + end-to-end Erlang parse)95- `tests/test_embeddings.py` — Vector encode/decode, similarity, store96- `tests/test_flows.py` — Execution flow detection and criticality97- `tests/test_communities.py` — Community detection, architecture overview98- `tests/test_changes.py` — Risk-scored change analysis99- `tests/test_refactor.py` — Rename preview, dead code, suggestions100- `tests/test_search.py` — FTS5 hybrid search101- `tests/test_hints.py` — Review hint generation102- `tests/test_prompts.py` — MCP prompt template tests103- `tests/test_wiki.py` — Wiki generation104- `tests/test_context_savings.py` — Estimated context-savings metadata105- `tests/test_skills.py` — Install/config generation and shipped skill metadata106- `tests/test_registry.py` — Multi-repo registry107- `tests/test_migrations.py` — Database migrations108- `tests/test_eval.py` — Evaluation framework109- `tests/test_tsconfig_resolver.py` — TypeScript path resolution110- `tests/test_integration_v2.py` — v2 pipeline integration test111- `tests/test_action_render.py` — GitHub Action PR comment renderer (`scripts/render_pr_comment.py`)112- `tests/fixtures/` — Sample files for each supported language113114## CI Pipeline115116- **lint**: ruff on Python 3.10117- **type-check**: mypy118- **security**: bandit scan119- **test**: pytest matrix (3.10, 3.11, 3.12, 3.13) with 65% coverage minimum120121122<!-- BEGIN BEADS INTEGRATION v:1 profile:minimal hash:ca08a54f -->123## Beads Issue Tracker124125This project uses **bd (beads)** for issue tracking. Run `bd prime` to see full workflow context and commands.126127### Quick Reference128129```bash130bd ready # Find available work131bd show <id> # View issue details132bd update <id> --claim # Claim work133bd close <id> # Complete work134```135136### Rules137138- Use `bd` for ALL task tracking — do NOT use TodoWrite, TaskCreate, or markdown TODO lists139- Run `bd prime` for detailed command reference and session close protocol140- Use `bd remember` for persistent knowledge — do NOT use MEMORY.md files141142## Session Completion143144**When ending a work session**, you MUST complete ALL steps below. Work is NOT complete until `git push` succeeds.145146**MANDATORY WORKFLOW:**1471481. **File issues for remaining work** - Create issues for anything that needs follow-up1492. **Run quality gates** (if code changed) - Tests, linters, builds1503. **Update issue status** - Close finished work, update in-progress items1514. **PUSH TO REMOTE** - This is MANDATORY:152```bash153 git pull --rebase154 bd dolt push155 git push156 git status # MUST show "up to date with origin"157```1585. **Clean up** - Clear stashes, prune remote branches1596. **Verify** - All changes committed AND pushed1607. **Hand off** - Provide context for next session161162**CRITICAL RULES:**163- Work is NOT complete until `git push` succeeds164- NEVER stop before pushing - that leaves work stranded locally165- NEVER say "ready to push when you are" - YOU must push166- If push fails, resolve and retry until it succeeds167<!-- END BEADS INTEGRATION -->168169<!-- code-review-graph MCP tools -->170## MCP Tools: code-review-graph171172**IMPORTANT: This project has a knowledge graph. ALWAYS use the173code-review-graph MCP tools BEFORE using Grep/Glob/Read to explore174the codebase.** The graph is faster, cheaper (fewer tokens), and gives175you structural context (callers, dependents, test coverage) that file176scanning cannot.177178### When to use graph tools FIRST179180- **Exploring code**: `semantic_search_nodes_tool` or `query_graph_tool` instead of Grep181- **Understanding impact**: `get_impact_radius_tool` instead of manually tracing imports182- **Code review**: `detect_changes_tool` + `get_review_context_tool` instead of reading entire files183- **Finding relationships**: `query_graph_tool` with callers_of/callees_of/imports_of/tests_for184- **Architecture questions**: `get_architecture_overview_tool` + `list_communities_tool`185186Fall back to Grep/Glob/Read **only** when the graph doesn't cover what you need.187188### Key Tools189190| Tool | Use when |191|------|----------|192| `detect_changes_tool` | Reviewing code changes — gives risk-scored analysis |193| `get_review_context_tool` | Need source snippets for review — token-efficient |194| `get_impact_radius_tool` | Understanding blast radius of a change |195| `get_affected_flows_tool` | Finding which execution paths are impacted |196| `query_graph_tool` | Tracing callers, callees, imports, tests, dependencies |197| `semantic_search_nodes_tool` | Finding functions/classes by name or keyword |198| `get_architecture_overview_tool` | Understanding high-level codebase structure |199| `refactor_tool` | Planning renames, finding dead code |200201### Workflow2022031. The graph auto-updates on file changes (via hooks).2042. Use `detect_changes_tool` for code review.2053. Use `get_affected_flows_tool` to understand impact.2064. Use `query_graph_tool` pattern="tests_for" to check coverage.207
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| tirth8205/code-review-graph.github/copilot-instructions.md · 30k | Copilot instructions | testing-strategygitagent-behaviour | 39/100 | 13 days ago | |
| tirth8205/code-review-graphGEMINI.md · 30k | GEMINI.md | testing-strategygitagent-behaviour | 39/100 | 13 days ago | |
| tirth8205/code-review-graphAGENTS.md · 30k | AGENTS.md | styletesting-strategygitdo-not+1 | 80/100 | 13 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| bagisto/bagistoCLAUDE.md · 28k | CLAUDE.md | setupbuildteststyle+5 | 100/100 | 7 days ago | |
| Adit-Jain-srm/NightmareNetCLAUDE.md · 46 | CLAUDE.md | buildtestlint-formatstyle+6 | 100/100 | 14 days ago | |
| nimbalyst/nimbalystpackages/android/CLAUDE.md · 1.5k | CLAUDE.md | setupbuildstylearch+2 | 100/100 | 14 days ago | |
| microsoft/playwrightCLAUDE.md · 95k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 7 days ago | |
| dotCMS/corecore-web/CLAUDE.md · 949 | CLAUDE.md | teststylearchtesting-strategy+3 | 100/100 | 14 days ago | |
| tphakala/birdnet-goCLAUDE.md · 1.6k | CLAUDE.md | buildtestlint-formatstyle+8 | 100/100 | today | |
| tyrchen/geektime-bootcamp-aiw7/genslides/backend/CLAUDE.md · 230 | CLAUDE.md | testlint-formatstylearch+6 | 100/100 | 9 days ago | |
| dotCMS/coreCLAUDE.md · 949 | CLAUDE.md | setupbuildteststyle+7 | 99/100 | today |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/tirth8205-code-review-graph-claude)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.