# Connect an agent

Register OSMates with an AI agent so it can run programs and use a machine's desktop.

## Register OSMates with your agent

1. Choose **OSMates > Settings**, then click **Agents**.
2. Under **On This Mac**, click **Connect** next to your client.
3. Choose the agent's tools next to **Tools**. See [Pick a profile](https://osmates.com/docs/agents#pick-a-profile).
4. Check the **Adds** and **Removes** lines for each settings file, then click **Connect**.
5. Restart the client, or start a new session, as the sheet says.

![The Agents settings pane, with Claude Code and Codex connected and Cursor not connected](https://osmates.com/docs/images/agents-settings.png)

OSMates looks for clients on this Mac. It knows these clients: Claude Code, Claude Desktop, Codex, Gemini CLI, Antigravity, Grok Build, Cursor, VS Code, Devin, Cline, Zed, OpenCode, Xcode and Hermes Agent.

To change a connection, click **Change**. To remove one, Control-click the client and choose **Disconnect**. Each file is copied to `<file>.osmates-backup` before it changes.

To do the same in Terminal, with `--dry-run` to preview a change:

```sh
osmates mcp clients
osmates mcp install codex --profile read-only --dry-run
osmates mcp install claude-code
osmates mcp uninstall claude-code
```

## Pick a profile

A profile sets which tools the agent can call. The default is Full. Choose it under **Tools**, or with `--profile` in Terminal.

| App choice | Command-line value | Tools |
|---|---|---|
| Read Only | `read-only` | Look at machines and read their files |
| Operator | `operator` | Use existing machines |
| Full | `full` | Also create, clone, and delete machines |

A tool outside the profile is refused, even with your permission. The [MCP reference](https://osmates.com/docs/mcp) lists each tool's profiles. An [access limit](https://osmates.com/docs/agent-access#limit-every-session-of-an-agent) caps a program in every session.

## Drive another Mac's machines

[Pair your Macs](https://osmates.com/docs/remote#pair-your-macs) first. Then register the other Mac, here named `studio`:

```sh
osmates mcp install claude-code --mac studio
osmates mcp install codex --mac studio --profile operator
```

The agent gets an `osmates-studio` server beside the local `osmates` one. The other Mac applies its own permissions, and its questions also appear here.

If two Macs share a server name, pass an identifier from `osmates remote devices`, such as `--mac mac-3fa29c01b2d4`.

Agents can't open files on the other Mac, so create or import machines there. If the connection drops, the other Mac holds the session for 2 minutes. To remove the server, run `osmates mcp uninstall claude-code --mac studio`.

## Choose another way to connect

- For a client on another computer, [serve MCP over HTTP](https://osmates.com/docs/mcp-http).
- For an agent that runs shell commands, [use `osmates agent`](https://osmates.com/docs/agent-cli).
- To chat in an OSMates window, [start your agent there](https://osmates.com/docs/agent-window).
- For Hermes Agent's terminal backend, [run its tasks in clones](https://osmates.com/docs/hermes).

[How agents see and use a machine](https://osmates.com/docs/agent-tools) covers screenshots and accessibility tools.

## If OSMates can't find your client

A client that isn't installed shows under Not Found, and one with unreadable settings under Settings Can't Be Read.

Claude Code is registered through its `claude` command, without a backup file. OSMates looks for `claude` on your PATH, then in `~/.local/bin`, `/opt/homebrew/bin`, and `/usr/local/bin`.

If `claude` is elsewhere, copy the command from the sheet and run it in Terminal. Do the same if you moved settings with `CLAUDE_CONFIG_DIR` or `CODEX_HOME`.

Hermes Agent uses the profile that `hermes profile use` selected. To connect another Hermes profile, replace `<name>` with its name:

```sh
HERMES_HOME=~/.hermes/profiles/<name> osmates mcp install hermes
```
