Every agent's branch gets its own dev server and port, reloading as the agent codes. Access them via private link from a browser or your phone.
Ask me about each of these, one at a time, with a suggested default: - Branches (the branches to preview) - Machine (your dev box or another remote machine to run them on) - Checkout (the repo's folder on that machine, if it has one) - Dev server command (check package.json, e.g. npm run dev) Skip any I've answered. Then sum up the plan in three bullets and wait for my go. My answers override the steps below. If a wait times out, wait again, up to three times. Run a dev server for each branch on a remote bb machine, and share each one at its own getbb.app link. Guide: https://getbb.app/guides/remote-dev-servers If a step fails, stop and tell me what you saw. Don't open firewall ports, send localhost links, or share ports I didn't ask for. Leave work in progress alone: don't stash, reset, or switch branches in any folder. 1. Check what's needed first. If `bb connect status` shows remote access off, ask me to turn on bb connect in Settings. If `bb machine list` doesn't show the machine, run `bb terminal create --thread "$BB_THREAD_ID" --title "Add machine" --command "bb machine create --provider manual"`, take the install command from `bb terminal output <terminal-id>`, and run it on the machine over SSH, or send it to me if you can't reach it. If the machine is a container dev environment without systemd, like Codespaces, Coder, Ona, Cloud Workstations, or an in-house container, tell me to raise its idle timeout and to add `curl -sSL <my bb address>/install.sh | sh -s -- --start --host-id <machine-id>` to its startup script, so bb comes back when it restarts. 2. Each server runs from what's committed on its branch. If a branch I named has uncommitted or unpushed changes, here or in my checkout, tell me and ask whether to commit and push them first or skip that branch. 3. If `bb project show "$BB_PROJECT_ID"` has no source on the machine, run `bb project source add "$BB_PROJECT_ID" --path <checkout> --machine <machine>` for my existing checkout, or `bb project source add "$BB_PROJECT_ID" --clone --machine <machine>` if there isn't one. 4. For each branch, start a thread on the machine that starts its own server, all at once: bb thread spawn --json --project "$BB_PROJECT_ID" --machine <machine> --new-environment worktree --base-branch <origin/branch, or the local branch if there's no remote> --title "<branch>" --prompt "Install dependencies if they're missing, then start this branch's dev server. Pick a free port, save it as WEB_PORT in .env.local (don't commit it), and run <dev server command> with HOST=127.0.0.1 and PORT set to that port in a bb terminal titled Dev server. Don't change the app's code. Reply with the port once it's listening, or with the error." 5. Wait for each thread with `bb thread wait` and read its port with `bb thread output`. 6. Share each port with `bb connect expose <port> --host <machine>`, and check that `bb connect shares --host <machine>` lists them all. Reply with a table of branch, port, and link. Then offer to save these steps as a bb skill in .bb/skills/preview-branches/SKILL.md, with my machine and dev server command filled in, so next time I can just ask for it.
Run servers on a dev box, a remote machine you already develop on. bb keeps it connected through reboots and updates.
gh auth login so they can push and open pull requests.Point bb at the checkout already on your dev box, and give every branch its own ports.
Then commit a setup script at the repo root. bb runs it in every new worktree, so each branch installs its dependencies and picks free ports. Here's an example for a pnpm project; change the install command and ports to fit yours:
#!/usr/bin/env bash
set -euo pipefail
pnpm install
free_port() { node -e 'const s=require("net").createServer().listen(0,"127.0.0.1",()=>{console.log(s.address().port);s.close()})'; }
printf 'WEB_PORT=%s\nAPI_PORT=%s\n' "$(free_port)" "$(free_port)" > .env.localEach thread gets its own worktree on the machine, so servers never step on each other.
A bb terminal runs in the thread's worktree and keeps going after you close the tab.
$ set -a; . ./.env.local; set +a $ pnpm dev --host 127.0.0.1 --port "$WEB_PORT"
Or ask the thread's agent to start it for you.
bb connect gives each port a private getbb.app link, and live reload works through it.
Share port 3001 on this machine with bb connect and give me the link.
It replies with a link like https://my-server--3001.getbb.app. Every link is listed under Shared ports in Settings → bb connect, where you can copy it or stop sharing when the branch is done. Open each link on your phone to check its branch.
127.0.0.1, so a server on 127.0.0.1 or 0.0.0.0 works. If it only listens on ::1, start it on 127.0.0.1 at the same port..bb-env-setup.sh from step 2, so each new worktree picks its own free ports..env.local, not a hard-coded one..worktreeinclude file at the repo root, one pattern per line.https://my-server--3001.getbb.app, as your app's base URL.bb connect drops cookies that set a Domain attribute or are named better-auth.* or bb-connect.*. Use host-only cookies with other names.
Yes. bb connect passes WebSockets through, so hot reload works as it does on localhost.
Only you, signed in to your getbb.app account, and devices you've paired. They aren't public, so webhooks and other services can't call them. To shut off access, open Settings → bb connect and choose Turn off, or choose Disconnect on that bb in your getbb.app dashboard.
Yes. Your machines connect out to bb, so you don't open any ports. If your work keeps dev servers on a private network, skip the shared links and open each server over your VPN or tailnet instead.
No. Shared links only open for your getbb.app account, and bb is built for one person.
Your repo, the tools it builds with, and any .env files. List untracked files every branch needs in a .worktreeinclude, and bb copies them from your checkout into each new worktree. bb's install command adds what bb needs.
Yes. Agents work in their own worktrees, so your checkout, editor, and terminals stay as they are.
postStartCommand, with the machine ID from bb machine list: curl -sSL https://<you>.getbb.app/install.sh | sh -s -- --start --host-id <machine-id>bb can run machines in your own Modal account. Install the Modal Sandbox plugin, then pick Modal Sandbox as the machine when you start a new thread.
The built-in Concurrency limit plugin does this by default: each machine runs one thread per processor, and new turns wait until a running thread finishes. To change a machine's limit, open Settings → Concurrency limit.
The dev server and other terminals stop after the 30-second undo window. Five minutes later, bb removes the worktree if no other thread uses it. The branch is kept. Commit a .bb-env-teardown.sh to clean up anything outside the worktree, like Docker containers.
bb is free and open source, and bb connect is free. bb runs your agents on the subscriptions or API keys you already have. Machines you add cost what they do now.
Free and open source. Bring the machines and AI plans you already have.