1Password CLI
Follow the official CLI get-started steps. Don't guess install commands.
References
- -
references/get-started.md (install + app integration + sign-in flow) - INLINECODE1 (real
op examples)
Workflow
- 1. Check OS + shell.
- Verify CLI present:
op --version. - Confirm desktop app integration is enabled (per get-started) and the app is unlocked.
- REQUIRED: create a fresh tmux session for all
op commands (no direct op calls outside tmux). - Sign in / authorize inside tmux:
op signin (expect app prompt). - Verify access inside tmux:
op whoami (must succeed before any secret read). - If multiple accounts: use
--account or OP_ACCOUNT.
REQUIRED tmux session (T-Max)
The shell tool uses a fresh TTY per command. To avoid re-prompts and failures, always run op inside a dedicated tmux session with a fresh socket/session name.
Example (see tmux skill for socket conventions, do not reuse old session names):
CODEBLOCK0
Guardrails
- - Never paste secrets into logs, chat, or code.
- Prefer
op run / op inject over writing secrets to disk. - If sign-in without app integration is needed, use
op account add. - If a command returns "account is not signed in", re-run
op signin inside tmux and authorize in the app. - Do not run
op outside tmux; stop and ask if tmux is unavailable.
1Password CLI
请遵循官方CLI入门步骤。不要猜测安装命令。
参考资料
- - references/get-started.md(安装 + 应用集成 + 登录流程)
- references/cli-examples.md(真实的 op 示例)
工作流程
- 1. 检查操作系统 + Shell。
- 验证CLI是否存在:op --version。
- 确认桌面应用集成已启用(按入门指南操作)且应用已解锁。
- 必需:为所有 op 命令创建一个全新的 tmux 会话(tmux 外部不得直接调用 op)。
- 在 tmux 内登录/授权:op signin(等待应用提示)。
- 在 tmux 内验证访问权限:op whoami(读取任何机密前必须成功)。
- 如果存在多个账户:使用 --account 或 OP_ACCOUNT。
必需的 tmux 会话(T-Max)
Shell 工具为每个命令使用全新的 TTY。为避免重复提示和失败,请始终在专用的 tmux 会话中运行 op,并使用全新的套接字/会话名称。
示例(参见 tmux 技能了解套接字约定,不要重复使用旧的会话名称):
bash
SOCKETDIR=${OPENCLAWTMUXSOCKETDIR:-${CLAWDBOTTMUXSOCKET_DIR:-${TMPDIR:-/tmp}/openclaw-tmux-sockets}}
mkdir -p $SOCKET_DIR
SOCKET=$SOCKET_DIR/openclaw-op.sock
SESSION=op-auth-$(date +%Y%m%d-%H%M%S)
tmux -S $SOCKET new -d -s $SESSION -n shell
tmux -S $SOCKET send-keys -t $SESSION:0.0 -- op signin --account my.1password.com Enter
tmux -S $SOCKET send-keys -t $SESSION:0.0 -- op whoami Enter
tmux -S $SOCKET send-keys -t $SESSION:0.0 -- op vault list Enter
tmux -S $SOCKET capture-pane -p -J -t $SESSION:0.0 -S -200
tmux -S $SOCKET kill-session -t $SESSION
安全护栏
- - 切勿将机密粘贴到日志、聊天或代码中。
- 优先使用 op run / op inject,而非将机密写入磁盘。
- 如果需要无应用集成的登录,请使用 op account add。
- 如果命令返回账户未登录,请在 tmux 内重新运行 op signin 并在应用中授权。
- 不要在 tmux 外部运行 op;如果 tmux 不可用,请停止并询问。