OpenParable
Skip to content
← Back to skills

op-session

Apps & Automation

Initialize 1Password CLI session for Claude Code. Use when: starting a session that needs 1Password secrets, op CLI keeps prompting biometric auth, setting up OP_SESSION token. Solves: Claude Code's no-TTY subprocess model triggers 1Password biometric auth on every op call. Supports both token-based and App Integration auth modes — auto-detects which mode to use.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/sd0xdev/sd0x-dev-flow/blob/HEAD/skills/op-session/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/op-session, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

1Password Session for Claude Code

Problem

Claude Code executes each Bash tool call in a new subprocess without TTY. 1Password CLI's app integration binds auth to the terminal session, so every op call triggers a biometric prompt.

Solution

Auto-detect the auth mode and configure accordingly:

ModeConditionBehavior
Tokenop signin --raw returns a tokenCache token in ~/.op-claude-session; wrapper passes --session flag
App Integrationop signin --raw returns empty + op whoami succeedsRecord mode in session file; wrapper calls op directly (IPC with desktop app)

Workflow

/op-session [--account <name>]
     │
     ▼
 op signin --raw
     │
     ├─ token non-empty ──► Token mode
     │                       Verify → write session file → done
     │
     └─ token empty ──► op whoami succeeds?
                          ├─ YES → App Integration mode
                          │        Write session file (no token) → done
                          └─ NO  → ERROR: signin failed

Usage

Initialize Session

bash skills/op-session/scripts/op-session-init.sh
# or with specific account
bash skills/op-session/scripts/op-session-init.sh --account my-team

List Available Accounts

bash skills/op-session/scripts/op-session-init.sh --list

Check Session Status

bash skills/op-session/scripts/op-session-init.sh --check

Clear Session

bash skills/op-session/scripts/op-session-init.sh --clear

Subsequent op Calls (Recommended)

Use the secure helper script — it handles mode detection, token loading, validation, and expiry:

bash skills/op-session/scripts/op-with-session.sh read "op://vault/item/field"
bash skills/op-session/scripts/op-with-session.sh item list --vault Production
bash skills/op-session/scripts/op-with-session.sh whoami

The helper:

  • Auto-detects auth mode from session file (OP_AUTH_MODE)
  • Token mode: passes --session and --account flags
  • App mode: passes only --account flag (auth via desktop app IPC)
  • Validates session before each call
  • Returns clear error if session is missing, expired, or app is locked

Session Lifecycle

EventToken ModeApp Integration Mode
Idle timeout30 min → expires10 min → expires (auto-refresh on use)
Each op callResets idle timerResets idle timer
Hard limit12hr12hr
1Password app locksDoes NOT revoke tokenNext op call fails until unlocked
/op-session --clearRemoves session fileRemoves session file

Session File Format

# Token mode
export OP_AUTH_MODE='token'
export OP_SESSION='<session-token>'
export OP_ACCOUNT='<account-id>'

# App Integration mode
export OP_AUTH_MODE='app'
export OP_SESSION=''
export OP_ACCOUNT='<account-id>'

Legacy session files (without OP_AUTH_MODE) are auto-detected as token mode if OP_SESSION is non-empty.

Security

AspectToken ModeApp Integration Mode
Token at rest~/.op-claude-session (owner-only via umask 077)No token stored
Process args--session $TOKEN visible to same-user processesNo --session flag
Auth controlToken possession = accessDesktop app biometric
ScopeAll vaults you can accessAll vaults you can access
Risk levelModerate (token on disk)Lower (no token on disk)
MitigationShort-lived token, --clear when doneApp auto-manages session

Known Limitations

LimitationCauseWorkaround
ls on home-dir paths blocked in ! context checksClaude Code sandbox may restrict ls/find to working directory in command template expansionUse test -f via bash -c wrapper; see skills/op-session/SKILL.md
allowed-tools cannot be narrowed to specific script paths${CLAUDE_PLUGIN_ROOT} unavailable in command markdown (#9354)Keep Bash(bash:*) until upstream fix
Context check is best-effort UISandbox policy may tightenAuthoritative status via bash skills/op-session/scripts/op-session-init.sh --check
App mode fails when desktop app is lockedCLI cannot IPC with locked appUnlock 1Password app, or run /op-session to reinitialize

Prerequisites

  • 1Password CLI (op) installed and configured
  • 1Password desktop app running (for initial biometric auth)
  • Account signed in to 1Password app