Organizations, projects, and entitlements
Organizations hold people and projects. Projects hold the work space, its context, and its data access rules. Memberships, user groups, licenses, and billing decide what each person can use, see, share, and manage. This page gives the main model for that boundary; see Access and governance for the wider control model and Authentication and SSO for sign-in and identity-provider flows.
Organization and project hierarchy
Organization boundary
An organization is the top-level tenant for people, projects, and cloud billing. A person must belong to an organization to use its projects. Organization roles are admin, user, and viewer; organization admins manage members, roles, projects, and organization-level sign-in settings. Cloud projects must belong to an organization.
The selected organization can come from the request, from the selected project, or from the user’s first organization. This keeps project actions and billing actions in the same organization scope as the current session.
References: apps/…/organization.ts• L1-3 apps/…/organization.routes.ts• L24-120 apps/…/trpc.ts• L103-128 apps/…/project.queries.ts• L322-359
Project boundary
A project is the main work space for analysis, chats, stories, integrations, models, context files, tests, and project settings. It belongs to one organization when it is managed in the cloud. A project can grant access directly to a person or indirectly through organization membership.
Project access uses the most specific membership available. A direct project role takes precedence over an organization role. If a person has only organization access, the organization role supplies the project role. Project roles include admin, user, viewer, and context_admin; context_admin supports project use plus selected observability and context-management surfaces. Project access listings also show whether access comes from the project, the organization, or both.
References: apps/…/project.queries.ts• L186-208 apps/…/project.queries.ts• L227-250 apps/…/project.queries.ts• L269-310 apps/…/trpc.ts• L131-153 apps/…/trpc.ts• L205-224 apps/…/project.routes.ts• L1004-1013
Project lifecycle
Project creation establishes the project record and its default access group. The first-user setup path can create a default organization, add the first user as an organization admin, create a default project, and make that user a project admin. Project changes also feed project-readiness and setup tracking.
Projects can start from an imported repository. A repository import creates or updates the project context; when it replaces an existing project, the project keeps its chats, members, and settings. Required project environment values also contribute to setup readiness. Project admins can enter values that are not supplied by the running environment, while values supplied by the process remain controlled outside the project settings.
Project names must be unique within an organization. A rename is accepted only when the target project still matches the request and the new name is available. Organization-scoped rename checks serialize competing changes so two projects cannot take the same name at the same time.
Project availability also depends on the deployment mode. In self-hosted multi-project mode, the active project list can be limited to projects that the instance currently serves and its project license covers. Inactive projects can still be listed for cleanup.
The lifecycle has three broad states:
| State | Meaning |
|---|---|
| Created | The project exists and has a default group, but may still need data or model setup. |
| Ready | Required project inputs are present, so project-dependent features can run. |
| Restricted | A missing setup item, inactive license, or expired cloud entitlement limits the affected feature. |
The project context also has a review path. A repository-backed project uses branches and review requests, while a project without a repository keeps a private draft for test runs until a repository is connected. Clean context changes can be updated or switched. Dirty changes must be saved or discarded first so a branch update cannot overwrite work.
The following diagram shows the main relationship between the tenant, work space, access sources, and context review.
flowchart TD
O[Organization] --> OM[Organization membership]
O --> P[Project]
P --> PM[Direct project membership]
P --> G[All Users and custom user groups]
P --> C[Project context]
OM -->|inherited project access| P
PM --> R[Project role]
G --> A[Effective access]
R --> A
A --> F[Features and context]
A --> S[Sharing and governance]
C --> D[Draft or branch changes]
D --> T[Test against production or changes]
D --> V[Commit, push, and review]
References: apps/…/project.queries.ts• L123-130 apps/…/project.queries.ts• L183-220 apps/…/project.queries.ts• L322-359 apps/…/project.queries.ts• L577-612 apps/…/project.service.ts• L5-27 apps/…/organization.queries.ts• L293-338 apps/…/project.routes.ts• L213-255 apps/…/github-repo-picker.tsx• L42-63 apps/…/github-repo-picker.tsx• L71-99 apps/…/env-vars-section.tsx• L18-41 apps/…/context-git-panel.tsx• L83-106 apps/…/context-git-panel.tsx• L136-214 apps/…/context-git-panel.tsx• L246-306
Context review
Context review lets a project owner inspect and test changes before they affect production. The project can run tests against production, against the draft, or against both sides so a change can be judged as a regression, a fix, or no change.
The review result covers more than pass or fail. It can show the answer, the data difference, and the SQL used by each side. It also records model, cost, time, token, and tool-call measures. Several models or reasoning efforts can be compared, and old test versions are marked so past results are not mistaken for current results.
References: apps/…/test-run-actions.tsx• L28-37 apps/…/test-run-actions.tsx• L84-113 apps/…/test-run-results.tsx• L72-113 apps/…/test-run-details.tsx• L31-93 apps/…/test-attempt-details.tsx• L31-99 apps/…/test-draft-comparison.tsx• L66-89
Memberships and sharing
Organization membership
Organization membership is the broad access grant. Adding a person to an organization makes that person eligible for its projects, while removing the person also removes organization-derived project access. The system keeps at least one organization admin.
Organization admins can add members, change roles, and remove members. Role changes can be disabled when an identity provider maps organization roles, so the provider remains the source of truth; see Authentication and SSO.
References: apps/…/membership.service.ts• L13-70 apps/…/organization.routes.ts• L98-153 apps/…/trpc.ts• L257-264
Project membership
Project membership narrows access within an organization. A person must already belong to the project’s organization before a project role can be added. Every project keeps an admin, and removing or demoting the last project admin is not allowed.
Project access can therefore come from two sources:
- A direct project membership with its own role.
- An organization membership inherited by the project.
When a role loses context-management access, related project context work areas are cleaned up. This prevents old context access from remaining after the membership changes.
References: apps/…/membership.service.ts• L72-108 apps/…/project.queries.ts• L227-264 apps/…/project.routes.ts• L1033-1041
User groups
A user group is a project-local policy set that collects people and controls their effective access. Every project has an All Users group. Custom groups add narrower rules, and memberships can be assigned by an admin or supplied by SSO group mapping.
Groups can govern:
- Feature creation rights.
- Which settings a
userrole can see. - Sharing with the whole project.
- The groups that members may use as sharing targets.
- Database, document, file, MCP, and skill context.
- Row-security policies.
- Preloaded skills and tool-call behavior.
- Member budgets.
Access from applicable groups is combined for a person. A locked custom group on a plan without the needed license does not contribute access, but its saved settings remain available if the license returns. Without the user-groups entitlement, the default group and the first three custom groups remain active.
The effective context view makes this result visible across database tables, docs, and project files. A group can allow everything or select folders and files. A folder grant flows to its children, while saved grants that no longer match the current catalog remain visible for cleanup. Catalog loading and sync status are shown separately, so an empty view does not silently mean that access was removed.
References: apps/…/user-group-features.ts• L16-47 apps/…/user-group.queries.ts• L105-126 apps/…/user-group.queries.ts• L150-209 apps/…/user-group-availability.service.ts• L41-103 apps/…/user-group-effective-context.tsx• L85-149 apps/…/user-group-effective-context.tsx• L187-257 apps/…/user-group-file-tree-access.tsx• L50-169 apps/…/user-group-file-tree-access.tsx• L218-359
Project sharing
Project sharing controls who a person may name as a recipient for shared chats, stories, and automations. Organization and project admins can share with the whole project. Other users can share only with their own custom groups and the members of those groups when group policy does not allow project-wide sharing.
The sharing decision uses explicit group overrides. A block wins over an allow, and an allow wins over the All Users default. When project-wide sharing is not allowed, each custom group can limit its members to their own group or to a selected set of other custom groups. If a policy change makes an existing project-wide share invalid, the system previews and then removes the affected chat, story, or automation shares.
References: apps/…/project-sharing.service.ts• L18-23 apps/…/project-sharing.service.ts• L42-99 apps/…/project-sharing.service.ts• L101-120 apps/…/user-group-features.ts• L122-134 apps/…/user-group.routes.ts• L239-260 apps/…/project.routes.ts• L148-165 apps/…/user-group-editor.tsx• L166-171 apps/…/user-group-editor.tsx• L394-476 apps/…/user-group-project-sharing.tsx• L46-70 apps/…/user-group-project-sharing.tsx• L109-190
Entitlements and feature access
Effective access
Effective access is the final set of permissions for one person in one project. It combines the project role, active user-group membership, group policy, and product licenses. The same result is used by project settings, agent runs, context tools, and sharing checks.
The access result covers two kinds of control:
| Control | Effect |
|---|---|
| Product feature access | Allows or blocks actions such as creating stories, custom stories, or automations. |
| Context access | Limits databases, documents, files, MCP servers, skills, and warehouse rows available to the person. |
The feature list is not only a user-interface hint. Restricted agent features are also stated in the agent policy, so the agent does not offer or attempt a blocked action. Feature prerequisites also apply: custom story creation needs story creation.
References: apps/…/user-group-feature-access.service.ts• L19-35 apps/…/user-group-feature-access.service.ts• L49-103 apps/…/user-group-feature-access.service.ts• L124-183 apps/…/user-group-features.ts• L56-83
Project context paths
Project context paths provide one virtual view of files, docs, databases, MCP tool specs, and skills. The access check uses the person’s effective context and the requested path before a tool can read or render it.
The path boundary hides sensitive configuration and rejects unsafe or ambiguous aliases. It also applies the right policy to each context type: file and document grants follow the addressed path, database paths use table and column rules, MCP paths expose only granted server or tool specs, and restricted skill runs expose only loaded skill files. Error messages use the virtual project path and can suggest an existing allowed path without exposing the host file system.
This flow shows how a tool request becomes an allowed or denied project-context operation.
flowchart LR
T[Tool path request] --> N[Virtual path validation]
N --> C[Effective context rules]
C --> D{Allowed to render?}
D -->|No| E[Safe project-path error]
D -->|Yes| R{Allowed to read?}
R -->|No| X[Access denied]
R -->|Yes| O[Context content]
References: apps/…/project-context-path-access.service.ts• L35-122 apps/…/project-context-path-access.service.ts• L128-203 apps/…/project-context-path-access.service.ts• L213-250 apps/…/project-path-error.service.ts• L25-47 apps/…/project-path-error.service.ts• L50-89
License entitlements
License entitlements decide whether a project may use enterprise controls. They gate user groups, row-level security, MCP and skill restrictions, and member budgets. A license loss narrows access instead of deleting policy data, and some settings remain editable only when they remove a restriction.
Cloud billing is a separate organization entitlement. A valid trial or paid subscription gives the organization a time-bounded access end date. Project actions that require cloud access check the organization entitlement unless billing is disabled or the organization has a billing bypass.
References: apps/…/user-group-availability.service.ts• L71-103 apps/…/user-group.routes.ts• L480-570 apps/…/member-budget.ts• L37-45 apps/…/cloud-billing-access.service.ts• L33-63 apps/…/cloud-billing-access.service.ts• L99-143
Billing permissions
Billing belongs to the organization, not to an individual project. Organization members can view billing access status. Only organization admins can start a trial, select a paid plan, manage payment methods, open the billing portal, review invoices, resubscribe, or buy credits.
Billing access can end because a trial ends, a subscription is canceled, or a subscription is not active. A short reconciliation grace period protects active subscriptions while billing state catches up. When access is restricted, project features that use cloud billing fail with a governance error and direct the user to an organization admin.
References: apps/…/billing.routes.ts• L44-117 apps/…/billing.routes.ts• L120-169 apps/…/cloud-billing-access.service.ts• L8-12 apps/…/cloud-billing-access.service.ts• L125-146
Row-security context
Project row-security registry
Row-level security protects sensitive warehouse tables by declaring which tables need a user-specific row rule and which columns may constrain that rule. The registry is project-wide. An admin must define a table in the registry before a group can add a policy for it.
The registry is checked against the synced database catalog. Unknown tables or constraint columns are rejected. The feature requires an Enterprise license; without it, an admin may remove configured tables but may not add or expand protection.
References: apps/…/user-group-row-security.ts• L7-20 apps/…/user-group.routes.ts• L299-308 apps/…/user-group.routes.ts• L496-598
Group row policies
Each applicable group can grant full table access or a predicate that limits rows. A predicate can use guided conditions or a validated SQL WHERE expression. Policies from all applicable groups are combined for each registered table.
The resulting warehouse context has one of these outcomes:
- Full access when any applicable group grants full access.
- Predicate access when applicable predicates exist.
- No access when the table is registered but no group policy grants it.
- Blocked access when row security is configured but its license is inactive.
The following diagram shows how a person’s group context becomes a warehouse row rule.
flowchart LR
U[User] --> G[Applicable user groups]
G --> P[Group row policies]
R[Project table registry] --> C[Policy validation]
P --> C
C --> E[Effective warehouse row security]
E --> Q[Warehouse query context]
References: apps/…/user-group-row-security.ts• L52-80 apps/…/user-group-row-security.ts• L199-241 apps/…/user-group.queries.ts• L180-209 apps/…/user-group-context-access.service.ts• L34-70 apps/…/project.routes.ts• L257-275 apps/…/user-group-effective-context.tsx• L85-149
Member budgets
Budget inheritance
Member budgets limit cross-provider spend for a person during a project budget period. A person’s limit comes from the first applicable source in this order: personal limit, group limit, or the project default. A limit of zero means no limit, while null clears an override and restores inheritance.
The All Users group represents the project default budget. Custom group budgets apply only to active groups. If a person belongs to several groups, the budget resolver uses the group limits when no personal limit exists.
References: apps/…/member-budget.ts• L47-89 apps/…/member-budget.service.ts• L56-97 apps/…/member-budget.service.ts• L132-148 apps/…/member-budget.ts• L6-22
Budget administration
Project admins can view spend, inspect member limits, export usage, and set personal, group, and default budgets. Members can view their own budget. The whole feature is protected by the Enterprise user-budget entitlement.
Usage views help an administrator connect spend to its source. They can narrow a period, provider, user, or usage source, save a period for reuse, and split results by user. Chat replay rows also show source, token, cost, feedback, and tool-state signals.
References: apps/…/member-budget.routes.ts• L24-68 apps/…/member-budget.service.ts• L99-129 apps/…/member-budget.ts• L37-45 apps/…/usage-filters.tsx• L21-115 apps/…/usage-filters.tsx• L126-161 apps/…/usage-route-search.ts• L17-97 apps/…/chats-replay-columns.tsx• L33-146
Governance settings
Settings visibility
Settings visibility is separate from the ability to use a feature. Admins and context admins can see advanced settings by role. A regular user can see them only when one of the person’s groups enables all settings. Viewers do not see advanced settings.
References: apps/…/user-group-features.ts• L106-119 apps/…/user-group-feature-access.service.ts• L79-86 apps/…/trpc.ts• L229-236
Identity-provider group mapping
Identity providers can supply organization roles and project user-group membership. When mapping is active, local organization role edits are blocked because sign-in re-applies the provider’s mapping. User-group mapping and sign-in setup are covered in more detail by Authentication and SSO.
References: apps/…/trpc.ts• L257-264 apps/…/user-group.routes.ts• L267-290 apps/…/membership.service.ts• L28-51
Governance change effects
Governance changes can alter access to data and existing shared resources. Group changes and membership changes therefore re-evaluate sharing, while role changes can remove context work areas. Billing and license changes can also narrow effective access without removing saved configuration.
References: apps/…/user-group.routes.ts• L401-477 apps/…/project-sharing.service.ts• L101-120 apps/…/membership.service.ts• L91-107 apps/…/member-budget.ts• L92-101
Change checklist
When these files or sections are changed, remember to consider these:
- Changes to organization or project role resolution must preserve the precedence between direct project membership and inherited organization membership.
- Changes to project listing, current-project selection, or access-source reporting must keep direct roles, inherited roles, and the displayed
project,organization, orbothsource aligned. - Changes to project listing must keep self-hosted active-project filtering separate from inactive-project cleanup visibility.
- Changes to project rename rules must preserve organization-local name uniqueness, the selected-project conflict check, and serialization of competing renames.
- Changes to user-group policy merging must keep feature prerequisites, license availability, and union behavior aligned across agent, context, sharing, and settings checks.
- Changes to project virtual-path checks must keep render access, read access, canonical-path checks, and sensitive configuration hiding aligned.
- Changes to path error suggestions must never expose host paths or suggest a path that the current context policy blocks.
- Changes to the row-security registry must remain compatible with group policy validation and warehouse query context creation.
- Changes to billing or license checks must preserve the distinction between organization cloud billing access and project Enterprise feature entitlements.
- Changes to group membership or sharing policy must continue to revoke project-wide shares that are no longer allowed, including automation shares.
- Changes to group sharing targets must keep own-group inclusion and selected cross-group audiences aligned with the sharing decision.
- Changes to budget inheritance must keep personal, group,
All Users, and active-group behavior consistent. - Changes to repository import or replacement must keep project-owned chats, members, and settings attached to the project.
- Changes to project context review must preserve the difference between production, draft, and comparison runs, including warnings for outdated or excluded changes.
- Changes to file and document grants must keep folder inheritance, unavailable saved grants, and catalog sync status consistent between policy editing and effective-context views.
- Changes to project environment values must keep setup-complete and missing-variable status in sync with the values used by project context.
- Changes to usage filters must keep route search, project-scoped saved filters, usage totals, and chat replay facets aligned.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| Removing or demoting the last organization admin | The organization could have no account owner. | Membership changes reject the operation. |
| Adding a project member who is not in the project’s organization | Project and organization access could disagree. | Project membership creation rejects the user. |
| Renaming a project to a name already used in its organization | Projects could become ambiguous within the tenant. | The rename checks organization-local uniqueness and returns a conflict. |
| A self-hosted project is no longer served or covered by the active project license | The project can be excluded from the active project list even though its records remain for cleanup. | Active-project resolution applies the serving and license filter while the cleanup path can include inactive projects. |
| Selecting a project that is not in the user’s accessible project list | A request could use a project outside the current access scope. | Current-project resolution falls back to an accessible project or returns no project. |
| A user group references a table outside the project registry | A row rule could target an unapproved or unknown table. | Policy validation rejects the group update. |
| Enterprise row-security access expires while tables remain registered | Warehouse access to those tables is blocked. | The resolved context marks the tables as blocked. |
| A group loses project-wide sharing permission | Existing project-wide chats, stories, or automations could remain visible. | Unauthorized shares are found and revoked. |
| A group sharing target is changed or its target group is no longer available | Members could share with an audience that no longer matches group policy. | The editor limits targets to current, unlocked custom groups and previews project-wide share revocation. |
| Cloud billing access expires | Billing-gated project actions are denied. | Organization entitlement checks raise a forbidden error. |
| A custom group is outside the active free-plan limit | Its saved policies must not grant access. | Availability resolution marks the group locked and excludes it. |
| A project context has unsaved or uncommitted changes during an update or branch switch | The update could overwrite work or produce an unclear review base. | Context actions block the operation until changes are saved or discarded. |
| A tool requests a path through an alias, sensitive config file, or ungranted context tree | The tool could bypass a context policy or expose credentials. | Virtual-path checks validate the canonical path and deny restricted paths before access. |
| A missing-path suggestion is built from an unallowed path | An error could reveal a path outside the person’s context. | Suggestions are returned only when the candidate exists and is render-allowed. |
| Production changes after a draft starts | A comparison can include unrelated production updates and give a false result. | The test view marks outdated paths and asks for a context update or a new draft. |
| A file or docs catalog is not synced | A policy view can show no current entries even though saved grants still exist. | The effective-context view reports the catalog status and keeps unavailable grants visible. |
| A test has no reference SQL | Its data cannot be compared with an expected result. | The test checks assertions only and states that no data comparison is available. |
Key files
| File | Why to read it |
|---|---|
| apps/…/trpc.ts | Defines organization and project scope, role gates, advanced-settings access, and billing middleware. |
| apps/…/project.queries.ts | Shows how direct and inherited project access become one effective project role and how project creation, selection, listing, and renaming preserve project boundaries. |
| apps/…/project.routes.ts | Shows the project-facing flow for current-project selection, setup status, access listings, sharing recipients, and member removal. |
| apps/…/membership.service.ts | Shows membership lifecycle rules and cleanup after role or membership changes. |
| apps/…/user-group.queries.ts | Shows how applicable groups are resolved and their policies are combined. |
| apps/…/project-sharing.service.ts | Shows sharing audiences and revocation for chats, stories, and automations after policy changes. |
| apps/…/project-context-path-access.service.ts | Shows how effective context rules protect virtual project paths across files, docs, databases, MCP specs, and skills. |
| apps/…/project-path-error.service.ts | Shows how missing and file-system errors become safe project-path messages and allowed suggestions. |
| apps/…/user-group-editor.tsx | Shows the policy surface that combines feature, context, security, budget, SSO, and sharing settings for a group. |
| apps/…/user-group-project-sharing.tsx | Shows the project-wide sharing override and the custom-group sharing audiences. |
| apps/…/user-group-context-access.service.ts | Shows how group permissions become the context used by project and warehouse operations. |
| apps/…/user-group-features.ts | Defines group features, sharing precedence, settings visibility, and feature dependencies. |
| apps/…/user-group-row-security.ts | Defines project row-security rules and the final table access outcomes. |
| apps/…/cloud-billing-access.service.ts | Defines organization billing entitlement and its project-level effect. |
| apps/…/member-budget.service.ts | Defines budget views and budget inheritance for members and groups. |
| apps/…/context-git-panel.tsx | Shows the project context review path from draft or branch changes through commit, push, and review. |
| apps/…/github-repo-picker.tsx | Shows repository import and replacement while preserving project-owned resources. |
| apps/…/user-group-effective-context.tsx | Shows the context a person effectively receives across tables, docs, and files. |
| apps/…/user-group-file-tree-access.tsx | Shows all-or-selected file grants, folder inheritance, and unavailable saved selections. |
| apps/…/test-drawer.tsx | Shows how project tests run beside the context editor and compare production with changes. |
| apps/…/test-run-results.tsx | Shows how test outcomes, model results, and production-versus-draft changes are summarized. |
| apps/…/usage-filters.tsx | Shows the user, provider, source, period, and split controls for spend review. |
| apps/…/env-vars-section.tsx | Shows how project environment values affect setup readiness and admin editing. |