Ignoring files
Control which files Bob can access by creating a `.bobignore` file in your project.
What is .bobignore?
- Purpose: To protect sensitive information, prevent accidental changes to build artifacts or large assets, and generally define Bob's operational scope within your workspace.
- How to use: Create a file named
.bobignorein the directory of your workspace. List patterns in this file to tell Bob which files and directories to ignore.
Bob actively monitors the .bobignore file. Any changes you make are reloaded automatically, ensuring Bob always uses the most current rules. The .bobignore file itself is always implicitly ignored, so Bob cannot change its own access rules.
Pattern syntax
The syntax for .bobignore is identical to .gitignore. Here are common examples:
| Example | Description |
|---|---|
node_modules/ | Ignores the entire node_modules directory |
*.log | Ignores all files ending in .log |
config/secrets.json | Ignores a specific file |
!important.log | An exception; Bob will not ignore this specific file, even if a broader pattern like *.log exists |
build/ | Ignores the build directory |
docs/**/*.md | Ignores all Markdown files in the docs directory and its subdirectories |
To learn about syntax, refer to the official Git documentation on .gitignore.
How Bob tools interact with .bobignore
.bobignore rules are enforced across various Bob tools:
Strict enforcement (reads & writes)
These tools directly check .bobignore before any file operation. If a file is ignored, the operation is blocked:
read_file: Will not read ignored files.write_to_file: Will not write to or create new ignored files.apply_diff: Will not apply diffs to ignored files.list_code_definition_names: Will not parse ignored files for code symbols.
File editing tools (potential write bypass)
The insert_content and search_and_replace tools use an internal component for managing changes.
Important: Currently, the final write operation performed by these tools might bypass .bobignore rules. While initial read attempts might be blocked, the save action itself does not have an explicit check.
File discovery and listing
list_filestool: When Bob lists files, ignored files are typically omitted or marked with a 🔒 symbol (see "User Experience" below).- Environment details: Information about your workspace (like open tabs and project structure) provided to Bob is filtered to exclude or mark ignored items.
Command execution
execute_commandtool: This tool checks if a command (from a predefined list likecatorgrep) targets an ignored file. If so, running the command is blocked.
Key limitations and scope
- Workspace-centric:
.bobignorerules apply only to files and directories within the current Bob workspace root. Files outside this scope are not affected. execute_commandspecificity: Protection forexecute_commandis limited to a predefined list of file-reading commands. Custom scripts or uncommon utilities might not be caught.- Write operations via
insert_content&search_and_replace: As noted, these tools might be able to write to ignored files due to current limitations in their save mechanism. - Not a full sandbox:
.bobignoreis a powerful tool for controlling Bob's file access via its tools, but it does not create a system-level sandbox.
User experience and notifications
- Visual cue (🔒): In file listings, files ignored by
.bobignoremay be marked with a lock symbol (🔒), depending on theshowbobignoredFilessetting (defaults totrue). - Error messages: If a tool operation is blocked, Bob receives an error:
"Access to [file_path] is blocked by the .bobignore file settings. You must try to continue in the task without using this file, or ask the user to update the .bobignore file." - Chat notifications: You will typically see a notification in the Bob chat interface when an action is blocked due to
.bobignore.
This guide helps you understand the .bobignore feature, its capabilities, and its current limitations, so you can effectively manage Bob's interaction with your codebase.