ChatCLI supports a file exclusion system inspired by .gitignore. This allows you to refine the context sent to the AI, avoiding irrelevant files such as tests, logs, dependencies, and builds.
Why filter files?
The .chatignore file
The syntax is identical to .gitignore:
- Lines starting with
# are comments
- To ignore an entire directory, add the name followed by
/ (e.g., docs/)
- Use glob patterns (wildcards) to ignore files (e.g.,
*_test.go, *.log)
Practical example
Precedence hierarchy
ChatCLI searches for an ignore file in a specific order. The first one found is used and the rest are ignored:
Example with environment variable
Rules are not merged. Only the first ignore file found in the hierarchy is used. If you set CHATCLI_IGNORE, the project and global directory .chatignore files will be ignored.
Default rules
When no .chatignore file is found, ChatCLI uses built-in rules that already automatically ignore:
.git/
node_modules/
vendor/
__pycache__/
.idea/, .vscode/
- Binary and compiled files
Usage tips
- Create a
.chatignore at the root of each project for specific rules
- Use the global
~/.chatcli/.chatignore for universal rules (e.g., .DS_Store, Thumbs.db)
- Combine with
@file --mode smart so the AI selects only the most relevant files within the already filtered scope