**Built**, phases 0-7, one commit each. The phases below are kept as written,
because they are the reasoning; where the build chose differently the table says
so, and it did nine times worth reading:
| what the plan said | what it turned out to be |
|---|---|
| a new `ChillDkgRitualManager.foundingMembersOf` | never built. `participantsOf` already was that function, fallback and all; Phase 1 made `MarmotGroupCreation.createFor` its one caller on the way to a room, and took the list off `ChatRepository.createMarmotGroup` altogether |
| Phase 2's `stampAdmins` replaced by `AdminFlags.reconcile` with the creation's list | with the group's policy instead. Reading the list back would have kept two sources for one flag, which is the drift D2 is about |
| Phase 2's Welcome test in `WelcomeBundleMatchJvmTest` | in `RobustGroupAdminsJvmTest`, where Phase 0 already delivers real gift-wrapped Welcomes between three app devices. The bundle test is about which key package a Welcome names, not what it leaves behind |
| Phase 3 reports `Differs(missing, unexpected)` and offers removing unexpected admins | `Missing` only. Removing an admin is out of scope, so an admin the ceremony did not have is not this plan's to act on |
| Phase 3's repair on every room | on the current profile only. The app makes no governance commit on a legacy room -- no removal, no disband -- so a legacy room gets the warning and the transcript line and not the button |
| Phase 4 invites founders "who have never had a row in the room, not even a soft-deleted one" | founders without a leaf in a room still at **epoch 0**. Rows are hard-deleted when a member leaves, so "never had a row" cannot be told from "left"; epoch 0 can, because leaving is a commit and the founding invite is the commit that ends epoch 0 |
| Phase 4 is about `notAdded` | it also fixed what Phase 0 found: on the current profile `MarmotGroupCreation` invited the founders through a room read before its routing id was recorded, so the engine adopted a second copy of the group under the room id, and every later invite into that room took the founding path -- no commit, and nobody already in the room told |
| Phase 4's "Invite again" for any other active admin | only on the device holding the room at epoch 0, which is its creator's: nobody else holds the room until the invite reaches them. The coordinator's device does it on its own as step 4 |
| Phase 6 reconciles behind a stored "reconciled" preference | on every start, with no flag. `AdminFlags.reconcile` writes nothing when the rows already agree, so running it again costs one decode per room and a preference would only be a second thing to keep right |
├─ the NIP-17 room members = picked + creator; no admins, no MLS
│ └─ proposeRitual ceremony participants = room members + creator
│
├─ the ChillDKG key t-of-n over those participants
│
└─ the admin room (Marmot) id = marmotGroupId(threshold key)
created by CeremonyFollowThrough (step 3) or DkgRitualViewModel,
both through MarmotGroupCreation.create(adminPublicKeys = participantsOf(session))
```
The NIP-17 room has no admin concept, and that is correct: membership is the p-tag set
and nothing in it can be governed. **Admin means admin of the Marmot room**, whose
epoch-0 admin policy (`AdminPolicyV1` on the current profile, `MarmotGroupData.admin_pubkeys`
on the legacy one) is what the library enforces and what `isLocalAdmin()` reads.
`Participant.adminAt` is a local cache of it.
A subgroup is the same shape with a different participant set, and everything below
applies to it unchanged.
`ChatRoomType` is not persisted. Nothing on a device records that a room was made robust;
what marks one is a `GroupKeyState` -- a room whose id is derived from a threshold key.
## What "founding member" means
**D1. The founding members of a key-backed room are the participants of the ceremony that
made its key** -- `DkgSession.participantPublicKeySet()` on the row
`GroupKeyState.dkgSessionId` names. For a top-level robust group that is the picked members
plus the creator; for a subgroup, the picked admins plus the coordinator.
Not the NIP-17 room's rows, which `ChillDkgRitualManager.memberPublicKeys` already warns
can drift. Not the admin list a Welcome arrives with, which is one device's claim. The
session row is the one record every founding member's device built independently from the
proposal it agreed to, and the ceremony would not have completed if they disagreed about `n`.
A member added to the admin room later is not a founding member and is not made an admin by
anything here.
## Where the promise breaks today
| | gap | effect | phase |
|---|---|---|---|
| G1 | The founding set is computed at three call sites -- `SelectChatRoomTypeViewModel.adminCount`, `CeremonyFollowThrough.takeNextStep` step 3, `DkgRitualViewModel` -- and passed into `MarmotGroupCreation.create` as a free parameter. `participantsOf` falls back to the room's rows when the session carries no set | nothing stops a caller passing a different set; a room's admin list is fixed at a derived address forever, so one wrong call is permanent | 1 |
| G2 | The Welcome path in `NostrDao` writes `Participant.fromMlsGroup(...)` rows with no `adminAt`. Only the creator (`stampAdmins`) and a later commit (`processGroupMembershipChanges`) ever set it | on every device but the creator's, the admin room shows no admins until some other commit arrives -- which may be never | 2 |
| G3 | A joiner never checks the admin list it was welcomed into against the ceremony it took part in | a device that created the room with a different list (a bug, an older build, a Bennu peer) goes unnoticed | 3 |
| G4 | `MarmotGroupCreation.create` returns `notAdded` when `addMembers` partly fails. Those founding members are listed as admins but hold no leaf, so the policy treats them as inactive, and nothing invites them again | a founding admin who is not in the room | 4 |
G2 has a smaller blast radius than it sounds: `canGovern` reads `isLocalAdmin()`, and
`SubgroupManager` reads `currentAdminIdentities()`, so permissions are right. What is wrong
is every reader of `adminAt` -- today the subgroup picker's "Admin of this group" line --
and the fact that two devices disagree about the same room.
## Decisions
**D2. The admin policy is the truth; `adminAt` is derived from it on every path.** One
function writes the flags, from `mlsGroup.currentAdminIdentities()`, and the creation,
Welcome and commit paths all call it. `stampAdmins` stops taking a list of its own.
**D3. No wire change.** Putting the founding set on the signed `GroupKeyStateEvent` (so a
quorum signs it) was considered and left out: every founding member already holds the set
on its own session row, a later joiner is by definition not one of them, and the 30326 event
is shared with Bennu. Revisit if a device ever needs to check the founding set without
having taken part.
**D4. No schema change.** Every check below is derived on demand from rows that already
exist -- the session, the key state, the stored MLS group, the participant rows -- so no