Documentation Index
Fetch the complete documentation index at: https://docs.firebender.com/llms.txt
Use this file to discover all available pages before exploring further.
title: ‘Worktrees’ description: ‘Run agents in isolated Git worktrees for parallel development’
The Worktrees feature lets you run multiple agents simultaneously, each in its own isolated, local environment. Each agent works in its own local worktree, enabling them to write code, run tests, and build your applications without conflicting each other. Firebender automatically manages worktrees for you.Using Worktree Mode
Basic Worktree Usage
- Type your request and start the agent in worktree mode
- Review the code changes and use run configurations to test the application
- Create a PR
Starting an Agent
To start an agent in worktree mode:- Type your request in the Firebender chat
- Select the worktree mode option before sending

Reviewing Changes
When the agent completes its work, you’ll see two options:
- Review: Opens an integrated diff viewer to inspect all changes
- Create PR: Triggers the built-in
/prcommand to generate a pull request
Review Panel
Clicking Review opens the review interface with IntelliJ’s native diff viewer:

Viewing Worktrees in the IDE
Active worktrees appear in the commit panel, showing worktree names, changed files, and branch information.
Creating Pull Requests
Click Create PR and the agent will create the pull request for you:
Worktree Management
Viewing Worktrees from Git
You can see all worktrees in your repository using the standard Git command:Cleaning Up Worktrees
To remove a worktree:- Click the worktrees icon in the Firebender header
- Click the trash icon next to the worktree

Worktree Init
You can customize the worktree setup by adding aworktrees property to your firebender.json file in the root of your project.
Configuration Options
Theworktrees property is an object that supports three configuration keys:
setup-worktree-unix: Commands or script path for macOS/Linux. Takes precedence oversetup-worktreeon Unix systems.setup-worktree-windows: Commands or script path for Windows. Takes precedence oversetup-worktreeon Windows.setup-worktree: Generic fallback for all operating systems.
- An array of shell commands: executed sequentially in the worktree
- A string filepath: path to a script file relative to
firebender.json
Example Setup Configurations
Using Command Arrays
Node.js projectUsing Script Files
For complex setups, you can reference script files instead of inline commands:firebender.json is):
setup-worktree-unix.sh (Unix/macOS):
OS-specific Configurations
You can provide different setup commands for different operating systems:Debugging
To debug your worktree setup script, redirect the output to a temporary log file:/tmp/worktree-setup.log to see the full output of each command.
Best Practices
When to Use Worktrees
Simple, verifiable tasks Worktrees excel for straightforward tasks you can easily validate. Bug fixes, writing tests, or fixing failing tests are perfect examples. Use the integrated run configurations to quickly verify the fix works as expected without opening a new project. Long-running isolated tasks Major refactors that deserve their own PR work great in worktrees. Examples include:- Migrating from View-based UI to Jetpack Compose
- Updating to Android 14 with the new permissions model
- Converting a large module from Java to Kotlin
- Migrating build scripts from Groovy to Kotlin DSL
Troubleshooting
Common Issues
Worktree creation fails- Ensure your project is a Git repository
- Verify sufficient disk space
- Check Git configuration and permissions
- Wait for agent to complete all tasks
- Check agent status in the registry
- Verify worktree branch exists with
git worktree list