# Use Codex with Gaitro

> Connect OpenAI's Codex to Gaitro with one command. It gets typed tools through the gaitro MCP server, reads GAITRO.md through AGENTS.md, and works in drafts you ship.

Source: https://gaitro.com/integrations/codex

Codex runs on your machine, on your own OpenAI account. Gaitro doesn't run it or pay for it. It gives Codex a place to work: drafts, code reserved as it's edited, checks, and a person who decides what ships.

## 1. Install the CLI and log in

```sh
npm i -g --allow-remote=root https://app.gaitro.com/cli.tgz   # puts `gaitro` on your PATH
gaitro login                                  # approve in your browser; --device on a server
```

The login is named after the machine and can be revoked under the company's Settings › Agents. [Get started](/docs) shows how to check the download first.

## 2. Add the MCP server

```sh
codex mcp add gaitro -- gaitro mcp
```

That writes the server into Codex's `~/.codex/config.toml`. You can also add it there by hand:

```toml
[mcp_servers.gaitro]
command = "gaitro"
args = ["mcp"]
```

One connection covers every project in the company you logged in to. Codex then has tools such as `gaitro_open_project`, `gaitro_intent`, `gaitro_sync` and `gaitro_ship`; the [MCP reference](/docs/mcp) lists them all.

Without the MCP server, Codex can still run the `gaitro` CLI in its shell. Every command takes `--json`.

## 3. Point AGENTS.md at the instructions

Every Gaitro project has a `GAITRO.md` that tells agents how to work there. Codex reads `AGENTS.md`. If the project already had an `AGENTS.md` when it came to Gaitro, Gaitro added a line to it pointing at `GAITRO.md`. If it has none, add one with this line:

```md
This repo uses Gaitro. Read and follow GAITRO.md before making any change.
```

## 4. Ask for something

Ask Codex to open a project and make a change, in plain words. It opens a draft with `gaitro_intent` (or `gaitro start`), edits, and saves checkpoints. What it edits is reserved for its draft as it saves. When you're happy with what changed, tell it to ship, or press **Ship it** on the draft.

## Good to know

- Codex can run shell commands in a sandbox without network access. If `gaitro` commands it runs there can't reach Gaitro, use the MCP tools, or allow network access in Codex's sandbox settings.
- Run several Codex sessions at once with a working copy each: `gaitro clone <company>/<project> <folder>`. If two edit the same function, the second's draft waits its turn.
- Gaitro records which agent saved each checkpoint. It recognizes Codex from its environment; set `GAITRO_AGENT` to name it yourself.
- Claude Code and Cursor connect the same way: [Claude Code](/integrations/claude-code), [Cursor](/integrations/cursor).
