Design Proposal: Personal Branch Sharing — owner-based read/write sharing while preserving Trilium’s personal knowledge-base model #10687
TheFreeman
started this conversation in
Development
Replies: 1 comment 1 reply
like I mentioned in a related discussion, my preference would be to target sharing with non-local users, even at the cost of higher complexity. I don't perceive anything less than that as particularly useful for the following reasons:
|
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Design Proposal: Personal Branch Sharing — owner-based read/write sharing while preserving Trilium's personal knowledge-base model
Summary
Trilium has always been strongest as a personal knowledge base: one person owns and structures their notes, while notes, branches, clones, attributes, revisions, protected notes, scripts, and synchronization remain part of one coherent personal system.
At the same time, there is a practical multi-user use case that does not require turning Trilium into a team wiki:
I would like to propose Personal Branch Sharing as the collaboration model for TriliumNext.
This proposal is intentionally narrower than Confluence, SharePoint, Notion teamspaces, or a conventional enterprise ACL system. It does not introduce organizations, spaces, departments, team-owned content, approval workflows, role matrices, or real-time collaborative editing.
Instead, it extends Trilium's existing mental model:
This proposal is intended to support and clarify the current multi-user work, not to replace or compete with it. The existing work around user identities,
notes.ownerId, groups, permission rows, and user-specific note projections provides much of the required foundation. The purpose of this design proposal is to settle the product and authorization rules before implementation details become difficult to change.Related work and discussions:
The core model
Every account opens into its own personal Trilium.
A user's notes are private by default. The owner may select a note and share that note together with its descendant branch with another local user.
A share has one of two access levels in the first version:
Example:
Daniel can share
Project Awith Anna:Anna then sees:
Anna does not enter a shared workspace, and the branch is not copied into her ownership tree. It is a controlled view into Daniel's branch.
Ownership rules
The ownership model is deliberately simple and strict.
For example, when Anna creates a note inside Daniel's shared branch:
This prevents accidental fragmentation of ownership inside one branch. Daniel remains responsible for the branch as a whole, while the revision history still records who created and changed each note.
Ownership transfer, if implemented later, should be a separate, explicit, owner-controlled operation. It must not happen implicitly through sharing, editing, moving, or cloning.
What “Can edit” means
Edit access should allow ordinary collaborative work inside the shared boundary, such as:
Edit access must not automatically allow the recipient to:
In other words, edit access is content collaboration, not delegated ownership or administration.
Inheritance and private exclusions
A share should normally apply to the selected note and all descendants reachable through that shared branch.
For the first implementation, exclusions should be scoped to a specific share rather than implemented as a generic deny-based ACL system. This keeps the model understandable:
This is important because a conventional deny/allow hierarchy would quickly move Trilium toward an enterprise permissions product.
Branches and clones
Trilium's branch and clone model requires special care because a note can be reachable through more than one path.
The proposed rule is:
A recipient must not learn:
The recipient's visible tree is therefore a user-specific projection, not a filtered copy of the owner's complete tree.
Cross-owner strong branches should not be introduced. A branch remains part of the owner's content graph; sharing only grants another user access to a projected path.
User experience
The interface should continue to feel like personal Trilium.
The recipient should have two top-level areas:
Shared with meis virtual. It is not a real root note owned by the recipient and does not create physical clones in the recipient's tree.Each shared root should clearly display:
For owners, the share dialog should remain small and direct:
This should not become a role editor or permission matrix.
System administration is not content ownership
System administration and access to personal content should be separate concepts.
An administrator may need to:
That does not mean an administrator should silently receive normal read/write access to every user's private notes through the UI, API, Becca cache, or search.
If emergency content access is considered necessary, it should be:
The normal authorization rule should remain ownership or an explicit share.
Authorization must be enforced in the service layer
A filtered user-specific Becca projection is necessary for privacy and performance, but it must not be treated as the authorization boundary.
The core rule should be:
The implementation should provide central operations such as:
These checks must apply consistently to:
Knowing a note ID, receiving a note through a cache, or having a note present in Becca must never be sufficient to authorize an operation.
Protected notes, scripts, widgets, and automation
Executable Trilium features create a stronger trust boundary than ordinary text notes.
A user with edit access must not be able to gain owner-level or server-level capabilities by modifying a shared script, widget, event handler, or automation note.
For the first version, the safest model is:
A later version may introduce more granular trust decisions, but ordinary branch editing must not imply executable trust.
Search, relations, backlinks, and metadata
All discovery mechanisms must operate on the current user's visible graph.
A recipient's search, autocomplete, backlinks, recent notes, relation suggestions, inherited attributes, saved searches, and navigation history must not expose inaccessible content.
For example:
This is not only a UI concern. It is part of the confidentiality boundary.
Synchronization and live updates
Synchronization cannot be routed only according to the user who caused a change.
If Daniel edits a note shared with Anna and Max, all current viewers must receive the change. If Anna edits the same note, Daniel, Anna, and Max must receive the resulting update according to their current access.
Revoking a share must also produce a removal or purge event for clients that previously synchronized the content.
The first version does not need CRDTs or character-by-character real-time co-editing. Optimistic concurrency is sufficient:
This fits Trilium's existing revision-oriented model and keeps the implementation proportionate to the intended use case.
Deliberate non-goals
Personal Branch Sharing is not intended to introduce:
The target is a personal or small-instance Trilium installation used by individuals, families, trusted collaborators, and small teams that need selective sharing without giving up personal ownership.
Why this remains true to Trilium
This model does not replace Trilium's personal tree with a collaboration platform.
It preserves the existing concepts:
The intended user experience remains:
It should never become:
Fit with the current implementation direction
The proposal is designed as an evolution of the current multi-user work rather than a replacement architecture.
The existing direction already contains or is moving toward important building blocks:
notes.ownerId;note_permissions;The remaining work is primarily to define and enforce consistent domain semantics around those structures:
Suggested implementation sequence
The work should be split into small, reviewable pull requests rather than one large multi-user merge:
This allows each security boundary to be reviewed and tested independently.
Decisions requested from maintainers
Before more implementation details harden, I would appreciate an explicit decision on the following product rules:
Once these product decisions are settled, most remaining questions become implementation details rather than unresolved product design.
Full design documents
The complete proposal contains the detailed data model, API contracts,
authorization algorithm, branch and clone semantics, migration strategy,
threat model, implementation map, test matrix, and release criteria.
This design proposal is not intended to disregard the ongoing implementation in #10348. It is intended to define the product invariants and target authorization model that the implementation can converge on.
Feedback is especially welcome on the product rules above. Once there is agreement on those rules, I would be willing to help translate them into smaller implementation tasks and reviewable pull requests.
All reactions