CLI
Init
Scaffold AI-agent-safe ignore files in your project.
The init command prepares a repository for use with Shelve and, crucially, keeps your .env* files out of the context of AI coding agents. Running it is a one-off setup step — run it once per project.
terminal
shelve init
What it does
- Creates (or updates) an ignore file for every major AI agent so they can never read cached secrets:
.cursorignore.aiderignore.codeiumignore.continueignore.aigignore
- Appends a managed block to your
.gitignoreif one is not already present, so the encrypted cache directory (.shelve/) and all.env*files stay out of version control..env.exampleand.env.templateare whitelisted so you can still commit references.
Each ignore file is framed with # shelve-managed-block / # end shelve-managed-block markers. Running shelve init again only rewrites the managed block — your own entries above and below are preserved.
Options
cwd
string
Directory to initialize. Defaults to the current working directory.
Why this matters
AI coding agents (Cursor, Claude Code, Codex, Aider, Continue…) can read every file in your workspace unless you tell them otherwise. If you ever run shelve pull to write a .env to disk, an agent can trivially exfiltrate its contents into a prompt or a suggested commit. shelve init closes that hole in one command.
Even with agent ignore files in place, prefer
shelve run -- <cmd>: it pipes secrets to your subprocess through the environment and never writes them to disk in the first place.