Fleet — parallel branch sessions for VS CodeRun a Claude Code session per git branch, each in its own worktree, each with its own dev-server ports — without leaving VS Code. The problemClaude 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:
Upstream request: anthropics/claude-code#69554. What Fleet adds over the alternativesOther tools in this space wrap the
Requirements
Everything degrades rather than breaks: no Claude extension disables native mode, no Getting startedFleet automatically adds local Git exclusions for
New same-window chats stage a short 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.
|
| 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.autoInstallHooksdisabled 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). Usefreshmode with a remote default branch; inspect commits directly with Git when usingheadmode 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/openhandler 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
EnterWorktreeinstruction. The chat begins in the window checkout until that tool succeeds; a shellcdis not sufficient. This depends on Claude Code's tool support and the model following the instruction. Usenative-windowfor 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
Stoprather than immediately. Detecting it precisely would mean subscribing toPostToolUse, 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.
setupruns alongside the session, not before it. A new worktree is a clean checkout, sonpm installstarts 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 leavesetupunset and install by hand.- Only Claude Code is implemented. The
AgentAdapterseam 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:
- 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.
- 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.
- 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