NEW: Claude Code Security — research preview

Mental Models & Architecture

Understand how Cursor IDE thinks — tools, models, rules/skills/hooks, and context indexing.

Read time: 12 min

title: "Mental Models & Architecture" description: "Understand how Cursor IDE thinks — tools, models, rules/skills/hooks, and context indexing." section: "Full Guide" readTime: "12 min"

Mental Models & Architecture

Before diving into Cursor, understand how it thinks. This mental model unlocks everything else.

The Tool Selection Matrix

ToolShortcutScopeWhen to Use
TabTabSingle tokenBoilerplate, repetitive patterns, known APIs (~320ms)
Inline EditCmd/Ctrl+KSingle fileRefactor a function, rename, small fixes
Composer / AgentCmd/Ctrl+IMulti-fileLarge refactors, migrations, architectural changes
ChatCmd/Ctrl+LConversationalQ&A, planning, cross-cutting queries
Debug ModeAgent submenuAnyElusive bugs, race conditions, runtime issues
Parallel AgentsAgent panelGit worktreesExplore multiple approaches simultaneously
Visual EditorRight-click elementBrowserUI work, real-time CSS editing

Thumb rule: Tab for speed, Inline for precision, Agent for correctness.

Chat has three sub-modes:

  • Ask — read-only Q&A and planning
  • Edit — apply changes directly to files
  • Agent — autonomous: file creation, search, terminal commands

How Cursor Actually Works

Cursor is an orchestration layer, not a monolithic LLM:

  • No memory between completions — full history is fed each request
  • Tools run client-side (Cursor orchestrates, the LLM just calls them)
  • Context window management is critical — garbage in, garbage out
  • Connects to external systems via MCP (Model Context Protocol)

Model Selection Guide (2026)

PhaseRecommended ModelWhy
Planning / analysisClaude 4.5 SonnetDeep reasoning, 200k ctx
Multi-file executionCursor Composer 14x faster, optimized for edits
Full codebase reviewGemini 3 Pro1M token context
Fast iterationGPT-5.1 Codex MaxCode-optimized, 272k ctx

Workflow: Sonnet to plan → Composer 1 to execute → Gemini 3 Pro to review.

The Three-Tier Guidance System

TypeLocationPurposeAlways Active?
Rules.cursor/rules/*.mdNon-negotiable constraintsYes (enforced)
Skills.cursor/skills/*/SKILL.mdOptional reusable workflowsConditional
Instructionsinstructions.md (root)Project context & backgroundYes (informational)

Three-question decision framework:

  1. Must this always hold? → Rule (e.g., "never use any types")
  2. Is this a reusable workflow? → Skill (e.g., TDD test-fix loop)
  3. Does this explain context or intent? → Instructions (e.g., "why we chose Fastify")

Codebase Indexing

Cursor embeds your code into a vector DB (Turbopuffer):

  • ~8,000 lines max context per request
  • Embeddings use obfuscated paths — your code never leaves your machine
  • Incremental updates via Merkle Tree every 10 minutes
  • Clean index = ~30% faster responses — configure .cursorignore well

When @codebase is triggered: query embedding computed locally → vector search → client reads local files → sent to LLM.

MCP (Model Context Protocol)

Connect Cursor to external live systems via .cursor/mcp.json:

  • Context7 (built-in, no setup) — live version-specific docs for 10,000+ libraries
  • Custom servers — Google Drive, Slack, GitHub, PostgreSQL, Kubernetes
  • 40 tool limit per session; execution is client-side (secure)

Context7 beats @Docs when: a library updates frequently, you need a specific version (e.g., React Query v5.62.0), or training data is over 6 months old.

Watch for the 🔧 tool indicator to confirm Context7 was invoked. Ask the agent to cite a version number — if it shows the exact recent version, Context7 was used.