Token-efficient code review knowledge graph: semantic and call-graph resolution.
pip install n24q02m-crg==3.37.0b1
Knowledge graph for token-efficient code reviews -- semantic and call-graph resolution across your codebase.
Renamed: repo is crg , PyPI distribution is n24q02m-crg (formerly better-code-review-graph , kept as a legacy command alias) — CLI-first ( crg command); MCP server is a secondary surface.
Renamed: repo is crg , PyPI distribution is n24q02m-crg (formerly better-code-review-graph , kept as a legacy command alias) — CLI-first ( crg command); MCP server is a secondary surface.
mcp-name: io.github.n24q02m/crg
An MCP server that parses your codebase with Tree-sitter , builds a structural graph of functions/classes/imports, and gives Claude (or any MCP client) precise context so it reads only what matters instead of the whole tree. Semantic runs through the local ONNX model registry from fastretrieval by default (zero config, no API key), with an optional cloud embedding chain. Fork of code-review-graph with fixed multi-word , qualified call resolution, dual-mode embeddings, output pagination, and production CI/CD.
v2.0 migration (BREAKING)
v2.0 adds temporal columns ( valid_from_sha / valid_to_sha on every node + edge) and an opt-in security scanner. The schema migration is auto-applied on first GraphStore open, and a backup of the pre-2.0 DB is saved to .pre-2.0.bak so you can roll back. See BREAKING_CHANGES.md for the full schema-change list, behavior changes, environment requirements, and the downgrade procedure ( CRG_DOWNGRADE_TO_1_X=1 uv run crg ).
v2.0 migration (BREAKING)
Migration & changelog
For OMP and other local coding harnesses, the primary surface is the package CLI plus the bundled skills/ workflows. The skills invoke the CLI directly and do not require an MCP server mapping.
The optional Semgrep engine for deeper security scans uses the semgrep CLI on PATH . Semgrep is not a crg dependency (its releases pin dependencies that conflict with crg's), so install it in its own environment:
MCP stdio remains a secondary protocol adapter for clients that require it:
Install matrix (stdio unless noted; the CLI-first usage above stays the primary surface):
Install with an AI agent -- paste this to your AI coding agent:
Install MCP server crg following the steps at
Install MCP server crg following the steps at
Full CLI usage is in CLI . Optional per-client MCP setup is at docs.n24q02m.com/plugins/servers/crg/setup/ .
Two ways to run the server, plus the surfaces to consume it.
Dev: uv, no auth (loopback only)
Always-on: docker (token auth)
The compose file builds the Dockerfile's http target (image crg:http ), publishes the container on host loopback only ( 127.0.0.1:${CRG_PORT:-8772}:8080 ), and mounts ./docker-config/config.toml read-only at the container's config dir ( CRG_CONFIG_DIR=/data/config ); graph state persists in the crg-data named volume. All state stays on your machine.
Consuming: CLI or MCP
CLI (local graphs, no server needed):
MCP over HTTP (remote/always-on): point any MCP client at with Authorization: Bearer :
Per-task model configuration
Each task (embed / rerank / chat / jev_score) resolves its own OpenAI-spec provider cell from [models. ] in the instance config: an independent base_url + api_key + model . Cloud or local is purely a config choice — point base_url at OpenRouter, a vendor, or your own local gateway (e.g. ). API keys are host-only material: keep them in config.toml (gitignored under docker-config/ ) or supply via HULL_ _API_KEY env; they are never end-user supplied.
Keys live in hull's provider credential pool ( ~/.hull/hull.db , sealed by hull's crypto), so a provider can hold several keys and named accounts. Every provider call rotates: 401/403 disables the key, 429 cools it down for the provider's Retry-After , 5xx retries once, and a pool that is fully disabled or cooling raises a redacted error carrying the remaining cooldown. An existing single key keeps working unchanged — it is migrated into the pool on first use, and the env var / config.toml value is never modified. Two optional keys per cell select the pool:
Additional keys and accounts are added through hull_core.credentials ( CredentialStore.add_credential , CredentialStore.accounts().add ), and config(action="setup_status") reports which tasks are configured without ever printing a key.
CRG is local-first for coding workflows:
CLI and bundled Skills are the primary surfaces for graph build/query, impact analysis, review context, security scans, and repository onboarding.
MCP stdio is the secondary protocol adapter over the same local domain services; it does not maintain a separate graph implementation.
Graph state stays in /.crg/graph.db unless an explicit multi-user/self-host configuration selects another data directory.
PyPI, CI, security scanning, GitHub releases, and eligible stable MCP Registry publication remain active. Historical public OCI tags are retained, but new public Docker Hub/GHCR images are no longer published.
CRG has no hosted Cloudflare runtime in the target topology.
The repo ships a smithery.yaml so the server can be built and run through Smithery . It deploys over stdio and needs no startup configuration -- the config schema is empty. Optional cloud embedding/summary keys stay host-owned: they come from the [models.*] cells of the instance config or HULL_ _API_KEY env (see Configuration below). The launch command is the same uvx invocation as a local install:
Everything works out of the box with zero configuration -- semantic uses the local ONNX registry from fastretrieval ( Qwen3-Embedding-0.6B is the current built-in reference entry, ~570 MB downloaded on first graph embed ). This reference entry is not a Qwen-only boundary: any built-in registry ID or valid non-Qwen artifact manifest follows the same resolver. All environment variables below are optional and only needed for cloud embeddings, LLM summaries, or an explicit BYO local artifact.
Embeddings select the first provider/model entry in EMBEDDING_MODELS ; later entries are retained as configuration but are not runtime fallbacks. The summary model comes from the model field of the [models.chat] cell (an unconfigured cell disables summaries). Transport always comes from the per-task [models. ] cell (OpenRouter pre-wired default) — model-name prefixes only select wire details, never keys.
Cohere embed-v4.0 and Voyage voyage-4-lite request and store 1024 dimensions ; other backends retain 768-dimensional storage. CRG never slices, pads, or silently accepts a different provider width. The embedding row's model and stored dimension must match before reuse. Run graph(action="embed") after changing models or upgrading an old 768-wide Cohere index. Searches reject incompatible widths before a provider call; graph nodes are retained and re-embedding replaces only stale vectors.
Vectors are stored as int8 with one scale per vector ( max|x| / 127 ), a quarter of the float32 payload. keeps the query in float32 and scores cosine against the stored codes, which differs from exact float32 cosine by under 0.01 (measured worst case 0.006 on 5,000 vectors with dominant channels). A graph.db written by an earlier release still opens: its float32 vectors are converted to int8 in place, in one transaction, the first time the embedding store opens it, and the format is recorded under the embedding_vector_format metadata key. A failed conversion rolls back and leaves every float32 vector searchable. SQLite reuses the freed pages for new rows; run sqlite3 .crg/graph.db "VACUUM" while no CRG process has the database open to shrink the file itself. Measured sizes are in docs/BENCHMARKS.md .
The key lives in the per-task cell's api_key (host-only; see the table below). Keys alone never select models: an empty embedding chain stays local, and an empty summary chain stays disabled. A configured cloud error does not fall back to local or another provider. Summarizers require a chat-completion model.
Every credential is served from hull's provider key pool (see Per-task model configuration ): one pool per provider, rotated per call, with named accounts selectable per cell.
Vendor-specific key env vars ( JINA_AI_API_KEY , GEMINI_API_KEY , OPENAI_API_KEY , GOOGLE_VERTEX_EXPRESS_API_KEY , …) are not read by crg; the removed per-vendor dispatch lived in the pre-de-host stack.
When LOCAL_RERANK_MODEL is configured, semantic vector retrieves a bounded candidate pool of min(max(limit * 4, limit), 100) rows, applies the existing kind , repo , and live-row filters, then reranks that pool and returns at most limit rows. The response uses search_mode="semantic_reranked" and adds rerank_score while preserving similarity_score . Blank keeps the existing limit * 2 vector path and search_mode="semantic" . Configured reranker failures return an explicit error; CRG does not silently fall back to vector or keyword results. Keyword searches, including as_of snapshots, do not invoke the reranker.
Example -- cloud embeddings + summaries
~/.crg/config.toml (write by hand, or start from crg config init which pre-wires OpenRouter defaults):
Equivalent env surface for the MCP server entry (keys override the cells; model names still come from EMBEDDING_MODELS / the model field):
Cohere embedding is paid. Authorize a bounded budget before a live index/query; the Minimax-free completion choice does not make embeddings free. Model-name prefixes ( cohere/… , openrouter/… ) select wire details only — transport and credentials come from the [models.*] cells, which the host owns.
CRG currently has no cloud rerank call : LOCAL_RERANK_MODEL is its only reranking path. Setting RERANK_MODELS or RERANK_API_BASE does not enable one.
Six tools, each grouping related actions to keep the tool surface small.
graph -- Graph lifecycle
Actions: build | update | stats | embed | export | import | summarize
query -- Graph queries
Actions: query | | impact | large_functions | spot_check | renamed_in_diff | diff | communities
Most read actions accept as_of= for temporal (point-in-time) snapshots and repo= to scope a federated multi-repo graph.
review -- Code review context
Actions: context (default) | delta
Token-optimized review context with structural summary, impacted nodes, source snippets, and review guidance. context auto-detects changed files from the git diff; delta (with from_sha / to_sha , optional show_line_shifts ) surfaces refactor moves between two commits.
context also reports code ownership from git history: suggested reviewers (line and commit of the changed files), bus-factor risks, churn hotspots, files that usually change together with the change but are missing from it, and health signals (stale code, long complex functions, functions with no callers). .mailmap is honoured. Pass include_ownership=false (CLI --no-ownership ) to skip it.
config -- Server configuration and credential setup
Actions: status | set | cache_clear | setup_status | setup_start | setup_skip | setup_reset | setup_complete
security -- Security scanning
Actions: scan | report | suppress | rule_list
The semgrep engine requires the semgrep CLI on PATH ( uv tool install semgrep ) and runs Semgrep's p/auto registry pack plus a 3-rule curated overlay.
help -- Full documentation
Topics: graph | query | review | config | security | recipes
Returns complete documentation for each tool. Use when the compressed descriptions above are insufficient.
The package installs three console scripts: crg (primary), n24q02m-crg (the distribution name) and better-code-review-graph (legacy long name). Running any of them with no arguments starts the MCP server over stdio; a leading positional argument routes to a local CLI subcommand that calls the same domain services used by the MCP adapter. Run them directly after pip install , or without a persistent install via uvx --python 3.14 --from n24q02m-crg crg ... .
crg --help lists every subcommand with its actions and flags; crg --help prints one subcommand's full flag list. A missing action names the values it accepts: crg graph ends in the following arguments are required: graph action (choose one of: build, embed, stats, export, import, summarize) instead of the bare internal name.
CLI subcommands print structured JSON and exit non-zero on an error.
What this fork fixes versus the upstream code-review-graph :
How crg stacks up against direct competitors in each pillar:
Sources: Greptile · Greptile pricing · Sourcegraph MCP · CodeGraph . Cells marked ? are capabilities the competitor does not publicly document, not confirmed absences.
Explicit selection -- Cloud embedding errors are reported; the runtime does not silently switch models or fall back to local ONNX.
Error handling -- Tools return error strings with fix suggestions, never crash.
Read-only config mount -- Docker mode mounts only config.toml (and, for multi , users.toml ) read-only; the repo is not mounted, and the port is published on host loopback.
SSRF-guarded endpoints -- Custom [models.*] cell base_url values are validated before any outbound call.
To report a vulnerability, see SECURITY.md .
Requirements: Python 3.14, uv .
This plugin implements TC-Local (machine-bound, single trust principal), the classification defined by the shared MCP foundation trust model.
Migration & changelog
Graph, security scan cache, and suppression state now use the package-owned .crg/ directory. Run graph(action="build", full_rebuild=true) once after upgrading, followed by graph(action="embed") if semantic is needed. The old .better-code-review-graph/ state directory plus the ambiguous .code-review-graph/ and .code-review-graph.db paths and their SQLite sidecars are left untouched, not migrated. Review and reapply any desired suppression rules explicitly.
The v2.0 release added temporal columns ( valid_from_sha / valid_to_sha on every node and edge) plus an opt-in security scanner. The schema migration is auto-applied on first GraphStore open, and a backup of the pre-2.0 DB is written to .pre-2.0.bak . To downgrade and restore it:
Full schema-change list, behavior changes, and rollback procedure: BREAKING_CHANGES.md . Release-by-release history: CHANGELOG.md .
Full docs at docs.n24q02m.com/plugins/servers/crg/setup/ :
Setup -- install methods for Claude Code, Codex, Gemini CLI, Cursor, Windsurf, mcp.json
Modes overview -- stdio / http
Multi-user setup -- per-JWT-sub credential model
Use the help tool from any MCP client for inline per-tool reference.
Apache-2.0 -- See LICENSE .
Release files for n24q02m-crg 3.37.0b1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation .
Source distribution (sdist)
Built distribution (wheel)
Total release size: 1.2 MB
Release files / n24q02m_crg-3.37.0b1.tar.gz
Release files / n24q02m_crg-3.37.0b1-py3-none-any.whl
Security for n24q02m-crg 3.37.0b1
Provenance describes where a file came from. On PyPI, provenance is shared via attestations , which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
Release history Release notifications | RSS feed
3.37.0b1 This release
Nov 28, 2026 2 release files No provenance
Nov 27, 2026 2 release files No provenance
Nov 27, 2026 2 release files No provenance
Nov 27, 2026 2 release files No provenance
Nov 25, 2026 2 release files No provenance
Nov 24, 2026 2 release files No provenance
Nov 24, 2026 2 release files No provenance
Nov 22, 2026 2 release files No provenance
Nov 22, 2026 2 release files No provenance
Nov 21, 2026 2 release files No provenance
Nov 17, 2026 2 release files No provenance
Nov 17, 2026 2 release files No provenance
Nov 17, 2026 2 release files No provenance
Nov 16, 2026 2 release files No provenance
Nov 16, 2026 2 release files No provenance
Nov 14, 2026 2 release files No provenance
Nov 14, 2026 2 release files No provenance
Nov 14, 2026 2 release files No provenance
Nov 12, 2026 2 release files No provenance
Nov 10, 2026 2 release files No provenance
Nov 3, 2026 2 release files No provenance
The full story
This article is one source in a clustered incident — the cluster page carries the summary, timeline and every other outlet covering it.
