Running OpenBelt

CommandWhat
bun run devThe platform from this checkout with live reload, at http://acme.localhost:1337 signed in as you with no sign-in (viewers.md), and on your tailnet at https://acme.<domain>:8445 once a domain is set up (tailnet.md); a worktree: its own ports; prints a token. Data persists in this checkout's namespace of ~/.openbelt/data (The data).
bun run data backup|restoreA copy of a data directory taken while the platform runs (15 ms on a Mac), and one put back with it stopped. See Backups.
bun run seed, bun run qa [<state>]Fill a running OpenBelt (bun run dev with no flags, or --run <dir>) with people, groups, connections, apps, tokens and activity; then put yourself in each state its pages have (fresh, needs-consent, connected, contractor, admin, ...). See Trying OpenBelt by hand.
bun run try:piA fresh isolated platform plus pi connected to it, in an empty folder; stops when pi exits. Pass pi's own flags after pi.
bun run tailnet up|rollback|status|token|logs|downOpenBelt on this Mac for your Tailscale tailnet: always on, everyone signed in as their Tailscale login; up upgrades it, tried on a copy of the data first. See OpenBelt on your tailnet.
bun run deploy deploy|rollback|status|smoke|token|logs prodProd, on a server of your own, deployed over ssh with no client errors: main's newest commit checked, a canary on a copy of prod's data, then the platform restarted on the new image behind Caddy, which holds requests meanwhile (about a second), rolled back if its smoke test fails. See Production.
bun run wwwThe marketing site (www/) at http://localhost:4321. The platform serves it only on a domain, so bun run dev doesn't.
bun run drive doctor|tools|call|oauth|scim|as|traceOne MCP call, a browserless OAuth sign-in (oauth <email>, 0.1 s), a directory's SCIM request (scim <METHOD> <path>), or a person's page request, against a running OpenBelt (--run <dir>, or --mcp/--token); trace <id> puts OpenBelt's side of one trace beside the test providers' (below).
bun run worldAn isolated OpenBelt with test OAuth providers shaped like Linear, Notion, Google and GitHub, each connected and called once, in about 5 seconds. See Iterating on connections.
bun run e2e:oidcOpenID Connect sign-in for real: Keycloak in Docker (one realm whose ID tokens say email_verified, one shaped like Entra ID's), a fresh platform for each with OPENBELT_SSO_* pointed at it, and a browser that presses Continue, types a password on Keycloak's page and comes back signed in, or refused for an unverified email. Screenshots in .verify/e2e-oidc/; --keep leaves Keycloak running. See viewers.md.
bun run providers list|probe [id]OpenBelt's catalog of connections (packages/platform/providers/): list prints each provider's sign-in and defaults; probe asks each live server, without an account, how it signs in today and prints where its file no longer matches (exits 1 on drift).
bun run verify [name...] [--all]The checks this checkout's change needs: its commits since --base (default origin/main) and what's uncommitted, picked by scripts/verify/select.ts (a changed checks file; docs/ → doc-examples; code → the checks that share its rare words; the harness, dependencies, or code no check matches → all; www/, brand/, skills → none). With names, the checks files whose name contains one; --all, every one. Each against its own fresh platform, in its own namespace of the verify data (.verify/data); evidence in .verify/<run>/. --shard 2/4 runs the second of four shares, balanced by each file's time in scripts/verify/durations.json (CI's, as each share prints them in its log: refresh it from there when a share grows long). CI runs a PR's picks on as few machines as fit (--plan), and everything on every push to main, in four shares, one check at a time on each.
bun run verify:list [words] [--changed]What each checks file proves (its about export and its behaviors), searched by words, best first; --changed: what bun run verify would pick for this change, why, and the closer calls.
bun run checkFormat, lint, typecheck, guard, brand, dead code.
bun run verify:upgrade [base]The base commit (default: where this branch left origin/main) given an app and data, then this checkout started on the same namespace: fails when anything is lost that packages/platform/storage.json doesn't drop on purpose. CI runs it on every PR.
bun run shots:diff [--pr <pr>]Which screens a change moved: every scene on the base and this checkout, compared pixel by pixel; --pr publishes them into the PR.

Iterating on connections

For work on how OpenBelt signs in to MCP servers (OAuth, refresh, revoke), bun run world gives you a world of fake providers that behave like real ones, from cold:

bun run world --keep                       # OpenBelt + linear, notion, google, github; returns
bun run world --providers google,entra     # just those; stays up until Ctrl-C
bun run world --once                       # start, connect, call, print the timings, stop
bun run world stop --run .verify/world-…   # what --keep left running

It launches an isolated OpenBelt (as bun run verify does), starts a test provider per preset (scripts/verify/drive/dummy-mcp.ts --preset <name>), adds a connection for each with bun run workspace, signs verify@acme.test (the instance's token) in to each without a browser (registering OpenBelt's app by hand at providers without dynamic registration, as an admin would), and makes one call through each. It prints OpenBelt's URL and token, each provider's URL, ledger and the call's trace, the commands to look closer, and how long each step took. Everything lives in the run dir (.verify/world-<time>/, or --run): instance.json, world.json, and platform.log. Stop a world before bun run verify: verify's last check counts any running platform server as left behind.

Presets are real providers' behavior as settings, in dummy-oauth.ts PRESETS. Measured against the real server: linear, notion, google. From the provider's docs: github (an OAuth app), github-app, entra, slack, slack-rotating. A preset made from a catalog file (linear, notion, google from google-gmail.json, github) takes its token lifetimes, rotation, quirks and registration from that file (one place says each), and bun run world adds it with --provider <file>, so the file's defaults and quirks are what's exercised.

PresetWhat it does
linearDCR and CIMD advertised; tokens last as linear/mcp.json measured; refresh tokens rotate; a replayed one is invalid_grant and the grant lives on; RFC 7009 revoke.
notion8h tokens; rotation and replay as Linear; the token answer's scope is default; revocation at the token URL.
googleinitialize and tools/list answer 200 without a token; tools/call 401s with an isError result and metadata per tool; URL /mcp/v1, resource /mcp; the metadata names the issuer with a slash; OIDC metadata only; no DCR or CIMD; refresh token only for access_type=offline, never rotated, lasting 604800s; granular consent; 403 ACCESS_TOKEN_SCOPE_INSUFFICIENT; revoking one token ends every grant to the app.
githubNo DCR or CIMD; metadata at /login/oauth; errors as HTTP 200; a client secret even with PKCE; tokens that never expire. github-app: 8h tokens and a rotating refresh token.
entraA tenant's issuer with OIDC metadata only; a .default scope; a refresh token only for offline_access, and the scope again on every refresh; resource refused beside scope; no revocation endpoint.
slackclient_secret_post only; errors as 200 {ok: false}; tokens that never expire. slack-rotating: 12h tokens and a rotating refresh token.

Change a provider while it runs: curl '<provider>/control/oauth?preset=notion&expiry=60' (every setting's name is in dummy-oauth.ts; an unknown one is refused), curl -X POST <provider>/control/expire-now (the next call refreshes first), /control/stats.

Faults are one-off failures, in emulate's shape: the next matching requests get your answer instead of the real one.

curl -X POST <provider>/control/faults -d '{"match": {"pathPattern": "/token", "grant": "refresh_token"},
  "response": {"status": 503, "body": {"error": "temporarily_unavailable"}}, "times": 1}'
curl <provider>/control/faults             # what's still armed
curl -X DELETE <provider>/control/faults   # disarm them all (?id=f1: one)

match takes method, pathPattern (* for any characters), grant (a token request's grant_type), rpc (a JSON-RPC method) and tool; delayMs holds the answer (with no response, the real one, late); times defaults to 1.

The ledger: every provider records each request it answers: method, path, status, a one-line summary (never a token, code or secret), the X-Correlation-Id OpenBelt sent (its trace id), how long it took and the fault that answered it. curl '<provider>/control/ledger?trace=<id>&limit=50'; curl -X DELETE <provider>/control/ledger empties it.

One trace, both sides: every connection call's result ends with its trace ((openbelt: linear.whoami ok in 5ms as me, trace 8fe81a27436a)), and

bun run drive trace 8fe81a27436a --run .verify/world-…

prints the trace's spans as a tree (each object, sandbox run and SQL call it went through, when it started and how long it took), then OpenBelt's log lines and connection calls beside every provider's ledger entries under the same id, in time order: "OpenBelt asked X, the provider answered Y". --provider <origin> adds a provider that isn't in world.json. Without --run, it traces this checkout's bun run dev (its dev.json): OpenBelt's side only, since real providers keep no ledger. "Reading the logs" below has the rest.

Upgrading to workspace terminology

This release uses workspace names throughout the browser, MCP, HTTP, CLI, configuration and code. Workspace IDs, people, app hosts, API tokens and documents keep their identities.

Before upgrading, take a backup with bun run data backup <dest>. Stop the previous platform before starting this release. At first start, the supervisor migrates the namespace before it starts any platform processes. It moves workspace object files, directory tables, metadata and shared connection credentials, including their encryption bindings. Keep the same OPENBELT_SECRETS_KEY. A key that cannot decrypt a credential stops startup without discarding it. Each database migration is transactional and retryable; the namespace gets a .workspace-v1 marker only after every database finishes. Original database snapshots are kept in the namespace's .before-workspace-v1 directory.

Update integrations to the new contracts together:

There are no aliases for the previous API or code names. Third-party scopes and service names keep their provider's spelling. To return to a release from before this migration, stop the platform and restore the pre-upgrade backup before starting that release. An old image cannot read the migrated workspace files.

The data

OpenBelt's objects (every workspace, app and MCP session) run in the platform's own processes, and each keeps its data in a SQLite file of its own (runtime/actor.ts, runtime/localdb.ts): an app's documents, versions, runs, logs, schedules and secrets in one file, a workspace's people, tokens, connections and directory of apps in another. The files live in one directory, OPENBELT_DATA, one folder per namespace: <data>/<namespace>/<object>-<key hash>.sqlite, each with its -wal beside it. An object lives in the process its key hashes to (OPENBELT_PROCESSES, below): it starts on its first request, opens its file, and is put to sleep after 10 minutes with nothing to do and no page open (OPENBELT_ACTOR_SLEEP_SECONDS, 600), which closes it. A job it books (a schedule, a later, a retry) is a timer in that process and a row in the process's wake file, so a restart arms it again.

Files

What people upload to apps (files.put in the SDK) isn't in the objects' SQLite: the gateway streams it to a file store, and an app's object keeps only each file's record (its files table) and the workspace's object each app's bytes (file_usage). Downloads come from the store alone and wake no object.

Running on a server

compose.yaml runs the platform from one image (Dockerfile: Bun, Playwright's pinned Chromium for check_app, the code), its data on a volume:

OPENBELT_HOST=openbelt.example.com docker compose up -d

.github/workflows/ci.yml builds the image on every push to main and publishes it to the repository's container registry by commit, then as :latest once every check passed on that commit; a deployment pulls the tag it wants.

The compiled server

bun run compile builds the platform as one Linux archive per arch, in dist/server/:

openbelt-server-2026.11.23.1308-linux-x64.tar.gz     52 MiB
openbelt-server-2026.11.23.1308-linux-arm64.tar.gz   52 MiB
SHA256SUMS

Each holds one folder: openbelt-server (Bun and the platform in one file, from bun build --compile), VERSION, and the files the platform reads at run time, at the repo's paths (www/, brand/, docs/, the starters, the QuickJS WASM, the icons, the CLI builds it hands out). Unpack it anywhere and run openbelt-server with the environment bun packages/platform/src/server.ts takes; it needs no Bun, checkout or node_modules. openbelt-server --version says its version and commit; openbelt-server data backup|restore|restore-backup keeps its data (Backups). Chrome is not in it: check_app finds one as it does from source (OPENBELT_CHROME_PATH, or the usual places).

Releases

CI builds both archives on every push (its archive job) and runs verify and processes on the x64 one. On main, once every check passed, its release job hands those same files to bun scripts/compile/release.ts, which refuses unless there is one version for x64 and arm64, it isn't -dirty, every file matches SHA256SUMS, and the commit both archives name is on origin/main. It writes the notes (RELEASE.md: files, sizes, SHA-256) and, with --publish <owner/repo>, makes the GitHub release v<version> there with the archives and SHA256SUMS; a release that exists is left alone. The job publishes only once the variable OPENBELT_RELEASE_REPO names a repository (with OPENBELT_RELEASE_TOKEN allowed to write its releases); until then it is a dry run. A release is public: setting that variable needs the owner's word.

Production

There is one deployed stage, prod, and no staging: a change goes from main to prod, and the canary runs it on a copy of prod's own data first. A stage is a platform on a server, on a data directory of its own (~/openbelt-<stage>/data), from deploy/compose.server.yaml; its name picks its settings (~/.config/openbelt/<stage>.env). In front of every stage on a server is one front (deploy/compose.front.yaml, in ~/openbelt-front): Caddy on ports 80 and 443, sending each stage's names to its platform's port, and a helper (scripts/deploy/front.ts) that answers Caddy's questions. bun run deploy drives it over ssh (scripts/deploy.ts):

CommandWhat
bun run deploy deploy prod [commit] [--fast]From a terminal: main's newest commit (or one on main), checked, built on the server, made live (Deploying from a terminal). CI runs the deploy itself once its checks passed.
bun run deploy recheck prodThe full checks on the commit prod runs, in a worktree of their own; nothing deployed.
bun run deploy rollback prodBack to the image that ran before the last deploy. Shipping an older commit on main is the other way back.
bun run deploy status|smoke|token|logs|history prodThe commit its front door serves; the smoke test against it; an API token and the commands that add it to an agent; the platform's last 50 lines (--follow streams); recent deploy timings and build cache hits.

A deploy:

  1. Builds the image on the server from the commit's files (or pulls CI's, with a registry token).
  2. Puts the front as it should be: Caddy (built once on the server with the Cloudflare DNS module, deploy/caddy.Dockerfile) and the helper started if they aren't, this stage's names in caddy/stages/<stage>.caddy, and Caddy reloaded only if they changed.
  3. Runs a canary: the image in a container of its own, on a copy of the stage's data taken as it runs (bun run data backup, consistent while the platform writes; milliseconds for prod's few megabytes). It is smoke-tested from inside (scripts/deploy/smoke.ts: health with the commit, a token, deploy_app with a function, its page, call_function, check_app writing through the SDK and seeing it live, search finding it), then checked to hold every workspace's apps, live versions, live files, documents, environments and tokens as the stage held them just before the copy (scripts/deploy/carried.ts, reading /_ops/inventory). A change that breaks on data an older version wrote stops here; an empty data directory would have let it through. The copy is real data, so the canary does nothing outside: an internal Docker network (its schedules, OAuth refreshes, webhooks and fetches reach nobody), no backups (its writes never mix into the stage's backup) and no mail. The copy is deleted after. A failure stops here with nothing changed.
  4. Stops the platform and starts the new image on the same data. Caddy holds each request meanwhile (scripts/deploy/proxy.ts: it checks /_health every 250 ms and holds a request up to 30 s) and sends it once the new one answers; the old one answers /_health 503 first, so Caddy stops sending to it before it stops taking connections, and its requests under way finish. Then a quick smoke test through its own port.
  5. Smoke-tests through the front door from where it runs. A failure goes back to the image before. --drill-rollback does the same after a passing deploy, to practice one. Once healthy, older image tags for the stage are pruned while keeping the current image, the rollback target, and the CLI build cache.

Every step can run again. The stage's state.json says what runs and what ran before; a deploy first puts the front and the platform back to what it says, and holds a lease so two deploys of one stage don't overlap. The lease names one run (its user, host and process), so two agents on one machine are two holders. A deploy from a terminal waits for another one's lease (up to 45 minutes), then starts again from main as it is then; when the stage already runs a commit that holds the main it started with, it stops there with nothing to do. A dead run's lease lapses at once on the machine that ran it, and after an hour elsewhere; --force takes one over.

The deploy-swap check runs the same Caddy block in front of a platform restarted twice under an agent's calls and a page's writes: 231 calls and 2,460 writes, none failed, the longest held for 2.5 s, and the agent's MCP session carried on through both restarts. deploy-burst holds 192 deploys at once, 8 at a time over one session, answering in 4.4 s.

Names and certificates (OPENBELT_TLS). OPENBELT_HOST and *.OPENBELT_HOST point at the server. The bare host serves the marketing site (www/); every name under it is OpenBelt's. With OPENBELT_BASE_HOST (a base host on a domain of its own), that one name serves the marketing site instead, and OPENBELT_HOST's bare name sends there (308); the deploy smoke-tests it too.

Who is viewing. OPENBELT_SIGNIN=tailscale with OPENBELT_FRONT_CADDY=tailscale: the helper asks the server's tailscaled who each request's address is, and Caddy adds the Tailscale-User-* headers it answers, as tailscale serve would; a tagged device (CI) is nobody. Or OPENBELT_FRONT_CADDY is a file with a Caddy snippet that signs people in (deploy/signin; viewers.md). Either way Caddy drops any Tailscale-User-* header a client sends first, and adds the front door's secret (OPENBELT_FRONT_DOOR_SECRET, made on the stage's first deploy) to every request it forwards. With a secret set, the platform believes only requests that carry it, loopback ones included: whatever else runs on the machine reaches loopback too. A stage with no sign-in is refused, prod too (OPENBELT_PUBLIC=yes if it's meant to be public).

The operator's routes (/_ops/*: tokens, sign-in links, logs, the inventory) answer through the front only from the server itself and the tailnet (100.64.0.0/10, fd7a:115c:a1e0::/48, which CI joins to deploy): anyone else gets a 403 from Caddy before the platform sees the request, the admin token or not. The token itself is compared in constant time. Sessions are signed with OPENBELT_SESSION_SECRET, which a stage's first deploy makes and keeps in its state.json, not with the admin token, so a leaked token can't forge sessions (a stage deployed before it gets one on its next deploy, and everyone signs in again once).

Settings come from the environment, or from ~/.config/openbelt/<stage>.env when you deploy from your own machine: OPENBELT_DEPLOY_SSH (user@host), OPENBELT_HOST, OPENBELT_ADMIN_TOKEN, OPENBELT_SECRETS_KEY; and optionally OPENBELT_SIGNIN, OPENBELT_FRONT_CADDY, OPENBELT_TLS, OPENBELT_DEFAULT_WORKSPACE, OPENBELT_TELEMETRY (below), OPENBELT_IMAGE, OPENBELT_DEPLOY_DIR (default openbelt-<stage> in the ssh user's home), OPENBELT_HOST_PORT (the platform's port on the server, default 1401), OPENBELT_PROCESSES and OPENBELT_MEMORY_LIMIT. Keep OPENBELT_SECRETS_KEY: what's sealed under one key doesn't open under another.

Grafana on the server

OPENBELT_TELEMETRY=grafana runs Grafana beside the front (Tempo for traces, Loki for logs, Prometheus for metrics: grafana/otel-lgtm, the image compose's telemetry profile runs) and sends the stage's spans, log lines and metrics to it, served at https://grafana.<host>. The stage is named by deployment.environment.name (prod), which Tempo, Loki and Prometheus all filter by. Prod itself has no sign-in at the front, so it sends to a Grafana on another machine instead (Prod, 6).

To send elsewhere instead (Grafana Cloud, Honeycomb), leave OPENBELT_TELEMETRY empty and set OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_HEADERS for the stage (Keeping traces and logs). Both at once is refused.

The tailnet

Prod has a public address for its names, and is on the tailnet for SSH, deploys and /_ops only:

Deploying from a terminal

Prod runs main. bun run deploy deploy prod does what CI's push to main does, from a machine on the tailnet with ~/.config/openbelt/prod.env, with nothing to confirm:

  1. Fetches origin/main and checks its newest commit out in a worktree of its own (a commit given instead must be on main; anything else is refused). If prod already runs it, it stops there.
  2. In that worktree: bun run check, bun run verify --all, the checks on several processes (OPENBELT_PROCESSES=4, as ci.yml's processes job), and bun run verify:upgrade from the commit prod runs. A failure deploys nothing and leaves the worktree, with its evidence. About 7 minutes. --fast runs check and the upgrade only (about 20 seconds), for a change you're sure of; bun run deploy recheck prod later runs the full checks on what prod runs, deploying nothing.
  3. Deploys with that commit's own scripts/deploy.ts. With no registry token, the deploy builds the image on the server from the commit's files instead of pulling it: about 2 minutes, 15 when cli/ or the Dockerfile changed (the CLI's stage is kept as openbelt-build-cache:cli).

The deploy itself is the one above: the canary on a copy of prod's data, swap, smoke test, back to the image before on failure.

Prod: a server with a public address

Prod is one VM of its own with a public address (4 vCPUs and 8 GB, with the provider's daily backups on). It is on the tailnet for SSH and deploys only (The tailnet):

  1. The machine. Ubuntu 24.04 from deploy/cloud-config.yml (its header has the commands), behind the provider's firewall: 80/tcp, 443/tcp and udp, ICMP and Tailscale's 41641/udp, and 2222/tcp from your address alone until the machine is on the tailnet.
  2. The tailnet. tag:openbelt-prod, in the policy (above): CI's ssh as deploy and https, members' https, and your own ssh as deploy. Then SSH is the tailnet's alone (the header's last commands).
  3. DNS (Cloudflare, DNS only): OPENBELT_HOST, *.<OPENBELT_HOST>, OPENBELT_BASE_HOST and *.<OPENBELT_PUBLIC_HOST> (*.openbelt.page), A and AAAA, the machine's public addresses. OPENBELT_TLS unset: Caddy gets each name's certificate from Let's Encrypt on its first visit, so the zones' CAA records must allow Let's Encrypt. Public apps' names are the exception: one wildcard, *.<OPENBELT_PUBLIC_HOST>, by DNS challenge, with CLOUDFLARE_DNS_API_TOKEN (a token that can edit that zone) in prod.env once (the deploy keeps it in the front's caddy.env); it refuses without it. *.openbelt.page is proxied through Cloudflare (orange cloud, SSL "Full (strict)", the free certificate covers one label). The front believes the visitor's address in CF-Connecting-IP only from Cloudflare's ranges (scripts/deploy/proxy.ts, CLOUDFLARE) and passes on that one address as X-Forwarded-For, so the per-address limits count each visitor, not each Cloudflare server. Update CLOUDFLARE when https://www.cloudflare.com/ips/ changes. Public apps behind a CDN: a public app's files (not /_...), /sdk.js and the page the OpenBelt bar frames (the page's address with _framed=1 last in its query: the same answer whoever asks) answer with CDN-Cache-Control: public, max-age=60, so the edge keeps them a minute while browsers still ask each time (Cache-Control: no-cache). A page at its own address (the bar, which counts the visit, or the page of an app with "bar": false) and data always reach the platform. Cloudflare keeps only the file types it caches by default (scripts, styles, images, fonts), so the framed page needs one Cache Rule on the zone: when the query string ends with _framed=1 (ends_with(http.request.uri.query, "_framed=1")), Eligible for cache, Edge TTL "Use cache-control header if present, bypass cache if not". The zone's Browser Cache TTL is "Respect Existing Headers". Each time a public app goes live (or stops being public) the platform purges its name there, with OPENBELT_CDN_TOKEN (a token with Cache Purge on the public host's zone) and OPENBELT_CDN_ZONE (that zone's id) in prod.env; without them a file at the edge is at most a minute old. A purge that fails is a warning in the log.
  4. ~/.config/openbelt/prod.env: OPENBELT_DEPLOY_SSH (deploy@<tailnet address>), OPENBELT_FRONT_ADDRESS (the tailnet address: /_ops answers only from the tailnet), OPENBELT_HOST, OPENBELT_BASE_HOST, OPENBELT_PUBLIC_HOST=openbelt.page, OPENBELT_SIGNIN=email, OPENBELT_SIGNIN_ALLOW, OPENBELT_MAIL_TOKEN and OPENBELT_MAIL_ACCOUNT, optionally OPENBELT_GOOGLE_CLIENT_ID and OPENBELT_GOOGLE_CLIENT_SECRET (viewers.md), optionally OpenBelt's own apps for connections, OPENBELT_CONNECT_<FAMILY>_CLIENT_ID and _CLIENT_SECRET (connections.md), OPENBELT_ADMIN_TOKEN and OPENBELT_SECRETS_KEY, the backup's three (Backups), the telemetry's endpoint (6), OPENBELT_INTERNAL_EMAILS (The sign-up funnel) and, to bill, OPENBELT_STRIPE_SECRET_KEY, OPENBELT_STRIPE_WEBHOOK_SECRET and OPENBELT_STRIPE_PRICE_PRO (bun run stripe:setup makes the price and the webhook; without the key every workspace has every feature). Keep a copy somewhere other than the laptop: a backup restored without its OPENBELT_SECRETS_KEY comes back with every secret sealed for good.
  5. Deploy. bun run deploy deploy prod from a terminal (Deploying from a terminal). The first build on a new machine takes about 10 minutes (the CLI's stage), later ones about 2.
  6. Telemetry on another machine. OPENBELT_TELEMETRY=grafana needs a sign-in at the front, which a public prod doesn't have, so Grafana (grafana/otel-lgtm) runs on a tailnet-only VM of its own: OTEL_EXPORTER_OTLP_ENDPOINT=http://<its tailnet address>:4318 in prod.env, and the tailnet policy lets tag:openbelt-prod reach that port and nothing else there.
  7. Backups. Continuous (OPENBELT_BACKUP_URL, to a bucket of its own), nightly (deploy/nightly.sh, to another bucket, kept by its lifecycle rule) and the provider's snapshots of the whole disk (Backups).

Rebuilding it on a new machine from the continuous copy (not yet drilled end to end; the restore itself is, bun run data restore-backup from the bucket alone):

  1. Steps 1 and 2, then 4 with the new tailnet address, and 5: prod starts on an empty data directory.

  2. On the server, as deploy, put the bucket's copy in place of it:

    cd ~/openbelt-prod && docker compose -p openbelt-prod stop openbelt
    docker run --rm -e OPENBELT_BACKUP_KEY_ID=... -e OPENBELT_BACKUP_SECRET=... -v "$PWD:/stage" \
      "$(sed -n 's/^OPENBELT_IMAGE=//p' .env)" bun run data restore-backup '<OPENBELT_BACKUP_URL>' /stage/restored
    mv data data.empty && mv restored data && docker compose -p openbelt-prod start openbelt
    
  3. Point DNS (3) at the new addresses. Install deploy/nightly.sh again.

CI

ci.yml builds and publishes the image on every push to main and every PR from this repository (layers cached, so a change to code alone rebuilds in seconds). On main, the prod job deploys it once every check passed, with the same canary on a copy of prod's data. Prod's uptime is checked off GitHub ("Uptime", below). Until prod has a server, the job is skipped (prod-off says so). What the repository needs:

The server pulls the image with the job's own token, which lasts only for that run.

Uptime

A Cloudflare Worker, openbelt-uptime (scripts/uptime/), checks prod every 5 minutes from outside the server and outside GitHub. It loads three pages: a workspace's /_health (acme.openbelt.app), the marketing page (openbelt.com), and a public app (uptime--acme.openbelt.page, a static page in acme with "public": {}). It checks paperbot too (app.paperbot.ca/v1/ping), which connects its owners to OpenBelt, as a service of its own. A page that fails is loaded again 20 seconds later. A page that fails twice makes its service "down" (except during OpenBelt prod's 10:00–10:05 UTC unattended-upgrades reboot window, when a new failure waits for the 10:05 UTC check before paging). When a service goes down, the Worker emails hello@openbelt.com (Email Sending, from uptime@openbelt.com; Email Routing forwards it). When it is back, it emails again. For OpenBelt prod it also posts both to the phone (ntfy.sh, the topic in its secret NTFY_TOPIC, the same one the ops machine's alerts use; only a title and a count, since anyone who knows a topic can read it), so the phone hears that prod is down when the ops machine is down too. It keeps each service's last state in the KV namespace openbelt-uptime. Change the pages in worker.ts, then deploy:

bunx wrangler@4 deploy -c scripts/uptime/wrangler.jsonc

Its runs and errors are in the Cloudflare dashboard (Workers > openbelt-uptime > Logs).

/_health doesn't reach a workspace's object, so it stayed green through prod's 2026-11-22 hang (a workspace answered no signed-in request for 19 minutes). scripts/uptime/probe.ts asks as a signed-in agent: an MCP session and one cheap tool per workspace (OPENBELT_PROBE_TARGETS, a JSON list of {name, url, token}; a token of a test person of its own, never a real person's), and says DOWN within its timeout. It isn't scheduled anywhere yet.

Alerts

The ops machine's Grafana watches prod's logs and metrics, and mails what it finds through the same Worker: POST /alert on openbelt-uptime.<account>.workers.dev, with the Worker's secret ALERT_TOKEN as a Bearer token, takes Grafana's webhook ({title, message}) or {subject, text, html?} (HTML with its plain copy) and emails it to hello@openbelt.com. The rules are files in the ops repo (grafana/alerting.yaml), each a SQL query on the ops machine's ClickHouse, which keeps everything prod sends (otel.otel_logs, otel.otel_traces, otel.otel_metrics_*):

AlertWhen
OpenBelt is answering errorsover 10 requests answered 5xx in 10 minutes, not counting prod's own 127.0.0.1 health checks while it starts
OpenBelt refused writes for storageany 507 in 15 minutes: an app's or workspace's cap, or the disk floor
OpenBelt sign-ups spikedover 20 new workspaces in an hour (made the workspace), test people (*.test) left out
A public app went liveevery public app: <host> is live at version <v> line: a version with "public" went live, so a page anyone can open is up. Open it
OpenBelt is rate-limiting a lotover 50 rate limit: refusals in 15 minutes

Rules on objects' turns are in this repo, deploy/grafana/alerts/turns.yaml (PromQL, for a server's own Grafana; the ops machine runs the same rules in SQL): any openbelt_turn_violations_total (a turn rule refused or broken: platform code that waits twice at once or uses storage outside its turn, or a bug in the kernel itself: a phone alert) and requests under way staying 3x their usual count (something holds them).

Each mails once, then again every 6 hours while it lasts; "resolved" isn't mailed. The ops machine also mails a digest every morning (15:00 UTC): new workspaces, public apps that went live, sign-ins, deploys, errors and limits hit. Whether prod is up at all is the Worker's own check: when the ops machine is down, these alerts and the digest stop with it, and the uptime mails and the Worker's "prod is down" on the phone don't.

The sign-up funnel

Each step towards using OpenBelt logs one funnel: <step> line (funnel.ts), for the ops machine's Glance page, digest and long-retention otel.product_events table:

StepWhen
landingthe marketing home page (/ as HTML)
page_view, copy_prompt, copy_cli, cta_click, pricing_seenfirst-party marketing beacons sent by the marketing page to POST /_event (same-origin, cookieless; detail names the page or place)
start/start (Start building)
signinthe base host's sign-in page
code, code_failed, google, ssoa code mailed, a code verification refusal (detail: missing, expired, too_many_tries, mismatch, rate_limited), Continue with Google, or Continue with the company's provider
signed_ina person signed in on the base host, by code or a provider
workspacea person made a workspace on the base host (the picker, or an agent's sign-in)
mcpan agent reached the base host's /mcp with no token (the 401 that starts its sign-in)
devicean agent started a device sign-in on the base host (no browser of its own)
authorizethe page that asks a person to let an agent in
agent_signed_ina person let an agent in

After that, post-login milestones carry structured event annotations (starter_added, connection_oauth_start, connection_oauth_connected, billing_checkout, billing_portal, billing_stripe) alongside deploys and agents' tool call: lines (with agent). Each funnel line carries:

People per step in the last day, on the ops machine's ClickHouse: SELECT uniqExact(LogAttributes['visitor']) FROM otel.otel_logs WHERE Body LIKE 'funnel: start%' AND LogAttributes['kind'] = 'person' AND Timestamp > now() - INTERVAL 1 DAY. Tag every link we share: https://openbelt.com/?ref=<where>.

Closing sign-ups

To stop new people at once (a flood of sign-ups, abuse): list who may still sign in in OPENBELT_SIGNIN_ALLOW (addresses and @domains, separated by commas) in ~/.config/openbelt/prod.env, then deploy (bun run deploy deploy prod --fast, about 30 s). It applies to email codes and Google alike; people already signed in stay signed in. Empty or unset, anyone may sign in.

Reading the logs

Every line the platform prints (on stderr) is one JSON object: at, level, msg, the trace and span it happened in, in (the span's name, like AppDO.execute), its context (workspace, app, actor, ms, ...) and, for a failure, cause (the full Effect cause, with the spans it passed through). That covers OpenBelt's own lines and what libraries print (from: "console"). bun run dev prints them readably and keeps the JSON in .dev/logs/dev.log; a verify or world run keeps them in its platform.log; compose keeps each container's in rotated files (docker compose logs).

A running instance also keeps its newest lines and every finished span in memory, and answers for them with the admin token (Authorization: Bearer $OPENBELT_ADMIN_TOKEN, on the workspace host):

AskWhat
bun run drive logsGET /_ops/logs: the newest lines, filtered by --trace, --workspace, --app, --level warn (that and worse), --since 5m (or an ISO time), --text, --limit
bun run drive trace <id>GET /_ops/trace?id=: one trace's spans as a tree (a span still running says so: what a stuck request waits in), with its log lines (and connection calls, and test providers' ledgers)
bun run drive actorsGET /_ops/actors: every object with data, awake (held by one of this machine's processes) or asleep, with its id; --state, --object
bun run drive actors sleep <id>POST /_ops/actors/sleep?id=: put one object to sleep; its next call wakes it
bun run drive metricsGET /_ops/metrics: the metrics below, in Prometheus' text format; --text filters
bun run drive turnsGET /_ops/turns: each object with an event under way or in line: who has its turn and for how long, its events (holding the turn, away, pinned in a transaction), and the first in line (X (coming back): an event back from an away). A stuck object is one whose line grows while its owner never changes
bun run drive turns release <id>POST /_ops/turns/release?id=: break glass: end the event holding a stuck object's turn and give the turn to the next in line. What is left of that event holds nothing (its storage is refused). It answers again without a restart. drive actors sleep <id> frees it too: the instance's mailbox retires, what was in line is refused (sending it again is safe) and the next request starts a new instance
bun run drive snapshotAll of the above at once into one folder (.verify/snapshots/<host>-<time>/, or --out): turns, actors, metrics, the newest 5,000 lines, GET /_ops/inflight (every span under way, oldest first) and the oldest requests' traces, with summary.md naming each stuck object and which known shape it is. Run it before any restart

Each takes --run <dir> (a launched instance), --url <workspace url> --admin-token <token> (any instance), --prod (~/.config/openbelt/prod.env: its admin token, over the tailnet to OPENBELT_FRONT_ADDRESS while naming the workspace host, as curl --resolve does; --env <file> reads another), or neither (this checkout's bun run dev); --json prints the JSON. Every turn rule refused (a second away of one event, storage outside the turn, a callback after its event ended) and every rule the kernel finds broken in itself is an error line starting turns: with the object's turns, and openbelt_turn_violations_total{kind} (concurrent-leave, storage-ended, storage-inside-away, ..., or the table's own grant-mismatch, ...). bun scripts/turns-ops.ts drives each of these levers on a launched platform. A trace id is either OpenBelt's (x-openbelt-trace, the trace in a tool's result, function_runs) or the span trace's: both find the same request. When the instance has stopped, logs and trace read its log file instead (lines, no spans).

Settings: OPENBELT_LOG_LEVEL (info by default; debug adds a line for every request), OPENBELT_KEEP_LOGS and OPENBELT_KEEP_SPANS (how many lines and spans are kept in memory: 20,000 and 50,000). Every setting the platform reads is checked when it starts: one that isn't a value it can use (OPENBELT_SANDBOX_PROCESSES=eight, OPENBELT_LOG_LEVEL=verbose) stops it with a line naming the setting; unset or empty is the default.

Metrics (/_ops/metrics), each with few labels and never a workspace, app or path:

MetricWhat
openbelt_http_requests_total, openbelt_http_request_secondsrequests answered, by status class (2xx ... 5xx), and how long they took
openbelt_function_runs_total, openbelt_function_run_secondsfunction runs, by outcome (ok, error) and via (page, agent, call, schedule, webhook, ...), and how long
openbelt_mcp_tool_calls_total, openbelt_mcp_tool_call_secondsagents' calls to OpenBelt's MCP tools, by tool (a name that isn't one: unknown) and outcome (below), and how long
openbelt_outbound_requests_total, openbelt_outbound_request_secondsrequests to the outside, by kind (mcp, oauth, api, client-document, a function's function) and outcome (a status class, timeout, unreachable, refused)
openbelt_object_turn_wait_secondshow long an event waited for its object's turn
openbelt_turn_violations_totalturn rules refused or broken, by kind (above): platform code waiting twice at once or using storage outside its turn, or a kernel bug
openbelt_object_commits_totaldurable commits of objects' writes, by the object's class (AppDO, WorkspaceDO, ...): under load, several events' writes share one
openbelt_sandbox_processes, openbelt_sandbox_boxessandbox processes running, and the boxes (a QuickJS instance each) they hold, busy or idle
openbelt_sandbox_boxes_made_totalsandbox boxes made: a burst that finds them warm makes none
openbelt_sandbox_processes_ended_totalprocesses ended, by why: idle, stuck (didn't stop a run when told), failed
openbelt_sandbox_cpu_seconds_totalCPU the sandbox processes used (user and system), ended ones too: what each says every 5 s, and the rest when it exits
openbelt_sandbox_wasm_bytes, openbelt_sandbox_process_peak_bytesthe boxes' WASM memory (most of what the sandboxes hold), and the most any running sandbox process has held
openbelt_http_requests_open, openbelt_http_websockets_openrequests under way (open streams, an MCP session's, among them) and WebSockets open, read from Bun's server every 5 s

What to look for:

Agents' tool calls

Workspace admins open Activity in the settings sidebar (/admin/events) to browse OpenBelt MCP calls and connection calls together, newest first. Each row shows the person, client, result and duration. Expand it for the trace, exact time, error and shortened arguments. Search by tool, person, app, client or trace; filter by source, result, person, tool, app and agent (the client's agent, claude-code 2.1.3 is Claude Code). Pages show 50 events; Refresh loads new calls.

Above the list, a chart shows the same matching calls over the last 7 days (2-hour bars, range=7d) or 24 hours (hourly, range=24h), stacked by app, person or agent (split=app|person|agent): the top 4 and the rest as Other. Its legend filters the list. The chart reads the workspace's hourly counts (activity_hours: one row per hour, source, person, agent, tool, app and result, kept 8 days, counted as each call is kept), so it covers the whole range however many calls the list keeps; a workspace from before them starts with the calls it kept. Its search looks at tool, person, agent and app, not trace or the client's version. The page keeps the latest 5,000 MCP calls and 500 connection calls, across restarts. A connection call made through MCP appears in both sources, showing each call's own duration. Scheduled function runs and ordinary HTTP requests are not included. Expand a refused call for its recorded reason. Change access on People, Groups or Connections. Requests (/admin/requests) lists the outstanding requests for more access.

Every call an agent makes to OpenBelt's own MCP tools (deploy_app, execute, search, ...) is kept, whatever the tool, by McpDO as it answers (tool-calls.ts), with one of five outcomes: ok; failed (the agent's code, a function or a connection's server ran and failed: execute's ok: false, a call_function run that failed, a connection's tool_error); refused (the tool said no, and why); invalid (arguments that don't fit, a tool that doesn't exist, a request the server turned away); defect (OpenBelt failed inside: look here first). A call on a session that can't be resumed isn't kept: no tool ran, and it's sent again on a new session. Each is:

A tool's error, and a JSON-RPC error answering a call, ends with (trace <id>), the id drive trace and app_logs take, so whoever reads an error can hand it on.

Database queue and execution time

OPENBELT_DB_TRACE=sampled (the default) adds database timing to 1 in 16 request traces, selected by trace id consistently across processes. all records it for every traced request; use it temporarily when diagnosing a slow request. off disables database timing. Restart the platform after changing the setting. Full recording costs more than sampling.

drive trace <id> and OTLP show db.count, db.errors, db.sqlQueueMs (waiting until the first worker dispatch), db.queueMs (waiting for the worker), db.executionMs (SQLite work) and db.transportMs (return delivery), summed on the calling span. Within selected traces, slow SQL queue waits, worker waits or executions (10 ms or more), failures and 1 in 64 fast operations also get SQLite.exec child spans with the worker index. These fields contain no SQL text or bindings. An unsampled request has no database timings; request and actor spans remain available.

The extra control worker keeps app SQL from occupying all database threads. Control queries still share a worker, and app HTTP requests that need a busy WorkspaceDO can still wait for it. OPENBELT_DB_THREADS continues to mean app workers; it never includes the additional control worker. Object filenames and the app worker hash stay the same across upgrades.

Keeping traces and logs

The memory above is gone when the platform stops. To keep traces and log lines, and search them across days and instances, point the platform at an OpenTelemetry backend (Grafana, Honeycomb, Datadog, any OTLP collector) with the standard variables:

SettingWhat
OTEL_EXPORTER_OTLP_ENDPOINTthe collector's base URL (/v1/traces and /v1/logs are added); unset or empty: no export
OTEL_EXPORTER_OTLP_HEADERSname=value pairs, comma separated: a hosted backend's key (Grafana Cloud's Authorization=Basic ...)
OTEL_EXPORTER_OTLP_PROTOCOLhttp/protobuf (the default) or http/json
OTEL_SERVICE_NAMEwhat it is filed under: openbelt unless set
OTEL_RESOURCE_ATTRIBUTESmore about where it runs, key=value pairs: a deploy sets deployment.environment.name=<stage>

OPENBELT_COMMIT is sent as the service's version, so a trace says which commit served it.

Then every span, log line and metric also goes there, batched in the background (a backend that is down costs requests nothing), and what is still batched is sent when the platform is sent SIGTERM. One request is one trace, across the objects it calls, with a span for each request OpenBelt or a function sends outside (POST mcp.linear.app, fetch api.github.com, with openbelt.outbound and openbelt.status). A request's own span says what it was about: openbelt.status (its answer's), openbelt.workspace (the id), openbelt.workspace.name, openbelt.app and openbelt.person (the signed-in email, or the agent's token's), each once the gateway knows it. Only OpenBelt's own span attributes (openbelt.function, openbelt.workspace, ...) leave the process; a log line goes as it is, with its fields, its span trace (trace_id) and OpenBelt's (trace). The runtime's own lines carry the trace they happened in too: a request's line, written once its answer is out, is in its request's trace, and a slow: turn's in its caller's. /_ops/* and bun run drive answer as before.

On one machine, compose runs Grafana for it (Tempo for traces, Loki for logs, Prometheus), kept in a volume, with Grafana at http://localhost:3000 (GRAFANA_PORT), on this machine only:

OTEL_EXPORTER_OTLP_ENDPOINT=http://telemetry:4318 docker compose --profile telemetry up -d

It has the server's dashboards (Grafana on the server), and takes OTLP at http://localhost:4318 (OTLP_PORT) too, so bun run dev can send to it; bun run grafana traffic makes up a few minutes of use (people, an app with fast, slow, failing and scheduled functions and a slow service outside) so the dashboards have something to show:

docker compose --profile telemetry up -d telemetry
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318 OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=local bun run dev
bun run grafana traffic --url http://acme.localhost:<port> --token <adminToken from .dev/dev.json> --minutes 10

Then pick the stage local at the top of the OpenBelt dashboard.

Loki stops taking log lines while its disk is over 90% full (Docker's disk, on a Mac): the log panels go empty while traces and metrics carry on, and with ENABLE_LOGS_LOKI=true on the container it says "disk usage exceeded threshold, throttling writes". Free Docker's disk (docker system df).

In Grafana, Explore finds a request by its span trace in Tempo, or with TraceQL ({span.openbelt.function="read" && duration > 50ms}), and its lines in Loki ({service_name="openbelt"} | trace="<OpenBelt's trace id>").

A server's stages get the same Grafana with OPENBELT_TELEMETRY=grafana (Grafana on the server).

Page loads

A request's spans say how long the platform took, not how long a person waited. Each OpenBelt page and each app page a browser opens (the script OpenBelt adds to it) reports its own load once: after load, when no new file has started for a second, or when the page is left first. It posts to /_timing on its own host, and the platform keeps it as a trace of its own, page <host><path>:

A page load: <host><path> in <ms> ms line goes with it. In Tempo, {name="page acme.openbelt.app/notes"} finds a page's loads, and {span.openbelt.browser.ms > 3000} the slow ones. Only a page's own origin, from someone the workspace admits, is kept: anything else is answered 204 and dropped. The public host (openbelt.page) has no report. WebSockets aren't files, so a socket's opening isn't in it.

The page's span ends at its last file, and Today fetches the Apps tab ahead 300 ms after load, so its openbelt.browser.ms reads about 500 ms when the page was ready in about 150: read the paint and load events, not the span's length.

Moving between pages

bun run nav --run <dir> clicks between OpenBelt's own pages in a real Chrome (Apps and Starters, an app, its About page, every settings page) on a platform launch.ts started with OPENBELT_SIGNIN=email and seed.ts filled, signed in with a session cookie as a person is, and prints each move's medians from the click: the document's first byte, first paint, DOMContentLoaded, load and ready, the bytes, the main thread's time, and the server's time for the document (its trace).

Chrome turns speculation rules' prerendering off while DevTools is attached, so nav (and any Playwright script) can't time a prerender: its --waterfall says PrerenderingDisabledByDevTools.

To compare two versions, launch a platform from each checkout and run nav against each in turn, several rounds, alternating.

Abuse

Storage caps

An app's data (its documents, in its own SQLite file) and a workspace's total are capped, and writes stop before the disk fills:

SettingDefaultWhat
OPENBELT_DATA_APP_MB1024one app's data (0: no cap)
OPENBELT_DATA_WORKSPACE_MB10240a workspace's apps together (0: no cap)
OPENBELT_DATA_DISK_FLOOR_MB1024free disk kept: writes stop there, in every workspace

A write that would add data past one (a page's, a function's, collection_add's) is refused with a 507 storage_full that says which, how much is used and the setting; reads and deletes go on. A deleted document's last version is kept on the server (the rules decide from it who is told it went; pages get only its id) until the app reaches a cap: then those go first, so deleting frees room, and a page reconnecting from before that reloads. Retained deploy files have a separate 256 MiB per-app budget (OPENBELT_VERSIONS_APP_MB; 0 disables it). When necessary, a deploy removes the oldest unpinned history to fit. The new live version, the previous live version and active previews are protected. If those cannot fit, the deploy is refused atomically and the live and preview versions remain unchanged. Identical file hashes count once. Deploys also respect the disk floor. An app's size is its file's pages in use. A growing data commit, seed or deploy checks the resulting size inside its transaction and atomically reserves that size in the workspace before committing. An oversized batch commits nothing. A failed transaction can leave a conservative reservation; the app reconciles its actual size on its next write. Existing apps are accounted as they are used. openbelt_refused_total{why="storage"} counts refusals. Uploads have their own caps (OPENBELT_FILES_*, Files).

Public apps have three more: OPENBELT_PUBLIC_APP_WRITES_PER_MINUTE (6000) writes, function calls and live query runs a minute to one app from the public host, every address together (429); OPENBELT_PUBLIC_ADDRESS_SHARE (2): the percent of that one client address may use (by the address the per-address request limit counts; a request straight to the port, with no x-forwarded-for, counts toward the app's limit only); and OPENBELT_PUBLIC_DATA_SHARE (50): past that percent of OPENBELT_DATA_APP_MB, the public host adds and changes no documents in the app (507), while its members still write. A request refused before doing any work (no such function, an op public doesn't list, the rules, a bad body) is not counted, nor is a watched query that a write from outside the public host runs again.

Request limits

SettingDefaultWhat
OPENBELT_RATE_PER_MINUTE6000requests per signed-in person/workspace, or anonymous address
OPENBELT_RATE_WRITES_PER_MINUTE3000of those, mutating requests (non-GET/HEAD/OPTIONS app calls, write MCP calls)
OPENBELT_RATE_IP_EMERGENCY_PER_MINUTE30000emergency request ceiling per address for everyone
OPENBELT_DEPLOYS_PER_HOUR300deploy attempts per person/workspace

Signed-in browsers and agents share the person's permanent workspace identity, not their token, session, app or address. Their refilling buckets are persisted in their McpDO, so opening another session, changing address or reaching another platform process does not reset the allowance. Colleagues behind one office address have separate allowances. MCP initialization, notifications, tools/list and read-only tool calls count against OPENBELT_RATE_PER_MINUTE, while mutating MCP tool calls also count against OPENBELT_RATE_WRITES_PER_MINUTE. Refusals answer 429 with Retry-After and a message naming the setting and when to retry.

Anonymous traffic uses address buckets in each gateway process. Every address also has the higher emergency ceiling, including signed-in traffic; a large office can still reach that ceiling. These address limits can multiply by the number of processes and reset on restart. The person's request and deploy limits do not. The operator's routes are exempt; anonymous loopback requests without forwarded headers are exempt for local tooling. Signed-in local requests still count.

Only a trusted front door's X-Forwarded-For supplies the address; otherwise the peer address is used. On hosted servers the platform port binds to localhost and Caddy supplies forwarding headers. Keep that port private when self-hosting. The hosted deploy passes these settings and the storage settings through to the container. Uploads retain their separate OPENBELT_FILES_* limits.

Runs, browsers and request sizes

Function, query and execute runs, check_app's browsers and request bodies are bounded so that one person can't take the machine's memory, at any number of workspaces:

SettingDefaultWhat
OPENBELT_SANDBOX_RUNS16sandbox runs under way at once on the machine; the rest wait in line
OPENBELT_SANDBOX_TENANT_RUNS6of those, one workspace's
OPENBELT_SANDBOX_PARKED16runs waiting on a ctx.call at once (each keeps its heap); past it, refused
OPENBELT_SANDBOX_TENANT_PARKED8of those, one workspace's
OPENBELT_SANDBOX_MACHINE_PROCESSES16sandbox processes kept (about 60 MB each at rest); the longest idle ends
OPENBELT_SANDBOX_RECYCLE_MB160a sandbox process that grew past this ends once idle (its heap stays)
OPENBELT_CHECKS_AT_ONCE4check_app browsers at once (about 150 MB each), half per workspace; a check waits up to 20 s

A page in check_app's browser (or a deploy's picture) holds at most 512 MB of JavaScript heap; past it the page crashes and the check says so. Chrome runs with core files off, so a crashed page leaves no dump of what it held on the machine, and no core handler (systemd-coredump) holds the crash up while it writes one.

Each run may hold OPENBELT_SANDBOX_RUN_MB (128) of heap, so OPENBELT_SANDBOX_RUNS plus OPENBELT_SANDBOX_PARKED times that, plus the processes and browsers, bounds the container's memory (OPENBELT_MEMORY_LIMIT; runs rarely use all of their heap); raise them together. A run waiting on a ctx.call gives its place to the run it called, which goes ahead of new runs. Should the container still run out of memory, the kernel ends a sandbox process first, then a browser, never the platform's processes before them (oom_score_adj); the supervisor outlives a platform process that ends with runs in flight.

An MCP request is at most 64 MB (413 past it, read no further), and a connection's server's reply at most 16 MB (the call fails, saying so). Each platform process holds at most 192 MB of MCP requests at once, and 80 MB of one person's (by email, across their workspaces), from before the first byte is read until the answer; past either, 503 busy with Retry-After: 5, read no further. 60 requests of 63 MB at once from one person took a 4 GB container through its swap until the kernel ended a platform process. Before these, 40 parallel execute calls of 96 MB, one 1 GB MCP request, or a connection answering tools/list with 1.2 GB each ended a platform process on a 4 GB container, and the supervisor with it.

Stopping and crashes

Measured on a Mac, from the kill to the first answer (the crash-recovery check holds these rows):

What diesWhat happens
The platform, stopped with SIGTERM (docker stop, a host shutdown)It stops in order (below) in about 2 to 5 seconds, nothing lost; started again, it answers in under a second.
The platform, killed (SIGKILL, OOM, power loss of the process)Started again on the same data, it answers in 466 ms. Nothing acknowledged is lost (kill -9 under 24,187 acknowledged writes: none). An app that only its schedule wakes runs again with nothing requesting it: each process arms the wake-ups in its wake file when it starts, and runs what came due.
One of its processes (OPENBELT_PROCESSES above 1)The supervisor starts it again: its objects answer again in 1.4 s, the other processes' all along.
The machine (a kernel panic, a power cut, the disk kept)As a kill, but the last second of acknowledged writes may be lost: each file is synced once a second (The data).

Losing the machine loses its disk, and the data with it. Keep the data directory on a volume that outlives the machine (EBS, a Hetzner Volume, a Persistent Disk) and attach it to the next one: what was synced is there. Without one, restore from what was copied off it: the continuous copy loses about the last second or two, a backup what came after it (Backups).

The platform, sent SIGTERM, stops in order (shutdown: lines, below): /_health answers 503 for 2 seconds while it still serves, so a proxy in front moves on; then it stops taking requests and lets those under way finish (5 seconds at most); each object finishes its events under way (6 seconds at most) and is put to sleep, which syncs and closes its file; about 2 to 5 seconds in all, 22 at most.

Let stops finish. compose.yaml gives the platform stop_grace_period: 30s (Docker's default 10 seconds can cut a stop short, which is a kill). If your supervisor has its own timeout, set it above 22 seconds.

Deploys without client errors

A deploy stops the platform and starts the new version on the same data, behind a proxy that holds each request while it restarts (about a second) and sends it once /_health answers. With Caddy:

https:// {
    reverse_proxy openbelt:1337 {
        lb_try_duration 30s
        lb_try_interval 100ms
        health_uri /_health
        health_interval 250ms
        health_timeout 1s
        health_passes 1
        health_fails 1
        fail_duration 1s
    }
}

The old platform answers /_health 503 for its first 600 ms of stopping, so the proxy stops sending to it before it stops taking connections; each object it held finishes what it was doing first, and wakes in the new one on its next request. A page's socket closes and the SDK opens it again with ?since=, getting what changed meanwhile; an MCP session carries on. The deploy-swap check proves it with this block (Production), and bun run deploy deploys this way.

Backups

bun run data backup <dest> [--data <dir>] copies the data directory while the platform runs: it holds <data>/.snapshot.lock, which keeps every platform from checkpointing or closing an object's file meanwhile, so each file's database stays as it was and its WAL only grows, and the copy opens like a file after a crash, with every write acknowledged before the copy began. A clone where the filesystem can (APFS, btrfs, XFS): 15 ms on a Mac for a test's data. bun run data restore <backup> [--data <dir>] puts one back with the platform stopped, setting what was there aside beside it. A standby is a restore into its own directory: the standby check restores one and answers in 455 ms, holding every write made before the backup. --data defaults to OPENBELT_DATA, else ~/.openbelt/data. The compiled server does the same with no Bun or checkout: openbelt-server data backup|restore|restore-backup takes the same arguments (The compiled server).

Continuous copies off the machine come from the platform itself (runtime/replicate.ts), when OPENBELT_BACKUP_URL is set (s3://<bucket>/<prefix>?endpoint=<host> with OPENBELT_BACKUP_KEY_ID and OPENBELT_BACKUP_SECRET, or file:///<dir>): after each commit an object's thread reads what its WAL gained, and each process uploads all of it as one gzipped object every OPENBELT_BACKUP_SECONDS (1), whatever the number of files; a changed file is also uploaded whole when it opens, when it closes and every OPENBELT_BACKUP_SNAPSHOT_SECONDS (300), and older batches are deleted once every file in them has a newer snapshot. Each start (a deploy, a restart) also takes a base beside the processes: every file once, from a copy made under the snapshot lock, then every batch from before the copy is deleted, the ones a stopped process left included. So the bucket holds about the data once plus what changed since the last start, however many deploys came before. It lists nothing while it runs (the base lists once) and never holds up a commit or the start. Losing the machine loses about the last second or two: the replication check restarts the platform as a deploy does, kills it mid-write while its base goes up, restores from the bucket alone into an empty directory, and finds every write acknowledged more than 3 s before the kill (measured: the losses, when any, all within 0.41 s of it). On a laptop with 20,000 files: about one PUT a second per process, no LIST or GET, and a restore in 35 to 64 seconds.

Moving off the Rivet engine

Before this version, OpenBelt ran its objects on a Rivet engine, which kept their data (or, at the end, placed them while their data was already in files). This version reads only its data directory: bun run tailnet and bun run deploy refuse a setup whose data is still in an engine (the tailnet's engine directory, a server's state.json from the blue and green slots) and point here; verify:upgrade and verify:rollback skip a base that kept its data there. An export from an engine to a data directory is pending; until it lands, keep such an instance on the last Rivet build (805f486).

Working in parallel

Every checkout of the repo runs on its own, side by side: the main one, a git worktree add, a claude --worktree or a subagent's worktree, a herdr worktree.

How a local instance is isolated

scripts/verify/launch.ts starts the server (packages/platform/src/server.ts) on a free port in a new namespace of the verify data (OPENBELT_DATA=.verify/data, OPENBELT_NAMESPACE=verify-<random>: a folder of its own), with a test token. It prints {url, mcp: {url, token}, namespace, ...}; scripts/verify/stop.ts <runDir> stops it and everything it started (a check's Chrome). The data stays in the namespace's folder: launch again with --namespace to carry on from it, as an upgrade does.

Local and deployed differ in a few ways

Updating marketing artwork

The homepage film's source lives in brand/film/. Its intro uses the CC0 metal clasp recording documented in brand/film/sounds/README.md, embedded in both the player and exported score. bun run brand film --page builds the local player; bun run brand film renders both video sizes. Follow brand/AGENTS.md to upload them under a new media folder and update the homepage sources.

The platform serves marketing assets with ETags and Cache-Control: no-cache: unchanged assets return 304, while edits are checked on the next visit. bun run brand sync bundles the brand stylesheet's imports into www/brand/css/openbelt.css. The homepage preloads its two main fonts and waits until the story is near the viewport to load its poster; distant logos load lazily. The homepage uses Speculation Rules to prefetch /signin on hover or pointer press in supporting browsers. Other browsers follow the Sign in link normally. The rule covers only that destination. Workspace pages also hover-prefetch Connections, Settings and its tabs, the connection catalog and app cards. An app card's prefetch is the workspace's frame page only, so it wakes no app and counts no open. These rules match exact links, excluding query strings and OAuth actions. They prefetch HTML without running the destination's scripts; browsers without support navigate normally.

Keep third-party artwork in www/assets/ separate from OpenBelt's own brand/ assets. Record the owner's source, permitted treatment and any required attribution in www/assets/README.md. Preserve supplied colors and proportions; a collection's license does not settle trademark permission. Pending reviews are listed there.

The compact logo rows move on touch screens. Tap an icon to show its name and pause its row; tap elsewhere to dismiss it. A swipe does not leave a name selected. On a keyboard, Tab reveals each name, stops its row, and brings the focused icon into view. Animated duplicate icons stay hidden from assistive technology and cannot receive focus.

After changing the artwork, run bun run design:shots artwork --only marketing --launch to check the homepage at desktop and phone sizes, then run bun run check.

OpenBelt brand assets

OpenBelt's own pages use the prebuilt tiles and wordmarks in brand/logo/, copied to www/brand/logo/ by bun run brand sync. Choose the asset from the brand asset table. Standard tiles contain a centered 54% mark; only 16–32px browser favicons use the larger 62% mark. MCP server icons use the 54% Ink tile (tile-ink.svg), and animations use the light tile. User apps may use their own branding.

Source: docs/running.md on GitHub