Skip to content

Your First Graph

Once CodeGraph is installed, building and exploring a graph takes a few commands.

Terminal window
cd your-project
codegraph init

codegraph 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:

Terminal window
codegraph index # full re-index
codegraph sync # incremental update of changed files
Terminal window
codegraph status

This reports the node/edge/file counts, the active SQLite backend, and the journal mode — a quick health check that the index is ready.

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):

Terminal window
codegraph explore "how does login work"

For narrower, scriptable lookups there are focused commands:

Terminal window
codegraph query UserService # find symbols by name
codegraph callers handleRequest # what calls a function
codegraph callees handleRequest # what a function calls
codegraph impact AuthMiddleware # what a change would affect

These four each accept --json for machine-readable output. See the full CLI reference.

With a .codegraph/ directory present and an agent configured (see Installation), your agent uses the MCP tools automatically — no extra step.