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

```bash [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 `.gitignore` if one is not already present, so the encrypted cache directory (`.shelve/`) and all `.env*` files stay out of version control. `.env.example` and `.env.template` are 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

<field-group>
<field name="cwd" type="string">

Directory to initialize. Defaults to the current working directory.

</field>
</field-group>

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

<callout type="info">

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.

</callout>
