# Worktree isolation

> AgentForge is designed to run several agents at once without them disturbing each other's work. Each agent runs in its own terminal process, optionally in its own git worktree, and its status is followed from one window.

- Canonical: https://www.zekfy.com/agentforge/features/worktree-isolation/
- Türkçe: https://www.zekfy.com/tr/agentforge/ozellikler/worktree-isolation/
- Last updated: 2026-12-04
- Capability: A worktree and a branch per pane

## Git worktree isolation per pane

A pane can be run in its own git worktree and branch, so parallel agents do not overwrite each other's files in the same working tree. When a [mission](https://www.zekfy.com/glossary/#mission) ends, uncommitted work is saved to the branch as a WIP commit rather than deleted. The branches are reviewed and merged from the [Metrics](https://www.zekfy.com/agentforge/features/metrics/) view.

When a Claude Code pane is reopened and a saved session identifier and transcript exist, it resumes where it left off and the role message is not sent again. Session resume is not available for Codex and Gemini yet.

## The branch integration panel

In isolated mode each [builder](https://www.zekfy.com/glossary/#builder) works on its own branch. The branch panel in Metrics lists those branches and merges a branch into the main branch with one click, reporting any conflict. A comment can be written on a line of the branch diff; comments persist in .forge/diff-comments.json, and "Send to agent" delivers the list of file, line and comment to the branch's agent as one message.

A branch can be opened as a pull request when the GitHub CLI is installed and signed in. AgentForge pushes the branch without a force push and states beforehand that the action makes the branch visible to everyone with access to the repository.

## Cleaning up leftover worktrees and branches

On opening, the branch panel in Metrics only scans and shows the number of items that can be cleaned: an empty branch, a branch merged into the main branch, an orphan folder git does not track, and a worktree whose branch was deleted. Deletion happens only after selection and a second confirmation.

Branches with unsaved files, unmerged commits or an open console, and branches outside the forge/ prefix, are never touched. When a mission ends, uncommitted work is saved to the branch as a WIP commit rather than deleted.

## Features

The 3 features that make up this capability. Each is also listed in the overview of all features.

### Git worktree isolation per pane

Each pane can run in its own git worktree and branch, so parallel agents do not share a working tree. When a mission ends, uncommitted work is saved to the branch as a WIP commit rather than deleted.

Listed under [Isolation and parallel work](https://www.zekfy.com/agentforge/features/#worktree-isolation)

### Leftover worktree and branch cleanup

On opening, the branch panel in Metrics only scans and shows the number of items that can be cleaned. Deletion needs selection and a second confirmation; branches with unsaved files, unmerged commits or an open console, and branches outside forge/, are not touched.

Listed under [Rollback and recovery](https://www.zekfy.com/agentforge/features/#worktree-cleanup)

### Opening a pull request from a branch

From the branch panel in Metrics a builder branch is pushed to GitHub without a force push and a pull request is opened. The action requires the GitHub CLI to be installed and signed in.

Listed under [Integrations and extensibility](https://www.zekfy.com/agentforge/features/#pull-requests)

## Questions about Worktree isolation

### Where does a Grid pane's git worktree live, and what happens to it when a mission ends?

A [Grid](https://www.zekfy.com/agentforge/features/grid/) pane's worktree lives in the <project>-worktrees folder next to the project folder, and the pane works on its own branch with the forge/ prefix. When a mission ends, uncommitted work is saved to the branch as a WIP commit rather than deleted. The branches are reviewed in the branch panel of the Metrics view and merged by the user; leftover worktrees and branches are cleaned up from the same panel after selection and a second confirmation.

See also: [Metrics](https://www.zekfy.com/agentforge/features/metrics/), [How do you run several AI coding agents in parallel on one Windows machine?](https://www.zekfy.com/docs/run-ai-coding-agents-in-parallel/), [Worktree isolation](https://www.zekfy.com/glossary/#worktree-isolation)

### Are builder branches merged automatically?

No, AgentForge does not merge builder branches on its own. In isolated mode each builder works on its own branch, and the merge is done by the user with one click in the branch panel of Metrics, with any conflict reported.

See also: [How do you run several AI coding agents in parallel on one Windows machine?](https://www.zekfy.com/docs/run-ai-coding-agents-in-parallel/), [Worktree isolation](https://www.zekfy.com/glossary/#worktree-isolation)

## Related guides

- [How do you run several AI coding agents in parallel on one Windows machine?](https://www.zekfy.com/docs/run-ai-coding-agents-in-parallel/): Run several AI coding agents on one Windows machine without them overwriting each other: panes, worktree isolation, single assignment and a branch panel.

## Related feature pages

- [Grid](https://www.zekfy.com/agentforge/features/grid/): Up to 16 agent terminals side by side
- [Metrics](https://www.zekfy.com/agentforge/features/metrics/): What each agent costs and produces

- Previous feature: [Cost ceilings](https://www.zekfy.com/agentforge/features/cost-ceilings/)
- Next feature: [Remote and phone access](https://www.zekfy.com/agentforge/features/remote-access/)
- [All features](https://www.zekfy.com/agentforge/features/)
