# Launch agents

> Start an agent in a worktree, and set the commands Rexa uses to launch and resume it.

An agent runs in a console tab, inside a worktree, as the CLI you would run yourself. Rexa watches it through hooks and its session files, and shows its state as a card in the sidebar.

## From the launch picker

Press <Kbd>⌘</Kbd> <Kbd>N</Kbd>. The picker lists **Console**, one row per agent, and **Browser**. Type to filter, then press <Kbd>↵</Kbd>.

The agent starts in a new tab in the focused pane, with the worktree as its working directory. Each agent row shows the exact command it will run. The gear on the row opens that agent's settings.

The command runs in your login shell, so an agent installed through `.zshrc` works even when Rexa was opened from the Dock. When the agent exits, the tab drops back to a shell prompt.

## From any Rexa terminal

Type the agent's command in any Rexa console, such as `claude` or `codex`. Rexa recognizes it and adds a card the same way. Agents started outside Rexa's terminals get no live card; their sessions still show in the [session history](/docs/agents/sessions#session-history).

## Default commands

| Agent        | Launch                                      | Resume                                                   |
| ------------ | ------------------------------------------- | -------------------------------------------------------- |
| Claude Code  | `claude --dangerously-skip-permissions`     | `claude --dangerously-skip-permissions --resume {session_id}` |
| Codex        | `codex --yolo`                              | `codex resume --yolo {session_id}`                       |
| Cursor Agent | `cursor-agent --force`                      | `cursor-agent --force --resume {session_id}`             |
| OpenCode     | `opencode`, with OpenCode's own tab bar turned off | `opencode --session {session_id}`                 |
| Pi           | `pi`                                        | `pi --session {session_id}`                              |

<Callout type="warning" title="Agents start without permission prompts">
  The default commands turn off each agent's approval prompts, so the agent edits files and runs commands without asking. Each task runs in its own worktree, but the agent still has your user's access to the whole machine. Change the commands below if you want the agent to ask first.
</Callout>

## Change the commands

**Settings → Agents** has a **Launch** and a **Resume** field per agent. The values are stored in `settings.json`:

```json [settings.json]
{
  "agents": {
    "claude": {
      "launch_command": "claude",
      "resume_command": "claude --resume {session_id}"
    }
  }
}
```

- `{session_id}` is the session to resume.
- `{config_root}` is the agent's config root, your home folder.
- An empty resume command falls back to the launch command.

## Order the picker and set the new-tab default

**Settings → Launch new tab**:

- **New tab opens** sets what <Kbd>⌘</Kbd> <Kbd>T</Kbd> and a pane's `+` open: a console (the default), an agent, or a browser (`launch.default`).
- **The row list** sets the picker's order. Drag a row by its grip to reorder (`launch.order`); turn its switch off to hide it (`launch.hidden`).

## Codex note

In Rexa terminals, the `codex` command runs through a small wrapper that adds `--no-daemon`, so each terminal's hooks report to the right card. Set `REXA_CODEX_DAEMON=1` in [terminal environment variables](/docs/workspace/terminal#environment-variables) to opt out.
