Skip to Content
Overview

Rosetta

Rosetta is an AI documentation assistant that uses Retrieval Augmented Generation (RAG) to help physicians create medical notes faster.


Architecture


Agents

Six specialized agents handle different tasks:

AgentFunction
ChatRoutes queries to specialized agents, manages conversation
ShorthanderExpands brief notes into full documentation
ReformatterRestructures content for specific formats
ReasonerProvides diagnostic reasoning and differentials
IngesterProcesses literature and creates summaries
CitationsFinds 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 PatternRouted 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

  1. User sends query via chat
  2. Chat agent classifies intent
  3. Query routed to specialized agent
  4. Agent generates edits with reasoning
  5. Edits sent to review queue

Edit Review

All AI modifications require user approval before applying to the document.

Edit Types

TypeVisualDescription
InsertGreen highlightNew text to add
ReplaceYellow highlightModified existing text
DeleteRed strikethroughText to remove

Review Flow

interface PendingEdit { id: string; type: 'insert' | 'replace' | 'delete'; start: number; end: number; original: string; replacement: string; reasoning: string; agent: AgentType; }
  1. Preview — Hover over highlighted text to see diff
  2. Reasoning — Each edit includes agent explanation
  3. Accept — Click checkmark or press Tab to apply
  4. Reject — Click X or press Esc to dismiss
  5. Bulk actions — Accept all or reject all from toolbar

Keyboard Shortcuts

KeyAction
TabAccept current edit
EscReject current edit
Ctrl+Shift+AAccept all pending
Ctrl+Shift+XReject all pending

Agent Rules

Each agent follows strict rules when modifying content:

Shorthander Rules

  1. Preserve anchors — Never modify locked template regions
  2. Expand only — Add detail, never remove user content
  3. Medical accuracy — Use standard terminology
  4. Context aware — Reference RAG sources when available

Ingester Rules

  1. Chunk size — Split documents into 512 token segments
  2. Metadata — Preserve source, date, and citation info
  3. Dedup — Skip documents already in vector store
  4. Rate limit — Max 3 PubMed requests per second

Reasoner Rules

  1. Evidence first — Cite sources for all claims
  2. Differential format — List by probability
  3. No diagnosis — Suggest, never conclude
  4. 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

TemplateUse Case
H&PInitial evaluation
Progress NoteDaily SOAP notes
ConsultSpecialty consultation
DischargeHospital discharge summary

Template Rules

  1. Anchor integrity — AI preserves all locked sections
  2. Field validation — Required fields must be filled
  3. Inheritance — Templates can extend base templates
  4. Versioning — Changes create new versions, not overwrites

Stack

LayerTechnologies
FrontendReact 19, Vite, TypeScript, Lexical 0.39
AI@langchain/google-genai, Vercel AI SDK
StorageFirestore, Firebase Auth, localStorage

Note: Runs entirely in browser. No backend server required.

Last updated on