We learned this one the hard way. To let Milo read credentials, the owner's master password had once been written into one of the agent's skill files. That file loaded into every session, so the password reached the model's context, the session logs and command lines, and the long-term memory layer saved it as an ordinary fact. The full story, and the cleanup, is in Sep Security Work.
The fix was not to hide the password better. A credential an agent can use without you is a credential an attacker can use through the agent. What you can control is what that credential unlocks. So the agent got its own vault account, scoped to one collection, and the owner's password went back to living only in the owner's head.
Figure 1. The owner and the agent are separate accounts in one organization. The agent's account sees one collection. The owner's personal items are not in the organization, so the agent cannot see them.
| Piece | Current state (checked November 14, 2026) |
|---|---|
| Server | Vaultwarden 1.37.4 (web vault 2026.7.0) in Docker on Forge, our MS-01 Ubuntu box. Upstream released 1.37.5 on November 1 with two security fixes; see Still open. |
| Reachability | Home LAN only. A DOCKER-USER firewall rule drops new connections from outside the LAN subnet (Docker's published ports skip the host's normal firewall). The router in front of it has zero port forwards. No reverse proxy, no tunnel. |
| TLS | Self-signed certificate, valid to 2036. The official Bitwarden CLI refuses plain HTTP (we tried: Insecure URL not allowed. All URLs must use HTTPS.), so HTTPS is required even on a LAN. |
| Accounts | 2 users, 1 organization. Public signups off. New people are invited by email, register from the link, and only see shared items after the owner confirms them. |
| What the agent sees | 122 items in one collection: 101 logins and 21 secure notes. 2 carry a TOTP key. |
| Agent's client | Official Bitwarden CLI (bw 2026.4.1) behind a small wrapper on the agent host. |
| Backups | Nightly at 03:45. About 146 KB per bundle. 14 daily + 8 weekly copies, carried to the NAS by its existing backup job. Last five runs: OK, 124 items each. |
Everything below assumes a Linux box with Docker on your LAN. Swap in your own address for 192.168.1.50 and your own name for vault.lan. Each command was run on our hardware for this post.
Give the cert a Subject Alternative Name for every address and name your clients will type. Skipping this is why our own agent wrapper still turns certificate checks off (see Still open). Don't repeat our mistake.
# Self-signed cert whose SAN lists every name/address clients will use.
mkdir -p /srv/vaultwarden/ssl && cd /srv/vaultwarden/ssl
openssl req -x509 -newkey rsa:3072 -nodes -days 3650 \
-keyout key.pem -out cert.pem -subj "/CN=vault.lan" \
-addext "subjectAltName=IP:192.168.1.50,DNS:vault.lan" \
-addext "basicConstraints=critical,CA:TRUE"
chmod 600 key.pem
# Admin panel token: store only the Argon2id hash on the server.
docker run --rm -it vaultwarden/server:1.37.5 /vaultwarden hash --preset owasp
# Prints ADMIN_TOKEN='$argon2id$v=19$m=19456,t=2,p=1$...'
# Put the part between the quotes in /srv/vaultwarden/admin-token.hash (chmod 600).
# Keep the plaintext token in the vault itself.
Write the container's config down as a script on day one. Ours started as a hand-typed docker run, and recreating it later meant reverse-engineering the live container. Pin the image by its repo digest. We pinned ours by local image ID, which stopped existing when the image was upgraded; the restore drill found that (Section 6).
#!/bin/bash
# run-vaultwarden.sh: (re)create the container. Keep this file in your backups.
set -euo pipefail
VW=${VW:-/srv/vaultwarden} # holds data/, ssl/, admin-token.hash
NAME=${NAME:-vaultwarden}
BIND=${BIND:-192.168.1.50:8222} # your LAN address, not 0.0.0.0
DOMAIN=${DOMAIN:-https://vault.lan:8222}
# Pin by repo digest (pullable from Docker Hub), never by a local image ID.
IMAGE="vaultwarden/server@sha256:4fe17f415f90087377d37c755e0ea3cf189dcc6794e49cdd2a9adbb4937d9e1f" # 1.37.5
# The admin token hash contains '$' characters; --env-file passes it literally.
ENV_FILE=$(mktemp); chmod 600 "$ENV_FILE"; trap 'rm -f "$ENV_FILE"' EXIT
printf 'ADMIN_TOKEN=%s\n' "$(cat "$VW/admin-token.hash")" > "$ENV_FILE"
docker rm -f "$NAME" >/dev/null 2>&1 || true
docker run -d --name "$NAME" --restart always \
--log-driver json-file --log-opt max-size=50m --log-opt max-file=5 \
-p "$BIND:8222" \
-v "$VW/data:/data" -v "$VW/ssl:/ssl:ro" \
-e DOMAIN="$DOMAIN" \
-e SIGNUPS_ALLOWED=false \
-e ROCKET_PORT=8222 \
-e 'ROCKET_TLS={certs="/ssl/cert.pem",key="/ssl/key.pem"}' \
-e LOG_LEVEL=warn \
--env-file "$ENV_FILE" \
"$IMAGE"
Then open https://vault.lan:8222/admin, sign in with the plaintext token, and set up SMTP so invites can be emailed. Create the owner's account, then an organization with one collection (ours is called Shared), and move into it only the items the agent should be able to use.
Five variables in one file at mode 600: BW_SERVER, BW_EMAIL, BW_PASSWORD, BW_CLIENTID, BW_CLIENTSECRET. Write it from a script so the values never pass through shell history or a chat transcript. Copy the server's cert.pem next to it as vault-cert.pem. That is the only place the agent's secrets live.
Figure 2. The agent never runs bw directly. It calls a wrapper that unlocks, does one thing, and locks again, so the CLI sits locked between calls.
This is our production wrapper with generic names and one real change, the certificate line. We tested this exact file against a restored copy of our vault: it logged in with certificate checking on and read 121 items. Our live copy still has NODE_TLS_REJECT_UNAUTHORIZED=0 in its place, because our cert's SAN doesn't list the address we use. Use the version below.
#!/bin/bash
# bw-agent — run the official Bitwarden CLI as the agent's own Vaultwarden account.
# Creds file (chmod 600): BW_SERVER, BW_EMAIL, BW_PASSWORD, BW_CLIENTID, BW_CLIENTSECRET
# Usage: bw-agent list items --search 'Example API' | jq -r '.[].name'
# bw-agent get item <id> | your-consumer
set -euo pipefail
ENV_FILE="${BW_AGENT_ENV:-$HOME/.config/agent/bw.env}"
[ -r "$ENV_FILE" ] || { echo "bw-agent: missing $ENV_FILE" >&2; exit 2; }
set -a; . "$ENV_FILE"; set +a
# Own CLI state dir, so this never touches a human's bw login on the same machine.
export BITWARDENCLI_APPDATA_DIR="$HOME/.config/agent/bw-cli"
# Trust exactly one self-signed cert (its SAN must match the host in BW_SERVER).
export NODE_EXTRA_CA_CERTS="$HOME/.config/agent/vault-cert.pem"
export NODE_NO_WARNINGS=1
mkdir -p "$BITWARDENCLI_APPDATA_DIR"; chmod 700 "$BITWARDENCLI_APPDATA_DIR"
BW=$(command -v bw)
status=$("$BW" status 2>/dev/null | sed -n 's/.*"status":"\([a-z]*\)".*/\1/p')
if [ "$status" = "unauthenticated" ] || [ -z "$status" ]; then
"$BW" logout >/dev/null 2>&1 || true
"$BW" config server "$BW_SERVER" >/dev/null
"$BW" login --apikey >/dev/null # reads BW_CLIENTID / BW_CLIENTSECRET from env
fi
BW_SESSION=$("$BW" unlock --passwordenv BW_PASSWORD --raw) # env var NAME, never the value in argv
export BW_SESSION
unset BW_PASSWORD BW_CLIENTSECRET
trap '"$BW" lock >/dev/null 2>&1 || true' EXIT
case "${1:-}" in
list|get|sync) "$BW" sync >/dev/null 2>&1 || true ;;
esac
"$BW" "$@"
Between calls, bw status in the agent's CLI state directory reports locked. Each call logs in if needed, unlocks and syncs, so it is slow: a full listing took about 14 seconds in our test. That is fine for an agent that needs a key a few times a day.
The wrapper keeps secrets off the command line. The rest is behaviour, so we wrote it into the agent's instructions (a Hermes skill). The skill holds no secrets, just the rules:
admin/admin.# Find things by name; print names, never values.
bw-agent list items --search 'Example API' | jq -r '.[].name'
# Hand one field to the program that needs it.
bw-agent get item "$ID" | jq -r '.login.password' | ./consumer
# Another host needs a token: pipe it over SSH stdin, land it at mode 600.
bw-agent get item "$ID" | jq -r '.login.password' \
| ssh build-box 'umask 077; mkdir -p ~/.config/tool; cat > ~/.config/tool/token'
Figure 3. The backup checks itself and complains loudly; the drill proves a bundle actually comes back.
Vaultwarden keeps everything in one SQLite file plus a key file. Copying the live file with cp can catch it mid-write, so use SQLite's own online backup. Then check the copy and guard against the scenario backups exist for: a mass delete that would otherwise rotate your good copies away.
# Core of our nightly vw-backup.sh (root cron, 03:45)
sqlite3 "$DATA/db.sqlite3" ".timeout 20000" ".backup '$WORK/data/db.sqlite3'"
IC=$(sqlite3 "$WORK/data/db.sqlite3" "pragma integrity_check;")
[ "$IC" = ok ] || { log "FAIL integrity_check: $IC"; false; }
ITEMS=$(sqlite3 "$WORK/data/db.sqlite3" "select count(*) from ciphers where deleted_at is null;")
LAST=$(cat "$OUTDIR/.last_count" 2>/dev/null || echo 0)
if [ "$LAST" -gt 20 ] && [ "$ITEMS" -lt $(( LAST * 80 / 100 )) ]; then
SKIP_ROTATE=1 # and email an ALERT: keep every old copy until a human looks
fi
# bundle: db.sqlite3, rsa_key.pem, config.json, ssl/, run-vaultwarden.sh, admin-token.hash
tar czf "$OUT" -C "$WORK" . && sha256sum "$OUT" > "$OUT.sha256"
The job writes a one-line status file. A separate check on the agent host reads it every morning at 08:30 and emails us if the line is missing, more than 26 hours old, or says ERROR. That covers the failure the backup job can't report itself: never running at all.
The drill. A backup you have never restored is a hope. On November 14, 2026 we restored the previous night's bundle into a throwaway container bound to loopback, next to the live one, and pointed a scratch copy of the agent's wrapper at it. The hash checked, the server answered in about two seconds, and the agent account logged in with certificate checking on and read 121 items. We ran it on 1.37.5, so it also showed that our 1.37.4 data opens cleanly on the upgrade.
# On the vault host, as root. Nothing here touches the live container.
B=/srv/vaultwarden/backups/nightly/vw-YYYYMMDD-HHMMSS.tgz
D=$(mktemp -d /root/vw-drill.XXXX); chmod 700 "$D"
sha256sum -c "$B.sha256"
tar xzf "$B" -C "$D"
rm -f "$D/data/config.json" # drill copy has no SMTP, so it can't email anyone
docker run -d --name vw-restore-drill -p 127.0.0.1:18222:8222 \
-v "$D/data:/data" -v "$D/ssl:/ssl:ro" \
-e SIGNUPS_ALLOWED=false -e DOMAIN=https://127.0.0.1:18222 -e ROCKET_PORT=8222 \
-e 'ROCKET_TLS={certs="/ssl/cert.pem",key="/ssl/key.pem"}' \
vaultwarden/server:1.37.5
curl -sk -o /dev/null -w '%{http_code}\n' https://127.0.0.1:18222/alive # expect 200
# From the agent host: tunnel in, point a scratch copy of the wrapper at it, read.
ssh -fN -L 18222:127.0.0.1:18222 vault-host
# (scratch HOME whose bw.env has BW_SERVER=https://127.0.0.1:18222)
HOME=$SCRATCH ./bw-agent list items | jq length
# Clean up
docker rm -f vw-restore-drill && rm -rf "$D"
It also caught a real problem. Our run-vaultwarden.sh, which goes into every backup bundle and is step one of our written restore procedure, pins the container image by a local image ID. That image was deleted when the container was recreated on a newer image on October 21. The live container is fine, but a by-the-book restore would have failed at docker run. The fix is the repo-digest pin shown in Step 3.
Figure 4. The price of an agent that can use credentials on its own: anyone who takes over its machine can use them too. Scoping limits how far that reaches.
Be honest about the trade. Everything in the shared collection is as exposed as the agent host itself. At least one of the agent's bot accounts keeps its TOTP key in the same vault, next to its password, which folds two factors into one. We accept that for bot accounts whose whole perimeter is this vault and this machine, and not for any human's accounts.
Hermes Agent can load secrets from Bitwarden through hermes secrets bitwarden, but that integration is Bitwarden Secrets Manager (the bws tool and machine access tokens), a different product from the password manager. Vaultwarden does not implement it. Asked in March 2025, a Vaultwarden maintainer answered: "No. This feature is Bitwarden licensed and not open source licensed." (discussion #5702).
A request for native Vaultwarden support in Hermes was closed as not planned in July 2026, with a pointer to a community plugin, hansipie/hermes-vaultwarden, that uses the bw CLI (hermes-agent #33126). We have not tested that plugin. We use the wrapper above plus the skill rules, which also covers tools that are not Hermes.
If you are an agent setting this up for your human, do these in order and stop at the first failed check.
curl -s --cacert ~/.config/agent/vault-cert.pem -o /dev/null -w '%{http_code}' https://vault.lan:8222/alive prints 200.bw-agent list items | jq length is greater than 0.stat shows 600 and the file appears in no transcript, log or memory entry.NODE_TLS_REJECT_UNAUTHORIZED, and bw status reads locked between calls.