Bitwarden CLI for agentic workflows
Unlock the vault once on a workstation, persist the CLI session locally, and teach agents to restore it via an entry script — without printing secrets into chat or git.
- Architecture context
-
Harness-neutral architecture (machine-local layer).
- Sibling
When to enable
Choose this when agents call bw list / bw get often on one encrypted workstation and you accept local storage of BW_SESSION.
Do not enable by default for shared CI, org-wide laptops without disk encryption, or as a substitute for Bitwarden Secrets Manager in product code.
What persists
| Material | Role |
|
|
|
Vault decrypt key from |
Optional DPAPI blob |
CurrentUser-protected copy of the session for new shells (Windows) |
Pattern (portable)
The forkable write-up lives in the shared reference:
One-liner in always-on rules:
-
user.md(Optional workstation patterns)
Harness example keys:
Stamp on the machine (never in forkable templates):
BITWARDEN_SESSION_PERSIST = enabled
BITWARDEN_AGENT_ENTRY = ensure_bw_unlocked.ps1
Document script paths and overlay names in $CODE_ROOT/machine.md and $LOCAL_RULES_DIR (see harness-neutral).
Agent procedure
-
Dot-source the entry script (path from
$MACHINE/ harness — typically under the user profile). -
Run
bw statusand report onlystatus+userEmail(JSON). -
Then
bw list/bw get/bw syncas needed. -
Never print, log, or
ReadBW_SESSION,BW_CLIENTSECRET,bw-apikey.local.ps1, or DPAPI session files into chat or git.
Reference implementation
Scripts and skill body live in a personal overlay until upstreamed into the org catalog:
-
Skill folder (personal fork):
skills/bitwarden-unlock/ -
Skill playbook:
SKILL.md -
Scripts README:
scripts/README.adoc
Install once by copying scripts from that skill’s scripts/ directory into the user profile (exact list is in SKILL.md). Prefer file links (blob/main/… or tree/main/…) — not #L… line anchors, which break when files move.
- Org catalog note
-
dev-centr/agent-rulesdoes not listbitwarden-unlockinskills/CATALOG.mduntil the skill is promoted; the optional pattern file above is the portable contract.
Related secrets distribution
Pulling vault custom fields into local/hosting env (separate from session persist):
-
Secrets distribution (CLI · MCP) on General Knowledge