| title | AI Agent Integration |
|---|---|
| weight | 6 |
| toc | true |
pass-cli is built to be driven safely by AI coding agents (Claude Code, Cursor, Codex, Continue, and similar) — not just humans at a keyboard. An agent can use your real credentials to run real commands without the secret ever landing in the chat transcript, a log, CI output, or a file the agent's harness watches.
This is the differentiator: most ways of handing a secret to an agent — pasting
it, echo-ing it, capturing it into a shell variable — leak it into the
conversation log the moment they happen. pass-cli exists to move a secret from
your encrypted vault into the process that needs it through a channel the
transcript never sees.
Never let a secret value reach the transcript, a log, or a watched file. Once a secret is in the conversation log on disk it is compromised and must be rotated.
Everything below is a way to satisfy that rule. The default — exec — passes
the secret only through a child process's environment, so it never touches
stdout, the clipboard, or shell history.
The primary tool. Runs a command with credentials injected as environment variables; pass-cli writes nothing of its own to stdout, and the child's exit code is propagated unchanged.
# Explicit mapping: ENV_NAME=service
pass-cli exec --set GITHUB_TOKEN=github -- gh repo list
# Multiple credentials at once
pass-cli exec --set AWS_ACCESS_KEY_ID=aws-id --set AWS_SECRET_ACCESS_KEY=aws-secret -- aws s3 ls
# Convenience form: derive the env name from the service (openai-api -> OPENAI_API)
pass-cli exec openai-api -- python train.pyexec is read-only: it records no usage and triggers no sync push, so it is safe
to call on a hot path.
-
exportprints shell statements to load credentials into the current shell (eval "$(pass-cli export --set GITHUB_TOKEN=github)"). A weaker boundary thanexec— preferexecwhen you only need to launch a command. -
injectrenders a template, replacing${pass:service/field}references with values — the tool for a config file or a connection string that embeds a secret:echo 'postgres://app:${pass:db/password}@localhost/app' | pass-cli inject
References support value filters —
base64,base64url, andbasicauth(base64("user:pass")for an HTTPAuthorization: Basicheader) — so an agent never has to shell out tobase64and risk the value on stdout:echo 'Authorization: Basic ${pass:api | basicauth}' | pass-cli inject
For a session where an agent resolves many credentials, the optional background
agent unlocks the vault once and holds it in memory, so exec/export/inject
need no master-password prompt and no key derivation on each call:
pass-cli agent start # unlock once, then background itself
pass-cli exec --set GITHUB_TOKEN=github -- gh repo list # resolves via the agent, no prompt
pass-cli agent stop # zero secrets and stopIt serves resolved field values only — the master password and derived key
never leave the agent process — and auto-locks after inactivity (--idle,
default 15m) and always after --max-ttl (default 8h). When no agent is running,
every command transparently falls back to opening the vault directly, so the
agent is a pure optimization, never a dependency. POSIX only for now; on Windows
commands fall back to direct-open. See the Background Agent
reference for details.
pass-cli ships an agent usage guide inside the binary, so an agent can load version-matched guidance straight from the CLI — the instructions never drift from the installed version:
pass-cli skills get core # safe-usage guide: exec/export/inject/agent/list/get + leak traps
pass-cli skills get core --full # also include the full command reference
pass-cli skills list # list every skill shipped with this versionTo make an agent discover pass-cli automatically, install a small discovery stub into its skills directory:
pass-cli skills install # auto-detects ~/.claude/skills or ~/.agents/skillsThe stub is intentionally thin — it points the agent at pass-cli skills get core, and the real, version-matched guidance stays in the binary. See
AI Agent Skills for the full command.
An agent working on a user's machine can bootstrap in three commands:
pass-cli skills get core # learn the safe-usage rules
pass-cli list -q # discover available service names (no secrets)
pass-cli exec --set API_KEY=some-service -- <cmd> # run a command with the secret injected- Command Reference — every command and flag
- Background Agent — the promptless daemon in depth
- AI Agent Skills — the
skillscommand - Scripting Guide — non-agent automation and output modes