# Graph Indexer for Kilo Code

> Add Graph Indexer to Kilo Code with npx graph-indexer init: it merges the server into kilo.json or opencode.json and installs a .kilo plugin with --hooks.

Graph Indexer for Kilo Code is a local MCP server that gives Kilo Code exact references, call graphs and change impact from an index of your repository. Run `npx graph-indexer init` and it adds a `graph-indexer` server to `kilo.json` or `opencode.json`, whichever Kilo Code uses in your project.

## How do I add Graph Indexer to Kilo Code?

From the repository root, with Node.js 22.5 or later:

```bash
npx graph-indexer init
```

`init` recognises Kilo Code from `kilo.json`, `kilo.jsonc`, a `.kilo` folder or a `.kilocode` folder. To force the target, run `npx graph-indexer init --agents opencode`: Kilo Code shares its init target with [OpenCode](/agents/opencode/), because Kilo Code is rebuilt on OpenCode and reads the same configuration.

## What does `npx graph-indexer init` change for Kilo Code?

For Kilo Code, `init` touches these files:

| File | Content |
|---|---|
| `kilo.json` or `.kilo/kilo.json` if it exists, else `opencode.json` | A `graph-indexer` entry under `mcp`, merged with your other servers |
| `AGENTS.md` | A managed block with the lookup rules and when to call each tool |
| `.gitignore` | `.graph-indexer/`, where the local index lives |
| `.kilo/plugin/graph-indexer.js` | The plugin, only with `--hooks` |

Use `--dry-run` to preview and `--no-instructions` to skip the `AGENTS.md` block. If the config file contains comments, `init` does not rewrite it; it prints the entry to paste in instead.

## What does the manual Kilo Code configuration look like?

Kilo Code uses the OpenCode format: a `mcp` object, type `local`, and the command as one array.

```json
{
  "mcp": {
    "graph-indexer": {
      "type": "local",
      "command": ["npx", "-y", "graph-indexer@3", "serve"],
      "enabled": true
    }
  }
}
```

Put it in `kilo.json` if you have one, or in `opencode.json`. The server indexes the git repository of the directory it starts in, so no `--repo` is needed.

## What does the Kilo Code plugin do?

The Graph Indexer plugin appends short context to the output of Kilo Code's `read`, `grep`, `bash`, `edit` and `write` tools. It queries the repository's resident Graph Indexer process over a local socket, never the network. It adds where the names in a read are defined once the agent is crawling, where a definition that a search missed lives, and what an edit broke.

Kilo Code can load a plugin from both `.kilo/` and `.opencode/`; the plugin guards against registering twice. If the process does not answer, it adds nothing and starts it in the background for the next call. Install it with `npx graph-indexer init --hooks`.

## What does Kilo Code gain from Graph Indexer?

Kilo Code's agent gets eight read-only tools. `find_references` returns every real use of a symbol, grouped by file and enclosing function, with a confidence label. `change_impact` lists dependents and the tests to run before a signature change. `check_changes` verifies edits without building.

Against the TypeScript compiler on 400 nestjs symbols, `find_references` reached 99.7% precision and 96.2% recall; grep reached 12.8% precision ([benchmarks](/benchmarks/)). Graph Indexer is not a type checker, and generics, reflection and `any` are only partly visible. Graph Indexer itself makes no network calls and sends no telemetry; Kilo Code still sends what it reads to its model provider. More in the [tools reference](/tools/) and the [agents overview](/agents/).

## Frequently asked questions

### Which config file does Graph Indexer write for Kilo Code?

An existing kilo.json (or .kilo/kilo.json) if one is present, otherwise opencode.json. Kilo Code is built on OpenCode and reads opencode.json too, so both agents share one entry format and one init target.

### Where does the Kilo Code plugin go?

With --hooks, init writes .kilo/plugin/graph-indexer.js when it detects Kilo Code files. It also writes .opencode/plugins/graph-indexer.js if OpenCode files are present. The plugin registers only once if both locations load.

### Does it work in the Kilo Code VS Code extension and the CLI?

Yes. init treats Kilo Code as one target covering both the CLI and the VS Code extension, rebuilt on OpenCode. The server is plain MCP over stdio, so anything that reads the project configuration can start it.

### Do I need to pass --repo for Kilo Code?

No. Without --repo, Graph Indexer indexes the git repository of the directory it starts in. Pass --repo or set GRAPH_INDEXER_REPO only if the server runs from outside the project.

---

Updated: 2026-10-08 · Graph Indexer 3.0.0 · https://graph-indexer.vercel.app/agents/kilo-code/
