About .cursorignore

To ignore files from being included in codebase indexing, you can use a .cursorignore file in the root of your project. It works the same way as .gitignore works for git.

.cursorignore respects .gitignore. If you already have .gitignore, the files will be ignored by default. If you want to ignore additional files, you can add them to the .cursorignore file.

You can read more about how this works on our security page.

Chat and Composer Context

Currently, Cursor Chat and Composer have access to all files in their context, regardless of .cursorignore settings.

More info on how we handle AI request can be found on our security page.

Example .cursorignore files

Ignore specific files

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

# Ignore all `.log` files
*.log

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

Only include specific files

Include only *.py files in the app directory. Note that this is the same syntax as .gitignore.

# 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 is sometimes a bit confusing. The .cursorignore file follows the exact same syntax as .gitignore, so if you are trying an ignore file and it doesn’t work the way you expect it to, we recommend a Google search for the issue, replacing cursorignore in your search query with gitignore. Probably someone will have had the same issue and StackOverflow will have a good answer.

One common example: here is how you ignore all files except those with a .php extension (just adding * followed by !*.php does not work because the gitignore file discoverer will not descend into and discover any .php files in subdirectories).