Pre-configured rule files that teach AI coding agents to use CodeGraph before falling back to grep, AST scripts, or filesystem walks.
CodeGraph is a local semantic code graph with persistent RocksDB storage, 38 language parsers, and 32+ MCP tools — see the main README or marketplace listing.
The rule files in this directory tell your AI agent:
- Call CodeGraph tools first for code-structural questions (callers, callees, impact, dependency graphs, complexity, dead code, semantic symbol search).
- Use the curated AI-context tools (
codegraph_get_edit_contextetc.) instead of reading multiple files blindly. - Persist discoveries via the memory subsystem so future sessions can retrieve debugging insights, decisions, conventions, and known issues.
- Tag stored memories with
agentSourceso cross-agent attribution shows up incodegraph_memory_list. - Maintain a
codegraph-sources.mdat the repo root tracking which workspaces have been indexed.
Copy the rule file for your agent into the agent's rules directory:
# Claude (Claude Code, claude.ai/code)
cp .claude/agents/codegraph.md ~/.claude/agents/
# Cursor
cp .cursor/rules/codegraph.mdc ~/.cursor/rules/
# Windsurf
cp .windsurf/rules/codegraph.md ~/.windsurf/rules/
# Codex
cp .codex/prompts/codegraph.md ~/.codex/prompts/
# Cline (VS Code extension)
cp .clinerules/codegraph.md ~/.clinerules/
# Generic / unspecified agent
cp general-agents/AGENTS.md ~/.claude/AGENTS.md # or wherever your agent reads system promptsYou can also drop them in the project root instead of the home directory
to scope the rules to a single repo (e.g. <repo>/.claude/agents/codegraph.md).
Your agent needs access to the CodeGraph MCP server. Install one of:
- VS Code extension:
aStudioPlus.codegraph(marketplace) — auto-starts the LSP server when you open a workspace - MCP server (standalone):
npx -y @astudioplus/codegraph-mcp— configure as an MCP server in Claude Desktop / Cursor / Cline etc.
After install, the first session indexes your workspace (1-5 min depending on size). Subsequent sessions load instantly from the persisted graph.
| File | For | Notes |
|---|---|---|
.claude/agents/codegraph.md |
Claude (Claude Code, claude.ai/code) | Includes tools: allowlist in frontmatter |
.cursor/rules/codegraph.mdc |
Cursor | Always-applied rule (alwaysApply: true) |
.windsurf/rules/codegraph.md |
Windsurf | Plain markdown |
.codex/prompts/codegraph.md |
Codex | Plain markdown |
.clinerules/codegraph.md |
Cline | Plain markdown |
general-agents/AGENTS.md |
Any agent / generic | Most detailed; use as reference |
The files differ mainly in frontmatter format and the agentSource string
the rule tells the agent to pass when storing memories. The core content
(tool cheatsheet + workflow rules) is consistent.
If your agent's prompt context fills up listing 32 tools, launch the MCP
server with --profile=core|graph|memory|security|all (or set
CODEGRAPH_TOOL_PROFILE):
core— 8 tools (search + symbol info + AI context)graph— 16 tools (callers/callees/deps/impact/traverse)memory— 7 tools (codegraph_memory_*)security— Pro security tools only (community: empty)all— default, every tool
- Add configurations for new agents (Aider, Continue, etc.) — PRs welcome
- Improve the tool cheatsheet / workflow rules
- Share patterns that worked well in your sessions
- Main repo: github.com/codegraph-ai/CodeGraph
- MCP server: npmjs.com/package/@astudioplus/codegraph-mcp
- VS Code extension: marketplace.visualstudio.com/items?itemName=aStudioPlus.codegraph
- Issues: github.com/codegraph-ai/CodeGraph/issues