# Isolated worktrees

> Give an agent its own copy of the project so several agents never step on each other's changes — and add a reviewer on a different AI.

Source: https://docs.neurosquad.ai/en/agents/worktrees

When several agents work in the same folder, they can overwrite each other's changes. An
**isolated** agent gets its own copy of the project (a git worktree) on its own branch, so it can
change anything without disturbing you or other agents.

## Turn it on

In the sidebar's add row under the workspace, switch on **Isolate in git worktree** (the button with
stacked squares) before adding the agent. The card says **Preparing** while its copy is set up, then
the agent starts.

> Your project needs to be a git repository. The setup wizard can install Git if you don't have it.

## Get the copy ready automatically

A fresh copy has no installed dependencies and none of your private files. In the workspace's edit
dialog you can set:

- **Setup command for isolated agents** — runs once in every new copy before the agent starts, e.g.
`npm install`. Its output shows in the card while it runs.
- **Files to copy into a new worktree** — files git doesn't track but the agent needs, like `.env`.
- **Run command** — starts your project from an agent's card (**Run this project** in its ⋯ menu); a
browser card opens on your app as soon as it prints its local address.

## Add a reviewer

When the work looks done, choose **Add a reviewer** in the agent's ⋯ menu. A second agent starts —
on a **different AI** when you have one installed — in the same worktree, with an arrow from the
author, and is told to read the changes and **not edit anything**.

## Bring the work back

The agent's changes live on its own branch. When you're happy with them, merge that branch from a
[terminal card](https://docs.neurosquad.ai/en/cards/terminal) — or simply ask the agent to commit and merge its work.
