Docs

Agents

omp

Set up the Comity extension and MCP server for omp (oh-my-pi).

5 min readUpdated

On this page

omp has no command-hook config file, so Comity integrates through an omp extension: a TypeScript module that omp loads in-process. Because it is executable code, comity init only installs it when you choose omp explicitly.

Set up

Terminal
cd your-repo
comity init --tools omp
git add .omp/extensions/comity/index.ts .omp/mcp.json
git commit -m "Set up Comity for omp"

Start omp at the repository root: omp loads project extensions only from <cwd>/.omp/extensions, without looking in parent folders. To start it in a monorepo subfolder, see Start in a subfolder.

What init writes

.omp/extensions/comity/index.ts

The bridge extension (first line // comity-omp-bridge v2 (comity hook)). It:

  • forwards omp events to Comity: session_start, before_agent_start (each prompt), tool_call and tool_result for the tools bash, edit, apply_patch, write, eval and ast_edit, session_stop, and session_shutdown;
  • evaluates in-process through the installed CLI's hook-lib.mjs (no Node process per tool call), falling back to spawning comity hook --tool omp;
  • waits at most 600 ms per event and then allows, because omp blocks a tool whose handler throws or hangs. Context that arrives late is delivered with the next reply;
  • delivers context from before a tool call with that call's result. omp drops a tool_call handler's context when the call fails (a non-zero exit, an error), but shows tool_result context on errors too, so a message is never lost on a failing command;
  • sends the session's first prompt to Comity after the session-start briefing came back (waiting up to 2 s for it), so the briefing arrives once;
  • reports subagents with their parent session, so a parent and its subagents are treated as one lineage and never conflict with each other. Subagents get no messages, handoffs, channel posts, questions, answers or arrival notices: those wait for the parent agent (CLI 0.6.3 or later).

Reads, searches and omp internal URIs (local://, artifact://, …) are never evaluated. Their results, and those of MCP tools, only send a mid-task check for updates, at most every 20 s per session (never from a subagent); no file content or path is checked. Paths that omp prints as ~/… (its read and edit headers) are resolved against your home folder, so protected paths apply to them, also when an agent copies them into a bash command (echo x > ~/…, cp a ~/…, $HOME/…). The file holds no token and no machine-specific path. Re-running comity init --tools omp rewrites it; comity doctor warns when it is outdated and names its version ("is outdated (bridge v1, this CLI writes v2)"). Commit the rewritten file so your teammates' omp loads it too.

The bridge finds the CLI next to comity on your PATH. If yours is installed elsewhere, set COMITY_CLI_DIR to the folder containing comity.mjs.

.omp/mcp.json

JSON
{
  "mcpServers": {
    "comity": {
      "type": "http",
      "url": "https://api.comity.so/mcp",
      "headers": { "Authorization": "!comity auth-header" },
      "timeout": 120000
    }
  }
}

omp runs a header value that starts with ! as a command and sends its output; comity auth-header prints Bearer cmt_… from COMITY_TOKEN or your login.

timeout is omp's per-server request timeout in milliseconds. omp's default of 30 s is shorter than Comity's long waits (wait_for and inbox with wait_seconds wait up to 55 s), so those calls would fail with "Request timeout after 30000ms". comity doctor warns when the entry has no timeout or one below 60 s; re-run comity init --tools omp to add it. OMP_MCP_TIMEOUT_MS, if you set it, overrides every per-server value.

What your agent sees

  • First prompt of a session: the session-start briefing together with the prompt's context.
  • Before a tool call: a block denies it with Comity's reason; warnings and news come with the call's result.
  • After a tool call: new conflicts, messages, answers and arrival notices, also when the call failed. A bash or eval call that changed no file but ran 5 s or more checks for what arrived meanwhile. Reads, searches and MCP tool results carry news too, at most every 20 s per session since Comity last could deliver, so an agent that only reads and calls MCP tools still hears news mid-task. Bridges written by older CLIs don't do all of this: re-run comity init --tools omp to get the new bridge.
  • When the agent updates its todo list: the done/total count becomes the progress of its claimed shared task.
  • Before task_accept (answering a teammate's work request): omp's confirm dialog, from bridge v6, only when the agent accepts. No sends the decline (with the note "declined in the approval prompt"); if the dialog fails, the call is blocked and the request stays waiting. Without a UI (print mode) the agent asks you in chat instead. Rerun comity init --tools omp if comity doctor says the bridge is outdated.

Verify

Terminal
comity doctor

Expect omp extension bridge installed at … and omp mcp configured in …/.omp/mcp.json. The omp checks only appear once the bridge or the MCP entry exists. Run doctor in the folder you start omp in: in a subfolder it also checks that a bridge loads there (omp subfolder).

Start in a subfolder (monorepos)

omp discovers project extensions in the working directory's .omp/extensions only. A session started in apps/api never loads the committed bridge: Comity sees no session and none of its edits, so breaking changes made there reach nobody, and fail_mode can't apply. comity doctor run in that folder says so:

Output
! omp subfolder      omp only loads `.omp/extensions` from the folder it starts in: a session started in apps/api doesn't load the Comity bridge
                     › start omp at the repo root (/home/marina/code/shop), or run `comity init --global --tools omp` once for a user-level bridge that works in every folder

Either start omp at the root, or install a user-level bridge once per machine:

Terminal
comity init --global --tools omp

This writes ~/.omp/agent/extensions/comity/index.ts, which omp loads in every folder. It follows omp's agent directory: OMP_PROFILE (or PI_PROFILE) selects ~/.omp/profiles/<name>/agent, PI_CODING_AGENT_DIR replaces the default profile's, and PI_CONFIG_DIR renames .omp. For a profile you only pick with omp --profile <name>, run init with OMP_PROFILE=<name>. The user-level bridge is the same module with one difference: it evaluates with --global, so

  • it only acts in bound repos: in a repo without a comity.json it sends nothing, not even to your default org;
  • it never reports an event twice: when the session's folder also has .omp/extensions/comity, it stays quiet and the project bridge answers.

It also merges the comity MCP server into ~/.omp/agent/mcp.json (same agent directory; your other servers are kept), because omp reads project MCP config only from .omp/mcp.json in the folder it starts in: without it, a subfolder session has the bridge but no Comity tools. The entry uses the server you last logged in to (COMITY_SERVER overrides it), so run comity login first. Where the folder has its own .omp/mcp.json entry, that one wins. Doctor's omp mcp checks what omp loads in the folder you run it in: in a subfolder without the user-level entry it warns. To remove the bridge, delete ~/.omp/agent/extensions/comity/ and the comity entry from ~/.omp/agent/mcp.json. Re-run comity init --global --tools omp after updating the CLI; doctor warns when the file is outdated, also when the repo's own bridge is current.

Try Comity now.

Start free →

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