Files
giza-kmp/docs/confederation-room-removal.md
T
Kgothatso NgakoandClaude Opus 5.5 8ef02129ad test: a confederation formed over its groups' rooms and inboxes end to end, and the record (confederation-dkg-inboxes, Phase 8)
ConfederationNetworkJvmTest forms a confederation on three groups of three, each with a real inbox
and a real MLS room, with one group's first admin never carrying. All nine devices reach one key,
and none holds a NIP-17 room or a ceremony gift wrap. ConfederationTestGroups.pumpConfederation
takes devices that do not carry.

The record: the plan's progress and where the build chose differently, the report marked as
implemented, the README rows, and since notes in the coordinator-free, profile and room-removal
plans. Nothing has run on a device or a real relay.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 14:22:04 +02:00

52 KiB
Raw Blame History

The confederation without a room of its own

A plan to remove the confederation's own Marmot room: the MLS group, with id marmotGroupId(02‖X), that one founder's device makes once the key ceremony has formed. People already reach a formed confederation from the place they understand it, the Member of … row on their group's screen, which opens ConfederationScreen. Everything a role holder still does in the confederation's room moves there, and the confederation's signing moves onto two channels that already exist:

  • within a group, that group's own Marmot room, where its role holders already are;
  • between groups, the groups' inboxes, which already carry every statement between them.

Each group's admins are the bridge between the two. When this plan is done, no device holds a room for a confederation, and a confederation is what it always was underneath: a key, a record, and the groups that hold it.

Read confederation.md (Part C: the nested signing, Phases 13 to 15), confederation-without-coordinator.md (D11, who makes the room), and confederation-profile.md, whose D5 to D9 are the parts of the room this plan takes apart. Read group-inbox.md for the inbox the bridge writes to.

Written against 9db986c1, on 2026-11-23. Built, Phases 0 to 8, but for the device run and Phase 0's check 6, one commit a phase (Phase 5 folded into Phase 2), behind ExperimentalFeatures.confederation and ExperimentalFeatures.groupInbox, both off in release. Nothing here has run on a phone, a desktop client or a real relay. Paths starting K/ are under composeApp/src/commonMain/kotlin/mobi/giza/compose/.

Development devices. Schema 52 changed while it was built (Phases 4 and 7 were folded into it, as earlier confederation plans folded theirs), so a device that ran a build from between the phases holds a 52 Room will not open; clear its data. A device at 51 upgrades.

what the plan said what it turned out to be
Phase 2: sign every message; 30398 from Phase 4 30398 from Phase 2, as the envelope in every channel, the confederation's room included: an MLS inner event has no column for a signature
Phase 5, its own phase folded into Phase 2: once every message travels in an envelope of signed events, a voucher -- already its group's signed event -- goes in as itself, and the 30396 wrapper, with the person's key it would have needed, goes
Phase 3: write to each seat group's room as well and an envelope names the room it is written into: the same events in two rooms made one id, and the second row overwrote the first
D4: bundles carried out carried out only when their author holds a seat in that group, or they are its voucher; anything else in the room was carried in, and would bounce
Phase 4: the switch took two writes from later phases with it, both keyed onto the room: the signing's lines into the seat groups' rooms (Phase 6's D9) and no GroupSignedEvent under the confederation (Phase 7)
Phase 4: an admin who changes a bundle not built: Phase 2 already drops a changed event on any path. Withholding, and the next admin's turn, was tested instead
D9: the composer not a new screen: AddGroupPostRoute takes a confederationId
D9: an ask that needs attention its own line type, TYPE_CONFEDERATION_SIGNING_ASKED, written as the person's own, as NEEDS_YOU lines are; a profile's attempt, which asks nobody, stays quiet
Phase 7: delete the room's state, which cascades Room migrates with foreign keys off, so the migration walks PRAGMA foreign_key_list from ChatRoom and deletes dependents itself
Phase 7: a separate schema 53 if 52 had been kept folded into 52
Phase 8: ConfederationPostNetworkJvmTest a case in ConfederationProfileNetworkJvmTest, on the same three real groups and inboxes, rather than forming them twice
phase result
0 done but for check 6. (1) GroupInboxReadJvmTest already pins a stranger's seal opening on every admin's device with the stranger as the rumor's author. (2) by arithmetic, checked again in Phase 4's tests: a signed event is about 400 bytes before its content, a per-person nonce message for one seat about 600, a group's bundle of ten selected roles about 6 KB, and a 30390 carrying a 1.1 KB kind:0 and twelve vouchers about 8 KB, against MAX_STATEMENT_BYTES (60,000). (3) 30398 appears nowhere in the code, RetiredKinds or quartz; 30397 was only ever written in confederation.md. (4) MarmotRouting, MarmotRetainedEpochSecret, MarmotSenderRatchet, Participant, GroupKeyState, GovernanceProposal, ChatMessage, GroupSignedEvent and ConfederationSigningAttempt cascade from ChatRoom, and ChatRoom.mlsGroupState is a column of the room's row. Four tables name a room without a key onto it and must be deleted from by hand: MarmotGroupEvent (keyed onto NostrEvent), MarmotInnerEvent (onto MarmotGroupEvent, and an outbound one onto nothing), MarmotCommitResult, and GiftWrapPayload, which a Marmot room never holds. (5) LiveSubscriptionManager.groupInboxFilters asks with a limit and no since, so a wrap dated two days back is heard live. (6) not done: no emulator was reachable from this session. (7) five rounds, each room → carrier → inbox, and → room again for a group with a seated member who is not an admin: four relay legs at worst beside today's one, plus k × 20 seconds when the first carrier is away
1 done. Schema 52 by AutoMigration(51, 52) with ConfederationRoomRemovalMigration: the attempt's key onto Confederation, ConfederationSigningHeard, and the confederation's signed events copied out of GroupSignedEvent with SQLite's json_object. process files every round it hears there and replayStoredMessages reads it back, so no attempt reads the room's MarmotInnerEvents; DisappearingMessageSweeper forgets them once their attempt ends, or after the signing floor with none. complete files a post in ConfederationEvent; ConfederationRepository.observePosts. ConfederationProfileManager.profiles and the two observers read ConfederationEvent alone. ConfederationRoomlessStorageJvmTest 3/3, ConfederationRoomRemovalMigrationJvmTest 1/1; ShippedProfileUpgradeJvmTest comes out at 52. jvmTest 1,986
2 done, with Phase 5 folded in. Every signing message is signed by its author's key and travels in a 30398 envelope (ConfederationSigningEvents.CARRIED), here already rather than from Phase 4, since an MLS inner event has no column for a signature. Each message also names its confederation. process reads only envelopes; receive verifies each event, drops one from a person with no seat or about another confederation, and files the rest. A voucher, being the group's signed event, goes in an envelope as itself and is checked against its group's npub, so 30396 is never sent and one that arrives is dropped. A Sender (the room and the key) replaces the room parameter through the manager. decline signs too, so it takes the key. ConfederationSigningJvmTest 17/17 (two new: a changed message, and one signed by an outsider, are dropped). jvmTest 1,988
3 done. Every message, and a group's voucher, also goes into the room of every group its author holds a seat in that the device holds, beside the confederation's room, which is still the channel that works. An envelope now names the room it was written into (ConfederationSigningEvents.ROOM_TAG): the same events written into two rooms made one envelope id, and the second room's row overwrote the first's, so a message went to one room only. process already took envelopes from any room, by their confederation tag. ConfederationPeople.withGroupRooms gives the fixture each group's room, inbox key and signed 10044, with members it can demote or remove. ConfederationSigningJvmTest 19/19 (every role holder's messages in their own group's room and no other; a member who holds no seat answers nothing), ConfederationSharedSeatsSigningJvmTest 3/3 (someone seated in all three groups writes into all three rooms). jvmTest 1,991
4 done. ConfederationBridge: a message heard in a group's room -- or written there by this device's owner -- is owed out by each of the group's current admins who holds its inbox key, at k × 20 seconds by their place, but only when its author holds a seat in that group or it is that group's voucher, so nothing carried in bounces back out. Owed out is one 30398 rumor per group, confederation and sweep, sealed as the admin to every member group's announced inbox key and owed through GroupInboxPublication under the group's room; owed in is one envelope into the room, only where the group has a seated member who is not its admin. Seeing a copy back (through the group's inbox for out, in the room for in) marks it done on every other admin's device. ConfederationCarry keeps the turns, folded into schema 52, and is forgotten after the signing floor. GroupInboxManager.receive takes the identity's key, which LiveSubscriptionManager passes, and hands a 30398 to ConfederationSigningManager.receiveFromInbox; without a key it only files what came. The switch: propose takes the confederation's id; nothing in signing looks up a ChatRoom for the confederation, nor writes to one. Two writes that had a key onto the room moved here from later phases: the signing's lines go into each seat group's room (D9's half, from Phase 6), and complete no longer files a GroupSignedEvent under the confederation (from Phase 7; Phase 1 already filed it in ConfederationEvent). ConfederationProfileFollowThrough needs no room. The fixtures carry no confederation room: ConfederationSigningJvmTest's pump ferries group rooms, runs the admins' turns and delivers inbox wraps, holding back an envelope or a wrap by what it carries (opened with the fixture's inbox secrets); ConfederationTestGroups.pumpConfederation does the same over real inboxes. ConfederationSigningJvmTest 24/24 (new: no room anywhere; each group's messages cross once, carried by its first admin; with the first away, nothing of Agora's crosses until the next admin's turn twenty seconds on; a founder Agora has demoted signs for their seat through Agora's room; one Agora has removed hears nothing and the others sign). Not built as planned: "an admin who changes a bundle" -- Phase 2's tests already drop a changed event on whatever path it comes, so withholding was tested instead. jvmTest 1,996
6 done. ConfederationScreen gains Posts (its signed kind:1s from ConfederationEvent, and Add post for someone who holds a seat), Charter (signed, or Propose the charter for a seat-holder, or "no charter yet"), and Signing for a seat-holder: their attempts, the ones waiting on them first, then what is running, then the last five ended, each opening ConfederationSigningScreen. Open the confederation's room goes. The composer is AddGroupPostRoute with a confederationId, which proposes through ChatRepository.proposeAsConfederation(confederationId, …) and bylines the confederation, rather than a new screen. A post or charter the person must answer is a new line, TYPE_CONFEDERATION_SIGNING_ASKED, theirs and in NotificationClassifier.NEEDS_YOU; the proposer's own and a profile's, which nobody is asked, stay …_PROPOSED and quiet. A signed post is owed to relays by every device that signed it (D10). From the room screens: the confederation's card, its members' group labels, ConfederationRoomInfo, confederationRoomInfo, confederationOfRoom, ChatRepository.proposeCharter, ConfederationRepository.holdsRoomOf, and the confederation branches of the posts, profile and edit-profile view models; four strings, and the ceremony room's banner no longer says "works in its own room". ConfederationSigningJvmTest 26/26 (the room-info case replaced: an ask in each role holder's group room that is theirs; a post owed by every signer; the signing list's order), ConfederationProfileScreensJvmTest (a seat-holder's posts, add, charter and waiting attempt; a member without a seat offered nothing to sign; no charter said so). jvmTest 2,001; m3, brand, wallet and Marmot audits pass
7 done. ConfederationFollowThrough is deleted, with its launch, welcomeReplaces, heldUnder and Confederation.roomCreator. ConfederationFormation.isConfederation (a record, or a charter its key signed) is what a Welcome is refused on in NostrDao -- with the flag off too -- and what MarmotGroupCreation.create refuses a group id on. Folded into schema 52, ConfederationRoomRemovalMigration drops the column and every room whose id is a confederation's, after copying its signed events out. Phase 0's check 4 was wrong for a migration: Room runs one with foreign keys off, so deleting a room's row cascades nothing there (the test found its MarmotRouting row still standing). The migration therefore walks PRAGMA foreign_key_list from ChatRoom and deletes every dependent row, children first, besides the four tables that name a room with no key. D1's renames: roomIdOf is idOf, Held.roomKey is key. ConfederationCeremonyJvmTest's four room cases become two: no device holds a room under the confederation's id, and nothing makes a group under it while its id reads as a confederation's. ConfederationRoomRemovalMigrationJvmTest 2/2: the room, its inner and group events and its routing go; a member group's room and the confederation's record stay. jvmTest 2,000; the audits pass
8 the record done; the device run not. ConfederationProfileNetworkJvmTest 3/3 runs with no room of the confederation's on any device: the profile change, endorsed and signed with nobody asked, and now a post proposed by one of Agora's admins, asked of the other eight in their own groups' rooms, approved, signed on all nine devices, filed and owed to relays. The demoted founder is ConfederationSigningJvmTest's, on the per-person fixture, since the three-group harness has no way to demote. Pointers from confederation.md Phase 13, confederation-without-coordinator.md D11, and confederation-profile.md D5, D9, Phase 7 and its appendix. Not done: no device, desktop or relay has carried a round; Phase 0's check 7 is still arithmetic, and twenty seconds a place is a guess until a device run measures it. jvmTest 2,001; the audits pass; compileDebugKotlinAndroid builds

What the room does today

Traced through the code at 9db986c1.

One value, three jobs. Confederation.id is ConfederationFormation.roomIdOf(X) = SharedKeyDerivation.marmotGroupId(02‖X) (K/managers/ConfederationFormation.kt:25,44). It is:

  • the confederation's npub, the key it signs as;
  • the key everything about the confederation is stored under;
  • the room's ChatRoom.id.

No column marks a room as a confederation's. A room is the confederation's because a Confederation row has the same id. Only the third job goes.

Making the room. ConfederationFollowThrough (K/managers/ConfederationFollowThrough.kt) exists for nothing else:

  • the first person in the roster's order makes the room through MarmotGroupCreation.create;
  • the k-th person makes it after k hours if no Welcome has arrived;
  • it retries on a ten-minute tick and whenever a key package arrives;
  • a Welcome from someone earlier in the order replaces the room a device holds (welcomeReplaces, called from K/database/dao/NostrDao.kt:856-865);
  • it records who made the room in Confederation.roomCreator.

DatabaseChatRepository.followThroughCeremonies launches it (:207-210).

Signing runs entirely in it. ConfederationSigningManager sends kinds 30390–30399 as MarmotInnerEvents into the room (broadcast, :655-677) and reads them back from it (replayStoredMessages, :679-687). NostrDao.kt:1718-1735 routes them in from MLS. Every entry point needs the ChatRoom row. propose takes a LocalChatRoom, and approve, decline, resumeRunning, postVoucher and ConfederationProfileFollowThrough.takeNextStep all return silently without one. Remove the room and nothing fails out loud: an endorsed profile change stays at "Endorsed, being signed" for good.

Its rows hang off it. Three tables have a foreign key to ChatRoom(id) with ON DELETE CASCADE, and all three hold rows under the confederation's id:

  • ConfederationSigningAttempt.confederationId;
  • GroupSignedEvent.chatRoomId, which holds every event the confederation signed;
  • ChatMessage.chatRoomId, which holds the signing's lines.

Deleting the room deletes the confederation's posts. They exist nowhere else: kind:0 and the charter are also in ConfederationEvent, but kind:1 is not.

Only the room offers these. The charter is proposed from the room's card on ChatRoomDetailScreen (:865-883). Posts are read and added through the room's GroupPostsScreen and AddGroupPostScreen, and broadcast from BroadcastGroupSignedEventScreen. A signing attempt is reached only from its line in the room's transcript. ConfederationScreen has none of these. Its one link to the room is Open the confederation's room (:229-233).

It is the wrong set of people. The room is fixed at the people who held roles at formation, as people (confederation-profile.md, "What is wrong today"). Admins who joined their group later are not in it, and founders who have since been demoted still are.


The constraint that shapes the plan

The confederation's nested signing does not let a group sign in private and hand over its result. ConfederationSigning.transcript(session, nonces) is built over every selected role's nonce in every group. Each role confirms that whole transcript with its host key (ConfederationSigning.confirm), and ConfederationSigning.sign takes the full transcript and the full confirmation certificate. Only the last step is per group: aggregateGroup adds up one group's partials before aggregate combines the groups.

So every round has to reach every selected signer in every group. No channel inside a group can make that cross-group traffic go away. What a channel inside a group can do is:

  • carry each group's part of a round to one place, so that it crosses as one batch per group rather than one message per person;
  • carry the other groups' batches back to role holders who cannot read the inbox.

That is the job this plan gives each group's own room.


What changes, in one table

today this plan
the confederation's Marmot room made by the first founder in order, every role holder a member never made. Rooms already held are dropped on each device (D11)
where a role holder's signing message goes the confederation's room their group's own room, for each group they hold a seat in (D2)
how it reaches the other groups everyone is in the one room a bundle per group per round, carried by one of the group's admins to every member group's inbox (D4)
how the other groups' messages reach a role holder the one room an admin reads them in their group's inbox; for role holders who are not admins, an admin also carries them into the group's room (D4)
a signing message a rumor, authenticated by MLS a signed event from its author, so whoever carries it cannot change it (D3)
a founder demoted since formation in the room, signs in their group's room, still signs (D5)
a voucher (9438) wrapped in a 30396 by a role holder and posted into the room carried as itself in its group's bundle. 30396 retires (D7)
where the confederation's signed events live GroupSignedEvent under the room ConfederationEvent, beside its charter and profile (D8)
posts, charter, signing attempts reached through the room on the confederation's screen (D9)
a request to sign a line in the confederation's room a line in the group's room for each of the person's seats, which opens the signing screen (D9)
a signed post broadcast by hand from the room owed to relays by every device that signed it, as the profile is (D10)

Decisions

D1. A confederation is a key and a record, not a room

The confederation's id stays marmotGroupId(02‖X). It is the npub the confederation signs as, and every signed kind:0, post and charter, every #p filter and every relay copy names it. Changing the derivation would give the confederation a new npub. confederation.md's D10 still explains why the derivation is the room's: every reader of a group-signed event (isSignedByRoom, GroupSignedEvent.verifies, signingPath) already knows it. That reason does not depend on a room existing.

What changes is the vocabulary in the code. ConfederationFormation.roomIdOf becomes idOf, Held.roomKey becomes key, and every KDoc that says "the confederation's room" about the id says "the confederation's id". Phase 7 makes these renames once nothing reads the room. Making them earlier would hide which phase removed which dependency.

D2. Two channels: the group's room within a group, the inboxes between groups

A role holder writes each signing message only into the Marmot room of a group they hold a seat in, as FrostSigningManager already writes a group's own FROST rounds. A person with seats in two groups writes it into both rooms. It is the same signed event, so the copies are one message (D3). Nothing a role holder sends goes to an inbox directly.

Messages cross between groups only through the groups' inboxes, carried by admins (D4). The inboxes already carry every statement between the groups, and every member group has one, which confederation-without-coordinator.md D5 made a precondition.

Why not everything through the inboxes. A role holder can write to another group's inbox as a person, since GroupInboxManager.open accepts a seal from any sender. That costs one wrap per group for every message from every person. It also cuts off every founder who has since been demoted, because GroupInboxManager.forgetIfNotAdmin wipes the inbox key from their device. The plan would then have to choose between dropping those seats and sending personal copies to the whole roster.

Why not the key ceremony's NIP-17 room. It is a room over the founders as people, which confederation-profile.md set out to stop. It costs one wrap per person in the roster for every message, and D10 of that plan closed its composer once the ceremony ended.

Why not keep the confederation's room. It is the wrong set of people (above). It is also one more room in everyone's chat list for something they already reach from their group.

Why the group's room. Every role holder of a group is in it, admin or not, as long as they are still in the group. It is already the channel for the group's own signing rounds, so a confederation round looks to every device like what it already handles. The one cost is a hop: each round now travels from a role holder's room to an admin's inbox, and in some groups back into a room.

D3. Every signing message is a signed event, so it can be carried

Today a 30390–30399 message is a rumor. MLS says who sent it, and the confederation's room is where it was sent. Once messages are carried from room to inbox to room, the carrier is not the author. So each message becomes a signed event: kind, tags and content as today, signed with the author's own nostr key, verified on arrival against a person in the confederation's roster, and never published. This is the pattern the voucher already follows (confederation-profile.md D5).

The protocol would catch a carrier who swapped a nonce even without this. The swapped nonce changes the transcript the other groups build, the real signer's confirmation does not match it, and the certificate fails. But that failure names nobody, and it costs the attempt. With signatures, a changed message is dropped on arrival, and the carrier can only delay or withhold. A carrier could withhold before this plan too, by not answering.

ConfederationSigningManager.record keeps its rules: one message per person per round, an availability that covers every seat, later rounds naming only the sender's own seats (139f5192). They now apply to event.pubKey once its signature verifies, not to the MLS sender.

D4. Each group's admins are its bridge, one at a time, in order

Out. For each confederation and each round, an admin of group A collects the signing messages from A's room that have not yet crossed. It puts them in a bundle: a rumor of a new kind, 30398 (ConfederationSigningEvents.CARRIED), whose content is a JSON array of the signed events. The admin seals the bundle as a person, wraps it to every member group's inbox (A's own included), and owes the wraps through GroupInboxPublication under A's room. A's own copy coming back through A's inbox is how A's other admins know the bundle got out.

In. An admin of A who reads another group's bundle in A's inbox processes it at once. If A has a seated member who is not an admin of A, the admin also carries that bundle's events into A's room as one MLS message of kind 30398. That seated member is the D5 case, and they cannot read the inbox. A group whose seated members are all admins needs no carrying in, and gets none.

Who carries. A's admins are taken in bytewise order of their public keys, the same order confederation-profile.md D6 uses for who starts a signing. Admin k carries a message out if A's own copy has not come back through A's inbox k × 20 seconds after the message reached their device. Admin k carries a bundle in if it has not appeared in A's room k × 20 seconds after it reached A's inbox. The admins are A's current admins, which A's own devices know. They are not the founders, so an admin who joined A after formation carries too, though they hold no seat.

Twenty seconds rather than D6's ten minutes. A nonce lives only in memory, so a round must cross while the signers' devices are still awake. A bridge that takes minutes per round turns a signing into an hour.

Batching. One bundle carries whatever is waiting when its carrier's turn comes. Within one round, A's selected role holders send at about the same moment, so their messages usually cross together. That is one wrap per member group per group per round, at most 12 × 12, where sending each person's message to every inbox would cost one wrap per group for every person.

D5. A seat signs while its holder is in its group's room

A founder who has been demoted, but is still a member of group A, keeps their share. The experimental refresh does not take it (confederation.md Phase 0), and they are in A's room. With D2 and D4 they hear every round through A's room, so they keep signing for their seat, as they do today. confederation-profile.md's test "a role holder who is no longer an admin of B still signs for B's seat on B's voucher" stays true.

A founder removed from A is no longer in A's room and hears nothing more about the confederation, so their seat goes quiet. This is the one change from today, where they would still be in the confederation's room. A group that removes someone has said that person no longer speaks for it, so this is the intended outcome, not a loss.

Admins who joined A after formation still hold no seat. Re-seating people is governance of the roster, which is out of scope here as it was before (confederation.md Phase 15).

D6. Who sees the rounds

Every member of A's room sees the confederation rounds of A's role holders. Where A has a seated member who is not an admin, A's members also see the other groups' bundles carried in. This is how A's members already see A's own FROST sessions. Nothing in a round is secret: public nonces, host-key confirmations, partials that every device adds up. The event being signed is a post, a profile or a charter, all of which are published once signed.

The profile-change statements (9435–9437) are unaffected. They stay sealed between inboxes, and only admins read them (confederation-profile.md D2 and D3). The proposal that starts a profile's signing (30390) carries the kind:0 and its vouchers. Members who are not admins learn the new profile a little earlier than they would from the relay, which they were about to see anyway.

D7. Vouchers travel as themselves

A voucher (9438) is already a signed event, signed in the group's own FROST session in the group's room, so every device of the group holds it (FrostSigningManager.complete). It goes into the group's next bundle as itself, and the 30396 wrapper and postVoucher retire. On arrival a voucher is verified against its group's npub and filed by ConfederationProfileManager.recordVoucher, as today. A 30396 that arrives, from a device on an older build, is ignored.

D8. The confederation's signed events live with its other events

ConfederationEvent already holds the charter (9434) and every kind:0, under the confederation's id (ConfederationEvent.confederationId, schema 51). It takes kind:1 as well. ConfederationSigningManager.complete writes every event the confederation signs there, and nothing reads the confederation's events from GroupSignedEvent any more. GroupSignedEvent keeps its job for groups, and its foreign key onto ChatRoom stays right for them.

ConfederationSigningAttempt's foreign key moves from ChatRoom(id) to Confederation(id). Only a device that holds the record signs, so every attempt has a Confederation row to hang from.

D9. A role holder acts on the confederation's screen; requests are lines in their group's room

ConfederationScreen gains three sections, each with the four states the conventions ask for:

  1. Posts: the confederation's signed kind:1s, newest first, and Add post for a member who holds a seat. Adding goes through the direct path, with every role holder asked as a person, as today (confederation-profile.md, What this does not do).
  2. Charter: whether one is signed and published. If not, Propose the charter for a member who holds a seat, with the sentence the room's card has today.
  3. Signing: attempts that are running, with the ones waiting for this person first, and the last few that ended. Each one opens ConfederationSigningScreen, which is already room-free.

Open the confederation's room goes.

The lines announce writes today into the confederation's room (proposed, failed, profile signed, post signed, charter signed) go into the room of each group the person holds a seat in. Each device writes them for itself and sends nothing, the pattern confederation-profile.md D8 set. A line about an attempt opens the signing screen, and a line about a signed event opens the confederation's screen. NotificationClassifier treats an attempt that is waiting for this person's answer as needing attention, the way a FROST session waiting for you is. Today the confederation's lines are silent, because the room's transcript was where a person looked.

D10. A signed post is published, by every device that signed it

Without the room, BroadcastGroupSignedEventScreen has nothing to open, and a confederation's post would be signed and then go nowhere. A post is therefore marked owed on every device that signed it, the same way confederation-profile.md's Phase 6 owes the kind:0, and ConfederationPublisher sends it to the publish set and to every member group's 10050 relays.

D11. The rooms that exist are dropped on each device, and a Welcome to one is refused

The feature has never been on in a release, so the only rooms are on development builds and emulators. A migration deletes, on each device:

  • the ChatRoom row under a confederation's id, with its MLS state;
  • the queued MarmotInnerEvents and the room's lines.

Before that, it copies any GroupSignedEvent under the id into ConfederationEvent, so posts survive. Running attempts are dropped too: their nonces would not have survived a restart anyway.

Nothing is sent to the MLS group. Every member drops it, so nobody is left to read a leave commit.

A Welcome whose group id is a confederation this device knows, by record or by charter, is refused and never joined. Without this, a device on an older build that still runs ConfederationFollowThrough would make the room again, and NostrDao would accept it as an ordinary invite. MarmotGroupCreation.create refuses that group id for the same reason.

D12. Behind both flags

Signing now needs the group inbox, so everything here is behind both ExperimentalFeatures.confederation and ExperimentalFeatures.groupInbox. The profile work already needed both. The Welcome refusal (D11) runs with the flags off, as every refusal does. The welcome replacement it takes over from was not behind a flag either (NostrDao.kt:864).


Who is asked what

step who is asked what they decide automatic after that
propose a post a member with a seat, on the confederation's screen the post writing the 30390 into each of their seat groups' rooms; the bridge
propose the charter a member with a seat, on the confederation's screen that the charter be signed as above
a post or charter attempt arrives every role holder, as a person, from the line in their group's room yes or no, for each seat nonces, confirmations, partials, carried by the bridge
a profile change reaches T vouchers nobody — as confederation-profile.md D5 and D6, with the rounds on the new channels
signed nobody — filed in ConfederationEvent; owed to relays by every device that signed it
carrying a bundle nobody — the admins' devices, in order

The questions a person is asked do not change. What changes is where the question appears, and that a member who holds no seat is never asked anything.


Phases

One commit per phase, in the repository's style (feat: … (confederation-room-removal, Phase n)). Every phase leaves these green: ./gradlew :composeApp:jvmTest, :composeApp:m3Audit, compileDebugKotlinAndroid, and the brand and wallet audits in check. Until Phase 4, signing still runs in the confederation's room. Each phase before it makes one dependency on the room unnecessary, without removing the room.

Phase 0: this document, and seven checks

As scratch tests where a check is code, kept as pins where they stay true:

  1. A person's seal to a group's inbox. A wrap sealed by a person's key to a group's announced inbox key opens in GroupInboxManager.open, and its rumor's author is the person. This is what D4's carrier relies on.
  2. A signed event inside a rumor survives intact. It must come out of both a seal and wrap and an MLS application message byte for byte, with its signature verifying. Record the largest bundle: a 30390 over a 1.1 KB kind:0 with twelve vouchers, and a nonce round of twelve groups at ten selected roles each. Compare both with MAX_STATEMENT_BYTES.
  3. 30398 is free. It must appear nowhere in RetiredKinds, Bennu's kinds, the NIP kind table or quartz. 30397 was reserved for a failure in confederation.md Phase 14 and never used, so leave it alone.
  4. Every row a Marmot room leaves behind. List every table keyed by a room's group id or routing id: ChatRoom.mlsGroupState, epoch secrets, key schedules, the MLS stores marmot-kmp persists (marmot-kmp.md Phase 9). Phase 7's migration must delete all of them.
  5. The inbox hears a back-dated wrap live. NIP-59 dates a wrap up to two days in the past. Check that the live inbox filter's since does not drop a wrap made a second ago and dated yesterday. D4's twenty seconds assume a carried bundle is heard within seconds.
  6. What the development devices hold. On the emulators that ran 139f5192, count the confederation rooms, their posts and any running attempts, so Phase 7 is tested against the state that exists.
  7. The hops. Count the legs an attempt takes now. Signing is five rounds: availability, selection, nonces, confirmations, partials. Each crosses as room → carrier → inbox → (carrier → room). Write down the worst-case extra delay at k = 0, so the device run has a number to beat.

Phase 1: the confederation's storage stands without the room (D8)

Schema 52, by auto-migration with a spec:

  • ConfederationSigningAttempt's foreign key moves to Confederation(id). Room rebuilds the table.
  • ConfederationSigningHeard: every signing message this device has heard for a confederation, by any path. Its columns are the event id (primary key), confederationId, sessionId (nullable, for a voucher), kind, pubKey, the signed event's JSON and heardAt. This replaces marmotInnerEventDao().getByChatRoomAndKinds(confederationId, …) as the place replayStoredMessages reads from, since messages will arrive through several rooms and inboxes.
  • ConfederationEvent takes kind:1. complete writes every signed event there, beside GroupSignedEvent (kept until Phase 7).
  • The migration copies every GroupSignedEvent whose chatRoomId is a confederation's id into ConfederationEvent.

ProtocolRetention gets a rule for ConfederationSigningHeard: a message is released once its attempt is complete or failed. A message with no attempt here is released after the signing floor, which is what the rule already does for FrostSigningEvents.

Readers move to ConfederationEvent: ConfederationProfileManager.profiles, DatabaseConfederationRepository.observeProfile and observeProfileChanges, and a new ConfederationRepository.observePosts(confederationId).

Tests: ConfederationStorageJvmTest gains:

  • an attempt filed with no ChatRoom row;
  • posts read back from ConfederationEvent;
  • the copy from GroupSignedEvent, opened from a v51 database the way ShippedProfileUpgradeJvmTest opens one.

Phase 2: every signing message is signed by its author (D3)

  • ConfederationSigningManager.publishOwn and broadcast sign the event with the author's nostrPrivateKey. It is still sent into the confederation's room.
  • process and record verify the signature and read the sender from event.pubKey. An unsigned or wrongly signed message is dropped with a warning. A message whose author holds no seat is dropped, as before.
  • Every message heard is written to ConfederationSigningHeard.

Tests: ConfederationSigningJvmTest stays green unchanged, which shows the signatures cost the protocol nothing. Two cases are added:

  • a message whose content was changed after signing is dropped on every device;
  • a message signed by someone outside the roster is dropped.

Phase 3: the group's room carries its role holders' messages (D2)

  • Each signing message is also written into the room of every group where the author holds a seat. It carries a ["confederation", <id>] tag, because the room no longer says which confederation it is about.
  • NostrDao's MLS branch for ConfederationSigningEvents.ALL routes by that tag rather than by the room's id. The branch for the confederation's room stays until Phase 4.
  • DisappearingMessages: the signing kinds keep their class. The stamp now uses the group room's policy, and the signing floor still applies.

The writes go to both places in this phase. The confederation's room remains the channel that works, and the group rooms are filled beside it, so Phase 4 can switch over without a gap.

Tests: on ConfederationTestGroups (three groups of three, real FROST, real inboxes; from confederation-profile.md Phase 8):

  • every role holder's message is in its group's room on every device of that group, and in both rooms for a person seated in two groups;
  • a member of the group who holds no seat files the message and does not answer it.

Phase 4: the bridge, and the switch (D4, D5)

  • ConfederationSigningEvents.CARRIED = 30398, a bundle. ConfederationBridge decides when to carry and keeps two marks per event and group room: crossedAt (A's own copy came back through A's inbox) and carriedInAt (the bundle appeared in A's room). The order and the k × 20 seconds are D4's. It runs on the sweep SynchronizationViewModel already runs, and whenever a message arrives.
  • Out: an admin's device bundles, seals as the admin, and wraps to each member group's announced inbox key. It owes the wraps through GroupInboxPublication under the group's room, with relays from InboxAnnouncements and the groups' 10050s, as ConfederationManager.proposeSealed finds them.
  • In: GroupInboxManager.open takes a 30398 before the inbox's own filing, as it does for statements. It verifies each event in the bundle and hands it to the signing manager. When the group has a seated member who is not an admin, it also queues the bundle for carrying in.
  • DisappearingMessages.classOf(30398) is the signing class. DisappearingMessagesTest fails until it is.
  • The switch. broadcast stops writing to the confederation's room. propose, approve, decline, resumeRunning and ConfederationProfileFollowThrough.takeNextStep stop looking up a ChatRoom: they take the confederation's id and find this person's seat groups' rooms. A seat group with no room on this device is an error said out loud, not a silent return.

Tests: the confederation's ChatRoom row goes from ConfederationSigningJvmTest's fixture, ConfederationSharedSeatsSigningJvmTest and ConfederationProfileNetworkJvmTest. The fixture now ferries group rooms and inboxes. Every existing case must pass on the new channels, plus:

  • a demoted founder signs: Agora demotes one of its founders, and the profile is still signed with that founder's seat selected, through Agora's room alone;
  • a removed founder is not heard: Agora removes them, and the attempt selects someone else;
  • one carrier at a time: with every admin online, each bundle crosses once; with the first admin away, the second carries after twenty seconds on the test clock;
  • an admin who changes a bundle: the changed event is dropped at the far end, and the attempt goes on once the next carrier's copy arrives;
  • a group with no admin online: its round does not cross, and the attempt's existing retry carries the change once one comes back (confederation-profile.md D6).

Phase 5: vouchers travel as themselves (D7)

  • The group's bridge carries a signed 9438 like any other event, once the group's FROST session completes. ConfederationProfileManager.onSigned stops calling postVoucher, which goes.
  • ConfederationSigningEvents.VOUCHER (30396) leaves ALL. One that arrives is ignored, and a KDoc line says why the number stays reserved.

Tests: confederation-profile.md's voucher cases in ConfederationSigningJvmTest and the network test pass with the vouchers in bundles. Add that a 30396 is ignored.

Phase 6: the confederation's screen takes over (D9, D10)

  • ConfederationScreen: the Posts, Charter and Signing sections. Each has its loading, empty and error states and a required EmptyState message. Remove the room button.
  • Posts: AddConfederationPostRoute reuses AddGroupPostScreen's form, moved into a shared composable the way NostrProfileForm was, and proposes through ConfederationSigningManager. Posts are owed to relays on every device that signed them (D10).
  • Charter: the room card's proposal moves here, with its two strings.
  • Signing: ConfederationRepository.observeAttempts(confederationId).
  • announce writes into each seat group's room. Add the click handling for the new lines in ChatTranscript, and the classifier rule.
  • Remove from the room screens: canSignAsConfederation, proposeAsConfederation, confederationRoomInfo, confederationOfRoom, and ConfederationRoomInfo with its card on ChatRoomDetailScreen and its member labels. Remove the confederation branches of AddGroupPostViewModel, GroupPostsViewModel, GroupNostrProfileViewModel and EditGroupNostrProfileViewModel, whose isConfederation is already always false.
  • Strings: add the sections' strings in sentence case. None of them says "room", "inbox", "bundle" or "voucher" to a person. Remove this_is_the_confederations_room, open_the_confederations_room, group_and_its_role_holders and admins_who_joined_later_are_not_here. Move propose_the_charter and the_charter_names_the_groups.

Tests:

  • ConfederationProfileScreensJvmTest gains: the three sections in each state; a member who holds no seat sees posts and no Add post; an attempt waiting for you is listed first.
  • ConfederationScreensJvmTest loses its room cases.
  • The signing test checks that the lines are in each seat group's room, and that a post signed on nine devices is owed on each of them.

Phase 7: no room is made, and the ones that exist go (D1, D11)

  • Delete ConfederationFollowThrough and its launch in DatabaseChatRepository. Delete welcomeReplaces and heldUnder and their calls in NostrDao.
  • NostrDao's Welcome path refuses a group id that is a known confederation's. So does MarmotGroupCreation.create.
  • Remove NostrDao's MLS branch for the confederation's own room. complete stops writing GroupSignedEvent.
  • The migration: drop Confederation.roomCreator, then delete every confederation room with every row Phase 0's check 4 listed. Fold this into schema 52 if Phases 1 and 7 land before a build that anyone keeps, as the earlier confederation plans folded theirs. Otherwise use 53.
  • Make D1's renames. The ceremony room's banner string the_key_ceremony_for_is_complete stops saying "The confederation works in its own room now."

Tests:

  • ConfederationCeremonyJvmTest's four room cases (:367-454) are replaced. A formed confederation leaves no ChatRoom under its id on any of the nine devices, even after the old hour and two hours have passed on the test clock.
  • A Welcome for a confederation's id is refused.
  • A v51 database holding a room, two posts and a running attempt opens at the new version with the posts in ConfederationEvent and nothing left of the room.

Phase 8: the network run, the record, and devices

  • ConfederationProfileNetworkJvmTest and a new ConfederationPostNetworkJvmTest, end to end with no confederation room anywhere:
    • a profile changed, endorsed, signed with nobody asked and published;
    • a post proposed from the confederation's screen, approved from the line in each role holder's group room, signed and published;
    • one founder demoted in Agora, still signing.
  • The record: this document's header and a progress table, and a "where the build chose differently" table. Add a line at the top of confederation.md Phase 13, confederation-without-coordinator.md D11, and confederation-profile.md D5, D9 and Phase 7, pointing here. Add confederation-profile.md's appendix row "run the confederation's nested signing through the groups' inboxes", with what this plan found. Add the README row.
  • Device run, on the emulators that hold rooms today:
    • upgrade them and check the rooms are gone and the posts are on the confederation's screen;
    • sign one profile change and one post across three groups, with one demoted founder seated;
    • measure the time each round takes to cross, against Phase 0's check 7.

What this does not do

  • Governance of the roster. Admins who joined after formation hold no seat. A founder removed from their group stops signing but still holds a share. Re-seating people needs a new key-state transition signed by the confederation. That is confederation.md Phase 15's unbuilt half, and it is no closer or further than before.
  • Posts and the charter through the groups. They keep the direct path, with every role holder asked as a person. confederation-profile.md names moving them onto group statements as its own next plan, and nothing here stands in its way.
  • Retiring the voucher. Under D5, a role holder may not be an admin and so may never see their group's sealed endorsement. The transferable voucher stays necessary.
  • Making signing tolerate a restart. Nonces still live in memory only. The bridge adds latency to each round, which makes a restart mid-attempt somewhat more likely, but not a different problem.

Risks

risk what to do
the extra hop per round makes signing too slow for devices that are online together only briefly Phase 0 check 7 sets a number; the device run measures it. D4's twenty seconds is the lever, and a carrier sends the moment its turn comes rather than waiting to batch
a group's inbox relays rate-limit a burst of wraps at most one wrap per member group per group per round (D4); the existing backoff of GroupInboxPublication
a group rotates its inbox key during an attempt the carrier reads each group's current announcement for every bundle; a bundle sealed to the old key is lost, and the attempt's retry covers it
no admin of a group is online, so its seated members cannot be heard the round waits, and the attempt fails and retries as today; the signing screen names the group being waited on
a malicious admin withholds or changes bundles changes are dropped (D3); withholding is covered by the next admin in order; an admin of every group's choosing is trusted this far already, by the group
a group's members who are not admins now see confederation rounds in their room D6: nothing in them is secret, and the event is about to be public
a device on an older build makes the room again the Welcome refusal (D11); the feature has never been in a release
the migration misses a table of MLS state, and a dropped room comes back half-open Phase 0 check 4, and Phase 7's upgrade test opening a v51 database with a room in it

Out of scope

  • Anything about the key ceremony and its NIP-17 room, which stays as confederation-profile.md D10 left it. Since confederation-dkg-inboxes.md: the ceremony runs over this plan's bridge too, and has no room.
  • Re-seating admins, and removing a seat.
  • Threshold-ECDH member groups, as in the earlier plans.

Appendix: considered and not chosen

idea why not
keep the room, and only hide it from the chat list it stays the wrong set of people (founders, as people), and its signing still runs where none of a group's other members can see it
every message straight to every group's inbox, as a person one wrap per group per message per person, and every demoted founder cut off by forgetIfNotAdmin (D2)
run signing in the key ceremony's NIP-17 room one wrap per founder per message, in a room over people that confederation-profile.md D10 closed (D2)
let each group combine its own nonces and send one the transcript is over every role's nonce and every role confirms all of it; the protocol has no per-group nonce
a fixed carrier per group, its first admin one person away stops their group's rounds; the order with a fallback costs twenty seconds instead
carry a bundle in for every group, always only a group with a seated member who is not an admin needs it; elsewhere it doubles each round's traffic in the room for nothing
delete the rooms on devices with a leave commit every member drops the room, so nobody is left to process the commit

Order and size

phase rough size depends on
0 this document, scratch tests —
1 ~250 main, ~250 test, an auto-migration with a spec 0
2 ~150 main, ~150 test 1
3 ~200 main, ~250 test 2
4 ~600 main, ~700 test 3
5 ~100 main, ~100 test 4
6 ~700 main, ~350 test 1 (the screen), 4 (its lines)
7 ~150 main, removing ~400, ~250 test 4, 6
8 ~400 test, docs, a device session all

Phase 6's screen sections need only Phase 1 and can be built beside Phases 2 to 5, with the lines following Phase 4. Phase 4 is the one to review closely: it is where the room stops being the channel, and every existing signing test moves onto the new one.

Checking the work

./gradlew :composeApp:compileDebugKotlinAndroid :composeApp:jvmTest
./gradlew :composeApp:m3Audit
./gradlew check

The new tag (confederation) and kind (30398) are wire values, not hash inputs, so no mantra/… tag is added. Bennu is named nowhere but in comments, and no kind in RetiredKinds is touched.