An agentic vault for Pi. The agent can use a secret without ever seeing it.
Instead of pasting an API key into the chat, where it lives in the transcript forever, the agent names a secret and a command. You approve or deny. On approval the secret is read from the macOS login keychain and handed to that one child process as $PI_VAULT_SECRET.
Read this before you put anything real in it.
An agent with shell access can bypass this entire extension with one command:
security find-generic-password -s pi-vault -a YOUR_SECRET -wYour login keychain is unlocked for as long as you are logged in, and the item's ACL trusts the security binary that created it, so that read succeeds with no prompt and no audit entry. The approval dialog is therefore a convention the agent chooses to honour, not a gate it is forced through.
So today this buys you: the secret stays out of the model's context and out of your session transcript, it never appears in a command line where ps can see it, and it gets redacted if a command echoes it. Those are real, but they are protections against accident and drift, not against intent.
The fix is Touch ID, and it is the next thing being built. Creating the keychain item with a Secure Enclave access control (kSecAccessControlBiometryCurrentSet) makes the OS demand a fresh fingerprint on every read, from any process. At that point the agent can trigger a prompt but can never satisfy one, and the boundary is enforced by hardware instead of by good behaviour.
Until then, treat this as a convenience wrapper, not a vault.
pi install git:github.com/isaaclins/pi-vaultThen /reload in Pi.
The vault is your macOS login keychain. Nothing new to unlock, nothing new to back up. Add secrets yourself, so the value never passes through the agent:
security add-generic-password -U -s pi-vault -a OPENAI_API_KEY -wLeaving -w empty makes it prompt for the value, which keeps it out of your shell history and out of ps.
Remove one:
security delete-generic-password -s pi-vault -a OPENAI_API_KEYThe agent calls one tool:
vault_use
name: OPENAI_API_KEY
reason: refresh the expired Codex auth token
command: ["sh","-c","curl -sH \"Authorization: Bearer $PI_VAULT_SECRET\" https://api.openai.com/v1/models"]
You get a confirmation showing the name, the reason, the working directory, and the exact command. Deny and nothing is read from the keychain at all.
Every request, approved or denied, appends one JSON line to:
~/.local/state/pi-vault/audit.log
- Touch ID via a Secure Enclave ACL on the keychain item. Required before this is a real boundary, see Status above
vault_listso the agent can discover names without values- Optional second approval from a phone
- A session-scoped "go free" grant that dies with the session
MIT