# Merget agent setup

Connect this coding agent to Merget, the merge queue at https://sema.merget.ai. Run the commands yourself; sign-up, sign-in and connecting GitHub are the human's steps: hand them over and wait.

## 1. Account

An agent can act only for an account in a Merget organization. If the human has neither, stop: ask them to sign up at https://sema.merget.ai and create an organization there (https://sema.merget.ai/organizations/new; an agent cannot) or join one, then continue.

## 2. Connect

Work out which app you run in: the product, not the model (Claude in Cursor is Cursor). If unsure, ask the human; never guess. If `merget_status` is already among your tools, skip to step 3. Otherwise fetch https://sema.merget.ai/agent-setup/<page>.md for your app and follow it — it adds Merget's MCP server (`https://sema.merget.ai/mcp`) and skills, and the human signs in — then continue at step 3.

- `claude-code`: Claude Code (terminal, desktop app, VS Code extension)
- `codex`: Codex CLI, Codex in the ChatGPT desktop app, the Codex IDE extension
- `copilot`: GitHub Copilot CLI, Copilot in VS Code, the Copilot cloud coding agent
- `cursor`: Cursor (IDE, CLI, cloud agents)
- `devin`: Devin, Devin Desktop (formerly Windsurf)
- `kiro`: Kiro (IDE, CLI, Web)
- `antigravity`: Google Antigravity, Gemini CLI
- `replit`: Replit Agent
- `chat`: claude.ai, Claude Desktop, ChatGPT
- `other`: Amp, Warp, OpenCode, Cline, Zed, Junie, Goose, Droid and anything else

## 3. Permissions

On Merget's sign-in page the human picks the organization and your permissions, and can change them later under Settings › Agents. On `insufficient_scope`, `agent_scope_disabled`, `agent_access_disabled` or `agent_keys_disabled`, stop and ask the human to allow it there (or in the repository's settings when the error names a repository), or to authorize you again. Never retry blindly; never change agent access yourself. You act as a member of the organization, never its owner: the owner's steps (connecting GitHub, members, organization settings and secrets, pausing a queue) are the human's in Merget's dashboard. On `session_required`, hand the step to them.

## 4. Finish

Call `merget_status`, do its `next_step`, and call it again. Name the organization by its `display_name` (its slug when that is null); the slug is only for `org` and URLs.

- `install_github_app`: the human connects GitHub as an organization owner in Merget's dashboard; you cannot. Give them the step's URL (Settings › GitHub) and wait.
- `enable_repository`: ask which repositories, then `merget_repo_update` with `enabled: true` (advisory mode: comments only). Before `queue` or `autonomous` mode, check readiness in `merget_repo_settings_get`.
- `human: true`, or anything else: give the human its description and URL; wait until they are done.

Stop when the organization's `setup.state` is `ready`, or `no_open_prs` (waiting for a pull request; do not open one for this). Then tell the human:

```
Merget agent setup
[x] Organization   <display_name>
[x] Connected      as @<handle>
[x] Permissions    <permissions>
[x] GitHub App     <installations>
[x] Repositories   <owner/name (mode)>
[ ] To do          <next step, or nothing>
```

Docs, signed in: https://sema.merget.ai/orgs/<slug>/docs/agents. Plugin: https://github.com/MergetAI/merget-plugin. Published at https://sema.merget.ai/agent-setup/prompt.md. Terms: https://merget.ai/legal/api-terms.
