BBramaDocs

Brama architecture: ownership and trust

Ownership and boundaries

Brama is one Rust process (axum) serving one HTTP listener. Its entire job is to turn an authenticated, alias-shaped model request into one provider HTTP call, paying with a credential it held for exactly that call. This page states what belongs to Brama, what belongs to somebody else, the rule enforced at each trust boundary, and who the neighbours are. For the listener, the request path and the files on disk, see request path and state.

What Brama owns

  • Routing. Alias resolution produces exactly one route: the registry maps an alias to a single destination, and that destination is the one Brama dispatches to. Selector ranking is a separate mechanism — it picks a subscription candidate for a signed agent asking for best or a task: selector. When a resolved route refuses the call, the refusal is reported to the caller; no second route is attempted (concepts/alias, concepts/entitlement). The admin snapshot states the boundary split Brama operates under: "boundaries": {"credentials": "skarbiec", "releases": "stado", "routing": "brama"} (captured from /v1/admin/snapshot).
  • The credential seam. Redeeming capabilities and subscription credentials at final use, refreshing OAuth grants ahead of expiry, and recording what each redemption concluded (concepts/capability, concepts/subscription).
  • Its own records. The usage ledger, the append-only journal, process telemetry, and the donated-subscriptions metadata overlay (state on disk).
  • The shape of the route registry. Brama reads a document with three known top-level fields — schema_version (whose value is the number one), deployments and routes — and rejects a document carrying any other top-level field. brama routes migrate brings an operator's existing file to that shape without hand editing.

What Brama is not

  • Not an agent runtime — Jeden is the runtime; Brama performs provider HTTP requests only.
  • Not placement — Stado owns placement and stages the owner-only inference route snapshot Brama re-reads per request (concepts/alias).
  • Not a secret store — Skarbiec is the authority for credentials; Brama receives capability handles until the final-use seam and holds no secret at rest.
  • Not a router of second chances — an alias has one destination, so an unhealthy destination is an unserviceable alias (503 alias_unserviceable carrying details.state and details.route), not a signal to dispatch somewhere else.
  • Not an identity provider, billing ledger, or system of record for provider accounts; and it never infers task intent from prompt text — task: selectors use previously recorded, explicitly named quality evidence only.

Trust boundaries

Boundary Rule
Transport loopback, own bound address, BRAMA_ENCRYPTED_PEER_IPS, or BRAMA_TRUSTED_PROXY_IPS with https forwarded headers; everything else 426. Forwarded headers from unlisted peers are never trusted
Caller bearer table and Skarbiec introspection classify workload/model clients; canonical Wisent Supabase plus authorize_organization classifies humans and verifies X-Wisent-Organization-ID; human cache keys include bearer digest + organization ID; a caller that cannot be classified is refused (concepts/client-identity)
Agent HMAC-SHA256 trio over the exact raw body, each signature accepted once and never one signed before the newest accepted; bearer-bound, signed, and path agents must agree (concepts/entitlement)
Admin /v1/admin/* answers only brama-desktop; /v1/account/* only a verified Wisent human (brama-user) with organization context, while subscription ownership remains user-scoped
Secrets Skarbiec broker socket, owner-bound; capabilities single-use, ≤1 h; plaintext only inside the one provider call; standalone mode keeps a zeroizing in-memory map
Providers exact trusted HTTPS hosts, redirects disabled, ambient proxies bypassed; loopback only via explicit BRAMA_PROVIDER_<X>_BASE_URL override (concepts/provider)
Route registry owner-only regular file, no symlink, no group/other access; endpoints loopback or Tailscale IPv4 only; an unknown top-level field makes the deserializer reject the whole document
Vault listing shelled to the local entitlements router; donated plaintext crosses only the request body and the router's stdin pipe

Admin writes to the registry

The routing boundary is writable only through two admin calls, both answering {"ok":true,"routes":<document>} with the committed document:

PUT /v1/admin/routes
{"alias": "chat-prod", "primary": "deploy-oslo"}

DELETE /v1/admin/routes
{"alias": "chat-prod"}

The PUT body is exactly {"alias","primary"}; there is no field for a second destination, and an unknown field is refused with the deserializer's own sentence. See http-api for the full surface.

Neighbours

  • Skarbiec issues and redeems capabilities, introspects bearers, and stores subscription grants; the launcher provisions this installation's workload trust material once.
  • Stado declares inference deployments and the desired alias-to-route mapping, and stages the route snapshot; Brama reloads it per request and never supervises the engine behind it.
  • Jeden (and the other agents) call Brama with a bearer plus their HMAC identity; their subscriptions pay for best and the selectors.
  • Brama Desktop is the operator console behind the brama-desktop identity; Wisent Identity verifies desktop user sessions for the account routes.