# Connect Codex

URL: https://getvando.com/docs/connect-an-ai/codex

Connect Codex to the Vando app on your phone, so it gets a secret only after you tap Give, and keys stay out of your .env files and chats.

OpenAI’s coding agent, in the terminal and the IDE. Last checked 2026-11-10, against Codex’s own documentation (the links at the end). If a step doesn’t match what you see, [tell us](https://getvando.com/support). For Claude Code, [Connect an AI](https://getvando.com/docs/connect-an-ai) is the same road.

## The steps every tool shares

**1.** Install `vando` in your own terminal (not through your AI tool):

```bash
npm i -g @getvando/cli --registry=https://registry.npmjs.org --@getvando:registry=https://registry.npmjs.org
```

No npm on this computer? The one-line installer gets the same signed vando:

```bash
curl -fsSL https://getvando.com/install.sh | sh
```

**2.** Connect it to your phone. It shows a code that works once, for 10 minutes; open Vando on your phone, then **Connect an AI**, enter the code and tap **Connect**. Run `vando connect` again to finish. Do this in your own terminal: it writes the connection’s key on this computer, and many sandboxes block that.

```bash
vando connect
```

**3.** Save a secret once. Without a terminal it opens a one-time page in your own browser; you paste the value there and it goes to your phone, locked so only the phone can open it. Tap Save on the phone. Or add it in the Vando app.

```bash
vando add STRIPE_KEY
```

**4.** Your tool runs a command with it. Your phone shows what is asked and for how long; you give it or deny it there, and the value goes into that one program’s environment, as the variable `STRIPE_KEY`.

```bash
vando run --secret STRIPE_KEY -- node send.js
```

A `.env` line can name a secret instead of holding it, and `vando run` fills it in when the program starts:

```text
STRIPE_KEY=vando://Work/acme/dev/STRIPE_KEY
```

**5.** Tell your tool how to ask: put this note in its instructions file (the file is named below):

```md
## Secrets (Vando)
- Never open, print, copy or edit `.env*` files or secret values, and never put a secret in chat.
- Run anything that needs a secret as `vando run --secret NAME -- <command>` (repeat `--secret` for more than one).
- Exit 75 means it is waiting for the owner's phone: say "Approve NAME on your phone, then I'll run it again", do other work, then run the same command again. After two waits, stop and tell the owner to open Vando on their phone (the request is in the Inbox).
- Exit 77 means the owner said no or the access ended: don't retry; ask the owner.
- Output that shows `[vando:NAME]` had a secret hidden; that is expected.
- Don't use `vando get` or `vando env --reveal`: they print values where you can read them. `vando env` (names only) is fine.
- Never enter a connect code yourself.
```

## What differs for Codex

### The instructions file

Put the note from step 5 in `AGENTS.md` in the repository root (Codex reads one from each folder between the root and where you are), or `~/.codex/AGENTS.md` to cover every repository.

**Every project:** `~/.codex/AGENTS.md` is read before the project’s files; the closer file wins where they disagree. The note to put there: [Use Vando in every project](https://getvando.com/docs/connect-an-ai/every-project).

### Approvals and the sandbox

Codex runs commands in a sandbox. In its normal `workspace-write` mode the network is off, so `vando run` can’t reach Vando’s server until you allow it. Pick one of three ways, cleanest first:

1. **A rule that lets `vando run` run outside the sandbox** (rules are marked experimental by Codex), in `~/.codex/rules/default.rules`:

```python
prefix_rule(pattern = ["vando", "run"], decision = "prompt",
            justification = "Vando asks the phone itself")
```

   `decision = "prompt"` asks you in Codex each time, then your phone asks again. Use `"allow"` to skip the Codex prompt; the phone is still the gate.
2. **Turn the network on** for workspace-write: `[sandbox_workspace_write]` with `network_access = true` in `~/.codex/config.toml`.
3. **Allow only Vando’s server** through Codex’s network proxy (`[features.network_proxy]`, `domains`): use the server address `vando` names in its blocked message.

Codex may not let a sandboxed command reach the macOS keychain or write under your home folder (its docs don’t say), so run `vando connect` in your own terminal, not through Codex.

### MCP tools (optional)

Most work goes through `vando run`, which keeps secrets out of the chat. Add the tools only when Codex must read a value itself; a value a tool returns stays in the conversation ([the tools](https://getvando.com/docs/reference/mcp)). Add the server to `~/.codex/config.toml` (shared by the CLI, the IDE extension and the desktop app), or `codex mcp add vando -- vando mcp`:

```toml
[mcp_servers.vando]
command = "vando"          # use the full path from `which vando` if the IDE can't find it
args = ["mcp"]
tool_timeout_sec = 90      # room for a phone approval
```

Each tool call times out after one minute by default; the longer limit above gives a phone approval room.

### Cloud and remote sessions

Codex cloud runs tasks in its own environments: an install script, per-environment internet settings and a list of allowed domains. To try Vando there, install `vando` in the install script and allow Vando’s server in the environment’s domains. A cloud task has nobody to read the connect code, and each task starts clean, so connecting inside a task is awkward. Don’t store a Vando connection key in Codex’s secrets: that would bypass your phone. Use Vando with the Codex CLI or IDE on a computer you sit at.

### If something goes wrong

- Network is off in the default sandbox: `vando run` then fails with a connection error, not with exit 75. Use one of the three ways above.
- A command that waits more than about ten seconds may be moved to the background and polled (reported by users, not in Codex’s docs). Exit 75 and “run the same command again” is the safe route; the rules note says so.
- If you open Codex from the Dock on a Mac, it may not see the npm global bin in `PATH`. Use the full path in the MCP `command`, and check `which vando` in a Codex turn.
- Never put the connection key in `env` or `shell_environment_policy`.
- Run `vando doctor` in your own terminal: it says what is wrong and the command that fixes it.
- If a `vando` command stops, relay what it says; the line ends with a link to [the errors reference](https://getvando.com/docs/reference/errors).

## Sources

What this page is written from:

- [Codex: AGENTS.md](https://learn.chatgpt.com/docs/agent-configuration/agents-md)
- [Codex: MCP](https://learn.chatgpt.com/docs/extend/mcp?surface=cli)
- [Codex: sandbox and approvals](https://learn.chatgpt.com/docs/agent-approvals-security)
- [Codex: rules](https://learn.chatgpt.com/docs/agent-configuration/rules)
- [Codex: cloud environments](https://learn.chatgpt.com/docs/environments/cloud-environments)
