# Config and Secret Variables

> Every environment variable is config or a secret. Agents can set config values and generate secrets, but never read a value or write a secret.

Every environment variable in Potions has a kind:

- **Config** is a setting that isn't secret, such as `POOL_SIZE`, `LOG_LEVEL`, a feature flag or a public hostname.
- **Secret** is anything that would hurt if it leaked, such as an API key, a password, a signing salt or a database URL with a password in it.

The kind shows as a badge next to each variable on your app's **Environment** tab.

## What agents can do

Your coding agent works with variables through the [Potions API](/docs/api-reference). It can:

- See the names, kinds and flags of your variables. It never sees a value, of either kind.
- Set **config** values, for example when you ask it to raise `POOL_SIZE`.
- Ask Potions to generate a random **secret** for a value that only needs to be random, like a signing salt. Potions never replaces a value that's already set.

It can't write a secret, and it can't overwrite a variable that's already a secret. Potions also refuses any value that looks like a secret, even under a config name: names with words like `SECRET`, `TOKEN`, `KEY` or `PASSWORD`, known API key formats, URLs with a password in them, and long random strings. When that happens your agent gives you a link to add the value yourself.

Agents also can't set variables that change how your app is built, such as anything starting with `MIX_`, `HEX_`, `NODE_` or `GIT_`. You can still set those on the Environment tab.

## Choosing a kind

When you add or edit a variable, choose **Secret** or **Config** in the dialog. New variables start as secrets. When you paste a `.env` file, one choice applies to every variable in the paste.

To switch a variable's kind, edit it and pick the other kind. The value doesn't change.

## Existing variables

Variables created before kinds existed are secrets, except the configuration Potions sets for you (`PHX_HOST`, `PHX_SERVER`, `PORT`, `MIX_ENV`, `STORAGE_DIR`, `DATABASE_PATH` and similar), which are config. If an agent should be able to change one of your own variables, switch it to config.

## Values stay visible to you

Both kinds are encrypted at rest. You can still reveal and copy any value on the Environment tab, including secrets, and **Copy as .env** includes everything. Only the dashboard shows values; the API never does.
