NEW: Claude Code Security — research preview →

Mental Models & Architecture

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

Read time: 10 min

title: "Mental Models & Architecture" description: "Understand how Cursor IDE thinks — tools, models, rules/skills/hooks, and context indexing." section: "Full Guide" readTime: "10 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
TabTabInline, multi-lineBoilerplate, repetitive patterns, next-edit jumps
Inline EditCmd/Ctrl+KSelectionRefactor a function, rename, small fixes
AgentCmd/Ctrl+I or Cmd/Ctrl+LMulti-fileLarge refactors, migrations, architectural changes
Plan ModeShift+TabPlanningComplex features, unclear requirements
Debug ModeMode pickerAnyElusive bugs, race conditions, runtime issues
Worktrees / Parallel Agents/worktree, /best-of-nGit worktreesExplore multiple approaches simultaneously
Cloud AgentsAgent input dropdown, cursor.com/agentsRemote VMLong tasks that shouldn't tie up your machine
BrowserAgent toolWeb UITesting UI, screenshots, console and network checks

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

Cursor merged the old Chat and Composer panels into a single Agent panel in version 0.46. "Composer" is now the name of Cursor's own coding model. The Agent panel has several modes:

  • Agent — autonomous: file edits, search, terminal commands
  • Ask — read-only Q&A and exploration
  • Plan — research, clarifying questions, and an editable plan before building
  • Debug — hypothesize, instrument with logs, reproduce, fix

Switch with the mode picker, or rotate with Shift+Tab.

How Cursor Actually Works

Cursor is an orchestration layer, not a single LLM:

  • Three parts drive the agent: instructions (system prompt and rules), tools, and the model you pick
  • Models are stateless between requests, so conversation history and rules are sent each time
  • Context management matters: garbage in, garbage out
  • Connects to external systems via MCP (Model Context Protocol)
  • Checkpoints are taken before significant changes so you can restore files

Model Selection Guide

Cursor's model list changes often. Check cursor.com/docs/models for what's current. Models fall into two pools: Cursor models (Composer, Grok) and Other models (Anthropic, OpenAI, Google, and more, billed at API rates).

PhaseExample choiceWhy
Planning / analysisA frontier reasoning model (e.g., Claude Opus 5.5, GPT-5.5)Deeper reasoning
Multi-file executionComposer 2.5Cursor's own model, tuned for agentic coding
Large-context reviewGemini 3.1 ProLarge context window
Not sureAutoRoutes each request for cost, balance, or intelligence

Workflow: Plan with a reasoning model in Plan Mode, then build with a faster model such as Composer. See the model comparison for trade-offs.

Guidance System: Rules, Skills, Hooks

TypeLocationPurposeAlways Active?
Rules.cursor/rules/*.mdc, AGENTS.mdStanding project constraints and contextPer rule type (always, by glob, by description, manual)
Skills.cursor/skills/<name>/SKILL.mdReusable workflowsAgent applies when relevant, or /skill-name
Hooks.cursor/hooks.jsonScripts at agent lifecycle eventsYes, when configured

Decision framework:

  1. Must this always hold, or explain project context? → Rule (e.g., "never use any types", "why we chose Fastify")
  2. Is this a reusable workflow? → Skill (e.g., TDD test-fix loop)
  3. Must something be enforced or automated by a script? → Hook (e.g., format after every edit)

Codebase Search and Indexing

Cursor builds a local index for fast search, and the agent also uses semantic search to find relevant code. Cursor says it does not upload file paths or code to build the search index, but when the agent opens a file, that content can be included in the model request.

  • Cursor ignores everything in .gitignore plus a built-in list (lock files, .env*, node_modules/, binaries, media)
  • Add a .cursorignore to block Cursor (Agent, Tab, Inline Edit, @ mentions) from specific files. It is not a hard guarantee: terminal and MCP tools can't enforce it
  • Narrower scope means more focused context, so open the subfolder you actually work in for very large repos

MCP (Model Context Protocol)

Connect Cursor to external live systems via .cursor/mcp.json (project) or ~/.cursor/mcp.json (global):

  • Custom servers — GitHub, databases, Slack, docs, and more
  • Cursor asks for approval before running MCP tools by default
  • Install official plugins from the Cursor Marketplace under Customize

Context7 vs documentation guessing: Context7 is a third-party MCP server (@upstash/context7-mcp) that serves version-specific library docs. Add it to mcp.json yourself. It helps when a library updates often or you need a specific version.