Dashboard
0%
1
Curious builder0 XP earned · 300 to level 2
0 daysFinish a lesson to begin
Badge collection0 of 6 unlocked
51 small wins to finish your pathNext question →

Q30IntermediateSystem design

Design an AI writing assistant embedded in a document editor (like a "copilot" in Google Docs or Notion).

30-second answerSay your answer out loud first, then reveal.

Interaction modes and design

ModeContextModelLatency target
Ghost-text autocompleteText before/after cursor, title, outlineSmall, fast model< 300–500ms, cancel on keystroke
Selection commandsSelected text + surrounding paragraphs + style guideMid model, streamedFirst token < 1s
Generate sectionOutline, headings, related docsStrong modelStreamed, seconds OK
Ask about doc / workspaceRAG over doc chunks + permitted workspace docsStrong modelStreamed

Key engineering problems

  1. Context budgeting: long documents need the outline + nearby sections + retrieved relevant sections, not the whole document every time.
  2. Edit application: the model returns a replacement for a range. Show a diff and accept/reject. Handle concurrent edits (CRDT/OT collaborative editors): anchor suggestions to stable positions, and rebase if the text changed.
  3. Debounce and cancel autocomplete requests on typing; cache recent completions.
  4. Permissions: workspace retrieval must respect document ACLs.
  5. Tone / brand: per-workspace style guides injected as instructions.
  6. Privacy: enterprise customers may require no training on their data and regional processing.

Metrics: acceptance rate per mode, edits after acceptance, feature retention, latency percentiles, cost per active user.

Every expert started right here.