Skip to content
| Marketplace
Sign in
Visual Studio Code>SCM Providers>Fleet — Parallel Branch SessionsNew to Visual Studio Code? Get it now.
Fleet — Parallel Branch Sessions

Fleet — Parallel Branch Sessions

Ali Haider

|
2 installs
| (0) | Free
Run a Claude Code session per git branch in VS Code, each in its own worktree with its own dev-server ports.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Fleet — parallel branch sessions for VS Code

Run a Claude Code session per git branch, each in its own worktree, each with its own dev-server ports — without leaving VS Code.

The problem

Claude Code chats normally start in the window's checkout. Without deliberately entering separate worktrees, parallel task chats share files and a branch. Fleet creates and lists those worktrees, stages the worktree handoff in each new chat, and lets you switch back to saved task sessions from one sidebar.

This is specific to the VS Code extension. It is already solved elsewhere:

Surface Per-branch parallel sessions
Claude Code CLI ✅ claude --worktree <name>; claude agents auto-worktrees background sessions
Claude Code Desktop app ✅ every new session gets its own worktree automatically
Copilot in VS Code ✅ the Agents window has a "New Worktree" toggle
Claude Code VS Code extension Supports worktree sessions; Fleet adds task creation, switching, port allocation and a shared overview

Upstream request: anthropics/claude-code#69554.

What Fleet adds over the alternatives

Other tools in this space wrap the claude CLI in a terminal, which means giving up the graphical chat panel. Fleet keeps the native panel. And worktrees only isolate files — they do nothing about environments, so four agents each running npm run dev all fight over port 3000. Fleet allocates ports too.

  • Task sessions in one VS Code window, in the real chat panel. Click a task to return to its chat; create another session explicitly when needed.
  • Port isolation. Each worktree gets its own dev-server ports, written to an env file that layers over the one Claude copies in.
  • One fleet view from any window. Status, branch, dirty count, ports and sessions for every worktree, visible from whichever window you happen to be in.
  • Conflict radar. Warns when two worktrees have modified the same file, instead of letting you discover it at merge time.
  • Adopts rather than competes. Worktrees made by claude --worktree or git worktree add show up in the same list.

Requirements

  • VS Code 1.95+
  • git
  • The Claude Code extension 2.1.300+, for same-window native sessions. Older versions can use native-window mode.
  • node on your PATH, for status hooks
  • The standalone claude CLI on your PATH, only for terminal session mode. Installing the VS Code extension deliberately does not add claude to your PATH — it bundles a private copy for its own panel.

Everything degrades rather than breaks: no Claude extension disables native mode, no claude CLI disables terminal mode, no node disables status, and outside a git repo Fleet stays idle.

Getting started

Fleet automatically adds local Git exclusions for .claude/fleet/ (state, logs and locks) and .claude/worktrees/ (nested task checkouts). These rules live in Git's info/exclude, shared with linked worktrees; they do not create a .gitignore change on your branch. Other .claude files and .claude-fleet.json remain visible to Git. Already tracked files are not untracked automatically.

  1. Open a git repository and find Fleet in the activity bar.
  2. Run Fleet: Create Sample Config and edit .claude-fleet.json to declare your ports.
  3. Leave status hooks uninstalled and fleet.autoInstallHooks disabled; see the known issues below. Saved native sessions are visible without hooks.
  4. Click +, name your task, and optionally enter its first prompt. The Claude chat opens in your current window.
  5. Press Enter to send the staged prompt. Wait for EnterWorktree to confirm the task's existing worktree and branch before continuing. If it fails, stop and use a separate worktree window.
  6. Expand a task to see its chats by title. Click New chat beneath it to open another conversation, or select a chat to return to that specific tab/history. A worktree shows its chat count; Open and Active tab describe the editor state, not whether Claude is working. Clicking the task name returns to its most recently selected Fleet chat or saved history.

New same-window chats stage a short EnterWorktree handoff before any task prompt. Send it and wait for confirmation. Resuming an existing worktree session does not repeat it. Fleet-opened unsent chats are listed immediately as numbered new chats; those temporary associations last for this window session. Saved chats remain discoverable after reload. Chats created outside Fleet appear once saved in the worktree. If duplicate titles make an open tab's saved identity ambiguous, Fleet keeps them separate rather than guessing.

The file Explorer stays on the folder you opened; switching a chat does not switch the window's files or Git status bar. Use Open Worktree in Separate Window when you want the entire editor, terminals and language servers scoped to that task. Review edits in the task worktree, and avoid attaching main-checkout files to its chat accidentally.

.claude-fleet.json

Checked in, so a team gets identical behaviour.

{
  // ENV_VAR -> preferred base port. Fleet allocates upward from the base.
  "ports": { "PORT": 3000, "API_PORT": 4000 },
  // Where allocated ports are written, inside each worktree.
  "envFile": ".env.local",
  // Run once after a worktree is created.
  "setup": "npm install",
  // Offered as a per-worktree action.
  "dev": "npm run dev",
  // Which port the "Open Dev URL" action uses.
  "urlPort": "PORT"
}

The base ports are treated as belonging to the main checkout, so the first worktree starts at 3001. Create worktrees sequentially to avoid the concurrent-allocation issue below.

Settings

Setting Default Purpose
fleet.sessionMode native native keeps task chats in this window; native-window opens a separate window per worktree; terminal runs the CLI in an integrated terminal.
fleet.worktreeRoot .claude/worktrees Where worktrees go. Matches claude --worktree so the CLI reuses the same ones.
fleet.baseRef fresh fresh branches from the remote default branch; head carries your current work. Mirrors Claude Code's worktree.baseRef.
fleet.autoInstallHooks false Install status hooks without prompting.
fleet.conflictRadar true Warn on files changed in more than one worktree.
fleet.pollInterval 10000 How often git status and the conflict radar refresh, in ms.
fleet.terminalCommand claude Executable for terminal mode. Use an absolute path if it is not on your PATH.

Known issues in 0.2.0

These four issues from 0.1.0 remain open. The descriptions and workarounds are included here for all users.

  • Status-hook installation can interfere with Claude worktree creation (#1). Leave Fleet hooks uninstalled and fleet.autoInstallHooks disabled for this release. If already installed, use Fleet: Remove Status Hooks.
  • Simultaneous task creation can allocate duplicate ports (#2). Create tasks one at a time.
  • Committed task changes can disappear from the diff and conflict radar when the saved base is HEAD (#3). Use fresh mode with a remote default branch; inspect commits directly with Git when using head mode or a repository without a remote.
  • Removal warnings can miss local commits on branches without an upstream (#4). Inspect and push or merge your commits before removing a task worktree.

Known limitations

These are design consequences, not bugs, and are worth knowing before you rely on the tool.

  • Native-mode prompts are not auto-submitted. The documented vscode://anthropic.claude-code/open handler pre-fills the prompt but does not send it, so the session opens with your prompt staged and waits for Enter. Use terminal mode if you need fire-and-forget dispatch.
  • A new same-window chat needs a worktree handoff. Fleet stages an explicit EnterWorktree instruction. The chat begins in the window checkout until that tool succeeds; a shell cd is not sufficient. This depends on Claude Code's tool support and the model following the instruction. Use native-window for sessions rooted in the task checkout from startup.
  • Saved history does not report live activity. Chat titles and editor open/active indicators are available without hooks; working, idle and finished status requires hook events. History is read locally through the official Agent SDK; Fleet does not start a background agent or send an extra model request to discover sessions. CLI/programmatic sessions are excluded from native history because the graphical panel may not resume them.
  • The native launch command belongs to Claude Code. Fleet uses the command behind its documented open handler to target the current window. Changes to that extension can require a Fleet update.
  • A permission prompt reads as "needs attention" until the turn ends. No hook event fires when you approve one, so the status clears on the next Stop rather than immediately. Detecting it precisely would mean subscribing to PostToolUse, which spawns a hook process per tool call — a real latency cost for a cosmetic gain.
  • Multi-root workspaces use the first folder. The chat panel's directory would otherwise be ambiguous.
  • setup runs alongside the session, not before it. A new worktree is a clean checkout, so npm install starts in a terminal at the same moment the session window opens. On a slow install the agent can begin before dependencies are ready — give it a moment, or leave setup unset and install by hand.
  • Only Claude Code is implemented. The AgentAdapter seam exists for Codex, Copilot CLI and Gemini, but nothing else is wired up yet.

How it works

Four decisions carry most of the design.

Same-window sessions with an explicit worktree handoff. A fresh chat starts in the window checkout. Fleet stages EnterWorktree with the existing task path before the user's task; that tool moves the session's directory and worktree binding. Existing native sessions resume by ID. Open tab identities are remembered to avoid duplicate pending chats, and local history restores task switching after a reload. The optional native-window mode retains the locked shared-state handoff to a separate window. See Claude's worktree documentation and VS Code integration.

One state file, resolved from anywhere. git rev-parse via git worktree list finds the main checkout from inside any worktree, which anchors <mainRoot>/.claude/fleet/state.json. Every window resolves the same path, and a file watcher keeps them in step. Writes go through a lock file plus atomic rename, because two windows creating worktrees at the same moment would otherwise each reserve the same port and the second write would erase the first worktree.

Local history and optional hook status. The official SDK's listSessions reads native session metadata for each exact worktree, excluding programmatic sessions and other checkouts. Fleet does not parse the internal transcript format. Saved sessions have unknown live status. When hook events exist, they take priority over history metadata. Fleet's current hook registration includes a known WorktreeCreate bug, so leave status hooks disabled until issue #1 is fixed.

Status is derived rather than persisted, which is why there is no cross-window contention over it: every window reads the same log and reaches the same conclusion.

Hooks are installed at user scope, and self-scope by marker. Project settings live in .claude/settings.local.json, which is gitignored — so a freshly created worktree, being a clean checkout, would not have the file and hooks would silently never fire there. That is exactly the case Fleet exists to serve. So hooks go in ~/.claude/settings.json and the script does nothing unless the repository has a .claude/fleet/ directory. Creating that directory is what opts a repository in.

The script is written to ~/.claude/fleet/hook.mjs, deliberately outside the extension's install directory: that path changes on every extension update, which would leave the registered command pointing at a deleted file. Fleet revalidates and rewrites it on activation.

Port layering. .worktreeinclude copies .env into every new worktree verbatim, so writing .env would mean fighting that copy. Fleet writes .env.local, which Vite, Next.js and CRA all treat as an override. Ports are reserved in shared state before the worktree exists, because an unstarted dev server holds no socket and probing alone would hand the same port to two worktrees.

Development

npm install
npm run compile      # bundle to dist/
npm run watch        # rebuild on change
npm run typecheck
npm test             # unit tests
npm run test:e2e     # scratch-repo integration checks
npm run test:all     # typecheck + unit + e2e
npm run icon         # regenerate resources/icon.png
npm run preflight    # check the manifest is publish-ready
npm run package      # full gate + .vsix

To publish, see PUBLISHING.md. npm run package runs the test suite and a manifest preflight first, so a broken build or an unreplaced placeholder cannot reach a marketplace.

Press F5 to launch a window with the extension loaded. The second launch configuration prompts for another repository to open, which is the useful one for exercising worktree creation.

The whole data layer — git, ports, state, config, conflict detection, event folding — has no vscode import, which is what lets npm run test:e2e drive it against a real throwaway git repository outside any editor.

Verification status

Automated checks cover the data layer, native/legacy/terminal launch routing, minimum-version checks, guarded task prompts, tab reuse, exact-worktree history filtering and live-status merging. The integration harness creates scratch worktrees, checks sequential port allocation and env layering, exercises hook payloads and conflict radar, and checks removal.

Several unit tests deliberately run against real git rather than fixtures. That is how the porcelain parsing bug was caught: the first two columns of git status --porcelain are status flags and the third is a space, so trimming the line before slicing the path eats a character and turns app.js into pp.js. A hand-written fixture that omits the leading space hides it completely.

Manual verification:

  1. 0.2.0 same-window flow verified on macOS with the installed VSIX and Claude Code 2.1.331. A new task staged the guarded prompt in the main window. EnterWorktree entered the existing task branch, and the chat read that worktree's distinct marker file. Switching tasks reused the pending chat; switching after a reload resumed the saved native session with its worktree banner and history intact. The packaged local-history helper was also exercised directly.
  2. The earlier separate-window handoff was verified with Fleet installed. A native panel opened in its task window and confirmed the task worktree directory. F5 development sessions do not automatically load Fleet in newly opened windows; install the VSIX to test that workflow.
  3. Live hook status remains optional and affected by known issue #1. Keep hooks disabled for this release; saved native history works without them.

Fleet: Run Diagnostics exists for exactly this. It reports the resolved repository, hook registration, observed event types and their originating directories, transcript locations, port probe results and current fleet state, so a failure names its own cause.

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft