
Inject .envrc into bash in Grok Build
Inject .envrc into bash in Grok Build
load_envrc under [session] controls whether Build injects variables from a project .envrc into bash tool runs. Default is true. Official: Settings reference.
Config
User config (~/.grok/config.toml or $GROK_HOME/config.toml):
[session]
load_envrc = true
Turn injection off when bash must see only the process environment you already exported:
[session]
load_envrc = false
What it does
With load_envrc = true, bash tool calls pick up variables declared in the project's .envrc the same way a direnv-style workflow would for that shell. With false, those file-backed exports stay out of the tool environment.
Related session and env controls
Auto-compact threshold lives in the same [session] table: Set auto-compact threshold. Broader env vars for the CLI process: Set Grok Build environment variables.
Pitfalls
- Putting
[session]in project.grok/config.toml— user config only (project TOML is limited to[mcp_servers],[plugins], and[permission]). - Expecting
load_envrcto source arbitrary shell scripts — it targets.envrcvariable injection into bash, not a generalsourceof every dotenv flavor.