# Zed

> Connect Zed's agent to Comity's MCP server and add Comity's instructions to the project instructions file. Zed has no hooks.

Zed's built-in agent uses Comity through MCP and its project instructions. Zed doesn't document agent hooks, so nothing is automatic: no briefings, no recorded edits and no blocks. The agent only knows about Comity because the instructions tell it to call the tools. See [What works without hooks](/docs/agents/mcp-clients#what-works-without-hooks).

## Set up

```sh
cd your-repo
comity init --tools zed
git add AGENTS.md
git commit -m "Set up Comity for Zed"
```

Then add the MCP server to your **user** settings (`zed: open settings file`). It runs the [stdio bridge](/docs/agents/mcp-clients#stdio-bridge-comity-mcp), so there's no token in any config: `comity login` is enough.

```json
{
  "context_servers": {
    "comity": {
      "command": "node",
      "args": ["-e", "const c=require('child_process').spawn('comity '+process.argv.slice(1).join(' '),{stdio:'inherit',shell:true});c.on('error',()=>process.exit(1));c.on('exit',(k)=>process.exit(k===null?1:k))", "mcp"]
    }
  }
}
```

`comity init` prints this entry. The `node -e` launcher runs `comity mcp` through your shell and works the same on every OS; Node must be on your PATH, which the CLI needs anyway. Zed documents `context_servers` for the user settings file only, so init doesn't write it into the repo.

## What init writes

Comity's coordination instructions go into a block marked `<!-- comity:start -->` … `<!-- comity:end -->` in the project instructions file. Zed reads only the first of `.rules`, `.cursorrules`, `.windsurfrules`, `.clinerules`, `.github/copilot-instructions.md`, `AGENT.md`, `AGENTS.md`, `CLAUDE.md` and `GEMINI.md` it finds ([Zed instructions](https://zed.dev/docs/ai/instructions)). init writes into that file, or creates `AGENTS.md` if the repo has none. The rest of the file stays as it is.

## Verify

```sh
comity doctor
```

Expect `zed instructions  Comity block in …` and `zed mcp  context_servers.comity in …/zed/settings.json`. In Zed, **Settings → AI → MCP Servers** should show `comity` with a green dot.

## Limits

- No hooks: no automatic briefings, conflict warnings or blocks, and the agent's edits aren't recorded.
- Tools can't infer the repo. The instructions tell the agent to pass `repo` (`owner/name`).
- Zed asks before every MCP tool call unless you allow them in `agent.tool_permissions` (for example, `mcp:comity:team_context`).
