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 →
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
| Mode | Context | Model | Latency target |
|---|---|---|---|
| Ghost-text autocomplete | Text before/after cursor, title, outline | Small, fast model | < 300–500ms, cancel on keystroke |
| Selection commands | Selected text + surrounding paragraphs + style guide | Mid model, streamed | First token < 1s |
| Generate section | Outline, headings, related docs | Strong model | Streamed, seconds OK |
| Ask about doc / workspace | RAG over doc chunks + permitted workspace docs | Strong model | Streamed |
Key engineering problems
- Context budgeting: long documents need the outline + nearby sections + retrieved relevant sections, not the whole document every time.
- 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.
- Debounce and cancel autocomplete requests on typing; cache recent completions.
- Permissions: workspace retrieval must respect document ACLs.
- Tone / brand: per-workspace style guides injected as instructions.
- 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.
Related
Every expert started right here.