Skip to content

Latest commit

 

History

History
120 lines (103 loc) · 5.26 KB

CONTEXT.md

File metadata and controls

120 lines (103 loc) · 5.26 KB

Rift

Rift is a chat product for talking to AI models, with multi-tenant organizations, BYOK keys, and per-thread RAG.

Language

Project: A user-owned container that groups Threads and applies a shared custom instruction plus attached files (via RAG) to every Thread inside it. Avoid: Workspace, Folder, Collection.

Thread: A single linear conversation, persisted as threads. Optionally belongs to one Project. Avoid: Conversation (in code), Chat (as a noun).

Project Context: The combination of a Project's custom_instruction (system-prompt text) and Project files (RAG corpus) automatically applied to every Thread in the Project. Avoid: Project settings (which is broader — also includes name, description, visibility).

Project Files: Files (e.g. PDFs) attached to a Project, chunked and embedded into the shared vector store, retrieved per-turn for any Thread in the Project. Avoid: Knowledge base (reserved for org-wide knowledge), Documents.

Custom Instruction: The text injected into the system prompt for a Thread or Project. Stored inline as projects.custom_instruction. Per-Thread custom instructions are not yet a real feature (see ADR-0003); the dangling threads.custom_instruction_id column is unused. Avoid: System prompt (reserved for the assembled, full system message).

Skill: A named, user-authored markdown fragment a user opts into for a single turn by typing /[skillname] in the composer. Distinct from a Custom Instruction in three ways: (1) named and individually invokable, (2) opt-in per turn rather than always-on, (3) many can exist per Project, plus a personal pool that can be used in any context. A Skill does not have to invoke a tool or agent — its only required job is to expand into prompt text so the user can avoid copy-pasting.

A Skill has one of three scopes:

  • Project Skill: scoped to a single Project; visible to everyone with access to that Project.
  • Personal Skill: scoped to one user across all their Projects and Project-less Threads; never visible to anyone else.
  • Org-Shared Skill: a Personal Skill the creator has shared with their Organization. Visible as a global to every member of that Organization. Owned and edited by the original creator (optionally co-edited by Org admins via a per-skill toggle on the Skill). Avoid: Macro, Snippet, Command (slash menus often contain non-Skill commands).

Organization: The multi-tenant auth/billing boundary backed by Better Auth. Owns subscriptions, member access, BYOK keys, AI policy, and org-wide knowledge. Avoid: Workspace (in code) — see Flagged ambiguities.

Org Knowledge: Org-wide admin-curated RAG corpus, distinct from a Project's files. Avoid: Knowledge base (in user-facing copy when ambiguous).

Relationships

  • A Project belongs to exactly one user (user_id) and optionally one Organization (organization_id); visibility controls whether org members other than the owner can see it.
  • A Thread belongs to at most one Project (movable in either direction).
  • A Project has many Project Files (via attachments.project_id).
  • A Thread inside a Project receives that Project's Project Context unconditionally (ADR-0003).
  • RAG retrieval for a Thread inside a Project unions per-message, per-thread, project, and org-knowledge sources (ADR-0002). All of them go through one pipeline (ADR-0006): pinned sources (conversation and Project Files) are read in full while they fit the context budget and retrieved otherwise; Org Knowledge is ambient and only retrieved when relevant.
  • Project deletion is a soft delete with a Windows-folder cascade: the project, its Threads, and its Project Files are hidden together. FKs are preserved on the soft-deleted side (ADR-0001).

Example dialogue

Dev: "If a user moves a Thread out of a Project, do past turns lose their Project Context?"

Domain expert: "No — past turns are immutable. The Thread's old messages were already generated with the Project's instructions and retrievals; we're not rewriting history. Only future turns stop seeing the Project's context."

Dev: "And if I delete the Project the Thread is in?"

Domain expert: "Soft delete with a Windows-folder cascade. The project disappears, and so do its threads and attached files — they all become invisible together. Database rows survive intact (the FK is preserved), so a future restore feature can bring everything back, but the user can no longer see the threads anywhere in the UI."

Flagged ambiguities

  • "Workspace" has been used to mean both Organization (in pricing/billing copy) and an unbuilt entity (the dangling attachments.access_scope = 'workspace' enum value and workspace_id column). Resolution: do not use "Workspace" as a domain term in new code. Use Organization for the multi-tenant boundary and Project for the new Thread-grouping concept. The dangling attachments columns will be repurposed to mean Project as part of the Projects feature.
  • "Custom instruction" vs "system prompt": a custom instruction is the user-authored text that contributes to the assembled system prompt, alongside model-mode prompts and tool descriptions. They are not interchangeable.