codegraph
Skill24 starsChanged 2 months agoMITView on GitHub
Use CodeGraph for ALL codebase navigation and code research on any indexed project. Reach for it even when the user doesn't say "codegraph" — for "how does X work", "who calls X", "what breaks if I change X", "where is X defined", tracing a call flow, onboarding/surveying an area, or whole-project analysis: "analyze the project", "explain the architecture", "what does this project do". Also trigger when asked to index/initialize a codebase, or when .codegraph/ is present. Prefer codegraph_* tools over grep, find, or Read on source files — one call returns verbatim source plus the structural graph, replacing dozens of grep+read round-trips. Chinese triggers: "分析项目代码", "分析这个仓库", "代码分析", "这个项目是做什么的".
- Pipes a download into a shell
- Installs packages
17 other projects use a version of this.
Adopted by
Most recently taken up by
- longbowzz/CodeGraphtheir own version, first seen Nov 29, 2026
- aiproxer/aiproxertheir own version, first seen Nov 8, 2026
- davidgfolch/AI-job-searchtheir own version, first seen Nov 8, 2026
- rakaarwaky/agents-arwakytheir own version, first seen Nov 1, 2026
- suntianc/paseo-matt-worklooptheir own version, first seen Nov 1, 2026
- whoaskedssselery/claude-workspacetheir own version, first seen Oct 20, 2026
Used with
Projects with it also use codebase-design and grill-me.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
GoogleSkillcodebase-design
Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.
Also in 3 projects that use this
GoogleSkillgrill-me
A relentless interview to sharpen a plan or design.
Also in 4 projects that use this
Other versions17 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 17
- idaholab/moose★ 2.4ksame name
- alibaba/neug★ 181same name
- SylphAI-Inc/skills★ 111same name
- aiproxer/aiproxer★ 24same name
- suntianc/paseo-matt-workloop★ 11same name
- linkpranay-ai/context-engineering-protocol★ 9same name
- davidgfolch/AI-job-search★ 6same name
- longbowzz/CodeGraph★ 4same name
- sponge-b0b/Polaris★ 4same name
- betterlmy/agent-skills★ 3same name
7 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository3 other files it gives its agents.
- AGENTS.mdAGENTS.md
- docs/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
The file
We split this skill into the rules it gives an agent
10 rules. 0 are common, 3 are distinctive, and 7 are very specific to this project.
0
Common
Most of the 14 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 24
Use it to answer structural questions (call graph, blast radius, symbol location, architecture) in one sub-millisecond query rather than …
- Very specific: line 34
Do not infer readiness from the presence of .codegraph/ alone: the directory may contain a current index, an interrupted build, or …
- Very specific: line 36
Use codegraph_status (MCP) or the CLI before deciding what to run:
- Very specific: line 63
Use sync for routine manual catch-up.
- Very specific: line 175
Do not append the project as a second positional argument to a research command.
- Very specific: line 176
If the shell rejects an argument, run codegraph <command> --help and correct the syntax before falling back to grep/Read.
- Distinctive: line 187
Call this first for any open-ended question: architecture, a flow, "how does indexing work", "show me the auth layer".
- Very specific: line 193
When the question names a source path, include that path in the explore query.
- Very specific: line 242
Use these when you need focused traversal in one direction: all callers of a function, or all functions a module calls.
- Distinctive: line 269
When a tool response begins with:
“Common” is measured: kept by at least 6 in 10 of the 14 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CodeGraph — Agent Skill
CodeGraph is a deterministic code knowledge graph built on tree-sitter and
SQLite/FTS5. It parses a codebase, extracts symbols and their relationships, and
persists everything to a per-project .codegraph/ database. There is no AI, no
LLM, no vector store, and no embeddings anywhere inside the binary — output is
byte-stable and fully reproducible.
Use it to answer structural questions (call graph, blast radius, symbol location, architecture) in one sub-millisecond query rather than dozens of grep + file reads. You get more accurate context in far fewer tokens and round-trips.
Part A — Onboarding / Initialization
Check index health first
Do not infer readiness from the presence of .codegraph/ alone: the directory
may contain a current index, an interrupted build, or legacy/corrupt state.
Use codegraph_status (MCP) or the CLI before deciding what to run:
codegraph status /path/to/project --jsonThe status result is authoritative for initialization, extraction compatibility, pending changes, and any explicit recovery command.
Initialize, sync, or rebuild
# Preferred: one-line installer (downloads prebuilt binary, no Rust needed)
curl -fsSL https://raw.githubusercontent.com/sunerpy/codegraph-rust/main/scripts/install.sh | sh
# Windows PowerShell
irm https://raw.githubusercontent.com/sunerpy/codegraph-rust/main/scripts/install.ps1 | iex
# Fallback: build from source (requires Rust toolchain)
cargo install --git https://github.com/sunerpy/codegraph-rust codegraph-rs
# Choose from status + intent
codegraph init /path/to/project # no usable index exists
codegraph sync /path/to/project # ordinary added/changed/deleted files
codegraph index /path/to/project # intentional full rebuild
codegraph index --force /path/to/project # only when status/CLI explicitly prescribes itUse sync for routine manual catch-up. Supported extraction-version upgrades may
also escalate through sync; do not jump to a forced rebuild merely because the
CLI version changed. Follow the exact recovery command printed by status or the
failed command.
A project with no CodeGraph index yet is not a recovery case. Creating its index
is the user's decision: tell the user the project has no index yet, offer to run
codegraph init . in the project directory, and do not run it without the
user's consent.
Missing index-state slots and an all-OwnerMismatch index after a project move
or copy are supported init recovery cases. When status, sync, or another
failed command explicitly prints codegraph init ..., run that exact command to
replace the stale index; do not keep retrying sync. Do not generalize this to
mixed or other corruption when the CLI does not prescribe init.
Extraction is fail-closed per file at a deterministic logical named-node depth
of 256. If an adversarial or generated file exceeds that limit, CodeGraph records
one file error, contributes no partial nodes/edges/references for that file, and
continues indexing the rest of the project. A later sync also removes any graph
previously produced by that file. Do not retry with index --force: a full
rebuild intentionally produces the same file-level result.
Start the MCP server
codegraph serve --mcp # resolves project from cwd (recommended)
codegraph serve --mcp -p /path # pin to a specific projectThe server speaks newline-delimited JSON-RPC over stdio. It watches the project
directory and incrementally syncs file changes after a debounce. When the watcher
is healthy, do not run a manual sync after every edit. Each project still needs
one usable index, normally created with codegraph init.
A bare stdio launch first walks upward for an index. If that misses and the
launch directory is a workspace root (manifest or .git), CodeGraph performs a
bounded scan (depth 4, at most 64 candidates and 10,000 entries). It adopts exactly one indexed
child and starts that child's normal daemon/watcher/catch-up path. Zero or
multiple children are never guessed: the tool response and stderr name the
sorted candidates, and the caller must pass projectPath or restart with
--path. HOME and filesystem roots are never scanned downward. A no-default
server retries at most once every five seconds, so an index created later can be
adopted.
The watcher hot-reloads the selected index root's config.toml and
codegraph.json, plus the project root .gitignore. A control-file change
atomically replaces the live scope and triggers one full reconcile, so newly
excluded files are removed and newly included/custom-extension files are added
without restarting the MCP server. Invalid TOML keeps the last valid scope and
reports an error; malformed JSON retains CodeGraph's tolerant empty-override
behavior.
To keep vendored or generated source indexed but rank it below first-party code, configure ranking-only rules:
[indexing]
deprioritize = ["vendor/**", "generated/**"]The compatibility form in .codegraph/codegraph.json is
{"deprioritize":["vendor/**"]}. JSON rules run first, TOML rules run last,
and ordered !pattern exceptions make matching last-rule-wins. This never
removes files or changes nodes/edges. Search and explore reload the addressed
project's policy on each request, so a long-running MCP process needs no restart.
Auto-register into all detected agents (Claude Code, Cursor, Codex, opencode, Hermes, Gemini CLI, Antigravity, Kiro, Trae, Qoder, Zed, Zuno, VS Code, Copilot CLI, JetBrains):
codegraph install --yes
codegraph install --yes --init # wire agents, then init cwd
codegraph install --target=codex --local --yes # project-local Codex setupinstall --init is explicit: without it, install never creates an index.
--print-config returns before initialization. init -y/--yes is accepted for
unattended bootstrap compatibility. A local Codex install writes
.codex/config.toml, project-root AGENTS.md, and
.agents/skills/codegraph; Codex applies that project layer only after the
repository is trusted.
Part B — Daily Code Research
Tool selection workflow
Pick your entry point based on what you're trying to answer:
| Question | First tool |
| "How does this feature/area work?" | codegraph_explore |
| "Where is symbol X defined?" | codegraph_search |
| "Show me the source + callers of X" | codegraph_node |
| "Who calls X?" | codegraph_callers |
| "What does X call?" | codegraph_callees |
| "What breaks if I change X?" | codegraph_impact |
| "What files are under path P?" | codegraph_files |
| "Is the index up to date?" | codegraph_status |
These are MCP tool names. Shell project-path syntax is intentionally split:
- Lifecycle commands accept an optional positional path:
codegraph status .,codegraph init .,codegraph sync ., andcodegraph index .. - Research commands take exactly one positional query/target and select the
project with
-p/--path:codegraph explore "<question>" -p .,codegraph search "<symbol>" -p ., andcodegraph node "<symbol-name-or-id>" -p ..
Do not append the project as a second positional argument to a research command.
If the shell rejects an argument, run codegraph <command> --help and correct
the syntax before falling back to grep/Read. codegraph query remains a
compatibility alias; prefer codegraph search in new commands and guidance.
codegraph_explore — start here
For a whole-project overview ("analyze the project", "explain the architecture",
"what does this project do"), start with codegraph_explore (architecture
survey) rather than reading files one by one — one call maps the landscape;
follow up only for specific symbols that need deeper detail.
Call this first for any open-ended question: architecture, a flow, "how does indexing work", "show me the auth layer". One call returns the symbols most relevant to your query, their verbatim source grouped by file, and the call/impact graph connecting them. It replaces the grep-then-read-then-grep loop that would otherwise take 10-20 round-trips.
When the question names a source path, include that path in the explore query.
CodeGraph normalizes quoted/backticked, ./, Windows, :line, and #Lline
forms, pins matching files ahead of fuzzy results, and removes path fragments
from normal symbol search. An unresolved explicit path is reported instead of
being dissolved into noisy query tokens. Path recognition is deliberately
bounded; ordinary hyphenated prose is left alone.
Explore also supplements FTS with camelCase/snake-case identifier segments, so
prose such as "feed bottom" can seed callable, Variable, and Constant names such
as feedAtBottom without slowing the ordinary codegraph_search path.
Trust the results — they come from a full AST parse, not text matching. Don't re-verify with grep.
codegraph_search — locate a symbol by name
Returns kind, file path, line number, and signature. Use it when you know (or suspect) a symbol's name but not where it lives. The results are FTS5-scored across multiple signals (name, kind, path). This is the closest thing to "semantic" lookup available, but it is fully deterministic full-text scoring — there are no embeddings, no vector index, no neural model of any kind. Case-insensitive exact-name lookups use the dedicated lower-name SQLite index.
CLI equivalent:
codegraph search "<symbol>" -p /path/to/projectcodegraph_node — read source + graph trail
Pass a symbol name, qualified name, exact node ID (for example, the node.id
from CLI codegraph search --json), or a file path. A symbol selector returns
the symbol's verbatim source plus its direct callers and callees. A file path
returns the file's line-numbered source — use this instead of the Read tool for
any indexed source file. It's faster, and the output is pre-annotated with
structural context.
Erlang functions are arity-qualified internally. Written queries such as
cowboy_stream_h:request_process/3 and
cowboy_stream_h::request_process/3 both select that exact function; keep the
arity when different definitions share the same bare name.
MCP file mode supports offset and limit for large files, matching Read's
pagination interface. The shell codegraph node command currently reads the
whole file (or --symbols-only) and does not expose those pagination flags.
codegraph_callers / codegraph_callees — directed edges
Use these when you need focused traversal in one direction: all callers of a
function, or all functions a module calls. For broader "what's connected"
questions, codegraph_explore is usually more efficient than chaining callers
and callees manually.
codegraph_impact — blast radius before a refactor
Pass a symbol; get back the full transitive set of callers and dependents — every symbol that would need to change or be verified if you modify the queried one. Run this before any non-trivial refactor instead of walking the call graph by hand.
codegraph_files — directory listing
Returns the indexed files under a path as a tree. Useful for orienting yourself in an unfamiliar project layout without opening the filesystem directly.
codegraph_status — index health
Returns file count, node count, edge count, DB size, and any pending (stale) files. Call it when in doubt about whether the index reflects the current state of the codebase.
Stale-index handling
When a tool response begins with:
⚠️ Some files referenced below were edited since the last index sync — their codegraph entries may be stale:
- path/a.rs
- path/b.rs
For accurate content of those specific files, Read them directly. The rest of this response is fresh.those specific files may be out of date. Read them directly with the Read tool for accurate content. Every file not listed in the banner is fresh and can be trusted from the index without re-reading.
codegraph_status also lists any pending files if you want a proactive check
before starting a large research session. If the watcher is expected, wait for
its debounce and re-check status. If no watcher is running, use codegraph sync;
do not default to a full codegraph index for ordinary source changes.
A burst of many changes — a branch switch, a mass rename or move — or any sign
that the operating system dropped file events makes the watcher re-scan the
whole project on its own. Until that catch-up commits, responses can start with
⚠️ CodeGraph auto-sync is RECOVERING …; read the files you rely on directly
in the meantime. Large renames never need codegraph index: codegraph sync
reconciles the whole project against the index.
Fallback rules — when to use Read/grep instead
CodeGraph indexes source code. Fall back to the Read tool or grep for:
- Config files, TOML, YAML, JSON, Markdown, lock files, data files
- Files flagged in the stale-index banner
- Anything outside the indexed source tree (the
.codegraph/dir itself, build artifacts, vendored binaries)
For everything else in an indexed project, prefer the codegraph tools. The token savings compound quickly across a long session.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

