Modern AI Engineering

Lesson 12.8 · 27 min · video lesson

Cursor: Inside an AI-Native Code Editor

When we type in Cursor and a grey suggestion appears before we have finished thinking, or the agent edits five files in one go, what is actually happening behind the screen?

In short: Cursor is a code editor (built on VS Code) with AI woven into every part of it. It indexes our codebase into embeddings so it can find relevant code by meaning, uses a small fast model for Tab predictions, larger models for Chat and the Agent, and a specialised apply step that merges suggested edits into files quickly. Different jobs use different models because each job has a different trade-off between speed, cost and intelligence, and privacy settings control what is stored.

What you will learn

  • What is Cursor?
  • Cursor = Code Editor + AI
  • The big idea behind Cursor
  • How does Cursor understand our code?
  • How does Cursor index our codebase?
  • How does Tab autocomplete work?
  • How does the Chat work?
  • How does the Agent mode work?
  • How does Cursor apply the changes?
  • Why does Cursor use different models?
  • How does Cursor keep our code private?
  • The complete flow of Cursor

In this lesson

  1. What is Cursor? Code editor + AI
  2. The big idea behind Cursor
  3. How does Cursor understand our code?
  4. How does Cursor index our codebase?
  5. How does Tab autocomplete work?
  6. How do Chat and Agent mode work?
  7. How does Cursor apply the changes?
  8. Why different models, and how privacy works
  9. Worked example, step by step
  10. Practice: try it yourself
  11. The complete flow of Cursor

Key terms in this lesson

Fork
A new project built from a copy of another project's source code, here VS Code.
Codebase index
Embeddings of code chunks stored for semantic search over a project.
Merkle tree
A tree of hashes where each parent's hash is computed from its children's, so changes can be located quickly.
Tab (next-edit prediction)
Cursor's feature that predicts and suggests the next code edit as we type.
Apply model
A specialised model that merges a suggested code change into the full file.
Speculative edits
Speeding up file rewriting by using the original file as a draft that the model verifies in parallel.

This lesson is part of the Generative AI Engineering and Complete AI Engineer tracks. See plans and pricing to open the full lesson, its video, labs and quiz, or try the free lesson first (free account needed).

← 12.7 Claude Code: AI-Powered Software Engineering at the CLI · 13.1 LLM Inference Optimization: The Full Landscape →