Using 1Password CLI with Hermes Agent for Secret Management
Set up op CLI, sign in, and read or inject secrets.
Written by Neura Market from the official Hermes Agent documentation for 1Password. Commands, paths, and version numbers are reproduced from the source unchanged.
Read the official documentationThis skill lets Hermes Agent read secrets from a 1Password vault instead of storing them in plaintext environment variables or files. You would reach for it when your workflow already depends on 1Password and you want the agent to pull credentials, API keys, or database passwords on demand without exposing them in logs or config files.
What it does
The skill installs and configures the 1Password CLI (op), handles authentication, and provides three operations: reading a single secret, injecting secret references into a template, and running a command with secrets loaded as environment variables. It supports three authentication methods, so it works on a developer workstation with the desktop app, on a headless server with a service account token, or against a self-hosted Connect server.
Before you start
You need a 1Password account and the op CLI installed on the machine where Hermes runs. The skill also requires one of these authentication setups:
- Desktop app integration (interactive, needs a GUI and biometric approval)
- A service account token set as
OP_SERVICE_ACCOUNT_TOKEN - A Connect server with
OP_CONNECT_HOSTandOP_CONNECT_TOKEN
If you use the desktop app flow, tmux must be available because Hermes terminal commands are non-interactive and lose auth context between calls. The service account and Connect flows do not need tmux.
Authentication Methods
Service Account (recommended for Hermes)
Set OP_SERVICE_ACCOUNT_TOKEN in ${HERMES_HOME:-~/.hermes}/.env. The skill prompts for this on first load. No desktop app is needed. This method supports op read, op inject, and op run.
export OP_SERVICE_ACCOUNT_TOKEN="your-token-here"
op whoami # verify — should show Type: SERVICE_ACCOUNT
Desktop App Integration (interactive)
- Enable in 1Password desktop app: Settings → Developer → Integrate with 1Password CLI
- Ensure app is unlocked
- Run
op signinand approve the biometric prompt
Connect Server (self-hosted)
export OP_CONNECT_HOST="http://localhost:8080"
export OP_CONNECT_TOKEN="your-connect-token"
Setup
- Install CLI:
# macOS
brew install 1password-cli
# Linux (official package/install docs)
# See references/get-started.md for distro-specific links.
# Windows (winget)
winget install AgileBits.1Password.CLI
- Verify:
op --version
- Choose an auth method above and configure it.
Hermes Execution Pattern (desktop app flow)
Hermes terminal commands are non-interactive by default and can lose auth context between calls. For reliable op use with desktop app integration, run sign-in and secret operations inside a dedicated tmux session.
Note: This is NOT needed when using OP_SERVICE_ACCOUNT_TOKEN, the token persists across terminal calls automatically.
SOCKET_DIR="${TMPDIR:-/tmp}/hermes-tmux-sockets"
mkdir -p "$SOCKET_DIR"
SOCKET="$SOCKET_DIR/hermes-op.sock"
SESSION="op-auth-$(date +%Y%m%d-%H%M%S)"
tmux -S "$SOCKET" new -d -s "$SESSION" -n shell
# Sign in (approve in desktop app when prompted)
tmux -S "$SOCKET" send-keys -t "$SESSION":0.0 -- "eval \"\$(op signin --account my.1password.com)\"" Enter
# Verify auth
tmux -S "$SOCKET" send-keys -t "$SESSION":0.0 -- "op whoami" Enter
# Example read
tmux -S "$SOCKET" send-keys -t "$SESSION":0.0 -- "op read 'op://Private/Npmjs/one-time password?attribute=otp'" Enter
# Capture output when needed
tmux -S "$SOCKET" capture-pane -p -J -t "$SESSION":0.0 -S -200
# Cleanup
tmux -S "$SOCKET" kill-session -t "$SESSION"
Common Operations
Read a secret
op read "op://app-prod/db/password"
Get OTP
op read "op://app-prod/npm/one-time password?attribute=otp"
Inject into template
echo "db_password: {{ op://app-prod/db/password }}" | op inject
Run a command with secret env var
export DB_PASSWORD="op://app-prod/db/password"
op run -- sh -c '[ -n "$DB_PASSWORD" ] && echo "DB_PASSWORD is set" || echo "DB_PASSWORD missing"'
Guardrails
- Never print raw secrets back to user unless they explicitly request the value.
- Prefer
op run/op injectinstead of writing secrets into files. - If command fails with "account is not signed in", run
op signinagain in the same tmux session. - If desktop app integration is unavailable (headless/CI), use service account token flow.
CI / Headless note
For non-interactive use, authenticate with OP_SERVICE_ACCOUNT_TOKEN and avoid interactive op signin. Service accounts require CLI v2.18.0+.
References
references/get-started.mdreferences/cli-examples.md- https://developer.1password.com/docs/cli/
- https://developer.1password.com/docs/service-accounts/