Operate SwB
Retry a routine wake
Run swb routine wake HANDLE on the SwB host as the user that runs SwB. Replace HANDLE with the ID of a delivered mailbox message. SwB keeps the message and skips a wake that already succeeded.
Backups and upgrades
Run swb backup while SwB runs or after it stops. The command saves a private archive in the data folder under backups. An archive is one file that holds a group of files. Use --out to set its path.
The archive holds a copy of the database, its key files and the local Git copy of your memory. The key files include block-secrets-key, claim-key and mcp-events.key. Keep the archive private.
Add --include-env to save the instance config and .env in the archive. These files can contain your owner key. Save platform variables and any extra config files separately.
Local install
Use the same instance folder as swb up. Stop SwB before you restore.
swb backup --dir ./my-swb --out ./swb-backup.tar.gz
swb restore ./swb-backup.tar.gz --dir ./my-swb --forceSwB checks each file before it restores the archive. Use --force to replace an existing database. Use the same SwB major version or a newer one.
Docker Compose
Run the backup in the container. Find the archive in ./data/backups on the host.
docker compose exec switchboard swb backup --out /data/backups/swb-backup.tar.gzStop the service. Run the restore in a separate container, then start the service.
docker compose stop switchboard
docker compose run --rm switchboard swb restore /data/backups/swb-backup.tar.gz --force
docker compose up -d switchboardFly.io, Render and Railway
Connect to the running service. Use the Fly.io console or the Render or Railway shell.
| Platform | Open the shell |
|---|---|
| Fly.io | fly ssh console -a my-swb -u switchboard |
| Render | Open Shell for the SwB service. |
| Railway | Run railway ssh from the linked project. |
Run the backup as the user that runs SwB. In a root shell, run su -s /bin/sh switchboard first. Copy the archive to a private location.
swb backup --out /data/backups/swb-backup.tar.gzFor restore, upload the archive to the volume as /data/backups/swb-restore.pending.tar.gz. Use a temporary start command to restore before SwB starts.
| Platform | Set the temporary command |
|---|---|
| Fly.io | Set the command for the machine that holds the volume. |
| Render | Set Docker Command on the SwB service. |
| Railway | Set Start Command on the SwB service. |
Use the switchboard account to upload the archive and run the restore.
sh -c '
run() {
if test "$(id -u)" = 0; then
exec setpriv --reuid=switchboard --regid=switchboard --init-groups -- "$@"
fi
exec "$@"
}
file=/data/backups/swb-restore.pending.tar.gz
if test -f "$file"; then
(run swb restore "$file" --force) &&
mv "$file" /data/backups/swb-restore.done.tar.gz || exit 1
fi
run swb serve
'Set the start command back after SwB starts.
Upgrade or move to a new host
Make an archive before you upgrade. Start the new SwB version with the same data folder. Find the automatic database copies in backups/auto. SwB keeps the three newest copies of each database.
To move hosts, stop the old SwB service and make a final archive. Copy the archive to the new host. Install SwB and set the data folder and platform variables for that host.
Restore into the new data folder. Use the same --dir option when you start SwB. Check the data folder and public address in the config before you start SwB.
swb restore ./swb-backup.tar.gz --dir ./new-swb
swb up --dir ./new-swbChange the address
Start SwB 1.0.1 or later at the old address before you move. This records the address. Set SWB_PUBLIC_URL to the new address. If your config contains public_url, update it to match. Start SwB with the same data folder.
If you move during the upgrade, add the old address to public_url_aliases while you control that address.
SwB accepts OAuth credentials for addresses it recorded at startup. When an app renews an OAuth token from a retired address, SwB issues a token for the current address. SwB keeps its saved data, agent keys and companion keys.
Run swb status to see which connections to check. You can also ask an agent with owner access to call switchboard_status at the new address.
| Connection | What to change |
|---|---|
| Claude, ChatGPT, Grok and other MCP apps | Update the SwB connector address to the new address with /mcp. Approve a new sign-in if the app asks. |
| Muse | Update the SwB connector. Ask Muse to replace its wake link. |
| Incoming webhooks | Get the new URL from webhook_list. Paste it into the app that sends the webhook. Keep its existing secret. |
| Claude and Grok routines | Update any old SwB address in the routine prompt. Check that each routine uses the updated connector. |
| Companions | Stop the companion. Change only url in its private companion.json file. Start the companion again. |
Find companion.json in ~/.config/swb on Linux or macOS and in %APPDATA%\swb on Windows. If you set SWB_COMPANION_HOME, use that folder.
Open the new SwB address to sign in. Register a new passkey if the old passkey belongs to a different host.
Start SwB at sign-in
Install SwB with uv tool install swb.one or pipx install swb-one. Stop the SwB process for this instance. Run swb service install from the folder you use for swb up. Use --dir DIR if you use that option with swb up.
Add --tunnel cloudflare or --tunnel tailscale to start the tunnel with SwB. The service reads .env from the instance folder.
| Command | Use |
|---|---|
swb service status | Check the service state |
swb service logs | Read recent service logs |
swb service stop | Stop SwB for this session |
swb service start | Start the installed service |
swb service uninstall | Stop the service and remove automatic start |
Trace a message
Run swb trace HANDLE with the handle from a send or inbox item. Check the route and delivery results. Use the owner's key.
Rename a paired agent
Run swb rename-agent OLD NEW with the owner's key. SwB keeps the agent's keys, routes, memory and mailbox.
If an environment variable sets the agent name, rename its SWB_KEY_<NAME> variable instead.
If the config sets access rules for the current name, copy those rules to the new name. Restart SwB before the rename.
Export memory
Run the export inside the Compose container.
docker compose exec -T switchboard swb export /data/exportThe export saves Markdown files by scope under ./data/export on the host. Open INDEX.md to find the files. Set memory.mirror_dir to keep a current Markdown copy.