$ keygrant

Your API keys don't belong in your agent's context window.

keygrant is a secrets manager for AI coding agents. The model sees names. The process gets values. You approve every command.

Get started → GitHub Why: the threat model
demo: agent requests a secret, user approves via a native dialog, output returns redacted

Anything in context can leak

Agents read untrusted input all day: web pages, issues, READMEs, tool results. One injected instruction can make a model emit whatever its context holds, into a URL, a tool call, or generated code. Context is also logged, stored by observability tools, and shared in transcripts. If the key is in there, every output channel is an exfiltration channel.

The fix isn't to be careful. It's architectural:

model context: $STRIPE_KEY (name only)
child process: sk-live-************ (injected at exec)
output channel: [STRIPE_KEY:REDACTED] (base64/hex/url too)

How it works

OS-native storage

DPAPI on Windows, Keychain on macOS, Secret Service on Linux. Never a dotfile, never pasted into chat.

Injection via MCP

exec_with_secrets runs a command with values injected into that child process only, and redacts output before the model sees it.

You approve each command

A native dialog shows the exact command. A grant covers that command, in that agent session, for 15 minutes, in memory only. Timeout means deny.

No store tool, by design

The agent can't write secrets either: a value in a tool call would be a value in context. Values enter out-of-band only.

Install

uv tool install keygrant      # or: pipx install keygrant (Python ≥ 3.10)
keygrant init                 # wires .mcp.json + CLAUDE.md in your project
echo "sk-..." | keygrant set STRIPE_KEY --desc "stripe, test mode"

Then restart Claude Code. Full walkthrough in the quickstart.

Optional: sync and approve from your phone

End-to-end encrypted sync between your machines (the server stores ciphertext it cannot decrypt), and a phone approver for when you're away from the desk (verdicts are signed on your phone, so the relay can't forge them). Both are in preview. Read how it works →

What it doesn't protect against

Roadmap