Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Phase 9: page outline, version history, workspaces, and updates & analytics

Status: built, from this plan as approved (with every recommendation: guests on, history for owners and editors, history kept forever, view history Allow by default, invitations make accounts, and this is Phase 9 with the whiteboard moving to Phase 10), on one branch and one PR. Where the build differs from the plan, it says so just below.

Changed from the plan

  • Several workspaces live in one encrypted store per device, each document tagged with its workspace, not one SQLCipher file and key per workspace. Sign-in, AI providers and agents are the device’s and the account’s, and would otherwise be copied into every file. Removing a workspace from a device deletes its rows, with SQLite’s secure_delete on so they’re overwritten.
  • Only the open workspace syncs. Another one catches up when it’s opened, rather than every 5 minutes in the background (§3.1.3). Search, Ask and the Markdown folder cover the open workspace; “Search all workspaces” isn’t built.
  • A device with notes of its own adds them as another workspace without asking (§3.3), and there’s no “Replace” choice: removing a workspace from the device, or deleting it, does that. New workspaces start empty (no getting-started page).
  • Restricted pages live in tree documents the server moves pages into, not in per-person view documents the server keeps in step (§3.4.2). A page that isn’t for everyone is listed in a tree document of its own, which only the people it’s shared with can sync; the server moves pages between the workspace and a tree (Move to Private, Move to Workspace, sharing a workspace page with a guest) in one transaction, and devices keep exactly the trees it lists on every connection. It’s simpler and leaks nothing, with three costs: moving needs a connection; a page’s title and property history starts again in the tree it moves to (its text’s history doesn’t); and a page shared with a guest is always a tree of its own, which every member still has (“Everyone in Work · Can edit”).
  • Who has a restricted page isn’t limited per subpage. Subpages go with their page; giving a subpage more people than its parent isn’t built.
  • Agents, publishing and the server’s search see restricted pages only through their own rules: agents (MCP) and publish to web reach the workspace’s own pages only, and the server’s search never returns a restricted page to someone who can’t reach it (row-level security now also covers the update log, snapshots and the search index). A guest has no server search or Ask; their devices search their pages locally. The Markdown folder writes restricted pages among the others, not under Private/ and Shared with me/.
  • Invitation links are shown once, when they’re made (and sent, when the server can send email). A pending invitation has New link, which replaces it, rather than Copy link: only a hash of each token is kept. The workspace’s invite link works the same way.
  • The server’s clock doesn’t correct a device’s (§2.9): history shows the time the device recorded. Device names come from the sign-in (“test”, “Firefox on macOS”).
  • Updates for all pages list who last edited which page and when, without excerpts; This page’s updates have them. Comments don’t exist yet, so neither do their updates.
  • Analytics’ “Created by” is whoever made the page’s document on the server (for an import, the person who imported it), not Notion’s creator.
  • A viewer’s page menu has no Version history (rather than a greyed item with the reason).
  • History’s size was measured by the new budget test: a page typed a word at a time and then a quarter rewritten keeps every change in 13 KB for 21 KB of text. The test fails past 3× the text.

The plan as approved

Four pieces of work:

  1. Page outline: a strip of dashes at the page’s right edge, one per heading, that opens into a list of headings you can jump to.
  2. Version history for every page, database row and database: who changed what and when, the changes highlighted, named versions, and restore as a new edit.
  3. Workspaces: several per account (Personal, Work), sharing a workspace with other people, private pages inside it, and sharing a single page with anyone, guests included.
  4. Updates & analytics: a side panel with a feed of changes, a views chart, and who viewed and edited the page.

Notion is the reference for how these behave, not for how they look. Everything follows design/DESIGN.md, and everything behaves the same on macOS, Windows, Linux, iOS, Android and the browser. Where a platform can’t do something, the app says so in the place you’d look for it. Nothing assumes a particular deployment, identity provider or number of users. Examples use made-up names (“Sam”, “Work”, “sam@example.com”).


0. What the code says today

These facts decide most of the plan.

FactWhereWhat it means here
Every device and the server already keep a page’s full history. Compaction writes ExportMode::Snapshot, which includes Loro’s whole oplog. Nothing uses shallow snapshots.drusite-core/src/store.rs, drusite-server/src/sync/store.rsHistory costs nothing new to keep. It’s already being paid for. What’s missing is when and who.
Loro isn’t told to record timestamps (set_record_timestamp is never called), so every change’s time is 0.drusite-crdtBefore history can say “19 Sep at 12:02”, every document has to start recording time. Edits made before that have no time.
Each loaded document gets a random Loro peer ID. A peer is a load of a document, not a device or a person.page.rs, workspace.rs“Who” needs a record of which person and device each peer belongs to. Nothing keeps that today.
The server logs who pushed each update (document_updates.created_by) and over which connection, but compaction deletes those rows after 500 updates.0003_sync.sql, sync/store.rsThe server knows who for a while, then forgets. The record of who has to outlive compaction.
A page’s title and properties live in the workspace document, not the page’s. A database’s columns, options and views, and each row’s values, are also keys in the workspace document’s tree entries.workspace.rs, workspace/database.rsA page’s history is its page document’s history plus its entry in the workspace document. Restoring a page can’t simply rewind the workspace document, because that would rewind every other page too.
Rows already store created, createdBy, edited and editedBy, and Notion import fills them.workspace/database.rs, database/notion*.rs“Created by” and “last edited by” exist for rows, and the Notion import’s values are kept.
fork_at and revert_change already undo an agent’s change as a new edit.page.rs, workspace.rsRestore is the same operation over a longer span.
The server has workspaces, workspace_members (owner, editor, viewer) and workspace_keys, with Cedar roles and row-level security on every table. Every route is already /api/v1/workspaces/{ws}/….0001_core.sql, policy.rsWorkspaces are mostly built on the server. The apps assume one.
A device holds one store (workspace.drusite) and chooses one workspace with choose(). A device with its own notes, signed in to an account that already has a workspace, stops at Join::Conflict.engine.rs, sync/mod.rsSeveral workspaces per account also fixes that dead end: the device’s notes can become a second workspace.
The workspace document holds a few settings (journal and meeting settings).journal.rs, meetings.rsThose are already per workspace.
Folded toggles are view state only, never saved. Headings are H1 to H3. There are no toggle headings and no comments.editor/blocks.ts, drusite-modelThe outline deals with folded toggles and meeting tabs, not toggle headings. The Updates feed has no comments to show yet.

1. Page outline

1.1 What it is

A page with headings gets a column of short dashes at the right edge of the page area, level with the top of the text, as in Notion. There’s one dash per heading: H1 dashes are 16 px wide, H2 12 px, H3 8 px, all right-aligned, 2 px tall, 8 px apart, in --text-3. The dash for where you are is --text and 2 px longer.

Hovering the dashes (or focusing them with Tab) opens the outline: a 240 px card on --bg-elevated with --shadow-md, radius 12, at most 70 vh tall, scrolling inside if it’s longer. Each heading is one row of --text-sm, indented 12 px per level below H1, cut with “…” after two lines. The row for where you are is --accent-text. Clicking a row scrolls the page so that heading sits 24 px under the top bar, and flashes it the way a search hit does. The card closes when the pointer leaves it for 300 ms, on Esc, or after a click.

The outline lists only headings: H1, H2 and H3. It doesn’t list the page title, toggles, or bold lines, and it skips empty headings.

1.2 When it shows

  • At least 3 headings. Fewer than that, and the page is short enough to see at once.
  • The window has room. The strip needs 48 px clear to the right of the 720 px column. On a window narrower than that, but wider than 700 px, the strip doesn’t show and the outline is in the page’s “…” menu instead (below).
  • Not on full-page databases, Journals, the Ask panel or Settings. It does show on a database row’s page, a journal entry and a meeting page when they have the headings.
  • With the Ask or Updates panel open beside the page, the strip moves to the left edge of the panel, as long as the page area still has the room.

1.3 Phones and narrow windows (≤ 700 px)

No strip: there’s no spare edge, and a thin target by the screen’s edge fights the system’s back gesture. Instead, the page’s “…” menu has Outline, with the table-of-contents icon, when the page has at least 3 headings. It opens a bottom sheet with the same list, the current heading marked. Tapping a heading closes the sheet and scrolls there. This is the same on iOS, Android and a phone’s browser.

1.4 Where you are

The current heading is the last heading above a line one third of the way down the page area. It’s worked out as you scroll, at most once per animation frame, from the headings’ positions. While you’re above the first heading, nothing is current. At the bottom of the page, the last heading is current even if it never reaches the line, so short final sections can still be marked.

1.5 Folded toggles and meeting tabs

  • A heading inside a folded toggle is listed in --text-3, with a small chevron-right before it. Clicking it unfolds the toggle (and any folded toggles around it) and scrolls there. Unfolding is view state, as it is today, so it isn’t saved or synced.
  • A heading in a meeting tab that isn’t shown is listed under the tab’s name (Summary, Notes, Transcript) as a group label. Clicking it switches to that tab and scrolls there.
  • Its dash is drawn at half opacity in both cases.

1.6 Turning it off

Settings → Appearance → Show page outline, a switch, on by default. It’s kept per device, like the theme, because it’s about screen size. It turns off both the strip and the “…” menu’s Outline.

1.7 Keyboard and screen readers

The strip is a nav landmark labelled “Outline”. Tab reaches it after the page, and focusing it opens the card. ↑ and ↓ move between headings, Enter jumps there, and Esc closes the card and returns the focus. Each row is a link whose name is the heading’s text. With reduced motion on, the jump doesn’t animate.

1.8 Published pages and export

Published pages (Phase 5) don’t get the outline in this plan: they carry no JavaScript, and a plain list of links at the top would change their layout. Markdown export and Notion import are unaffected, since the outline only reads headings.


2. Version history

2.1 Opening it

  • The page’s “…” menu, Version history (file-clock). This works for any page, database row, journal entry, meeting page or full-page database.
  • On desktops and in the browser it opens as a large modal (the lg size, 1040×760, or the whole window if that’s smaller). On phones it’s full screen.
  • Two parts: the version list on the left (280 px), and the selected version on the right, shown read-only as the page looked then, with its changes highlighted. On phones the list comes first, and tapping a version opens it full screen with a back chevron.

2.2 The list

  • Header: “Version history”, the page’s title, and a Group by select: Every change, 1 minute, 10 minutes, 1 hour or 1 day. The default is 10 minutes, and your choice is kept per device.
  • What a version is: a run of changes by one person, where no gap between two changes is longer than the window. A version never mixes two people, and never mixes a person with an agent acting for them. “Every change” shows each Loro change as it was saved (a few seconds of typing).
  • Each row: the time (“19 Sep at 12:02”, or “Today at 09:14”), and under it who made the version, as an avatar and name. If more than one device or way of editing was involved, the line also names them: “Sam · MacBook, iPhone”, “Sam · via Markdown folder”, “Research agent for Sam”, “Imported from Notion by Sam”.
  • The newest row is “Current version”. Rows load as you scroll, 50 at a time.
  • Named versions have a bookmark icon filled in, and their name in 500 weight above the time (“Before the rewrite”). A switch at the top, Only named versions, hides the rest.
  • Hovering a row (always visible on touch screens) shows Name this version (bookmark).
  • The list ends with the page’s first version: “Created” (or “Imported from Notion”, §2.10).

2.3 The selected version and its changes

  • The page as it was at the end of that version: title, properties, then blocks, read-only, drawn by the same editor.
  • Highlighted changes, comparing it with the version before it in the list:
    • inserted text has an --accent-soft background;
    • deleted text is shown where it was, struck through, in --text-2 on --danger-soft;
    • a block whose type, heading level, checked state or indent changed gets a 2 px --accent bar in the left margin, with “Was a paragraph” (or similar) in --text-sm on hover;
    • a property that changed shows its old value struck through before the new one;
    • a block that moved gets the margin bar and “Moved”.
  • Next and previous change: a pill at the bottom centre, “3 / 14 changes”, with ↑ and ↓ buttons, which scroll to the change and outline it. The shortcuts are ⌥↑ and ⌥↓ (Alt on Windows and Linux). With no changes (a version that only renamed a property, say), the pill says “No changes to the text” and lists what changed instead.
  • Compare with current (a switch in the header): compares this version with the current page, not with the one before it. This is what you want before restoring.
  • Subpages and inline databases show as their title only. Their own history is separate. Attachments show as they did then. If a file has since been removed from the server, it shows “This file was deleted” instead.

2.4 Restore

  • Restore this version is a primary button in the header. It’s greyed with the reason when you can’t use it (a viewer, or offline with a version this device doesn’t have).
  • It asks first: “Restore the version from 13 Sep at 14:45? The page goes back to how it was then. This is saved as a new change, so the current version stays in history and you can go back to it.” The buttons are Restore and Cancel.
  • What it does: the page’s content, title and properties become what they were in that version, as one new edit by you, labelled in history as “Restored the version from 13 Sep at 14:45”. Nothing is deleted from history. Restoring the restore is just as possible.
  • Under the hood: it’s revert_change from the current version back to the chosen one, on the page document, merged in as a new change. For the workspace document, only that page’s entry is written: its title and property keys are set to their old values, never a rewind of the whole document.
  • Edits arriving at the same moment from another device or person merge as they always do. The restore is one more concurrent edit, so text someone types while you restore isn’t lost.
  • What it doesn’t touch: subpages, the page’s place in the tree, whether it’s in the trash, and whether it’s published. Restoring a database row doesn’t touch the database’s columns.
  • Afterwards, the modal closes and a toast says “Restored the version from 13 Sep at 14:45”, with Undo. Undo is another new edit.

2.5 Named versions

  • Name this version opens a small field in the row: a name of up to 80 characters, then Save or Esc. Named versions can be renamed or unnamed from the row’s “…” menu.
  • They’re kept in the workspace document, in the page’s tree entry (ver:<id> keys holding the name, the version vector, who named it and when). That way they sync, work offline, and merge if two devices name versions at once. Naming a version isn’t an edit to the page: it doesn’t appear as a change, in Updates, or as “last edited”.
  • Who can name versions: anyone who can edit the page.

2.6 Databases and their rows

  • A database row is a page: its history is its page document plus its row values, so it works exactly like a page’s.
  • A database (the full-page database itself) has a history of its structure: columns added, renamed, retyped or removed, options added and removed, views added and changed, rows added and moved to the trash. Each version lists its changes in words (“Added the column Priority”, “Renamed the view Board to Sprint”, “Added 3 rows”), because a table of every cell at every moment isn’t readable. Restore puts back the columns, options and views. It doesn’t change rows: a row that was removed is in the trash, and its own history restores its content.
  • The journal and meetings are databases, so the same applies to them.

2.7 How long history is kept

Every change is kept for the life of the page, on the server and on every device that has the page. This is how it works today, without the times and names. When a page is deleted forever from the trash, its history goes with it.

Loro shallow snapshots would trim history: a shallow snapshot keeps the current state and only the changes after a chosen point, and a document loaded from one can’t go back further. They also have a cost for sync: a device holding edits that depend on changes from before the point can’t merge them into a trimmed document. That edge case is exactly a device that’s been offline for a long time, and losing its edits is worse than the storage. So this plan doesn’t trim. If trimming is ever needed, it would be a server setting ([history] keep_days) that trims only up to a point that every device of every member has synced past, and keeps each named version as a stored copy. That’s open question 4.

2.8 Where history lives, and its size

  • On every device, as today: a page’s stored snapshot includes its history. So the list, the changes and restore all work offline, for every version this device has. Versions from other devices arrive as part of normal sync.
  • On the server, as today: the document’s snapshot and log, sealed with the workspace’s key.
  • The new costs are small: a timestamp on each Loro change (a few bytes, and Loro merges changes a peer makes within its merge interval, which is set to 10 seconds so “Every change” stays useful); the peer register (§2.9), one row per peer; and named versions. The real size of history is what it already is today. Part of this work is a size test (§7) that measures, for a page typed and edited heavily, a long meeting transcript and a large database, the size of the snapshot with history against the same content without it, and fails if that grows past a budget agreed in the PR. If phones ever need a smaller copy, the fallback is for phones to keep a shallow copy and fetch older versions from the server, which would make old versions need a connection on phones. That isn’t part of this plan.

2.9 Who and which device made each change

  • Time: every document records time on every change (set_record_timestamp(true)), from the device’s clock. A clock that’s wrong shows wrong times, which the server corrects where it can (below).
  • The peer register: each time a device loads a document to write to it, it writes as a new Loro peer, as today. The device records the peer in its store as this device, this person, this way of editing (the editor, the Markdown folder, the local MCP, an import, a meeting job). When it pushes changes, the server records the peer against the signed-in person and the device’s grant (the same grant that’s listed in Account → Devices). The server’s record is what counts:
    • it’s kept in a new table, document_peers (document, peer, user, grant, kind, first and last seen), which compaction never deletes;
    • if a push carries a peer the server already holds for someone else, the push is refused (“Changes from this device couldn’t be checked. Restart Drusite.”), so nobody can make their edits look like someone else’s;
    • when the device’s clock and the server’s receive time differ by more than 5 minutes for an edit pushed live, the list uses the server’s time. Edits made offline keep the device’s time, which is when they were made.
  • The kind of edit goes in Loro’s commit message on the change itself: restore:<version>, import:notion, import:markdown, folder, agent:<grant>, meeting. So it travels with the document and the list can say “Restored…” or “via Markdown folder” even offline.
  • Agents: server-side MCP writes are made on the server as the agent’s grant, and are shown as “(agent name) for (person)”. The desktop’s local MCP writes as its own kind on that device. The existing agent activity log, with its Undo, stays as it is, and history links to it.
  • What a device shows before it knows a peer: the list asks the server for the names of the peers it doesn’t know and keeps them. Offline, your own devices’ peers are named (“Sam · MacBook”), and anyone else’s show as “Someone on another device” until the device is online.
  • Changes from before this ships have no time and no person. They show as one version at the bottom of the list: “Earlier changes, before history was recorded”, with no time. Restoring it is allowed. Drusite is in alpha, so this only affects test data.

2.10 Imported pages

  • From Notion: the page’s history starts at the import, as one version “Imported from Notion by Sam” at the time of the import. Notion’s own page history isn’t in its export, and its API doesn’t offer it, so it can’t come across. The row values created, createdBy, edited and editedBy from Notion are kept, as today, and Analytics uses them for “Created by” (§4.3).
  • From Markdown (the import and the Markdown folder): the same, “Imported from Markdown”. Later edits made in the folder show as “via Markdown folder”.
  • Export: Markdown and Notion-style export carry the current version only. History isn’t exported. That’s listed under §8.

2.11 Who can see and restore history

OwnerEditorViewer
Open Version historyYesYesNo
Restore a versionYesYesNo
Name a versionYesYesNo

Viewers don’t get history because it shows text that was deleted, which they never saw. In their “…” menu the item is greyed out: “Only people who can edit see version history.” The server enforces this too: the peer names and the history endpoints refuse viewers. Since a viewer’s device has the document, a determined viewer could read old text from their own copy, so the plan says so plainly in §5 instead of pretending otherwise.

2.12 Errors and empty states

WhenIt says
A page that has only its first version“No changes yet. Versions appear here as the page is edited.”
Offline, and a version’s peer is unknownThe version shows “Someone on another device”. Nothing is blocked.
A restore that fails“Couldn’t restore that version: (reason). Nothing was changed.”
A version this device doesn’t have yet (still syncing)“This version is still syncing to this device.” Restore is greyed out until it arrives.
The page was deleted forever while the modal was open“This page was deleted, so its history is gone.”

3. Workspaces

All of it is in this plan: (a) several workspaces per account, (b) sharing a workspace with other people, and private pages and single-page sharing inside a workspace (§3.4).

3.1 (a) Several workspaces per account

3.1.1 What you see

  • The switcher replaces the Drusite mark and name at the top of the sidebar: the workspace’s icon (its initial on --accent-soft-2, or an emoji you pick) and name, with chevrons-up-down. It opens a menu listing your workspaces, each with its role if you aren’t the owner (“Editor”), ticks the open one, and ends with New workspace and Workspace settings. ⌘⇧1…9 (Ctrl+Shift on Windows and Linux) switch to the first nine. On phones it’s at the top of the drawer and opens a bottom sheet.
  • The account menu at the foot stays as it is: who you are, the server, Settings, Trash and signing out. Trash is per workspace.
  • The window title and the browser tab say “Page title · Work”.
  • Switching keeps your place in each workspace: the page you had open in Work is open again when you come back to Work.
  • design/DESIGN.md’s “Workspace switcher” row changes from “one workspace” to this.

3.1.2 New workspace

A small form: name, icon, and Start with: Empty, or a copy of the getting-started page. It’s created on the server at once, and offline it’s created on the device and on the server when the device is next online. A new workspace has no journal and no Meetings database until you use them.

3.1.3 What belongs to a workspace, and what to the account

ThingScopeHow
Pages, databases, trashWorkspaceEach workspace document is its own tree, as now.
The local storeWorkspaceOne SQLCipher file per workspace: workspaces/<id>/workspace.drusite in the app’s data. Each has its own store key in the keychain or keystore (in the browser, its own wrapped key in IndexedDB), so removing a workspace from a device deletes its key, and what’s left can’t be opened.
SyncWorkspaceOne connection carries every workspace you belong to. Subscriptions already name their workspace. The open workspace syncs live; the others sync when the app starts, then every 5 minutes while it’s open, and live once you switch to them. This is the same on every platform. Phones and the browser don’t sync while closed, as today.
Server encryptionWorkspaceEach workspace already has its own data key, wrapped by the master key. Nothing changes.
Search (⌘K)WorkspaceSearches the open workspace. A line at the foot, “Search all workspaces”, runs it over all of them, with each result naming its workspace.
Ask your notesWorkspaceAnswers from the open workspace’s pages. Saved chats are listed per workspace. The chosen model and AI providers are the account’s, so they’re the same in every workspace.
AI providers, default modelsAccountAs in Phase 8. In a shared workspace, Ask and meetings use the asking person’s providers and keys.
Agents and MCPWorkspaceAn agent’s sign-in asks which workspace it gets, one per grant, in the consent screen. An agent that needs two gets two grants. The desktop’s local MCP serves the open workspace, and its tokens name a workspace too.
Meeting notesWorkspaceEach workspace makes its own Meetings database the first time you record there. A recording belongs to the workspace it was started in, even if you switch while it records.
Markdown folder syncWorkspaceSet per workspace, on each desktop: Work can sync to ~/Notes/Work and Personal to ~/Notes/Personal, or not at all. Two workspaces can’t share a folder.
JournalWorkspaceA workspace has a journal once you write in it. Today opens the open workspace’s journal. Settings → Journal says which workspace it’s showing.
SettingsSplitAccount: Account & sync, AI, Agents (the list of grants, across workspaces). This device: Appearance (theme, page outline). Workspace: General (name, icon, delete), Members (§3.2), Journal, Meetings, Markdown folder, Import. Settings’ nav gets a fourth group, the workspace’s name, for these.
Publish to webWorkspacePublished pages stay published. Their links don’t contain the workspace, so nothing changes for readers.
Agent activity, AI auditWorkspaceAlready per workspace on the server.

3.1.4 Leaving and deleting

  • Remove from this device (Workspace settings → General): deletes the local copy and its key on this device only. The workspace stays on the server and comes back if you open it again. Unsynced edits block this, with the reason: “3 changes haven’t synced yet. Connect to your server first, or remove anyway and lose them.” The second choice is a separate, danger-styled button.
  • Delete workspace (owners only): asks you to type the workspace’s name. It’s then scheduled for deletion in 30 days: it disappears from every member’s switcher, the owner sees it under Settings → Account → “Deleted workspaces” with Restore, and after 30 days the server deletes its documents, attachments, search index, history and key. The last workspace you own can’t be deleted while it’s your only one.

3.2 (b) Sharing a workspace with other people

3.2.1 Roles

The three roles already in the server, unchanged:

OwnerEditorViewer
Read pages, search, AskYesYesYes
Edit, create, move, trashYesYesNo
Delete forever from trashYesYesNo
Version history, restore, name versionsYesYesNo
Updates panelYesYesYes, without deleted text (§4.2)
Analytics: views chart, created and edited byYesYesYes
Analytics: the list of viewersYesYesNo
Publish to webYesYesNo
Connect an agentYes, at their roleYes, up to editorYes, read-only
Invite peopleYesOption (Settings → Members, “Editors can invite”, off by default)No
Change roles, remove peopleYesNoNo
Rename the workspace, delete itYesNoNo

A workspace can have several owners. The last owner can’t leave or become an editor until someone else is an owner.

3.2.2 Inviting

Workspace settings → Members lists everyone: avatar, name, email, role (a Select for owners), and when they joined. Its button is Invite people:

  • By email: one or more addresses and a role. Each person gets a link that works once, for that email, for 7 days. If the server can send email (the setting magic links already use), it sends it: “Sam invited you to Work on (server)”. If it can’t, the form shows the links to copy and send yourself. Pending invites are listed, with Copy link, Resend and Revoke.
  • Invite link (off by default): a link anyone can use to join with the chosen role (editor or viewer, never owner) until it’s turned off or reset. Owners can limit it to email domains (“@example.com”).
  • What joining looks like: the link opens the server’s page, “Join Work”, with the workspace’s name, who invited you and the role. Signed in, it’s Join. Signed out, it’s the server’s sign-in page, with every login method the server has switched on. After joining, the apps pick up the new workspace at the next sync, and the switcher shows it with a dot until it’s opened.

3.2.3 How logins join

  • An invite doesn’t open self-signup in general. It lets that one email make an account, with any login method the server allows, even when self_signup is off. Owners of a server that doesn’t want even that set [workspaces] invites_create_accounts = false, and then only existing accounts can join.
  • OIDC: the provider’s email must be verified and match the invited email (not case sensitive). OIDC’s existing rules (allowed domains, groups) still apply: an invite can’t let in someone the provider rules keep out. The page says which: “Your sign-in is for sam@other.example, but the invite is for sam@example.com.”
  • Passkeys, password, magic links: as for any new account, with the email checked by the invite link itself.
  • An invite link (not an email invite) asks for an existing account or the normal sign-up rules.

3.2.4 Leaving and removal

  • Leave workspace (Workspace settings → General) asks first, then removes you. Your devices delete their copy of it at their next sync, after pushing anything unsynced first.
  • Removing someone (owners, from Members): it takes effect at once on the server. Their open sync connections lose that workspace’s subscriptions, every later request is refused, and their agent grants for it are revoked. Each of their devices, at its next connection, is told “You were removed from Work” and deletes its copy and that copy’s store key.
  • What can’t be taken back: a removed person’s device that never connects again keeps the copy it had, encrypted with a key only that device holds. No system can reach into an offline device. The Members screen says so when removing: “Their devices delete their copy the next time they connect. A device that stays offline keeps what it already had.”
  • Their past edits stay in history under their name. If their account is deleted, the name becomes “Deleted user”.
  • Pages they published stay published, and owners see them under Settings → Members → “Pages published by former members” to unpublish if they want.

3.2.5 What changes in sync and the security model

  • Protocol (fields added, so old and new keep talking): Welcome lists your workspaces with your role in each. A new frame, Membership, tells a connected device when it’s added to, changed in or removed from a workspace. A subscription to a workspace you’ve left is refused with a new reason, NotAMember. A viewer’s Push is refused with ReadOnly, and the device rolls its local edit back with “You can view this workspace but not edit it.” (The app also stops viewers from typing, so this is a backstop.)
  • Keys per workspace: the server’s per-workspace data key and the device’s per-workspace store key (§3.1.3). Members never hold the server’s key: the server decrypts on their behalf after checking their membership. That’s why removal doesn’t require rotating the workspace key. Rotation stays as it is today, a server job you can run any time.
  • What the server checks: Cedar decides each request from the person’s role in the workspace, and row-level security repeats it in Postgres, as today. New tables (invites, peer register, views) get the same row-level security.
  • End-to-end encrypted spaces (on the roadmap as “Later”) would change this: members would hold the key, and removal would need rotation. Nothing here blocks that.

3.2.6 Whole workspaces, single pages, and publish to web

  • A page is either shared with the workspace (every member sees it, as above) or restricted: private to you, or shared with chosen people, who can be members or guests from outside the workspace. §3.4 covers how.
  • The invite screen says: “Everyone in Work sees every page in the Workspace section. Pages in Private, and pages shared only with some people, stay with them.” The first time you invite someone to a workspace whose journal is shared, it asks: “Work’s journal is shared with the workspace. Make it private first?” with Make private and Keep shared.
  • Publish to web (Phase 5) is unchanged: a read-only link for anyone, with no account.

3.4 Private pages and sharing a single page

3.4.1 What you see

  • The sidebar gets three sections, as in Notion: Workspace (pages every member sees), Private (pages only you see) and Shared with me (pages someone gave you, in a workspace you aren’t a member of, or restricted pages of one you are). Sections with nothing in them are hidden. In a workspace with only you, Workspace and Private both show, so private pages stay private if you invite people later.
  • Share in the top bar (today it’s only Publish to web) gets two tabs: Invite and Publish. Invite lists who has access to this page:
    • “Everyone in Work · Can edit” (or “Only people listed”, for a restricted page);
    • each person added, with Can edit or Can view, and Remove;
    • an email field and Invite. A member is added at once. Someone outside the workspace becomes a guest: they get a link like a workspace invite (§3.2.2), valid 7 days, for that email.
  • Moving a page between Workspace and Private is a drag in the sidebar, or “…” › Move to Private / Move to Workspace. Moving to Workspace asks first: “Everyone in Work will see this page and the 4 pages inside it.”
  • Subpages inherit their parent’s access. A subpage can have more people than its parent, never fewer, as in Notion. Removing someone from a page removes them from the pages inside it.
  • A lock in --text-3 after a restricted page’s title in the tree, and a line under the breadcrumb: “Only you can see this page” or “Shared with Sam and 2 others”.

3.4.2 How it works

The workspace document can’t carry these pages, because every member syncs all of it (§3.2.6). So:

  • The workspace document keeps only Workspace pages, as today.
  • A restricted tree, one per workspace, a new document kind kept only on the server. It holds the entries (title, properties, children, database columns and values, named versions) of every restricted page, with the same layout as the workspace document.
  • A view document per person per workspace, also a new kind. The server builds it for each person from the restricted tree: just the entries they may see, with their place under “Private” or “Shared with me”. A person’s devices sync their own view document like any other.
  • Edits go both ways through the server. When the restricted tree changes, the server writes the change into each affected view document. When a person edits their view document (renames a shared page, sets a property), the server checks they may, writes it into the restricted tree under their name, and from there into everyone else’s view. This is the same kind of mirroring the server already does for publish state. Each fact is a separate key, as in the workspace document, so two people changing different things both keep theirs, and the same thing keeps the last writer’s. Offline edits to a view merge when the device next syncs.
  • Page documents (the text) don’t change. The server keeps a page_access table (page, person or “workspace”, role) and checks it on every subscription, push, search and Ask. A device only ever receives the pages it may see.
  • Moving a page between Workspace and Private moves its entry from one tree to the other: the server deletes it in one and writes it in the other, in one transaction, keeping its ID, so links, history and page documents stay as they are. The page’s history (§2) joins both trees’ entries, so it continues across the move.

3.4.3 Guests

  • A guest needs an account on the server, made from the invite as in §3.2.3. They see only what’s shared with them, under Shared with me, grouped by workspace. A guest isn’t in the workspace’s member list or switcher; their switcher shows “Shared with me” as an entry of its own.
  • What a guest can do follows Can edit or Can view on that page:
Guest, can editGuest, can view
Read the page and pages inside itYesYes
Edit, add pages insideYesNo
Version history of that page, restoreYesNo
Share it furtherNoNo
Publish to webNoNo
Search and AskOnly over pages shared with themSame
AnalyticsViews chart onlyViews chart only
Connect an agentOnly to what’s shared with them, at their accessRead-only
  • Links and blocks pointing elsewhere: a link to a page the reader can’t see shows as a grey chip, “No access”, without its title. A query block or inline database lists only the rows the reader can see. A backlink from a page they can’t see isn’t shown.
  • Owners can turn guests off for a workspace (Settings → Members, Allow guests, on by default), and the server’s owner for the whole server ([workspaces] guests = false). Members gets a Guests list with what each guest can reach, and Remove.

3.4.4 Losing access

The same as removal (§3.2.4), page by page: the server deletes the entries from the person’s view document at once and refuses the page documents. Their devices delete those pages’ local copies at their next sync. A device that stays offline keeps what it had.

3.4.5 Members with restricted pages, and the other features

  • Search, Ask, agents, Markdown folder: each covers what that person can see. A Markdown folder writes private pages under Private/ and pages shared with you under Shared with me/.
  • History of a restricted page is visible to those who can edit it.
  • Updates, “All pages” lists only pages the reader can see.
  • Analytics viewers lists only people who can see the page.
  • Journal and Meetings: each can be moved to Private like any page. A new journal or Meetings database starts in Private in a workspace with other members, and in Workspace when you’re alone.
  • Notion import puts imported pages in Private when the workspace has other members, and asks otherwise. Notion’s own sharing settings aren’t in its export, so they don’t come across.

3.4.6 Sync and security changes

  • documents.kind gains restricted and view. A restricted document is never sent to any device. A view document is sent only to its own person.
  • page_access gets row-level security: a page is readable by a person only if the workspace shares it, or a row names them. Cedar checks the same rule first.
  • New protocol reason NoAccess for a page subscription the person may no longer have.
  • A guest’s grants and agent tokens are limited to their view document and the pages in it.

3.3 Migrating what exists

  • Server: workspaces gets name, icon and deleting_at. Each existing workspace is named “Personal”. Members, keys and documents are already per workspace, so nothing else moves.
  • Devices: on first start, the store moves from workspace.drusite to workspaces/<id>/workspace.drusite, and its key is filed under that workspace. The move is a rename in the same folder, done before the store is opened, so a crash leaves either the old layout or the new one. The browser does the same in OPFS.
  • The dead end goes away: a device with notes of its own that signs in to an account with a workspace from elsewhere (Join::Conflict today) is now asked: “This device has notes that aren’t in your account. Add them as a new workspace, or replace them with your account’s?” The choices are Add as a workspace (“Notes from MacBook”) and Replace (which needs a second confirmation and deletes the device’s own notes).
  • Settings: the journal and meeting settings already in the workspace document stay there. Device settings stay on the device. The Markdown folder setting, which is per device today, becomes this device’s folder for the “Personal” workspace.
  • Agents: existing grants are scoped to the one workspace they could already reach.
  • Old apps against a new server see only the workspace they already sync, as today. New apps against an old server show the one workspace, without the switcher’s New workspace: “Your server is too old for more than one workspace (needs 0.1.0-alpha.9).”

4. Updates & analytics

4.1 Opening it

The page’s “…” menu, Updates & analytics (activity). It opens in the right panel beside the page (the same container as Ask, 400 px, resizable), replacing Ask if that’s open. On phones it’s full screen. Two tabs: Updates and Analytics. The panel remembers the last tab per device.

4.2 Updates

A feed of what happened to this page, newest first, built from version history (§2) at the 10-minute window:

  • Each entry: avatar, “Sam edited Page title”, the time, and a short excerpt of the change: up to 3 changed blocks with insertions highlighted as in history, then “View 6 more”, which opens Version history at that version. A file-clock button on the right opens it too.
  • Other kinds of entry: created, renamed (“Renamed from Draft”), moved (“Moved into Projects”), moved to the trash and restored, published and unpublished, a version restored, a version named, properties changed (“Status: To do → Done”), a meeting transcribed or summarised, and an agent’s edit (“Research agent edited this for Sam”, with Undo from the agent activity log).
  • Comments: Drusite has none yet. When it does, they appear here.
  • Viewers see the feed without deleted text: an entry that only removed text says “Removed some text”.
  • All pages: a select at the top, This page or All pages, shows the same feed for the whole workspace, each entry naming its page. It’s useful with one person too, to see what your other devices, agents and meeting jobs changed. It isn’t a notification inbox: nothing is marked read, and nothing is pushed to you.
  • Where it comes from: the page’s own feed is built from the page’s history on the device, so it works offline for what the device has. “All pages” is built on the server from the peer register and the update log (without opening every document), so it needs a connection.
  • Empty: “No updates yet.” Offline for All pages: “Updates for all pages come from your server. You’re offline.”

4.3 Analytics

Three sections, as in Notion:

Views

  • “Views (12 total)”, and a range select: Last 7 days, Last 28 days (the default), Last 90 days, Last 12 months.
  • A bar chart of views per day (per week for 12 months), in --accent, with the axis in --text-3, following design/DESIGN.md. Hovering or tapping a bar shows the day and count.
  • If the page is published, views from the public link are a second series in --text-3, labelled “Public link”, counted without any identity (§4.4).

Viewers (owners and editors)

  • First, your own setting, Show your view history, a Select: Allow or Don’t allow, with one line: “People who can edit this workspace see when you last viewed a page.” It’s per person, per workspace, and also in Settings → Account.
  • Then the people who viewed the page and allow it, with “Last viewed 5 minutes ago”. People who don’t allow it aren’t listed, and their views still count in the chart.

Editors

  • Created by: the person and when. For a page imported from Notion, Notion’s creator and time are kept, and the line says “(in Notion)”.
  • Recently edited by: up to 5 people, from the peer register, with when each last edited. Agents appear as “(agent) for (person)”.

For one person, which is what most installs are today, the panel says so instead of looking empty: “Only you are in Work, so these are your own views.” The viewers list is hidden, and “Created by” and “Recently edited by” show you and your devices. It’s still honest data, just not very interesting until someone else joins.

4.4 What is recorded, and privacy

What counts as a view: the page shown in the foreground for at least 5 seconds. A person counts once per page per 30 minutes, so scrolling and switching tabs don’t inflate it. Agents reading a page don’t count. Your own views count.

What the server keeps, and nothing more:

RecordContentsKept
page_view_dayspage, day, count (from members), count (from the public link)[analytics] keep_days, 365 by default
page_viewerspage, person, last viewed, count. Only for people who allow it.Until they turn it off, leave the workspace or delete their account, which deletes their rows at once

There’s no per-view log, no IP address, no device and no user agent. A public view of a published page adds 1 to the day’s count and stores nothing about the reader: no cookie and no address.

Defaults (open question 5): Show your view history is Allow in workspaces you share, as in Notion. In a workspace with only you in it, it makes no difference.

The server’s owner can turn it all off: [analytics] enabled = false stops recording, hides the Analytics tab, and deletes the stored rows. count_public_views = false stops counting public links.

What each app reports:

AppHowOffline
Desktop apps, phone appsThe app sends “viewed page P at time T” to /api/v1/workspaces/{ws}/viewsKept in a small queue in the encrypted store and sent later with their original times. Views older than 7 days are dropped instead of being sent.
BrowserThe same, from the workerSame queue, in its OPFS store
Published pagesThe server counts the page it servesNot applicable
Agents, the Markdown folder, importsNothingNot applicable

4.5 Errors and empty states

WhenIt says
No views in the range“No views in the last 28 days.”
OfflineThe panel shows the last numbers it had: “Last updated at 14:05. You’re offline.”
Not signed in to a server“Analytics need your server: views are counted there.” Updates for this page still work.
Analytics turned off on the serverThe Analytics tab isn’t shown.
A viewer opens the panelUpdates and Analytics show, without the viewers list or deleted text.

5. The same on every platform

macOS, Windows, LinuxiOS, AndroidBrowser
OutlineStrip and hover card; in “…” when the window is narrow“…” › Outline, bottom sheetAs desktop (as phone in a phone’s browser)
Version historyModalFull screen, list then versionAs desktop
History offlineYes, from the device’s copyYesYes (OPFS copy)
Restore offlineYes, synced laterYesYes
Updates for this pageRight panelFull screenRight panel
Updates for all pages, AnalyticsOnlineOnlineOnline
Workspace switcherTop of the sidebar, ⌘⇧1–9Top of the drawer, bottom sheetTop of the sidebar
Markdown folder per workspaceYesNo folders on phones, as todayNo folders, as today
Invites, MembersSettings → MembersSame, full screenSame
Private, Shared with me, page InviteSidebar sections; Share › Invite popoverDrawer sections; Share sheet from “…”As desktop
Views reportedYes, queued offlineYes, queued offlineYes, queued offline

What a viewer can technically read. A viewer’s device holds the documents, with their history. The app doesn’t show viewers the history, and the server doesn’t give them peer names, but someone with a viewer’s unlocked device and a debugger could read deleted text from the copy. That’s true of any local-first app that keeps history. If that matters, the answer is not to share that workspace with them.


6. Order and dependencies

One branch, one PR. Inside it, the work is built in this order, because each step uses the one before:

  1. Outline. Only the UI; depends on nothing.
  2. Version history. It starts recording time and authors (§2.9). Every edit made before it has no time or name, permanently, so it goes first among the data changes. The roles it checks already exist on the server.
  3. Several workspaces (a). Moves the device’s store and puts several workspaces on one connection.
  4. Sharing a workspace (b). Invites, roles, removal.
  5. Private pages and single-page sharing (§3.4). The restricted tree, view documents, page_access and guests. It needs (b)’s invites and removal.
  6. Updates & analytics. Updates reads history; analytics’ viewers need members and page access.

The PR description will list these as sections, each with its own tests, so it can be reviewed a part at a time even though it lands at once.


7. Tests

WhatHow
OutlinePlaywright on the in-memory core: when it shows (2 headings no, 3 yes), the current heading as the page scrolls, jumping, folded toggles unfolding, meeting tabs switching, the narrow-window and phone versions, keyboard, and the Settings switch. In Chromium and WebKit, like the other UI tests.
History in the CRDTUnit and property tests in drusite-crdt: versions grouped by window and person, the diff between two versions (inserted, deleted, retyped, moved blocks), restore as a new edit with a concurrent edit kept, restore of title and properties only touching that page’s entry, database structure history in words.
Peer registerServer tests on Postgres: pushes record user and grant, compaction keeps the register, a peer already held by someone else is refused, the server’s time wins for a live push with a wrong clock and the device’s for an offline one, viewers are refused peer names.
Sync simulation (drusite-core/tests/simulation.rs, turmoil)Added cases: two people editing offline, then syncing, each change attributed correctly; a restore made while another device edits the same block, with nothing typed lost; a member removed while their device is partitioned, which deletes its copy on reconnect and has its later pushes refused; a viewer’s pushes refused; views queued offline and sent with their original times; several workspaces on one connection, with only the open one live.
SizeA test that builds pages from synthetic text (heavy editing, a long transcript, a large database) and checks history’s size against a budget set in the PR (§2.8).
Private pages and guestsServer and simulation tests: a restricted page never reaches a device that may not see it (by sync, search, Ask, agents or a link’s title); edits to a view document reach the restricted tree and every other view, attributed right, including from offline devices; a page moved between Workspace and Private keeps its ID, links and history; access removed while a device is offline deletes the copy on reconnect; a guest’s search and Ask see only their pages; subpages can add people but not remove them.
Workspaces on the serverInvites (once only, expiry, email must match, OIDC verified-email check, invites_create_accounts off), roles against every route, the last-owner rule, scheduled deletion and Restore, row-level security on the new tables.
Device migrationThe store moves to workspaces/<id>/, with a crash injected between steps; Join::Conflict becomes “Add as a workspace”. In the browser, the same in OPFS.
AnalyticsThe 5-second and 30-minute rules, opt-out deleting rows at once, public views storing nothing but a count, keep_days pruning, enabled = false deleting the stored rows.
PlatformsThe existing CI matrix builds and runs core tests on macOS, Windows and Linux, plus the Android build. iOS is checked locally. Phones and touch are covered by the UI tests at phone size with pointer: coarse.
By handThe switcher’s shortcuts on each desktop, the outline on an iPad in both orientations, and inviting a second account through an OIDC provider. You’d run these; I’ll write the checklist into each PR.

No real notes, Notion data or real people’s addresses go into the repository. Test people are sam@example.com and the like.


8. Not in this plan

  • Live presence: others’ cursors and who’s on the page now.
  • Comments and suggested edits, and with them comments in Updates.
  • Notifications, an inbox, and “Notify me”.
  • Trimming history (§2.7), unless you choose it in question 4.
  • Exporting history.
  • The outline on published pages.

9. Open questions

  1. Order inside the PR: recommend outline, history, workspaces (a), (b), private pages and guests, then updates & analytics (§6), so that times and names start being recorded first.
  2. Guests on by default: recommend on (Settings → Members, Allow guests), with the server setting [workspaces] guests to turn them off for a whole server.
  3. Who can see history: recommend owners and editors only (§2.11). Notion does the same. The alternative is to let viewers see history without restore, which shows them text that was deleted before they were invited.
  4. How long to keep history: recommend forever, with no trimming, as today (§2.7). Trimming with shallow snapshots saves space but can lose the edits of a device that was offline for a long time. If you want a limit anyway, it would be a server setting that trims only past what every device has synced, with named versions kept.
  5. The default for “Show your view history”: recommend Allow, as Notion does, since members of a workspace already see each other’s edits. The alternative is Don’t allow by default, which leaves the viewers list empty unless people opt in.
  6. Invites creating accounts when self-signup is off: recommend yes by default (invites_create_accounts = true), since otherwise inviting someone new means the server’s owner has to make their account first. A server that wants only existing accounts sets it to false.
  7. The phase number: this plan is “Phase 9”, so the roadmap’s whiteboard would become Phase 10. Recommend renumbering, since this work comes first.