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.

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

Was this page helpful?