Docs

Reference

Environment variables

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

3 min readUpdated

On this page

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 https://; plain http:// only for localhost, 127.0.0.1 or ::1.
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:

Terminal
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]).

Which credentials apply

Every command, hook and MCP helper picks credentials for the folder it runs in, in this order:

  1. COMITY_TOKEN, if set. The server is COMITY_SERVER, else the repo's comity.json server, else your last login's, else https://api.comity.so. A comity.json server is used only when it is COMITY_SERVER, https://api.comity.so, or a server you have logged in to on this machine: otherwise nothing is sent and the CLI says to set COMITY_SERVER if you trust that host (a committed file can't redirect your token).
  2. The login for the org in the repo's comity.json. Its server wins over the login's: a login for that org on another server doesn't count. With no matching login, nothing is sent to any org and the CLI says to run comity login --org <org>.
  3. Only in repos without comity.json: the default org (comity use <org>).

COMITY_SERVER overrides the server in every case. comity whoami and comity orgs show which org applies here and why.

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 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.
COMITY_FAIL_OPEN=1 Emergency override for fail-closed repos: while Comity is unreachable, hooks in this environment let edits through that the policy would block. Each use is reported to the org (hook.fail_open in the audit log) once Comity answers again. Any value except empty, 0 or false. Blocks Comity itself answers with still apply. The interactive alternative is comity fail-open.

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 where update checks look: a release manifest URL in the <server>/cli/latest.json format (default: the npm registry on Comity Cloud, <server>/cli/latest.json on a self-hosted server). For testing.

See CLI reference → 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.
LOCALAPPDATA Windows: config folder is %LOCALAPPDATA%\comity (not the roaming profile). A folder left in %APPDATA%\comity by a CLI before 0.9.0-beta.2 is moved there on the next command.
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.

Try Comity now.

Start free →

npm i -g comity-cli && comity login && comity init