Skip to content

Your First Graph

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

Terminal window
cd your-project
codegraph init -i # initialize + index in one step

init creates the .codegraph/ directory; -i (or --index) immediately builds the full index. For an existing project you can re-index any time:

Terminal window
codegraph index # full 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.

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
codegraph context "fix the login flow" # build task-focused context

Each accepts --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.