What Hooks and Skills Does `code-review-graph install` Configure for Different Platforms?
The code‑review‑graph install command auto‑configures three core platform‑agnostic skills (build‑graph, update‑graph, embed‑graph) and platform‑specific hooks including Git pre‑commit hooks, Claude Code SessionStart hooks, and Codex PostToolUse hooks.
The code‑review‑graph install command in the tirth8205/code‑review‑graph repository serves as a single‑step bootstrap that prepares the tool for every supported AI coding platform. Whether you are using Claude Code, Codex, Cursor, or a standard Git workflow, the installer detects your environment and writes the appropriate configuration files automatically.
Core Skills Added to All Platforms
Every installation registers three fundamental skills that form the backbone of the code‑review‑graph functionality. These skills are platform‑agnostic and exposed through the CLI:
build-graph– Constructs or rebuilds the entire graph database from scratch.update-graph– Performs incremental updates to the graph when files change.embed-graph– Computes vector embeddings for graph nodes to enable semantic search.
These skills are documented in the README at line 65 and are registered regardless of which AI platform you use.
Platform‑Specific Hooks Configured by install
The code‑review‑graph install command detects your development environment and configures hooks tailored to each platform's extension mechanism.
Git‑Based Platforms (Codex, Claude Code, Cursor)
For any Git repository, the installer adds two critical hooks to keep the graph synchronized with code changes:
- Pre‑commit hook – Runs
code‑review‑graph updatebefore every commit, as documented in the CHANGELOG at line 561. This ensures the graph reflects staged changes before they are committed. - Watch hook – Triggers on file saves or operates in workspace‑wide watch mode to call
update‑graphcontinuously, described in the README at line 115.
The installer resolves the actual Git hooks directory using git rev‑parse --git‑path hooks, ensuring compatibility with work‑trees and Husky configurations per FEATURES.md line 16.
Claude Code
When Claude Code is detected, the installer injects skills into Claude's MCP (Model Context Protocol) metadata. This enables Claude to automatically prefer graph‑aware tools over generic file searches.
- SessionStart hook – Fires when a Claude session begins, preferring graph‑backed tools and avoiding expensive full code scans. This hook is detailed in FEATURES.md at line 96.
The generated configuration merges with existing .claude/settings.json entries, preserving user‑defined hooks.
Codex
For OpenAI's Codex CLI, the installer configures automated graph refresh triggers:
- PostToolUse hooks (Write, Edit, Bash) – After any Codex tool call that modifies files, the graph is refreshed in the background. This ensures Codex always operates on an up‑to‑date codebase, as implemented in FEATURES.md at line 148.
Cursor
Cursor support activates only when a ~/.cursor installation is detected:
- Cursor‑specific hook entries – Written to Cursor's configuration directory, enabling graph updates within the Cursor IDE environment. This addition is noted in the CHANGELOG at line 492.
How the Installer Detects and Configures Your Environment
The code‑review‑graph install command performs several environment detection steps before writing any configuration.
Python Backend Detection
The installer detects how the backend was installed—via uvx, pip, or pipx—and writes the correct cliPath into your configuration. The relevant logic resides in src/backend/cli.ts:
// src/backend/cli.ts lines 59-64
private getCliPath(): string {
// Detects uvx, pip, or pipx installation
// Returns absolute path to code-review-graph executable
return resolveFromEnvironment();
}
This ensures that hooks call the correct binary regardless of how you installed the tool.
MCP Configuration Generation
The installer generates a platform‑native .mcp.json file that merges new hook entries with any existing configuration. Per CHANGELOG line 560, this merge behavior preserves user‑defined hooks while adding code‑review‑graph entries.
Interactive Installation Flow
The Installer class in src/onboarding/installer.ts orchestrates the entire process:
// Example: invoking the installer from a VS Code extension
import { Installer } from './onboarding/installer';
import { CliWrapper } from '../backend/cli';
const cli = new CliWrapper();
const installer = new Installer(cli);
await installer.checkAndPrompt(); // Prompts user and configures skills/hooks
Generated Configuration Examples
Git Pre‑Commit Hook
After installation, the generated pre‑commit hook automatically runs before every commit:
#!/bin/sh
# .git/hooks/pre-commit (generated by code-review-graph install)
code-review-graph update # Incremental graph update
Claude Code Settings
The installer produces a .claude/settings.json snippet similar to:
{
"matcher": "**/*.py",
"hooks": [
{
"type": "PreToolUse",
"command": "code-review-graph update",
"timeout": 30
},
{
"type": "SessionStart",
"command": "code-review-graph detect-changes --brief",
"timeout": 30
}
]
}
This configuration ensures Claude Code initializes with graph awareness and refreshes the graph before tool use.
Key Implementation Files
| File Path | Purpose |
|---|---|
src/backend/cli.ts |
CliWrapper class detects Python installer, provides backend installation, and executes graph commands |
src/onboarding/installer.ts |
Installer class implements interactive install flow and writes platform‑specific hook configurations |
docs/FEATURES.md |
Documents supported hooks (pre‑commit, watch, SessionStart, PostToolUse) and platform behavior |
CHANGELOG.md |
Tracks changes to hook generation, merge behavior, and platform additions |
README.md |
High‑level overview of the install command and its effects on skills and hooks |
Summary
code‑review‑graph installconfigures three core skills (build‑graph,update‑graph,embed‑graph) for every platform.- Git platforms receive pre‑commit and watch hooks that call
code‑review-graph updateautomatically. - Claude Code receives SessionStart hooks that prefer graph‑backed tools from session initialization.
- Codex receives PostToolUse hooks that refresh the graph after any file‑modifying tool call.
- Cursor support activates conditionally when
~/.cursoris detected, writing IDE‑specific hook entries. - The installer merges configurations rather than overwriting, preserving your existing custom hooks.
Frequently Asked Questions
Does code-review-graph install overwrite my existing Git hooks?
No. The installer merges new hook entries with existing configurations. As documented in CHANGELOG.md line 560, the generated .mcp.json and Git hooks preserve any user‑defined entries while adding code‑review‑graph specific hooks.
Can I use code-review-graph install if I installed the backend with pipx?
Yes. The installer detects your installation method—uvx, pip, or pipx—via the getCliPath() method in src/backend/cli.ts and writes the correct cliPath to your configuration. This ensures hooks invoke the proper executable regardless of installation method.
What happens if I use multiple AI platforms in the same project?
The installer detects all supported platforms present in your environment and configures hooks for each. You can use Claude Code, Codex, and Cursor in the same repository; each will have its appropriate hooks written without conflict since they reside in separate configuration files.
How does the SessionStart hook for Claude Code improve performance?
The SessionStart hook fires when a Claude session begins and configures Claude to prefer graph‑backed tools over full codebase scans. As described in FEATURES.md line 96, this avoids expensive initial scans by leveraging the pre‑built graph database.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →