Repository navigation
Description
Overview
An ai-chat node is an ordinary node, access is open by default, and upgrading a local install to Pro syncs existing data as open. Composed, that means every AI chat is readable by every user in the tenant unless someone takes an explicit action. That is the specified behavior today, and it is wrong for this node type.
A conversation is a thinking surface — half-formed ideas, salary questions, frustrations about a colleague, a pasted error containing a token. People do not compose them for an audience. Open-by-default is right for most node types and wrong for this one.
Problem Statement
- There is no owner or creator property on the chat node. The
created_by: "ai"marker andsource_chat_nodesit on nodes the agent created, not on the conversation, so there is nothing today that even identifies whose chat it is. - Nothing privatizes chats at Pro upgrade — existing local data syncs as open by design.
- A tenant-visible chat is directly readable: openable, linkable, listable. Direct read access is the exposure, and it is sufficient on its own.
A separate correction matters here, in the opposite direction from what might be assumed. It is tempting to argue that semantic search leaks private chats to teammates, and the docs disagree with the code about whether chats are embedded at all:
- ADR-029 carries a revision stating ai-chat is never embedded —
get_embeddable_content()returnsNoneunconditionally, makingSearchScope::Conversationsa no-op. packages/core/src/behaviors/mod.rsstill extracts user and assistant text fromproperties.messages[]and returnsSome(...). The revision was never implemented.
So chats are embedded today, and architecture/ai-chat-node.md still described them as embeddable with RLS-controlled embeddings. But this does not make search the privacy problem: embeddings are local-only and never synced, so they were never a cross-user exposure surface. The privacy case rests on direct read access; implementing the ADR-029 revision is a search-hygiene fix (conversation fragments polluting knowledge search) that belongs in this issue only because it is the same file and the same stale narrative.
Proposed Solution
Private by default within the existing collection access model — no new owner property, no new access axis.
- Seed a personal AI-chat collection alongside the existing PersonNode and DatabaseSettingsNode seeding, with
restrictedToMembers = trueand exactly one personmember_ofedge atadminto the local PersonNode. The auto-admin bootstrap already performs precisely this pair of writes. - Random node id — not symbolic. A username-derived id like
<user>-private-collectionwould be guessable, would collide across installs that later sync into one tenant, and would bind identity to a mutable display name. Identity comes from the personmember_ofadmin edge, not from the name. - Membership written transactionally at chat creation, fail-closed. A chat must never be observable without its restriction.
- Sharing is an ordinary membership change: add a
member_ofedge to an open or shared collection, or add teammates to the personal collection. Private-by-default sets the default; it forecloses nothing.
Because the access walk unions member_of, this makes the chat private wherever it sits in the outline — on a date page, under a project, anywhere — without the collection dictating outline position.
Open-by-default is not inverted globally. One node type gets a seeded restricted classification. This is why the collection approach beats a per-node-type owner property: no second access mechanism, no new RLS branch, and sharing composes for free.
Delivery: a seeded playbook declared as an invariant rule
The node_created on ai-chat → add_relationship member_of step ships as a seeded playbook — user-inspectable and modifiable, in the spirit of DB-seeded prompts and skills — declared as an invariant rule so it runs inside the creating transaction.
As a plain post-commit reactive rule it would be fail-open: abort-on-failure with no rollback yields a permanently tenant-open chat plus a log node, and even on success there is a window in which the chat exists unrestricted. Neither is acceptable for a privacy default. The rule qualifies for the invariant class — a local write only, depth 1, deterministic, same-graph scope.
The engine is not the guarantee. The Pro tenant schema must also enforce that an ai-chat insert carries a restricted member_of classification, so a client that does not run the engine or holds a stale playbook cannot create a tenant-visible chat.
Chats still sync
Rejecting a non-syncing node type, deliberately: multi-device continuity is the core Pro promise; a task carrying source_chat_node whose chat does not sync leaves teammates with a dangling reference, breaking the audit trail the surface exists to provide; and deliberate sharing is legitimate. Private-by-default achieves the privacy goal without trading one solved problem for three new ones.
Where a source_chat_node reference legitimately cannot resolve (private to another user, or on a device the reader lacks), it renders as a known-but-inaccessible marker — not a broken link, an error, or nothing. This preserves the provenance signal ("this was decided in a conversation") while leaking nothing about content. Whether the cause is "private to someone else" or "not on this device" is not surfaced, because that distinction is itself information about other users' data.
Architecture Impact
- ADR-061 (
../nodespace-docs/decisions/061-ai-chat-private-by-default-and-machine-bound-properties.md) is the governing decision. This issue implements §1–§5 and §8. - ADR-037 (
../nodespace-docs/decisions/037-collection-access-model.md) §1's open-by-default is not reversed globally; §6's auto-admin bootstrap and the PersonNode seeding section are reused as-is. - ADR-029 (
../nodespace-docs/decisions/029-behavior-owned-embedding.md): its revision (ai-chat never embedded) is the accepted decision and is currently unimplemented in code. This issue implements it. - ADR-059 (
../nodespace-docs/decisions/059-access-classification-not-outline-position.md) is what makes the collection approach work regardless of outline position. architecture/ai-chat-node.mdhas been corrected — the stale "embeddable, RLS-controlled embeddings" narrative and code sample are fixed, and the privacy and provenance sections added.- The companion
nodespace-docschanges are already committed; no further docs work is required.
Acceptance Criteria
- Every install seeds a personal AI-chat collection with
restrictedToMembers = trueand one personmember_ofedge atadminto the local PersonNode - The seeded collection's node id is random — not symbolic, not derived from a username
- Creating an
ai-chatnode writes itsmember_ofedge to the personal collection in the same transaction; the chat is never observable without it - A failed membership write fails the chat creation (no chat is created)
- The membership rule ships as a seeded playbook, inspectable and modifiable, resettable to default, warning on edit or disable
- The Pro tenant schema rejects an
ai-chatinsert lacking a restrictedmember_ofclassification - A teammate without membership cannot read another user's chat
- Adding a
member_ofedge to an open collection makes the chat readable by the tenant (sharing works) -
AiChatNodeBehavior::get_embeddable_content()returnsNoneunconditionally; no ai-chat rows enter the vector index -
SearchScope::ConversationsandSearchScope::Everythingreturn no ai-chat results - An unresolvable
source_chat_nodereference renders as known-but-inaccessible, not as an error or a broken link - Tests pass (
bun run test:all) - Code passes
bun run quality:fix
Technical Specifications
Reference Files
- Behavior:
packages/core/src/behaviors/mod.rs—AiChatNodeBehavior::get_embeddable_content(currently extractsmessages[]; must returnNone),get_parent_contribution(alreadyNone) - Search scopes: the
SearchScopeenum —Conversationsis retained for API stability but becomes a no-op - Seeding: the existing PersonNode + DatabaseSettingsNode first-launch seeding path
- Auto-admin bootstrap:
auto_admin_on_restrictindb/tenant-schema.sql(nodespace-cloud) — the existing atomic restrict-plus-admin-grant - Membership constraint precedent:
enforce_last_admin,enforce_restriction_adminin the same file — the pattern for DB-level enforcement independent of client path - Provenance consumers: whatever renders
source_chat_nodereferences and node-reference decoration - Seeded content precedent: ADR-030's DB-seeded prompts and skills
Implementation Details
- The seeded collection is per-user, and every install seeds exactly one PersonNode (the local user), so seeding is one collection per install. On Pro upgrade the local PersonNode is bound to an auth identity rather than recreated, so the existing collection and its admin edge carry over with no migration step — this is why identity must live on the edge and not in the id.
- Removing embeddable content for ai-chat means existing ai-chat embedding rows must be deleted, not merely left unwritten. The embedding service already deletes existing embeddings when extraction returns
None, so requeuing existing ai-chat nodes once is sufficient — confirm that path rather than writing a bespoke cleanup. - Do not implement the membership write as hardcoded node behavior. A seeded playbook keeps it inspectable and adjustable; the DB constraint, not hardcoding, is what makes it non-bypassable.
- Deleting or un-restricting the personal collection silently changes the default for future chats while leaving existing ones private. The DB-level enforcement is what keeps this from becoming an exposure; the seeded-playbook warning is what makes it visible.
- The known-but-inaccessible marker must not distinguish "private to another user" from "absent on this device" in anything the UI renders or logs at user-visible level.
Dependencies
- Introduce invariant vs reactive playbook rule classes with synchronous pre-commit execution on the origin device #1739 (the invariant rule class — without it the membership write is fail-open, which defeats the purpose)
- Harden the RLS access walk: assert member_of classification, minimum-depth tie resolution, and cycle bound as tested invariants #1735 (the access walk must union
member_of, or the collection does not protect a chat sitting under an open outline ancestor)
Related Issues
- Property-level localOnly classification in the schema system; PTY transcript and session id never sync; remove the inert capture.sync setting #1741 (machine-bound property classification — the other half of ADR-061)
Activity
mstomar125 commentedon Aug 3, 2026
Status check while triaging this for pickup:
Slice A (ADR-029 search-hygiene) is already implemented —
AiChatNodeBehavior::get_embeddable_contentreturnsNoneunconditionally (behaviors/mod.rs), so no ai-chat rows enter the vector index andSearchScope::Conversations/Everythingreturn no ai-chat results. Those two acceptance criteria are met today.Remaining = the privacy core (Slice B) + the frontend marker (Slice C): seed the restricted personal ai-chat collection, write the
member_ofedge transactionally at chat creation (fail-closed), the Pro-schema reject for an ai-chat insert lacking a restrictedmember_of, and the known-but-inaccessiblesource_chat_nodemarker. Slice B's preferred delivery — a seeded playbook declared as an invariant rule — depends on #1739 (invariant vs reactive rule classes), which isn't built yet, and it sits squarely in the playbook/ai-chat area Michael is actively working. Recommend sequencing #1739 first (or coordinating with @malibio) before building Slice B rather than a direct non-playbook hack that the playbook approach is meant to avoid. The cloud-schema reject (my lane) should land together with the core seeding so it isn't rejecting inserts with no collection to point at.mstomar125 commentedon Sep 12, 2026
Status-confirmation (2026-09-12), following up on my 2026-08-03 comment above — nothing material has changed.
AiChatNodeBehavior::get_embeddable_content(packages/core/src/behaviors/mod.rs:1894) still returnsNoneunconditionally, with a doc comment explicitly citing the ADR-029 reversal.SearchScope::Conversations(embedding_service.rs:878) remains a no-op consumer. Those two acceptance criteria stay met.member_ofwrite, Pro-schema reject) is still not implemented — no seeding code for a personal ai-chat collection exists anywhere inpackages/core/src/.member_ofhardening), is now CLOSED — that half is no longer a blocker.Still correctly gated on #1739, not stale. Setting status to Blocked to reflect that accurately (was Backlog). Leaving open, no further action.
malibio commentedon Sep 27, 2026
Frontend baseline: 281 test files passed, 5444 tests passed (Duration 93.76s)
AI chats private by default: seeded personal collection + invariant m…
AI chats private by default: seeded personal collection + invariant m…
AI chats private by default: seeded personal collection + invariant m…
AI chats private by default: seeded personal collection + invariant m…