Skip to content

Capability ownership

Start with the behavior’s owner, not the screen where it appears. A capability owns its state, its adapter to Matrix or a host, and the commands that change that state. Features present capabilities; application services coordinate them.

ConcernOwner
Process startup, readiness, recovery, and session streamsApplication Runtime
Saved accounts, authentication lifecycle, active account, sign-out, resetAccounts
Room and Space summaries, invitations, hierarchy, ordering, aggregate unreadRoom Library
Canonical destination, browser history, account readiness, focused roomWorkspace
Exact account-and-room timeline retentionConversation Runtime within the conversations capability
Messages, drafts, relations, threads, pins, and room mediaConversation data access
Verification and encryption healthTrust
Context-keyed persisted settingsPreferences Runtime plus contributing capability descriptors
Matrix client, sync, SDK persistence, and SDK event adaptationMatrix Client data access
Platform support and host operationsHost Runtime contracts and selected host adapters

The capability list and allowed role dependencies are recorded in architecture/contract.json. Project tags in each project.json assign a role and capability to the live Nx graph.

Use these placement questions in order:

  1. Which capability defines the product meaning of the state or action?
  2. Is this a capability concern, cross-capability application orchestration, a reusable kernel, a host adapter, or presentation?
  3. Which public entrypoint already exposes the nearest contract?
  4. Does the intended dependency direction permit that import?

If one screen needs another capability’s state, read the owning data-access signal or use an application-level port. Do not move ownership into the screen and do not import another feature.

Ownership includes creation and cleanup. Account-scoped state follows the exact account lifecycle; conversation-scoped state follows the exact account and room; application startup owns its single retained subscription. A component can observe and command a capability, but it must not outlive, duplicate, or reset the owner’s state.

Read state and reactivity for projection rules and workspace and navigation for destination ownership.