Rapid-Review Cram Sheet: Agentic Coding Editors
Night-before, scannable. Synthesizes sections 01–16. Glossary → flashcards → numbers/names → punch list.
Glossary (45+ terms, one line each) ¶
- Rope — balanced tree buffer, O(log n) edits + cheap immutable snapshots; Zed, CodeMirror 6.
- Piece table / piece tree — append-only buffers + ordered spans, text never moves, near-free undo; VS Code.
- Gap buffer — movable empty gap at cursor, O(1) local typing; classic Emacs.
- Virtualized rendering — only build/draw the ~60 visible lines + overscan, regardless of file size.
- Glyph atlas — texture of pre-rendered characters; GPU editors (Zed/GPUI) emit textured quads each frame.
- Extension Host — VS Code's out-of-process sandbox for extensions; async-only API over IPC.
- WorkspaceEdit — VS Code's transactional, multi-file, single-undo edit primitive.
- LSP — Language Server Protocol; JSON-RPC over stdio, collapses M×N language-feature work to M+N.
- Tree-sitter — in-process incremental GLR parser, sub-ms reparse, ERROR-node recovery, concrete syntax trees.
- CST vs AST — concrete keeps every token/comment/bracket; abstract drops them.
- Diagnostics — LSP errors/warnings fed back as the agent's primary act-observe signal (the compiler is the reward).
- SCIP / LSIF — precomputed server-side code-intelligence index for cross-repo nav at scale (Sourcegraph).
- stack-graphs — GitHub's precise code navigation engine on github.com.
- PSI — JetBrains' bespoke Program Structure Interface; deep semantic engine instead of LSP.
- RAG for code — retrieve relevant snippets, stuff into context before generation.
- Chunking (AST-aware) — split files on function/class boundaries (Tree-sitter) vs naive fixed-window.
- Embedding — text→dense vector (256–3072 dims); code-tuned models beat generic text ones.
- HNSW — Hierarchical Navigable Small World graph; ~O(log N) ANN search, 95–99% recall.
- IVF-PQ — inverted file + product quantization; memory-efficient ANN at scale (FAISS).
- BM25 — TF-IDF-family sparse/lexical ranking; nails exact identifiers embeddings miss.
- RRF — Reciprocal Rank Fusion; combines dense+sparse rankings, score = Σ 1/(k+rank), k≈60.
- Cross-encoder reranker — jointly scores (query,chunk); accurate but slow, so used only on top-100.
- Merkle tree sync — hash files up to a root; re-embed only changed subtrees (Cursor; same as Git/Dropbox).
- HyDE — embed a hypothetical answer instead of the question, since answer-shaped text sits near real code.
- Lost-in-the-middle — U-shaped attention; models attend best to prompt start/end (Liu et al. 2023).
- FIM — Fill-in-the-Middle; condition on prefix AND suffix via sentinel tokens (
<fim_prefix/suffix/middle>). - PSM / SPM — FIM layouts; SPM (suffix-first) maximizes KV-cache reuse since prefix changes most.
- Neighboring tabs — Copilot's trick of pulling snippets from open tabs, ranked by Jaccard overlap.
- Contextual filter — Copilot's separate lightweight classifier deciding whether to show a suggestion.
- Next-edit prediction — Cursor Tab predicts the next diff + cursor jump, not just caret text.
- ReAct — Reason+Act loop (Yao 2022): think → tool call → observe → repeat.
- Agent loop —
whileloop around a chat model: system prompt + tool defs + history → tool call → execute → append. - tool_use / tool_result — linked structured blocks (by
tool_use_id) for a call and its returned observation. - Sub-agent — fresh loop with own context window for a scoped task; returns a condensed result (context isolation).
- Thin harness vs heavy scaffolding — trust-the-model (Claude Code) vs orchestrated phases; "bitter lesson" favors thin.
- Constrained decoding — per-token logit masking to a grammar; guarantees syntactic (not semantic) validity. (Outlines, XGrammar, GBNF).
- Apply model — small specialized model that materializes a lazy sketch into a full file (Cursor Fast Apply, ~1000 tok/s).
- Search/replace block — content-anchored edit needing a unique match (Aider SEARCH/REPLACE, Claude
str_replace). - Lazy edit — frontier model emits only changed regions with
// ... existing code ...placeholders. - Myers diff — O(ND) shortest-edit-script via LCS; Git default. Histogram/patience = faster, more readable hunks.
- Three-way merge — base (agent read) + ours (disk now) + theirs (agent result); reconciles concurrent edits.
- Prompt/KV caching — reuse KV tensors for identical prefix; ~10% input cost (Anthropic), 50–80% TTFT cut.
- Prefill vs decode — prefill = parallel, compute-bound, sets TTFT; decode = sequential, memory-bandwidth-bound, sets tok/s.
- KV cache — stored per-token keys/values; grows linearly, lives in HBM, caps batch size & throughput.
- PagedAttention — vLLM's OS-style paging of KV cache; ~4% waste + prefix sharing → 2–4× throughput.
- Continuous batching — token-level scheduling; evict finished / admit new requests each step.
- Speculative decoding — draft proposes k tokens, target verifies in one pass; 2–3× faster, identical distribution. (Medusa, EAGLE, prompt-lookup).
- Model routing — tiny model for completions/apply, mid-tier for easy chat, frontier for hard reasoning.
- PTY — pseudo-terminal (node-pty/ConPTY) so CLIs behave as if attached to a TTY; output must be ANSI-stripped.
- ACI — agent-computer interface; tool design + output formatting matter as much as the model (SWE-agent).
- Firecracker — Rust microVM, ~125ms boot, separate kernel; gold standard for multi-tenant untrusted code.
- seccomp / Landlock / Seatbelt — OS-level syscall/filesystem sandboxing, lighter than containers.
- MCP — Model Context Protocol (Anthropic, Nov 2024); "USB-C for AI," JSON-RPC, turns M×N tools into M+N.
- MCP host/client/server — app+LLM / 1:1 connector / capability provider; tools=model, resources=app, prompts=user.
- Sampling / roots / elicitation — server→host: borrow the LLM / scope dirs / ask user for structured input.
- Lethal trifecta — private data + untrusted content + exfiltration ability; remove any one leg to kill the attack.
- Prompt injection — direct or indirect (hidden in files/web/tool output); model can't separate instructions from data.
- Tool poisoning — malicious instructions hidden in a tool's description (model reads it); "rug pull" = changed after install.
- SWE-bench Verified — 500 human-validated real GitHub issues; binary resolve via FAIL_TO_PASS + PASS_TO_PASS.
- pass@k — P(≥1 of k samples correct); report pass@1 for real feel. Resolve rate, acceptance rate + retention.
- LLM-as-judge — grade open-ended output with a strong model; beware position/verbosity/self-preference bias.
- RLEF / RLVR — RL from execution feedback / verifiable rewards: run tests, reward passing. GRPO is modern algo.
- Distillation — train small student to mimic frontier teacher (logit/soft or sequence/hard); how Tab feels smart at 80ms.
- DPO — Direct Preference Optimization on (preferred, rejected) pairs; no separate reward model.
- Data flywheel — accept/reject/edit telemetry → training data → better model → more usage; the structural moat.
35 Flashcards ¶
Q: What's the hard latency invariant of the editor core? A: Keystroke→paint stays under one frame (~16.7ms @ 60Hz); nothing on that path may do I/O, call a model, or run unbounded CPU.
Q: Why does a flat string fail as a buffer? A: Inserting at position n is O(n) — every later byte shifts. Ropes/piece tables make edits O(log n), independent of file size.
Q: Fork VS Code or build an extension? A: Fork when differentiation is the editing surface (Cursor inline apply); extension when it's the model/backend and reach matters (Copilot).
Q: Why run extensions/language servers out-of-process? A: Responsiveness (can't block typing), stability (crash isolation), and forced async-over-IPC API discipline.
Q: Tree-sitter vs LSP — when does each fire? A: Tree-sitter: in-process, every keystroke, syntactic, tolerates broken code. LSP: out-of-process, project-wide, semantic, slower.
Q: How does an agent use LSP beyond highlighting? A: Go-to-def/references/workspace-symbol as exact retrieval tools, Tree-sitter for function-boundary chunking, and diagnostics as the feedback loop.
Q: Why not paste the whole repo now that windows are 1M tokens? A: Scale (repos are 10M+ tokens), cost (per-token billing every turn), and quality (lost-in-the-middle degrades long contexts).
Q: Fixed-window vs AST-aware chunking? A: AST (Tree-sitter) cuts on function/class boundaries so each chunk is coherent; fixed-window slices signatures from bodies.
Q: Explain hybrid retrieval. A: Dense embeddings (semantic) + sparse BM25/grep (exact identifiers), fused with RRF, then cross-encoder rerank top-100→top-10.
Q: How does incremental re-indexing avoid re-embedding everything? A: Merkle tree over the filesystem — compare roots, only differing subtrees contain changed files. O(changes), not O(repo).
Q: Cursor's privacy model for indexing? A: Embed server-side but store only vectors + obfuscated paths; client reads actual file contents locally to assemble context.
Q: Why can't a chat model do inline autocomplete? A: Code is edited bidirectionally; the model must condition on suffix too (FIM). Chat models are also too slow for ~150–300ms.
Q: What does the contextual filter do and why separate? A: A lightweight classifier decides whether to show a suggestion; a bad suggestion is worse than none and tanks acceptance rate.
Q: How is Cursor Tab different from Copilot ghost text? A: It predicts the next edit (diffs, deletions) anywhere nearby plus a cursor jump, conditioned on recent edit history.
Q: One iteration of an agent loop? A: Build request (system + tools + history) → model emits tool_use → harness executes → append tool_result → call model again.
Q: Why does an agent run get expensive, and the #1 fix? A: Whole history is resent every turn → ~quadratic token growth. Prompt caching of the stable prefix cuts cost 5–10×.
Q: Thin harness vs heavy scaffolding — which and why? A: Default thin (Claude Code) for frontier models — improves free with each upgrade ("bitter lesson"); scaffold surgically where evals show failures.
Q: Why are tool error messages part of the contract? A: No human in the loop each turn; a good error ("not found, 3 near-misses, line numbers") lets the model self-correct next turn.
Q: Why must edit tools be content-anchored and idempotent? A: Calls can be duplicated and views go stale; a line-number edit applied twice corrupts, a search/replace just no-matches (fails loud).
Q: Constrained decoding guarantees what? A: Syntactic validity only (valid JSON, required fields) via per-token logit masking — NOT semantic correctness of values.
Q: Why don't editors emit unified diffs from the model? A: Models botch the hunk-header arithmetic (@@ -41,7 +41,9 @@); appliers survive by ignoring line numbers and fuzzy-matching context.
Q: Explain the lazy-edit + fast-apply two-model split. A: Frontier model writes intent cheaply (// ... existing code ...); small apply model materializes the full file — division by cost/skill.
Q: Why does speculative decoding work so well for apply? A: Output ≈ input file, so you draft tokens straight from the original; acceptance is huge → ~1000 tok/s, ~10× speedup.
Q: The unique-match requirement? A: SEARCH/old_str must match exactly one location; zero = can't locate, multiple = ambiguous corruption. Forces disambiguating anchor context.
Q: Prompt assembly order? A: System prompt → project rules (CLAUDE.md/.cursorrules) → retrieved chunks → open/attached files → @-mentions → history → current message.
Q: Why structure prompts prefix-first? A: Caching is exact-prefix; first differing byte invalidates everything after. Stable content first, volatile last. @-mentions are highest signal.
Q: Prefill vs decode bottlenecks? A: Prefill = parallel, compute/FLOP-bound, sets TTFT. Decode = sequential, memory-bandwidth-bound (stream weights+KV per token), sets tok/s.
Q: What does PagedAttention buy you? A: OS-style paging of the KV cache → ~4% waste (vs 60–80%) + copy-on-write prefix sharing → 2–4× throughput. From vLLM.
Q: Why a server-side proxy even in privacy mode? A: API-key safety, model routing, prompt caching, rate limiting, telemetry, hosting custom models. Privacy = zero-retention, not "code never leaves."
Q: How do you reconcile a file changed under the agent? A: Detect via hash/document-version; three-way merge (base=agent read, ours=disk, theirs=agent result); search/replace fails loud, never clobbers.
Q: Why a PTY not pipes? A: CLIs change behavior on a TTY (color, progress, prompts) and may hang on stdin; PTY makes tools behave normally. Cost: ANSI noise to strip.
Q: State the lethal trifecta and the highest-leverage defense. A: Private data + untrusted content + exfiltration ability. Best single control: egress restriction (deny-by-default network) — kills leg 3.
Q: MCP primitives and who controls them? A: tools = model-controlled (actions/POST), resources = app-controlled (read-only/GET), prompts = user-controlled (templates/slash commands).
Q: Why is SWE-bench Verified better than HumanEval? A: Real issues + real repos needing multi-file nav/tools/passing tests; HumanEval is single-function, saturated (90%+), and contaminated.
Q: Fine-tune vs prompt vs retrieve? A: Fine-tune for form/latency, retrieve for facts, prompt for everything you can — fine-tune last (costliest to maintain).
Numbers & Names to Drop ¶
Latency targets: frame budget 16.7ms@60Hz / 6.9ms@144Hz · LSP completion <100ms · autocomplete debounce 25–75ms, end-to-end sub-300ms (best ~150ms) · chat first token ~1–2s · apply <1–2s · agent steps seconds, runs minutes · Firecracker boot ~125ms.
Inference / cost: frontier ~$2.5–3/MTok input, $10–15 output; top reasoning tier up to 15/75; small tier 0.10–1/MTok · cached input ~10% (Anthropic, TTL ~5min), ~50% (OpenAI, auto ≥1024 tokens) · cache cuts TTFT 50–80% and agent cost 5–10× · output tokens 3–5× input price · speculative decoding 2–3× decode (Cursor apply ~1000 tok/s) · PagedAttention 2–4× throughput.
Context windows: GPT-4o ~128K · Claude 200K (1M beta) · Gemini up to 1M+ · DeepSeek-V3 128K · 1M-line repo ≈ 10–15M tokens · ~4 chars/token · compaction trigger ~70–85% fill · tool-result caps ~250 lines/~25K chars.
Retrieval: chunks 200–800 tokens, 10–20% overlap · embedding dims 256–3072 · HNSW ~O(log N), 95–99% recall · RRF k≈60 · ANN top-100 → rerank → top-10 · Tree-sitter ~40+ grammars, sub-ms reparse.
Agents: 5–20 tools (keep <~15–20) · turn caps ~25–50 · multi-agent ~15× token cost (Anthropic) · FIM training rate ~50–90%.
Benchmarks: SWE-bench (~2,294 instances, 12 Python repos) · SWE-bench Verified (500 human-validated, frontier ~60–75% in 2025) · SWE-bench Lite (300) · Aider polyglot (225 Exercism, 6 langs) · HumanEval (164), MBPP (~974) · RepoBench, LiveCodeBench, SWE-rebench (contamination-resistant).
Exit codes: 0 success · 124 timeout · 137 SIGKILL/OOM · 130 Ctrl-C.
Real products/models: Cursor (Fast Apply, Tab, Turbopuffer), Copilot (Codex lineage, neighboring tabs), Zed (GPUI, Zeta, Rust), JetBrains (PSI, local full-line, Mellum/Junie), Sourcegraph Cody (SCIP/LSIF, Cody Gateway), Aider (SEARCH/REPLACE, polyglot leaderboard), Claude Code (str_replace, TodoWrite, thin harness), Windsurf/Codeium (Cascade, Supercomplete), Continue (BYO-model). FIM models: StarCoder2, CodeLlama, DeepSeek-Coder, CodeGemma, Qwen2.5-Coder, Codestral. Serving: vLLM, SGLang (RadixAttention), TensorRT-LLM, TGI. Embeddings: voyage-code-3, text-embedding-3. Algos: Myers (1986), GRPO, DPO, PPO, EAGLE, Medusa.
People/papers: FIM "for-free" (Bavarian et al., OpenAI 2022) · ReAct (Yao et al. 2022) · lost-in-the-middle (Liu et al. 2023) · lethal trifecta (Simon Willison) · "the agent is a while-loop" · Max Brunsfeld (Tree-sitter, Zed).
If You Remember Nothing Else (20-item punch list) ¶
- The keystroke→paint loop stays under one frame; everything slow (AI, LSP, search) is async and off-thread.
- Buffers are ropes or piece tables for O(log n) edits — never a flat string.
- Fork = control the editing surface; extension = reach + model/backend differentiation.
- LSP turns code into a queryable graph (M×N→M+N); Tree-sitter is fast syntactic eyes, LSP is slow semantic brain.
- Diagnostics fed back are the agent's reward signal — the compiler is how it self-corrects.
- Retrieval beats stuffing: hybrid (dense+BM25) → RRF → cross-encoder rerank; Merkle sync re-embeds only changed files.
- FIM (prefix + suffix via sentinels) is what makes autocomplete possible; chat models can't infill.
- Acceptance rate (+ retention) is autocomplete's north star and training signal; a separate filter decides whether to show.
- The agent loop is a
whileloop: the model emits tool calls, the harness executes them, results feed back. - Action space and observation format matter as much as the model — same model, better tools = +15 SWE-bench points.
- Tool errors are teaching signals; edits must be content-anchored, idempotent, and truncate huge output.
- Apply = lazy sketch (frontier) + fast-apply model (small) sped by speculative decoding; the diff is the trust surface.
- Lost-in-the-middle: authoritative content front, decisive question/file last; sandwich the ask.
- Prompt caching needs a frozen prefix — stable first, volatile last, never inject churn early (5–10× cost lever).
- Prefill is compute-bound (TTFT), decode is memory-bandwidth-bound (tok/s); PagedAttention + continuous batching = throughput.
- Speculative decoding is a free lunch: 2–3× faster, identical output distribution; near-instant for apply/FIM.
- Route models: tiny for the hot path (completions/apply), frontier for the hard tail — or the economics collapse.
- Reconcile concurrent edits with a three-way merge; fail loudly rather than apply wrongly; checkpoints = whole-task undo.
- Lethal trifecta = private data + untrusted content + exfiltration; remove one leg (egress restriction is highest-leverage); never auto-run bash on untrusted input.
- MCP = USB-C for tools (host/client/server, JSON-RPC); SWE-bench Verified is the agentic benchmark; fine-tune for form, retrieve for facts, prompt for the rest.