# Connect OpenCode

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

Connect OpenCode 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.

The open-source terminal and desktop coding agent (version 2). Last checked 2026-11-10, against OpenCode’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 OpenCode

### The instructions file

Put the note from step 5 in `AGENTS.md` in the project root, or `~/.config/opencode/AGENTS.md` for every project. OpenCode 2 reads `AGENTS.md` only (version 1 also fell back to `CLAUDE.md`).

**Every project:** `~/.config/opencode/AGENTS.md` is read after the project’s files, with `~/.claude/CLAUDE.md` as a fallback. The note to put there: [Use Vando in every project](https://getvando.com/docs/connect-an-ai/every-project).

### Approvals and the sandbox

OpenCode 2 allows shell commands without asking by default, and has no sandbox: commands run with your files, home folder, keychain and network. To make it ask for shell commands but let `vando` through (the phone is the gate), put this in `opencode.jsonc`:

```jsonc
"permissions": [
  { "action": "shell", "resource": "*", "effect": "ask" },
  { "action": "shell", "resource": "vando *", "effect": "allow" }
]
```

The last matching rule wins. If you installed `vando` after OpenCode’s background service started, restart the service so it sees the new `PATH`.

### MCP tools (optional)

Most work goes through `vando run`, which keeps secrets out of the chat. Add the tools only when OpenCode 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 `opencode.jsonc` in the project or `.opencode/`, or `~/.config/opencode/opencode.jsonc` for every project:

```jsonc
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "servers": {
      "vando": { "type": "local", "command": ["vando", "mcp"] }
    }
  }
}
```

In OpenCode 2 the command is one array (the program, then its arguments). The old `opencode-ai` package is version 1, whose config keys differ.

### Cloud and remote sessions

The OpenCode 2 docs describe no hosted agent. `opencode --server <url>` connects to a server that runs the tools, so `vando` must be installed and connected on that computer.

### If something goes wrong

- Version 2 keys differ from version 1 (`permissions` is an ordered list; the action is `shell`, not `bash`). Check which version you run.
- How the environment and `PATH` reach commands isn’t documented; if `vando` isn’t found, use its full path.
- OpenCode 2 allows commands by default: the phone, not OpenCode, is the gate for secrets.
- 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:

- [OpenCode: instructions](https://opencode.ai/docs/instructions/)
- [OpenCode: MCP servers](https://opencode.ai/docs/mcp-servers/)
- [OpenCode: permissions](https://opencode.ai/docs/permissions/)
- [OpenCode: network](https://opencode.ai/docs/network/)
