
# agc environment variables, environments and local state

agc reads variables from its own environment that change who it acts as, which Agent Cloud environment (production or staging) it talks to, how it prints and whether it updates itself. It keeps its identities, mirrors and caches in one state folder.

None of this is what your app gets at run time; for that, see [App runtime contract](/docs/reference/app-runtime-contract.md).

A typical CI job:

```bash
export AGC_TOKEN="$AGC_DEPLOY_KEY"   # a deploy key from the app's settings, agcd_…
export AGC_NO_UPDATE=1
agc ship --no-wait --json
```

`agc whoami` then reports `"source": "AGC_TOKEN"`.

## Reference

### Identity and environment

<!-- generated: env-identity -->
| Variable | What it does | Read at |
|---|---|---|
| `HTTPS_PROXY` | The proxy agc sends its own requests through (to Agent Cloud and the rest), and Devbox `wss://` tunnels too. `https_proxy` is read first when both are set. A proxy given without a scheme (`proxy:3128`) is taken as `http://`. This machine's loopback always goes directly. | env-proxy.ts:8, tunnel-socket.ts:55 |
| `HTTP_PROXY` | Turns on proxying for agc's own requests like `HTTPS_PROXY` (`http_proxy` read first). A proxy given without a scheme is taken as `http://`. | env-proxy.ts:8 |
| `NO_PROXY` | Hosts agc reaches directly while a proxy is set (`no_proxy` read first). `localhost`, `127.0.0.1` and `::1` are always added; `*` skips the proxy for everything. | env-proxy.ts:9, env-proxy.ts:25, tunnel-socket.ts:59 |
| `NODE_USE_ENV_PROXY` | When set, agc leaves Node's proxying as you set it. Unset, agc on Node turns proxying on itself whenever `HTTPS_PROXY` or `HTTP_PROXY` is set. | env-proxy.ts:17 |
| `AGC_TOKEN` | A credential to use instead of this machine's saved agent: a deploy key (`agcd_…`) in CI, or a task token (`agct_…`) in a sandbox. Wins over `config.json` and `identities/`. Required by `agc ship --from-git`. `agc init --reset-identity` refuses while it's set, and `agc init` makes no new agent while it's set. | commands/init.ts:1201, commands/init.ts:1279, commands/init.ts:1307 +9 |
| `AGC_CONTROL_URL` | The Agent Cloud (control) origin agc talks to. Default: the URL saved in `config.json`, else `https://agent.cloud`. A folder whose `[app] control` names another origin is refused with `cli.environment_mismatch`. | commands/devbox.ts:227, config.ts:67, main.ts:398 +1 |
| `GIT_COMMITTER_NAME` | The committer of the first commit `agc init` makes for a starter in a new folder. Default: the author, from `GIT_AUTHOR_NAME` or git's `user.name`, else `agent.cloud`. | commands/init.ts:2097 |
| `GIT_COMMITTER_EMAIL` | The committer email of that first commit. Default: the author's, from `GIT_AUTHOR_EMAIL` or git's `user.email`, else `noreply@agent.cloud`. | commands/init.ts:2097 |
| `AGC_HOME` | Where agc keeps its state. Default `~/.agentcloud`. A separate home gives a separate agent identity; it doesn't isolate the executable or its updates. | commands/devbox.ts:227, commands/steer.ts:186, config.ts:150 |
| `AGC_ENV` | `staging` or `production`. On `staging`, every `next` command and the AGENTS.md agc writes say `agc-staging`, and install fixes use staging's installer. `agc status` and `agc doctor` report it in `data.environment`. Set by the `agc-staging` and `agc-production` executables. | agents-md.ts:57, commands/devbox.ts:227, commands/doctor.ts:123 +5 |
<!-- /generated: env-identity -->

The `agc-staging` and `agc-production` executables set `AGC_ENV`, `AGC_CONTROL_URL` and `AGC_HOME` (`~/.agentcloud/state/<environment>`) for themselves, unless they're already set. See [Environments: production and staging](#environments-production-and-staging).

### Output

<!-- generated: env-output -->
| Variable | What it does | Read at |
|---|---|---|
| `AGC_OUTPUT` | `json` or `human`. Wins over agent detection and the terminal check; loses to `--json` or `--human`. | output.ts:13 |
| `AI_AGENT` | Any value: JSON output, even in a terminal. | output.ts:15 |
| `CLAUDECODE` | Any value: JSON output. Also labels a new agent "Claude Code". | client.ts:15, commands/steer.ts:223, output.ts:15 |
| `CODEX_SANDBOX` | Any value: JSON output. Also labels a new agent "Codex". | client.ts:14, output.ts:15 |
| `CODEX_THREAD_ID` | Any value: JSON output. Also labels a new agent "Codex". | client.ts:14, output.ts:15 |
| `CURSOR_AGENT` | Any value: JSON output. Also labels a new agent "Cursor". | client.ts:15, output.ts:15 |
| `CI` | Any value: JSON output. | output.ts:15 |
| `NO_COLOR` | Any value: no color in human output. | ui.ts:13 |
<!-- /generated: env-output -->

Precedence: `--json`/`--human`, then `AGC_OUTPUT`, then the agent variables, then whether stdout is a terminal. See [Output modes](/docs/reference/the-json-envelope.md#output-modes).

### Updates

<!-- generated: env-updates -->
| Variable | What it does | Read at |
|---|---|---|
| `AGC_NO_UPDATE` | `1` turns off the automatic hourly update check (CI, pinning). `agc update` still updates; `agc doctor` warns. | commands/doctor.ts:110, main.ts:575, update.ts:75 |
<!-- /generated: env-updates -->

### Mirrors and starters

<!-- generated: env-mirror -->
| Variable | What it does | Read at |
|---|---|---|
| `AGC_STARTERS_URL` | Where `agc init` downloads the starters archive from. The download must still match the pinned sha256, or init fails with `init.starter_checksum`. | starters.ts:15 |
| `AGC_EDGE_DEV_USER` | The test identity a mirror's web proxy puts in `x-agc-user-email` and `x-agc-user-name` for an `[auth] provider = "edge"` app. Default `dev@mirror.invalid`. Passed to the app too. | mirror.ts:784 |
| `AGC_COPY_ACCESS` | For a host that runs agc in a sandbox: names a file holding mirror create's answer for this app and mirror (JSON, owned by you, mode 0600 or stricter), which `agc up` uses instead of asking Agent Cloud for the copy. A file it can't use is `mirror.access_file`; a copy gone since is `mirror.access_stale`. When it's used, `agc up` answers `copy_access: "file"`. | commands/mirror.ts:604, commands/mirror.ts:733, commands/mirror.ts:734 |
| `AGC_LIVE_FRAMES` | `0`: a running mirror's live build preview of its Work item takes no frames of the app's pages, and sends its events only. | frames.ts:29, live.ts:39 |
<!-- /generated: env-mirror -->

### Release verification (`agc verify`)

<!-- generated: env-verify -->
| Variable | What it does | Read at |
|---|---|---|
| `AGC_E2E_DIR` | Where `agc verify` finds the jev-ultrafast browser agent. Default `~/jev-ultrafast`. | commands/verify.ts:145, live.ts:31 |
| `AGC_VERIFY_MODEL` | The Fireworks model `agc verify`'s browser agent uses when `FIREWORKS_API_KEY` is set. Default `glm-5p3-flash`; `typesafe` keeps jev-ultrafast's own models. | commands/verify.ts:111, e2e/verify.py:25 |
| `AGC_VERIFY_EFFORT` | Reasoning effort sent to the model, read by `e2e/verify.py`. Default `low` for `glm*` models, else `none`. | e2e/verify.py:27 |
| `AGC_VERIFY_MAX_STEPS` | Most actions per try, read by `e2e/verify.py`. Default 120. | e2e/verify.py:174 |
| `FIREWORKS_API_KEY` | When set (in the environment or jev-ultrafast's `.env`), `agc verify` sends each step to Fireworks (api.fireworks.ai); otherwise to jev-ultrafast's own models. `data.sent_to` names which. | commands/verify.ts:109, e2e/verify.py:65, e2e/verify.py:143 +1 |
| `UV_CACHE_DIR` | uv's cache for the browser agent run. Default `<AGC_HOME>/uv-cache`. | commands/verify.ts:73, live.ts:142, live.ts:175 |
<!-- /generated: env-verify -->

### Devboxes

<!-- generated: env-devbox -->
| Variable | What it does | Read at |
|---|---|---|
| `AGC_DEVBOX` | Set inside a Devbox to its id. Makes `agc up`/`agc down` declare the mirror's ports and enables `agc devbox ports --add`. | commands/devbox.ts:398, commands/feedback.ts:77, commands/init.ts:2032 +5 |
| `AGC_DEVBOX_SSH_WAIT` | Seconds `agc devbox connect` keeps retrying the SSH probe. Default 60. | commands/devbox.ts:356 |
| `AGC_DEVBOX_SSH_RETRY` | Seconds between those retries. Default 2. | commands/devbox.ts:357 |
| `AGC_OPEN` | The program `agc devbox connect` opens `codex://codex-app/apply-config` with. Default `open` on macOS; none elsewhere. | commands/devbox.ts:81, commands/root.ts:53 |
| `AGC_NO_CODEX_APP` | Any value: `agc devbox connect` writes Codex desktop's config but doesn't ask Codex to apply it. | commands/devbox.ts:81 |
| `CODEX_HOME` | Codex's home. `agc agent install codex` writes `$CODEX_HOME/AGENTS.md`; `agc devbox connect` writes `$CODEX_HOME/codex-app/config.json`. Default `~/.codex`. | commands/agent.ts:20, commands/devbox.ts:48 |
<!-- /generated: env-devbox -->

### Set by agc, or for its tests

<!-- generated: env-internal -->
| Variable | What it does | Read at |
|---|---|---|
| `AGC_UPDATED_FROM` | Set by agc on the command it re-runs after updating itself; marks `data.agc_updated` and stops a second update. Don't set it. | main.ts:569, main.ts:582, main.ts:583 +1 |
| `AGC_LAUNCHER` | For Agent Cloud's own development: the path of a launcher script that carries a development control and home; `agc steer hook install` runs the hook through it. Don't set it. | commands/steer.ts:185 |
| `BU_CDP_URL` | For Agent Cloud's own development: the automation browser the live session's frame capture uses. agc checks it answers before a capture. Don't set it. | live.ts:57, live.ts:352, live.ts:831 |
| `BU_CDP_WS` | For Agent Cloud's own development: the capture browser's websocket, taken before `BU_CDP_URL`. Don't set it. | live.ts:58, live.ts:352 |
| `AGC_TEST_SYSTEM_BIN` | For agc's own tests: folders that stand in for `/usr/bin` and `/bin` when the mirror sandbox looks for its tools, honored only against a control on this machine's loopback. Don't set it. | sandbox.ts:38 |
| `AGC_UPDATED_TO` | Set by agc alongside `AGC_UPDATED_FROM`. Don't set it. | main.ts:583 |
| `AGC_TEST_TIME_SCALE` | For agc's own tests: a number between 0 and 1 shortens agc's own waits and timeouts by that factor. Any other value is ignored. Don't set it. | checks.ts:712, wait.ts:5 |
| `AGC_UNSAFE_MIRROR_NO_ISOLATION` | `1` lets a mirror run without an OS sandbox, only against a control on localhost (agc's own tests). Ignored against Agent Cloud. | sandbox.ts:27 |
| `AGC_ANALYTICS_TOKEN` | Set by agc in a mirror's app and worker environment when Agent Cloud hands the mirror analytics credentials; a launch that carries it is recorded in the mirror's launch journal before the process runs. Don't set it. | mirror.ts:259 |
<!-- /generated: env-internal -->

## Environments: production and staging

> **Preview.** Staging is for Agent Cloud's own platform testing and Summation's internal apps, by invitation. Details may change.

Agent Cloud has two environments that share no credential, database or app: production at `agent.cloud` and staging at `staging-agent.cloud`. Each has its own executable, `agc` for production and `agc-staging` for staging, with its own state folder. An app is bound to the environment that created it through `[app] control` in its `agentcloud.toml`, and running the wrong executable in its folder fails before anything is sent:

```bash
agc-staging status
```

When the app was created from a staging prompt, the agent's AGENTS.md section already names `agc-staging`.

```mermaid
flowchart LR
  F["app folder<br/>[app] control = staging-agent.cloud"] --> X{Which executable?}
  X -- agc-staging --> S["staging control<br/>~/.agentcloud/state/staging"]
  X -- agc --> E["cli.environment_mismatch<br/>nothing sent"]
  P["app folder<br/>no [app] control"] --> Y{Which executable?}
  Y -- agc --> PR["production control"]
  Y -- agc-staging --> E
```

The folder decides the environment; the executable has to match it.

| | Production | Staging |
|---|---|---|
| Console | `agent.cloud` | `staging-agent.cloud` |
| Apps | `<app>.agent.cloud` | `<app>.staging-agent.cloud` |
| Relay | `relay.agent.cloud` | `relay.staging-agent.cloud` |
| Executable | `agc` (also `agentcloud`) | `agc-staging` |
| For | customers and Summation's customer-facing apps | platform testing and Summation's internal apps |
| Gets platform builds | promoted from staging | every merge to main |
| Data | real | real (Summation's internal data) |
| Backups | production backups | 7 days of point-in-time history |

**Binding.** `agc-staging init` writes the control address into the manifest; production apps omit the line, which means `https://agent.cloud`:

```toml
[app]
name = "expense-app"
control = "https://staging-agent.cloud"
```

Commit it, so a clone stays bound. An app's name is unique within an environment, not across them: `expense-app.agent.cloud` and `expense-app.staging-agent.cloud` are unrelated apps with separate data, owners and history.

**Separate executables and homes.** `agc-staging` sets `AGC_ENV=staging`, `AGC_CONTROL_URL=https://staging-agent.cloud` and `AGC_HOME=~/.agentcloud/state/staging`, unless you've set them (see [Identity and environment](#identity-and-environment)). Each home keeps its own agents, and a saved agent is only ever sent to the control service it was made for. Each control plane serves its own agc build, so a staging update never replaces your production executable. Staging installs from its own installer, which writes `bin/agc-staging` without an `agentcloud` alias.

**Seeing where you are.** With `AGC_ENV` set, as the staging executable sets it, `agc status` and `agc doctor` add `data.environment` and `data.control_url`.

**What staging promises.** Running apps keep serving when a bad staging build lands, because the cluster doesn't depend on control. App sign-in, releases, the console and the relay's egress checks do, so they wait until a rollback; apps on private targets lose outbound connections while staging's control is down. A staging release follows the same rules as production: rehearsal first, and a person approves database changes.

## Local state

agc keeps this machine's agent identities, its running mirrors, task counters and a few caches in one folder: `~/.agentcloud`, or `$AGC_HOME` when set. Nothing in it belongs in a repository. Identity files are written mode 0600 in 0700 folders.

```bash
ls -la "${AGC_HOME:-$HOME/.agentcloud}"
```

### What's in it

| Path | Holds | Safe to delete? |
|---|---|---|
| `config.json` | The default agent: `token`, `controlUrl`, `agent` id, and `org` once it joined one (or `wanted`, the organization a reset agent was made for). | No. Losing it loses the agent; a person must connect a new one. |
| `identities/<organization id>.json` | One agent per further organization this machine builds in, chosen by the folder's `[app] org`. | No, same reason. |
| `identities/new-<agent>.json` | An agent made for a join whose answer hasn't come back yet. | No: agc retries the join with it. |
| `identities/spare-<agent>.json` | An agent that joined an organization this home already had one for. Kept, never chosen. | Yes, once you're sure it isn't needed. |
| `config.json.old-<time>`, `identities/<id>.json.old-<time>` | Identities set aside by `agc init --reset-identity`, or replaced after being refused. | Yes. |
| `mirrors/<app>/<name>.json` | A mirror's local state: its database URL (mirror-only credentials), ports, the supervisor's pid, email and test sign-in tokens, sandbox mode. | Only after `agc down`. Deleting it stops the running supervisor. |
| `mirrors/<app>/<name>.log` | The app's and worker's output, credentials scrubbed. | Yes. |
| `mirrors/<app>/<name>.egress.jsonl` | Hosts and ports the mirror's proxy refused, shown by `agc status`. | Yes. |
| `mirrors/<app>/<name>.preserved.json` | What the last `agc migrate` proved; `agc check` reports it. | Yes; `agc check` then reports those checks as skipped until the next migrate. |
| `mirrors/<app>/<name>.json.worker` | The worker's pid. | With the mirror. |
| `mirrors/<app>/<name>.sandbox/` | Linux only: the sandbox's sockets, its own home and tool caches. | When the mirror is down. |
| `ca.pem` | Node's root certificates as a file, for a Python app's `PGSSLROOTCERT`. | Yes; rewritten when needed. |
| `tasks.json` | The counter agc was given for each task, keyed by control, app, work item and a hash of the credential (never the token). | Not while you own a task: without it agc can't act on it (`task.no_counter`). |
| `update.json` | When agc last checked for an update, and what it found. | Yes. |
| `feedback-nudges.json` | Which `agc feedback` suggestions were shown, so each appears at most once a day. | Yes. |
| `agents-md/<time>.md` | AGENTS.md as it was before agc refreshed its section. | Yes. |
| `verify/<app>.json` | The last `agc verify` result and the snapshot it saw; `agc ship` sends it along. | Yes; the next ship then says verification hasn't run. |
| `verify/runs/<app>-<time>/` | Screenshots of each verification try. | Yes. |
| `uv-cache/` | uv's cache for the browser agent. | Yes. |
| `devbox/id_ed25519`, `.pub`, `known_hosts` | The laptop's SSH key for Devboxes and each Devbox's pinned host key. | Only if you'll run `agc devbox connect` again. |
| `devbox-app` | The app the last `--app` named. | Yes. |
| `devbox-ports.json`, `devbox-ports.log` | The background port forwarder's state and log. | After `agc devbox ports --stop`. |
| `package/` | Files a compiled agc unpacks to run (the verification script). | Yes. |

The same list, generated from every path agc builds under the folder:

<!-- generated: state-paths -->
| Path under the state folder | Built at |
|---|---|
| `<FILE>` | last-failure.ts:23, last-failure.ts:44 |
| `<name>` | mirror.ts:1030 |
| `agents-md/<now>.md` | commands/init.ts:1007 |
| `ca.pem` | mirror.ts:246 |
| `capture-browser` | live.ts:71 |
| `config.json` | commands/init.ts:1228, commands/init.ts:1632, config.ts:65, config.ts:95 |
| `config.json.old-<time>, identities/<id>.json.old-<time>` | commands/init.ts:1414, commands/init.ts:1552 |
| `devbox` | commands/devbox.ts:20 |
| `devbox-app` | devbox-tunnel.ts:26 |
| `devbox-ports.json` | devbox-tunnel.ts:116 |
| `devbox-ports.log` | commands/devbox.ts:428, commands/devbox.ts:435 |
| `devbox/id_ed25519` | commands/devbox.ts:323 |
| `devbox/known_hosts` | commands/devbox.ts:330 |
| `feedback-nudges.json` | nudges.ts:36 |
| `frames-told.json` | frames.ts:17 |
| `identities` | config.ts:44 |
| `identities/<id>.json` | commands/init.ts:1410 |
| `identities/new-<agent>.json` | commands/init.ts:1290, commands/init.ts:1400 |
| `identities/spare-<agent>.json` | commands/init.ts:1415 |
| `live/<createHash>.json` | live-front.ts:41 |
| `maven` | maven.ts:23 |
| `mirrors` | mirror.ts:590 |
| `mirrors/<app>` | mirror.ts:319 |
| `mirrors/<app>/<name>.egress.jsonl` | mirror.ts:283 |
| `mirrors/<app>/<name>.json` | mirror.ts:269 |
| `mirrors/<app>/<name>.json.worker` | mirror.ts:1839 |
| `mirrors/<app>/<name>.log` | commands/mirror.ts:641, commands/mirror.ts:846 |
| `mirrors/<app>/<name>.preserved.json` | commands/migrate.ts:20 |
| `mirrors/<app>/<name>.refresh` | mirror.ts:430 |
| `mirrors/<app>/<name>.sandbox` | sandbox.ts:211 |
| `mirrors/<app>/<name>.sandbox/home` | sandbox.ts:212 |
| `mirrors/<app>/<name>.sandbox/home/.cache` | sandbox.ts:212 |
| `mirrors/<app>/<name>.sandbox/sock` | sandbox.ts:212 |
| `package/<path>` | executable.ts:81 |
| `playwright/<PIN>` | commands/walkthrough.ts:67 |
| `pnpm` | pnpm.ts:107 |
| `ships` | commands/ship.ts:255 |
| `ships/<op>.json` | commands/ship.ts:252 |
| `steering.json` | control.ts:42 |
| `tasks.json` | commands/task.ts:23 |
| `update.json` | update.ts:39 |
| `uv-cache` | commands/verify.ts:73, live.ts:142, live.ts:175 |
| `verify/<app>.json` | commands/verify.ts:53 |
| `verify/runs/<app>-<now>` | commands/verify.ts:154 |
| `walkthrough/<segment>` | walkthrough-state.ts:29 |
| `walkthrough/<segment>.json` | walkthrough-state.ts:28 |
| `yarn` | yarn.ts:196 |
<!-- /generated: state-paths -->

### Outside the state folder

| Where | Written by |
|---|---|
| `~/.ssh/config` | `agc devbox connect`: one block per app between `# >>> agent.cloud Devbox <host> …` marker lines, placed first in the file. |
| `$CODEX_HOME/AGENTS.md` (default `~/.codex`) | `agc agent install codex`, between its own marker lines. |
| `$CODEX_HOME/codex-app/config.json` | `agc devbox connect`, to list the Devbox in Codex desktop. |
| The app folder | `agentcloud.toml`, `AGENTS.md`, `CLAUDE.md`, `.gitignore`; markers under `node_modules/` and `.venv/` for install scripts run inside the sandbox. |

## Errors

| Code | Exit | Cause | Fix |
|---|---|---|---|
| `init.reset_with_token` | 2 | `agc init --reset-identity` while `AGC_TOKEN` is set. | Replace the deploy key in the console, or unset `AGC_TOKEN` deliberately. |
| `init.join_other_org` | 2 | `--join` with a code for another organization while `AGC_TOKEN` holds an agent. | Unset `AGC_TOKEN`; agc then makes this machine a separate agent for that organization. |
| `auth.required` | 1 | `agc ship --from-git` with no `AGC_TOKEN`. | `AGC_TOKEN=<a Ship-only deploy key> agc ship --from-git <commit>`. |
| `auth.missing`, `auth.required` | 1 | No identity in the state folder. | `agc init`. |
| `auth.invalid`, `auth.expired` | 1 | The saved agent was revoked or expired. | `agc init --reset-identity`, then the person connects the new agent. |
| `auth.no_identity_for_org` | 1 | The folder names an organization this home has no agent for. | Run the organization's `agc init --join <code>` line. |
| `auth.other_control` | 1 | This home's saved agent belongs to another Agent Cloud (control service) than `AGC_CONTROL_URL`. | Use that environment's agc, or a separate `AGC_HOME`. |
| `cli.environment_mismatch` | 1 | The folder's `[app] control` names a different Agent Cloud than this executable talks to. | Run the named executable in this folder (`agc-staging` for staging, `agc` for production); don't `agc init` over it. |
| `manifest.invalid` | 2 | `[app] control` isn't an https origin agc accepts (no path, query or credentials). | Set it to the app's Agent Cloud address, or remove it for production. |

```json
{
  "ok": false,
  "product": "agent.cloud",
  "command": "status",
  "error": {
    "code": "cli.environment_mismatch",
    "message": "This folder's app belongs to https://staging-agent.cloud; this agc talks to https://agent.cloud.",
    "fix": "Run agc-staging, the executable for https://staging-agent.cloud, in this folder. Don't run agc init or --reset-identity to get past this: that makes another app on the wrong agent.cloud.",
    "retryable": false
  },
  "next": [ { "cmd": "agc-staging status", "why": "the same folder, with the executable for its agent.cloud" } ]
}
```

## Coming soon

- With `HTTPS_PROXY` or `HTTP_PROXY` set, `control.unreachable` and `agc doctor` name the proxy agc is using (without credentials), and `agc doctor` adds a `proxy` check.

## Agent notes

- A refused `AGC_TOKEN` is never replaced by this machine's saved agent: agc reports the refusal and tells you to replace the key. A task token (`agct_…`) is replaced by whoever started the sandbox.
- `AGC_HOME` gives a separate identity and state, not a separate executable: two homes on one machine (one per CI job or per test, say) isolate identities and mirrors but still share one installed agc and its updates. For staging, use `agc-staging`.
- Never put a secret into the app through these variables. Secrets reach the app only from the console; see [Secrets](/docs/build/secrets.md).
- Never edit `config.json` by hand; agc's own fix for a refused agent says so.
- Copying the state folder to another machine copies the agent. Don't; make a new one with `agc init` there.
- Never run `agc init` or `agc init --reset-identity` to clear `cli.environment_mismatch`. That makes a second app on the wrong Agent Cloud.
- Don't edit `[app] control` to "fix" a mismatch; it records where the app lives.
- Public docs and prompts for production say `agc`. Only use `agc-staging` when the app's manifest or its AGENTS.md says so.

## Related

- [Output: the JSON envelope, modes and exit codes](/docs/reference/the-json-envelope.md)
- [CI/CD with deploy keys](/docs/ship/ci-cd-with-deploy-keys.md)
- [App runtime contract](/docs/reference/app-runtime-contract.md)
- [Agent identities and purposes](/docs/owners/managing-agents.md#agent-identities-and-purposes)
- [Managing agents](/docs/owners/managing-agents.md)
- [Installing agc](/docs/getting-started/installing-agc.md)
- [PR previews](/docs/ship/pr-previews.md)
- [Where apps run](/docs/concepts/where-apps-run.md)

<!-- feedback:start -->
---
Wrong, outdated or unclear? Run `agc feedback docs "reference/agc-environment-variables: <what is wrong>" --body <file>` with the sentence quoted in the file. No code or app data is sent.
<!-- feedback:end -->
