Your First Graph
Once CodeGraph is installed, building and exploring a graph takes a few commands.
Index a project
Section titled “Index a project”cd your-projectcodegraph initcodegraph init creates the .codegraph/ directory and builds the full graph in the same step — one command, done. From there a native file watcher keeps the index in sync on every change, so you rarely need to rebuild by hand. When you do want to:
codegraph index # full re-indexcodegraph sync # incremental update of changed filesCheck it worked
Section titled “Check it worked”codegraph statusThis reports the node/edge/file counts, the active SQLite backend, and the journal mode — a quick health check that the index is ready.
Run a query
Section titled “Run a query”Reach for codegraph explore first — a natural-language question or a bag of symbol names returns the relevant source plus the call paths between those symbols in a single shot (the same output the codegraph_explore tool gives your agent):
codegraph explore "how does login work"For narrower, scriptable lookups there are focused commands:
codegraph query UserService # find symbols by namecodegraph callers handleRequest # what calls a functioncodegraph callees handleRequest # what a function callscodegraph impact AuthMiddleware # what a change would affectThese four each accept --json for machine-readable output. See the full CLI reference.
Hand it to your agent
Section titled “Hand it to your agent”With a .codegraph/ directory present and an agent configured (see Installation), your agent uses the MCP tools automatically — no extra step.