> Godmode v0.20.0 documentation · Reviewed 2026-11-19
> Source: https://godmode.build/docs/v0.20.0/contexts

# Businesses and environments

A **key environment** is a complete set of provider keys. A **business context** is a reusable profile. Select one of each to give a task the right credentials and business details.

## Select the active setup

Open **Switch setup** in `godmode`. Choose a **Key environment** and **Business profile**, then select **Use this setup**. In the terminal:

```sh
godmode use --env acme-test \
  --context acme
godmode active
```

The named selections must already exist. The pair is saved in `active.json` for future commands. **Recent setups** shows up to five prior pairs when history exists. Choose a pair and confirm it before switching.

**Automatic** uses the selected environment's own profile. To return to the original setup, run `godmode use --env default --context -`.

## Copy a key file

Copy an existing environment to create an independent snapshot of all its keys:

```sh
godmode env create acme-copy \
  --copy default
```

For a new client or account, start empty and add only its keys:

```sh
godmode env create acme-test
godmode --env acme-test \
  --context - setup stripe
```

Future edits and rotations affect only the file you edit. Each environment uses its own keys.

## Reuse one business profile

If the same business uses both test and live keys, create its profile once:

```sh
godmode context create acme
godmode --context acme profile
```

Use `--context acme` with either key environment to select the same business facts. For a profile that belongs exclusively to one environment, edit it with `--env NAME --context -`.

## Give an agent the selection

Print a task note with both selections pinned:

```sh
godmode --env acme-test \
  --context acme agents --print
```

Paste it into the task. For shell commands, `godmode active --command` prints the prefix for the current pair. `godmode run` also passes the selected pair to nested Godmode commands.

For each selection, command flags take precedence over shell variables (`GODMODE_ENV` and `GODMODE_CONTEXT`), then the saved pair. Pass both flags to pin the entire pair. `godmode use` with only one flag saves the other axis as currently resolved. An agent already running may hold its own scope, so give it an updated task note to switch.

## Inspect the files

| Command | What it shows |
| --- | --- |
| `godmode active --json` | The resolved setup, paths, and where each selection came from |
| `godmode env list --json` | Available environments and local paths |
| `godmode path` | The selected key file |
| `godmode profile path` | The selected profile file |

## Reuse a saved key name

A context alias maps a requested key to the name already in the selected environment:

```sh
godmode context map acme \
  STRIPE_TEST_SECRET_KEY \
  ACME_STRIPE_KEY
godmode --env acme-test \
  --context acme run \
  STRIPE_API_KEY=STRIPE_TEST_SECRET_KEY \
  -- stripe balance retrieve
```

Here `ACME_STRIPE_KEY` must already exist in `acme-test`. A missing mapped key stops the command. Remove the alias with `godmode context unmap acme STRIPE_TEST_SECRET_KEY`.

## Repair a missing selection

Run `godmode env list` and `godmode context list` to find valid choices, then save an existing pair with `godmode use`.

If `active.json` is malformed, pass both selection flags to work around it for one command. Repair the file or move it aside before saving another default.
