Cursor Drive

March 5, 2026 · View on GitHub

Cursor Drive is a standalone Cursor IDE extension. There is no external backend. All logic runs in the VS Code extension host or in the .cursor/ Cursor plugin layer. No hh backend, no Discord, no shared core.

High-Level Architecture

┌─────────────────────────────────────────────────────────────────┐
│                        Cursor IDE                               │
│                                                                 │
│  ┌────────────────────────────────────────────────────────┐     │
│  │              VS Code Extension Host                    │     │
│  │                                                        │     │
│  │  beforeSubmitPrompt hook ──► Pipeline (when Drive active): │     │
│  │    fillerCleaner → promptOptimizer → router            │     │
│  │    → modelSelector → main model call                   │     │
│  │                                                        │     │
│  │  Status Bar   Agent Screen (S-AS) Webview   TTS Engine      │     │
│  │        ↑               ↑                        ↑           │     │
│  │        └───────── MCP Server :7891 ─────────────┘            │     │
│  │                         ↑                             │     │
│  │              (AI calls MCP tools)                     │     │
│  └────────────────────────────────────────────────────────┘     │
│                                                                 │
│  ┌────────────────────────────────────────────────────────┐     │
│  │              .cursor/ Plugin Layer                     │     │
│  │                                                        │     │
│  │  skills/drive-persona/SKILL.md  (AI reads at runtime)  │     │
│  │  rules/*.mdc                    (always applied)       │     │
│  │  commands/*.md                  (slash commands)       │     │
│  │  hooks/*.py                     (pre/post submit)      │     │
│  └────────────────────────────────────────────────────────┘     │
└─────────────────────────────────────────────────────────────────┘

Component Map

ComponentFile(s)Purpose
Entry pointsrc/extension.tsActivates extension, registers commands, starts MCP server
Drive statesrc/driveMode.tsactive + subMode, persisted to workspaceState
Status barsrc/statusBar.tsDrive > [Mode] | [OperatorName] live indicator
Drive togglesrc/statusBar.ts, src/driveMode.tsStatus bar + Ctrl+Shift+D; beforeSubmitPrompt routes when active
Intent routersrc/router.tsMaps prompt + subMode → plan/run/direct/collab
Model selectorsrc/modelSelector.ts3-tier cost selection: routing → planning → execution
Filler cleanersrc/fillerCleaner.tsClient-side filler word removal, free
Operator registrysrc/operatorRegistry.tsOperator pool: spawn, switch, merge, dismiss
Agent Screen (S-AS)src/agentScreen.tsWebviewPanel with activity feed, files, decisions
TTS enginesrc/tts.tsOS-native speech via say.js
MCP serversrc/mcpServer.tsLocal HTTP server on :7891; AI calls tools here
Approval gatessrc/approvalGates.tsPre/post scan for dangerous operations
Tool allowlistsrc/toolAllowlist.tsPer-operator permission enforcement
Session memorysrc/sessionMemory.tsPer-workspace context tracking
Glossary expandersrc/glossaryExpander.tsVoice shortcut → intent mapping
Sanitizersrc/sanitizer.tsPrompt truncation + injection stripping
Plugin installersrc/pluginInstaller.tsInstall plugin assets into .cursor/
API discoverysrc/apiDiscovery.tsCursor API surface discovery
Index (sandbox)src/index.tsSandbox/entry for experiments

Request Pipeline

User submits prompt (Drive active; beforeSubmitPrompt intercepts)


  /cancel guard ──────────────────────────────────► exit Drive


  Activation word parse ("drive", sub-mode)


  fillerCleaner.ts  (free, client-side)


  promptOptimizer.ts  (routing-tier model, conditional)
  ├── looksLikeDictation OR wasModified OR len > 120
  └── user approves via QuickPick


  approvalGates.ts  (pre-routing scan)


  router.ts  → RouteMode: plan | run | direct | collab


  modelSelector.ts  → routing | planning | execution tier


  Main model call with Drive persona system prompt


  responseFormatter.ts  (terse / normal / verbose)

       ├── stream.markdown() → chat panel
       └── tts_speak() via MCP → TTS engine

MCP Bridge

The local MCP server is the contract between "AI wants to update the UI" and "extension updates VS Code APIs." The AI does not call VS Code APIs directly.

AI calls MCP tool → mcpServer.ts handles → emits event → extension updates UI

MCP tools: tts_speak, tts_stop, agent_screen_activity, agent_screen_file, agent_screen_decision, drive_set_mode, operator_spawn, operator_switch, operator_list, operator_pause, operator_resume, operator_dismiss, operator_merge. Deprecated aliases: share_screen_*, agent_* (spawn/switch/list/dismiss/merge).

The MCP server URL is registered in .cursor/mcp.json:

{ "mcpServers": { "drive": { "url": "http://127.0.0.1:7891/mcp" } } }

Multi-Agent System

User: "tangent: research rate limiting"
  → AI calls operator_spawn({ task: "research rate limiting" })
  → OperatorRegistry creates Beta (background)
  → Alpha continues as foreground operator
  → Beta works asynchronously
  → Completion updates batched and delivered at natural pause
User: "show me beta" → operator_switch → Beta becomes foreground
User: "merge beta into alpha" → operator_merge → Alpha receives Beta's context

Plugin Layer

The .cursor/ directory is auto-discovered by Cursor and shapes AI behavior without extension code:

PathPurpose
.cursor/skills/drive-persona/SKILL.mdDrive persona, MCP tool usage, mode behaviors
.cursor/rules/drive-modes.mdcMode detection signals and behaviors
.cursor/rules/drive-concise.mdcConcise-first response pattern
.cursor/rules/policy-pack.mdcPrivacy, approval gates, testing, minimal-diff
.cursor/skills/switch/SKILL.md/switch <agent> slash command
.cursor/skills/tangent/SKILL.md/tangent <task> slash command
.cursor/skills/merge/SKILL.md/merge <source> into <target> slash command
.cursor/hooks/drive-preprocessor.pyPre-submit: filler detection, mode hints
.cursor/hooks/plan-runner.pyPre-submit: plan TODO reminders, registry sync

Architecture Decision Records

ADRDecision
ADR-0001Hybrid extension + plugin strategy (superseded by ADR-0009)
ADR-0002Why VS Code extension + .cursor/ plugin layer (not one or the other)
ADR-0003Why local MCP server as the AI-to-extension bridge
ADR-0004In-memory AgentRegistry with tangent keyword spawning
ADR-0005Privacy strict mode as default; debug opt-in only
ADR-0006Executable plans in .cursor/plans/ only
ADR-0007Drive mode installable distribution
ADR-0008Drive wraps Cursor native modes; beforeSubmitPrompt primary
ADR-0009Hook-based prompt interception
ADR-0010Tiered model routing
ADR-0011Native mode compatibility (1:1 mapping)
ADR-0012Voice input integration
ADR-0013Mode state management
ADR-0014Agent orchestration strategy
ADR-0015Senior engineer interaction model
ADR-0016Drive terminology: operators, Agent Screen (S-AS)
ADR-0017MCP Apps adoption strategy (proposed)
ADR-0018Cursor computer use posture (proposed)
ADR-0019Plugin and extension strategy (proposed)
ADR-0020Agent steering control plane (proposed)
ADR-0021Agent orchestration enhancement (proposed)
ADR-0022Mob programming cockpit — worktree isolation
ADR-0023SDK, protocol, framework adoption
ADR-0024Fork merge — drive-mode canonical

Security & Privacy

  • No raw audio retained
  • No transcript persistence unless debug mode enabled
  • Dangerous operations blocked/warned via approvalGates before execution
  • API keys stored in vscode.SecretStorage, never logged
  • Tool allowlist enforces per-agent permissions (readonly / standard / full)

Configuration

All settings are under cursorDrive.*. See PRD 4: Safety + Config for the canonical master config schema.