Agentic Editor · Study Guide

Building an Agentic Coding Editor (Cursor-style): The Complete Study Guide

Interview prep, subsystem by subsystem. ~77,000 words across 21 docs. Goal: read it aloud, internalize the mechanisms, and walk into a system-design / deep-dive interview able to explain how a Cursor-like editor actually works — and how you'd build one.

Everything resolves to three pressures: latency (typing must never wait on a model), economics (the median request must be cheap), and trust (a probabilistic actor with shell access must never silently wreck your repo). Every design choice below is a different answer to those three.


How to read this (start here)

  1. Read 90-overview-architecture.md first. It gives you the whole machine in one sitting: the architecture map, the keystroke-to-result flow for all 3 modes, and "the 10 ideas that explain everything." If you only have one hour, read this twice.
  2. Then read the 16 subsystem sections (01–16) in order. Each is self-contained and ends with Interview Talking Points + Likely Interview Q&A (with model answers).
  3. Then the capstones: 91 (design-it-from-scratch interview), 93 (mega Q&A bank), 94 (gaps + curveballs the sections don't cover).
  4. The night before: read 92-cheatsheet-flashcards.md only. Glossary + 35 flashcards + numbers/names to drop.

File map

The mental model

  • 90-overview-architecture.md — READ FIRST. Architecture map, 3-mode data flow, the 10 load-bearing ideas.

The 16 subsystems (each ends with talking points + Q&A)

# File What it covers
01 01-editor-core.md Buffer data structures (rope/piece tree), render loop, VS Code multi-process model, fork-vs-extension
02 02-language-intelligence.md LSP (semantic, project-wide) + Tree-sitter (syntactic, instant); diagnostics as agent feedback
03 03-indexing-retrieval.md RAG for code: AST chunking, embeddings, HNSW, BM25 hybrid, Merkle sync, reranking, agentic search
04 04-autocomplete-tab.md Fill-in-the-Middle, ghost text, contextual filter model, Cursor Tab = next-edit prediction
05 05-agent-loop.md The while loop: ReAct think-act-observe, planning, guards, thin-harness vs scaffolding
06 06-tool-use.md Function-calling contract, designing good tools, error-messages-as-teaching, parallel calls
07 07-apply-model.md Turning intent into byte-precise edits: lazy sketch → fast merge model, search/replace, diffs
08 08-context-management.md Prompt assembly order, lost-in-the-middle, KV/prompt caching, compression, stuff-vs-retrieve
09 09-inference-infra.md Prefill vs decode, KV cache, PagedAttention, continuous batching, speculative decoding, routing
10 10-diff-merge-vcs.md Myers/histogram diff, 3-way merge, checkpoints/undo, per-hunk review, git/PR, worktrees
11 11-execution-sandbox.md PTY/terminal capture, allowlists/approval, containers/microVMs, background & remote agents
12 12-mcp.md Model Context Protocol: hosts/clients/servers, transports, tools/resources/prompts, security
13 13-safety-permissions.md Permission modes, prompt injection, the lethal trifecta, privacy mode, secret redaction
14 14-evaluation.md SWE-bench (Verified), pass@k, acceptance rate, offline vs online, LLM-as-judge, regression suites
15 15-model-training.md SFT, FIM objective, the apply model, RL-from-execution-feedback, distillation, the data flywheel
16 16-system-design.md Backend view: client ↔︎ proxy ↔︎ providers/index/apply/exec; why a proxy exists even in privacy mode

Capstones

  • 91-system-design-interview.md — "Design Cursor from scratch" 45-min walkthrough: clarifying Qs, requirements, components, deep dives, scaling, MVP→v2→v3, what strong vs weak answers sound like.
  • 92-cheatsheet-flashcards.md — Night-before cram sheet: 45+ term glossary, 35 flashcards, "numbers & names to drop," 20-item "if you remember nothing else."
  • 93-qa-bank.md — Mega Q&A bank: best questions from every section + 25 new cross-cutting ones, grouped by theme (incl. behavioral / "why-did-they-build-it-this-way").
  • 94-gaps-and-curveballs.md — Critic pass: accuracy corrections, coverage gaps with primers (monorepo scale, observability, on-device, cost modeling, eval contamination, agent memory, multimodal), and 15 curveball questions with answers.

Suggested 2–3 day plan

Day 1 — Build the mental model + foundations.

  • 90 overview (twice). Then 01 core, 02 language-intel, 03 indexing, 04 autocomplete.
  • Test yourself: explain "what happens when I hit Tab" end-to-end out loud.

Day 2 — The agent half.

  • 05 agent loop, 06 tools, 07 apply, 08 context, 09 inference, 12 MCP.
  • Test yourself: explain "what happens when I tell the agent 'fix this failing test'" end-to-end.

Day 3 — Safety, eval, training, and the interview drill.

  • 10 diff/vcs, 11 exec/sandbox, 13 safety, 14 eval, 15 training, 16 system design.
  • Then 91 design-from-scratch, 93 Q&A bank (answer out loud before reading the model answer), 94 curveballs.
  • Final pass: 92 cheat sheet.

The 5 stories you must be able to tell cold

  1. Keystroke → Tab completion. Debounce → FIM prompt (prefix/suffix + neighbor tabs) → tiny model + speculative decoding → contextual filter → ghost text → accept event feeds the flywheel. (04, 09)
  2. Question → chat answer + edit. Retrieval (hybrid + rerank) → context assembly (stable prefix for cache, question last) → frontier model over SSE → apply model materializes the edit → diff review. (03, 08, 07, 10)
  3. Goal → autonomous agent run. The while loop: system prompt + tools + history → tool call → harness executes (read/grep/edit/run) → observe (diagnostics, exit code) → self-correct → permission gate + checkpoint each step → bounded by budgets. (05, 06, 11, 13)
  4. Intent → byte-precise edit. Why not full-file rewrite or line-number diffs; lazy sketch + small fast merge model + unique-match search/replace + parse-validate + retry. (07)
  5. "Is it good?" → eval. SWE-bench Verified gates merges; acceptance rate + retention + A/B gate launches; the gap between "scores well" and "feels good" is the whole game. (14)
Built from Markdown · 22 pages · Read it aloud and burn it in.