Summary
code-review-graph build (CLI) and build_or_update_graph_tool(full_rebuild=True) (MCP tool) produce significantly different results. The CLI only runs Tree-sitter parsing, while the MCP tool also runs 4 post-processing steps. This means users who build via CLI get an incomplete graph with many features returning empty results.
This affects all CLI entry points — build, update, and watch — as well as the Claude Code PostToolUse hook which calls code-review-graph update.
Steps to Reproduce
- Install:
pip install code-review-graph
- Build via CLI:
code-review-graph build
- Start MCP server:
code-review-graph serve
- Query communities → 0 results
- Query flows → 0 results
- Semantic search → 0 results (FTS not indexed)
- Architecture overview → 0 communities
Workaround: calling build_or_update_graph_tool(full_rebuild=True) via the MCP server produces the correct results with all features populated.
Expected Behavior
CLI build should produce the same output as the MCP build_or_update_graph_tool(full_rebuild=True) — or at minimum, the CLI docs/README should clarify that additional steps are needed.
Root Cause
cli.py (build command) calls only:
result = full_build(repo_root, store)
tools/build.py (build_or_update_graph) calls full_build() plus 4 post-build steps:
- Compute node signatures
- Rebuild FTS index (
search.rebuild_fts_index)
- Trace execution flows (
flows.trace_flows → flows.store_flows)
- Detect communities (
communities.detect_communities → communities.store_communities)
These post-build steps populate the flows, flow_memberships, communities tables and the nodes_fts virtual table. Without them, the corresponding MCP tools return empty results.
Feature Comparison
| Post-processing step |
CLI build |
MCP build_or_update_graph_tool |
| Tree-sitter parse (nodes + edges) |
✅ |
✅ |
| Compute signatures |
❌ |
✅ |
| Rebuild FTS index |
❌ |
✅ |
| Trace execution flows |
❌ |
✅ |
| Detect communities |
❌ |
✅ |
Affected Entry Points
The same gap exists in all non-MCP paths:
code-review-graph build — CLI full build
code-review-graph update — CLI incremental update
code-review-graph watch — filesystem watcher (calls incremental_update internally)
The only path that works correctly is the MCP tool build_or_update_graph_tool().
Also Affects Claude Code Hooks
This isn't platform-specific — the bundled Claude Code hooks have the same gap:
hooks/session-start.sh suggests running code-review-graph build (CLI) when no graph exists — this produces an incomplete graph
hooks/hooks.json PostToolUse hook fires code-review-graph update (CLI) after every Write/Edit — incremental updates also skip post-processing
So even in Claude Code (the primary target platform), a user following the setup instructions gets an incomplete graph until an agent happens to call build_or_update_graph_tool() via the MCP server.
Suggestion
Extract the post-build pipeline from tools/build.py into a shared function and call it from both the MCP tool and the CLI commands. This would fix the CLI, the hooks, and the watch mode in one change.
Environment
- code-review-graph v2.1.0
- Python 3.14
- macOS (Apple Silicon)
- Tested with an agentic OpenCode workflow (multi-agent setup using the MCP server)
Summary
code-review-graph build(CLI) andbuild_or_update_graph_tool(full_rebuild=True)(MCP tool) produce significantly different results. The CLI only runs Tree-sitter parsing, while the MCP tool also runs 4 post-processing steps. This means users who build via CLI get an incomplete graph with many features returning empty results.This affects all CLI entry points —
build,update, andwatch— as well as the Claude CodePostToolUsehook which callscode-review-graph update.Steps to Reproduce
pip install code-review-graphcode-review-graph buildcode-review-graph serveWorkaround: calling
build_or_update_graph_tool(full_rebuild=True)via the MCP server produces the correct results with all features populated.Expected Behavior
CLI
buildshould produce the same output as the MCPbuild_or_update_graph_tool(full_rebuild=True)— or at minimum, the CLI docs/README should clarify that additional steps are needed.Root Cause
cli.py(buildcommand) calls only:tools/build.py(build_or_update_graph) callsfull_build()plus 4 post-build steps:search.rebuild_fts_index)flows.trace_flows→flows.store_flows)communities.detect_communities→communities.store_communities)These post-build steps populate the
flows,flow_memberships,communitiestables and thenodes_ftsvirtual table. Without them, the corresponding MCP tools return empty results.Feature Comparison
buildbuild_or_update_graph_toolAffected Entry Points
The same gap exists in all non-MCP paths:
code-review-graph build— CLI full buildcode-review-graph update— CLI incremental updatecode-review-graph watch— filesystem watcher (callsincremental_updateinternally)The only path that works correctly is the MCP tool
build_or_update_graph_tool().Also Affects Claude Code Hooks
This isn't platform-specific — the bundled Claude Code hooks have the same gap:
hooks/session-start.shsuggests runningcode-review-graph build(CLI) when no graph exists — this produces an incomplete graphhooks/hooks.jsonPostToolUsehook firescode-review-graph update(CLI) after every Write/Edit — incremental updates also skip post-processingSo even in Claude Code (the primary target platform), a user following the setup instructions gets an incomplete graph until an agent happens to call
build_or_update_graph_tool()via the MCP server.Suggestion
Extract the post-build pipeline from
tools/build.pyinto a shared function and call it from both the MCP tool and the CLI commands. This would fix the CLI, the hooks, and the watch mode in one change.Environment