Ignoring files
Control which files Bob Shell can access by creating a `.bobignore` file in your project.
Overview
| Feature | Description | Benefit |
|---|---|---|
| Path exclusion | Prevent Bob Shell from accessing specific files or directories | Protect sensitive information |
| Pattern matching | Use glob patterns to match multiple files | Efficiently exclude file types |
| Negation support | Override exclusions for specific files | Fine-grained control |
| Project-specific | Each project can have its own exclusion rules | Customized to project needs |
Why use .bobignore?
- Privacy protection: Keep sensitive files like API keys and credentials private
- Performance improvement: Exclude large binary files or directories that slow down operations
- Noise reduction: Remove irrelevant files from Bob Shell's context
- Focus control: Direct Bob Shell's attention to the most relevant parts of your codebase
How .bobignore works
.bobignore controls which files Bob Shell's file tools can access. If a file matches an ignored pattern, Bob Shell's file tools cannot read, write, or delete it, and the file is excluded from list and search results. Shell commands run through execute_command are not filtered by .bobignore; a shell command can still read or modify files anywhere the operating system permits.
When you add paths to your .bobignore file, Bob Shell tools that respect this file will automatically exclude matching files and directories from their operations. For example, read_file, grep, glob, and list_files skip matching paths, and file write tools cannot modify them.
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ │ │ │ │ │
│ Your project │────▶│ .bobignore │────▶│ Files Bob Shell │
│ files │ │ filter │ │ can access │
│ │ │ │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘Bob Shell re-reads your .bobignore file automatically, so changes take effect within about 30 seconds without restarting.
Pattern syntax
The .bobignore file follows the same pattern syntax as .gitignore:
| Pattern | Description | Example |
|---|---|---|
file.txt | Matches a specific file | apikeys.txt |
*.ext | Matches all files with the extension | *.log |
/dir/ | Matches a directory | /node_modules/ |
/path/to/file | Anchors the path to the root | /src/config/secrets.json |
!pattern | Negates a previous pattern | !important.md |
# | Comment line | # API credentials |
Getting started
Creating a .bobignore file
- Create a file named
.bobignorein the root of your project directory - Add patterns for files and directories you want to exclude
- Save the file. Changes take effect within about 30 seconds.
# From your project root
touch .bobignore
echo "# Files to ignore" > .bobignore
echo "secrets/" >> .bobignoreCommon exclusion patterns
Here are some common patterns you might want to add to your .bobignore file:
# Sensitive information
.env
secrets/
*password*
*credential*
*apikey*
# Large directories
node_modules/
.git/
dist/
build/
# Binary and media files
*.zip
*.tar.gz
*.mp4
*.jpg
*.png
# Log files
*.log
logs/Pattern examples
Excluding specific directories
To exclude entire directories and their contents:
# Exclude the packages directory and all its contents
/packages/
# Exclude all node_modules directories anywhere in the project
**/node_modules/
# Exclude the dist directory but only at the root level
/dist/Using wildcards
Wildcards let you match multiple files with similar patterns:
# Exclude all markdown files
*.md
# Exclude all JavaScript files in the src directory
/src/**/*.js
# Exclude all files with "test" in their name
*test*Using negation
You can override exclusions for specific files:
# Exclude all markdown files
*.md
# But include README.md
!README.md
# And include all markdown files in the docs directory
!docs/*.mdAdvanced usage
Combining patterns
You can create sophisticated exclusion rules by combining patterns:
# Exclude all JavaScript files
*.js
# But include all files in the src directory
!src/**/*.js
# Except for test files in the src directory
src/**/*.test.jsDebugging your .bobignore file
If Bob Shell seems to be ignoring files you want it to access, or accessing files you want it to ignore:
- Check your
.bobignorefile for conflicting patterns - Remember that more specific patterns (like negations) should come after general patterns
- Wait about 30 seconds after making changes for them to take effect
- Write patterns relative to the directory that contains the
.bobignorefile, as in.gitignore
Best practices
- Start simple: Begin with a few essential patterns and add more as needed
- Comment your patterns: Add comments to explain why certain files are excluded
- Be specific: Use precise patterns to avoid accidentally excluding important files
- Consider security: Always exclude files containing sensitive information
- Maintain regularly: Update your
.bobignorefile as your project evolves
Custom modes
You can create custom modes to tailor Bob's behavior to specific tasks or workflows. Custom modes in Bob Shell work similarly to Bob IDE modes.
Telemetry data
Learn about the telemetry data Bob Shell can collect, how it's used to improve the product, and how to enable or disable data collection.