# What Hooks and Skills Does `code-review-graph install` Configure for Different Platforms?

> Discover what hooks and skills `code-review-graph install` configures for Git, Claude, and Codex. Automate your graph building and updates across platforms.

- Repository: [Tirth Kanani/code-review-graph](https://github.com/tirth8205/code-review-graph)
- Tags: how-to-guide
- Published: 2026-08-15

---

**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](https://github.com/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](https://github.com/tirth8205/code-review-graph/blob/main/README.md#L65) 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 update` before every commit, as documented in the [CHANGELOG at line 561](https://github.com/tirth8205/code-review-graph/blob/main/CHANGELOG.md#L561). 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‑graph` continuously, described in the [README at line 115](https://github.com/tirth8205/code-review-graph/blob/main/README.md#L115).

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](https://github.com/tirth8205/code-review-graph/blob/main/docs/FEATURES.md#L16).

### 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](https://github.com/tirth8205/code-review-graph/blob/main/docs/FEATURES.md#L96).

The generated configuration merges with existing [`.claude/settings.json`](https://github.com/tirth8205/code-review-graph/blob/main/.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](https://github.com/tirth8205/code-review-graph/blob/main/docs/FEATURES.md#L148).

### 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](https://github.com/tirth8205/code-review-graph/blob/main/CHANGELOG.md#L492).

## 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`](https://github.com/tirth8205/code-review-graph/blob/main/src/backend/cli.ts):

```typescript
// 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`](https://github.com/tirth8205/code-review-graph/blob/main/.mcp.json) file that merges new hook entries with any existing configuration. Per [CHANGELOG line 560](https://github.com/tirth8205/code-review-graph/blob/main/CHANGELOG.md#L560), this merge behavior preserves user‑defined hooks while adding code‑review‑graph entries.

### Interactive Installation Flow

The `Installer` class in [`src/onboarding/installer.ts`](https://github.com/tirth8205/code-review-graph/blob/main/src/onboarding/installer.ts) orchestrates the entire process:

```typescript
// 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:

```bash
#!/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`](https://github.com/tirth8205/code-review-graph/blob/main/.claude/settings.json) snippet similar to:

```json
{
  "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`](https://github.com/tirth8205/code-review-graph/blob/main/src/backend/cli.ts) | `CliWrapper` class detects Python installer, provides backend installation, and executes graph commands |
| [`src/onboarding/installer.ts`](https://github.com/tirth8205/code-review-graph/blob/main/src/onboarding/installer.ts) | `Installer` class implements interactive install flow and writes platform‑specific hook configurations |
| [`docs/FEATURES.md`](https://github.com/tirth8205/code-review-graph/blob/main/docs/FEATURES.md) | Documents supported hooks (pre‑commit, watch, SessionStart, PostToolUse) and platform behavior |
| [`CHANGELOG.md`](https://github.com/tirth8205/code-review-graph/blob/main/CHANGELOG.md) | Tracks changes to hook generation, merge behavior, and platform additions |
| [`README.md`](https://github.com/tirth8205/code-review-graph/blob/main/README.md) | High‑level overview of the `install` command and its effects on skills and hooks |

## Summary

- **`code‑review‑graph install` configures 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 update` automatically.
- **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 `~/.cursor` is 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](https://github.com/tirth8205/code-review-graph/blob/main/CHANGELOG.md#L560), the generated [`.mcp.json`](https://github.com/tirth8205/code-review-graph/blob/main/.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`](https://github.com/tirth8205/code-review-graph/blob/main/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](https://github.com/tirth8205/code-review-graph/blob/main/docs/FEATURES.md#L96), this avoids expensive initial scans by leveraging the pre‑built graph database.