Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add rules/cdbattags/ai/direnv-shell-bootstrapgit clone --depth 1 https://github.com/cdbattags/aiWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00563 | $0.00563 |
| Opus 5 | $0.00282 | $0.00282 |
| Sonnet 5 | $0.00113 | $0.00113 |
| Haiku 4.5 | $0.00056 | $0.00056 |
Grade A, and why
direnv-shell-bootstrap scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
direnv Shell Bootstrap
CRITICAL: The Cursor Shell tool runs non-interactive shells. The
direnv hook zsh from .zshrc does NOT fire. You MUST bootstrap the
environment before running any command that needs Nix tools or .env
variables.
Bootstrap One-Liner (cascading, fastest first)
[[ -n "$IN_NIX_SHELL" ]] || { source .direnv/cursor-env.zsh 2>/dev/null || eval "$(DIRENV_LOG_FORMAT= direnv export zsh)"; } && <your command>
- Already loaded (
$IN_NIX_SHELLset) — skip entirely (~0ms) - Cached env file exists and fresh —
source(~0ms) - Cache stale/missing — falls back to
direnv export(~1-4s)
Run from the workspace root (where .envrc lives) — use
working_directory on the Shell tool. The Shell tool is stateful — once
loaded, subsequent calls inherit the env.
Generate the Cache
Run the generate script from the workspace root (works for any project):
~/.cursor/skills/direnv-shell-commands/generate-cursor-env.sh
Pass --minimal for a smaller file (PATH + .env vars only). The output
at .direnv/cursor-env.zsh self-validates via mtime checks — if .envrc,
flake.lock, or .env is newer, it returns 1 and the bootstrap falls
back to live direnv export.
When to Skip Entirely
git,gh,ls,head,wc— system tools, no flake env needed- File reads, searches, grep — Cursor tools, not shell
- If you already bootstrapped in the same session (
$IN_NIX_SHELLis set)
When to Request Permissions
Use required_permissions: ["all"] on the Shell tool when:
flake.nixorflake.lockwas just changed (Nix daemon must rebuild)- The bootstrap fails with Nix errors (daemon socket or network access)
- First bootstrap after a fresh clone (no
.direnv/cache yet)
Normal development (warm cache) works fine in the default sandbox.
Full Details
See ~/.cursor/skills/direnv-shell-commands/SKILL.md for sandbox behavior,
error recovery, command categories, and all three bootstrap tiers.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 60 lines · 563 tokens per session scan A 60ebc291c0c5
direnv-shell-bootstrap is a cursor rule published in the GitHub repository cdbattags/ai (4 stars, last pushed 6mo ago), licensed MIT. It adds 563 tokens to every session, about $0.0028 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other cursor rules, from other repositories
10-feature-development
Feature implementation workflow and engineering mindset.
11-template-conventions
Reusable building blocks shipped with this template - use them instead of writing new ones.
03-ui
UI, layout, theming and localization standards.
12-new-project
Workflow for starting a new app from this template - rebranding, identity, cleanup and first feature.
13-updating-project
Workflow for updating an existing project - dependency and SDK upgrades, migrations, refactors, bug fixes.
01-tech-stack
Android tech stack and project standards.