Latchkey for developers
Everything you can script: the latchkey command-line tool, the references your files hold, the protocol the tool speaks to the app, and how to put agents and MCP servers behind it.
The pieces
- The app holds the keychain. It runs the broker, shows approval panels, and keeps the log, grants and history. Only the signed app can read Latchkey’s keychain access group.
latchkey, the command-line tool, asks the app for everything over a Unix socket. It starts the app in the background if it isn’t running.- References such as
latchkey://shop/production/DATABASE_URLgo in env files and environment variables in place of values.
latchkey (CLI)
│ JSON over a Unix socket
▼
Broker (in the app) ──► iCloud Keychain
├─ approval panel, then Touch ID
├─ grants: keychain, this Mac only
├─ access log: access.jsonl (never values)
└─ remote pushes: vercel, gh, railway, flyctl,
or the services' APIs with a token itemWhere to start
- Quickstart
- Install the tool, import an env file, run a command, grant a folder.
- CLI reference
- Every command and option, environment variables and exit codes.
- Agents and MCP
- Instructions for coding agents, narrower grants, keys an agent can use without reading, rotation after a session, SSH, and Latchkey’s MCP server.
- References and API
- The reference formats, the broker protocol, the access log, and the files Latchkey keeps.
Item IDs
An item is either shared, NAME, or belongs to one environment of a project, project/environment/NAME. Each part is letters, digits, _, - and ., at most 64 bytes. For an item, the ID is the only place its project and environment are stored.
Environments can be any name; development, preview, staging, production and test sort first. Use names like vercel.preview to tell apart the same environment in different places.
| Kind | For | Masked in output |
|---|---|---|
token | API tokens and keys, one line | Yes |
password | Passwords and connection strings, one line | Yes |
key | Key material: SSH, GPG, .p8, .pem. Multi-line | Yes, line by line |
value | Not secret: host names, account IDs | No |
What’s released without asking
A read is released without a prompt only when the item is agent-safe (No Approval in the app), or a grant covers the folder, session and command as applicable. Allow Once authorizes one request; approvals are not cached. Revoking a grant stops future reads through it, but cannot recall released values. Everything else shows the approval panel, then Touch ID, Apple Watch or your password. Earlier values always ask. Changes (set, update, delete, move, import, restore, push) always ask, once per request: the Touch ID sheet alone, with the panel behind its Details… button (pushes show the panel first).