Skip to content
Code Review
Hook

Hooks

What code-review-graph runs automatically, and when. A hook is a command Claude Code fires at a fixed moment, without you asking for it.

From plugin
code-review-graph
33k7 skills2 hooks1 MCP

Claude Code

$ npx -y skills add tirth8205/code-review-graph --agent claude-code

What fires, and when

SessionStart

Fires once when a session begins, and again after a context compaction. It is where a plugin sets up its environment, or restores state the compaction dropped.

  • cat >/dev/null || true; code-review-graph status

PostToolUse

  • MatchesEnterWorktreecat >/dev/null || true; code-review-graph build >/dev/null 2>&1 &
  • MatchesWrite|Edit|Bashcat >/dev/null || true; code-review-graph update --skip-flows
Read hooks/hooks.json

Where it lives

  • hooks/session-start.shGitHub
    Read the script
    #!/bin/bash
    # Checks for the code-review-graph knowledge graph and outputs
    # guidance for Claude Code at the start of every session.
    
    # Drain stdin so large hook payloads do not cause BrokenPipeError (#493).
    cat >/dev/null || true
    
    DB_PATH=".code-review-graph/graph.db"
    
    if [ -f "$DB_PATH" ]; then
        cat <<'INSTRUCTIONS'
    [code-review-graph] Knowledge graph is available.
    
    When answering questions about this codebase, prefer using the code-review-graph MCP tools before scanning files manually:
    - Use semantic_search_nodes_tool to find classes, functions, or types by name or keyword.
    - Use query_graph_tool with patterns like callers_of, callees_of, imports_of, importers_of, children_of, tests_for, inheritors_of, or file_summary to explore relationships.
    - Use get_impact_radius_tool to understand the blast radius of changes.
    - Use get_review_context_tool for token-efficient review context.
    - Fall back to Grep/Glob/Read only when the graph does not cover what you need.
    
    This saves significant tokens by avoiding full codebase scans.
    INSTRUCTIONS
    else
        echo "[code-review-graph] No knowledge graph found. Run `code-review-graph build` to parse this codebase and enable graph-powered queries."
    fi
    

Read the script before you install anything that runs on your machine. This is the one part of a plugin that acts without being asked.

@tirth8205
Ships withcode-review-graph

Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.

33k7 skills1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
32.5k
Star history of tirth8205/code-review-graph on GitHub, a chart by star-history.com

More plugins that ship hooks.

brooks-lint

brooks-lint

Reviews your code for structural decay such as tangled dependencies, duplicated knowledge and weak tests, citing classic engineering books for each finding. Each result comes with a severity label and a concrete fix, and an audit or debt-assessment mode can also map a roadmap for cleanup.

9 skills+31.6k
@hyhmrright@hyhmrright
Install Plugin

Questions about the hooks in code-review-graph.

Which coding agents can use the hooks in code-review-graph?
The hooks in code-review-graph install in Claude Code and Cursor: each runs Claude Code hooks from .claude/settings.json, so copy the hooks there.