Secrets for AI coding agents
keyshroud keeps API keys in an encrypted vault on your machine (or your own Vaultwarden, or the secret manager your team already runs) and injects them into the commands your AI coding agent runs. Any secret value that shows up in tool output is replaced with <redacted:NAME> before the model reads it.
Free, MIT-licensed, no account, no telemetry. Node.js 18.19+ on macOS, Linux and Windows.
$ keyshroud run -- ./deploy.sh > POST /v1/deploy HTTP/1.1 > Authorization: Bearer ghp_DEMOdemo0123456789demo<redacted:GH_TOKEN> < HTTP/1.1 200 OK deployed acme-app to production $ echo $GH_TOKEN ghp_DEMOdemo0123456789demo<redacted:GH_TOKEN>
The command got the real token and the deploy worked. The transcript holds only its name. (The token shown is fake.)
Works with Claude Code · Codex · Cursor · Cline · OpenCode · Gemini CLI · pi · omp · any MCP client · any shell
The problem
Whatever an agent reads goes to the model provider and stays in the transcript. These are the usual ways a key gets there, and what keyshroud does about each.
It is in the transcript, the provider’s logs and every later context window.
✓keyshroud add takes the value in a masked prompt or a desktop dialog, never through the chat.
.envAgents read it to debug. .gitignore stops commits, not reads.
✓Values live in the vault. .env.refs holds names you can commit.
Most vault MCP servers hand the plaintext straight to the model.
✓keyshroud’s MCP tools run the command for the model. None returns a value.
Claude Code cannot rewrite the output of a command that fails.
✓keyshroud claude-guard masks what every Bash command prints, failed ones included.
How it works
The agent works with names. The command gets the value. Whatever the command prints is masked before the model reads it.
GH_TOKEN to its vault item and puts the value in the command’s environment. Never in its arguments.gh, npm publish, curl, a deploy script. It runs with the real key.<redacted:GH_TOKEN> wherever the value was printed.keyshroud add --env GH_TOKEN stores the value and wires the name. Config files and .env.refs hold only names and references.
keyshroud run -- <command> reads what the command needs from the vault and starts it with those variables set.
Output streams through a redactor. Hooks in Claude Code and pi mask tool results of commands you did not wrap, too.
More detail, with the pieces and what each one touches: how it works.
Demo
A real Claude Code session, recorded in one take. The prompt never mentions keyshroud: the plugin tells Claude which secret names exist, and Claude runs the check through keyshroud on its own. The API gets the key. Claude gets its name.
keyshroud: vault secrets are available by name only: ACME_API_KEY, GH_TOKEN, DATABASE_URL. Run every command that uses one through `keyshroud run --only NAME -- <command>` …
From the plugin’s SessionStart hook when the session starts. Names only.
> Authorization: Bearer <redacted:ACME_API_KEY> < HTTP/1.1 200 OK {"ok":true,"account":"acme-demo"}
The script runs curl -v, which prints the header it sends. keyshroud masked the key before Claude Code got the output: it appears 0 times in Claude Code’s saved transcript.
200 Bearer acme_DEMO_not_a_real_key_4f9c2e7a1b
Last line of the API’s log from the same run. The key arrived, so the call worked.
Recorded in November 2026 in one take with vhs, at normal speed, no cuts: Claude Code 2.1.309 (Haiku 5.5, reached through OpenRouter) with the keyshroud 0.12.1 plugin (/plugin install keyshroud@keyshroud). The setup runs off screen and is published: agent-shell.sh, claude.tape. The key is fake, and the API is a local mock that accepts only that key. keyshroud keeps keys out of what Claude reads by accident; it is not a sandbox against an agent that sets out to steal one (threat model).
Open the text version
{ "mcpServers": { "keyshroud": { "command": "keyshroud", "args": ["mcp"] } } }
Claude Desktop takes the same entry in claude_desktop_config.json. None of the server’s tools return a secret value: secrets_run, secrets_list, secrets_request, vault_status.
exit: 0 --- stdout --- > Authorization: Bearer <redacted:ACME_API_KEY> < HTTP/1.1 200 OK {"ok":true,"account":"acme-demo"} --- stderr ---
The secrets_run result. The server put the key into the command’s environment and masked it in the output.
Recorded in November 2026 with keyshroud 0.12.1 in Claude Code 2.1.309 (Haiku 5.5, reached through OpenRouter) with its built-in tools turned off and keyshroud’s MCP server as its only tools: the same server, tools and results Claude Desktop gets from this entry. Claude Desktop itself is not shown. Same fake key and local mock as the Claude Code take: claude-mcp.tape.
Open the text version
Claude Code cannot rewrite the output of a command that fails, so a hook alone leaves it unmasked. keyshroud claude-guard makes Claude Code start its shell through a small launcher that masks what the command prints as it is written, and keeps its exit status. There is no agent in this take: the last command is what Claude Code’s Bash tool runs once the guard is on, in a shell started through keyshroud run the way keyshroud run -- claude starts Claude Code. Recorded in November 2026 with keyshroud 0.12 from guard.tape and tour-shell.sh. The key is fake, and the API is a local mock that refuses the call. macOS and Linux.
A secret is read from a real HashiCorp Vault 2.2.2 dev server on localhost and used masked; nothing is copied out of Vault and keyshroud never writes there. Then the project is narrowed to its own names, a command that asks for another project’s token is refused, and the local vault is copied into one file under a passphrase of its own. No agent in this take. Recorded in November 2026 with keyshroud 0.12 from team.tape and tour-shell.sh. The token, passphrase and secrets are made up.
Quickstart
You need Node.js 18.19+. No account, no server: the first secret creates an encrypted vault on your machine.
npm i -g keyshroud
One CLI that agents call from their shell, plus plugins for Claude Code and pi. An MCP server covers clients without a shell.
keyshroud add --env GH_TOKEN \
--item "GitHub token"
Typed into a masked prompt, or a dialog when an agent starts it. The vault’s key goes to the macOS keychain, the Linux Secret Service or Windows DPAPI. Already have a .env? keyshroud import moves it.
keyshroud run -- gh auth status
The command gets the token; what it prints shows <redacted:GH_TOKEN>. In Claude Code, install the plugin: /plugin marketplace add dinhkarate/keyshroud
Paste this into Claude Code, Codex, Cursor, OpenCode or pi. The agent follows install.md and leaves typing secrets (and any vault password) to you.
Read https://keyshroud.dev/install.md and set up keyshroud for me.
Where secrets live
A reference names its vault, so all three work side by side. keyshroud has no service of its own to sign up for.
keyshroud://An AES-256-GCM file on your machine. No account, no server, works offline.
keyshroud backup writes one file that restores anywherebw://The same secrets everywhere, in the Vaultwarden you host or a Bitwarden account.
vault://infisical://op://awssecrets://awsssm://gcpsecrets://azurekeyvault://HashiCorp Vault, OpenBao, Infisical, 1Password, AWS, Google Cloud and Azure, read where the secrets already are.
Features
Every feature works with names and references, never with values.
keyshroud run streams stdout and stderr through a redactor. A secret that arrives split across two chunks is still masked. Masking is always on, in a terminal too, because some agents run commands on one; --no-mask hands the terminal to an interactive program. Output that is not text passes through byte for byte.
pi tool_result and Claude Code PostToolUse hooks scrub tool results, including commands the agent ran without keyshroud.
Claude Code can't rewrite a failed call, so keyshroud claude-guard masks what every Bash command prints as it is written, failed ones included.
For clients without a shell, keyshroud mcp gives them secrets_run, secrets_list and secrets_request. None of them return values.
Write GH_TOKEN=keyshroud://GitHub token in a .env.refs file you can commit. keyshroud import converts an existing .env.
When an agent needs a new key it runs keyshroud add, and a hidden-input dialog opens on your desktop. You paste; the chat never sees it.
inject renders {{ keyshroud://… }} templates into files only you can read (mode 0600). scan finds leaked values in your repo before you commit.
A .keyshroud.json in a repo, such as { "only": ["STRIPE_*"] }, narrows what keyshroud run and the agent get there to the names that project needs.
audit.jsonl records which names were used, when and by which command, so you can see what an agent reached for. Never a value.
Agents
One vault, every coding agent you use. Setup for each is in the docs. Watch it in Claude Code and over MCP.
npx skills add dinhkarate/keyshroud, then the agent uses the CLI.
MCPClaude Desktop & chat clientsOne mcpServers entry. secrets_run returns masked output.
CLIAny shell or CIkeyshroud run -- <cmd> injects env and masks stdout/stderr.
Setup guideLet the agent install itinstall.md is written for agents: what to run, and what to leave to you.
Least privilege
By default a command gets every wired secret. Narrow that per project or per command. These are defaults against accidents, not walls: see the threat model.
In that directory, keyshroud run, the MCP tools and the names an agent is told are narrowed to the names in scope. Masking still covers every value.
$ keyshroud scope --only 'DB_*,ACME_*' $ keyshroud run --only GH_TOKEN -- gh auth status Secret unresolved: GH_TOKEN is outside this project's scope (~/acme-app/.keyshroud.json)
--only gives a command just the names you list. With Vaultwarden, keyshroud setup gives agents an account of their own, so they never open your whole vault.
$ keyshroud run --only GH_TOKEN -- gh pr list # gh gets GH_TOKEN and no other secret
Compare
The tools in this space take one of four approaches. keyshroud masks what the model reads whether or not you wrapped the command, and keeps the vault on your side.
| Approach | Does the model see the value? | A command you did not wrap | Covers |
|---|---|---|---|
| Names in, masked output out keyshroud |
No. Tool output is masked. | Masked too in Claude Code (hook, plus the guard for failed commands) and pi/omp. Other agents rely on keyshroud run. |
Any secret a command reads from its environment or a file. Free, MIT, no account. |
| A wrapper that masks its own child 1Password op run, dotenvx run --redact, varlock run, secretspec run |
Not from the wrapped command. | Not masked. | The same, for the commands you wrap. op run needs a paid 1Password account. |
| A vault MCP server Bitwarden MCP, HashiCorp Vault MCP, Doppler MCP, Infisical MCP (by default) |
Yes. The tool returns it. | Not masked. | Looking a secret up, with the value in the context from then on. |
| An egress proxy with placeholders Infisical Agent Vault, OneCLI, fnox proxy, 1Password for NVIDIA OpenShell, Claude Code’s sandbox.credentials mask |
No. The agent holds a placeholder. | Nothing to mask: the real value is never in the shell. | HTTP(S) credentials for hosts you allow. Needs a proxy that can read the requests. |
An egress proxy is the stronger tool against a hostile or prompt-injected agent, for the credentials it covers; keyshroud also covers database passwords, SSH and signing keys and every CLI that reads a variable. They combine. As we read each project’s documentation on 2026-11-15; corrections are welcome in an issue.
Security
Redaction is defense in depth, not a sandbox. Every guarantee we test for and every known limit is in the security model.
keyshroud claude-guard on)auth.json (only references are stored)keyshroud scan)keyshroud run (the hook can’t rewrite a failed call)FAQ
The long list, with CI, Docker, Windows and upgrading, is in the FAQ.
No. Secrets live in an encrypted file on your machine by default, with its key in the OS keychain. Vaultwarden or Bitwarden is optional, for the same secrets on several machines.
Yes. The command gets the real value in its environment; only the text the model reads is masked.
No. It stops accidental disclosure. A hostile or prompt-injected agent can still send a value it can use somewhere else; for that threat use an egress proxy with placeholder credentials and keep a human approving commands.
Partly, and differently. Claude Code can deny reads of files such as .env, and its sandbox can show a command a placeholder for a credential and put the real value on requests to hosts you allow. It has no secret store and does not rewrite what a tool prints. keyshroud is the store, works the same across agents, and masks output; the two combine.
.gitignore my .env?That stops commits, not reads. Agents read .env to debug, and whatever they read goes to the model provider.
No. keyshroud reads them where they are, with the sign-in you already have, and never writes there.
Yes, tested on Windows 10 with Node 22. The local vault keeps its key with DPAPI. The guard for failed commands is macOS and Linux only.
Every key you paste lives on in the transcript, the provider’s logs and every future context window. Give your agent the name instead.
No account · No telemetry · MIT