Skip to content

AI chats private by default: seeded personal collection, transactional membership, and implement the non-embeddable revision #1740

Closed

Description

@malibio

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 and source_chat_node sit 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() returns None unconditionally, making SearchScope::Conversations a no-op.
  • packages/core/src/behaviors/mod.rs still extracts user and assistant text from properties.messages[] and returns Some(...). 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 = true and exactly one person member_of edge at admin to 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-collection would 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 person member_of admin 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_of edge 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.md has been corrected — the stale "embeddable, RLS-controlled embeddings" narrative and code sample are fixed, and the privacy and provenance sections added.
  • The companion nodespace-docs changes are already committed; no further docs work is required.

Acceptance Criteria

  • Every install seeds a personal AI-chat collection with restrictedToMembers = true and one person member_of edge at admin to the local PersonNode
  • The seeded collection's node id is random — not symbolic, not derived from a username
  • Creating an ai-chat node writes its member_of edge 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-chat insert lacking a restricted member_of classification
  • A teammate without membership cannot read another user's chat
  • Adding a member_of edge to an open collection makes the chat readable by the tenant (sharing works)
  • AiChatNodeBehavior::get_embeddable_content() returns None unconditionally; no ai-chat rows enter the vector index
  • SearchScope::Conversations and SearchScope::Everything return no ai-chat results
  • An unresolvable source_chat_node reference 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 extracts messages[]; must return None), get_parent_contribution (already None)
  • Search scopes: the SearchScope enum — Conversations is retained for API stability but becomes a no-op
  • Seeding: the existing PersonNode + DatabaseSettingsNode first-launch seeding path
  • Auto-admin bootstrap: auto_admin_on_restrict in db/tenant-schema.sql (nodespace-cloud) — the existing atomic restrict-plus-admin-grant
  • Membership constraint precedent: enforce_last_admin, enforce_restriction_admin in the same file — the pattern for DB-level enforcement independent of client path
  • Provenance consumers: whatever renders source_chat_node references 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

Related Issues

Activity

  1. mstomar125 commented on Aug 3, 2026

    @mstomar125
    Contributor

    Status check while triaging this for pickup:

    Slice A (ADR-029 search-hygiene) is already implemented — AiChatNodeBehavior::get_embeddable_content returns None unconditionally (behaviors/mod.rs), so no ai-chat rows enter the vector index and SearchScope::Conversations/Everything return 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_of edge transactionally at chat creation (fail-closed), the Pro-schema reject for an ai-chat insert lacking a restricted member_of, and the known-but-inaccessible source_chat_node marker. 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.

  2. mstomar125 commented on Sep 12, 2026

    @mstomar125
    Contributor

    Status-confirmation (2026-09-12), following up on my 2026-08-03 comment above — nothing material has changed.

    Still correctly gated on #1739, not stale. Setting status to Blocked to reflect that accurately (was Backlog). Leaving open, no further action.

  3. malibio commented on Sep 27, 2026

    @malibio
    CollaboratorAuthor

    Frontend baseline: 281 test files passed, 5444 tests passed (Duration 93.76s)

  4. self-assigned this
    on Sep 27, 2026
  5. added 4 commits that reference this issue on Sep 27, 2026
    f804a45
    e1634e6
    cca6f70
    6cd55ac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions