# Atmosphere Groups specification > **Status: beta.** The spec may still change. We'll try to avoid backwards-incompatible changes but don't promise to; any such change is at the discretion of the working group and implementers. Atmosphere Groups also builds on [atproto spaces](https://github.com/bluesky-social/proposals/tree/main/0016-permissioned-data), which is also in beta. This document specifies the Atmosphere Groups model. See the [project README](README.md) for an overview, background, and design posture. An **Atmosphere group** is a network identity (DID) with a bunch of permissioned spaces under it. There is a one-to-one mapping between groups and DIDs. Atmosphere Groups is a set of **lexicons**, under the `org.atgrp` namespace, describing **space types, record types, and methods** for modeling and interacting with Atmosphere groups. Groups run on **group hosts** that implement this spec. Groups should be able to migrate from one group host to another without disrupting how members interact with the group. Atmosphere Groups defines its own [space policy](https://github.com/bluesky-social/proposals/tree/main/0016-permissioned-data#space-policy), `org.atgrp.policy`, as a *peer* of the [baseline policies](https://github.com/bluesky-social/proposals/tree/main/0016-permissioned-data#baseline-policies) that PDSes are required to support. Group hosts implement the policy. It is not expected to operate on most PDSes and does not layer on top of the baseline policies. ## Group hosts A **group host** functions like a PDS for group accounts. Just as a person's PDS hosts their account and data, a group host manages the group's network identity, hosts and signs its public repository and space repositories, and acts as the space host for the group's spaces. It adds the group-specific functionality needed to manage a collectively controlled account. It understands the Atmosphere Groups records and methods, enforces space access policies, and checks roles when authorizing group-account permissions. It is both the authorization service and the repo host for records authored by the group. Members continue to publish their own records to their own PDSes, including records in the group's spaces. Members' repositories *are not* stored on the group host. The group host serves as the OAuth authorization server for the group account. Users authenticate to it using their personal atproto accounts, and the host determines which group-account permissions they may authorize from their roles. This is described in the [OAuth flow](#writing-as-the-group-account) below. A user's account may be on a different PDS, and that PDS only needs to support the standard atproto OAuth flow for authenticating them. ## Group configuration spaces Every group has at least two spaces: * a `meta` space (`org.atgrp.meta/self`) which includes metadata about the group that is often shared publicly rather than just with members. This includes basic information for presenting the group and its settings. This space has to do with “overall group presence and discoverability.” * a `members` space (`org.atgrp.members/self`) which includes members-only information about the group. This includes membership and administrative information, and an index of available modality spaces. This space has to do with “roles and access.” The Atmosphere Groups spaces are largely intended for records *about* the group. Apps may publish modality-specific info about the group in `meta`, but other modality- or app-specific data is not published to these spaces. Rather, a group hosts an additional space for each application or modality. If a group wants to enable event applications, it might create a `community.lexicon.calendar.events` space. All `community.lexicon.*` records will then be published into this modality-specific space rather than into a universal “group” space. A group creates a space with `com.atproto.space.createSpace`, passing the space's [policy](#roles--access) (`org.atgrp.policy`), and deletes one with `com.atproto.space.deleteSpace`. The `meta` and `members` spaces cannot be deleted. The `members` space indexes the group's modality spaces with a `space` record per space. The host maintains the index, adding an entry when a space is created and removing it when the space is deleted, and rejects direct writes to it. The index is a discovery aid, not an exhaustive list. A group may leave a space out by setting `unlisted` in its policy, for instance so that members cannot learn an admin-only space exists. The `meta` and `members` spaces always exist and are never indexed, so `unlisted` does not apply to them. ## Roles & Access Authorization and access is modeled as flat Role-Based Access Control (RBAC). The group defines multiple **roles** and assigns one or more roles to each member. Each role can be configured to grant specific access to the group's spaces and a set of OAuth permissions on the overall group account. There are no deny rules or caveats. So authorization composes simply by **unioning all access and permissions granted by a member's roles.** There is no precedence, hierarchy, or evaluation order. Membership is defined **bidirectionally**. The group creates a `membership` record in the `members` space and the member in turn creates a `confirmation` record in the same space. Roles are granted in the `membership` record. The group account itself is implicitly a member with all group permissions. It does not need its own `membership` or `confirmation` records or assigned roles. To leave, a member calls `leaveGroup`, which deletes their `membership`. They should also delete their `confirmation`. Apps ignore a `confirmation` without a matching `membership`. Permissions cannot express which roles a user may grant, revoke, or eject, so each role definition also has a `canAssign` list. When a user writes a membership, every role added or removed, and every current role of a member being removed, must be in the union of `canAssign` across their roles. A `canAssign` entry of `*` covers every role, including roles created later. Each role is keyed by its ID. Role IDs follow label value syntax (lowercase letters and `-`) and are at least 3 characters, since apps may display them. As a convention, groups should have an `admin` role and a `member` role, which hosts [create by default](#creating-a-group). This is not strictly required, and a group can change or delete either role, but apps may rely on them as a baseline. For example, an app creating a space may simply grant access to the `member` role. Roles may also imply modality-specific access not represented as permissions. Beyond `admin` and `member`, groups may develop other role conventions, such as `moderator`, that apps choose to special-case with UI affordances or badges. Other roles may be treated as flair or metadata. Apps and groups are free to adopt or ignore these conventions. Grants live in two places: - Each space in the group (both modality-specific spaces and Atmosphere Groups spaces) has an `org.atgrp.policy` space policy. For each role, it grants `read` and `write` access for members acting as themselves, and permissions for acting as the group in that space. Grants apply only to that space. The policy can also make the space public or leave it out of the space index. The group changes it with `com.atproto.space.updateSpace`, and the host always publishes it in the space as a `com.atproto.space.policy` record so members can read it. - Each `role` record in the `members` space grants its role permissions that are not tied to one existing space: `manage=create`, `rpc:` permissions for the group methods, and grants across all spaces, such as `space:*` for writing labels. It also holds the role's `canAssign` list. A member whose roles grant `read` on a space may obtain space credentials for it. Only members whose roles grant `write` may be included in its [writer set](https://github.com/bluesky-social/proposals/tree/main/0016-permissioned-data#the-sync-boundary-writer-set), so only their records sync to readers. Making a space public does not let non-members' records in. When a member loses `write` on a space, through a role change, ejection, or leaving, the host removes them from its writer set. Apps determine what access a member has by reading their `membership`, the grants on their role records and in each space's policy, and each role's `canAssign` list. The Atmosphere Groups lexicons include [permission sets](#permission-sets) for common grants, which roles and applications can use instead of listing individual permissions. Any member who can write role records or update a space's policy can grant any access or permission, so these are considered admin-level permissions. What members' own records mean is an **app feature**: who can pin a thread, post to an announcements channel, create an event, etc. Each of these is declared in the modality’s **own lexicon** within the relevant space, and may use the group-defined roles. ## Writing as the Group Account The group account authors the group's info, rules, roles, memberships, invites, and labels, and sets each space's policy. It can also author modality-specific records. For example, pinning a post at the top of a forum may require the group account to create a `pin` record in the forum space. Applications create, update, and delete these records through `com.atproto.space.*`, using an OAuth session for the group account. The host checks that each write follows the semantics for that record type and that the session permits it. Authorization uses a two-sided OAuth flow: 1. The application starts an atproto OAuth flow for the group account, requesting the permissions it needs. 2. The group host authenticates the user by acting as an OAuth client to their personal PDS in a second flow (requiring only authentication). 3. The group host checks the user's roles and presents consent for the permissions those roles allow. 4. On approval, the application receives an OAuth session for the group account. ```text Application Group host User's PDS | | | |--- OAuth for group account --->| | | |--- OAuth for user account ---->| | | (authentication only) | | | User signs in | |<-- Personal OAuth session -----| | | | | Check roles + user consent | | | | |<-- Group OAuth session --------| | | | | ``` Applications can use these sessions in two ways: - **Per-user sessions.** Each user authorizes a session for their own actions, using the permissions allowed by their roles. This suits personal tools and independent clients. - **Shared application sessions.** An admin authorizes a session that the application uses on behalf of multiple members. This avoids a separate group authorization flow for each member when many members use the same trusted application. The application is responsible for checking each member's permissions before using the group session on their behalf. The group host must track which user authorized each session. Some permissions depend on the record being written, and permissions cannot express these limits. For example, `canAssign` limits which roles a user can grant or revoke and which members they can eject. On every write, whether through CRUD or a method, the host checks them using the current roles of the user who authorized the session. For shared sessions, this is the authorizing admin. The same check keeps users from granting themselves more than they hold. In a role write or a policy update, the user may change grants only for roles in their `canAssign` union. Any permission they add must already be covered by their own permissions, after expanding permission sets. Any `read` or `write` access they grant on a space must already be theirs on that space. Any role they add to a `canAssign` list must already be in their own `canAssign` union, and only a user whose union includes `*` may add `*`. Without this, anyone who can write roles or update a policy could grant their own role every permission and role in the group. A session's permissions are likewise limited on every request to what its authorizing user's current roles grant. If that user loses roles or membership, the session narrows accordingly. A user can authorize a permission only if their roles grant it. Methods for personal actions, such as joining, leaving, or reporting, use service auth from the person's own account instead of a group account session. ## Creating a group An application creates a group by starting the [OAuth flow](#writing-as-the-group-account) at the group host with `prompt=create`. The host authenticates the creator through their PDS, creates the group account, and returns a group account session. This is how an application may allow a user to sign up for an account on a PDS. Each group host decides who may create groups and under which circumstances. For example, a group host may have a relationship with a particular app or require invite codes. A new group starts with: - a DID and handle - the `meta` and `members` spaces, each with a policy - `about` and `config` records - a `role` that grants every permission and can assign every role (`*`), and a `membership` giving it to the creator Hosts should give the creator's role the ID `admin`. They should also create a `member` role, marked `default`, that can read the `meta` and `members` spaces and write to `members`. A host should not let a group lose its last admin. Without an admin, regaining control of the group depends on whatever recovery the host offers outside this specification. ## Presence & Discoverability Each group has an `about` record that it publishes in its `meta` space. This includes some basic metadata about the group such as a display name and a profile picture. The `meta` space also holds a `config` record with the group's join policy. Any app that wants to show or interact with Atmosphere groups will use these records when displaying the group. Many groups will wish to make their `meta` space public, even if the rest of the group is private. Even in those cases, the data is still published in a **space**; the space is just permissioned to allow public reads. Groups that wish to be easily discoverable may also publish a `declaration` record to the public broadcast protocol. This record is empty. It simply declares the account as a group, whose `meta` space is always at `org.atgrp.meta/self`. ## Moderation Each group is also a **moderation service** with moderation authority over all content in the group. Moderation happens in the normal atproto way: reports come in one side, labels come out the other side. In some cases, certain group-specific actions such as ejection from the group may need to occur. Reports are sent through `org.atgrp.mod.submitReport`. Labels are `com.atproto.label.record` records that the group account writes in its own repo, in the same space as their subject. A label may reference an account or any record in that space, by any author, but not content in another space, so exactly those who can read the subject can read its labels. Labels on accounts are published in the `members` space. Deleting a label record negates it. Following the spaces convention, a `!takedown` label removes content from the space. The host keeps a moderation history of label writes and member ejections. The group defines its own label values in a `labeler` record in the `members` space. It declares the label values and their definitions, plus the report reasons and subject types the group accepts. On top of this, a simple moderation information architecture is specified. In this system, a reported subject is either **open** or **resolved**. Moderators can also tag subjects and filter the queue by tag, for example `escalated` for subjects that need another moderator. Moderators may see limited information and take limited action on reports. The goal of this system is to support in-app moderation use cases. Accounts can appeal a label or ejection on themselves or their records with `mod.submitAppeal`, which reopens the subject, and see their own moderation history with `mod.querySelfHistory`. Both work for former members. Groups at scale may support significantly more complex moderation systems. However, this will likely require bespoke group moderation software and wouldn’t be done through in-app flows. Like any account, the group account itself remains subject to labels and takedowns from the wider network. ## Invites An invite is an interesting case because it must reach someone who isn’t yet a member and therefore does not necessarily have access to the group’s spaces. Invites usually should not be broadcast publicly. Instead, each user who is interested in receiving invites to groups hosts an `inbox` space under their own account, and a group writes an `invite` record into that space. The user's app creates the space with the baseline `com.atproto.memberspace.policy`, with `publicWrite` set and no members, so any group may write an invite but only the user can read the space. When a group writes an invite, its host notifies the user's PDS with `com.atproto.space.notifyRepoUpdate`, and the PDS forwards that to apps registered for the space with `com.atproto.space.notifySpaceUpdate`. Those apps can then read and present the invite to the user. Only the user (and authorized applications) may read the space. In other words, the inviting group writes the record but can’t read other invites in the space. The group writes and deletes invite records in its own repo through the standard CRUD methods. Deleting an invite revokes it. ## Migration A group migrates to a new host through the standard account migration flow, including the migration of its space repos and space policies. A group can only migrate to a host that implements `org.atgrp.policy`. Everything the group stores in repos, including labels, moves with it. Private host state does not migrate. This includes join requests, the moderation queue and history, and OAuth sessions, which users authorize again on the new host. A host may offer an export of its moderation history, but this spec does not define one. ## Group governance Atmosphere Groups is intended to standardize the interface between applications and groups. Therefore, group governance is generally considered out of scope. A group may implement arbitrarily complex governance, including things like voting and holding periods for certain actions. This is all considered out of scope for the group standard. ## Spaces, records, and methods: at a glance ### Space types | Space type | skey | Purpose | | ----- | ----- | ----- | | `org.atgrp.meta` | `self` | The group's public face. Basic information and settings. Often readable by anyone, though may be private to members. | | `org.atgrp.members` | `self` | Membership and administrative information, and the space index. Usually gated to members. | | `org.atgrp.inbox` | `self` | Hosted by each **user**, not by groups. Where invites arrive. | | *(modality spaces)* | any | `com.example.atmoboards.forum`, `app.bsky.group`, etc. Not specified here. | ### Record types | Record | Space | Author | Key | Purpose | | ----- | ----- | ----- | ----- | ----- | | `org.atgrp.declaration` | *public repo* | authority | `self` | Marks an account as a group. Discovery only. | | `org.atgrp.about` | meta | authority | `self` | Basic information for presenting the group. | | `org.atgrp.config` | meta | authority | `self` | Group settings, such as the join policy. | | `org.atgrp.rule` | members | authority | tid | One group rule with a stable URI a mod action can cite. | | `org.atgrp.labeler` | members | authority | `self` | The group's label value definitions and accepted report reasons. | | `org.atgrp.space` | members | authority | tid | Lists one space in the group's index. Maintained by the host. | | `org.atgrp.role` | members | authority | role id | Declares a role, its group-wide permissions, and its `canAssign` list. | | `org.atgrp.membership` | members | authority | member DID | Grants a member their roles. | | `org.atgrp.confirmation` | members | **member** | `self` | The member's side of membership. Gates whether the member appears in the roster, not access. | | `com.atproto.space.policy` | any space | authority | `self` | Published copy of the space's `org.atgrp.policy`: each role's access and permissions in this space, and whether it is public or unlisted. | | `com.atproto.label.record` | any space | authority | tid | A moderation label written into the space its subject lives in. | | `org.atgrp.invite` | inbox | inviting group | tid | An invitation delivered into the invitee's own space. | ### Permission sets Atmosphere Groups publishes these permission sets for group account sessions: profile, members, moderation, and admin, which includes the other three. Each covers reading and writing records in the group's own `meta` and `members` spaces, or writing invites into invitees' `inbox` spaces, plus the related methods. A set is an upper bound. A session gets only the parts the authorizing user's roles grant. | Set | Writes | Calls | | ----- | ----- | ----- | | `org.atgrp.authManageBasic` | `about` in `meta`; `rule` in `members` | — | | `org.atgrp.authManageMembers` | `membership` in `members`; `invite` in invitees' `inbox` spaces | `listJoinRequests`, `denyJoinRequest` | | `org.atgrp.authModerate` | labels in `meta` and `members`; deleting `membership` (ejection) | `mod.querySubjects`, `mod.querySubjectHistory`, `mod.updateSubject` | | `org.atgrp.authManageAdmin` | everything above, plus `config` in `meta`; `labeler` and `role` in `members`; the `meta` and `members` policies | everything above | A permission set must name a specific space type, so grants that span the group's modality spaces are listed as individual permissions. | Grant | Permission | | ----- | ----- | | Write labels in any group space | `space:*?collection=com.atproto.label.record` | | Update any group space's policy | `space:*?manage=update` | | Create and delete spaces | `space:*?manage=create&manage=delete` | ### Methods Methods handle data stored privately by the host and actions users take as themselves (not as the group). | Method | Auth | Requires | Purpose | | ----- | ----- | ----- | ----- | | `listJoinRequests` | group account session | `rpc:` permission | Lists pending join requests, which the host stores privately. Writing a requester's membership approves their request. | | `denyJoinRequest` | group account session | `rpc:` permission | Denies a pending join request. | | `mod.querySubjects` | group account session | `rpc:` permission | Lists the moderation queue, which the host stores privately. | | `mod.querySubjectHistory` | group account session | `rpc:` permission | Returns a subject's moderation history, which the host stores privately. | | `mod.updateSubject` | group account session | `rpc:` permission | Reopens or resolves a subject, or changes its tags, in the host's private moderation records, optionally with a note. | | `requestJoin` | member service auth | — | Creates a private request or redeems an invite for a non-member. | | `cancelJoinRequest` | member service auth | — | Withdraws a private join request. | | `leaveGroup` | member service auth | — | Deletes the caller's membership record, which is authored by the group. | | `mod.submitReport` | member service auth | access to the subject's space | Opens or reopens a subject in the host's private moderation records. | | `mod.submitAppeal` | service auth | subject is the caller or their record | Appeals a label or ejection, reopening the subject. | | `mod.querySelfHistory` | service auth | — | Returns the caller's own moderation history, without reports, notes, tags, or who acted. |