Docs

Reference

CLI reference

Every comity command, flag, exit code and config file.

26 min readUpdated

On this page

The comity CLI signs you in, writes agent configuration into your repos, checks your setup and runs inside your agents' hooks. It needs Node.js 22 or newer.

npm i -g comity-cli
Terminal
comity --version

Running comity with no arguments shows a home screen: your account, the server, the current repo, which agents are set up there (✔ ready, ! partial, – missing) and the next command to run.

Global options

Option Effect
--help, -h With no command: the command overview. After a command (comity init --help): that command's usage, options and examples.
--version, -v Print the CLI version. comity version does the same.
--no-update-check Skip the update check for this run. See Updates.

Unknown commands exit with code 2 and suggest the closest match.

comity login

Output
comity login [--org <org>] [--server <url>] [--token <cmt_…>]

Signs in to one org and stores its credentials on this machine. Logging in to another org adds it; your other logins stay. The first org you log in to becomes the default org (change it with comity use).

Option Description
--org <org> Preselect this org on the approval page. Default: the org in this repo's comity.json. With --token, a token of another org is refused.
--server <url> Comity server. Default: COMITY_SERVER, the server in this repo's comity.json, your last login's, else https://api.comity.so. A comity.json server you have no login for (other than https://api.comity.so) is used only after you confirm its host at a prompt; without a terminal, pass --server. Plain http:// only for localhost, 127.0.0.1 or ::1.
--token <cmt_…> Use an existing token instead of the browser. For headless machines and CI.

Without --token (and without COMITY_TOKEN), login uses a browser device flow:

  1. The CLI prints a short code and the URL https://comity.so/cli, and opens it in your browser (unless COMITY_NO_BROWSER is set).
  2. Signed in to Comity, you type the code on that page. It shows the requesting device's name, when the login started and the IP address it came from; you pick the org and approve (or deny). The page never takes the code from a link, so deny any code someone else gave you.
  3. The CLI polls until the server mints a personal token named cli · <hostname> and saves it.

The CLI then verifies the token with GET /v1/me and prints the account, org and role:

Output
✔ Logged in as diego@acme.com · org acme · role member
  Server https://api.comity.so · credentials saved to /home/diego/.config/comity/config.json

Next: run comity init in each repo.

A token must look like cmt_ followed by 43 base64url characters. A rejected token (revoked, expired, or issued by a different server) fails with token rejected by server.

Logging in again to an org this machine is already logged in to replaces the stored token and revokes the previous one on the server, if comity login created it (a cli · <hostname> token). Tokens you passed with --token are only replaced locally.

Terminal
comity login
comity login --server https://comity.internal.example.com
comity login --token cmt_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

comity logout

Output
comity logout [--org <org> | --all]

Removes stored credentials: one org's with --org, every org's with --all. With a single login no flag is needed; with several, one of the two is required (exit 2). If COMITY_TOKEN is set in the environment, the CLI warns that it keeps authenticating.

Logout also revokes the token on the server when comity login created it (DELETE /v1/tokens/:id). If the server can't be reached, the login is still removed from this machine and the CLI tells you to revoke the token on the Team tab (Tokens). A token you passed with --token stays valid, because something else may use it; the CLI says so.

The machine id in the config file is kept, so after the next comity login your agents' running conversations continue as the same Comity sessions.

comity orgs

Output
comity orgs [--json]

Lists the orgs you're logged in to (slug, name, email, server), marks the default org with * and the org that applies in the current repo. --json prints {default_org, orgs: [{slug, name, email, server, default, current}], repo: {binding, org, via, problem}, env_token}.

comity use

Output
comity use <org>

Sets the default org: the one repos without a comity.json report to. Repos with a comity.json always use their own org. Fails if you aren't logged in to that org.

comity init

Output
comity init [--org <org>] [--tools <ids>|all] [--yes] [--server <url>] [--verbose]
comity init --explain <agent>
comity init --global [--tools claude_code,omp]

Binds the current repository to an org by writing comity.json, and writes Comity's hook, MCP and agent-instruction configuration into it (at the git top level).

Option Description
--org <org> Org this repo belongs to. Written to comity.json.
--tools <list> Comma-separated agent ids, or all. Skips the question. Ids: claude_code, codex, cursor, copilot, gemini, windsurf, kiro, cline, roo, opencode, amp, droid, zed, continue, goose, junie, augment, omp.
--yes, -y No questions: use --tools, or the agents found on this machine.
--server <url> Server for this repo's hooks and MCP config, saved in comity.json. Default: the server in comity.json, then your login's.
--verbose List every file written (created, updated or unchanged) and each agent's full setup steps, including config to paste by hand.
--explain <agent> Print one agent's full setup steps; writes nothing. Config you add by hand (the user-level MCP entry of Windsurf, Cline, Zed, goose or Augment) is printed ready to paste and, in a terminal, copied to the clipboard. Takes the same names as --tools.
--global User-level hooks instead of repo files: see below. Default tool claude_code; --tools may name claude_code and omp.

init only works in a git repository. Run outside one, it writes nothing and says Comity works on git repositories. This folder isn't one yet. In an interactive terminal it then asks Run git init here? (Y/n); after git init it says that hooks activate after the first commit and, when the folder already has files, offers to commit them as the first commit (default no). In a pipe, in CI or with --yes it exits 1 and prints the commands to run (git init, git add -A, git commit -m "Initial commit", comity init). --global works in any folder.

Which org init binds: --org; else the org already in comity.json; else your only login. Logged in to several orgs, init asks in a terminal, uses the default org with --yes, and otherwise exits 2 asking for --org.

In an interactive terminal without --tools or --yes, init lists the agents found on this machine (an executable on PATH or a config folder in your home directory) first, pre-selected and grouped by how Comity reaches them (hooks + MCP, or MCP + instructions only), then every other supported agent under Not found on this machine, dimmed and not selected. Space toggles, a toggles all, Enter confirms. Cancelling writes nothing (exit 130).

In a pipe, in CI, or with --yes, init sets up the agents found on this machine unless --tools says otherwise. When it finds none, it writes only comity.json and says how to pick agents with --tools. (Before CLI 0.6.9 the default was claude_code,codex, installed or not.)

Files written per agent:

Agent Files
claude_code .claude/settings.json (hooks), .mcp.json (MCP server comity)
codex .codex/hooks.json (hooks), .codex/config.toml ([mcp_servers.comity])
cursor .cursor/hooks.json, .cursor/mcp.json, .cursor/rules/comity.mdc
copilot .github/hooks/comity.json, .github/mcp.json (Copilot CLI), .vscode/mcp.json (VS Code)
gemini .gemini/settings.json (hooks + MCP), GEMINI.md (Comity block)
windsurf .windsurf/hooks.json, .windsurf/rules/comity.md (MCP is user-level: comity init --explain windsurf prints the entry)
kiro .kiro/hooks/comity.json, .kiro/settings/mcp.json, .kiro/steering/comity.md
cline .clinerules/hooks/<Event> scripts (MCP is user-level: comity init --explain cline prints the command)
roo .roo/mcp.json, .roo/rules/comity.md
opencode .opencode/plugins/comity.ts (plugin), opencode.json (MCP)
amp .amp/plugins/comity.ts (plugin), .amp/settings.json (MCP)
droid .factory/hooks.json, .factory/mcp.json, AGENTS.md (Comity block)
zed AGENTS.md (or the instructions file Zed already reads; MCP is user-level: comity init --explain zed prints the entry)
continue .continue/mcpServers/comity.yaml, .continue/rules/comity.md
goose .agents/plugins/comity/plugin.json + hooks/hooks.json, AGENTS.md (MCP is user-level)
junie .junie/comity-hooks.json, AGENTS.md (hooks and MCP are user-level: comity init --explain junie prints both)
augment .augment/hooks/comity.sh + comity.cmd, .augment/rules/comity.md, personal .augment/settings.local.json (not committed)
omp .omp/extensions/comity/index.ts (bridge extension), .omp/mcp.json (MCP server comity)

init merges into existing files: it replaces only handlers whose command runs comity hook, only the comity MCP entry and only the marked Comity block of shared instruction files (AGENTS.md, GEMINI.md), keeps everything else, and is safe to re-run. It writes or updates comity.json with the org and server. No token is ever written to the repo. The exact contents, approvals and limits are on each agent's page.

After writing, init prints a short summary: a header with the repo and its org (plus comity init --org <slug> to change it when you're logged in to several orgs), one line per agent set up with one or two things left to do (trust prompts, approvals, user-level MCP entries via comity init --explain <agent>), how many files it wrote, comity doctor to check everything and, for the repo files that changed, the git add / git commit command, so teammates get the same setup when they pull. --verbose lists each file and every step.

When you're logged in to the org and the repo has a remote or at least one commit, init also registers the repo with the org, the same way an agent's first hook would, so an admin can add it to a project (POST /v1/projects, see the REST API) right away. The header shows the outcome: ✔ Repo acme/api registered in org acme (or already registered); otherwise it reads ✔ Repo api bound to org acme, followed by ! Comity won't coordinate this repo yet: … with the reason and what to do, such as the plan's repo limit. A server older than this CLI registers the repo when an agent first runs there.

In a repo without a remote, init says so: i No git remote: Comity identifies this repo by its first commit (…). The repo is registered as local/<folder>-<sha:7>, and a remote added later joins it (see Repos without a remote). Before the first commit it warns ! No commits yet: … and registers nothing: agents stay out of Comity until the first commit.

Terminal
comity init
comity init --org acme
comity init --yes
comity init --tools claude_code,omp
comity init --tools cursor,gemini
comity init --tools all --yes
comity init --explain windsurf
comity init --global --tools claude_code,omp

User-level hooks (--global)

Claude Code reads .claude/settings.json, and omp reads .omp/extensions, only from the folder a session starts in, so an agent started in a monorepo subfolder misses the hooks committed at the root (comity doctor in that folder warns claude_code subfolder / omp subfolder). comity init --global writes hooks that load in every folder instead:

Agent File
claude_code ~/.claude/settings.json ($CLAUDE_CONFIG_DIR/settings.json): the six hooks, each command ending in comity hook … --global
omp ~/.omp/agent/extensions/comity/index.ts (the active omp agent directory): the bridge, evaluating with --global

A --global hook acts only in repos with a comity.json; elsewhere it sends nothing, not even to your default org. It stays quiet when the session also loaded the repo's own Comity hooks (Claude Code: .claude/settings*.json in the folder the session started in, CLAUDE_PROJECT_DIR; omp: .omp/extensions/comity in its working directory), so no event reaches Comity twice. --global writes nothing into the repo and no binding, so it refuses --org and --server; run it once per machine, and comity init once per repo.

comity.json

comity init writes comity.json at the repo root. Commit it: it tells every teammate's CLI which org the repo's agents report to. It holds no secrets.

JSON
{
  "$schema": "https://comity.so/schemas/comity.json",
  "org": "acme",
  "server": "https://api.comity.so"
}
Field Description
$schema JSON Schema for editors. Optional.
org Slug of the org this repo belongs to. Required.
server Comity server of that org. Optional; overrides the server of your login for this repo.

The CLI uses the nearest comity.json from the current folder up to the repo root. In a bound repo:

  • hooks and MCP use your login for that org, whatever your default org is, and send X-Comity-Org: <org> so the server refuses a token of another org (409 org_mismatch) before recording anything;
  • without a login for that org, nothing is sent to any org and the agent gets one notice per session: "This repo uses Comity org acme. Run comity login --org acme."

Repos without comity.json (set up before CLI 0.6) keep working with your default org. Run comity init in them to bind them. See Multiple orgs.

comity status

Output
comity status [--json]

Shows:

  • Account: user, org, role, server (and whether it came from the environment or the config file).
  • Plan: plan name, active developers this month and repos against the plan's limits, and who is not coordinated when over a limit.
  • Repo: path, remote fingerprints, branch, HEAD and merge base with the default branch. A repo without a remote shows (none) identified by its first commit <sha>; with no commit either, (none, and no commits yet: hooks start after the first commit).
  • Your intents: your live intents in this repo with status, branch and claim count. When the org doesn't know the repo, it shows why, from the same read-only probe as comity doctor's coordination check: for example ! Comity isn't coordinating this repo: Comity Free covers 3 repos … › Ask an owner to upgrade or archive a repo (coordination {detail, fix} in --json). With no such reason it shows ! this repo isn't registered with Comity yet: run an agent here or comity init. Both set repo_registered: false in --json.
  • Teammates online: other developers' live agents (● active, ○ idle) with tool, branch and intent.

--json prints the same data as one JSON object (server, server_source, token_source, user, org, usage, repo, intents, teammates, plus *_error fields for sections that failed).

comity doctor

Output
comity doctor [--json]

Checks the whole chain from config to a real hook round trip. Each warning or failure prints a › line with the fix.

Check What it verifies
config Server and token are configured (and where from); the token has the cmt_ shape.
server GET /healthz answers, with how much of the time was connection setup (DNS, TCP, TLS). Warns when it is above the time a pre-edit check may take (400 ms once connected plus the setup, at most 800 ms): such checks are skipped.
token GET /v1/me accepts the token and it has the hooks:evaluate and mcp:tools scopes.
git You are in a git repo that has a remote, or at least one commit (a repo without a remote is identified by its first commit). Warns in a repo with neither: hooks are inactive there until the first commit.
<agent> hooks, <agent> mcp, … One group per agent in use here: one comity init set up in this clone (recorded in its git directory, never committed), or one found on this machine (on PATH or with its user config folder) that has its own Comity config in this repo or your user config. Other agents are skipped and never affect the result: a teammate's agent committed to the repo, or a Comity block in an instructions file several agents read (AGENTS.md, CLAUDE.md, GEMINI.md, .rules, …), doesn't make doctor degraded. Checked: hooks installed for every event, the comity MCP entry present and authenticating, the rules/instructions block current. Generated files are compared ignoring line endings, so a CRLF checkout (core.autocrlf=true) counts as current. Hooks from an older comity init with a different matcher (Claude Code before 0.4.1: no ExitPlanMode) warn "update available"; rerun comity init. Agents whose MCP entry lives in user-level config the CLI does not write (Windsurf, Cline, Zed, goose, Junie, Augment) warn until you add it. omp mcp checks the MCP files omp loads in the folder doctor runs in (.omp/mcp.json there, then ~/.omp/agent/mcp.json). claude_code trust warns when .mcp.json relies on comity mcp-headers, COMITY_TOKEN is unset and ~/.claude.json shows Claude Code hasn't trusted the repo folder (no line when that file is missing). Trust checks for an agent that has never been used in this repo (claude_code trust, codex trust, codex hook trust) are i notes instead of warnings.
agents Warns when no agent in use here is set up at all.
round trip Sends one read-only session_start probe (probe: true) to /v1/hooks/evaluate: the server answers like a hook but starts no session, delivers no messages, sends no arrival notices and records no usage. Shows the server's share (its Server-Timing header) and warns when the probe plus a hook's own connection setup exceeds the pre-edit limit.
coordination Fails when the probe's answer carries the notice an agent's SessionStart would get because Comity won't coordinate this repo: the repo isn't registered and the org doesn't add repos automatically, the plan's repo limit is reached, or the org is suspended. The › line says what to do.
shared tasks Lists the repo's shared task lists with their open and claimed counts, and notes a file list whose file is missing from this checkout. Informational: never changes the exit code.
same checkout A note when two or more of your agent sessions are live in this checkout: Comity never compares them, so it shows the git worktree add command for a checkout per agent (see One checkout per agent). Informational: never changes the exit code. comity status shows the same as "Your agents in this checkout".
codex task approval Codex: task_accept is set to approval_mode = "prompt" in .codex/config.toml, so accepting a work request in an interactive Codex session shows Codex's approval prompt. codex exec (approval policy never) can't ask: Comity refuses accepts from such sessions and you answer in the dashboard. Warns when the setting is missing (rerun comity init --tools codex); informational when your Codex config sets approval_policy = "never" for every session.
CLI up to date Compares your version with the latest release.
skipped checks This machine's before-edit/before-command checks against this server that were skipped in the last 24 h (no answer within the limit, unreachable, or a 5xx), with the latest cause and what to check. Warns when there are any.

Exit codes: 0 all checks passed, 1 degraded (warnings), 2 broken (failures). --json prints {"result": "ok" | "warn" | "fail", "checks": [{"name", "level", "detail", "fix"?}]}.

JSON
{
  "result": "warn",
  "checks": [
    { "name": "config", "level": "ok", "detail": "server https://api.comity.so [file], token [file], /home/diego/.config/comity/config.json" },
    { "name": "codex hooks", "level": "warn", "detail": "missing SessionEnd", "fix": "run `comity init --tools codex`" }
  ]
}

comity whoami

Output
comity whoami [--json]

Prints the signed-in user, the org that applies in this folder (name and slug) and why (COMITY_TOKEN, the repo's comity.json, or the default org), role, server, and token name and kind. --json prints the GET /v1/me response plus server. Exits 1 when not logged in.

comity handoff

Output
comity handoff <email|@name> [--intent INT-n] [--note "…"] [--tried "…"]... [--summary "…"] [--next "…"]... [--no-context] [--yes] [--json]

Hands one of your intents off to a teammate: they become its owner and their agents pick it up at their next tool call or prompt. See Handoffs.

Option Description
<email> / @name The teammate. @name matches a member by name, first name or email local part, case-insensitive (@jordan).
--intent INT-n The intent to hand off. Default: your only live intent in the current repo; with several, the command fails and lists them.
--note "…" A note for the teammate, up to 2,000 characters.
--tried "<what> => <result>" Something you tried that didn't work, so their agent doesn't repeat it. Repeatable, up to 10. Without => the whole text is the what. See Tried, didn't work.
--summary "…" Where things stand, for the context pack (up to 600 characters).
--next "…" A next step for the context pack. Repeatable, up to 8.
--no-context Send no context pack.
--yes Don't ask for confirmation. Required outside a terminal (scripts, pipes, agents): without it the CLI refuses and hands off nothing. In a terminal the CLI first does a dry run and shows its warnings, then asks before handing off: a protected path the teammate doesn't own (which would block their intent_adopt until an override is approved), open blocking conflicts they would inherit, and work only your checkout has on the intent's branch (a branch with no upstream, unpushed commits, uncommitted changes). The result repeats the warnings.
--json Print the result as JSON.

It uses your comity login token, whose default scopes include intents:write and members:read.

Context pack. Unless you pass --no-context, the CLI builds a context pack on this machine. It asks the server (dry run) for your agent sessions that carried the intent, finds the newest one whose transcript is on this machine (Claude Code or Codex), and extracts only which files it read and changed (repo-relative) and which commands it ran and whether they passed; commands that only look around (ls, cat, grep, git status, …) are skipped. No messages, command output or file contents are read into the pack. --summary and --next are added, and the pack is capped and redacted (secrets, credential-looking values, home folders) before it leaves the machine; in a metadata_only org only the file list is sent. The transcript itself is never sent. The confirmation shows exactly what goes (outside a terminal, without --yes, the CLI prints the same pack with its refusal, so a rerun with --yes isn't blind):

Output
Context pack for Jordan (…), built on this machine from your Claude Code session's transcript; only this is sent, never the transcript:
  Summary: PDF layout done, totals wrong
  Files: 2 changed (src/invoices/pdf.ts, src/invoices/layout.ts (created)), 5 read
  $ pnpm test invoices → failed
  Next: fix tax on discounted lines

The result's Context: line says what the server kept. With no transcript of the intent's sessions on this machine and no --summary/--next, no pack is sent ("no context pack: no transcript of INT-12's sessions on this machine (add one with --summary/--next)"). The session the pack came from is sent along, so with Ask my agent on, a read-only copy of it answers the teammate's follow-up questions.

Terminal
comity handoff @jordan --note "PDF layout is done; totals still wrong"
comity handoff priya@acme.com --intent INT-12 --yes
comity handoff @jordan --tried "Rounding per line before tax => still off by 1 cent" --tried "Bumping decimal.js"
comity handoff @jordan --summary "PDF layout done, totals wrong" --next "fix tax on discounted lines"
comity handoff @jordan --no-context --yes

comity tasks

Output
comity tasks [list] [--list <path|title|id>] [--status open,claimed,done,dropped] [--mine] [--all] [--json]
comity tasks show <T-n> [--json]
comity tasks requests [--direction in|out|all] [--json]

Shows shared tasks from the terminal: the lists and tasks of the current repo (--all: every list of the org; --mine: tasks claimed by or queued for you), one task with its history (claimed, released and why, done), or work requests (one line each; --json has the full messages). Read-only: answer requests in the dashboard (Needs you) or in an interactive agent session, which asks you first.

comity ask-my-agent

Output
comity ask-my-agent on|off|status [--model <name>|default] [--effort low|medium|high] [--cap <n>]

Turns Ask my agent on or off for you in this org, or shows its state: on/off, model, effort, cap and used/cap this month. While on, a read-only copy of your most recent agent session answers teammates' questions for you when your agent is busy or away. Paid plans (Team and up); off by default.

Option Description
on Turn it on. In a terminal it explains what happens and asks you to confirm.
off Turn it off.
status Show the setting and this month's use.
--model <name>|default Model the copy runs on. default: the agent's cheap default (haiku for Claude Code, the session's model for Codex and omp).
--effort low|medium|high Reasoning effort of the copy. Default low.
--cap <n> Answers per month (UTC), 1 to 10,000. Default 200.
Terminal
comity ask-my-agent on
comity ask-my-agent on --model sonnet --effort medium --cap 500
comity ask-my-agent status

comity autopilot

Output
comity autopilot [status] [--json]
comity autopilot on [--repo] [--confirm yes]
comity autopilot off
comity autopilot people [--everyone | --only <a,b>]

Turns Autopilot on or off for you in this org, or shows it: on/off, who can give your agent work, which repositories, and the agent sessions waiting for team work now. While on, trusted teammates' work requests are accepted without asking you and your open agent session does the work. Paid plans (Team and up); off by default.

Command or option Description
status (or no subcommand) Show the state. --json prints the API object.
on Turn it on. The first time, it shows the warning and asks you to type yes; later it turns on without asking.
on --repo Only the repository you're in (default: every repository of the org).
on --confirm yes Answer the warning without a prompt (scripts, agents).
off Turn it off. Prints what your agent did meanwhile ("While you were away …"), if anything.
people Pick who can give your agent work: "Everyone in acme (including people who join later)" or "Choose people…".
people --everyone / people --only mike,priya The same without the picker: names, emails or email handles.

In Claude Code, /autopilot runs it from the chat (/autopilot, /autopilot yes, /autopilot off, /autopilot status); comity init writes the command to .claude/commands/autopilot.md. omp's Comity bridge has /autopilot too.

Terminal
comity autopilot on
comity autopilot people --only mike
comity autopilot off

comity open

Output
comity open [dashboard|messages|conflicts]

Opens the web dashboard (/dashboard, /dashboard/messages or /dashboard/conflicts) in your browser, in the org you are logged in to. The web address is the one you logged in through, or COMITY_WEB_URL. With COMITY_NO_BROWSER set, the URL is printed instead.

comity update

Output
comity update [--check]

Checks for a newer release and, if there is one, installs it with npm and confirms that comity --version on your PATH reports the new version. On Comity Cloud the release comes from npm (npm install -g comity-cli@<version>); logged in to a self-hosted server, from that server's release manifest (<server>/cli/latest.json) and tarball (npm install -g <tarball url>). --check only reports whether an update is available. comity update always checks; it ignores the 12-hour throttle and any earlier "no".

If the install fails, the CLI prints the exact command to run by hand and the likely cause (npm not on PATH, files in use on Windows, EACCES permissions).

comity fail-open

Output
comity fail-open [--for <30m|2h>] [--reason "…"]
comity fail-open --off
comity fail-open --status

Emergency override for fail-closed repos. While it is on and Comity is unreachable, your agents' edits and shell commands go through on this machine instead of being blocked by the repo's policy. Blocks that Comity itself answers with still apply.

Option Description
--for <duration> How long: 30m, 2h, or minutes (90). 1 minute to 24 hours; default 1 hour.
--reason "…" Why. Shown to owners in the audit log.
--off Turn it off now, and send reports that are waiting.
--status Show the override, the fail mode this machine last saw for the current repo, and reports waiting to be sent.

Turning it on asks for confirmation and needs an interactive terminal, so an agent can't run it; in scripts and CI set COMITY_FAIL_OPEN=1 instead. Each call the override lets through is reported to your org as a hook.fail_open event (who, repo, number of calls, first paths, source, reason) once Comity answers again.

comity help

Output
comity help [command]

Without an argument, lists all commands. With one, shows that command's usage, options and examples (same as comity <command> --help).

Commands run by your agents

These exist for agent configuration files. You don't run them yourself.

Command Used by Output
comity hook --tool <tool> --event <Event> [--global] Every hook entry comity init writes (directly, or through a node -e launcher for hosts that run hooks through PowerShell on Windows and sh elsewhere), and the omp/OpenCode/Amp plugins; --global marks the user-level hooks of comity init --global Reads the host's hook JSON on stdin, calls /v1/hooks/evaluate, prints the host's native hook output. Exits 0, except 2 with the reason on stderr where the host blocks by exit code (Kiro, Windsurf). See Hook events.
comity mcp Stdio MCP entries written by comity init ("command": "node" with a one-line launcher that runs comity mcp through the system shell, the same entry on every OS) A stdio MCP server. It forwards every message to <server>/mcp with your login's token and writes the responses (streamed events included) to stdout, one JSON-RPC message per line. See Any MCP client.
comity mcp-headers Claude Code headersHelper, Codex http_headers_helper {"Authorization":"Bearer cmt_…"}
comity auth-header omp MCP header "!comity auth-header" Bearer cmt_…

mcp, mcp-headers and auth-header pick credentials like the hooks do: COMITY_TOKEN first, then the login of the org in the repo's comity.json, then (only in repos without one) the default org. In a bound repo, mcp-headers also returns X-Comity-Org: <org> and comity mcp sends it. mcp-headers and auth-header exit 1 when no credentials apply; in a repo bound to an org you aren't logged in to, they print "This repo uses Comity org X. Run comity login --org X." comity mcp keeps running and answers every request with an error that says what to run, so your MCP client shows the reason. comity mcp writes only protocol messages to stdout. It logs errors to stderr, and with COMITY_DEBUG=1 it also logs each message it forwards.

Updates

Interactive commands (login, logout, orgs, use, init, status, doctor, whoami, open, and the home screen) check for a newer CLI at most once every 12 hours, with a 1.5-second timeout. The hook, mcp, mcp-headers, auth-header and fail-open commands never check. Where they look depends on the server you last logged in to: Comity Cloud (https://api.comity.so, also when you aren't logged in) checks the npm registry for the latest comity-cli; a self-hosted server serves its own release (<server>/cli/latest.json), so its machines stay on the version that server ships.

  • In a terminal, the CLI asks Update now? (Y/n). Answering no silences that version for 24 hours.
  • Otherwise it prints one line on stderr.

Turn checks off with --no-update-check, COMITY_NO_UPDATE_CHECK=1, or by running in CI (CI set). The result of the last check is cached in update-check.json next to the config file.

Files

File Contents
Config: ~/.config/comity/config.json ($XDG_CONFIG_HOME/comity/ when set); Windows %LOCALAPPDATA%\comity\config.json (moved from %APPDATA%\comity\ once, by 0.9.0-beta.2 and later) server (of the last login), machine_id, default_org, and orgs: one login per org slug (token, server, org_name, user_email, data_mode, web_url). data_mode is updated from every hook response, so an owner's switch applies without a new login. Written with owner-only permissions. A config from a CLI before 0.6 (one token) is moved under its org's slug the next time you run a command.
update-check.json (same folder) Last update check and any skipped version.
hook.log (same folder) One line per hook that failed open, was blocked because Comity was unreachable (fail-closed), or was let through by the override, rotated at 1 MiB.
hook-skips.json (same folder) The last 50 before-edit/before-command checks that were skipped because Comity didn't answer in time (with their timings), for comity status and comity doctor.
tls-sessions.json (same folder, owner-only) The server's TLS session, so the next hook resumes it instead of a full handshake. Kept at most 24 h; safe to delete.
fail-mode.json (same folder) Each repo's fail mode and fail-closed protected paths from Comity's last answer, per server, with the time. Used only while Comity is unreachable; older than 7 days counts as unknown.
fail-open.json, fail-open-reports/ (same folder) The comity fail-open override, and override uses waiting to be reported.
Spool: $XDG_RUNTIME_DIR/comity-spool/, else <os temp>/comity-spool-<uid>/; Windows %TEMP%\comity-spool\ Per-session hook state (deduplication, queued notices, workspace map cache). Owner-only (0700); a folder there that is a symlink or belongs to another user is never used. Pruned after 48 hours.
comity.json (repo root, committed) The repo's org binding. See comity.json.

machine_id is a random UUID. The server only receives a hash of it, and an HMAC of your worktree path keyed by it; raw local paths never leave your machine.

Exit codes

Code Meaning
0 Success
1 Error (not logged in, server unreachable, doctor degraded, init outside a git repository)
2 Usage error (unknown command or flag), or doctor found failures
130 init cancelled at the question

See Environment variables for everything the CLI reads from the environment.

Try Comity now.

Start free →

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