Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

direnv

$ direnv Community Med Risk
direnv Contributors · Code & DevOps · MIT · macos / linux

Loads 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.

FCRS-1.0 Score
85 /100
Good
Medium Confidence
Zero-Friction Install
brew install direnv
CLI vs MCP Decision CLI Only

Pure local shell environment hook; agents should use direnv exec or direnv export json directly in the workspace.

Agent-Readiness Checklist

✓ JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
— NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 21 / 25

Exposes direnv status --json, direnv export json, and direnv exec for non-hooked subagent shells.

  • direnv status --json and direnv export json return JSON
  • direnv exec <dir> <cmd> works without shell hook setup
Trust & Safety 21 / 25

Explicit SHA-256 allow-listing blocks untrusted .envrc execution by default, though allowed .envrc files run arbitrary bash.

  • Untrusted .envrc changes are blocked until direnv allow
Setup & Portability 13 / 15

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
Utility & Efficiency 13 / 15

Standardizes per-repo PATH, Nix use flake, and .env injection cleanly across tools.

  • Integrates cleanly with Nix, Python venvs, and .env files
Maintenance & Lineage 8 / 10

Mature MIT-licensed community project with long-term stability.

  • Active direnv/direnv repository
Docs & Verifiability 9 / 10

Clear manpages (direnv.1, direnv-stdlib.1) and website documentation.

  • Complete manual pages at direnv.net

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

No credentials stored by direnv itself; .envrc trust hashes are saved in ~/.local/share/direnv/allow/.

Side Effects
Read-Only Local Write
Cost & Quotas

MIT open-source Go binary; completely free.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# 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

Check .envrc allow status in JSON
direnv status --json

Reports active .envrc paths, trust status, and loaded state as JSON.

Export directory environment diff as JSON
direnv export json

Computes and prints the environment variable additions/changes for the current directory in JSON.

Controlled Writes & Previews

Execute a command inside a trusted .envrc environment
direnv exec . env

Applies an already-allowed .envrc cleanly for one command without relying on interactive shell hooks.

Strengths for Agents

  • + direnv status --json and direnv export json make environment state inspectable by agents.
  • + direnv exec lets subagents run inside .envrc contexts without interactive shell hooks.
  • + Built-in allow hash guard prevents unreviewed .envrc execution.

Caveats & Pitfalls

  • ! No native Windows support outside WSL.
  • ! An .envrc file is executable bash; agents must read it before running direnv allow.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI