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=${CLAWDBOTTMUXSOCKETDIR:-${TMPDIR:-/tmp}/clawdbot-tmux-sockets}
mkdir -p $SOCKET_DIR
SOCKET=$SOCKET_DIR/clawdbot-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不可用,请停止操作并询问。