Cursor Documentation
  1. Context
Cursor Documentation
  • Get Started
    • Introduction
    • Installation
    • FAQ
  • Guides
    • Editor Migration
      • Migrate from VS Code
      • Migrate from JetBrains IDEs
    • Languages & Frameworks
      • JavaScript & TypeScript
      • iOS & macOS (Swift)
      • Java
  • Editor
    • AI Commit Message
    • Notepads (Beta)
    • Keyboard Shortcuts
    • Tab
      • Overview
      • Tab vs GitHub Copilot
      • Auto-import
      • Advanced Features
    • Chat
      • Overview
      • Agent mode
      • Ask mode
      • Custom modes
      • Tools
      • Apply
    • ⌘K
      • Overview
      • Terminal Cmd K
  • Context
    • Codebase Indexing
    • Rules for AI
    • Ignore Files
    • Model Context Protocol
    • @ Symbols
      • Overview
      • @Files
      • @Folders
      • @Code
      • @Docs
      • @Git
      • @Web
      • @Definitions
      • @Link
      • @Lint Errors
      • @Lint Errors
      • @Recent Changes
      • @Cursor Rules
      • @Notepads
      • @Summarized Composers
      • #Files
      • /command
  • Account
    • Plans & Usage
    • Dashboard
    • Billing
    • Business
      • Get Started
      • Members + Roles
      • Analytics
      • SSO
  • Settings
    • Models
    • Custom API Keys
    • Early Access Program
  • Troubleshooting
    • Common Issues
    • Troubleshooting Guide
    • Getting a Request ID
  1. Context

Ignore Files

Ignore Files#

Learn how to use .cursorignore and .cursorindexingignore to control file access and indexing in Cursor

Overview#

Cursor provides two different ignore files to control how files are handled:
.cursorignore: Makes a best-effort attempt to exclude files from both AI features and indexing
.cursorindexingignore: Controls only which files are indexed for search and context (same as the old .cursorignore)
As of 0.46, .cursorignore attempts to exclude files from both AI access and indexing (similar to the previously unreleased .cursorban). For indexing-only control like the old .cursorignore, use .cursorindexingignore.

.cursorignore#

The .cursorignore is best-effort, meaning we do not guarantee that files in it are blocked from being sent up. We may have bugs that allow ignored files to be sent up in certain cases. Please let us know if you find bugs like that and we will do our best to fix!
The .cursorignore file makes a best-effort attempt to exclude files from both AI features and indexing. This is useful for:
Attempting to exclude sensitive files from AI access and indexing
Excluding configuration files with secrets
Limiting access to proprietary code
Files listed in .cursorignore will be excluded from Cursor’s AI features in a best-effort way:
Not included in tab and chat requests
Not included in context for AI features
Not indexed for search or context features
Not available through @-symbols or other context tools

.cursorindexingignore#

.cursorindexingignore files automatically inherits all patterns from your .gitignore files
The .cursorindexingignore file only controls which files are indexed for search and context features. This provides the same indexing control as the old .cursorignore. Use this file when you want to:
Exclude large generated files from indexing
Skip indexing of binary files
Control which parts of your codebase are searchable
Optimize indexing performance
Important: Files in .cursorindexingignore can still be manually included as context or accessed by AI features - they just won’t be automatically indexed or included in search results.
Default Indexing Ignore Files

File Format#

Both files use the same syntax as .gitignore. Here are some examples:

Basic Patterns#

# Ignore all files in the `dist` directory
dist/

# Ignore all `.log` files
*.log

# Ignore specific file `config.json`
config.json

Advanced Patterns#

Include only *.py files in the app directory:
# ignore everything
*
# do not ignore app
!app/
# do not ignore directories inside app
!app/*/
!app/**/*/
# don't ignore python files
!*.py

Troubleshooting#

The ignore file syntax follows .gitignore exactly. If you encounter issues:
1.
Replace “cursorignore” with “gitignore” in your search queries
2.
Check Stack Overflow for similar patterns
3.
Test patterns with git check-ignore -v [file] to understand matching
Common gotchas:
Patterns are matched relative to the ignore file location
Later patterns override earlier ones
Directory patterns need a trailing slash
Negation patterns (!) must negate a previous pattern
Modified at 2025-03-26 08:58:05
Previous
Rules for AI
Next
Model Context Protocol
Built with