Keep agent API keys in one encrypted store your phone can autofill

I wrote up the setup I use for this, since “where do the agent’s API keys live” kept coming up.

Your agent needs API keys and app passwords, and copying them into chat, tracked files, or terminal output is how they leak. This puts one encrypted store on the machine and on your phone.

1. Create the store. Have the agent generate a GPG key — with the secret key, public key, and revocation certificate exported to a separate backup — then `pass init ` and insert one test entry, `example.com`. Check it with `pass show example.com | head -1`. No real credentials yet.

2. Push ciphertext only. Make `~/.password-store` a Git repo with a new **private** GitHub repo as origin and push. Check that GitHub holds `example.com.gpg` and not the word `password`.

3. Connect Pass for iOS over HTTPS. Add the repo’s HTTPS clone URL and paste a GitHub personal access token into the field the app labels “GitHub password” — it wants the token, not your account password. Then import the **same private GPG key**: the repo lets the app download the files, the key lets it decrypt them.

4. Prove the phone can write back. Create `phone-test` in the app, sync, then run `pass git pull` and `pass show phone-test | head -1` on the machine. Both directions now work.

5. Teach every new session to use it. Add a short `## Credentials` block to the always-loaded instruction file — store path, `pass show | head -1`, use the value inline, never echo it, never pass a secret as a command-line argument — and keep the long policy in a separate note. Test it by having a fresh session make one authenticated read.

Source: How to Use pass for AI Agent Secrets and iPhone Autofill

1 Like