> Graphify: shared context of codebase for agents and developers. Canonical: https://graphify.com/blog/what-is-a-code-graph · Full index: https://graphify.com/llms-full.txt

# What is a code graph?

*November 20, 2026 · Syed Fahad*

A code graph is a map of a codebase built by parsing the source. Functions, classes, files and modules become nodes, and calls, imports, inheritance and references become typed edges between them. An AI coding agent follows those edges to see what calls a function or what a change reaches, and each hop points to a file and line.

People also call this a [code knowledge graph](https://graphify.com/blog/what-is-a-code-knowledge-graph). The [Code graph](https://graphify.com/glossary/code-graph) glossary entry is the short definition. Below is how one is built, how it compares with grep and with embeddings, and how agents query it over MCP.

## How is a code graph built?

Most code graphs come from a parser, not a model. A code graph is built by parsing the source with a parser such as tree-sitter. Declarations become nodes, and calls, imports, inheritance and references become typed edges. A second pass resolves each name to a declaration, and every edge keeps its file, line and a provenance tag.

Graphify reads each file with [tree-sitter](https://graphify.com/glossary/tree-sitter) or a built-in parser, then records what the syntax tree contains. The declarations are things like modules, classes, functions and methods. The common edges are:

- `calls`: one function or method invokes another
- `imports`: a file or module brings in another module
- `inherits`: a class extends a base class
- `references`: code refers to a symbol

When a class extends a base class, that shows up as an `inherits` edge, the same way a function invocation shows up as a `calls` edge. Each node and edge keeps its source file and line, so a hop is something you can open and check.

A parser can see that `checkout()` calls `total()` without knowing which `total()` it means. The next pass resolves that name from the evidence in the code: the imports, the file a name is declared in, and the type of the receiver for a call like `obj.method()`. An edge is stored when the name resolves to exactly one declaration. If two declarations could match, Graphify leaves the edge out or marks it AMBIGUOUS.

Every edge also carries a provenance tag. EXTRACTED means the relationship was read from the source. INFERRED means it was derived by resolution, which can be static and does not require a model. AMBIGUOUS means the evidence did not settle on one target. [How code dependencies are found, not guessed](https://docs.graphify.com/concepts/how-graphify-finds-dependencies) walks through each step.

## How does a code graph compare with grep and with embeddings?

Grep returns the lines that contain a string. That is the right tool when the question is a search for a string, such as a misspelled word in a comment or a URL in a config file.

A code graph stores the relationship itself, a call, an import or an inheritance edge with a direction and a type. A call can exist when the names do not match. A file can import `charge` as `take_payment` and then call `take_payment()`. Grep for the original name finds the import and misses the call. The import edge still connects them, because the parser read the alias in the syntax tree. [What is a code knowledge graph?](https://graphify.com/blog/what-is-a-code-knowledge-graph) works through this in more detail.

Embeddings return the chunks of text whose vectors are closest to a question. That is useful for fuzzy search over prose. Similar text is not the same as connected code. A caller in another file can look nothing like the function it calls, so vector search may miss it, while the call edge is still in the graph. A code graph follows stored edges such as calls, imports and inheritance. [Why vector search isn't enough for coding agents](https://graphify.com/blog/why-vector-search-isnt-enough-for-coding-agents) shows one real path, with a label on every hop. The comparison with retrieval over similar passages is also in [Code knowledge graph vs RAG](https://graphify.com/blog/code-knowledge-graph-vs-rag).

## How do AI coding agents use a code graph over MCP?

An agent reaches a code graph through an MCP server, which exposes the graph as tools the agent can call in the middle of a task. It asks for the callers of a function, the path between two symbols or the code a change touches, and gets back nodes and edges with a file and line.

On Graphify those tools include `graphify_callers`, `graphify_trace` and `graphify_impact`. The agent signs in with OAuth, so there is no API key to paste. The endpoint is `https://api.graphify.com/mcp`. The [Graphify MCP server](https://graphify.com/mcp) page lists the rest and the setup for each agent, including the Claude connector.

## Where does Graphify fit?

Graphify builds the code graph from your repository and puts shared codebase context on top of it: a Wiki generated from the graph, Memory that ties what your agents learn to the code it is about, and pull request reviews that show what a change affects. The graph is the map underneath. The [Wiki](https://docs.graphify.com/platform/wiki), [Memory](https://docs.graphify.com/platform/memory) and [pull request reviews](https://docs.graphify.com/platform/reviews) all read from it.

Connect a repository at [app.graphify.com](https://app.graphify.com). Agents connect to the hosted MCP server at `https://api.graphify.com/mcp`, and a push to the default branch starts an incremental rebuild. Agents keep using the previous graph until the new one is ready, as [How it works](https://docs.graphify.com/platform/how-it-works) explains.

Start free at [app.graphify.com](https://app.graphify.com). To build the graph on your own machine instead, install open-source Graphify with `uv tool install graphifyy`. In the project, `/graphify .` writes `graph.html`, `GRAPH_REPORT.md` and `graph.json` under `graphify-out/`. The [CLI quickstart](https://docs.graphify.com/open-source/cli-quickstart) has the terminal commands, including `graphify extract .`.

## FAQ

### What is a code graph?

A code graph is a map of a codebase built by parsing the source. Functions, classes, files and modules become nodes, and calls, imports, inheritance and references become typed edges between them. An AI coding agent follows those edges to see what calls a function or what a change reaches, and each hop points to a file and line.

### How is a code graph built?

A code graph is built by parsing the source with a parser such as tree-sitter. Declarations become nodes, and calls, imports, inheritance and references become typed edges. A second pass resolves each name to a declaration, and every edge keeps its file, line and a provenance tag.

### How is a code graph different from grep?

Grep returns the lines that contain a string. A code graph stores the relationship itself, a call, an import or an inheritance edge with a direction and a type. A call can exist when the names do not match. Grep for the original name finds the import and misses the call. The import edge still connects them.

### How is a code graph different from embeddings?

Embeddings return the chunks of text whose vectors are closest to a question. A code graph follows stored edges such as calls, imports and inheritance. A caller in another file can look nothing like the function it calls, so vector search may miss it, while the call edge is still in the graph.

### How do AI coding agents use a code graph over MCP?

An agent reaches a code graph through an MCP server, which exposes the graph as tools the agent can call in the middle of a task. It asks for the callers of a function, the path between two symbols or the code a change touches, and gets back nodes and edges with a file and line.

### Where does Graphify fit?

Graphify builds the code graph from your repository and puts shared codebase context on top of it: a Wiki generated from the graph, Memory that ties what your agents learn to the code it is about, and pull request reviews that show what a change affects. Agents connect to the hosted MCP server at `https://api.graphify.com/mcp`, and a push to the default branch starts an incremental rebuild.
