# Augment Code

> Set up Comity for Augment's Auggie CLI with native hooks, a workspace rule and the MCP server in your Augment settings.

Auggie CLI runs Comity's hooks on session start, tool calls (shell, file edits, writes, deletes), stop and session end. Comity's coordination instructions go into a workspace rule. The MCP server goes in your user Augment settings.

## Set up

```sh
cd your-repo
comity init --tools augment
git add .augment/hooks/comity.sh .augment/hooks/comity.cmd .augment/rules/comity.md
git commit -m "Set up Comity for Augment"
```

Keep `.augment/settings.local.json` out of git: it is personal and holds an absolute path. Every teammate runs `comity init --tools augment` in their own clone.

Then add the MCP server to your user settings (`~/.augment/settings.json`). It runs the [stdio bridge](/docs/agents/mcp-clients#stdio-bridge-comity-mcp), so there's no token: `comity login` is enough. `comity init` prints this entry:

```json
{
  "mcpServers": {
    "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"]
    }
  }
}
```

The `node -e` launcher runs `comity mcp` through your shell and works the same on every OS; Node must be on PATH. Augment documents MCP servers only in the user settings file ([Integrations and MCP](https://docs.augmentcode.com/cli/integrations)), so init doesn't write this into the repo.

## What init writes

### `.augment/hooks/comity.sh` and `.augment/hooks/comity.cmd`

Augment hook commands must be script paths ending in `.sh`, `.ps1`, `.cmd` or `.bat` ([Augment hooks](https://docs.augmentcode.com/cli/hooks)). Both launchers run `comity hook --tool augment` and exit 0 when the CLI isn't installed. The event comes from the payload's `hook_event_name`.

### `.augment/settings.local.json`

Hooks pointing at this OS's launcher. Your own hooks in the file are kept.

| Augment event | Matcher | Timeout (ms) |
|---|---|---|
| `SessionStart` | | 5000 |
| `PreToolUse` | `launch-process\|str-replace-editor\|save-file\|remove-files` | 5000 |
| `PostToolUse` | same | 10000 |
| `Stop` | | 10000 |
| `SessionEnd` | | 10000 |

### `.augment/rules/comity.md`

An `always_apply` [workspace rule](https://docs.augmentcode.com/cli/rules) with Comity's coordination instructions.

## What your agent sees

- **Session start**: the briefing as `additionalContext`.
- **Before a shell command or file change**: a block denies the call (`permissionDecision: "deny"`) and the agent gets the reason.
- **After a tool call**: new conflicts, messages and queued warnings as `additionalContext`.
- **Prompts**: Augment has no prompt-submit event. Pre-tool warnings are queued and delivered after the next tool call.

## Verify

```sh
comity doctor
```

Expect `augment hooks  .augment/settings.local.json → .augment/hooks/comity launcher`, `augment mcp  mcpServers.comity in ~/.augment/settings.json` and `augment rule  .augment/rules/comity.md`. In Auggie, `/mcp` should list `comity`.

## Limits

- `.augment/settings.local.json` is read only by Auggie CLI. The VS Code and JetBrains extensions read hooks only from system and user settings, so they get MCP and the rule but no hooks.
- No prompt-time context; warnings arrive after the next tool call.
