codegraph

A code-structure guide for using a CodeGraph server, which maps files, symbols, and their relationships in a project.

In plain words
What is it for?
Use it to find definitions, inspect signatures, trace callers and callees, check change impact, explore related source, list files, and check the index.
Why use it?
It helps answer structural questions that ordinary text search cannot, such as what calls a function or what might be affected by a change.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/angrysky56/local-repl-mcp/codegraph
Clone the repo
git clone --depth 1 https://github.com/angrysky56/local-repl-mcp

Made for: Cursor.

Per session 654 This file is loaded in full into every session.
When invoked 654 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00654 $0.00654
Opus 5 $0.00327 $0.00327
Sonnet 5 $0.00131 $0.00131
Haiku 4.5 $0.00065 $0.00065

Measured yesterday against content hash f60cde20259d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

codegraph scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to codegraph — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.cursor/rules/codegraph.mdc · 39 lines

How it starts

The opening of the file, as written. The whole thing — 39 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CodeGraph

This project has a CodeGraph MCP server (codegraph_* tools) configured. CodeGraph is a tree-sitter-parsed knowledge graph of every symbol, edge, and file. Reads are sub-millisecond and return structural information grep cannot.

When to prefer codegraph over native search

Use codegraph for structural questions — what calls what, what would break, where is X defined, what is X's signature. Use native grep/read only for literal text queries (string contents, comments, log messages) or after you already have a specific file open.

Question Tool
"Where is X defined?" / "Find symbol named X" codegraph_search
"What calls function Y?" codegraph_callers
"What does Y call?" codegraph_callees
"What would break if I changed Z?" codegraph_impact
"Show me Y's signature / source / docstring" codegraph_node
"Give me focused context for a task/area" codegraph_context
"See several related symbols' source at once" codegraph_explore
"What files exist under path/" codegraph_files
"Is the index healthy?" codegraph_status

Rules of thumb

  • Answer directly — don't delegate exploration. For "how does X work" / architecture / trace questions, answer with 2-3 codegraph calls: codegraph_context first, then ONE codegraph_explore for the source of the symbols it surfaces. Codegraph IS the pre-built index, so spawning a separate file-reading sub-task/agent — or running a grep + read loop — repeats work codegraph already did and costs more for the same answer.
  • Trust codegraph results. They come from a full AST parse. Do NOT re-verify them with grep — that's slower, less accurate, and wastes context.
  • Don't grep first when looking up a symbol by name. codegraph_search is faster and returns kind + location + signature in one call.
  • Don't chain codegraph_search + codegraph_node when you just want context — codegraph_context is one call.
  • Don't loop codegraph_node over many symbols — one codegraph_explore call returns several symbols' source grouped in a single capped call, while each separate node/Read call re-reads the whole context and costs far more.
  • Index lag: the file watcher debounces ~500ms behind writes; don't re-query immediately after editing a file in the same turn.

Read the full file on GitHub · 39 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 39 lines · 654 tokens per session scan A f60cde20259d

Subscribe to this mod's changes

codegraph is a cursor rule published in the GitHub repository angrysky56/local-repl-mcp (4 stars, last pushed 3mo ago), licensed MIT. It adds 654 tokens to every session, about $0.0033 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to codegraph, differing in 0 lines, and is treated as a copy.

Related

Other cursor rules, from other repositories

java-import-fqn

Java 禁止不必要的全限定类名,必须 import(类名冲突除外).

henryxm/autumn · 0 tokens

debugging

Debugging guidance for the Lineai MCP Server.

lineai-intelligence/lineai-mcp-server · 0 tokens

diagram

Generate or update a mermaid diagram with the .mmd text as source of truth — defaults to a lightweight zero-dependency Node live-preview server that watches the .mmd and hot-reloads a browser tab (pan/zoom), with a self-hosted mermaid.live editor via Docker, system-viewer SVG, VS Code live preview, or a public…

victusfate/scaffold · 133 tokens

council

Run a high-stakes decision through a council of five persona-diverse advisors (Contrarian, First-Principles, Expansionist, Outsider, Executor) in parallel, then anonymized peer review, then a chairman synthesis of where they agree, clash, and what to do. Use for real tradeoffs ("council this", "pressure-test this"…

victusfate/scaffold · 88 tokens

statusline

Turn the usage statusLine on or off (model + context% + 5-hour usage% in every project) without editing config by hand. Runs bin/install-statusline.sh, which installs the script to /.claude and merges the setting without clobbering other keys. Opt-in, global, run once per machine; /statusline off disables it.

victusfate/scaffold · 74 tokens

add-linter

Add linter configs and GitHub Actions workflows for languages detected in the current repo. Use when the user wants to add linters, set up code quality checks, or after sync-scaffold suggests running /add-linter.

victusfate/scaffold · 45 tokens