Every resource a workspace holds — secrets, connections, model providers, MCP servers, skills, prompts, and work of every kind (Tasks, scheduled Tasks, Jobs, persistent agents) — belongs either to the organization or to one person:
| Scope | Column | Who sees it | Who changes it |
|---|---|---|---|
| Organization | owner_user_id IS NULL |
Everyone in the workspace | Each resource's own role rule (admin or member) |
| Private | owner_user_id = <user> |
Its owner; workspace admins read-only, named with them | Its owner alone; admins may delete (offboarding) |
One rule, one place: apps/api/src/services/ownership.ts.
visibleOwner(column, actor)— theWHEREterm lists use: everything for an admin, otherwiseowner IS NULL OR owner = me.canSee(owner, actor)— the row form; a member fetching someone else's private row gets a 404 (its existence is theirs), an admin a read-only row.canChange(owner, actor, orgRule, action)— a private row is its owner's;deleteis also open to admins. Changing, running or using someone else's private resource is a 403 for everyone but the owner, admins included.usableBy(column, workOwner)/canUse— what a piece of work may be given: the organization's rows, plus its owner's own private rows. Organization work never uses anything private.ownerForNew(owner, actor)— the body'sowner: "workspace" | "me"decides a new row's scope.withOwnerNames(rows)— private rows carryownerNameso an admin's list can say whose they are.
work-ownership.ts keeps the work-specific rules (an owner's work runs with
their secrets / providers / connections; owner: "me"; making work personal).
- Private work (
tasks,work_definitions,persistent_agents) is visible only to its owner — in the Work list, the per-kind lists and detail endpoints, recent runs, and the events socket (/ws/eventsdrops private events for other viewers) — and read-only to admins. Cancel / retry / run now / review are the owner's alone. Cost analytics count it in the workspace's totals. - A private persistent agent accepts messages from its owner and from the
owner's other private agents; the organization's agents reach only the
organization's (
/api/internal/persistent-agents/send|broadcast). - Private secrets (
scope = "user") are stored without a workspace, so every reader's lookup (by user alone) decrypts them.GET /api/secretsreturns the organization's (instance-wideglobalrows and this workspace's repo-scoped rows), the caller's own, and — for an admin — members' private secrets by name. An admin deletes someone's withDELETE /api/secrets/:name?scope=user&userId=<owner>. - The deployment's own — global secrets (no workspace, written by a
deployment admin) and ticket providers — belong to the founding workspace
(the oldest;
foundingWorkspaceId, the rulerequireDeploymentAdminuses). Work elsewhere can't pick a global secret as a pod secret or name one in a connection's or MCP server's${{NAME}}(mayUseDeploymentSecrets); the provider list takes a deployment admin and never returns credentials; and the Issues page shows the providers' tickets to the founding workspace and deployment admins only. The deployment's fixed uses (agent sign-in, git and cloud credentials) still serve every workspace. - MCP servers, skills and prompts have an
owner_user_idtoo. Members may add private ones; the organization's MCP servers still need an admin. A prompt's name is unique per scope (prompt_templates_scope_name_key), not across the instance. Prompts with no workspace (the starter prompts, the deployment's defaults) are everyone's to read and only a deployment admin's to change. Work linked to a saved prompt (promptTemplateId) may use its own workspace's or the deployment's, the organization's or its owner's own (promptUsableBy), checked when it is saved and when it renders. buildAgentEnvironmentgives a pod the organization's connections, MCP servers and skills plus its owner's private ones;GET /api/work/environmentmarks the private items (private: true).
One vocabulary everywhere: pickers say Organization / Private; lists are sectioned Organization / Private / Other people's (the last for admins); a chip says Private (or Private · Name for someone else's).
apps/web/src/lib/owner.ts—ownerScope(row, viewerId), counts, filters.hooks/use-current-user.ts— oneuseCurrentUser()(userId,isAdmin,isDeploymentAdmin) in place of per-component/api/auth/mecalls.components/ui/owner-segments.tsx(OwnerSegments,useOwnerFilter→?owner=),scoped-list.tsx(ScopedList),owner-picker.tsx(OwnerPicker),owner-chip.tsx(OwnerChip). The Secrets page is the exemplar; Connections, Model providers, MCP servers, Skills, Prompts, the Work list and the New work form use the same pieces. "+ New" opens on the scope being viewed.- iOS and Android group their Secrets, Connections and Model providers screens the same way and tag private Work rows.
apps/api/src/services/ownership.int.test.ts — two members and an admin in
one workspace, every resource kind, the secret round trip through the route,
and the boot-time heal of private secrets saved before the fix.