# Code Graph

> Connect an agent to it and the agent finds code by structure — who calls a function, what it calls, where a symbol lives — instead of grepping and reading file after file.

Source: https://docs.neurosquad.ai/en/plugins/code-graph

To answer "what calls `processOrder`?" an agent usually greps, opens a file, greps again, opens the
next one — and spends thousands of tokens on code it didn't need. The **Code Graph** plugin indexes
your workspace's code into a knowledge graph — functions, classes, methods, calls, imports, routes —
with [codebase-memory-mcp](https://github.com/DeusData/codebase-memory-mcp), an open-source engine by
DeusData. A connected agent asks the graph instead and gets the answer in one call.

## How to use it

1. In the add-card menu choose **Plugin…**, open **Code Graph** in the **Plugins** tab and press
**Add to canvas**.
2. Press **Download** on the card. NeuroSquad downloads the official codebase-memory-mcp build from
GitHub (about 40 MB; about 300 MB once unpacked) and checks it against the checksum pinned in the
app — a file that doesn't match is deleted. This happens once.
3. Press **Build graph**. Most projects take seconds, a very large one a few minutes.
4. Draw an [arrow](https://docs.neurosquad.ai/en/canvas/arrows) from an agent to the card.

The agent now has the graph tools. Most CLIs pick them up without a restart; remove the arrow and
they are gone.

## What the agent can do

| Tool | What it answers |
| --- | --- |
| `codegraph_search_graph` | Find functions, classes and other symbols by name, pattern or meaning |
| `codegraph_trace_path` | Who calls a function and what it calls, several hops deep |
| `codegraph_get_code_snippet` | The source of one symbol, without opening the whole file |
| `codegraph_query_graph` | Read-only Cypher queries for multi-step questions |
| `codegraph_get_architecture` | Languages, packages, entry points, routes, hotspots |
| `codegraph_search_code` | Text search ranked by the graph |
| `codegraph_get_file_outline` | Everything declared in one file |
| `codegraph_detect_changes` | Which symbols your uncommitted changes affect |
| `codegraph_get_graph_schema`, `codegraph_index_status`, `codegraph_check_index_coverage` | What's in the graph and how complete it is |
| `codegraph_reindex` | Re-index now, after edits made a moment ago |

You can simply ask: "use the code graph to find everything that calls `validateOrder`".

## The card

- **The main fact** — how many symbols the graph holds, with files, calls and links, and whether
it's up to date.
- **A search box** — try a name and see where it's defined.
- **What's in it** — functions, interfaces, classes, types and the languages of the project.
- **Agents using it** and the last graph call each of them made.

## Always up to date

With **Auto-update** on (the default), the card notices when files change and re-indexes a few
seconds later — only what changed, so it's quick. It also refreshes after a connected agent finishes
a turn. Turn it off to update by hand with **Update now**.

> The graph is built from the workspace's folder. An agent working in an isolated worktree still
> queries the graph of the main folder.

## WSL and SSH workspaces

For a workspace inside WSL or on an SSH host, the engine runs **there**, next to the code. The card
shows where — **WSL · Ubuntu** or **SSH · your host**:

- **Download** fetches the engine's Linux build (x86-64 or ARM64, picked by the host's CPU) and
checks it here; the first **Build graph** copies it into NeuroSquad's own folder on that side
(`~/.neurosquad`), checks it again and unpacks it there — once per distro or host.
- The graph lives in that folder too. Nothing is written into your project or the rest of your
home there, and your code doesn't come to this computer: agents get the answers to their queries.
- Freshness: for a WSL project on a Windows drive (`/mnt/c/…`) the card watches the files as
usual; elsewhere it updates after a connected agent's turn and on **Update now**.
- Deleting the card (or the workspace) deletes the graph on that side; quitting NeuroSquad stops
the engine there.

The engine runs on Linux only: an SSH host running macOS shows "No engine build for this host".

## Privacy and storage

Everything runs on your computer. codebase-memory-mcp sends nothing anywhere — no account, no
telemetry, your code never leaves the machine. The engine and the graph live in NeuroSquad's data
folder: nothing is written into your project or your home folder, and if you have your own
codebase-memory-mcp installed, it keeps working separately. Delete the card and its graph is deleted
too.

codebase-memory-mcp is made by DeusData and published under the MIT license.
