direnv
$ direnv Community Med RiskLoads and unloads per-project environment variables from .envrc files as your shell enters or leaves directories. Offers direnv status --json, direnv export json, and direnv exec for non-interactive shells, while blocking untrusted .envrc files until explicitly allowed.
brew install direnv Pure local shell environment hook; agents should use direnv exec or direnv export json directly in the workspace.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Exposes direnv status --json, direnv export json, and direnv exec for non-hooked subagent shells.
direnv status --jsonanddirenv export jsonreturn JSONdirenv exec <dir> <cmd>works without shell hook setup
Explicit SHA-256 allow-listing blocks untrusted .envrc execution by default, though allowed .envrc files run arbitrary bash.
- Untrusted
.envrcchanges are blocked untildirenv allow
Single Go binary available via Homebrew and distro packages on macOS and Linux (no native Windows support).
- macOS and Linux only; no native Windows shell support
Standardizes per-repo PATH, Nix use flake, and .env injection cleanly across tools.
- Integrates cleanly with Nix, Python venvs, and
.envfiles
Mature MIT-licensed community project with long-term stability.
- Active
direnv/direnvrepository
Clear manpages (direnv.1, direnv-stdlib.1) and website documentation.
- Complete manual pages at direnv.net
Security, Auth & Guardrails
No credentials stored by direnv itself; .envrc trust hashes are saved in ~/.local/share/direnv/allow/.
MIT open-source Go binary; completely free.
# direnv Agent Rules - Never run `direnv allow` blindly on an uninspected `.envrc` file (`.envrc` executes arbitrary bash). - Use `direnv exec <dir> <cmd>` in non-interactive shells where `direnv hook` is not active.
Agent-Ready Command Recipes
Safe Read-Only Queries
direnv status --json
Reports active .envrc paths, trust status, and loaded state as JSON.
direnv export json
Computes and prints the environment variable additions/changes for the current directory in JSON.
Controlled Writes & Previews
direnv exec . env
Applies an already-allowed .envrc cleanly for one command without relying on interactive shell hooks.
Strengths for Agents
- +
direnv status --jsonanddirenv export jsonmake environment state inspectable by agents. - +
direnv execlets subagents run inside.envrccontexts without interactive shell hooks. - + Built-in
allowhash guard prevents unreviewed.envrcexecution.
Caveats & Pitfalls
- ! No native Windows support outside WSL.
- ! An
.envrcfile is executable bash; agents must read it before runningdirenv allow.