Pi Op
complete .env secrets handling replacement for agentic development within the Pi agent harness - secure secret injection, redaction, and vault browsing via the 1Password SDK
Install / Use
npx skills add p1rallels/pi-opInstalls into whichever agent you are using.
README
pi-op
1Password extension for Pi. macOS only.
Gives the agent access to 1Password secrets without ever exposing plaintext values. The agent can browse vaults, load secrets into the session environment, and run programs that use them — but never sees the actual secret values.
Why not the op CLI?
The op CLI works, but it has problems as an agent tool:
- Too much surface area. The CLI can create, update, delete vaults and items. The agent only needs to read.
- Shell injection risk. Shelling out to
opwith dynamic arguments is a vector. The SDK uses typed function calls. - Auth friction. The CLI uses interactive sessions or biometric prompts. The SDK uses a service account token — headless, no prompts.
- Secrets in tool output.
op readreturns plaintext to stdout, which goes straight back to the agent. This extension injects secrets intoprocess.envand redacts any leaked values from all tool output. - No redaction layer. The CLI has no concept of preventing the caller from seeing what it returns. This extension intercepts every tool result (bash, read, grep, etc.) and replaces known secret values with
[REDACTED]. - Slower. Every
opinvocation spawns a process. The SDK initializes once and resolves secrets via WASM in-process.
How it works
- A 1Password service account token is stored in the macOS Keychain (Secure Enclave-backed, never touches disk as plaintext).
- On startup, the extension pulls the token from Keychain and initializes the 1Password SDK.
op_loadresolvesop://secret references via the SDK and injects them intoprocess.env.- All subsequent bash calls inherit the secrets as regular environment variables.
- A global
tool_resulthook scans every tool's output for known secret values and replaces them with[REDACTED]. - On session switch or shutdown, secrets are cleared from
process.env.
Child processes (including nested Pi instances) automatically inherit the redaction map via __OP_LOADED_REFS — a JSON env var containing only the op:// reference metadata (not values). Any child Pi with this extension re-resolves the refs on startup and rebuilds its own redaction map.
Setup
1. Create a 1Password service account
Go to your 1Password account settings and create a service account with read access to the vaults you need. Copy the token.
2. Store the token in macOS Keychain
read -rs OP_TOKEN
# paste token, press enter
security add-generic-password -a "$USER" -s op-service-account -U -w "$OP_TOKEN"
unset OP_TOKEN
The token is now in Keychain, backed by Secure Enclave on Apple Silicon. No plaintext on disk, not in shell history.
3. Install the extension
# install dependencies
cd path/to/pi-op
npm install
# symlink into Pi's global extensions directory
ln -s "$(pwd)" ~/.pi/agent/extensions/op
4. Verify
Start Pi. You should see 1P: ready in the footer. Ask the agent to list your vaults:
list my 1password vaults
Tools
op_list
Browse vaults and items. Metadata only — never returns secret values.
- No params: list all vaults
vault: list items in a vault (by name or ID)vault+item: show item field structure (field names, types,op://refs — no values)
op_load
Resolve op:// references and inject into the session environment.
- Values starting with
op://are resolved from 1Password - Plain values pass through as-is
- Resolved values are set on
process.env— all bash calls inherit them - All tool output is scanned for leaked values and redacted
Security model
What the agent can see:
- Vault names, item names, field names/types (metadata)
op://reference URIs- Command output with secret values replaced by
[REDACTED]
What the agent cannot see:
- Resolved secret values (injected directly into
process.env, redacted from all output)
Known limitations:
- Secrets shorter than 4 characters are not redacted (too many false positives)
- Encoding transforms (base64, hex, reverse) bypass exact-match redaction
Requirements
- macOS (uses
securityCLI for Keychain access) - Node.js or Bun
- Pi
- 1Password service account with vault read access
Related Skills
node-connect
385.5kDiagnose OpenClaw Android, iOS, or macOS node pairing, QR/setup code, route, auth, and connection failures.
blender-python-addon
40.5kBlender Python add-on rules for operators, panels, properties, registration, testing, and API-safe scripting
flutter-development-guidelines-cursorrules-prompt-file
40.5kCursor rules for Flutter development with MVVM architecture, Riverpod state management, Material widgets, and Dart style guidelines.
commit-push-pr
140.7kCommit, push, and open a PR
