Reference

Ignore file

View as Markdown
On the other surface

.cursorignore and .cursorindexingignore are Agents Window features. The Terminal UI has no equivalent and does not read either file; see the Terminal UI settings reference for the settings it does read.

Grok Build reads your project's codebase to power its features. Control which directories and files Grok Build can access using a .cursorignore file in your root directory.

Grok Build blocks access to files listed in .cursorignore from:

The terminal and MCP server tools used by Agent cannot block access to code governed by .cursorignore

Why ignore files?

Security: Restrict access to API keys, credentials, and secrets. While Grok Build blocks ignored files, complete protection isn't guaranteed due to LLM unpredictability.

Performance: In large codebases or monorepos, exclude irrelevant portions for more accurate file discovery.

Configuring .cursorignore

Create a .cursorignore file in your root directory using .gitignore syntax.

Pattern syntax

  • * matches any characters except /
  • ** matches any characters including /
  • ? matches a single character
  • ! negates a pattern (un-ignores a previously ignored path)
  • Lines starting with # are comments
  • Trailing spaces are ignored unless escaped with \

Pattern examples

Bash

config.json      # Specific file
dist/           # Directory
*.log           # File extension
**/logs         # Nested directories
!app/           # Exclude from ignore (negate)

Hierarchical ignore

Enable Grok Build Settings > Indexing > Ignore Files > Hierarchical .cursorignore to search parent directories for .cursorignore files.

Global ignore files

Set ignore patterns for all projects in user settings to exclude sensitive files without per-project configuration. The global ignore list is empty by default.

Common patterns to add:

  • Environment files: **/.env, **/.env.*
  • Credentials: **/credentials.json, **/secrets.json
  • Keys: **/*.key, **/*.pem, **/id_rsa

Files ignored by default

Grok Build automatically ignores files in .gitignore and the default ignore list below. Override with ! prefix in .cursorignore.

Default ignore list

These files are ignored in addition to files in your .gitignore and .cursorignore:

Bash

package-lock.json
pnpm-lock.yaml
yarn.lock
composer.lock
Gemfile.lock
bun.lockb
.env*
.git/
.svn/
.hg/
*.lock
*.bak
*.tmp
*.bin
*.exe
*.dll
*.so
*.lockb
*.qwoff
*.isl
*.csv
*.pdf
*.doc
*.doc
*.xls
*.xlsx
*.ppt
*.pptx
*.odt
*.ods
*.odp
*.odg
*.odf
*.sxw
*.sxc
*.sxi
*.sxd
*.sdc
*.jpg
*.jpeg
*.png
*.gif
*.bmp
*.tif
*.mp3
*.wav
*.wma
*.ogg
*.flac
*.aac
*.mp4
*.mov
*.wmv
*.flv
*.avi
*.zip
*.tar
*.gz
*.7z
*.rar
*.tgz
*.dmg
*.iso
*.cue
*.mdf
*.mds
*.vcd
*.toast
*.img
*.apk
*.msi
*.cab
*.tar.gz
*.tar.xz
*.tar.bz2
*.tar.lzma
*.tar.Z
*.tar.sz
*.lzma
*.ttf
*.otf
*.pak
*.woff
*.woff2
*.eot
*.webp
*.vsix
*.rmeta
*.rlib
*.parquet
*.svg
.egg-info/
.venv/
node_modules/
__pycache__/
.next/
.nuxt/
.cache/
.sass-cache/
.gradle/
.DS_Store/
.ipynb_checkpoints/
.pytest_cache/
.mypy_cache/
.tox/
.git/
.hg/
.svn/
.bzr/
.lock-wscript/
.Python/
.jupyter/
.history/
.yarn/
.yarn-cache/
.eslintcache/
.parcel-cache/
.cache-loader/
.nyc_output/
.node_repl_history/
.pnp.js/
.pnp/

Negation pattern limitations

When using negation patterns (prefixed with !), you cannot re-include a file if a parent directory is excluded via *.

Bash

# Ignore all files in public folder
public/*

# This works, as the file exists at the top level
!public/index.html

# This doesn't work - cannot re-include files from nested directories
!public/assets/style.css

Workaround: Explicitly exclude nested directories:

Bash

public/assets/*
!public/assets/style.css # This file is now accessible

Excluded directories are not traversed for performance, so patterns on contained files have no effect. This matches the .gitignore implementation for negation patterns in nested directories. For more details, see the official Git documentation on gitignore patterns.

Troubleshooting

Test patterns with git check-ignore -v [file].


Last updated: November 23, 2026