Overview
Cursor is an AI-powered code editor built on VS Code that operates on the AI Flow paradigm. It features both chat-based assistance and an autonomous agent mode powered by GPT-4.1 that can independently work through coding tasks.Available Prompt Versions
- Agent Prompt 2.0
- Chat Prompt
The primary agent system prompt used for autonomous coding tasks.When to Use Codebase Search:Important Notes:When to Use Todo List:
Key Capabilities
Autonomous Operation- Agent mode that works independently until tasks are resolved
- Keeps going until user’s query is completely resolved before ending turn
- Does not wait for user confirmation unless additional information is needed
- Receives automatic context including open files, cursor position, recently viewed files
- Edit history and linter errors included in context
- System reminders provided in tool results
Core Tools
- Explore unfamiliar codebases
- Ask “how/where/what” questions
- Find code by meaning, not exact text
- Exact text matches (use
grep) - Reading known files (use
read_file) - Simple symbol lookups
- Finding files by name
Command Execution
- Commands may need user approval
- Shell state persists between commands
- Use non-interactive flags (e.g.,
--yesfor npx) - Run long-running processes in background
Task Management
- Complex multi-step tasks (3+ steps)
- Non-trivial tasks requiring planning
- User provides multiple tasks
- After receiving new instructions
- Single straightforward tasks
- Trivial tasks with < 3 steps
- Purely conversational requests
Additional Tools
delete_file: Delete files safelyweb_search: Search the web for real-time informationupdate_memory: Create/update/delete persistent memoriesread_lints: Read linter errors from workspaceedit_notebook: Edit Jupyter notebook cellslist_dir: List directory contentsglob_file_search: Search files by glob pattern
Agent vs Chat Mode
| Feature | Agent Mode | Chat Mode |
|---|---|---|
| Autonomy | Fully autonomous | Interactive |
| Execution | Directly applies edits | Suggests changes |
| Task completion | Works until resolved | Waits for confirmation |
| Best for | Complex multi-step tasks | Quick questions, guidance |
Code Editing Approach
Edit Instructions
Cursor’s edit system uses an “apply model” - a less intelligent model that applies edits based on instructions:- Use
// ... existing code ...for unchanged sections - Provide sufficient context around edits
- Clear, single-sentence instructions
- Never specify unchanged code explicitly
Search Strategy
Semantic Search Workflow
- Start Broad: Begin with exploratory queries using empty
target_directories: [] - Review Results: Identify relevant directories or files
- Narrow Down: Rerun search scoped to specific directories
- Break Down: Split large questions into smaller focused queries
When to Use Each Search Tool
Codebase Search (Semantic)- “How does X work?”
- “What happens when Y?”
- “Where is Z handled?”
- Exploring unfamiliar code
- Finding exact symbols:
AuthService - Finding patterns:
function\s+\w+ - File type filtering:
--glob "*.ts" - Line number results with context
- Finding files by name
- Glob patterns:
*.config.js
Memory System
Cursor maintains persistent knowledge about preferences and context:- User explicitly asks to remember something
- Important preferences discovered
- Patterns in user’s requests
- Without user request for simple facts
- Contradictory information (use delete instead)
Model Information
- Base Model: GPT-4.1
- Knowledge Cutoff: 2024-06
- Image Input: Enabled
- Context: Includes open files, cursor position, recent edits, linter errors
Best Practices
For Complex Tasks
- Use agent mode for multi-step tasks
- Start with
codebase_searchto understand context - Create todo list for tracking (3+ steps)
- Read files before editing
- Run linter after edits
- Mark todos complete as you go
For Code Changes
- Gather context first
- Use clear, specific instructions
- Include sufficient surrounding context
- Use
// ... existing code ...properly - Run tests after changes
- Check linter errors with
read_lints
For Debugging
- Use
codebase_searchto understand flow - Use
grepto find all references - Read files with context (use
-A,-B,-Cflags) - Check git history if needed
- Test changes locally before committing