Skip to content

Claude Code

Install the dotsecenv plugin for Claude Code so your AI coding assistant can list, retrieve, store, share, and revoke GPG-encrypted secrets.

  • dotsecenv installed and available on your PATH
  • A GPG key with your passphrase cached in gpg-agent (or macOS Keychain)
  • Claude Code installed (CLI, desktop app, or IDE extension)
  1. Add the dotsecenv marketplace

    In Claude Code, run:

    /plugin marketplace add dotsecenv/dotsecenv
  2. Install the plugin

    /plugin install dotsecenv@dotsecenv

    This registers two skills:

    • /dotsecenv:secrets — manages secrets via the dotsecenv CLI (store, get, share, revoke)
    • /dotsecenv:secenv — interprets .secenv files, resolves vault references, and debugs loading issues
  3. Verify GPG is ready

    The plugin checks your GPG configuration on first use. If your passphrase is not cached, Claude will ask you to warm the cache:

    Terminal window
    ! gpg --sign --local-user YOUR_FINGERPRINT </dev/null

    The ! prefix runs the command in your terminal so pinentry can prompt for your passphrase.

  4. Use it

    Ask Claude to work with your secrets naturally:

    • “List my secrets” — lists secret keys without decrypting values
    • “Show me the value of myapp::API_KEY” — decrypts a specific secret
    • “Store a new secret called myapp::DB_PASSWORD” — encrypts and stores a value
    • “Share myapp::API_KEY with fingerprint ABC123” — re-encrypts for another team member
    • “Create a .secenv file for this project” — generates a .secenv with the right references
    • “Why isn’t my secret loading?” — debugs vault paths and .secenv references

After installation, Claude can manage your dotsecenv secrets through natural language. The plugin enforces a security model that prevents Claude from decrypting secrets unless you explicitly ask.

You: list my secrets
Claude: Running dotsecenv secret get...
myapp::API_KEY
myapp::DB_PASSWORD
staging::JWT_SECRET
You have 3 secrets across 1 vault.

The plugin provides two skills:

Teaches Claude how to use the dotsecenv CLI safely:

  • Which commands are safe — listing secrets, describing vaults, and running health checks never trigger GPG decryption
  • When to ask first — decryption and mutation require your explicit request
  • How to detect problems — if your GPG pinentry is terminal-based or your passphrase is not cached, Claude warns you upfront instead of failing silently

Teaches Claude how to work with .secenv files:

  • Parse .secenv syntax — plain variables (KEY=value), secret references (KEY={dotsecenv}, KEY={dotsecenv/prod::SECRET}), and quoted values
  • Resolve vault paths — reads your dotsecenv config to find vaults, understanding that relative paths like .dotsecenv/vault resolve relative to the .secenv file’s directory
  • Debug loading issues — checks if referenced secrets exist in reachable vaults, verifies file ownership/permissions, and explains ancestor loading behavior
  • Create .secenv files — generates files with the correct syntax after verifying secrets exist

Claude Code runs shell commands without a terminal, which affects how GPG passphrase prompts work:

Pinentry ProgramWorks with Claude Code?Notes
pinentry-macYesGUI-based. Passphrase returned silently from Keychain or gpg-agent cache.
pinentry-gnome3YesGUI-based. Needs a display server.
pinentry-qtYesGUI-based. Needs a display server.
pinentry-ttyNoRequires terminal input that Claude cannot provide.
pinentry-cursesNoRequires terminal input that Claude cannot provide.

If you use a terminal-based pinentry, you have two options:

  1. Switch to a GUI pinentry — set pinentry-program in ~/.gnupg/gpg-agent.conf

  2. Pre-cache your passphrase before asking Claude to decrypt:

    Terminal window
    ! gpg --sign --local-user YOUR_FINGERPRINT </dev/null

The plugin enforces four tiers of operations:

TierOperationsBehavior
SafeList secrets, describe vaults, validate, health checksClaude runs freely
DecryptRetrieve a secret valueOnly when you explicitly ask
MutateStore, share, revoke, forgetClaude confirms before executing
ProhibitedKeychain extraction, exfiltration, init/loginNever executed

If you are developing dotsecenv locally, you can load the plugin directly from a checkout:

Terminal window
claude --plugin-dir /path/to/dotsecenv
/plugin uninstall dotsecenv@dotsecenv
/plugin marketplace remove dotsecenv