An environment (dev, staging, prod, …) holds a set of variables and has its own encryption key. Each one has an ID, fixed when it is created and part of how its values are encrypted, and a display name that can change.
| Task | Command | Who can run it |
|---|---|---|
| List the environments | maruhi env list [--all] [--json] |
any member |
| Create an environment | maruhi env create <environment-id> |
member or above, scope all |
| Change its display name | maruhi env rename <environment-id> <name> |
member or above, environment in scope |
| Delete it and all its values | maruhi env rm <environment-id> |
admin or owner, environment in scope |
A rename is a statement signed by your device key; a deletion is an entry on the project’s chain, also signed by your device key. Other members’ CLIs verify both against the project’s chain, so the server cannot forge a rename, a deletion, or any other change on its own.
List
maruhi env listEnvironments (2) — verified chain head seq=9:
dev Development active epoch=1 in-scope=yes disclosed-to-server=no
prod Production active epoch=3 in-scope=no disclosed-to-server=yesOne row per environment, sorted by ID: the ID, the display name, the status, the current epoch (it goes up by one with each maruhi env rotate), whether your scope covers the environment (whether this device can read its values), and whether a project owner disclosed it to the server with maruhi server grant (whether the server can decrypt its values too — see GitHub Actions). Deleted environments are hidden and counted in a note; --all lists them too, without a name (nothing of a deleted environment is served any more) and never as in scope. --json prints one document for scripts:
{
"scopeBasis": "device",
"environments": [
{
"environmentId": "dev",
"name": "Development",
"status": "active",
"currentEpoch": 1,
"inScope": true,
"disclosedToServerKeyFingerprintsHex": []
}
]
}The list of environments comes from the project’s chain, which records every creation and every deletion, so the server can neither leave an environment out nor bring a deleted one back, and hiding a deletion means rolling the chain back, which a client that has already seen it detects: if the server’s listing omits a live environment, still serves a deleted one, or a name fails verification, the command fails instead of skipping it. The status, the epoch and the disclosure also come from the chain (disclosedToServerKeyFingerprintsHex lists the fingerprints of the server keys whose active grant covers the environment, and is empty when none does); the name comes from the latest signed statement the server lists. The scope column uses this device’s scope, which is your scope narrowed to the device’s cap. On a machine without a device key (a MARUHI_TOKEN run, for example) it uses your member scope, prints a note, and scopeBasis is "member". No values are read, so the command needs no device key and also runs in CI or under an AI agent.
Create
maruhi env create staging --name Staging--name sets the display name; without it the name is the ID. The ID can contain letters, digits, _ and -, starts with a letter or digit, and can never be used again in the same project, even after the environment is deleted.
Rename
maruhi env rename staging "Pre-production"Renamed environment staging from Staging to Pre-production (metaVersion=2)Only the display name changes. The ID, every value and every key stay as they are, so nothing is re-encrypted and --env staging keeps working. Names are normalized to Unicode NFC before signing, are at most 256 characters, and must be unique among the environments that are not deleted (“Another environment in this project is already named …”).
If someone else changes the environment at the same moment, the CLI fetches the new state, verifies it, signs again, and retries a few times before giving up. It reports success only after the new name shows up in the verified listing.
Delete
maruhi env rm stagingYou are about to delete environment staging (Pre-production): every variable in it, every stored value version and every wrapped DEK is deleted immediately and cannot be recovered; only its signed deletion record remains. Deletion is terminal — the environment cannot be restored and its ID can never be reused
Type the environment ID to confirm the permanent deletion: staging
Deleted environment staging (Pre-production; delete_environment at chain seq 12). Its variables, values and DEK wraps are gone; a signed deletion record remains on the project chain, and the ID staging can never be reusedDeleting needs the admin or owner role. You confirm by typing the environment ID. If someone renames the environment while you confirm, the CLI deletes it under the new name without asking again (you confirmed the ID, which never changes) and prints one note naming the old and the new name. Without a terminal (CI, scripts, or an AI agent) the command refuses unless you pass --force, which skips the prompt but still prints what is being deleted.
If someone else appends to the project’s chain while you delete, the CLI syncs the chain again, signs again, and retries a few times before giving up. It reports success only after its own deletion entry shows up on the verified chain. If the response is lost on the way back, the next maruhi command against the project finds the entry on the chain and says so.
What happens on the server, at once:
- Every variable in the environment is deleted, with every stored version of its value and the metadata of variables deleted earlier.
- Every wrapped copy of the environment’s keys (its DEKs, for every member and every epoch) is deleted.
- The deletion is recorded on the project’s chain as a
delete_environmententry signed by your device key, in the same step that deletes the data. Every member’s CLI verifies it with the rest of the chain: from then on the environment is deleted for every client, a server that serves it as live again is refused, and a server that hides the deletion would have to roll the chain back, which every client that has already seen the deletion detects. - The environment’s signed statements are deleted too, and the server stops listing it.
maruhi env list --allstill shows it, from the chain, without a name. - The environment leaves every scope that listed it: members, devices and server grants. A later scope can no longer name it.
- The ID is never reused: the project’s chain records that the environment was created and deleted. The display name is freed and can be given to another environment.
- The audit log records the deletion of the environment and of each variable it held.
Afterwards, commands that use the environment, such as maruhi pull, fail before contacting the server with “Environment staging is deleted (delete_environment at chain seq 12)”, and running maruhi env rm again reports the same. If the environment was your defaultEnvironment, point it somewhere else with maruhi config set defaultEnvironment <id>.
Deleting removes the ciphertext the server holds; it does not take back values that were already pulled or synced to a deploy target. If the environment held credentials that should stop working, rotate them at their issuer — see Rotating upstream credentials.