Migrate from Doppler to BotPassword

Setup guide

BotPassword guide: Migrate from Doppler to BotPassword.

Status: E-8 (ADR 0063). This runbook moves a repository’s environment variables off Doppler and onto BotPassword for local development, CI/CD, downstream secret pushing, and AI coding agents.

Unreviewed build notice — synthetic data only. Projects, environments, machine identities, and bpw run (not yet available in default builds) live behind the unreviewed org-collections-unreviewed feature until outside crypto sign-off (H-1, ADR 0064). While unreviewed, every collection and environment operation is locked to loopback servers and must use synthetic values only. Do not migrate real production credentials before H-1 sign-off and staging acceptance pass.

One architectural difference shapes every step below: the BotPassword control plane cannot decrypt environment values. Doppler’s servers hold plaintext and push to integrations on your behalf. BotPassword’s server stores ciphertext, verifies signed org-roster entries, and orders revisions; every decryption happens inside a BotPassword client that holds a key.

1. Prerequisites and org setup

Build the unreviewed bpw CLI and botpasswordd daemon binaries using the single guarded build entrypoint, and start the local control plane (see Get started for daemon setup and account creation):

sh scripts/unreviewed-collections.sh --build-bins
export PATH="$PWD/target/unreviewed-collections/cargo/debug:$PATH"

Create an account (bpw init) and start botpasswordd if you have not already. Every project belongs to an organization (ADR 0038, Organization web admin). A solo developer gets a personal org of one automatically when running bpw env init without --org; a team creates an org once and invites members:

# Owner creates the organization (prints org ID and BPO1 invite link)
bpw org create

# Each teammate generates their join code on their own device
bpw org join-code

# Owner invites each teammate with a role (owner, admin, member, auditor)
bpw org invite <ORG_ID> <JOIN_CODE> --role member

# Teammate accepts using the invite link and invitation ID
bpw org accept <BPO1_LINK> <INVITE_ID>

# Verify signed membership from genesis
bpw org members <ORG_ID>

Initialize a project in your repository root. By default, bpw env init creates dev, staging, and prod environments with separate collection keys and writes botpassword.toml:

bpw env init repackify-api --org <ORG_ID>

Each tier carries signed security properties:

Tier Default presence rule Default agent access Default writer roles
dev session (up to 8 hours, terminal-anchored) sealed owner, admin, member
staging every_run sealed owner, admin, member
prod every_run none owner, admin

Create additional environments with explicit signed push targets, stricter presence windows, or custom agent rules using bpw env create:

# Environment with signed downstream push targets
bpw env create staging_worker \
  --tier staging \
  --presence every_run \
  --agent-access none \
  --writer-role owner --writer-role admin \
  --push-target cloudflare-workers:<ACCOUNT_ID>/<WORKER_NAME> \
  --push-target github-actions:<OWNER>/<REPO>:env/staging

Create a personal branch environment (analogous to Doppler’s dev_alice) for local overrides. A branch inherits one level from its parent, takes the stricter of its own and its parent’s signed properties (so a branch of prod stays locked to prod rules), and can never be granted to a CI machine identity:

bpw env create dev_alice --branch dev

2. Import variables from Doppler and verify parity

Pipe Doppler’s export directly into bpw env import - over stdin so plaintext never touches disk. Preview the plan (names only, never values) with --dry-run first:

# Dry-run plan (prints variable names only)
doppler secrets download --no-file --format env --project <PROJECT> --config dev \
  | bpw env import - --env dev --format dotenv --dry-run

# Import into dev (JSON is also supported via --format json)
doppler secrets download --no-file --format env --project <PROJECT> --config dev \
  | bpw env import - --env dev --format dotenv

Repeat for staging and prod (updating --config and --env).

Handling ${...} references and loader variables

  • Secret references (${OTHER}): BotPassword v1 stores values literally and does not expand ${...} references, because reference expansion would allow one writer to alter another variable’s effective value. bpw env import lists any variables containing ${...} and refuses the import by default. Resolve Doppler references to concrete values before importing, or pass --literal if the ${...} text is intentionally literal.
  • Loader variables: Code-loading and execution-path variables enforced by Spec 09 section 3.2 — such as LD_*, DYLD_*, NODE_OPTIONS, BASH_ENV, ENV, GCONV_PATH, GIT_EXEC_PATH, GIT_SSH_COMMAND, IFS, JAVA_TOOL_OPTIONS, JDK_JAVA_OPTIONS, PATH, PERL5OPT, PYTHONPATH, PYTHONSTARTUP, RUBYOPT, ZDOTDIR, and _JAVA_OPTIONS — are refused unless an org owner explicitly opts in with --allow-loader-var.
  • Reserved prefixes: Variable names starting with BPW_ or BOTPASSWORD_ are always refused.

Check parity with bpw env diff

Verify that every imported environment matches Doppler before changing any script or workflow. bpw env diff compares names and domain-separated HMACs and prints names only (added, removed, changed, unchanged count):

doppler secrets download --no-file --format json --project <PROJECT> --config dev \
  | bpw env diff dev --against - --format json

# Compare two BotPassword environments directly
bpw env diff dev staging

Never commit plaintext .env files

Avoid exporting plaintext files whenever a tool can run under bpw run (not yet available in default builds; see section 3). For tools that require a file on disk, bpw env export asks for fresh presence every time, creates a new regular file with mode 0600, and refuses symlinks, FIFOs, /dev/*, tracked files, and non-gitignored paths inside a git repository:

# Refused if .env.local is tracked or not listed in .gitignore
bpw env export --env dev --format dotenv --out .env.local

# Other supported formats: json, shell, yaml (or --stdout behind fresh presence)
bpw env export --env dev --format json --out "$HOME/.config/<app>/dev-secrets.json"

3. Cut over local development

Commit botpassword.toml to the repository root. It contains only IDs and a default environment name — never values — and is strictly parsed (unknown keys, traversal paths, and duplicate [[path]] entries are refused). Run bpw env setup to write or update it, including monorepo subdirectories:

# Root project binding
bpw env setup --org <ORG_ID> --project <PROJECT_ID> --env dev

# Optional monorepo subdirectory override (adds a [[path]] table)
bpw env setup --org <ORG_ID> --project <PROJECT_ID> --env dev --path services/control-plane

Each developer can switch their local default for a directory without touching botpassword.toml (for example, to target a personal branch environment):

bpw env use dev_alice       # stored locally on this device, never committed
bpw env use --clear         # return to botpassword.toml's default_env

Day-to-day variable management commands (all gated behind human presence and refused inside agent sessions):

# Set a variable via stdin or hidden prompt (argv values like KEY=VAL are refused)
printf '%s\n' 'synth-local-value' | bpw env set API_BASE_URL --env dev --stdin

# Mark an API token sealable for agent egress proxy injection
printf '%s\n' 'synth-cf-token-0001' | bpw env set CF_API_TOKEN --env dev --stdin \
  --seal-host api.cloudflare.com

# Inspect metadata and history (never prints secret values)
bpw env list --env dev
bpw env history API_BASE_URL --env dev

# Read one value behind fresh presence, or remove a variable with a signed tombstone
bpw env get API_BASE_URL --env dev -n
bpw env unset OLD_FLAG --env dev

Replace doppler run -- ... with bpw run -- ... in your local scripts and package.json. (bpw run is not yet available in default builds; it requires the unreviewed collections build until H-1 crypto sign-off.)

# Run with default environment from botpassword.toml or `bpw env use`
bpw run -- pnpm dev

# Override environment or restrict injected variables
bpw run --env staging --only API_BASE_URL,CF_API_TOKEN -- pnpm test

# Overwrite variables already set in the calling shell (refused by default)
bpw run --env dev --allow-shadow -- pnpm dev

How bpw run behaves in local development (not yet available in default builds until H-1 sign-off):

  • Terminal-anchored sessions vs. every-run presence: dev opens a run session anchored to your terminal’s shell process tree (up to 8 hours by default). Any variable edit or bpw lock invalidates it immediately. staging and prod require fresh master-password presence on every run.
  • Changed-names summary: Before spawning the child, the runner prints a one-line stderr summary with variable names that changed since your last run on that environment (never values), plus sets BOTPASSWORD_PROJECT and BOTPASSWORD_ENVIRONMENT in the child environment.
  • No-shadow protection: If a variable from the environment already exists in your shell, the command refuses and lists the conflicting names unless you pass --allow-shadow.
  • Agent and detached-process refusal: Local runs refuse callers inside a bpw agent run session, callers with a known AI coding harness (claude, codex, cursor, gemini, aider, and others in agent-policy) anywhere in process ancestry, and callers detached via setsid without a controlling terminal.
  • Stated residual risk (ADR 0063 section 4): An unlisted harness started inside a terminal that already holds an open dev run session can read dev until that session expires or is locked. Tighten --presence-window or set --presence every_run on any environment where that residual risk is unacceptable.

4. Cut over CI/CD with machine identities

CI runners, deploy pipelines, and headless servers use machine identities instead of Doppler service tokens or a person’s master password.

First, publish a fresh signed head checkpoint from an unlocked org device so headless machines can verify against rollback:

bpw env checkpoint --env staging

Create one read-only machine identity per pipeline and environment. Only an org owner can create a machine identity for a prod environment:

bpw machine create \
  --env staging \
  --label "github: repackify/api staging" \
  --mode read \
  --expires-in 90

bpw machine create prints a one-time BPM1-... token. Store it in your CI secret store as BOTPASSWORD_TOKEN (for example, in a protected GitHub Actions environment secret) in place of DOPPLER_TOKEN.

Headless execution (BOTPASSWORD_TOKEN)

When BOTPASSWORD_TOKEN is set, bpw run (not yet available in default builds until H-1 sign-off) and bpw env export run headlessly with no local daemon or vault store:

BOTPASSWORD_TOKEN="$BOTPASSWORD_TOKEN" bpw run --env staging -- pnpm run deploy:staging

During headless startup, bpw:

  1. Verifies the signed org roster from genesis against the root fingerprint pinned inside BPM1-... (ignoring any untrusted edits in botpassword.toml).
  2. Checks that the machine is active and unexpired.
  3. Authenticates to the control plane with a request signed by the machine’s Ed25519 key.
  4. Verifies every revision signature, op uniqueness, and the environment’s Purpose-7 signed head checkpoint against max_checkpoint_age_secs (30 days by default). Pass --fallback only when you explicitly want to accept a stale checkpoint with a warning during an outage.
  5. Unwraps the collection key, decrypts the variables in memory, strips BOTPASSWORD_TOKEN from the child process environment, and spawns the command.

CI trust boundary: Every step inside a CI job runs as the same OS user. Any code executed during the job — including tests, postinstall scripts, or a CI-hosted coding agent — can read variables decrypted for that job. Machine tokens do not provide placeholder sealing. Keep each machine scoped to a single environment, read-only, and time-limited.

GitHub Actions workflow (botpassword/run)

Use the composite action in .github/actions/run pinned to a full 40-character commit SHA. Always pass BOTPASSWORD_TOKEN in the step’s env: block, never as an action input (bpw run is not yet available in default release archives until H-1 sign-off, so set install: "false" when using a pre-built unreviewed binary during staging trials):

steps:
  - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
    with:
      persist-credentials: false

  - uses: botpassword/botpassword/.github/actions/run@<40-char-commit-sha>
    env:
      BOTPASSWORD_TOKEN: ${{ secrets.BOTPASSWORD_TOKEN }}
    with:
      install: "false"
      env: "staging"
      command: "pnpm"
      args: "run deploy:staging"

5. Push secrets to downstream providers (bpw env push)

Because BotPassword’s server holds only ciphertext, downstream sync runs from an authorized client or CI workflow via bpw env push. Supported providers and canonical target strings:

Provider Canonical --target format
GitHub Actions (repo) github-actions:<owner>/<repo>
GitHub Actions (environment) github-actions:<owner>/<repo>:env/<name>
Cloudflare Workers cloudflare-workers:<account_id>/<script_name>
Vercel vercel:<project_id>/<development|preview|production> or vercel:<team_id>/<project_id>/<target>
Convex convex:<deployment>

Every destination must first be listed in the environment’s signed push_targets property (set via bpw env create --push-target ...). bpw env push refuses any unsigned target before reading a provider token or making any HTTP call — so a pull request that edits a workflow to push prod secrets to another repository or account is refused locally.

By default, bpw env push runs a dry-run plan (names only, never values). Pass --apply to push, and pass --prune only when you explicitly want to delete unmanaged remote secrets:

# Dry-run plan (reads provider token from an env var; argv tokens are refused)
bpw env push \
  --env staging_worker \
  --target cloudflare-workers:<ACCOUNT_ID>/<WORKER_NAME> \
  --token-env CLOUDFLARE_API_TOKEN

# Apply the plan (add --prune to remove remote variables absent from BotPassword)
bpw env push \
  --env staging_worker \
  --target cloudflare-workers:<ACCOUNT_ID>/<WORKER_NAME> \
  --token-env CLOUDFLARE_API_TOKEN \
  --apply

You can also pipe a provider token over stdin with --token-stdin. bpw env push refuses BOTPASSWORD_TOKEN and any BPM1- token as a provider API token so a machine credential is never sent to a third-party API.

Known difference from Doppler: BotPassword does not run live server-side sync or change webhooks. If you want downstream providers updated on a cadence, run bpw env push --apply from a scheduled or manually dispatched CI workflow.

6. Grant environments to AI coding agents

Agents use environments through explicit grants evaluated by agent_policy::evaluate, never through bpw run (not yet available in default builds until H-1 sign-off). See Use BotPassword from Claude Code for harness installation and session setup.

  1. Mark sealable variables: When storing an HTTP API token in dev, attach --seal-host (and optionally --seal-header / --seal-prefix) so BotPassword’s per-run egress proxy can inject it as a bpw_ph_... placeholder and swap the real value only in outbound HTTPS requests to the signed hosts:

    printf '%s\n' 'synth-cf-token-0001' | bpw env set CF_API_TOKEN --env dev --stdin \
      --seal-host api.cloudflare.com
  2. Understand dev, staging, and prod: dev and staging default to agent_access=sealed (you can tighten staging to --agent-access none at creation time). Variables without --seal-host (such as a local database DSN) are unsealable and cannot be delivered under a sealed grant; select only sealable variables with --only, or opt into disclosing delivery explicitly on a disclosing environment. Environments marked prod (agent_access=none) refuse both bpw grant add --env and request_access.

  3. Grant directly or approve request_access:

    # Option A: grant sealed access to specific variable(s) in dev
    bpw grant add \
      --env <ORG_ID>:<DEV_ENV_ID> \
      --only CF_API_TOKEN \
      --intent run_with \
      --argv "/bin/sh scripts/check-api.sh" \
      --project "$PWD"
    
    # Option B: inside `bpw agent run`, the agent asks for access via CLI or MCP
    bpw agent request_access \
      --env <ORG_ID>:<DEV_ENV_ID> \
      --only CF_API_TOKEN \
      --intent run_with \
      --reason "Run synthetic API smoke check" \
      --argv "/bin/sh scripts/check-api.sh"
    
    # Person reviews variable names and signed hosts (never values) and approves
    bpw access list
    bpw access approve <REQUEST_ID>
  4. Run under the grant: Inside an active bpw agent run session, the agent invokes run_with (CLI or MCP):

    bpw agent run_with \
      --env <ORG_ID>:<DEV_ENV_ID> \
      --only CF_API_TOKEN \
      -- /bin/sh scripts/check-api.sh

    Under a sealed grant, the child receives a bpw_ph_... placeholder plus HTTPS_PROXY and SSL_CERT_FILE pointing at the per-run loopback proxy; requests to unlisted hosts are refused. For unsealable local test values on an environment configured with --agent-access disclosing, an explicit --allow-disclosure grant and --disclose flag label delivery as disclosing and apply best-effort output redaction.

7. Run a machine revocation drill

Before cutting over a repository, rehearse revoking a CI machine identity:

# List active machine identities (metadata only; tokens are never shown again)
bpw machine list --env staging

# Revoke the machine: atomically appends RemoveMachine + Rekey and lists variables to rotate
bpw machine revoke <MACHINE_ID> --env staging

Verify three outcomes:

  1. bpw machine revoke reports rekeyed=true, prints the incremented key_epoch, and prints the sorted list of variable names the machine had read access to.
  2. Re-running headless bpw run (not yet available in default builds until H-1 sign-off) with the revoked BPM1-... token fails on its very next request.
  3. Rotate every listed secret at its upstream provider (for providers with API rotation adapters, rotate is partly built via bpw rotate configure and bpw rotate start).

8. Parallel soak period and rollback

Never delete a Doppler project on day one. Run a 7-day parallel soak per repository:

  1. Pause Doppler sync: Disable automatic Doppler integrations (GitHub Actions, Cloudflare, Vercel, Convex) so BotPassword is the sole writer pushing downstream secrets, while keeping the Doppler project read-only as a fallback.
  2. Verify parity daily: Run doppler secrets download --no-file --format json | bpw env diff <env> --against - --format json for dev, staging, and prod whenever a variable changes during the soak.
  3. Verify all four paths: Confirm local developer bpw run (not yet available in default builds until H-1 sign-off), CI headless BOTPASSWORD_TOKEN jobs, bpw env push --apply downstream deploys, and agent sealed run_with runs all stay green for a full week.
  4. Rollback procedure (if anything breaks during soak):
    • Re-enable the paused Doppler integration sync for the affected environment.
    • Restore the DOPPLER_TOKEN secret in CI workflows and revert the workflow step back to doppler run.
    • Revert local script wrappers in package.json back to doppler run (botpassword.toml can remain harmlessly or be removed).
    • Investigate the failure via bpw env history, bpw access ledger, and bpw machine list before retrying.
  5. Decommission Doppler: Once the 7-day soak completes with zero discrepancies and all five steps of ADR 0063 section 10 have passed on staging, revoke Doppler service tokens and archive the Doppler project.