# Environment variables

> Variables the comity CLI and its hooks read, and what they override.

Environment variables override the stored login (`comity login`) for every command, including the hooks and MCP header helpers your agents run. Set them in the environment your agent starts from.

## Connection

| Variable | Default | Effect |
|---|---|---|
| `COMITY_SERVER` | stored server, else `https://api.comity.so` | Server URL. Used by every command, the hooks and `comity login` (when `--server` is not given). Must be `http://` or `https://`. |
| `COMITY_TOKEN` | stored token | API token (`cmt_…`). Overrides the stored login everywhere. `comity logout` does not unset it. |
| `COMITY_WEB_URL` | the web origin you logged in through, else `https://comity.so` | Dashboard address used by `comity open`. |

`COMITY_SERVER` and `COMITY_TOKEN` together are enough to run without `comity login`, for example in CI:

```sh
export COMITY_SERVER=https://api.comity.so
export COMITY_TOKEN=cmt_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
comity doctor
```

`comity status`, `comity whoami` and `comity doctor` show whether each value came from the environment (`[env]`) or the config file (`[file]`).

## Behavior

| Variable | Effect |
|---|---|
| `COMITY_SHARE_STATUS=0` | Don't send the end-of-turn status (the agent's last message excerpt and files touched) to Comity. `false`, `off` and `no` also work. Teammates then see no status for your sessions. The org-wide switch is the [`share_session_status`](/docs/admin/policies#share_session_status) policy. |
| `COMITY_NO_BROWSER` | `comity login` and `comity open` print the URL instead of opening a browser. Any non-empty value. |
| `COMITY_DEBUG=1` | `comity mcp` logs each forwarded message (method and id, never the token) and transport errors to stderr. Without it, only errors are logged. `true` also works. |

## Update checks

| Variable | Effect |
|---|---|
| `COMITY_NO_UPDATE_CHECK=1` | Turn off the background update check. Any value except empty, `0` or `false`. Same as `--no-update-check`. |
| `CI` | When set (not empty, `0` or `false`): no update checks, no interactive questions, no colors. |
| `COMITY_UPDATE_URL` | Override the release manifest URL (default `<server>/cli/latest.json`). For testing. |

See [CLI reference → Updates](/docs/reference/cli#updates).

## Terminal output

| Variable | Effect |
|---|---|
| `NO_COLOR` | Any non-empty value turns colors off. |
| `FORCE_COLOR` | `0` turns colors off; any other value (or empty) turns them on, even without a terminal. |

`--json` output is never colored or interactive.

## Paths

| Variable | Effect |
|---|---|
| `XDG_CONFIG_HOME` | macOS/Linux: config folder is `$XDG_CONFIG_HOME/comity` instead of `~/.config/comity`. |
| `APPDATA` | Windows: config folder is `%APPDATA%\comity`. |
| `COMITY_CLI_DIR` | omp bridge only: folder of the installed CLI package (containing `comity.mjs`) when it can't be found next to `comity` on `PATH`. |

## Read from agent hosts

The hook command reads a few variables that agent hosts set themselves, to tell which host invoked it and where: `CLAUDE_PROJECT_DIR`, `CLAUDE_CODE_REMOTE`, `CURSOR_VERSION`, `CURSOR_PROJECT_DIR`, `CURSOR_CODE_REMOTE`. You don't set these.
