> ## Documentation Index
> Fetch the complete documentation index at: https://docs.whim.run/llms.txt
> Use this file to discover all available pages before exploring further.

# Branch Isolation

> Every task runs on its own Git branch for conflict-free parallel work.

Every Whim task runs on its own dedicated Git branch. You can launch dozens of tasks in parallel — each writes to its own branch with no merge conflicts or race conditions.

When a task starts, Whim:

1. Clones your repository from a [local mirror](#mirroring-and-sync) into an isolated container
2. Checks out the **remote base branch** you specified (or the repo's default branch)
3. Creates a new task branch and switches to it
4. Hands control to the AI agent, which commits to the task branch

## Branch naming

Task branches follow a deterministic pattern:

```
whim-{display-id}
```

The display ID is derived from your workspace name with an auto-incrementing counter:

| Workspace name | Prefix | Example branch |
| -------------- | ------ | -------------- |
| `whim`         | `WW`   | `whim-ww-12`   |
| `my-app`       | `MA`   | `whim-ma-5`    |
| `acme/billing` | `BI`   | `whim-bi-31`   |

Even tasks created simultaneously get distinct branch names via atomic counter increments.

## Base branch selection

By default, tasks branch off your repository's default branch (usually `main`, meaning `origin/main`). Override this by setting a **remote base branch** when creating a task.

<Info>
  The remote base branch is the starting point. The agent commits to the task's own branch, not the base.
</Info>

Common use cases:

* **Feature branches** — continue work on an in-progress branch
* **Release branches** — target a specific release for hotfixes
* **Task chaining** — use one task's branch as the base for another

You can also set a default remote base branch in workspace settings.

## Parallel work

Because each task has its own branch in its own container:

* **No file locking** — multiple tasks can modify the same files
* **No conflicts during execution** — conflicts only surface when merging branches
* **Independent commit histories** — each task builds a linear history on its branch

## Branch cleanup

When a task completes, its branch **remains in your repository**. Whim does not auto-delete branches — this preserves commit history and keeps associated PRs intact.

Clean up old branches through GitHub (UI, CLI, or auto-delete on PR merge).

## Forking and branch inheritance

When you [fork a task](/tasks/task-lifecycle#forking-tasks), the new task inherits the original's branch as its source, starting from where the original left off.

## Mirroring and sync

Whim keeps a cached mirror of your repository on its infrastructure. When a task starts, the container clones from this mirror instead of GitHub, which significantly reduces startup time for large repos.

### How mirroring works

<Steps>
  <Step title="Repository connected">
    When you connect a repo to a workspace, Whim creates a mirror — a bare clone stored on Whim's infrastructure.
  </Step>

  <Step title="Mirror stays in sync">
    Each push to your repository triggers a webhook that syncs the mirror with the latest changes.
  </Step>

  <Step title="Tasks clone from the mirror">
    Containers clone from the mirror over a local network instead of the public internet.
  </Step>

  <Step title="Fallback to GitHub">
    If the mirror is unavailable, containers clone directly from GitHub. Task execution is never blocked by mirror issues.
  </Step>
</Steps>

### Why mirroring matters

Without mirroring, each container clones directly from GitHub — slower for large repos, uses more GitHub API quota, and varies with network conditions. The mirror eliminates these issues.

### Troubleshooting

* **Slow task startup** — the mirror may be temporarily unavailable. The container falls back to GitHub, which is slower but still works. Mirror issues resolve on the next push event.
* **Recent commits missing** — the mirror syncs on push events. If you pushed very recently, there may be a brief delay. The container falls back to GitHub if the mirror hasn't caught up.
* **Mirror not updating** — verify the Whim GitHub App is installed with webhook permissions. Check webhook delivery logs in GitHub Settings > Webhooks.

<CardGroup cols={2}>
  <Card title="Pull Requests" icon="code-pull-request" href="/git/pull-requests">
    Create PRs from task branches and track their status.
  </Card>
</CardGroup>
