Keep secrets out of AI context.
Keep AI coding tools away from credential files: a hook in Claude Code, instruction or ignore files in other tools. Store secrets in encrypted backends. Protect MCP server configs. One command to set up.
npx secretless-ai initOpen source. secretless-ai 0.23.0.
The problem.
AI coding tools read your filesystem. That includes .env files, SSH keys, cloud credentials, and MCP server configs. Without protection, your secrets enter the context window on every interaction.
Without secretless
- xAI reads .env files with API keys.
- xCredentials sent to remote AI APIs.
- xSSH keys and cloud credentials exposed in context.
- xAI suggests hardcoded secrets in code.
With secretless
- Secret files are off limits: denied by a hook in Claude Code, by instruction elsewhere.
- Stored values are referenced by name instead of pasted into the context window.
- In Claude Code, a shell command whose text reads a secret file or prints a secret variable is denied before it runs.
- AI uses environment variable references instead.
How it works.
Secretless auto detects your AI tools, installs a protection for each, stores credentials in encrypted backends, and injects them at runtime.
Detect
Scans your project for AI tool config files. Finds .claude/, .cursorrules, .aider.conf.yml, and more.
Configure
Installs tool specific protections. Hooks for Claude Code, instruction files for Cursor and Copilot, ignore patterns for Aider.
Store
Secrets go into encrypted backends: local AES-256-GCM, OS keychain, 1Password, Vault, or GCP Secret Manager, instead of .env files.
Inject
At runtime, secrets are injected into the process as environment variables. The AI tool refers to them by name and works from the command's output.
Store and inject secrets.
Secrets are stored in an encrypted backend and reach a command as environment variables when it runs.
- What secretless meansHere the term means the AI tool works without seeing secret values. The secrets still exist, stored in a backend and injected when a command runs.
- Five storage backendsThe OS keychain by default on macOS, and on Linux with secret-tool. An AES-256-GCM encrypted file where there is no keychain. 1Password, HashiCorp Vault or GCP Secret Manager.
- Secret managementSet, list and import secrets, and run a command with all of them or only the ones it names.
- AI safe guardThe secret get command prints no value in a non interactive context, which is how AI tools run commands, unless the command carries --force.
- MCP secret protectionThe protect-mcp command encrypts the plaintext API keys in MCP server configs, and the server receives them at runtime.
Rules, scans and the broker.
Rules set what an AI tool is denied, scans find credentials that already leaked, and the optional broker allows or denies each request.
- Supported AI toolsA hook and deny rules in Claude Code. An instruction file that nothing enforces in Cursor, GitHub Copilot, Devin Desktop (formerly Windsurf) and Cline. Ignore patterns in Aider.
- What is coveredFile patterns such as .env files, private keys and cloud credentials, and the credential pattern families of the @opena2a/credential-patterns catalog.
- Allowlist and custom rulesA .secretlessignore file suppresses known false positives, and custom deny rules add organization specific patterns.
- Credential scope discoveryRecords what a stored credential can do as a baseline, and a later check reports the permissions added since.
- Credential brokerA local daemon whose policy rules allow or deny each credential request, deny all by default.
- Wires into agent identityWhen the broker runs, each credential access is attributable to an AIM agent identity.
- Data loss preventionScan and redact credentials in shell history and AI tool transcripts, once or with a watch daemon.
- Git protection and verificationA pre-commit hook scans staged files for secrets. The verify command reports credentials it finds in AI context.
What it does not cover.
For Cursor, GitHub Copilot, Devin Desktop (formerly Windsurf) and Cline, nothing enforces the instruction file Secretless writes, and it has no effect unless the tool loads that file.
The hook and the deny rules check a command by its text before it runs and cannot see its output, so a command that returns a credential, such as a cloud CLI call that fetches a secret, places the value in the model's context.
The gate sits on the assistant's tool path: it is not a boundary against other processes on the machine.
Get started with one command.
No signup. One command detects your AI tools and installs the protection each one supports. Store your secrets afterwards with the import or secret set command.
npx secretless-ai init