# Roo Code

> Connect Roo Code to Comity's MCP server and add the coordination rules.

Roo Code has no hook system, so Comity cannot see or block its edits as they happen. `comity init` connects Roo to the Comity MCP server and adds rules that tell the agent to declare its work and check for conflicts through Comity's tools.

## Set up

```sh
cd your-repo
comity init --tools roo
git add .roo/mcp.json .roo/rules/comity.md
git commit -m "Set up Comity for Roo Code"
```

Reload the VS Code window and make sure the `comity` server is enabled in Roo's MCP panel. There is no token in the repo: `comity login` is enough.

## What init writes

### `.roo/mcp.json`

```json
{
  "mcpServers": {
    "comity": {
      "command": "node",
      "args": ["-e", "<launcher>", "mcp"]
    }
  }
}
```

Roo starts `comity mcp`, a local proxy to the Comity server that authenticates with your `comity login` (or `COMITY_TOKEN`). The entry is the same on every OS, so the committed file never changes between teammates; it needs Node on `PATH` (the CLI needs it anyway). `<launcher>` stands for a one-line Node script that starts `comity mcp` through your shell, so it finds the npm `comity` shim on every OS. Other servers in the file are kept.

### `.roo/rules/comity.md`

The coordination rules inside a `<!-- comity:start -->` … `<!-- comity:end -->` block. Roo adds every file in `.roo/rules/` to its system prompt. Re-running init updates only that block.

## Verify

```sh
comity doctor
```

Expect `roo mcp  comity server in .roo/mcp.json` and `roo rules  .roo/rules/comity.md is current`. Doctor warns about an entry from an older init that reads `${env:COMITY_TOKEN}` while it is unset.

## Limits

- No hooks: Comity only knows what the agent reports through MCP tools (`intent_declare`, `scope_check`, …). Edits are never blocked automatically.
