Skip to content

MSC4438: Message bookmarks via account data#4438

Open
smokku wants to merge 1 commit into
matrix-org:mainfrom
smokku:message-bookmarks
Open

MSC4438: Message bookmarks via account data#4438
smokku wants to merge 1 commit into
matrix-org:mainfrom
smokku:message-bookmarks

Conversation

@smokku
Copy link
Copy Markdown

@smokku smokku commented Mar 24, 2026

Rendered

Implementations:

Signed-off-by: Tomasz Sterna tomasz@sterna.link

@turt2live turt2live changed the title MSCXXXX: Message bookmarks via account data MSC4438: Message bookmarks via account data Mar 24, 2026
Comment thread proposals/4438-message-bookmarks.md
@smokku smokku force-pushed the message-bookmarks branch from 30a3a09 to 037fa44 Compare March 24, 2026 14:19
@smokku smokku marked this pull request as ready for review March 24, 2026 14:20
Copilot AI review requested due to automatic review settings March 24, 2026 14:20
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new MSC proposal describing an interoperable client-side convention for bookmarking Matrix room events using global account data, with a per-user index event for ordering and one account-data event per bookmark for metadata.

Changes:

  • Defines account data event types and schemas for a bookmark index and per-bookmark items.
  • Specifies client workflows for adding, removing (tombstoning), listing, and syncing bookmarks across devices.
  • Documents privacy/security considerations and an example bookmark ID generation approach.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread proposals/4438-message-bookmarks.md Outdated
Comment thread proposals/4438-message-bookmarks.md Outdated
Comment thread proposals/4438-message-bookmarks.md Outdated
Comment thread proposals/4438-message-bookmarks.md
Comment thread proposals/4438-message-bookmarks.md Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation requirements:

  • Client (sending)
  • Client (receiving/rendering)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added to PR description.

Copy link
Copy Markdown
Member

@turt2live turt2live left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Early MSC checklist requirements review - I haven't meaningfully looked at the MSC content.

Comment thread proposals/4438-message-bookmarks.md
@turt2live turt2live added proposal A matrix spec change proposal client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. labels Mar 24, 2026
Comment thread proposals/4438-message-bookmarks.md Outdated
### Bookmark index event

The bookmark index event maintains the bookmark ID sequence for all active bookmarks along with
versioning metadata.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the benefit of this? Account data is generally synced in its entirety

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It lists which bookmarks are active (not deleted) and hints the ordering.

```

Clients must ignore malformed bookmark item events. Clients must also ignore bookmark item events
where `deleted` is `true`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the benefit of a separate deleted field over simply clearing the content?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allows undeletion.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finding all trashed bookmarks will require a linear scan of the entire bookmark set this way. If you really need a wastebin, maybe it would be better to just collect the deleted bookmarks in a separate m.bookmarks.wastebin.index?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. Undeletion will require some one-time effort.
This is required when someone actually decides to implement undeletion feature. On the contrary, maintaining the wastebin will require effort on every client, whether it implements undeletion or not.

Conversely:

  • What is the benefit of simply clearing the content?


The presence of `room_id`, `event_id`, and `uri` duplicates some information by design. This lets
clients use the explicit room and event identifiers directly for display, grouping, partitioning,
or lookup purposes without having to parse URI components out of `uri`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is uri there at all? It doesn't seem like there's any benefit to that over room/event ID. If routing information is expected to be needed, it'd be better to just add a via field and remove uri

Copy link
Copy Markdown
Author

@smokku smokku Mar 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea is to bookmark the uri.
The room_id, event_id are additional data, for ease of client implementation - like grouping by room.

Copy link
Copy Markdown
Contributor

@Johennes Johennes Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could the URI not be built on demand and locally from the other properties in the bookmark structure?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose it could. But using the uri as the main concern will allow natural updates in the future, when the uri schema gets expanded.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not feel strongly about keeping room_id and event_id fields though.

I could as well generate it by parsing uri when inserting the bookmark into my client bookmark storage.

@smokku smokku force-pushed the message-bookmarks branch 2 times, most recently from 2138484 to b518b9a Compare March 24, 2026 14:57
@smokku smokku requested a review from turt2live March 24, 2026 14:57
Comment thread proposals/4438-message-bookmarks.md Outdated

The `revision` field allows clients to detect concurrent modifications from other devices. When a
client receives an updated index via `/sync` with a `revision` higher than the locally known
value, it should refresh its bookmark list from the server.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this not be a relatively rare situation given that the index should only be changed based on user interaction and people tend to not use two devices in parallel?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a counter-example. I usually run two devices: mobile phone and desktop client.
I sometimes run a third client in a browser tab.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right but you probably don't bookmark events in two or more clients at the same time?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't promise I won't do it. 😅

Comment on lines +177 to +180
* When creating a bookmark, if a client already knows an existing bookmark item for the same
`(room_id, event_id)`, it should reuse that item's `bookmark_id` instead of generating a new
one.
* Clients should make reasonable effort to deduplicate bookmarks for the same `(room_id, event_id)`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the use case for bookmarking the same event twice? The only thing that will differ are bookmark_id, bookmarked_ts and the cached content data.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no proper use case. It is a bug, which should be prevented with reasonable effort.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case it sounds like we should just prescribe a scheme for generating bookmark IDs that prevents that?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if we do, the client will need to do the effort to check for duplicates, in order to prevent clashing with identifiers generated with buggy other clients, buggy older version of the same client, older version of the MSC.
If so, we might as well leave it free to the client implementation discrepancy.

Comment thread proposals/4438-message-bookmarks.md Outdated
Comment thread proposals/4438-message-bookmarks.md
Comment thread proposals/4438-message-bookmarks.md Outdated
Comment on lines +277 to +278
The ordering of `bookmark_ids` should be treated as the default display ordering hint. Clients may
sort, group, or partition bookmarks differently when presenting bookmarks to the user.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that bookmarks in browsers use a file / folder schema, I wonder if we should add support for this from the start?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If someone is willing to build more features based on this MSC, I see no blockers in the current implementation. Implementations of this MSC should just ignore unknown fields, that might be added by later protocols.

### Bookmark ID

The `bookmark_id` identifies a bookmark item and forms the suffix of the corresponding account
data event type. This MSC does not require any particular bookmark ID generation method.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this proposal as it can be used as message level read indicators (not to be confused with read receipts) and expanded more.

I'm not super versed on the matrix spec stuff but not having a standardized bookmark ID generation method seems counterintuitive to being a spec to me. If it's not the same across all clients, then you can't really use between different clients unless they share the same bookmark ID generation.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bookmark_id is just an opaque string to be used as an item in the index.
Standardizing on the id generation algorithm could result in an expectation, that there is some semantic encoded in the identifier, while it should not be.
Clients would need to be resilient to out-of-spec identifiers anyway, due to bugs in implementation in the wild. We can standardize on such behavior then.

Following list is perfectly fine, and should be handled by any client without additional effort:

    "bookmark_ids": [
        "bmk_1a2b3c4d",
        "bmk_5e6f7788",
        "chr_shahphie3K",
        "9836b821-da3a-4599-be1f-76e390ae3f31",
        "54c30437-8775-4f44-bc60-8865702594ea",
        "chr_Hiemu5ahKo",
        "69JH5EWWFKTDQCT5N5D9LAPEMQNV7HMNUA7RSFJX2VHEelmt"
    ]

@thetayloredman
Copy link
Copy Markdown

This may also benefit from the work towards encrypting account data introduced in #4441. The primitives for encrypting account data could potentially be factored out into a separate proposal?

@smokku smokku force-pushed the message-bookmarks branch from b518b9a to 98ee0d8 Compare April 1, 2026 08:35
@smokku smokku force-pushed the message-bookmarks branch from 98ee0d8 to 8f1810b Compare April 1, 2026 08:47
@smokku
Copy link
Copy Markdown
Author

smokku commented Apr 1, 2026

I've removed the details of reference implementation bookmark_id generation algorithm, as it is not required and might create confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client-server Client-Server API kind:feature MSC for not-core and not-maintenance stuff needs-implementation This MSC does not have a qualifying implementation for the SCT to review. The MSC cannot enter FCP. proposal A matrix spec change proposal

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants