The Electron desktop app and web SPA for MindsHub Cowork — MindsDB's AI coworker platform. Cross-platform: macOS and Windows installers, and an unsigned Linux .deb (amd64 and arm64) built on every staging and prod run and on a PR with the build-linux-deb label, with no apt repository or update feed. It auto-installs the backend on first run, and provides a chat-based UI backed by a FastAPI server, with Minds integration.
The project is split across two repos:
The frontend and backend are developed and released independently. At runtime, the Electron main process spawns cowork-server as a local sidecar and communicates with it over HTTP ( 127.0.0.1:26866 ). Both the UI and server support over-the-air updates — see Over-the-Air Updates .
On deployments with selective project sharing, a recipient sees shared projects in Projects with a read-only file view. Files are addressed by project UUID, so an owned project with the same name stays separate. Received projects show the last eight characters of that UUID on their cards and file views, with the full project ID in a tooltip, to distinguish equal names without revealing owner identities. Shared projects are excluded from task, schedule and move pickers, and send handlers reject them. HTML is shown as text; downloads use authenticated requests. The view rechecks access on focus and every 15 seconds, clearing its contents if access is revoked or a recheck gets no answer within 10 seconds. The server enforces these restrictions and must support /shared-projects/{id}/files ; older deployments keep their existing project behavior.
MindsHub Cowork runs in several contexts. The React SPA is identical across all of them — only the shell and server lifecycle differ.
Docker builds with a supplied dependency lock
For an exact server environment, put a hashed requirements.lock and Git source identities in server-lock/ , then run:
The contract selects both server and anton, replacing the ordinary version/ref arguments. Registry packages install from exact hashed wheels before either app is imported. The installer checks the complete environment, source commits, dependency compatibility, and the PyJWT security floor. A missing artifact or a mismatch fails the build; it does not select a newer package. Change the supplied contract explicitly when updating dependencies.
Builds without COWORK_SERVER_LOCK=true select a server version or Git ref and consume that release's dependency contract, as described below. Git build backends, apt packages, and the frontend have separate build inputs.
The Environments table above covers how you run the app. A build channel (or "kind") covers which env it targets and where it stores its data . Every launch resolves to one of four kinds. src/main/channels.ts is the source of truth: its CHANNELS table maps each kind to a data , API host, and default sidecar branch, and every other layer derives from it.
How the kind is decided ( resolveBuildKind ): a COWORK_BUILD_KIND env var wins if set; otherwise any unpackaged run is dev ; otherwise the kind comes from the bundled build-config.json , and an absent config falls back to prod . So dev only exists when you run from source — it is never packaged into a distributed installer. CI stamps build-config.json with preview , stable , or prod when it packages those.
Ordinary local pack / dist produce a prod package. npm run pack and npm run dist bundle the checked-in build-config.json ( {"buildKind":"prod"} ) as-is — nothing stamps it — so the launched app resolves the prod kind and uses the ~/.cowork and the prod API. Setting COWORK_BUILD_KIND for the pack does not make a non-prod package: the env var is never written into the bundle, and pack 's plain electron-builder --dir also skips the per-kind bundle identity applied by scripts/run-electron-builder.mjs . So COWORK_BUILD_KIND=stable npm run pack yields a prod-identity bundle that still resolves prod at launch, while a staging VITE_MINDS_API_URL bakes the staging host into the renderer — a prod- app talking to staging. A real non-prod package is a CI-only path (CI writes build-config.json with the target kind and runs the identity-aware packaging scripts). To exercise a non-prod kind locally without packaging, run from source ( npm run dev = the dev kind), or launch the packaged binary with COWORK_BUILD_KIND set in its environment — that runtime env var does win in resolveBuildKind , overriding the prod bundle onto the non-prod and keychain (pair it with a matching baked VITE_MINDS_API_URL so the API host agrees).
Ordinary local pack / dist produce a prod package. npm run pack and npm run dist bundle the checked-in build-config.json ( {"buildKind":"prod"} ) as-is — nothing stamps it — so the launched app resolves the prod kind and uses the ~/.cowork and the prod API. Setting COWORK_BUILD_KIND for the pack does not make a non-prod package: the env var is never written into the bundle, and pack 's plain electron-builder --dir also skips the per-kind bundle identity applied by scripts/run-electron-builder.mjs . So COWORK_BUILD_KIND=stable npm run pack yields a prod-identity bundle that still resolves prod at launch, while a staging VITE_MINDS_API_URL bakes the staging host into the renderer — a prod- app talking to staging. A real non-prod package is a CI-only path (CI writes build-config.json with the target kind and runs the identity-aware packaging scripts). To exercise a non-prod kind locally without packaging, run from source ( npm run dev = the dev kind), or launch the packaged binary with COWORK_BUILD_KIND set in its environment — that runtime env var does win in resolveBuildKind , overriding the prod bundle onto the non-prod and keychain (pair it with a matching baked VITE_MINDS_API_URL so the API host agrees).
Things that trip people up:
"Staging" is the stable kind. The internal name is stable and its is ~/.cowork-stable . Users see the label "Staging", and it targets the staging env. The name is historical.
Only prod talks to production. The other three kinds target api.staging.mindshub.ai . Keycloak follows the API host ( api.X → auth.X ), so their auth resolves to auth.staging.mindshub.ai . A bare dev run must never authenticate against prod. No build targets a dev API env — that realm is effectively dead.
prod keeps the historical paths. Its is ~/.cowork and its Electron userData name stays anton , never re-set. Every other kind uses ~/.cowork- and its own userData name.
Where each channel saves its data
A channel's state is not all under one folder. It spreads across several locations, each keyed on the build kind so channels never clobber each other. Non-prod kinds keep their state under (or near) ~/.cowork- ; prod keeps every historical global location, byte-for-byte unchanged. Paths below are for macOS.
The packaged bundle identity ( appId , productName , icon, Linux package name) is also set per kind at build time ( scripts/channel-identity.mjs ), so non-prod builds install as distinct apps beside prod.
Everything under the ~/.cowork- — the data , uv install, and non-prod server logs — is identical on every OS; only ~ resolves differently. The three OS-managed locations follow each platform's convention:
The fresh-install reset function below wipes all of these locations; use it as a checklist of everywhere state hides.
Caveat — standalone cowork-server defaults to prod. The Electron shell enforces the split by injecting COWORK_HOME . A cowork-server launched outside the desktop app — a bare uv run cowork-server , or an Alembic command — inherits no COWORK_HOME and silently targets the prod ~/.cowork . Set the target explicitly before any standalone DB or migration work: COWORK_HOME=~/.cowork-dev (or DATABASE_URI=sqlite:///$ /.cowork-dev/cowork.db ). Back up the target .db first.
Caveat — standalone cowork-server defaults to prod. The Electron shell enforces the split by injecting COWORK_HOME . A cowork-server launched outside the desktop app — a bare uv run cowork-server , or an Alembic command — inherits no COWORK_HOME and silently targets the prod ~/.cowork . Set the target explicitly before any standalone DB or migration work: COWORK_HOME=~/.cowork-dev (or DATABASE_URI=sqlite:///$ /.cowork-dev/cowork.db ). Back up the target .db first.
Both dev modes expect a sibling cowork-server directory (override with COWORK_SERVER_DIR ):
Or jump straight into dev mode:
In dev mode the server runs from source ( uv run cowork-server ), so local Python edits are picked up immediately.
Environment variables
Copy .env.example to .env and fill in any optional tokens (e.g. VITE_POSTHOG_MINDSHUB_MAIN_PROJECT_TOKEN for analytics). Vite auto-loads .env at build/dev time. The .env file is gitignored.
Dev Mode With Inspector
This opens the Electron app against the Vite dev server and auto-opens Chromium DevTools in a detached window. It runs three processes concurrently:
tsc --watch for main process
vite dev for renderer (port 5173)
Electron with VITE_DEV=1 flag
DEV_MODE (packaged app testing)
When testing a packaged build ( npm run pack ), the DEV_MODE variable in ~/.anton/.env controls which renderer the app loads:
To set it, add DEV_MODE=full (or live ) to ~/.anton/.env . Remove the line to return to production behavior. When DEV_MODE is set, the OTA update check is skipped entirely.
Tip : If you build the app and it looks outdated, the OTA cache may be serving an older published bundle. Either set DEV_MODE=full to bypass it, or clear the cache: rm -rf ~/Library/Application\ Support/anton/ui-cache/current
Tip : If you build the app and it looks outdated, the OTA cache may be serving an older published bundle. Either set DEV_MODE=full to bypass it, or clear the cache: rm -rf ~/Library/Application\ Support/anton/ui-cache/current
Fresh-install reset (macOS)
To test first-run onboarding you need a true fresh-install state. App state hides in several places: the cowork homes ( ~/.cowork plus per-build-kind variants), the legacy ~/.anton , the Electron userData dirs ( one per build kind — prod's anton plus the Dev/Preview/Staging apps), the prod log dir, the per-channel shell-update caches ( anton-updater-{prod,stable} ), the uv-managed tool installs, and the macOS Keychain (connector OAuth tokens, one service per kind : cowork-oauth plus cowork-oauth-{dev,preview,stable} ). This zsh function wipes them all — drop it in ~/.zshrc :
The cowork SPA also runs as a plain web app, served by the same FastAPI backend. The renderer is shell-agnostic — there is one source tree, one component library, and two entrypoints.
Web development defaults to MindsHub UI off. In this build, Settings hides LLM Providers and Model Router, the composer hides model and reasoning-effort controls, and questions send model: null without a reasoning_effort override. The server uses its configured models and role-specific efforts. To configure providers and models in the development UI, run VITE_PLATFORM_UI=true npm run dev:web .
This boots both processes:
The cowork-server FastAPI backend on 127.0.0.1:26866 (via uv run cowork-server from the sibling source directory).
Vite dev server on localhost:5173 , with BUILD_TARGET=web .
The dev server opens at (a small Vite middleware rewrites / → /index-web.html so the bare URL is canonical). API calls hit the FastAPI sidecar via Vite's /api proxy. Press Ctrl-C once for a clean shutdown — vite quiesces first, then the python child.
Build a production bundle
Outputs to dist/renderer-web/ (separate from dist/renderer/ which is the Electron build). Drop this directory behind any static-file server and point its /api requests at a running cowork-server process.
Settings > Appearance lets web users upload a browser tab icon independently of the sidebar logo. PNG, ICO, SVG, and WEBP files must be smaller than 100 KB; a square image of at least 32 × 32 pixels works best. Changes preview immediately and persist through the settings API. Removing the override restores the page's original icon, including a deployment's custom branding. Desktop does not show this control, and the browser's -screen icon is unchanged.
A web build with MindsHub UI off ( BUILD_TARGET=web and VITE_PLATFORM_UI not true ) reads an optional brand from its own origin when the page loads. One build then serves any number of deployments, and a deployment changes its brand by serving different files, with no rebuild. Hosted web and desktop never load a brand: their HTML has no reference to it.
The build marks the stock title, favicon and icon links with and . A deployment server can replace that entire region with its escaped title and literal icon links before sending the page. The markers appear only in web builds with MindsHub UI off. Without a replacement, the stock content stays.
The blocking brand script and title line follow this region, before the app's bundle, so the first render already has the brand. The script must never be async or defer . The stylesheet goes last in . Cowork ships empty stock files in src/renderer/public/brand/ , and scripts/spa_wrapper.py and the frontend image's nginx ( scripts/nginx-frontend.conf ) serve them, so a deployment that serves nothing of its own looks stock. A hosted deployment that serves its own brand mounts its files over the image's /brand/ folder. nginx sends them with Cache-Control: no-cache and an ETag, and answers a missing one with a 404.
scripts/spa_wrapper.py marks its HTML shell responses with X-Cowork-Spa-Shell: 1 , including / , /index-web.html and deep client routes. Assets, API responses and redirects have no such header. A deployment proxy can use the header to distinguish the shell from other HTML. The build rejects missing, duplicate or reordered title and icon anchors, and markers already present in the source.
The hosted build adds the draft hosts to the page's CSP meta tag as well. That tag allows same-origin scripts, inline scripts, styles and images, so the brand's script, its title line, its stylesheet and its images load there too. Both changes are made at build time, and either order gives the same page.
Every field is optional. A field that breaks its rule is ignored, with one console warning, and the rest still apply. Unknown keys are ignored, so the format only ever gains optional fields.
A person's own Settings win over the brand: a sidebar title, logo or tab icon set there is shown instead, and clearing the tab icon brings back the brand's. The style is the one exception while the brand sets skinLocked: true . If brand.js doesn't load, or doesn't set an object, the page shows stock names, styles and icons with no style lock, and logs one console error naming the file. A server that serves the brand should send Cache-Control: no-cache with an ETag, so a changed brand shows after a reload.
The cowork tree ( src/renderer/cowork/ ) never touches window.antontron directly. All host-bridge access goes through src/renderer/platform/host.ts , which exposes:
Affordances that depend on Electron-only bridge calls (server pill + power button in the sidebar, "Open in OS" / "Show in Finder" / "Move to Trash" buttons in the artifact views, the ServerOfflineHelpModal ) are hidden when host.isWeb is true.
vite.config.ts branches on BUILD_TARGET=web : when set, rollupOptions.input points at index-web.html and outDir becomes dist/renderer-web/ . When unset (the Electron path), behavior is byte-identical to before.
FastAPI sidecar : The Electron main process manages the cowork-server Python FastAPI backend on 127.0.0.1:26866 , installed from PyPI via uv tool install . The renderer communicates exclusively through this HTTP API — there is no PTY or terminal emulator.
FastAPI sidecar : The Electron main process manages the cowork-server Python FastAPI backend on 127.0.0.1:26866 , installed from PyPI via uv tool install . The renderer communicates exclusively through this HTTP API — there is no PTY or terminal emulator.
Minds integration : The GUI replicates the /connect flow — lists minds via REST API, handles datasource selection (normalizes string/object refs), and writes non-credential config to ~/.cowork/.env . The MindsHub credential itself is never written there; see MindsHub credentials .
Minds integration : The GUI replicates the /connect flow — lists minds via REST API, handles datasource selection (normalizes string/object refs), and writes non-credential config to ~/.cowork/.env . The MindsHub credential itself is never written there; see MindsHub credentials .
OTA updates : The React UI and the Python backend update over-the-air (coupled, auto-applied at boot) without a new installer; the Electron shell auto-updates on stable/prod via electron-updater , installing on relaunch. See Over-the-Air Updates .
OTA updates : The React UI and the Python backend update over-the-air (coupled, auto-applied at boot) without a new installer; the Electron shell auto-updates on stable/prod via electron-updater , installing on relaunch. See Over-the-Air Updates .
All channels defined in src/shared/ipc-channels.ts :
Provider validation is answered in main, not proxied to the sidecar
settings:validate is handled entirely in the main process. The IPC handler is in src/main/app.ts and the validators it calls ( validateMinds , validateOpenAICompatible , validateAnthropic ) live in src/main/provider-validation.ts . It never reaches the Python sidecar. The same logic also lives in the sidecar ( cowork-server/cowork/services/providers.py ), and that copy answers POST /api/v1/settings/validate-provider , which is the path the web build takes because it has no main process.
So a change to how a provider is validated has to land in both places. The two have drifted before: a fix that moved the MindsHub probe onto the free model landed in the sidecar and left main probing a paid one, and probing a paid model means an account with an empty wallet is told its working key is invalid.
The rule both copies follow: probe mindshub_air , whose usage draws the free included allowance rather than the wallet, so the result reports reachability and key validity instead of billing state. For openai-compatible and anthropic a model the caller asked for explicitly is sent as asked; provider: 'minds' always sends the probe model and ignores model on both copies.
Which copy a given build actually runs is decided by the onboarding screen, not by the platform alone. The MindsHub card renders a pasted-key form on web and Keycloak sign-in buttons on Electron ( OnboardingScreen.tsx ), and the pasted-key form is the only caller that passes provider: 'minds' . Since host.validateProvider reaches this IPC channel only under Electron, main's validateMinds has no live caller : on desktop the MindsHub path goes through mindshub:finalize , which provisions a key and probes no model. The validators a packaged build does run are the openai-compatible and anthropic ones, from the BYOK step. Main's MindsHub probe is kept in step with the sidecar anyway, because the drift is what caused this bug and a future caller should not have to rediscover it.
Rollout is not symmetric between the two. On prod the renderer bundle hot-updates at boot, while the Electron shell (so everything under src/main/** ) downloads its own update in the background ( shellAutoUpdateEnabledFor in src/main/shell-auto-update-rollout.ts , on by default for prod and stable ) and only changes on the relaunch — so each new UI first runs on the shell until the user quits. On stable only the shell moves: UI OTA is prod-only ( otaUiEnabled in src/main/update-logic.ts ). Either way a main-process change lands a relaunch later than a sidecar change, and how far a prod shell may fall behind before the UI says so is the "Supported desktop window" in docs/update-behavior.md . See Shell updates .
The GUI provides a visual /connect flow:
If LLM provider is Minds (from onboarding), credentials are pre-filled
Lists available minds via GET /api/v1/minds/
Handles datasource selection (auto-selects if only one)
Fetches engine type via GET /api/v1/datasources
Writes to ~/.cowork/.env : ANTON_MINDS_URL ANTON_MINDS_MIND_NAME ANTON_MINDS_DATASOURCE ANTON_MINDS_DATASOURCE_ENGINE ANTON_MINDS_SSL_VERIFY
ANTON_MINDS_MIND_NAME
ANTON_MINDS_DATASOURCE
ANTON_MINDS_DATASOURCE_ENGINE
ANTON_MINDS_SSL_VERIFY
Writes mind's system prompt to project cortex
Auto-restarts the server to pick up new config
ANTON_MINDS_API_KEY is deliberately absent from that list — see below.
The app writes no MindsHub credential to disk. Signing in gets you a Keycloak session (Authorization Code + PKCE, refresh token in OS secure storage, access token in memory), and that access token is what the sidecar presents to the gateway. MindsHub's /v1/authenticate/ accepts a JWT and an mdb_ key alike, picking the branch from the token's shape.
The sidecar is a separate process, so the value has to cross that boundary. It crosses over loopback rather than through a file: main holds it and PUTs it to /api/v1/runtime-credential/minds , which the sidecar keeps in memory and overlays onto its settings. src/main/minds-credential.ts owns that hand-over.
Four consequences worth knowing:
Every sidecar start needs a fresh hand-over. Nothing persists the value, so a sidecar that has just come up holds nothing and /health answers config_ready: false until main pushes again. The renderer paints that answer as "Connect a provider to start chatting", so a signed-in user reads a wiring gap as a billing prompt. The sidecar goes down far more often than a launch: an over-the-air update and its rollback, the sidebar's stop/start, and the installer's first start on a fresh machine. Wiring the push into each of those is how one gets missed, so it hangs off the single function they all call. src/main/app.ts registers handOffMindsCredentialToStartedSidecar with setServerStartedHook , and startServer awaits it after every successful start ( src/main/server-process.ts ). That hook also releases the wake barrier below, because a sidecar restarting mid-hand-over is exactly when a turn is parked waiting for one. It is awaited rather than fired off, because callers read /health as soon as startServer resolves. Sign-in and the token-refresh tick push on top of that, since both produce a new credential without restarting anything.
Every sidecar start needs a fresh hand-over. Nothing persists the value, so a sidecar that has just come up holds nothing and /health answers config_ready: false until main pushes again. The renderer paints that answer as "Connect a provider to start chatting", so a signed-in user reads a wiring gap as a billing prompt. The sidecar goes down far more often than a launch: an over-the-air update and its rollback, the sidebar's stop/start, and the installer's first start on a fresh machine. Wiring the push into each of those is how one gets missed, so it hangs off the single function they all call. src/main/app.ts registers handOffMindsCredentialToStartedSidecar with setServerStartedHook , and startServer awaits it after every successful start ( src/main/server-process.ts ). That hook also releases the wake barrier below, because a sidecar restarting mid-hand-over is exactly when a turn is parked waiting for one. It is awaited rather than fired off, because callers read /health as soon as startServer resolves. Sign-in and the token-refresh tick push on top of that, since both produce a new credential without restarting anything.
A wake can hold your message for up to 12 seconds. Sleeping past the access token's ten-minute life leaves the sidecar holding a JWT the gateway will reject, so a resume near expiry arms a barrier over POST /api/v1/responses and /responses/answer until the refreshed value has been accepted. src/main/minds-resume-gate.ts owns it. Three things bound the damage. It waits at most MINDS_RESUME_READY_TIMEOUT_MS (12s) and then cancels the request, which stays under the renderer's ~13s stranded-reservation reap so a held turn fails visibly instead of vanishing with its thinking placeholder still on screen. It only arms when the sidecar's /health says a resolved required planning or coding role actually uses the runtime MindsHub credential, so direct OpenAI and Anthropic turns are never held. And Stop is deliberately outside it. An unknown or unreachable health answer is treated as "needs it", because an older sidecar cannot prove otherwise.
A wake can hold your message for up to 12 seconds. Sleeping past the access token's ten-minute life leaves the sidecar holding a JWT the gateway will reject, so a resume near expiry arms a barrier over POST /api/v1/responses and /responses/answer until the refreshed value has been accepted. src/main/minds-resume-gate.ts owns it. Three things bound the damage. It waits at most MINDS_RESUME_READY_TIMEOUT_MS (12s) and then cancels the request, which stays under the renderer's ~13s stranded-reservation reap so a held turn fails visibly instead of vanishing with its thinking placeholder still on screen. It only arms when the sidecar's /health says a resolved required planning or coding role actually uses the runtime MindsHub credential, so direct OpenAI and Anthropic turns are never held. And Stop is deliberately outside it. An unknown or unreachable health answer is treated as "needs it", because an older sidecar cannot prove otherwise.
A key you supply yourself goes to the OS keychain , not to .env and not to the sidecar's settings table. It wins over the session credential while it is set. mindshub:set-user-key is the IPC channel that carries it.
A key you supply yourself goes to the OS keychain , not to .env and not to the sidecar's settings table. It wins over the session credential while it is set. mindshub:set-user-key is the IPC channel that carries it.
Signing out takes the credential away , and an install upgrading from a build that minted a per-device key is signed out once so that key can be revoked while the session still names the organization it belongs to.
Signing out takes the credential away , and an install upgrading from a build that minted a per-device key is signed out once so that key can be revoked while the session still names the organization it belongs to.
Sign-out answers as soon as the credentials are gone. It also restarts the sidecar, to flush provider objects that might still hold the user's credential in memory, and that restart runs in the background rather than holding the : the stop and start together are capped near 190 seconds, and longer behind a start already in flight, which is far past what anyone waits in front of a confirm dialog. src/main/sign-out-restart.ts owns it and is single-flight. Signing the user in waits for it, so their credential is not handed to a sidecar the restart is to take down, and boot routing answers "not configured" until it settles.
Sign-out answers as soon as the credentials are gone. It also restarts the sidecar, to flush provider objects that might still hold the user's credential in memory, and that restart runs in the background rather than holding the : the stop and start together are capped near 190 seconds, and longer behind a start already in flight, which is far past what anyone waits in front of a confirm dialog. src/main/sign-out-restart.ts owns it and is single-flight. Signing the user in waits for it, so their credential is not handed to a sidecar the restart is to take down, and boot routing answers "not configured" until it settles.
A sidecar you start by hand, outside the app, therefore has no MindsHub credential. Set ANTON_MINDS_API_KEY yourself with a key minted in the console if you need one for that.
The MindsHub hub routes
Nothing under /api/v1/hub/* calls MindsHub directly. The renderer calls its own sidecar, which forwards on the caller's behalf. /api/v1/hub/usage/ carries the free MindsHub Air allowance, the balance, the period's credit spend and auto top up state, and backs Settings → Usage and the stopped-task cards. /api/v1/hub/workspaces/ answers the MindsHub workspace listing and backs the workspace selector described in the section.
MindsHub's ingress allows the console origins and no Cowork host, and a per-PR Cowork host cannot be added to a static allow-list. A direct call would therefore work in the packaged app ( webSecurity is off there) and fail in the web SPA. Going through the sidecar is what lets both hosts read the same thing, which is why Settings → Usage is offered on the hosted build and not filtered off it.
The credential goes in X-MindsHub-Authorization , not Authorization . The main process overwrites Authorization on every loopback request with the sidecar's own token, so the Keycloak JWT cannot arrive under that name. The exceptions are requests from the document preview frame, from frames inside it, and requests with no frame: the main process adds no token to those ( src/main/document-preview-guard.ts ).
Only /api/v1/hub/usage/ and the /api/v1/hub/workspaces/ routes send X-MindsHub-Authorization . The sharing reads, /api/v1/hub/teams/ and /api/v1/hub/people/ , send none, because cowork-server answers them from the Authorization the gateway validated ( cowork.principal.caller_bearer ).
The MindsHub workspace selector
A bordered control at the bottom of the sidebar, docked with the account row, names the MindsHub workspace you are working in and opens a listing every workspace you can use with a check on the active one. A MindsHub Workspace is an org-internal container that owns MindsHub resources (API keys, artifacts, model entitlements) and lives in MindsHub. It is not the working folder this app also calls a workspace, which is why the stored key and the code are named hubWorkspace throughout. There is no create entry: workspaces are created in the console, and the last row deep-links there.
One workspace draws nothing. Everyone starts in Default on their own, and a switch offering only the place you are already in asks a first-time reader to work out what a workspace is for no benefit. The control appears once the organization has a second one, which is the first moment "which workspace am I in" has more than one answer. The count is taken on the rows the sidecar offers, which already exclude archived workspaces except the one you are currently in. So a live workspace beside an archived one counts as one and draws nothing, and a live workspace beside the archived one you are in counts as two and does draw. The second case is deliberate: the control is the only way out of a workspace that was archived under you.
It sits at the bottom rather than the top of the rail. A workspace is a container inside the organization, not what a reader starts a task from, and the top of the rail is where the first task begins. It is not a group inside the account either, which is where it shipped first. Two things were wrong with that: the current workspace was invisible until you opened the , which is the opposite of what a scope indicator is for, and the account is where the organization selector lands, so two levels of one hierarchy would have nested inside a identity.
A read that has not settled is retried three times over forty seconds and then left alone. The renderer can mount before the sidecar is listening, so one attempt per session made an ordinary cold-start blip hide the control until the app was relaunched. Two shapes count as unsettled: a thrown transport error or 5xx, and a 200 that says the gate is on but MindsHub could not be reached, which is how the sidecar reports a failed hop to MindsHub in band. A 404 is not retried, because a sidecar without the route will not grow one, and neither is a gate-off answer, because it is definite.
After a successful desktop organization switch, useMindsOrgs notifies useHubWorkspaces to discard the old listing and read the new organization. Late reads and workspace switches from the old organization cannot replace it. If leaving an archived workspace hides the focused selector, focus moves to the sidebar's Settings button. Focus already moved elsewhere stays there.
The switch is a server-side Statsig gate, not a build flag. MindsHub declares authorization_ui in its own configs/statsig_gates.json , evaluates it with its server SDK, and reports the verdict; cowork-server reads it and passes it on. So one gate governs the console and this app, and turning the surface off does not need an installer. That matters here specifically: src/main/** reaches users only through a new installer, so a CODING_MODE_OPTIONS_ENABLED -style preload flag could not be switched off in an incident. COWORK_HUB_WORKSPACES_FORCE_ON=true on the sidecar is an ON-only development override for walking the surface where no rule targets you.
Picking a workspace changes what this app shows, not what a turn is billed to. Attribution rides the credential a turn presents, and neither credential carries a workspace today.
Which organization the session uses
The access token's activate_organization claim decides whose credits a turn spends. On web it also partitions tasks, settings, and storage; desktop's local database is not organization-filtered. The current server auth path resolves that identity for each request. A turn already in flight keeps the scope it started with; later requests use the refreshed credential's organization.
Packaged desktop sign-in still runs through the Electron bridge and main process. Main owns the Keycloak session and hands its access token to the sidecar at /api/v1/runtime-credential/minds . Its selection rules live in src/shared/minds-orgs.ts , and the Keycloak calls live in src/main/minds-auth.ts .
Three things decide it, in order:
A pick the person made — stored in state.json under preferences.mindsOrganization , keyed by the Keycloak subject so one machine signed into a second account does not inherit the first's choice. Only a pick is ever written: the onboarding picker and the account . Where a sign-in happens to land is not recorded, because the key is a single slot and an automatic write to it would replace whatever a person chose — possibly another account's, which no guard keyed on the stored value can even see.
Company organizations rank ahead of the personal one , which Keycloak names personal_ . Within each group the order Keycloak returned is kept, so "the first company organization" means the same thing on every sign-in.
The claim the token already carried , which used to be the whole answer. That is how turns ended up billed wherever a console tab happened to be pointing.
ensureActiveOrg switches only when the answer differs from the claim, so an account with one organization makes no extra round-trip.
Changing it later happens in the account 's Organization group ( components/UserMenu.jsx , hook hooks/useMindsOrgs.js ). It lives there because an organization is who pays. A MindsHub workspace is a container inside one, which is why its picker is its own control lower down the rail rather than a group in this .
Desktop lists and switches through mindshub:list-orgs and mindshub:switch-org . Main switches the Keycloak session, refreshes its token, and hands that token to the sidecar before it reports success. A later failure switches back, and main stores the preference only after the hand-over succeeds.
Web lists and switches directly against Keycloak through public-client ; cowork-server has no organization-switch write proxy. The selector has no product or authorization feature flag, but it stays hidden until the same-origin server reports organization-boundary protocol v1 as both enforced and enabled. That compatibility handshake lets the transition-aware client deploy before old browser bundles are rejected and the picker is exposed. The shows switch rows only when the listing contains multiple organizations. Names also come from the listing, including the generated label for a personal organization; the token claim supplies only its id. An unsuccessful read times out after ten seconds, keeps the rows hidden, and retries after 2, 8, and 30 seconds.
After Keycloak accepts the web switch PUT , Cowork forces keycloak.updateToken(-1) . A confirmed switch, or any result where the PUT may have committed, clears the settings and composer-draft caches and hard reloads every open same-origin Cowork document. On canonical web, settings and drafts are namespaced by the initial token's subject and organization as well as the durable transition epoch. That keeps a close, external Keycloak switch, and reopen from hydrating the former organization's data; the epoch also means a late old-document write cannot overwrite or delete the current value. A switch request that does not settle within ten seconds is treated as possibly committed. Known refusal statuses 400, 401, 403, and 404 leave the current page and organization in place.
Web Locks serializes switch attempts across tabs, and a local-storage marker blocks ordinary token reads from the moment the PUT starts until refusal or reload. Each document remembers the epoch in which its JavaScript heap started and rechecks it after bfcache restore. A browser without exclusive Web Locks or writable same-origin storage refuses before sending the PUT .
Mandatory reloads are budgeted. A tab that reloads three times inside ten seconds did no work in between, which is a loop rather than a person changing organization, so the fourth reload does not happen. That tab has already cleared its tenant caches and it goes on refusing access tokens, so it fails closed and visibly instead of reloading forever.
Every authenticated browser API request also carries X-Cowork-Expected-Organization-Id , pinned to the organization in which that document started. In MindsHub mode, cowork-server always enforces this boundary for browser JWT requests. A missing header from a pre-protocol bundle receives HTTP 426; a malformed header or one that differs from the gateway-resolved organization receives HTTP 409. Both responses require a reload. This closes the gap between the token check and actual request dispatch, and it also catches a Keycloak session change made from another origin. The client clears tenant state and reloads before consuming such a response.
Canonical-web attachment and project-file bytes use that same authenticated fetch path, then render, open, or download from a checked Blob URL; a native resource cannot attach the expected-organization header. Project HTML preview URLs are the exception: the server mints a short-lived preview token bound to the requesting tenant scope, so a token requested in one organization returns no content after the principal changes. Private artifact serveUrl routes are unavailable in MindsHub mode and therefore are not part of the organization-switch protocol.
The initial four-stage rollout was superseded by cowork-server#524 , to main through #489 on 2026-09-13. It removed COWORK_ORGANIZATION_BOUNDARY_MODE and enabled the picker in the dev, staging, and production overlays. There is no audit setting that can reopen the boundary. The server still logs organization boundary: for refused requests.
COWORK_ORGANIZATION_SWITCH_ENABLED=false remains the deployment control for hiding switch targets without weakening enforcement. The capability handshake still requires MindsHub mode and enforced identity before advertising switching. Verify every deployed replica and authenticated browser behavior when checking a rollout; an enabled source value alone does not prove the deployed state.
Shared-resource permissions come from the server
Hosted Cowork never derives project, skill, project-memory, or instruction permissions from a role in the renderer. Each resource response carries its allowed actions, and a missing capability fails closed: the corresponding rename, edit, disable, or delete control stays unavailable until a fresh server response explicitly allows it. Packaged skills and the General project therefore remain immutable according to the same response contract. The packaged desktop app keeps its local-owner fallback because its files have no organization principal or server-owned capability record.
Attribution is display metadata, not authority. The UI may name the immutable creator and current last editor, but only the capability fields decide whether a control is enabled. Protected deletes wait for the server before removing anything from local state; a refusal keeps the resource, selection, tasks, drafts, and route in place. Successful protected mutations force a fresh read generation, superseding any coalesced pre-mutation request so stale attribution or capabilities cannot overwrite the response that just succeeded.
The server ships first. Because the hosted client fails closed on an absent capability, a renderer that reaches hosted users before cowork-server#417 is deployed reads every response as carrying no capabilities, and rename, delete, edit, and disable go unavailable for everyone, creators and organization admins included. Deploy cowork-server#417, confirm hosted responses carry capabilities , and only then deploy the renderer.
A person can their own skill with everyone, read-only, or stop sharing it. The skill's page and its Edit form show that "Who can use it" control only when the skill's capabilities.canShare is true; a change goes to PUT /api/v1/skills/{skill}/sharing (the Edit form sends it after saving the rest). Creating a skill (the Write form, Upload and the chat's skill card) asks the same question, with Only me preselected, only when the skills list's top-level canShare is true, and sends the answer as shared . The chat's skill card creates a skill shared with everyone without the chat's project scope, since a reader applies the creator's scope. Unlike the other capabilities, a missing canShare is false on every build, desktop included. cowork-server grants it only where each person keeps their own skills, so hosted Cowork, the desktop app and a deployment whose skills everyone already shares never show it. Deploy cowork-server first: against an older server the renderer shows no control and sends no shared field.
The Connections page reads the same way. Each connection carries managed and shared , and the page keys its Reconnect, Remove and read-only note on them; a missing field keeps every control, and cowork-server's 403 enforces the rule when a change is refused.
MindsHub mode, single-tenant mode, single-user mode and MindsHub UI
Two separate switches decide what the app shows: how the cowork-server it talks to keeps tenants, and whether the web build carries MindsHub UI. Neither implies the other. The cloud build turns both on; the self-hosted VM runs single-tenant mode with MindsHub UI off.
Sharing inside the org
In MindsHub mode, when GET /api/v1/skills/sharing-capabilities answers enabled: true , skills and artifacts are shared with Only me, Everyone at ‹org›, or Specific teams and people. An artifact also takes people outside the org by email, a password, or a public link. The org's default team ("All members") is never listed: an audience that names it reads as Everyone at ‹org›.
Who may pick Everyone at ‹org›: canShareSkillsOrg ( skills.share_org ) for a skill, canShareArtifactsOrg ( artifacts.share_org ) for an artifact. Without it the card is grayed with "Only admins can with everyone in the organization" for a skill. Every built-in MindsHub role holds artifacts.share_org , so for an artifact only a custom role that withholds it grays the card, with "Your role can't with everyone in the organization". MindsHub refuses an artifact save that newly sets everyone without artifacts.share_org , whichever client sends it. cowork-server answers that refusal with 403 {"detail": " ", "code": "share_org_required"} on PUT .../access , POST /publish , and POST /publish/update , and PUT .../access answers its own check of the same that way, before anything publishes. The app shows the reason once, as it is, with no "Sharing failed:" or "Update failed:" in front and no Try again, since asking again gets the same answer: under the panel's choices, and in a toast on the Artifacts page, whose card keeps its state ( publishRefusalMessage in components/artifact/publish/publishErrors.js ; the code is SHARE_ORG_REQUIRED_CODE in lib/sharingContract.js ).
When MindsHub couldn't be asked: permissionsKnown: false means the can… flags say nothing, so a locked control reads "Couldn't reach MindsHub" instead of a permission lock, and the artifact panel and the Skills page offer Retry. teamsKnown: false means skills shared with the caller's teams are left out of the list; the Skills page says so, with Retry. Such an answer is never cached.
Always on: a skill shared with everyone or with a team can be part of every task for everyone it reaches. The switch on a skill shared with everyone needs canShareSkillsOrg ; on a team skill it needs edit rights (its owner, a member of one of its teams, or an admin). People named one by one always use a skill on demand.
Waiting on reads: the artifact panel waits for the capabilities read and, in MindsHub mode, for the access route. An artifact card there doesn't say who a restricted artifact reaches: cowork-server answers its orgAllowed , ownerOnly , allowedTeamIds , and allowedUserIds as null, and lib/sharingContract.js 's readArtifactAudience reads a null as unknown, never as an empty audience or "Only me". A failed read, or an access answer with nulls, offers Retry and saves nothing. Until the access route answers, the button and the panel title read " ", never "Shared", a draft seeded from the card picks nothing and can't be saved, and the Artifacts list says "Restricted. Open to see who can open the link." The Skills page waits for the capabilities read too, and a failed read shows "Couldn't load the sharing settings." with Retry instead of the list.
The people directory: GET /api/v1/hub/people/ lists the org's members, the caller left out, up to MindsHub's cap; truncated: true says there are more. ?ids= names stored people and ?emails= finds members past the cap. Typing filters the loaded list and asks nothing. An address the list has is that person. One a list over a minute old, or a capped one, doesn't have reads "Add …", with no claim the org. Adding it (Enter, Tab, a comma, or a click) holds it as "Checking…" while the app reads the whole list again ( GET /hub/people/ , for a list over a minute old) or asks MindsHub the address ( ?emails= , past a capped list's end, also once a list read again comes back capped). Then it is added as that member, added as an outside email ("Outside ‹org›"), or reported "Not added: … (not in ‹org›)" where only people in the org may be named; a check that gets no answer leaves it in the input with its reason, and Enter checks again. Only an address a list under a minute old answers for (the list is complete, or MindsHub has answered for that address) reads "Invite … (outside ‹org›)" or "Only people in ‹org›" while it is typed. Addresses are checked with lib/emailAddress.js , the rule MindsHub's lookup applies; one cowork-server still refuses (400 invalid_email ) is reported as not an email, and the rest of its batch is asked again. A stored id cowork-server refuses as no UUID (400 invalid_id ) reads as an Unknown person and is never asked again; the rest of its batch is asked again.
When MindsHub says no: a people or teams read that MindsHub refused (403 or 400 mindshub_refused ) or throttled (429 mindshub_throttled ) says so in its own words, never as an outage. A refusal reads "MindsHub refused to list your organization's people" (the directory), "MindsHub refused to name some people." (stored people) or "MindsHub refused to list your teams.", with no Retry, since asking again gets the same answer; the open asks again. A throttle reads "MindsHub is limiting requests. Try again in a minute.", with Retry where the field has one, and nothing asks again on a timer. An outage keeps its "Couldn't load …" line, and Retry where the field has one. lib/sharingContract.js 's readMindsHubFailure reads the code, and lib/orgSharing.js 's mindsHubFailureText picks the line.
The organization's name: "Everyone at ‹org›" reads the organization's name from the same two places as the account ( useSharingOrgName , sharingOrgName in lib/orgSharing.js ). The app's own organization list ( useMindsOrgs ' active organization) gives its display name. The browser reads that list only where GET /api/v1/capabilities/organization-switch answers enabled ( COWORK_ORGANIZATION_SWITCH_ENABLED ). Without the list, the access token's activate_organization claim gives the organization's Keycloak name, which can differ from its display name: it can be a slug, and for an organization MindsHub's staff created it is an id, staff-org- . With no name known, it reads "Everyone in the organization": MindsHub UI off, the token not read yet, a personal organization (one named personal_ ), or a claim that names the organization only by an id: staff-org- , or personal_ for someone else's personal organization. So where switching is off, the label of such an organization stays generic.
Which file owns what, under src/renderer/cowork/ :
Requests take snake_case and answers come back camelCase only; lib/sharingContract.js reads no other spelling.
GET /api/v1/skills/sharing-capabilities answers enabled , canShareSkillsOrg , canWriteSkillsOrg , canShareArtifactsOrg , permissionsKnown and teamsKnown . It names no organization.
The per-rule caps ( MAX_TEAMS_PER_RULE and MAX_PEOPLE_PER_RULE , 100 teams and 100 people a rule names, and MAX_NOTIFY_EMAILS , 100 outside addresses a save may notify) belong to cowork-server and MindsHub. The app doesn't check them before a save; a save past one shows the server's refusal.
A model that can't run right now is not selectable
MindsHub's /v1/models marks each model with whether it can run for the org right now: a paid ...
