eleven / messenger Public

Clone
git clone https://amadan.net/eleven/messenger

Plain git — no account needed to clone.

Download

Download this file

1# 🤖 Instance contexts — one engine, different social defaults
2
3Status: **design** (not built). Builds on `docs/threads-and-dms.md` and
4`docs/invite-redesign.md`. Nothing here weakens the E2EE invariant: the server
5still only ever stores ciphertext and key-blobs it cannot open.
6
7## The idea
8
9Different kinds of instances — a family, a friend group, a community — share
10~80% of what they need and differ in ~20%. The shared 80% is the **messaging
11core**: threads, per-thread AES-GCM keys, the instance key, DMs, attachments,
12mini-apps, the whole crypto model. None of it changes across kinds.
13
14The 20% that differs is entirely **social structure**: who may cross the trust
15boundary, who can see whom, and which channels exist by default. So "context" is
16**not a mode the engine branches on** — it's a *named preset* over a handful of
17orthogonal knobs, plus tailored onboarding copy and channel scaffolding.
18
19- **A context is a template chosen at instance creation.** It expands into
20 concrete values on the knobs below, seeds a channel or two, and sets the
21 onboarding language.
22- **We store the resolved knobs, not the context.** Real instances drift — a
23 family later wants a General; a friend group wants restricted DMs for the one
24 kid. The admin console exposes the dials directly; the context only seeds them.
25- **"Other / Custom" always exists** — the dials with no preset. Future contexts
26 (Team, Club, Business) are new template rows, not engine changes.
27
28## The knobs
29
30| Knob | Options | Backing |
31|---|---|---|
32| **1. Admission** — who adds a *person* to the instance | admin-only · members-can-invite · open join-link | `usersCanInvite` / `user_invites_enabled` (exists); open join-link is new |
33| **2. Default channels** | none · one "General" · several topic channels | instance-key–encrypted threads, auto-created |
34| **3. Member-created open channels** | off · on | deferred *"group join links, instance-members-only"* (`threads-and-dms.md`) |
35| **4. Discovery / roster visibility** | full-open · restricted (e.g. kids ↔ parents only) | deferred *"restricted discovery"* |
36| **5. Who can DM whom** | anyone ↔ anyone · restricted | same restricted-discovery lever |
37
38Everything else (composing, reactions, attachments, mini-apps) is the shared
39core and is identical in every context.
40
41## Contexts as presets
42
43| | Admission | Default channels | Member open channels | Discovery / DMs |
44|---|---|---|---|---|
45| **Family** | admin-only (parents) | none | off | restricted (kids ↔ parents), else open |
46| **Friends** | members-can-invite | one General | maybe | full-open |
47| **Community** | members-invite or open-link | several topic channels | on | full-open (role-gated later) |
48| **Other** | fully custom | — | — | — |
49| *Team (later)* | domain/SSO-gated | per-project | on | open within org |
50| *Business (later)* | admin/SSO | departmental | on | + retention/audit ⚠️ (see below) |
51| *Club (later)* | invite or open-link | few | on | open |
52
53Each row is a starting point on those five dials, nothing more.
54
55## Two knobs that aren't cosmetic
56
57Most knobs are defaults you can flip freely. Two change the **trust model** and
58must be designed as first-class features, not preset side effects.
59
60### Admission is the security posture
61
62Family's "admin-only" *is* the safety model: a parent vets everyone who can read
63anything. Community's "open join-link" means unvetted people get keys wrapped to
64them. That is not a preference — it changes who you are trusting. The open
65join-link is its own carefully-gated feature (expiring links, optional
66admin-approval step), never something a preset silently turns on.
67
68### Open channels: subscription vs. access
69
70An "open" channel (General, topic channels) is cleanest **encrypted with the
71instance key**: every member already holds it, and new members get it
72auto-granted via the existing nudge-and-wrap flow (`instance-key/nudge` →
73`grantInstanceKeyTo`), so the channel is instantly readable with zero per-member
74re-wrap. That gives a clean split:
75
76- **Open channels** → instance-key encrypted. *Any member can read* (even browse
77 before joining). Membership here is a **subscription** — it controls what's in
78 your list and what notifies you, not access.
79- **Private groups / DMs** → per-thread key. Membership is **access** — you
80 cannot decrypt without being wrapped in.
81
82Honest limitation: an open channel is cryptographically readable by every
83current and future instance member, forever. "Leaving" one is unsubscribing, not
84losing the ability to decrypt. For a community that is usually the intended
85meaning of "open." A channel that is open-to-join but revocable-on-leave needs a
86per-channel key + rekey-on-leave, which costs an online key-holder and O(members)
87re-wraps — a bill that grows with size.
88
89## Cross-cutting concerns (not knobs)
90
91- **Scale is the silent axis.** Family (~5) and Friends (~20) sit in the model's
92 sweet spot. Community (100s) strains two mechanics: the nudge-and-grant
93 instance-key handshake assumes a holder is reachable, and remove-a-member rekey
94 is O(members) and needs someone online. Decide how far up the size curve each
95 context is meant to go before designing it.
96- **Business bends the model.** Team and Club are basically Community + roles.
97 Business drags in retention, compliance, and admin-visible audit — several of
98 which *directly conflict* with E2EE (you cannot hand a compliance officer
99 plaintext the server never sees). Business needs its own trust-model
100 conversation; it is not a preset.
101
102## Status / next steps
103
104Design only — nothing here is built. Natural build order once we commit:
105
1061. Land the knobs as instance config + admin-console dials (extends the existing
107 `user_invites_enabled` pattern).
1082. Instance-key–encrypted "General" / open channels + the subscription-vs-access
109 split.
1103. Member-created open channels (the deferred group-join-links design).
1114. Restricted discovery (kids ↔ parents).
1125. Context templates + onboarding copy on top, once the dials exist.
113