Rosetta
Rosetta is an AI documentation assistant that uses Retrieval Augmented Generation (RAG) to help physicians create medical notes faster.
Quick Links
Token based document model with Lexical
EditorVector search with Gemini embeddings
RAGState, templates, and data flow
WorkflowsREST endpoints and SDK
APIArchitecture
Agents
Six specialized agents handle different tasks:
| Agent | Function |
|---|---|
| Chat | Routes queries to specialized agents, manages conversation |
| Shorthander | Expands brief notes into full documentation |
| Reformatter | Restructures content for specific formats |
| Reasoner | Provides diagnostic reasoning and differentials |
| Ingester | Processes literature and creates summaries |
| Citations | Finds and formats PubMed citations |
Agent Orchestration
The Chat agent acts as the router. It analyzes user queries and delegates to the appropriate specialized agent.
┌──────────────┐
│ Chat │ ◀── User query
└──────┬───────┘
│
▼
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ Shorthander │ │ Reasoner │ │ Citations │
└──────────────┘ └──────────────┘ └──────────────┘
│ │ │
└────────────────────┴────────────────────┘
│
▼
┌──────────────┐
│ Edit Queue │
└──────────────┘Routing Logic
| 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 |
Response Flow
- User sends query via chat
- Chat agent classifies intent
- Query routed to specialized agent
- Agent generates edits with reasoning
- Edits sent to review queue
Edit Review
All AI modifications require user approval before applying to the document.
Edit Types
| Type | Visual | Description |
|---|---|---|
| Insert | Green highlight | New text to add |
| Replace | Yellow highlight | Modified existing text |
| Delete | Red strikethrough | Text to remove |
Review Flow
interface PendingEdit {
id: string;
type: 'insert' | 'replace' | 'delete';
start: number;
end: number;
original: string;
replacement: string;
reasoning: string;
agent: AgentType;
}- Preview — Hover over highlighted text to see diff
- Reasoning — Each edit includes agent explanation
- Accept — Click checkmark or press
Tabto apply - Reject — Click X or press
Escto dismiss - Bulk actions — Accept all or reject all from toolbar
Keyboard Shortcuts
| Key | Action |
|---|---|
Tab | Accept current edit |
Esc | Reject current edit |
Ctrl+Shift+A | Accept all pending |
Ctrl+Shift+X | Reject all pending |
Agent Rules
Each agent follows strict rules when modifying content:
Shorthander Rules
- Preserve anchors — Never modify locked template regions
- Expand only — Add detail, never remove user content
- Medical accuracy — Use standard terminology
- Context aware — Reference RAG sources when available
Ingester Rules
- Chunk size — Split documents into 512 token segments
- Metadata — Preserve source, date, and citation info
- Dedup — Skip documents already in vector store
- Rate limit — Max 3 PubMed requests per second
Reasoner Rules
- Evidence first — Cite sources for all claims
- Differential format — List by probability
- No diagnosis — Suggest, never conclude
- Red flags — Always surface critical findings
Templates
Templates define reusable document structures with locked and editable regions.
Structure
interface Template {
id: string;
name: string;
category: 'note' | 'form' | 'letter';
anchors: Anchor[];
fields: Field[];
}
interface Anchor {
label: string;
locked: boolean; // AI 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 |
Template Rules
- Anchor integrity — AI preserves all locked sections
- Field validation — Required fields must be filled
- Inheritance — Templates can extend base templates
- Versioning — Changes create new versions, not overwrites
Stack
| Layer | Technologies |
|---|---|
| Frontend | React 19, Vite, TypeScript, Lexical 0.39 |
| AI | @langchain/google-genai, Vercel AI SDK |
| Storage | Firestore, Firebase Auth, localStorage |
Note: Runs entirely in browser. No backend server required.
Last updated on