Rosetta Docs - LLM Digest Generated from src/content/**/*.mdx ================================================================================ FILE: api/documents.mdx ================================================================================ # Documents API ## List Documents ```http GET /v1/documents ``` ### Query Parameters | Parameter | Type | Description | | --- | --- | --- | | `limit` | integer | Results per page (default: 20, max: 100) | | `offset` | integer | Pagination offset (default: 0) | | `sort` | string | `created_at`, `updated_at`, `title` | | `order` | string | `asc` or `desc` | | `search` | string | Full-text search query | | `tag` | string | Filter by tag | ### Example ```bash curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://philipshih.org/apps/rosetta/api/v1/documents?limit=10&sort=created_at&order=desc" ``` ## Get Document ```http GET /v1/documents/:id ``` ## Create Document ```http POST /v1/documents ``` ### Request Body ```json { "title": "New Progress Note", "content": "Document content in markdown...", "tags": ["progress-note"], "template_id": "tpl_123", "metadata": { "document_type": "progress_note", "date_of_service": "2026-01-20" } } ``` ## Update Document ```http PATCH /v1/documents/:id ``` ## Delete Document ```http DELETE /v1/documents/:id ``` ### Delete Response ```json { "success": true, "message": "Document moved to trash", "recoverable_until": "2026-02-19T09:15:00Z" } ``` ================================================================================ FILE: api/errors-sdks.mdx ================================================================================ # Errors & SDKs ## Error Response Format ```json { "error": { "type": "validation_error", "message": "Invalid request parameters", "details": [ { "field": "title", "issue": "Title is required" } ], "request_id": "req_abc123" } } ``` ## HTTP Status Codes | Code | Meaning | Description | | --- | --- | --- | | 200 | OK | Successful request | | 201 | Created | Resource created successfully | | 400 | Bad Request | Invalid request parameters | | 401 | Unauthorized | Missing or invalid API key | | 403 | Forbidden | Insufficient permissions | | 404 | Not Found | Resource does not exist | | 429 | Too Many Requests | Rate limit exceeded | | 500 | Internal Server Error | Contact support | ## Error Types - `authentication_error` - `validation_error` - `permission_error` - `rate_limit_error` - `not_found_error` - `server_error` ## SDKs ### Python ```bash pip install rosetta-client ``` ```python from rosetta import RosettaClient client = RosettaClient(api_key="YOUR_API_KEY") documents = client.documents.list(limit=10) ``` ### JavaScript / TypeScript ```bash npm install @rosetta/client ``` ```ts const client = new RosettaClient({ apiKey: "YOUR_API_KEY" }); const documents = await client.documents.list({ limit: 10 }); ``` ================================================================================ FILE: api/export-webhooks.mdx ================================================================================ # Export & Webhooks ## Export Document ```http POST /v1/documents/:id/export ``` ### Request Body ```json { "format": "pdf", "options": { "include_metadata": true, "include_citations": true, "page_size": "letter", "orientation": "portrait" } } ``` ### Supported Formats - `pdf` - `docx` - `html` - `txt` - `markdown` ## Webhooks Subscribe to account events from **Settings -> Webhooks**. ### Available Events - `document.created` - `document.updated` - `document.deleted` - `export.completed` - `ai.query_completed` ### Payload Example ```json { "event": "document.created", "timestamp": "2026-01-20T10:30:00Z", "data": { "document_id": "doc_abc123", "title": "New Progress Note" } } ``` ================================================================================ FILE: api/index.mdx ================================================================================ # API Reference Rosetta provides a REST API for documents, templates, tool requests, and export workflows. **Beta**: Breaking changes may occur. ## Base URL ```text https://philipshih.org/apps/rosetta/api/v1 ``` ## Authentication Use a bearer token in the `Authorization` header: ```http Authorization: Bearer YOUR_API_KEY ``` ## Common Headers ```http Authorization: Bearer YOUR_API_KEY Content-Type: application/json Accept: application/json X-Request-ID: unique-request-id (optional) ``` ## Rate Limiting | Tier | Limit | Burst | | --- | --- | --- | | Free | 100 requests/hour | 10 concurrent | | Professional | 1,000 requests/hour | 50 concurrent | | Enterprise | 10,000 requests/hour | 100 concurrent | ## API Sections CRUD operations for document resources. Template endpoints and tool endpoints. Export jobs and event delivery integration. Error formats, status codes, and client libraries. ================================================================================ FILE: api/templates-ai.mdx ================================================================================ # Templates & Tools ## Templates ### List Templates ```http GET /v1/templates ``` ### Get Template ```http GET /v1/templates/:id ``` ## Tool Requests ### Ask Question ```http POST /v1/ai/ask ``` ### Request Body ```json { "question": "What is the treatment for community-acquired pneumonia?", "context": "Outpatient, no comorbidities", "include_citations": true } ``` Do not include PHI in API prompts. Redaction is best-effort, not a substitute for input hygiene. ### Generate Text ```http POST /v1/ai/generate ``` ### Request Body ```json { "prompt": "Expand on COPD exacerbation", "context": "Progress note, moderate severity", "max_tokens": 500, "temperature": 0.7 } ``` ================================================================================ FILE: clinical-workflow/index.mdx ================================================================================ # Workflows Rosetta organizes note drafting, templates, and agent tools in one editor. ## Document State Rosetta uses a local-first document state. - **Local writes first**: Changes are stored locally before sync. - **Offline editing**: You can keep editing without a connection. - **Conflict handling**: Edits from multiple devices are merged deterministically. ## Templates Templates define note structure and field behavior. ### Interactive Fields Templates can include placeholders that prompt for input when instantiated: - **Text fields**: `{{chief_complaint}}` - **Select menus**: `{{SELECT:severity|mild,moderate,severe}}` - **Dates**: Auto-formatted date pickers ### Locked Anchors Templates can contain "Anchors" - sections that agent tools cannot modify. Common uses: - Legal disclaimers - Required headers and footers - Fixed billing codes ## Agents Rosetta uses specialized agents for different workflow steps. ### `Shorthander` Toggle shorthand formatting for the selected text (i.e., hx of -> history of). - **Behavior**: Preserves meaning while expanding abbreviations (for example, "SOB" -> "shortness of breath"). - **Safety**: Does not remove user content and respects locked anchors. ### `Ingester` Sort and format user-uploaded documents and raw data. - **Context**: Scans PDFs and text files to build a searchable index. - **Citations**: Preserves metadata (authors, dates, DOIs) for traceability. ### `Reasoner` Generate a ranked differential and plan by problem for the selected text. - **Evidence-based**: Prioritizes claims supported by uploaded guidelines or PubMed results. - **Differentials**: Suggests diagnoses by likelihood and highlights red flags. ### `Formatter` Regenerates the selected text in the requested format. ### `Citations` Search PubMed, Embase, Google Scholar for guidelines. - **Source**: Queries PubMed and your local library. - **Style**: Formats citations in standard medical styles (for example, Vancouver). - **Relevance**: Prioritizes recent, relevant publications. ## `SmartPhrases` You can define custom text expansion shortcuts to speed up documentation. | Trigger | Expansion | |---------|-----------| | `.cc` | Chief Complaint section | | `.hpi` | History of Present Illness | | `.ros` | Review of Systems | | `.pe` | Physical Examination | | `.ap` | Assessment & Plan | | `.dc` | Discharge instructions | --- **Related** - [RAG System](/apps/rosetta/docs/rag-system) - [API Reference](/apps/rosetta/docs/api) ================================================================================ FILE: clinical-workflow/state-flow.mdx ================================================================================ --- title: State Flow description: High-level workflow state transitions. --- # State Flow Rosetta workflows move through predictable states from draft to finalized output. ## Typical Stages ```mermaid flowchart LR A[Draft creation] --> B[Agent-assisted enrichment] B --> C[Human review and acceptance] C --> D[Finalize and export] ``` ## Validation Points - Required fields present - Locked template anchors unchanged - Citations and references attached when needed ================================================================================ FILE: clinical-workflow/template-pipeline.mdx ================================================================================ --- title: Template Pipeline description: How templates and fields are applied across workflow steps. --- # Template Pipeline Templates define structure and constraints for generated notes. ## Pipeline ```mermaid flowchart LR A[Select template] --> B[Bind field values] B --> C[Run agent transforms] C --> D[Validate locked regions] D --> E[Queue pending edits] ``` ## Guardrails - Locked regions are never edited by agent tools. - Field validation runs before export. ================================================================================ FILE: editor/data-model.mdx ================================================================================ --- title: Data Model description: Core structures used by the Rosetta editor. --- # Data Model Rosetta uses a token-based document model on top of Lexical. ## Core Entities - Document blocks and inline marks - Pending edit objects from agent tools - Template anchors and locked regions ## Pending Edit Shape ```ts interface PendingEdit { id: string; type: "insert" | "replace" | "delete"; start: number; end: number; original: string; replacement: string; reasoning: string; agent: string; } ``` See the full editor overview for orchestration and review flow. ================================================================================ FILE: editor/index.mdx ================================================================================ # Editor Rosetta uses a custom **Lexical 0.39** stack with tokenized document state, template anchors, and an agent review queue. This page covers the editor internals, including change tracking and edge case behavior. ## At A Glance | Area | What It Handles | |------|------------------| | `EditorCore` | Host, selection, command routing | | `NoteEditorV2` | Composer, plugins, transactions | | `TemplateManager` | Anchors, fields, lock enforcement | | `SuggestionOverlay` | Pending diffs and review actions | | `SyncBridge` | Local store and cloud sync | ## Figure 1: Runtime Topology ```mermaid flowchart LR UI["User Input"] --> CORE["EditorCore"] CORE --> LEX["Lexical State"] LEX --> PIPE["Change Pipeline"] PIPE --> HIST["Undo/Redo History"] PIPE --> LOG["Operational Change Log"] PIPE --> QUEUE["Agent Suggestion Queue"] LOG --> LOCAL["Local Store"] LOG --> SYNC["Sync Bridge"] SYNC --> CLOUD["Cloud Snapshot"] QUEUE --> OVERLAY["Suggestion Overlay"] OVERLAY --> APPLY["Accept or Reject"] APPLY --> PIPE ``` ## Core Invariants 1. All mutations happen inside `editor.update()`. 2. Locked anchors are immutable for agent edits and template automation. 3. Character ranges used by suggestions are revision-scoped and remapped before apply. 4. Undo/redo affects only applied document changes, never discarded suggestions. 5. Every accepted agent edit emits a structured change event for auditability. ## Document Model Documents are serialized as node trees, not HTML strings: ```typescript interface SerializedEditorState { root: { type: "root"; version: number; children: SerializedNode[]; direction: "ltr" | "rtl" | null; }; } interface SerializedNode { type: string; version: number; children?: SerializedNode[]; text?: string; format?: number; detail?: number; mode?: "normal" | "segmented" | "token"; } ``` ### Why This Model - Portable between browser/runtime boundaries - Safer than HTML transport for clinical text - Deterministic diffing against prior snapshots - Enables anchored range mapping for suggestions ## Node Types ### Built-In + Rosetta Nodes ```typescript class RosettaTextNode extends TextNode { __format: number; } class RosettaParagraphNode extends ParagraphNode { __indent: number; } class AnchorNode extends ElementNode { __label: string; __isLocked: boolean; } class FieldNode extends DecoratorNode { __fieldType: "SELECT" | "MULTISELECT" | "DYNAMIC_SELECT"; __options: string[]; } ``` ### Custom Node Example ```typescript static getType(): string { return "smart-phrase"; } static clone(node: SmartPhraseNode): SmartPhraseNode { return new SmartPhraseNode(node.__text, node.__key); } createDOM(): HTMLElement { const span = document.createElement("span"); span.className = "smart-phrase"; return span; } } ``` ## Change Tracking Rosetta tracks changes in two layers: - Lexical history stack for user-facing undo/redo - Operational log for sync, agent traceability, and conflict logic ### Transaction Shape ```typescript type ChangeSource = "user" | "ai" | "template" | "sync"; type ChangeKind = "insert" | "replace" | "delete" | "format"; interface ChangeTransaction { id: string; revision: number; parentRevision: number; source: ChangeSource; kind: ChangeKind; createdAt: number; ranges: Array<{ start: number; end: number; beforeText: string; afterText: string; anchorId?: string; }>; metadata?: { suggestionId?: string; agent?: "chat" | "shorthander" | "reasoner" | "reformatter" | "citations" | "ingester"; batched?: boolean; }; } ``` ### Figure 2: Keystroke-To-Commit Flow ```mermaid flowchart TD U[User Input] E[Editor Update] D[Diff Engine] L[Change Log] S[Sync Bridge] C[Cloud Ack or Conflict] U --> E E --> D D --> L L --> S S --> C ``` ### Diff Strategy For reliable clinical text diffing, Rosetta uses staged comparison: 1. Node-level quick check (skip unchanged subtrees) 2. Token-level diff (sentence or field chunks) 3. Character-level fallback for precise selection overlays ```typescript function computeRanges(prev: string, next: string): RangeDelta[] { const tokenPass = diffByTokens(prev, next); if (tokenPass.precision >= 0.98) return tokenPass.ranges; return diffByCharacters(prev, next).ranges; } ``` ### Range Remapping Pending agent edits are revision-bound. If user edits arrive first, ranges are remapped before apply: ```typescript function remapRange(range: { start: number; end: number }, deltas: RangeDelta[]) { let { start, end } = range; for (const delta of deltas) { if (delta.pos <= start) start += delta.netLength; if (delta.pos < end) end += delta.netLength; } return { start, end }; } ``` ### Overlap and Conflict Rules When two pending edits overlap, Rosetta resolves deterministically: 1. Locked anchor guard always wins. 2. User edits override pending agent edits. 3. Newer agent suggestion supersedes older suggestion from the same agent scope. 4. Cross-agent overlap enters manual review state. ```mermaid flowchart TD A["New edit arrives"] --> B{"Touches locked anchor?"} B -- Yes --> C["Reject edit"] B -- No --> D{"Overlaps user-applied change?"} D -- Yes --> E["Mark stale, remap or discard"] D -- No --> F{"Overlaps pending agent edit?"} F -- No --> G["Queue normally"] F -- Yes --> H{"Same agent + newer?"} H -- Yes --> I["Supersede older suggestion"] H -- No --> J["Manual review required"] ``` ## Agent Suggestion Lifecycle ### Suggestion Object ```typescript type SuggestionStatus = | "pending" | "focused" | "accepted" | "rejected" | "stale" | "superseded"; interface AISuggestion { id: string; revision: number; type: "replace" | "insert" | "delete"; start: number; end: number; replacementText: string; reasoning: string; confidence: number; status: SuggestionStatus; } ``` ### Figure 3: Suggestion State Machine ```mermaid flowchart TD P[Pending] F[Focused] A[Accepted] R[Rejected] ST[Stale] SP[Superseded] END[Completed] P --> F F --> A F --> R P --> ST P --> SP ST --> F A --> END R --> END SP --> END ``` ### Safe Apply Logic ```typescript function applySuggestion(suggestion: AISuggestion) { editor.update(() => { if (isLockedRange(suggestion.start, suggestion.end)) return; const remapped = remapSuggestionAgainstLatestRevision(suggestion); if (!remapped) { markSuggestion(suggestion.id, "stale"); return; } replaceText(remapped.start, remapped.end, remapped.replacementText); appendChangeTransaction({ source: "ai", kind: suggestion.type === "insert" ? "insert" : "replace", metadata: { suggestionId: suggestion.id } }); markSuggestion(suggestion.id, "accepted"); }); } ``` ### Visual Indicators | Type | Color | Behavior | |------|-------|----------| | Insert | Green | Preview as additive text | | Replace | Yellow | Original text highlighted with replacement preview | | Delete | Red | Original text shown with remove indicator | ## Template Anchors Anchors define protected structure: ```typescript interface TemplateAnchor { id: string; label: string; isLocked: boolean; nodeKey: string; start: number; end: number; } ``` ### Guard Rails - Agents cannot modify locked anchors. - Bulk accept skips suggestions touching locked anchors. - Template updates can move anchors but cannot silently unlock them. - Anchor deletion requires explicit user confirmation. ### Anchor Navigation | Shortcut | Action | |----------|--------| | `Ctrl + ]` | Jump to next anchor | | `Ctrl + [` | Jump to previous anchor | | `Ctrl + Enter` | Fill current anchor and advance | ## Template Fields ### Field Types `SELECT` single choice: ```txt {{SELECT: medication | aspirin, clopidogrel, warfarin}} ``` `MULTISELECT` multiple values: ```txt {{MULTISELECT: symptoms | chest pain, dyspnea, diaphoresis}} ``` `DYNAMIC_SELECT` options resolved from query: ```txt {{DYNAMIC_SELECT: drug | query: medications for hypertension}} ``` ### Field Node Rendering ```typescript class FieldNode extends DecoratorNode { decorate(): JSX.Element { return ( ); } } ``` ## SmartPhrases SmartPhrases are expansion rules for high-frequency sections: ```typescript const smartPhrases: SmartPhrase[] = [ { trigger: ".cc", expansion: "Chief Complaint:\n" }, { trigger: ".hpi", expansion: "History of Present Illness:\n" }, { trigger: ".pe", expansion: "Physical Examination:\n" }, { trigger: ".ap", expansion: "Assessment & Plan:\n" } ]; ``` ### Nuance: Expansion + Suggestions - Expansion is treated as a user transaction (`source: "user"`). - Pending agent suggestions touching the trigger span are remapped. - If remap fails, those suggestions are marked `stale`. ## Selection And Positioning ### Character-Level Selection ```typescript const selection = $getSelection(); if ($isRangeSelection(selection)) { const anchor = selection.anchor; const focus = selection.focus; console.log({ anchorNode: anchor.key, anchorOffset: anchor.offset, focusNode: focus.key, focusOffset: focus.offset }); } ``` ### Programmatic Range Selection ```typescript editor.update(() => { const node = $getNodeByKey(nodeKey); if ($isTextNode(node)) { node.select(startOffset, endOffset); } }); ``` ## Plugin And Command Order Recommended plugin sequence: ```typescript ``` ### Why Ordering Matters 1. `TemplatePlugin` should run before `SuggestionPlugin` so locks are enforceable at preview time. 2. `OnChangePlugin` should run before network sync side effects. 3. `SmartPhrasePlugin` should execute before agent preview generation to avoid stale ranges. ### Command Priority Pattern ```typescript function MyPlugin(): null { const [editor] = useLexicalComposerContext(); useEffect(() => { return editor.registerCommand( MY_COMMAND, (payload) => { if (!payload) return false; editor.update(() => { // Apply a single atomic transaction. }); return true; }, COMMAND_PRIORITY_NORMAL ); }, [editor]); return null; } ``` ## Keyboard Shortcuts Reference | Shortcut | Action | |----------|--------| | `Ctrl/Cmd + B` | Bold | | `Ctrl/Cmd + I` | Italic | | `Ctrl/Cmd + U` | Underline | | `Ctrl/Cmd + Z` | Undo | | `Ctrl/Cmd + Shift + Z` | Redo | | `Tab` | Accept focused agent suggestion | | `Esc` | Reject focused agent suggestion | | `Ctrl/Cmd + Shift + A` | Accept all pending suggestions | | `Ctrl/Cmd + Shift + X` | Reject all pending suggestions | | `Ctrl + ]` | Next anchor | | `Ctrl + [` | Previous anchor | | `Ctrl + Enter` | Fill anchor and advance | ## Performance Notes ### Do - Batch related edits in one `editor.update()`. - Memoize expensive decorators (field components, inline preview components). - Keep suggestion overlay calculations incremental by revision. ### Avoid - Calling `$getRoot().getTextContent()` repeatedly in hot paths. - Rebuilding full range maps on every cursor move. - Triggering sync writes per keystroke without buffering. ### Batching Example ```typescript // Preferred: one atomic transaction. editor.update(() => { applyTemplateDefaults(); insertSmartPhraseExpansion(); queueAutosaveFlag(); }); ``` --- **Related:** - [Workflows](/apps/rosetta/docs/clinical-workflow) - [RAG](/apps/rosetta/docs/rag-system) - [API](/apps/rosetta/docs/api) ================================================================================ FILE: editor/keyboard-shortcuts.mdx ================================================================================ --- title: Keyboard Shortcuts description: Editor review and action shortcuts. --- # Keyboard Shortcuts | Key | Action | | --- | --- | | `Tab` | Accept current edit | | `Esc` | Reject current edit | | `Ctrl+Shift+A` | Accept all pending edits | | `Ctrl+Shift+X` | Reject all pending edits | ## Notes - Shortcuts apply when the editor has focus. - Hover a pending edit to preview the diff before accepting. ================================================================================ FILE: faq/account.mdx ================================================================================ --- title: Account & Access description: Login, permissions, and account management answers. --- # Account & Access ## Common Questions ### I cannot log in. What should I check? - Verify email/password - Confirm SSO configuration - Reset password and retry ### How do I manage team permissions? Use workspace roles and assign least-privilege access for each member. ### Can I recover deleted content? Contact [philip@philipshih.org](mailto:philip@philipshih.org). ================================================================================ FILE: faq/api.mdx ================================================================================ --- title: API & Integrations description: Questions about API keys, limits, and integrations. --- # API & Integrations ## Common Questions ### Where do I create an API key? Go to Settings and create a key under API access. ### Why am I receiving rate-limit responses? Your request volume exceeded your plan threshold. Retry with backoff or upgrade your tier. ### Which export formats are supported? `pdf`, `docx`, `html`, `txt`, and `markdown`. ================================================================================ FILE: faq/index.mdx ================================================================================ # Frequently Asked Questions ## General ### What is Rosetta? Rosetta is a text editing platform with RAG tools specifically designed for accuracy in clinical reasoning, literature retrieval, and note editing tasks. ### Who can use Rosetta? Rosetta is in private beta and available upon request to: - Physicians - Residents and fellows - Medical students at UCSF School of Medicine - Healthcare institutions [Request access](mailto:philip@philipshih.org?subject=Rosetta%20Access%20Request) ### How much does Rosetta cost? Pricing has not been announced. Beta users have free access during testing. ### What browsers are supported? Supported browsers: - Chrome 90+ - Firefox 88+ - Safari 14+ - Edge 90+ Keep your browser updated. ### Is Rosetta available on mobile? Rosetta is optimized for desktop browsers. Mobile support is planned. ## Getting Started ### How do I get access to Rosetta? 1. Request access by email 2. Receive login credentials 3. Sign in at [philipshih.org/apps/rosetta](https://philipshih.org/apps/rosetta) 4. Complete profile setup 5. Start creating documents ### Do I need to install anything? No. Rosetta is web-based. No install is required. ### How do I reset my password? 1. Go to the login page 2. Click **"Forgot Password?"** 3. Enter your email address 4. Use the reset link from your email 5. Create a new password If the email does not arrive, check spam or contact support. ### Can I import existing documents? Yes. Supported formats: - Microsoft Word (`.docx`) - Rich Text Format (`.rtf`) - Plain Text (`.txt`) - Markdown (`.md`) Use **File -> Import**. ## Using Rosetta ### How do I create a new document? 1. Click **"New Document"** or press `Ctrl/Cmd + N` 2. Choose a template (optional) 3. Start typing 4. The document auto-saves every 30 seconds ### What templates are available? Built-in templates include: - History & Physical (H&P) - Progress Notes (SOAP) - Consult Notes - Discharge Summaries - Procedure Notes - ER Notes - Specialty templates You can also create custom templates. ### How do I use the `Chat` tools? **Method 1: Ask a question** 1. Click the tool icon or press `Ctrl/Cmd + K` 2. Type your clinical question 3. Review the response 4. Insert it into the document (optional) **Method 2: Use selected text** 1. Highlight text in your document 2. Right-click or press `Ctrl/Cmd + Shift + A` 3. Choose an action (explain, expand, simplify) ### Can the `Chat` tools make clinical decisions for me? **No.** The tools provide information and suggestions, but they: - Do not replace clinical judgment - Should not be the sole basis for medical decisions - Can be wrong - Can help find relevant information and citations Verify critical information and use clinical judgment. ### How accurate are the `Chat` tools? Rosetta uses RAG over medical literature and guidelines, but results can still be wrong. - Verify critical information - Check citations - Use primary sources for high-stakes decisions ### How do I export a document? 1. Open the document 2. Click **"Export"** 3. Choose a format (`PDF`, `DOCX`, `HTML`, or plain text) 4. Select options (metadata, citations, etc.) 5. Click **"Download"** ### Can I share documents with colleagues? Real-time sharing is not available yet. You can: - Export and send through approved channels - Copy and paste into EMR systems - Print for handoff ## Privacy & Security ### Is my data secure? Yes. Rosetta uses: - **Encryption**: TLS 1.3 in transit and AES-256 at rest - **Access controls**: MFA and role-based permissions - **Audit logs**: Activity logging - **Compliance**: HIPAA-aligned infrastructure [Learn more about security](/apps/rosetta/docs/privacy) ### Is Rosetta HIPAA compliant? Rosetta is designed to meet HIPAA requirements and supports BAAs for institutional users. ### Does the system see patient information? The RAG pipeline is designed to limit PHI exposure: - Google Cloud DLP scans for PHI - Identifiers are removed before processing - Requests are de-identified before tool use [Learn more about privacy](/apps/rosetta/docs/privacy) ### What happens to my documents if I delete them? - Deleted documents -> Trash (recoverable for 30 days) - After 30 days -> Permanently deleted - Backups -> Removed within 90 days You can request immediate permanent deletion in account settings. ### Can Rosetta employees see my documents? Documents are encrypted. Staff access is limited to: - Explicit written consent for support - Valid legal process - Security incident investigation (de-identified when possible) ### Where is my data stored? Data is stored in HIPAA-aligned cloud infrastructure in the United States with encrypted backups in multiple regions. ## Technical Issues ### Rosetta isn't loading. What should I do? Try: 1. Refresh the page (`Ctrl/Cmd + R`) 2. Clear browser cache 3. Check your internet connection 4. Try a private/incognito window 5. Update your browser 6. Try another browser If the issue persists, contact support with error details. ### My document isn't saving. Help! Check: - Internet connection - Storage quota - Recent browser changes **Temporary fix** 1. Copy your text 2. Refresh the page 3. Create a new document 4. Paste content 5. Save manually (`Ctrl/Cmd + S`) ### I'm getting "Rate Limit Exceeded" errors. You have sent too many tool requests in a short period. Wait a few minutes and retry. Rate limits: - **Free tier**: 100 requests/hour - **Professional**: 1,000 requests/hour - **Enterprise**: 10,000 requests/hour ### The `Chat` tools aren't responding. Possible causes: - Tool service unavailable - Network issue - Restricted content Try: 1. Refresh the page 2. Rephrase the question 3. Check for PHI in the query 4. Retry in one minute ### Keyboard shortcuts aren't working. - Browser shortcuts may conflict - Extensions may intercept keys - OS shortcuts may take priority Check the [keyboard shortcuts reference](/apps/rosetta/docs/editor#keyboard-shortcuts-reference). ## Features & Functionality ### Can I use Rosetta offline? Not currently. Rosetta requires internet connectivity for: - `Chat` and retrieval tools - Auto-save and sync - PHI detection and protection Offline mode is planned. ### Can I customize templates? Yes. 1. Create a document with your preferred structure 2. Add placeholders for variable content 3. Save it as a template 4. Reuse it ### Does Rosetta integrate with my EMR? Direct EMR integration is planned. Current workflows: - Epic (copy/paste) - Cerner (copy/paste) - MEDITECH (plain text export) Planned integrations include NextGen and athenahealth. ### Can I use my own models? Not currently. Rosetta uses a curated RAG system for clinical use. Enterprise customization may be available later. ### Is there an API? Yes. Rosetta provides a REST API for: - Document management - Template access - Tool requests - Export workflows [View API documentation](/apps/rosetta/docs/api) ### Can I collaborate with teammates in real-time? Real-time collaboration is planned. Current workarounds: - Export and share documents - Use manual versioning - Merge changes across documents ## Billing & Account ### How do I upgrade my account? Account tiers and pricing will be announced before general release. Beta users currently have full access at no cost. ### How do I cancel my account? Contact support to request cancellation. Export your data first if needed. ### Can I get a refund? A refund policy will be published for paid tiers. Beta users are not charged. ### How do I update my billing information? Billing features will be available when paid tiers launch. ## Support ### How do I report a bug? Email [philip@philipshih.org](mailto:philip@philipshih.org) with: - A short description - Steps to reproduce - Browser and OS details - Screenshots (if relevant) ### How do I request a feature? Send feature requests to [philip@philipshih.org](mailto:philip@philipshih.org). ### Is there a user community? A user community forum is planned. In the meantime: - Email questions to support - Join the beta mailing list - Follow updates by email ### How do I contact support? - **Email**: [philip@philipshih.org](mailto:philip@philipshih.org) - **Response time**: Within 24 business hours - **Security issues**: Mark the subject as urgent --- **Didn't find your answer?** Contact Philip Shih: [philip@philipshih.org](mailto:philip@philipshih.org?subject=Rosetta%20Question) **Documentation** - [Getting Started](/apps/rosetta/docs/getting-started) - [Editor Features](/apps/rosetta/docs/editor) - [Privacy & Security](/apps/rosetta/docs/privacy) - [API Reference](/apps/rosetta/docs/api) ================================================================================ FILE: getting-started/first-document.mdx ================================================================================ --- title: First Document description: Use version history, right-click actions, and RAG while drafting. --- # First Document ## Version History (Version Control) ```mermaid flowchart LR A([Header]) --> B["Open version history"] B --> C["Review saved versions"] C --> D["Compare with current draft"] D --> E["Restore selected version"] ``` ## Right-Click Actions ```mermaid flowchart LR A([Editor]) --> B["Select text"] B --> C["Right-click"] C --> D["Choose action"] D --> E["Review suggestion"] E --> F["Accept or reject"] ``` ## RAG Workflow ```mermaid flowchart LR A([Chat]) --> B["Ask a clinical question"] B --> C["Sources retrieved by`Citations` agent"] C --> D["Review citations"] D --> E["Add desired content"] E --> F["Save or export"] ``` ## Review Tips - Validate diagnosis and plan language - Confirm no PHI in shared prompts - Keep citations for externally sourced claims ================================================================================ FILE: getting-started/index.mdx ================================================================================ # Getting Started Use this guide to sign in and create your first note. ## Prerequisites Before you begin: - **Access credentials**: Rosetta is in private beta. [Request access](mailto:philip@philipshih.org?subject=Rosetta%20Access%20Request) if needed. - **Modern browser**: Chrome, Firefox, Safari, or Edge - **Internet connection**: Rosetta runs in the browser ## First Time Setup ### 1. Configure Your Profile On first sign-in: - Set your **name** and **role** (for example, Physician, Nurse, Resident) - Choose your **specialty** for more relevant tool suggestions - Configure **notification preferences** ### 2. Understand the Interface Rosetta has three main areas: - **Header**: Templates, save, and export actions - **Editor**: Main text editing area - **Sidebar**: `Chat` tools, document history, and quick actions ## Basic Workflow ### Creating a New Note ```mermaid flowchart LR A([Header]) --> B["Create document"] B --> C([Templates]) C --> D["Choose template (optional)"] D --> E([Editor]) E --> F[Add content] F --> G([Tools]) G --> H["Use tools (optional)"] H --> I[Save or export] ``` ### Using Templates Templates help you create structured documents: ```mermaid flowchart LR A([Templates]) --> B["Browse templates"] B --> C[Load template] C --> D([Editor]) D --> E[Add content] ``` ### Using `Chat` `Chat` tools can help with clinical questions: ```mermaid flowchart LR A([Editor]) --> B["Select text (optional)"] B --> C([Chat]) C --> D["Ask a question"] D --> E[Review response] E --> F[Add content] ``` ## Keyboard Shortcuts | Shortcut | Action | |----------|--------| | `Ctrl/Cmd + S` | Save document | | `Ctrl/Cmd + N` | New document | | `Ctrl/Cmd + K` | Open `Chat` | | `/` | Command palette | | `Ctrl/Cmd + B` | Bold text | | `Ctrl/Cmd + I` | Italic text | ## Next Steps - [Editor](/apps/rosetta/docs/editor) - [Workflows](/apps/rosetta/docs/clinical-workflow) - [RAG](/apps/rosetta/docs/rag-system) - [Privacy](/apps/rosetta/docs/privacy) ## Help - [FAQ](/apps/rosetta/docs/faq) - [Contact](mailto:philip@philipshih.org) ================================================================================ FILE: getting-started/setup.mdx ================================================================================ --- title: Setup description: Initial account and environment setup. --- # Setup ## Checklist - [ ] Create account - [ ] Open workspace settings - [ ] Set defaults - [ ] Generate API key - [ ] Review privacy defaults ## Recommended Defaults - Enable autosave - Keep citation mode on for clinical responses - Use role-based workspace access ================================================================================ FILE: index.mdx ================================================================================ # Rosetta Rosetta is a text editing platform employing RAG tools specifically designed for accuracy in clinical reasoning, literature retrieval, and note editing tasks. ## Quick Links Editor RAG Workflows API --- ## Agents Rosetta comes preloaded with six agents that each assist with a different stage of the note drafting process. | Agent | Function | |-------|----------| | `Chat` | Classifies requests and routes them to the appropriate agent(s) | | `Shorthander` | Toggle shorthand formatting for the selected text (i.e., hx of -> history of) | | `Reformatter` | Regenerates the selected text in the requested format | | `Reasoner` | Generate a ranked differential and plan by problem for the selected text | | `Ingester` | Sort and format user-uploaded documents and raw data | | `Citations` | Search PubMed, Embase, Google Scholar for guidelines | --- ## Agent Orchestration Below is an example of a workflow you can configure in Rosetta. ```mermaid flowchart LR U[User query] --> C[Chat] subgraph Inline["Right Click Options"] direction TB SH[Shorthander] RE[Reasoner] CI[Citations] end C --> SH C --> RE C --> CI SH --> Q[Edit Queue] RE --> Q CI --> Q ``` ### Routing Examples | Query Pattern | Routed To | |---------------|-----------| | "expand this", "write up" | `Shorthander` | | "format as", "restructure" | `Reformatter` | | "differential for", "what could cause" | `Reasoner` | | "add source", "ingest this" | `Ingester` | | "cite", "find articles about" | `Citations` | --- ## Edit Review All agent-generated edits require approval before they are applied. Suggested changes will be shown through highlights of the impacted text in your editor. Edits that you approve are saved to your document's edit history, which you can then use to revert documents to previous states. ### Edit Types | Type | Visual | Description | |------|--------|-------------| | `Insert` | Green highlight | New text to add | | `Replace` | Yellow highlight | Modified existing text | | `Delete` | Red strikethrough | Text to remove | ### Keyboard Shortcuts | Key | Action | |-----|--------| | `Tab` | Accept current edit | | `Esc` | Reject current edit | | `Ctrl+Shift+A` | Accept all pending | | `Ctrl+Shift+X` | Reject all pending | ## Templates Templates in Rosetta represent reusable document structures with locked and editable regions. Templates can be edited through the Template manager, or by entering the Template Edit mode through double-clicking the templated text in your editor. ### Structure ```typescript interface Template { id: string; name: string; category: 'note' | 'form' | 'letter'; anchors: Anchor[]; fields: Field[]; } interface Anchor { label: string; locked: boolean; // agents cannot edit content: string; } interface Field { key: string; type: 'text' | 'select' | 'date'; options?: string[]; } ``` ### Built-in Templates | Template | Use Case | |----------|----------| | `H&P` | Initial evaluation | | `Progress Note` | Daily SOAP notes | | `Consult` | Specialty consultation | | `Discharge` | Hospital discharge summary | ================================================================================ FILE: privacy/dlp-redaction.mdx ================================================================================ --- title: DLP & Redaction description: PHI detection and de-identification workflow. --- # DLP & Redaction Rosetta uses Google Cloud DLP to detect potential PHI and de-identify content before tool processing. ## Common Detectors - personal identifiers (names, MRN, SSN) - dates and address-like values - contact and account identifiers - device and network identifiers ## Redaction Flow ```mermaid flowchart LR A[Scan user content] --> B[Flag PHI like spans] B --> C[Replace sensitive tokens] C --> D[Send de identified payload] ``` ## Example Input: > John Smith, MRN 123456, born 01/15/1960 Output: > [PERSON_NAME], MRN [MEDICAL_RECORD_NUMBER], born [DATE] ================================================================================ FILE: privacy/encryption.mdx ================================================================================ --- title: Encryption description: Data encryption standards at rest and in transit. --- # Encryption ## In Transit - TLS 1.2+ for client-server and service-service communication - HSTS and modern ciphers for transport hardening ## At Rest - encrypted storage at provider-managed and application-managed layers - key management with periodic rotation ## Operational Controls - strict secret handling practices - audited key access and least-privilege scopes ================================================================================ FILE: privacy/hipaa.mdx ================================================================================ --- title: HIPAA Compliance description: Administrative, physical, and technical safeguards. --- # HIPAA Compliance Rosetta is designed for HIPAA-aligned handling of PHI. ## Business Associate Agreement (BAA) For institutional usage, BAAs define: - responsibilities for PHI protection - permitted uses and disclosures - breach notification procedures - required security safeguards ## Security Rule Safeguards ### Administrative - security ownership and policy controls - workforce training and access governance - incident response and periodic risk assessment ### Physical - secure data center facility controls - workstation and device control practices ### Technical - role-based access and unique identities - audit logging and integrity protections - encrypted transmission controls ================================================================================ FILE: privacy/index.mdx ================================================================================ # Privacy & Security ## HIPAA Compliance Rosetta is designed to meet **Health Insurance Portability and Accountability Act (HIPAA)** requirements for protecting Protected Health Information (PHI). ### Business Associate Agreement (BAA) For institutional use, Rosetta enters into Business Associate Agreements (BAAs) that: - Define responsibilities for PHI protection - Specify permitted uses and disclosures - Require breach notification procedures - Mandate security safeguards - Include audit and termination provisions ### HIPAA Security Rule Compliance Rosetta implements the three types of safeguards required by HIPAA: #### 1. Administrative Safeguards - **Security Officer**: Designated individual responsible for security policies - **Workforce Training**: All personnel trained on HIPAA requirements - **Access Management**: Role-based access controls - **Incident Response**: Procedures for security incidents - **Risk Assessment**: Regular security risk analyses #### 2. Physical Safeguards - **Facility Access Controls**: Secure data center facilities - **Workstation Security**: Device encryption requirements - **Device Controls**: Mobile device management policies #### 3. Technical Safeguards - **Access Controls**: Unique user IDs, automatic logoff - **Audit Controls**: Comprehensive logging of system activity - **Integrity Controls**: Protect data from improper alteration - **Transmission Security**: End-to-end encryption ## Data Loss Prevention (DLP) ### Google Cloud DLP Integration Rosetta uses **Google Cloud Data Loss Prevention API** to automatically detect and protect PHI. #### What DLP Detects The system scans for and protects: **Personal Identifiers:** - Full names (first and last) - Social Security Numbers (SSNs) - Medical Record Numbers (MRNs) - Account numbers - Email addresses - Phone numbers **Dates:** - Dates of birth - Admission/discharge dates - Dates that could identify individuals **Locations:** - Street addresses - Zip codes (if < 20,000 population) - Geographic subdivisions **Other Identifiers:** - IP addresses - Device IDs - Biometric identifiers - License/certificate numbers #### How DLP Works ```mermaid graph LR A[User Types Text] --> B{Contains PHI?} B -->|No| C[Process Normally] B -->|Yes| D[Redact PHI] D --> E[Alert User] E --> F[Process Redacted Text] ``` **Real-time Protection:** 1. As you type, DLP scans content client-side 2. If PHI detected, visual warning appears 3. Before data leaves your device, PHI is redacted 4. Only de-identified data transmitted to tool systems 5. User notified of what was redacted **Example:** Input: > "John Smith, MRN 123456, born 01/15/1960" DLP Output: > "[PERSON_NAME], MRN [MEDICAL_RECORD_NUMBER], born [DATE]" User sees: > ⚠️ **PHI Detected and Protected**: Personal identifiers have been removed from this text. ### Automatic PHI Redaction For tool queries, PHI is automatically redacted: **Without Redaction (Unsafe):** > "What treatment for Maria Garcia, DOB 3/12/1985, with new diagnosis of Type 2 diabetes?" **With Redaction (Safe):** > "What treatment for a patient with new diagnosis of Type 2 diabetes?" Tools receive no patient-identifying information while still returning useful clinical guidance. ## Data Encryption ### In Transit All data transmitted between your device and Rosetta servers: - **TLS 1.3**: Modern encryption protocol - **Perfect Forward Secrecy**: Each session has unique keys - **Certificate Pinning**: Prevents man-in-the-middle attacks ### At Rest All stored data is encrypted: - **AES-256 Encryption**: Industry-standard encryption - **Key Management**: Secure key storage using cloud KMS - **Encrypted Backups**: All backups encrypted - **Database Encryption**: Transparent data encryption (TDE) ## Access Controls ### Authentication **Multi-Factor Authentication (MFA):** - Required for all users - Options: SMS, authenticator app, hardware key - Backup codes for account recovery **Password Requirements:** - Minimum 12 characters - Mix of uppercase, lowercase, numbers, symbols - Cannot reuse last 12 passwords - Expires every 90 days (configurable) ### Authorization **Role-Based Access Control (RBAC):** | Role | Permissions | |------|-------------| | **Viewer** | Read-only access to shared documents | | **Editor** | Create and edit own documents | | **Admin** | Manage users, templates, settings | | **Super Admin** | Full system access, security settings | **Principle of Least Privilege:** - Users granted minimum necessary access - Regular access reviews - Automatic deprovisioning of inactive accounts ### Session Management - **Session Timeout**: 30 minutes of inactivity (configurable) - **Concurrent Session Limits**: Prevent credential sharing - **Device Management**: Track and manage authorized devices - **Remote Logout**: Administrators can terminate sessions ## Audit Logging ### Comprehensive Activity Logs All system activity is logged: **User Actions:** - Login/logout events - Document creation, modification, deletion - Template usage - Tool query submissions - Export operations - Access to sensitive features **System Events:** - Failed authentication attempts - Permission changes - Configuration modifications - Backup operations - Security incidents ### Audit Log Properties - **Immutable**: Cannot be altered or deleted - **Timestamped**: Precise time of each event - **User Attribution**: Linked to specific user accounts - **Retained**: Stored for minimum 6 years (configurable) - **Searchable**: Query logs for investigations ### Audit Reports Available audit reports: - **Access Report**: Who accessed what, when - **Modification Report**: Document edit history - **Export Report**: What data was exported - **Failed Login Report**: Potential security threats - **PHI Detection Report**: DLP system activity ## Data Retention and Deletion ### Retention Policies **Active Documents:** - Retained as long as account is active - Accessible immediately - Backed up daily **Deleted Documents:** - Moved to "Trash" for 30 days - Recoverable during trash period - Permanently deleted after 30 days **Backups:** - Daily incremental backups - Weekly full backups - Retained for 90 days - Encrypted and geographically distributed ### Right to Deletion Users can request complete data deletion: 1. **Request Submitted**: Via account settings or email 2. **Verification**: Identity confirmation required 3. **Deletion Process**: All data removed within 30 days 4. **Confirmation**: Certificate of destruction provided 5. **Backups**: Removed from backup cycles (purged within 90 days) ### Data Portability Export your data in standard formats: - **Documents**: PDF, DOCX, HTML, plain text - **Metadata**: JSON format - **Activity Logs**: CSV export (own activity only) ## Breach Notification ### Incident Response Plan In the event of a security incident: **Phase 1: Detection & Containment (0-1 hour)** - Detect and verify incident - Contain to prevent further exposure - Preserve evidence for investigation **Phase 2: Assessment (1-24 hours)** - Determine scope of breach - Identify affected data and users - Assess risk to individuals **Phase 3: Notification (24-72 hours)** - Notify affected individuals - Report to covered entities (BAA partners) - Report to HHS if required (500+ individuals) - Notify media if required (states with >500 residents affected) **Phase 4: Remediation** - Implement fixes to prevent recurrence - Enhance security measures - Document lessons learned ### User Notification Affected users receive: - **Email Notification**: Details of incident - **Affected Data**: What information was exposed - **Actions Taken**: Steps to mitigate harm - **Recommendations**: What users should do - **Support**: Contact information for assistance ## Privacy by Design ### Minimal Data Collection Rosetta collects only necessary data: **Required Information:** - Name and email (authentication) - Role/specialty (relevant suggestions) - Usage data (improve service) **Not Collected:** - Patient information (unless you enter it) - Unnecessary personal data - Third-party analytics without consent ### De-identification Documents can be de-identified for: - Research purposes - Quality improvement - Training and education - System development **De-identification Process:** 1. Remove all 18 HIPAA identifiers 2. Statistical assessment of re-identification risk 3. Expert determination (if required) 4. Documentation of method used ### Data Segregation - **Tenant Isolation**: Each organization's data isolated - **No Cross-Organization Access**: Data never shared between organizations - **Separate Encryption Keys**: Unique keys per organization ## Compliance Certifications ### Current Certifications Rosetta maintains: - **HIPAA Compliance**: Regular assessments and audits - **SOC 2 Type II**: Independent security audit (in progress) - **HITRUST**: Healthcare security framework (planned) ### Regular Assessments - **Penetration Testing**: Annual third-party testing - **Vulnerability Scanning**: Weekly automated scans - **Security Audits**: Quarterly internal reviews - **Risk Assessments**: Annual comprehensive assessment ## User Responsibilities While Rosetta provides robust security, users must also: ### Do: - Use strong, unique passwords - Enable multi-factor authentication - Lock your workstation when away - Log out of shared computers - Report suspicious activity immediately - Keep software and browsers updated - Review access logs periodically ### Don't: - Share your login credentials - Use public Wi-Fi without VPN - Save passwords in browsers on shared computers - Take screenshots of PHI - Email or text login credentials - Leave devices unattended while logged in - Ignore security warnings ## Frequently Asked Questions ### Is Rosetta HIPAA compliant? Yes. Rosetta is designed to meet HIPAA Security and Privacy Rule requirements and will enter into Business Associate Agreements for institutional use. ### Where is my data stored? Data is stored in HIPAA-compliant cloud infrastructure in the United States with encrypted backups in multiple geographic regions for redundancy. ### Can Rosetta employees see my documents? No. Documents are encrypted, and Rosetta employees do not have access to user content except: - With explicit written consent for support purposes - As required by law enforcement with valid legal process - For security incident investigation (de-identified when possible) ### What happens if I forget my password? Use the password reset feature. For security, Rosetta cannot retrieve your password—Philip Shih can only assist with creating a new one. ### How do I report a security concern? Email philip@philipshih.org or use the "Report Security Issue" link in the app. All reports are taken seriously and investigated promptly. ### Can I use Rosetta on my personal device? Consult your institution's policies. If permitted: - Ensure device is password-protected - Keep operating system updated - Use Rosetta's automatic logout feature - Don't save documents locally --- **Questions about privacy or security?** Contact: [philip@philipshih.org](mailto:philip@philipshih.org?subject=Rosetta%20Security%20Question) **Next Steps:** - [Review API documentation →](/apps/rosetta/docs/api) - [Check out the FAQ →](/apps/rosetta/docs/faq) ================================================================================ FILE: rag-system/citations.mdx ================================================================================ --- title: Citations description: Citation generation and display behavior. --- # Citations Citations are attached to generated answers when evidence is available. ## Citation Payload ```json { "title": "IDSA/ATS CAP Guidelines (2019)", "url": "https://www.idsociety.org/...", "relevance_score": 0.98 } ``` ## Best Practices - Prefer primary literature - Keep source URLs stable - Surface confidence with each response ================================================================================ FILE: rag-system/index.mdx ================================================================================ # RAG Rosetta uses semantic retrieval to pull supporting material from notes, uploads, and medical databases. ## Architecture Text is embedded into vectors so retrieval can match meaning, not only keywords. Rosetta returns the closest passages from your available sources. ## Semantic vs Keyword **Keyword Search** (Traditional): ``` Query: "heart failure treatment" Matches: Exact text "heart failure" AND "treatment" Misses: "HFrEF management", "cardiac dysfunction therapy" ``` **Semantic Search** (Rosetta): ``` Query: "heart failure treatment" Matches: Any semantically similar concepts - "HFrEF management" - "cardiac dysfunction therapy" - "GDMT for reduced EF" ``` ## Source Types Rosetta organizes knowledge into two scopes: 1. **Local**: Sources specific to the current note and patient context. 2. **Account**: Guidelines, protocols, and papers in your library, available across notes. ## PubMed Integration Rosetta integrates with PubMed for evidence retrieval. - **Search**: Converts a request into PubMed search terms. - **Retrieval**: Fetches abstracts and metadata for top results. - **Ingestion**: Processes results into the RAG store for citation use. ## Usage Examples ### Evidence-Based Treatment (HFrEF) 1. Add a "GDMT" PDF to the Account library. 2. In a note, ask: "heart failure reduced ejection fraction treatment". 3. The system retrieves guidance on ACE-I/ARB, beta-blockers, and SGLT2i use. 4. The agent generates a plan with citations from the uploaded PDF. ### Literature Review (AFib) 1. The agent searches PubMed for "atrial fibrillation anticoagulation 2024". 2. It retrieves recent abstracts. 3. The agent generates a summary with current scoring criteria. ### Institutional Protocols 1. Upload a hospital sepsis protocol to the Account library. 2. Query: "UCSF sepsis bundle timing". 3. The agent returns the timing requirements from your protocol. --- **Next**: [Workflows](/apps/rosetta/docs/clinical-workflow) | [API](/apps/rosetta/docs/api) ================================================================================ FILE: rag-system/retrieval-pipeline.mdx ================================================================================ --- title: Retrieval Pipeline description: Embedding, indexing, and retrieval flow for RAG. --- # Retrieval Pipeline Rosetta's RAG system retrieves relevant evidence before response generation. ## Flow 1. Chunk source documents 2. Generate embeddings 3. Store vectors with metadata 4. Retrieve top-k matches 5. Re-rank and pass context to generation ## Retrieval Controls - Source filters - Date windows - Relevance thresholds