Shell Environment Inheritance
Workbench captures the full environment of your interactive login shell at launch and injects it as the lowest-precedence source into the env-provider dispatcher. This means tools installed via Homebrew, nvm, pyenv, SDKMAN, or any other shell-profile mechanism are visible to agents and terminals without extra configuration.
How it works
Section titled “How it works”- Launch snapshot — on startup, Workbench records the process’s own environment as the baseline.
- Shell probe — a background thread spawns
$SHELL -l -i -c 'printf "\0"; env -0'(or an equivalent fish script) and parses the NUL-delimited output. The leading NUL sentinel ensures any rc-file banner output is discarded. - Diff — the probe result is compared against the baseline. Keys that are new or changed become the forwarded set; keys present in both with identical values become the inherited set (shown separately in Settings for reference).
- Denylist — a built-in denylist strips security-sensitive variables (
LD_PRELOAD,DYLD_*,BASH_FUNC_*, etc.) and shell-presentation noise (PS1,STARSHIP_*,PROMPT_*). Users can add glob patterns in Settings to extend this list. - Injection — the filtered forwarded vars are injected as precedence 0 (lowest) into the env-provider dispatcher, so plugin-provided values (direnv, mise, dotenv, Nix devshell) always win on collision.
The probe re-runs automatically when any of your shell rc files change (.zshrc, .bashrc, .bash_profile, .profile, .config/fish/config.fish, etc.).
Settings
Section titled “Settings”The Environment section in Settings shows the captured shell environment and provides controls to manage it.
| Setting | Description | Default |
|---|---|---|
| Forwarded variables | Variables from your shell that differ from the launch baseline. Values are masked by default; click Show values to reveal. | — |
| Inherited variables | Variables present in both your shell and the baseline with identical values (read-only, for reference). | — |
| Reload | Re-probe $SHELL and refresh the captured environment. | — |
| Disable shell env | Globally disable shell-env injection. Agents and terminals will not receive the captured variables. Other env providers (direnv, mise, etc.) are unaffected. | Off |
| User deny patterns | Glob patterns (one per line) for variables you want excluded from forwarding, on top of the built-in denylist. | Empty |
| Built-in deny details | Expandable list showing the hardcoded denylist entries. | — |
Precedence
Section titled “Precedence”Shell-env sits at the bottom of the env-provider stack:
| Precedence | Source |
|---|---|
| 4 (highest) | direnv |
| 3 | mise |
| 2 | dotenv |
| 1 | Nix devshell |
| 0 (lowest) | Shell environment |
If direnv exports GOPATH=/workspace/go and your shell has GOPATH=/home/you/go, direnv wins.
Platform notes
Section titled “Platform notes”- macOS / Linux — the probe runs the user’s
$SHELLwith login + interactive flags. Fish uses a dedicated script that avoids the POSIXenv -0incompatibility. - Windows — there is no shell probe.
shell_path_is_cached()returnstrueimmediately. Registry-based PATH refresh (winreg) is handled separately inenv.rs.
Diagnostics
Section titled “Diagnostics”Shell-env probe events are logged under the workbench::env tracing target. If the probe fails (missing shell binary, timeout, parse error), a warning is logged and the shell-env source is simply absent — agents fall back to the other env providers.
Original source: utensils.io/claudette