Files
giza-kmp/docs/confederation-profile.md
T
Kgothatso NgakoandClaude Opus 5.5 6b5fb76cbe test: a confederation's post end to end with no room anywhere, and the record (confederation-room-removal, Phase 8)
On three real FROST groups with real inboxes, one of Agora's admins
proposes a post; the other eight are asked in their own groups' rooms,
approve, and every device signs it, files it as the confederation's post
and owes it to relays, with no room of the confederation's on any of them.

The plan's header and its table of where the build chose differently;
pointers from confederation.md Phase 13, confederation-without-coordinator.md
D11 and confederation-profile.md D5, D9, Phase 7 and its appendix, whose
rejected idea this plan took up. No device run.

Full jvmTest 2,001, all passing; m3, brand, wallet and Marmot audits pass;
compileDebugKotlinAndroid builds.

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

56 KiB
Raw Blame History

A confederation's profile, decided by its groups

A plan to run a formed confederation's nostr profile (its kind:0) from the place where people already understand a confederation: the group's own screen. From there, an admin opens the confederation's screen, edits its profile, and the edit goes out as a proposal from their group to every other group's inbox. The other groups endorse it or object, each by its own quorum. Once enough groups have endorsed, the confederation signs the new profile and it is published. Nobody is asked a second time.

Read confederation.md (Parts B and C: the key, the room, the nested signing), then confederation-without-coordinator.md, whose statements, seals and refusals this plan reuses for a new kind of statement, and group-inbox.md, which carries them. group-nostr-profile-and-posts.md defines what a group's profile is and how its form works. This plan reuses that form.

Written against 3b0b3c9a, on 2026-11-22. Built, Phases 0 to 8, on claude/confederation-profile, behind ExperimentalFeatures.confederation and ExperimentalFeatures.groupInbox, both off in release. The device run (Phase 9) has not been done. Each phase says under it what was built and where it differs from what it planned. Paths starting K/ are under composeApp/src/commonMain/kotlin/mobi/giza/compose/.

phase commit result
0 3e05a28b the plan, and three premises as tests. A profile change carries the whole kind:0 in every group's seal: 1.1 KB of profile fits twelve groups, 13 KB fits two
1 4994248d kinds 9435–9438, the state of a change, and one nullable column (schema 51, built as 50) rather than three tables
2 c293514d a group proposes, endorses or objects, sealed to every member group's inbox, its voucher signed in the same session; seven refusals. The charter gains its threshold
3 44cbe596 a line in every member group's room for every statement, in any order
4 5d6bbcd5 the confederation's screen, its profile form and a change's screen, reached from the group's screen
5 8d494ddb vouchers into the confederation's room; the first in the order starts the signing; nobody asked; crossing attempts and retries; the direct kind:0 path closed
6 19cd1aae the signed profile owed by every signer, to the public and every group's inbox relays; heard by every member by the confederation's key
7 6285033c the confederation's room names its groups; the ceremony's room, once formed, leads to the confederation and takes no messages
8 33e88f62 the plan end to end on nine devices, formed the real way, and the record. No device run

Full jvmTest 1,903, all passing (from 1,864 before Phase 1); m3Audit, brandAudit and walletAudit at their budgets; compileDebugKotlinAndroid builds.

Merged into giza after disappearing messages (docs/disappearing-messages.md), which had taken schema 50 for its storage first. This plan's column is therefore v51, AutoMigration(50, 51); every "schema 50" below is that one, as it was numbered while it was built. One conflict besides: in GroupInboxManager, a profile statement is handed to the confederation before the inbox's NIP-40 expiry check, as the formation's statements already were. After the merge, full jvmTest 1,978, all passing, with the audits at budget and compileDebugKotlinAndroid building.


What is wrong today

Traced through the code at 3b0b3c9a, with the working tree's ceremony-room changes applied.

The confederation's room does not show which groups are in it. ConfederationFollowThrough makes a Marmot room whose members are the people who hold roles: every admin of every group, at the time it formed. The room's detail screen lists them as people. The confederation is made of groups, and the room does not say which group each person belongs to. The device already knows: ConfederationRosterBuilder.Plan.seatsOf(person) gives each person's seats, and each seat names its group. Nothing reads it for display.

The proposal screen is the only place that shows the confederation as groups. ConfederationProposalScreen lists every group, by name, with its answer. That is the right view of a confederation, but it is framed as a proposal. Once the confederation has formed, the card on ConfederationsScreen says "Formed" (ConfederationsUIState.Item.formed) and still opens the proposal. That screen has nothing to say about a confederation after it exists.

The key ceremony's NIP-17 room has nothing to do once the ceremony ends. The room is made over the roster's people (deriveChatRoomId(people), D8 of the coordinator-free plan), so it appears in everyone's chat list. It carries 30381–30385 while the ceremony runs. After that it receives nothing. The working tree adds a banner that links the room to its ceremony (ChatRoomMessagingUIState.keyCeremony, ConfederationRitualManager.proposalOfRoom). After formation, the banner has nothing to point to.

The confederation's profile is edited by people, not groups. Phase 15 of confederation.md opened the existing editors in the confederation's room. EditGroupNostrProfileViewModel sees canSignAsConfederation and sends the kind:0 to ChatRepository.proposeAsConfederation, which calls ConfederationSigningManager.propose. Every role holder is then asked in that room (30391), as a person. The groups never decide anything as groups, and their inboxes never hear of it. A group's members who are not admins never hear of it either. Two admins from the same group can sign the confederation's profile with no one else in their group knowing.


What changes, in one table

today this plan
where a profile is edited the confederation's Marmot room, by a role holder the confederation's screen, reached from any member group's screen, by an admin of that group
what an edit is a signing attempt (30390) in the confederation's room a statement by a group (9435), sealed by its quorum, sent to every member group's inbox
who decides each role holder, as a person, in 30391 each group, by its quorum: endorse (9436) or object (9437)
how many must agree T groups' worth of role holders saying yes, one by one T groups endorsing. The proposing group's statement counts as its endorsement
what a role holder is asked to approve the attempt nothing. Their device says yes for each seat whose group vouched (D5)
who starts the signing the person who proposed the first role holder in a fixed order who holds T vouchers, with a fallback (D6)
who publishes the kind:0 nobody automatically (the broadcast screen) the device that started the signing, owed until a relay takes it (D7)
what each group's room says nothing, unless a member holds a role a line when a change is proposed, endorsed, objected to, published (D8)
the confederation's room members as people members labelled by group, with a groups card (D9)
the ceremony's NIP-17 room after formation an open chat with nothing in it read-only, with a banner linking to the confederation's screen (D10)

Decisions

D1. A formed confederation gets its own screen, reached from the group's

ConfederationScreen (route ConfederationRoute(activeUserPublicKey, chatRoomId, confederationId), where chatRoomId is the member group's room it was opened from) is the confederation's detail screen. It is reached in two ways:

  • from ChatRoomDetailScreen: one row per formed confederation the group is in ("Member of Polis League"), placed above the existing Confederations row;
  • from ConfederationsScreen: a card whose proposal has formed opens this screen instead of the proposal. The proposal screen stays reachable from here, under "How it was formed".

It shows, top to bottom:

  1. The profile: picture, name, about, website, nip05, npub. This is the newest valid kind:0 authored by the confederation's id (D7).
  2. The groups: each member group by name, with the number of roles it holds. For a device that holds the record, it also lists who holds those roles. This is the view the proposal screen gives, but describing the confederation rather than the vote that made it.
  3. Profile changes: each open change, and the most recent closed ones, with their state and each group's answer (D4).
  4. Edit profile, for a member who can put a statement to their group (D2).
  5. Links to the confederation's room, when this device holds it, and to the proposal.

Who sees what. Every member of a member group's room can open the screen. Members who are not admins hold no record and none of the statements between the groups, so for them it is built from public data: the charter (9434) for the groups and the kind:0 for the profile. Admins also see the changes, because those come through the group inbox, which only admins read. The screen does not guess. A part it cannot fill shows an EmptyState that says why: "Only the group's admins see proposed changes."

The confederation's groups come from the Confederation record when the device holds one, and from a verified charter otherwise. The charter is the confederation's own signed list of its groups. That is enough for a device that never took part to know whom a change must go to.

D2. An edit is a statement by a group: kind 9435, to every member group's inbox

An admin edits the profile on EditConfederationProfileScreen. It is the existing profile form, moved out of EditGroupNostrProfileScreen into a shared NostrProfileForm composable, with its own view model. Propose does not ask the confederation to sign. It asks the admin's group to sign a statement proposing the change. That statement goes through ConfederationManager.proposeStatement, as the confederation's proposals and answers do now: one seal per member group (this group's own copy included), sealed with the group's inbox key, signed by the group's quorum through FROST, and wrapped to each group's 10050 relays.

9435 rumor, pubkey = the proposing group's npub
tags:
  ["p", <every other member group>] …
  ["confederation", <the confederation's id>]
  ["base", <id of the kind:0 this edits>]                 absent when the confederation has none
  ["expiration", "<unix seconds>"]                        default 3 days, at most 7
content: the unsigned kind:0, as JSON:
  {"pubkey":"<confederation id>","created_at":<now>,"kind":0,"tags":[…],"content":"…"}

The kind:0's created_at is fixed when it is proposed, so its id is fixed before anyone answers. Every endorsement, voucher and signing attempt names that id. Nothing that is signed later can differ from what was endorsed.

Who can propose: a member of the group's room with a share in its active generation, who holds the group's announced inbox key (an admin, as D5 of the coordinator-free plan requires). Every member group must have announced an inbox. The form checks the same things ProposeConfederationScreen checks before it allows Propose, and gives the same reasons: "Set up the group's inbox first", or "Agora has no inbox, so it cannot be asked".

An admin of two member groups picks which group proposes, from a choice on the form that appears only when there is more than one group to pick from. The group is the author. The person is not.

Size. One seal per group, each holding the whole kind:0, so the profile a change can carry shrinks as the groups grow: about 13 KB of text to two groups, 4 KB to six, 1.1 KB to twelve (Phase 0, check 3). A name, an about of a paragraph, a picture URL, a website and a nip05 fit any confederation. The check against MAX_STATEMENT_BYTES that proposeSealed already makes refuses a larger one, and the form says why in a profile's terms: "This profile is too long to send to 12 groups. Shorten its about."

D3. Answers: endorse (9436) or object (9437), each by the group's quorum

9436 rumor   endorsement
tags: ["p", <every other member group>] …, ["confederation", <id>], ["e", <9435 rumor id>],
      ["profile", <the kind:0's id>]
content: empty

9437 rumor   objection; from the proposing group, a withdrawal
tags: as 9436
content: an optional reason, plain text

An answer goes to every member group, not only the proposer. Every admin of every group sees how every group answered, as with the formation statements. Each answer's signing session carries the 9435's seal in confederation_invitation, as answers to a proposal already do. A signer therefore does not depend on its own inbox having received the change.

ConfederationProposalScreen's Accept/Decline pair becomes Endorse / Object on the change's own screen (ConfederationProfileChangeScreen, opened from the confederation's screen and from the line in the group's room). Under them is the change as a field-by-field difference from the profile it edits:

Name     Polis League  →  Polis League of the Coast
Picture  (unchanged)
About    (cleared)

The same difference appears in ProposedEvent's summary on the FROST approval screen. A member who opens the signing session from the room's transcript sees what their group is being asked to say, not "Event of kind 13".

D4. A change's state is computed from the statements held, on every device

ConfederationProfileChange.State, computed whenever it is read, as ConfederationStatus is for proposals. E is the number of groups that endorsed (the proposer included), O the number that objected, and N and T are the confederation's.

state when
WITHDRAWN the proposing group's 9437 is held
PUBLISHED a signed kind:0 with the change's id is held
SUPERSEDED a signed kind:0 for the confederation with a later created_at is held
ENDORSED E ≥ T: the signing is under way (D6)
DECLINED N − O < T: it can no longer reach T
EXPIRED past its expiry and not ENDORSED
OPEN otherwise

An answer counts only if its own created_at is at or before the expiry. This is the existing rule (confederation.md D8), so whether a change was endorsed in time does not depend on when a device heard of it.

The rule is T of N, not all of N. T is what the groups agreed to when they formed it ("2 of 3 groups to act"), and it is also what the signature needs. If an objecting group could block a change that T groups endorsed, the confederation would be governed by unanimity while its key works by threshold. An objection is still recorded and shown to every group.

Changes may overlap. Two open changes may exist at once. Whichever is published first wins, and any change with an earlier created_at becomes SUPERSEDED, because relays keep only the newest kind:0. A later change published first makes an earlier one pointless, and its signing is refused (D6).

Since confederation-room-removal.md: a confederation has no room of its own. Its signing runs in each member group's own room, carried between the groups' inboxes by their admins, and a voucher travels in its group's envelope as itself rather than wrapped in a 30396.

The sealed 9435 and 9436 are good evidence for the groups' admins, but they are not transferable. A seal opens only with the inbox key it was sealed to (D3 of the coordinator-free plan). The people who must act on an endorsement are the confederation's role holders, in the confederation's room. Some of them are no longer admins of their group and hold no inbox key, and none of them can show another group's seal to anyone. So the group's signing session signs one more event in the same batch:

9438 voucher, signed by the group's npub (FROST, same session), never published
tags: ["confederation", <id>], ["profile", <the kind:0's id>], ["e", <9435 rumor id>],
      ["expiration", <the change's expiry>]
content: empty

A 9435 or 9436 batch is N seals plus one voucher. It is signed in the one FROST session the group is already asked for, so this costs no extra question. When it completes, every device in the group's room holds the signed voucher (FrostSigningManager.complete → applySignedEvent).

Carried into the confederation's room. Each role holder of the group whose device holds the signed voucher posts it into the confederation's Marmot room as a new message, 30396 (ConfederationSigningEvents.VOUCHER). Copies from several devices are deduplicated by the voucher's id. A role holder's device that receives one verifies the group's signature against the roster's group key, then files it.

A voucher is consent. ConfederationSigningManager.acceptProposal gains a path for an attempt over a kind:0. The 30390 must carry vouchers (["voucher", <signed 9438 JSON>]) from at least T distinct member groups. Each must verify under its group's npub, name exactly this event's id, and not be expired. A device then sends its 30391 without asking anyone: yes for each of its seats whose group vouched, no for each that did not. A seat in a group that objected never signs.

That moves the decision from each person to each group. A role holder who would have said no as a person signs anyway if their group's quorum said yes. This is deliberate: the confederation was formed with t_g set to each group's own threshold, and a role holder holds their share as an admin of their group. The appendix covers asking each role holder as well.

The direct path closes for kind:0. ConfederationSigningManager.refusalOf refuses a kind:0 that carries fewer than T valid vouchers: "A confederation's profile changes through its groups." EditGroupNostrProfileViewModel stops treating a confederation's room as a signer for kind:0. The profile row on that room's detail screen opens the confederation's screen. Posts (kind:1) and the charter keep the direct path for now (Out of scope).

D6. Who starts the signing, and what happens when it fails

Once a role holder's device holds vouchers from T groups for one change, and no attempt for that kind:0 is running:

  • The order is the roster's people sorted bytewise, the same order D11 of the coordinator-free plan uses for making the room.
  • Person k starts an attempt if none for this kind:0 has arrived k × 10 minutes after the T-th voucher reached their device. One person away adds ten minutes of delay, not an indefinite wait. Ten minutes rather than D11's hour, because signing needs devices online at the same time and should run while the endorsing people still have their phones in hand.
  • Crossing attempts over the same kind:0 both run until one finishes. The attempt whose id sorts first continues everywhere. The other is ended out loud with "Another attempt is signing this change", as crossing inbox ceremonies are.
  • A failed attempt is retried by the same rule, from its failure: RESTARTED (a nonce lost to a restart), or a selected device that stopped answering. The delay doubles each time, from ten minutes up to two hours, until the change expires. The change's screen says "Signing: waiting for Agora's admins", naming the groups whose roles have not yet said yes.
  • Refusals before starting: the change is not PUBLISHED, SUPERSEDED or expired, and no signed kind:0 for the confederation with a later created_at is held.

An attempt started this way does not announce "A proposal for the confederation to sign" in the room as a question. It writes one line that names the change and the groups that vouched.

D7. The signed profile is published, and every member group hears it

ConfederationSigningManager.complete already files the signed event as a GroupSignedEvent under the confederation's id on every role holder's device. Added:

  • Owed to relays. On the device that started the attempt, the signed kind:0 is marked owed, and ConfederationPublisher sends it, as it sends the charter. It goes to the publish set and to each member group's 10050 relays, and backs off from a minute up to half an hour until a relay takes it. Any other role holder's device may publish the same event too. It is the same event, so duplicates are harmless. It sends only if the event is still unpublished an hour later, the same fallback idea as D6.
  • Heard by every member group. live-confederation gains a filter {"kinds":[0], "authors":[every confederation id this device knows]}. Known ids come from the Confederation rows and from charters filed for this device's groups. A kind:0 that arrives is verified and filed as a GroupSignedEvent under the confederation's id. That is how a member who is not an admin learns of the new profile, and how the confederation's screen reads it.
  • Read by a new ConfederationProfile.newestOf(confederationId), which is GroupNostrProfile.newestAmong over those rows.

D8. Lines in each group's room, written by each device for itself

New ChatMessage types, written by each device into its own member groups' rooms, and sending nothing. This is the pattern ConfederationFormation already follows.

type text who writes it
TYPE_CONFEDERATION_PROFILE_PROPOSED "Agora proposes a new profile for Polis League" admins' devices, from the 9435
TYPE_CONFEDERATION_PROFILE_ENDORSED "Ekklesia endorsed Agora's change to Polis League's profile" admins' devices, from each 9436
TYPE_CONFEDERATION_PROFILE_OBJECTED "Ekklesia objected to …: " admins' devices, from each 9437
TYPE_CONFEDERATION_PROFILE_PUBLISHED "Polis League has a new profile" every member's device, from the kind:0 off relays

Each line carries the change id and opens ConfederationProfileChangeScreen. The published line carries the confederation id and opens ConfederationScreen. Members who are not admins see their own group's signing session through its existing line, and then the published line. That is the same visibility they have for formation statements.

NotificationClassifier treats a 9435 from another group, received by an admin of a group that has not answered, as needing attention, the way a signing session waiting for you does. The other lines are quiet.

D9. The confederation's room shows its groups

Since confederation-room-removal.md: a confederation has no room of its own. Its signing runs in each member group's own room, carried between the groups' inboxes by their admins, and its groups, posts, charter and signing are on its own screen.

On a confederation's room, ChatRoomDetailScreen:

  • labels each member with their groups, from Plan.seatsOf(member) named by ConfederationManager.nameOf: "Thandi · Ekklesia, Agora". Someone who holds roles in two groups is shown once with both names;
  • gains a Groups card above the members, listing each group with its role holders. The card links to the confederation's screen;
  • states that the room is fixed at the people who held roles at formation, and what that means: "Admins who joined a group after Polis League formed are not here."

D10. The ceremony's room is closed once the ceremony ends

The NIP-17 room the ceremony ran in stays on the device. Its messages are the evidence the genesis was built from, and a later attempt over the same roster meets there. After ConfederationFormation.onComplete:

  • the banner the working tree adds (keyCeremony) says "The key ceremony for Polis League is complete" and links to ConfederationScreen;
  • the composer is hidden, the same way it is for a room nobody can write to. Anything typed there would reach only the founding people as people, which is what this plan is trying to stop;
  • the room moves below the active conversations in the chat list, ordered by its last message like any other room. It is not hidden. A person who goes looking for it should find it.

If a ceremony is retried (D10 of the coordinator-free plan), the room opens again, because the retry runs there.

D11. Behind both flags; the kinds are rumors and a voucher, never public

Everything here needs ExperimentalFeatures.confederation and ExperimentalFeatures.groupInbox. Kinds 9435–9437 are rumor kinds and 9438 is a voucher. None joins ConfederationKinds.ALL, which drives the public subscription and BROADCASTABLE_KINDS. They go in a new ConfederationKinds.PROFILE_CHANGE_KINDS. A FROST batch that tries to sign any of them as a bare event, rather than as a voucher beside its seals, is declined by ConfederationRefusal. That check runs even with the flags off, as every refusal does. A device that receives a 9438 on its own, outside a 30390, files nothing.


Who is asked what

step who is asked what they decide automatic after that
propose one admin of group A, on the confederation's screen the new profile building the 9435, the seals, the voucher
A signs A's quorum that A proposes this profile wrapping to every member group's inbox; A's role holders posting A's voucher
a change arrives nobody — every admin's device in every group files it and writes a line
B answers one admin of B, then B's quorum endorse or object wrapping to every group; B's voucher into the confederation's room
T groups have vouched nobody — the first role holder in order starts the signing; every role holder's device says yes for its vouched seats
signed nobody — published; every member's device files it and writes "has a new profile"

People are asked twice in total, once per group, and both questions are group signing sessions they already know how to answer.


Phases

One commit per phase, in the repository's style (feat: … (confederation-profile, Phase n)). Every phase leaves ./gradlew :composeApp:jvmTest and :composeApp:m3Audit green, and check's brand and wallet audits at budget.

Phase 0: land what is in flight, this document, five checks

The working tree's ceremony-room changes (keyCeremonyOfRoom, joinablePlan, ConfederationRitualUIState.Joinable, the messaging screen's banner) are committed first, as their own commit. D10 builds on that banner.

Then this document and its row in README.md, and before code:

  1. The kinds. 9435–9438 appear in no NIP, nor in quartz, Curare or Bennu, and 30396 is unused (30390–30395 and 30399 are signing's, 30410–30416 the inbox's).
  2. A mixed batch. On the inbox's harness, a FROST batch of N kind-13 seals plus one kind 9438 proposes, passes ConfederationRefusal's routing (by the confederation_rumor tag) and InboxRefusal's manifest check, signs, and leaves the signed 9438 on every member's device. If the manifest check refuses a batch that is not all seals, the voucher is signed in a second session started automatically on completion, and D5 says so.
  3. Size. A 9435 for twelve groups with a 4 KB kind:0, against MAX_STATEMENT_BYTES. Record the largest profile that fits.
  4. Pin today. ConfederationProfileTodayJvmTest: a role holder's kind:0 through proposeAsConfederation signs with no group asked; the confederation's room lists members without groups. Both are flipped on purpose in Phases 5 and 7.
  5. A voucher verifies anywhere. A 9438 signed by group B's FROST session verifies under B's npub on a device that is in neither B's room nor B's inbox, given only the roster.

Done when all five are recorded here and checks 2, 4 and 5 are tests.

Done, on 2026-11-22. The in-flight work had already landed as 50f73e17. ConfederationProfilePremiseJvmTest keeps checks 2, 3 and 5:

check result
1. the kinds free. Neither 9435–9438 nor 30396 appears in quartz 2.20.1's sources or anywhere in the app; confederation.md's Phase 0 found nothing in the NIP table between 9321 and 9734
2. a mixed batch does not pass today, and both obstacles are ours. ConfederationRefusal.of declines any batch with a non-seal in it as SHAPE, and InboxReplies.wrapAndOwe sends nothing when a session has more items than its manifest has seals. Phase 2 teaches both about the one voucher, rather than signing it in a second session: a second session is a second question to the quorum
3. size a 4 KB profile does not fit twelve groups (118 KB against 60 KB): every seal carries the whole kind:0. The largest profile text that fits, by groups: 13.6 KB for 2, 7.3 KB for 4, 4.1 KB for 6, 2.9 KB for 8, 1.8 KB for 10, 1.1 KB for 12. D2 now says so, and the form gives the reason in a profile's terms
4. pin today ConfederationSigningJvmTest's first case already pins it: a role holder's kind:0 through ConfederationSigningManager.propose signs with no group asked. Phase 5 flips it. The room's member list is pinned by Phase 7's own test
5. a voucher anywhere holds. A 9438 signed by a group's FROST session verifies under its npub through GroupKeyStateEvent.isSignedByRoom, given nothing but the npub, and not under another group's

Phase 1: the wire, and the storage

  • K/nostr/confederation/ConfederationProfileStatements.kt: build and strictly parse 9435–9437 rumors and the 9438 voucher. The parser refuses an embedded event that is not kind 0, does not have the confederation as its author, or is not a readable profile (GroupStatementRefusal.isUnreadableProfile). ConfederationKinds.PROFILE_CHANGE_KINDS, ConfederationSigningEvents.VOUCHER = 30396 and the voucher tag.
  • ConfederationProfileChange.State and the computation of D4, as a pure function over the held statements, the vouchers and the newest kind:0. Tested exhaustively, since every screen and the starter rule read it.
  • Schema 50, AutoMigration(49, 50), new tables only:
    • ConfederationProfileChange: rumor id, confederation id, proposing group, the unsigned kind:0's JSON and id, base, expiry, created_at, and the seal that delivered it;
    • ConfederationProfileAnswer: change id, group, kind, rumor id, reason, created_at, seal;
    • ConfederationVoucher: voucher id, change id, group, signed JSON.
  • ConfederationRepository gains observeProfileChanges(confederationId), observeProfileChange(changeId) and observeProfile(confederationId), with NO_OP overrides.

Tests: ConfederationProfileStatementsTest (bytes pinned, every refusal), ConfederationProfileChangeStateTest, ConfederationProfileStorageJvmTest.

Built. Where it differs from the above:

what the phase said what it turned out to be
three new tables one nullable column. ConfederationEvent gains confederationId (schema 50, AutoMigration(49, 50)), and changes, answers, vouchers and the signed kind:0 are filed there, the change's rumor id standing as their proposalId. It is already the table "for every kind" the formation uses, its ownSessionId/publishedAt already carry what is owed to relays, and the ConfederationSigning rows that carry a statement past its proposal fit a change unchanged
the signed kind:0 in GroupSignedEvent under the confederation's id (D7) in ConfederationEvent too, through ConfederationProfileManager.recordProfile. GroupSignedEvent has a foreign key to ChatRoom, and a member of a member group who is not an admin holds no room for the confederation. profiles reads both
the 9435's tags plus ["threshold", "<T>"]. A device without the confederation's record (an admin promoted since it formed) has no other way to know T; a device with the record checks it (Phase 2)
D4's ENDORSED past the expiry EXPIRED. The voucher carries the change's expiry and nothing signs past it, so an endorsed change not signed by then is over
ConfederationProfileChangeStateTest folded into ConfederationProfileStatementsTest, 11 cases with the wire's; ConfederationProfileStorageJvmTest 4

Phase 2: proposing and answering through the inboxes (D2, D3, D5's batch)

  • ConfederationProfileManager.proposeChange, endorse, object and withdraw. Each builds its rumor, resolves recipients from the confederation's groups (record, else charter), and goes through ConfederationManager.proposeStatement, which gains an optional extra signed event for the voucher.
  • ConfederationRefusal gains arms for 9435–9437 in the four places it sits (arrival, approval, decline reason, resend). A signer declines unless:
    1. this device holds the group's announced inbox key (as today);
    2. every seal holds confederation_rumor byte for byte, one per member group (as today);
    3. the p tags are exactly the confederation's other groups, from the record or a verified charter. Otherwise: "This device holds no record of that confederation";
    4. for a 9435: the kind:0 is the confederation's, readable, its created_at within ten minutes of now, the expiry at most seven days away, and this device holds no kind:0 newer than its base. Otherwise: "Polis League's profile has changed since this was written". An unknown base is a warning, not a refusal;
    5. for a 9436 or 9437: the carried 9435 opens with this group's inbox key and verifies as its author's, is OPEN here, and this group has not answered;
    6. the voucher in the batch names exactly the kind:0 and change in the rumor, with the same expiry. For a 9437 there is no voucher, and a batch that has one is declined.
  • ProposedEvent summarises each kind with the field difference of D3.

Tests: ConfederationProfileDeclineJvmTest, one case per refusal, on SigningProposalHarness. ConfederationProfileProposeJvmTest: a three-group fixture where A's admin proposes, A's quorum signs, and every group's admins' devices hold the 9435.

Built. ConfederationProfileStatementJvmTest 13/13, on ConfederationTestGroups' three real groups (FROST and inboxes) with a charter naming them: a change reaches every admin of every group with the proposer's voucher on the proposer's devices only; a second group's endorsement makes it ENDORSED everywhere; objections and a withdrawal; a device that missed the change answers from the carried invitation; a profile too long refused before anything is asked; and seven refusals (stale, unknown confederation, unreadable, a wrong voucher, no voucher, a voucher on its own, answering twice or after it closed). Where it differs from the above:

what the phase said what it turned out to be
two test files one, since both need the same three groups and charter
the confederation's groups "from the record, else a verified charter" as said, and the charter gains ["threshold", "<T>"] (ConfederationCharterEvent.assembleTags, optional on parse so earlier charters still read). Without it a device holding only the charter cannot know T; such a device falls back to the newest change's stated threshold, and proposes nothing if it has neither. A role holder still refuses a charter whose threshold is not the confederation's
proposeStatement "gains an optional extra signed event" extra (the voucher, last in the batch) and tooLarge, so a profile that will not fit is refused in a profile's words before anything is asked
routing received rumors, in Phase 3 here: the one branch in GroupInboxManager that hands 9435–9437 to ConfederationProfileManager.recordStatement, which the tests above need. And InboxReplies files no outgoing inbox copy of a profile statement, as it files none of the formation's
ConfederationRefusal's routing the batch is read as the seals and then at most one voucher. Any other non-seal, a voucher with a formation statement, or a profile statement or voucher asked for bare is declined as before (SHAPE or PUBLIC)
the threshold check (D2, step 3) only where the device holds the record: against a charter there is nothing to check it with

Phase 3: receiving (D4, D8)

  • GroupInboxManager routes rumors of PROFILE_CHANGE_KINDS to ConfederationProfileManager.record beside the existing ConfederationManager.recordStatement call, storing them with their seal. A 9436 or 9437 that arrives before its 9435 is stored and gets its line once the 9435 arrives. This is the same fix Phase 7 of confederation.md needed.
  • The lines of D8, and NotificationClassifier's one new case.

Tests: ConfederationProfileReceiveJvmTest, covering out-of-order arrival, a seal from a group that is not a member (dropped and logged), and a duplicate.

Built. ConfederationProfileReceiveJvmTest 3/3: a change from another group is one line in each of this device's member groups' rooms, carrying the change's id; heard twice, still one; an objection that arrives before its change gets its line when the change does; the classifier's two sets. The routing itself landed in Phase 2. A seal that is not its rumor's author's is dropped by recordStatement, tested in Phase 1's storage test. The lines carry the change's id in frostSigningSessionId, the column the confederation's signing lines already use for an attempt's id, so no schema change: Phase 4 makes them open the change. TYPE_CONFEDERATION_PROFILE_PROPOSED and …_PUBLISHED are group activity; …_ENDORSED and …_OBJECTED are silent.

Phase 4: the screens (D1, D2, D3)

  • ConfederationScreen + ConfederationViewModel + ConfederationUIState (loading, error, not held, loaded), with the parts and visibility rules of D1. The Edit profile button is gated on D2's conditions, as ConfederationsScreen gates Propose a confederation.
  • EditConfederationProfileScreen: NostrProfileForm extracted from EditGroupNostrProfileScreen (both screens then use it), the group picker for an admin of several groups, and Propose to the groups. On success it goes to the FROST signing session, as answering a proposal does.
  • ConfederationProfileChangeScreen: the difference from the base, every group's answer, Endorse / Object (with an optional reason) / Withdraw, the open signing session if there is one, and the signing state of D6 once endorsed.
  • ChatRoomDetailScreen: one row per formed confederation. ConfederationsScreen: a formed card opens ConfederationScreen.
  • Routes in GizaNavHost, each with NavigateBackButton. Strings in the catalogue, sentence case, with no "supergroup", "voucher", "rumor" or "NIP-4E" shown to a person. A voucher appears in the interface only as "endorsed".

Tests: ConfederationProfileScreensJvmTest, covering each state, the gating of each button, and the non-admin view built from the charter and kind:0 alone. m3Audit at budget, with no new .dp spacing, colour literal or title-case string.

Built. ConfederationProfileScreensJvmTest 8/8; m3Audit at budget; compileDebugKotlinAndroid builds. Where it differs from the above:

what the phase said what it turned out to be
NostrProfileForm widgets/NostrProfileFields.kt: the five fields and a NostrProfileFieldStates holder whose template builds the kind:0. Its icons are now Decorative, since each sits beside its label; they carried hard-coded English descriptions before
the edit screen's own view model as said; its failure carries the profile-sized reason when there is one, so "too long for 12 groups" reaches the snackbar instead of a generic failure
"Signing: waiting for Agora's admins" (D6) the change's screen names the endorsing groups whose voucher this device has not yet seen. Phase 5 is what makes those vouchers arrive
repository methods on ConfederationRepository as interface defaults, so NO_OP_CONFEDERATION_REPOSITORY and every fake needed no change; ProfileChangeProblem says why a member cannot propose, which the screen and the form turn into words
the group detail screen's row ChatRepository.memberConfederations, by record or charter; each row reads "Member of Atlas" and opens the confederation
the lines (Phase 3) open the change ChatTranscript gains onOpenConfederationProfileChange and onOpenConfederation; the published line opens the confederation

Phase 5: from endorsement to signature (D5, D6)

  • The 30396 voucher message: posted by each role holder's device when its group's 9435 or 9436 session completes, verified and filed on arrival, and deduplicated.
  • ConfederationSigningManager: a 30390 over a kind:0 carries its vouchers. acceptProposal checks them and answers 30391 per seat with no person asked. refusalOf refuses a kind:0 without T vouchers. SIGNABLE_KINDS is unchanged.
  • ConfederationProfileFollowThrough, run from the sweep SynchronizationViewModel already runs and when a voucher arrives. It applies D6's order and delay, the crossing rule, and retry with backoff, and it stops at expiry, SUPERSEDED or PUBLISHED.
  • EditGroupNostrProfileViewModel stops routing kind:0 to proposeAsConfederation. The confederation's room opens ConfederationScreen for its profile. Phase 0 check 4's first pin is flipped.

Tests: extend ConfederationSigningJvmTest, three groups of three on nine devices with T = 2:

  • A proposes and B endorses, so the signature is made with no role holder asked, and C's seats say no;
  • A proposes and B and C object, so the change is DECLINED and no attempt starts;
  • the first person in the order is offline, so the second starts after ten minutes (on a test clock);
  • a restart between nonces and confirmations, followed by a retry that succeeds;
  • crossing attempts, where the one whose id sorts first survives everywhere;
  • a kind:0 proposed directly in the room, which is refused;
  • a role holder who is no longer an admin of B still signs for B's seat on B's voucher.

Built. ConfederationSigningJvmTest 13/13 (from 7): two groups' vouchers and the profile is signed on all nine devices with nobody asked, Ekklesia's seats saying no and every device reading the change as PUBLISHED; one group's voucher and nothing starts; the first in the order away and the second starting ten minutes later; a restart between nonces and confirmations, then the backoff, then a second attempt that signs; two attempts at once ending in the one whose id sorts first; and Phase 0's pin flipped (a kind:0 proposed in the room is refused with THROUGH_GROUPS). The direct-path cases now sign a post. Where it differs from the above:

what the phase said what it turned out to be
the vouchers a 30390 carries, checked on arrival checked, and filed (recordVoucher), so refusalOf reads them back from the table on approval and at the end: an attempt needs no new column
acceptProposal sends 30391 "without asking anyone" and marks the attempt approved, or declined where none of the person's seats vouched, so isAwaitingApproval is false and the signing screen asks nothing
crossing attempts settled the moment a device holds two running attempts over one kind:0, on proposing and on arrival: every device fails the same one out loud with CROSSED
a role holder who is no longer an admin of B holds by construction: the automatic answer reads only the seat's group's voucher and never the group's admins, so no case was added
ConfederationSigningManager.refusalOf also refuses a kind:0 older than one the confederation has already signed (SUPERSEDED), which the follow-through would otherwise sign for nothing
30396 in ConfederationSigningEvents.ALL, so it travels as the signing's other messages do; process takes it before looking for a session tag, and keeps it only from a role holder of the group that signed it
the confederation's room opens ConfederationScreen for its profile its profile screen no longer offers an edit (GroupNostrProfileViewModel, EditGroupNostrProfileViewModel); the way from that room to the confederation's screen is Phase 7's
the voucher premise (Phase 0, check 5) now signs its voucher beside a real change's seals, since a voucher asked for on its own is declined

Phase 6: publishing and hearing (D7)

  • The kind:0 owed on the starter's device, sent by ConfederationPublisher to the publish set and every member group's 10050 relays. The other role holders' devices send it as a fallback after an hour.
  • live-confederation's kind:0 filter by author. A kind:0 that arrives is verified and filed under the confederation's id. ConfederationProfile.newestOf.
  • TYPE_CONFEDERATION_PROFILE_PUBLISHED on every member's device, and the change moves to PUBLISHED. Other changes with an earlier created_at move to SUPERSEDED.

Tests: ConfederationProfileRelayTest, with the relay as a copy, covering that a member of A who is not an admin and holds no role sees the new profile on the confederation's screen, and that a later change published before an earlier one supersedes it.

Built. ConfederationProfileRelayJvmTest 4/4: a device holding only the charter hears the profile off a relay, reads it as the confederation's newest, and writes "Atlas has a new profile, as …" in its group's room, opening the confederation; an older profile heard late changes nothing a reader sees; a kind:0 from anyone but a known confederation, or one its key did not sign, is not filed; an owed profile goes to every member group's announced inbox relays too. ConfederationRelayTest gains the filter by author. Supersession was already Phase 1's and is tested there. Where it differs from the above:

what the phase said what it turned out to be
owed on the starter's device, the others as a fallback after an hour owed by every device that signed it. The same event from several devices is one event to a relay, and a fallback would have needed a way to tell that nobody else's copy got out, which nothing here can see
"the published line on every member's device, from the kind:0 off relays" from wherever the kind:0 is first filed -- the signing's end on a role holder's device, a relay everywhere else -- and only for the newest profile held
the subscription's confederation ids ConfederationRepository.observeKnownConfederations: every Confederation row and every charter's author, so the filter follows a charter as it arrives
a kind:0 off a relay ConfederationManager.record hands it to ConfederationProfileManager.hearProfile, which files it only for a confederation this device knows by record or charter

Phase 7: rooms that say what they are (D9, D10)

Since confederation-room-removal.md: a confederation has no room of its own. Its signing runs in each member group's own room, carried between the groups' inboxes by their admins, so this phase's half about the confederation's room is gone; the ceremony room's half stands.

  • The confederation's room: members labelled by group, the Groups card, and the sentence about admins who joined later. Phase 0 check 4's second pin is flipped.
  • The ceremony's room after formation: the banner links to the confederation, the composer is hidden, and the room moves below active conversations. It opens again for a retry.

Tests: ConfederationScreensJvmTest gains the labelled members and a person in two groups shown once. The messaging screen's test covers a formed ceremony room with no composer.

Built. ConfederationSigningJvmTest gains two cases (15): on a Polis admin's device the confederation's room names its three groups, each with its three role holders, names the person's own group beside them, and opens the confederation's screen from Polis's room; and once formed, the key ceremony's room leads to the confederation it made. Audits at budget. Where it differs from the above:

what the phase said what it turned out to be
a Groups card above the members the groups go into the confederation's card the room already had ("This is the room of the confederation Atlas…"), one line a group with its role holders, then the sentence about later admins and Open the confederation. One card about whose room it is, rather than two
each member labelled with their groups beside "Admin" and "Share" on the member's row, as one more label
the ceremony's room moves below active conversations not done. The chat list sorts every room by its last message, and an ended ceremony's room stops getting messages, so it sinks on its own; a special order for one kind of room was more than this needed. The banner and the hidden composer are built
tested through the screens through DatabaseChatRepository.confederationRoomInfo and keyCeremonyOfRoom on the nine-device harness, which is where the facts come from; the screens only lay them out

Phase 8: the network run

ConfederationProfileNetworkJvmTest, the plan end to end on ConfederationNetworkJvmTest's harness: three groups of three, real FROST and confederation signatures, and relays as copies. A's admin edits the name from the confederation's screen. Every admin of B and C gets a line and a notification. B endorses. The profile is signed with no further question, published, and read back on all nine devices and on a non-admin member's device in each group. Then a second change that C objects to and A withdraws.

Built. ConfederationProfileNetworkJvmTest 2/2, on ConfederationTestGroups rather than ConfederationNetworkJvmTest's fixture: three groups of three admins, each signing by real FROST and holding a real inbox, form the confederation the real way -- Agora's proposal and the two acceptances sealed group to group, then the key ceremony on all nine devices in the NIP-17 room each derives -- and then decide its profile. Agora's change reaches every admin of every group; Agora's voucher alone starts nothing; Polis's endorsement makes it ENDORSED everywhere; one device, the first in the order, starts the signing, and all nine finish it without being asked; every device reads the new name and the change as PUBLISHED; Ekklesia's room has the proposed, endorsed and published lines on each of its admins' devices; and a member of Polis who is no admin, holding only Polis's room, hears the charter and the profile from a relay and gets the published line. The second case: Ekklesia objects, Agora withdraws, and nothing is signed. Notifications are the classifier's, tested in Phase 3, not again here.

Phase 9: the record, and devices

This document's header and progress table, as the other confederation plans keep theirs, and a row-by-row "where the build chose differently". Then a device run: two phones and the desktop build, two real groups with inboxes, one change proposed, endorsed, signed and seen on a third client by npub. Record what did not happen.

The record done; the device run not. Nothing here has run on a device or a desktop client: no change has crossed real inboxes between real groups, no confederation has signed a profile across real phones whose nonces live only in memory, and the timing D6 rests on -- ten minutes a place, role holders online together -- has only been exercised on a test clock. The ten minutes, the two-hour cap and the one-minute sweep are guesses until a device run says otherwise.


What this does not do

  • Posts and the charter still go through the direct path, with each role holder asked as a person. The wire of D2 is general (the 9435 carries one unsigned event), so moving kind:1 and 9434 over is a refusal and a form each. That is the obvious next plan.
  • Admins who joined after formation cannot sign for the confederation. They hold no role, because the room and the roster are fixed at the founders until governance is built (confederation.md, Phase 15). They can propose and endorse, because those are their group's statements, and a voucher is their group's.
  • A newly promoted admin cannot read changes proposed before their promotion (group-inbox.md D15). Their group's later answers still work, because each carries the 9435 it answers.
  • Signing needs devices online together. A voucher makes a role holder's consent automatic, but their nonce still has to be made while the attempt runs. D6's retries carry the change across gaps; nothing carries it past its expiry.
  • Not for value. Upstream's warning on its confederation module stands.

Risks

risk what to do
InboxRefusal's manifest check refuses a batch that is not all seals sign the voucher in a second session, started automatically on completion (Phase 0, check 2)
a profile too large for twelve seals the existing size refusal, with the largest that fits recorded (check 3)
two groups each propose a change at once both run; the newer created_at wins on relays, and an older one published second is refused (D4, D6)
no T groups' role holders are online together retries with backoff until expiry, and the change's screen names the groups still being waited on
a group's quorum equivocates, sealing different 9435s to different groups the change's id is the kind:0's id, which every voucher names. Groups endorsing different kind:0s produce vouchers for different ids, and neither reaches T
a role holder disagrees with their group's endorsement by design their seat signs (D5); the appendix covers asking them as well
a stale voucher signed long after it was given vouchers expire with their change, and nothing signs past expiry

Out of scope

  • Moving posts (kind:1) and the charter (9434) onto group statements.
  • Governance of the confederation's room and roster: admins added later, admins removed.
  • A role holder's per-confederation setting to be asked each time (appendix).
  • Threshold-ECDH member groups, as in the coordinator-free plan.

Appendix: considered and not chosen

idea why not
keep the edit in the confederation's room, and only notify the groups' inboxes the groups would hear about it without deciding it, and two role holders of one group could still speak for the confederation with their group unaware
every group must endorse (unanimity) the confederation was formed as T of N, and its key signs that way. Unanimity would let one group stop everything forever
ask each role holder as well as each group two questions per change per person. The group's quorum already is the role holders of that group, at its own threshold. Worth an opt-in per role holder if it is missed in practice
send the sealed 9436 into the confederation's room instead of a voucher a seal is not transferable: only the group it was sealed to can open it
make the 9435/9436 rumors themselves signed rumors are unsigned on purpose, and the seal already makes them binding between groups. The voucher is the one transferable statement, kept separate and never published
run the confederation's nested signing through the groups' inboxes nonces, confirmations and partials are high-volume, person-to-person, and must stay in memory. The Marmot room already carries them. Since chosen, by confederation-room-removal.md: the nonces' memory does not depend on the channel, every round has to reach every group anyway, and once the room was to go its being the channel was no reason. Each group's room carries its own role holders, and its admins carry a batch a round between the inboxes
delete the ceremony's NIP-17 room after formation its messages are the genesis evidence, and a retry needs the room

Order and size

phase rough size depends on
0 the in-flight commit, scratch tests, this document —
1 ~450 main, ~400 test, an auto-migration 0
2 ~450 main, ~450 test 1
3 ~200 main, ~250 test 2
4 ~900 main, ~400 test 3
5 ~500 main, ~600 test 2
6 ~250 main, ~250 test 5
7 ~250 main, ~150 test 0
8 ~400 test 4, 6
9 docs and a device session all

Phases 3 and 5 can be built side by side once 2 is in, and Phase 4 can follow 3 while 5 and 6 go on. Phase 7 touches neither the statements nor the signing, so it can be built at any point after 0. That makes it a good first piece to ship, since it fixes the "which groups are these people" problem without waiting on the rest.

Checking the work

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

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