---
title: "Setting up Claude Code multi-agent work on Windows (Git Bash and PowerShell) · Cork"
description: "Run several Claude Code agents on Windows: install, Git Bash vs PowerShell, worktrees, hooks in either shell, agent teams, messaging and WSL, per the docs."
canonical: "https://corkcli.com/blog/claude-code-multi-agent-windows-setup"
last_updated: "2026-10-03"
published: "2026-10-03"
author: "Kevin Vera"
---

# Setting up Claude Code multi-agent work on Windows (Git Bash and PowerShell)

Run several Claude Code agents on Windows: install, Git Bash vs PowerShell, worktrees, hooks in either shell, agent teams, messaging and WSL, per the docs.

By Kevin Vera · October 3, 2026 · [Guides](https://corkcli.com/blog/c/guides) · 7 min read

To run several Claude Code agents on Windows, install Claude Code natively from PowerShell or CMD, install Git for Windows so Claude Code can use Git Bash, give each agent its own worktree with `claude --worktree <name>`, and write hooks for the shell they will actually run in (Git Bash by default, PowerShell if you say so). Native Windows supports worktrees, background sessions, hooks, and cross-session messaging; the gaps are sandboxing (WSL 2 only) and split-pane agent teams, which need tmux or iTerm2. Every command below was checked against the official docs as of October 2026.

## Step 1: install Claude Code

Pick one, depending on your shell. Your prompt shows `PS C:\` in PowerShell and `C:\` without the `PS` in CMD.

**PowerShell:**

```powershell
irm https://claude.ai/install.ps1 | iex
```

**CMD:**

```batch
curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
```

**WinGet:**

```powershell
winget install Anthropic.ClaudeCode
```

You do not need Administrator rights. Native installs update themselves in the background; WinGet installs do not, so run `winget upgrade Anthropic.ClaudeCode` periodically (or set `CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE` to `1` to let Claude Code run the upgrade for you). Open a new terminal and check:

```powershell
claude --version
claude doctor
```

If you see `The token '&&' is not a valid statement separator`, you ran the CMD command in PowerShell; `'irm' is not recognized` means the reverse.

## Step 2: decide between Git Bash and PowerShell

This is the choice that matters most on Windows, because it decides what shell your agents' commands and your hooks run in.

- **Without Git for Windows**, Claude Code runs shell commands through its PowerShell tool.
- **With Git for Windows**, Claude Code uses Git Bash for its Bash tool, and the PowerShell tool is available alongside it (on by default for claude.ai and Console accounts). Git Bash is also required for the Monitor tool.

For multi-agent work, install Git for Windows: you need git for worktrees anyway, and most hook scripts and agent instructions you will find are written for bash. If Claude Code cannot find Git Bash, point to it in `settings.json`:

```json
{
  "env": {
    "CLAUDE_CODE_GIT_BASH_PATH": "C:\\Program Files\\Git\\bin\\bash.exe"
  }
}
```

**Or use WSL 2.** Install and run `claude` inside your Linux distribution with the Linux installer. Choose WSL 2 if you want sandboxed command execution, which the docs list as supported on WSL 2 and not on native Windows, or if your toolchain is Linux-first. Do not mix: a native Windows session and a WSL 2 session cannot message each other.

## Step 3: give each agent its own worktree

Worktrees work the same on Windows. In separate terminals:

```powershell
claude --worktree feature-auth
claude --worktree fix-billing
```

Each creates `.claude\worktrees\<name>\` at the repo root on a branch named `worktree-<name>`. The repository needs at least one commit, and you need to have run `claude` once in the folder to accept the trust dialog. Add `.claude/worktrees/` to `.gitignore`, and list gitignored files each worktree needs (such as `.env`) in a `.worktreeinclude` file.

Two Windows-specific details from the docs:

- **Links are safe on cleanup.** When a worktree is removed, "if a folder inside the worktree is a link to somewhere else, such as an NTFS junction or a directory symlink, Claude Code deletes only the link and keeps the folder it points to."
- **Permission approvals stay per worktree.** On macOS and Linux, "don't ask again" approvals in a worktree are saved to the main checkout and apply everywhere; on Windows, the rule stays with that worktree. Put the commands every agent needs in the project's `.claude/settings.json` instead of approving them one worktree at a time.

To run sessions in the background and watch them from one screen, use agent view:

```powershell
claude --bg --name "flaky-test" "investigate the flaky checkout test"
claude agents
```

## Step 4: write hooks for the right shell

Hooks are how you add guardrails to every agent, for example blocking edits to generated files or to a file another session claimed. On Windows, the hooks docs say command hooks "default to Git Bash when available. If Git Bash isn't installed, Claude Code uses PowerShell."

**Bash hooks** (with Git for Windows) work as on macOS and Linux:

```json
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          { "type": "command", "command": "${CLAUDE_PROJECT_DIR}/.claude/hooks/check.sh", "args": [] }
        ]
      }
    ]
  }
}
```

**PowerShell hooks** use the exec form from the docs, which runs `powershell.exe` with no shell in between:

```json
{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "powershell.exe",
            "args": ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", "${CLAUDE_PROJECT_DIR}/.claude/hooks/protect-generated.ps1"]
          }
        ]
      }
    ]
  }
}
```

A minimal `protect-generated.ps1` that blocks edits under any `generated` folder. Exit code 2 blocks the tool call, and the stderr text becomes the reason Claude sees:

```powershell
$in = [Console]::In.ReadToEnd() | ConvertFrom-Json
$path = $in.tool_input.file_path
if ($path -match '[\\/]generated[\\/]') {
  [Console]::Error.WriteLine("$path is generated. Edit the source template instead.")
  exit 2
}
exit 0
```

For a one-line PowerShell command, set `"shell": "powershell"` on the hook instead of using `args`. Run `/hooks` in Claude Code to confirm a hook is registered.

## Step 5: coordinate the agents

**Cross-session messaging** works on native Windows from Claude Code v2.1.234, over a per-session named pipe that never goes through Anthropic servers. Claude can send findings between your sessions on the machine; run `/list-agents` to see which sessions it can reach.

**Agent teams** (experimental, `CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1`) run on Windows in the default in-process mode, where you switch between teammates with the arrow keys. Split-pane mode needs tmux or iTerm2 and "isn't supported in VS Code's integrated terminal, Windows Terminal, or Ghostty," so leave `teammateMode` at its default.

**Codex and Cursor on the same repo.** Codex installs on Windows with `powershell -ExecutionPolicy ByPass -c "irm https://chatgpt.com/codex/install.ps1 | iex"`, runs natively with a Windows sandboxing mode set under `[windows]` in `config.toml`, and its hooks accept a `commandWindows` override. Cursor's worktrees read a `"setup-worktree-windows"` command from `.cursor/worktrees.json`.

## How Cork helps

Worktrees, hooks, and messaging each cover part of the coordination on one machine. Cork is the [coordination layer](https://corkcli.com/blog/coordination-layer-ai-coding-agents) for multiplayer coding agents: it keeps Claude Code, Codex and Cursor agents, on one machine or across a team's machines, from overwriting each other on one codebase, and hands each agent what the others already learned.

For this setup specifically:

- **No hook scripts to maintain per shell:** Cork's hooks in Claude Code, Codex and Cursor run the protocol with no extra model calls.
- **[Write gate](https://corkcli.com/blog/write-gate):** an edit against code another agent is changing right now is held until your agent has their version.
- **Live awareness and briefing:** agents hear about renames and signature changes on their next step and start each task with the exact signatures, callers and recent changes of the code they will touch.
- **Landing:** `git push` becomes one step that rebases onto teammates' commits, reruns the tests and pushes.

Cork's published install line is a shell command:

```bash
curl -fsSL https://corkcli.com/install.sh | sh
```

In WSL 2, run it inside your Linux distribution. For native Windows, check the current install instructions at corkcli.com before running it, since this guide covers only what we could verify.

## Frequently asked questions

### Does Claude Code work on Windows without WSL?

Yes. Install it from PowerShell or CMD. Git for Windows is optional but recommended; without it, Claude Code uses PowerShell for shell commands.

### Do Claude Code hooks run in PowerShell or Git Bash on Windows?

Git Bash by default when it is installed, PowerShell otherwise. You can force PowerShell with `"shell": "powershell"` or run `powershell.exe` directly with `args`.

### Can I run Claude Code agent teams in Windows Terminal?

Yes, in the default in-process mode. Split panes are not supported in Windows Terminal.

### Should I use WSL or native Windows for multiple agents?

Native Windows for Windows-native projects; WSL 2 for Linux toolchains or sandboxed command execution. Keep all your agents on one side, since native and WSL 2 sessions cannot message each other.

## Sources

- <https://code.claude.com/docs/en/setup>
- <https://code.claude.com/docs/en/hooks>
- <https://code.claude.com/docs/en/worktrees>
- <https://code.claude.com/docs/en/agent-view>
- <https://code.claude.com/docs/en/agent-teams>
- <https://code.claude.com/docs/en/cross-session-messaging>
- <https://github.com/openai/codex>
- <https://learn.chatgpt.com/docs/windows/windows-sandbox>
- <https://learn.chatgpt.com/docs/hooks>
- <https://cursor.com/docs/configuration/worktrees>

## Related reading

- [How to run multiple Claude Code agents on one repo without conflicts](https://corkcli.com/blog/run-multiple-claude-code-agents-one-repo): Run several Claude Code agents on one repository safely: worktrees, subagents, agent teams, cross-session messaging, and a clean landing routine, step by step.
- [Claude Code hooks explained: PreToolUse, PostToolUse and team workflows](https://corkcli.com/blog/claude-code-hooks-pretooluse-posttooluse-team-workflows): How Claude Code hooks work: settings locations, PreToolUse allow and deny, PostToolUse checks, SessionStart context, exit codes, and hook patterns for teams.
- [How to see what all your AI coding agents are doing at once](https://corkcli.com/blog/see-what-all-ai-coding-agents-are-doing): See every AI coding agent's status in one place: Claude Code agent view, Cursor's Agents Window, git worktree checks, OpenTelemetry, and a team-wide view.
- [Setting up Cork for a team of five](https://corkcli.com/blog/cork-team-of-five-setup): Set up Cork for a five-person team running Claude Code, Codex and Cursor agents: install, login, agent hours, AGENTS.md, working habits, and what it costs.

[All articles](https://corkcli.com/blog.md) · [Cork in Markdown](https://corkcli.com/index.md) · [llms.txt](https://corkcli.com/llms.txt)

This page in HTML: https://corkcli.com/blog/claude-code-multi-agent-windows-setup
