[FEATURE] Parallel Multi-Agent Workflows for Code Generation and Planning
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Currently, Claude Code operates in a linear, single-agent fashion. When tackling a complex problem, a developer gives a prompt and receives one proposed solution from a single model. This workflow has several limitations:
- Exploring Alternatives is Tedious: To compare different implementation strategies (e.g., an iterative vs. a recursive solution) or to see how different models (e.g., Opus vs. Sonnet) would solve the same problem, the user must manually run the same prompt multiple times, switching models or refining instructions between each run. This is time-consuming and makes side-by-side comparison difficult.
- Lack of Diverse Solutions: A single agent might settle on a suboptimal path. For complex or ambiguous tasks, seeing multiple diverse approaches at once would allow the developer to make a more informed decision, cherry-pick the best ideas, or combine elements from different solutions.
- Inefficient Planning: The current Plan Mode generates a single plan. If the developer wants to evaluate alternative architectural plans, they must repeat the entire planning process. This slows down the crucial initial phase of feature development.
- Workflow Interruption: Running a complex task occupies the current session. There is no built-in mechanism to run multiple independent agents on the same codebase simultaneously without manual intervention (e.g., creating new git branches or worktrees by hand).
Proposed Solution
Implement a parallel multi-agent workflow system inspired by Cursor v2.0. This would allow a user to run multiple agents simultaneously on a single prompt, each in an isolated environment.
Ideal User Experience:
- Initiation: A developer issues a single prompt with a new command or flag to specify parallel execution. For example:
/run-parallel --model opus,sonnet "Refactor the authentication service to use JWTs."- Or a new UI element in the VS Code extension / JetBrains plugin to select multiple models.
- Isolated Execution:
- Claude Code automatically creates an isolated
git worktreefor each agent. This prevents file conflicts and allows each agent to modify the codebase independently. For remote execution, this could leverage separate cloud environments similar to Claude Code on the web. - The user's main working branch remains untouched during execution.
- UI for Monitoring:
- A dedicated view (perhaps in the VS Code extension sidebar or a new terminal pane) shows the status of each running agent in real-time (e.g., "Agent 1: Opus [In Progress]", "Agent 2: Sonnet [Completed]").
- Unified Review Interface:
- Once the agents are finished, a multi-diff view is presented. This interface would show the original code alongside the proposed changes from each agent, making it easy to compare solutions side-by-side.
- The user should be able to accept one entire solution, which would then be applied to their main branch.
- (Advanced) The user could potentially cherry-pick specific file changes from different agents.
- Parallel Planning:
- Extend this functionality to Plan Mode. A command like
/plan-parallel "Design a new caching layer"would generate multiple distinct implementation plans from different agents. The user can review the plans, choose the best one, and then proceed with execution.
Alternative Solutions
- Manual Sequential Runs: The current workaround is to run the same prompt sequentially, changing the model with
/modelbetween each run. The results have to be manually saved or committed to different branches for comparison, which is slow and inefficient. - Manual Git Branching: A developer can manually create new branches (
git checkout -b attempt-1, runclaude,git checkout main,git checkout -b attempt-2, runclaudeagain). This is extremely cumbersome and defeats the purpose of an AI assistant streamlining the workflow. - Using
/rewind: A user can run a prompt, review the result, use/rewindto undo it, and then try a different prompt or model. This loses the previous result and does not allow for side-by-side comparison.
Priority
Critical - Blocking my work
Feature Category
CLI commands and flags
Use Case Example
A developer is tasked with optimizing a data-fetching function in a Node.js application. They are unsure whether to use Promise.all for parallel requests or a sequential for...of loop with await for better rate-limit handling.
- Prompt: The developer runs the command:
claude /run-parallel --model opus,sonnet "Refactor the fetchData function in src/api.js to be more efficient. Show me both a parallel and a sequential approach."
- Execution: Claude Code spins up two agents in isolated git worktrees:
- Agent 1 (Opus) starts implementing a solution using
Promise.all. - Agent 2 (Sonnet) starts implementing a solution using a sequential loop.
- The developer sees the progress of both agents in their UI.
- Review: When complete, a unified diff view opens.
- The left pane shows the original
fetchDatafunction. - The middle pane shows Opus's
Promise.allimplementation. - The right pane shows Sonnet's sequential loop implementation.
- Decision & Action: The developer analyzes both solutions. They decide the
Promise.allapproach is superior for their use case. They click "Apply Opus's Changes".
- Result: The changes from the Opus agent's worktree are applied to the developer's current branch. The temporary git worktrees are automatically cleaned up. The task is complete in a fraction of the time it would have taken to do this manually.
Additional Context
This feature is heavily inspired by the "Multi-Agents" workflow introduced in Cursor v2.0. Their implementation using git worktrees for local execution and remote machines for cloud execution is a proven model for achieving codebase isolation.
A potential UI could look like this in the VS Code extension:
- A new "Parallel Agents" tab in the sidebar.
- When a parallel run is active, this tab lists each agent and its status (Running, Done, Error).
- Clicking a completed agent opens its proposed changes in a diff view.
- A "Compare All" button opens the unified multi-diff view described above.
Implementing this feature would be a significant step forward in making Claude Code a truly agentic partner in development, allowing developers to explore the solution space more effectively and make better architectural decisions faster.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗