Environment variables
Environment variables pass settings to a running program. Some let you change how discerndiscernA tool that installs and runs an agent development practice in a project. starts; others give your project scripts information such as the current worktreeWorktreeA separate working copy and branch for one effort. or its assigned port. This page lists the supported DISCERN_* variables by purpose.
Find the variable name below to see who sets it, who reads it, and its default where one exists. Setting a variable affects the current process unless its entry says discern exports or writes it. For lasting project settings, use discern.toml.
Installation
§Inputs read by the POSIX installerInstallerThe commands that set up and maintain discern in a project..
| Variable | What it does |
|---|---|
DISCERN_REPO |
GitHub release repository the installer downloads from. Defaults to discern-sh/discern. |
DISCERN_VERSION |
Release version the installer downloads, with or without a leading v. Defaults to latest. |
DISCERN_BIN_DIR |
Install directory. Overrides the installer's automatic destination selection. |
Runtime overrides
§Per-process overrides for discern's runtime behavior.
Worktree identity
§Inputs that override the identity derived for a worktree.
| Variable | What it does |
|---|---|
DISCERN_PROJECT_SLUG |
Overrides [project].slug when discern derives worktree identities. |
DISCERN_WORKTREE_BRANCH_PREFIX |
Overrides [repository].branch_prefix when discern derives worktree branch names. |
DISCERN_WORKTREE_ID |
Sets an explicit worktree id in the process or a configured env file. Accepts letters, numbers, dots, dashes, and underscores. |
Project Scripts
§Values discern exports before running a Project ScriptProject scriptA runnable procedure the project supplies for its agents and maintainers..
| Variable | What it does |
|---|---|
DISCERN_ROOT |
Absolute project root exported to a Project Script. |
DISCERN_TOML |
Absolute path to the active discern.toml exported to a Project Script. |
DISCERN_SCRIPTS_DIR |
Absolute configured Project Scripts directory exported to a Project Script. |
Checkpoint commands
§Structured inputs exported to checkpointCheckpointA review question presented when a relevant kind of change occurs. when commands.
| Variable | What it does |
|---|---|
DISCERN_CHECKPOINT_INPUT |
Absolute path to the versioned JSON facts without raw file content for the current checkpoint when command. See the checkpoint when protocol. The file exists only while that command runs. |
Worktree environment
§Identity values passed to resource commands or written to configured worktree env files.
| Variable | What it does |
|---|---|
DISCERN_WORKTREE_PORT |
Deterministic development port written to a configured worktree env file when [worktree].export_port = true. |
DISCERN_WORKTREE |
Generic worktree handle supplied to resource commands and written to configured env files when resources are declared. |
DISCERN_RESOURCE_<NAME> |
Stable handle for one declared resource. <NAME> is the resource name uppercased with non-alphanumeric runs replaced by underscores. |
Experimental features
§User-facing controls for experiments whose names and behavior remain subject to change.
| Variable | What it does |
|---|---|
DISCERN_EXPERIMENTAL_MCP_PRELOAD |
Requests eager discern MCP loading in supported provider integrations when set to 1. |
DISCERN_EXPERIMENTAL_AWAIT_CALL_SECONDS |
Sets a positive whole-number cap for one experimental automatic await call. |