π‘ Vision
CodeMux already unifies multiple AI coding engines (OpenCode, Copilot, Claude Code) under a single gateway. The next leap is enabling these engines to work together as a team β automatically decomposing complex tasks and distributing subtasks across engines/sessions in parallel, each working in an isolated environment, then aggregating results back to the user.
This is not about wrapping a single engine's sub-agent system (like Claude Code's internal Agent tool). Instead, it's about building a cross-engine orchestration layer that is unique to CodeMux's multi-engine architecture β something no single-engine tool can achieve.
π― Core Concept
User sends a complex task (e.g., "Refactor auth module and add tests")
β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Orchestrator (new layer) β
β 1. Analyze & decompose task β
β 2. Assign subtasks to engines/sessions β
β 3. Monitor progress β
β 4. Collect & synthesize results β
ββββ¬βββββββββββββββ¬βββββββββββββββ¬ββββββββββββββββββββββ
β β β
βΌ βΌ βΌ
ββββββββββ ββββββββββ ββββββββββ
β Engine β β Engine β β Engine β β Same or different engines
β Claude β βCopilot β βOpenCodeβ
β wt-1 β β wt-2 β β wt-3 β β Isolated worktrees
β"search β β"write β β"run β
β & plan"β β tests" β β build" β
ββββββ¬ββββ ββββββ¬ββββ ββββββ¬ββββ
β β β
ββββββββββββββΌβββββββββββββ
βΌ
Orchestrator merges results
β
Unified response to user
π§ Claude Agent Team vs CodeMux Orchestration
Claude Code already has built-in Agent Team capabilities (AgentInput.team_name, agents, TeammateIdle hook) for sub-agent parallelism within a single session. This is fundamentally different from what CodeMux orchestration provides:
|
Claude Agent Team |
CodeMux Orchestration |
| Orchestration layer |
Inside Claude session |
CodeMux application layer |
| Engine scope |
Claude only |
Cross-engine (Claude + Copilot + OpenCode) |
| Context |
Sub-agents share parent session context |
Sessions are fully independent, Orchestrator injects context |
| Isolation |
Optional worktree |
Each subtask gets an independent worktree |
| User control |
Claude decides internally |
Users review and edit the decomposition plan in UI |
Conclusion: Intra-engine parallelism is deferred to Agent Team's own mechanism. CodeMux focuses on cross-engine orchestration and user-controlled task decomposition. Even with a single engine, CodeMux provides true file-level worktree isolation that Agent Team cannot achieve.
β¨ Roadmap
Phase 0: Sub-agent Visibility β
(PR #99, merged)
Capture previously-dropped SDK messages (task_started, task_progress, task_notification, tool_progress) in ClaudeCodeAdapter and surface real-time sub-agent activity in the UI:
RunningToolCard shows current subtool name and tool-use count during execution
TaskTool completed state displays AI-generated summary and tool-use stats
- Status bar appends active subtool name (e.g., "Delegating work Β· Fix the bug (Bash)")
Phase 1: Cross-Engine Task Orchestration π§
Core Architecture: Hub-and-Spoke
Sessions do not communicate directly. All information flows through the Orchestrator (an LLM session):
βββββββββββββββββββββββββββββββ
β Orchestrator β
β (LLM session) β
β β
β β’ Holds global context β
β β’ Manages DAG dependency β
β β’ Injects upstream results β
β β’ Decides next round actions β
ββββ¬βββββββ¬βββββββ¬ββββββββββββββ
β β β
results upβ β βdispatch β βresults ββdispatch + inject context
β β β
βββββββ΄β ββββ΄ββββ ββ΄βββββββ
β S1 β β S2 β β S3 β
βClaudeβ βCopilotβ βClaude β
βwt-1 β βwt-2 β βwt-3 β
ββββββββ ββββββββ βββββββββ
Execution Model: DAG + Multi-Round Iteration
Rather than simple "parallel dispatch β wait all β aggregate", execution follows a dependency graph with iterative rounds:
Example: "Refactor auth module, add tests, then verify everything passes"
LLM decomposes into a DAG:
[Analyze arch] βββ [Write tests] βββ [Verify integration]
(Claude) (Copilot) (Claude)
ββββββββββββ [Refactor impl] ββ
(Claude)
Round 1 Round 2 Round 3
(no dependencies) (parallel, deps (waits for
satisfied) all above)
Execution loop:
while (unfinished subtasks exist) {
1. Find all subtasks whose dependencies are satisfied but not yet started
2. Collect upstream result summaries, inject into downstream prompts
3. Dispatch these subtasks in parallel (create worktree + session + send message)
4. Wait for any running subtask to complete
5. Extract completed subtask's result summary
6. Go back to step 1
}
Aggregate final results
Context injection (the core mechanism for inter-session communication):
When a downstream subtask starts, the Orchestrator injects upstream results into its prompt:
Message sent to the "Write tests" session:
Your task: Write unit tests for the auth module
## Upstream Task Results
### [Analyze architecture] output:
- Core modules: jwt/, session/, oauth/
- Entry point: src/auth/index.ts
- Current test coverage: 12%
- Key finding: token refresh logic has zero test coverage
Based on the analysis above, write comprehensive unit tests.
UX Design: Explicit UI, No Slash Commands
Entry point: A new "Team Tasks" collapsible section in the sidebar (between Active Sessions and Scheduled Tasks):
ββ Sidebar ββββββββββββββββββββββ
β π΅ Active Sessions (2) β
β β Session A β Running β
β β Session B β Done β
β β
β π₯ Team Tasks (1) [+] β β NEW section
β β Refactor auth β Running β
β β
β β° Scheduled Tasks (3) β
β ... β
β β
β π Projects β
β ... β
βββββββββββββββββββββββββββββββββ
4-phase view (main content area switches to Orchestration Dashboard):
- Setup View β Task description textarea + engine cards (multi-select with running status) + project selector + [Analyze Task] button
- Task Plan View β Editable subtask cards from LLM decomposition (description, engine, worktree toggle, dependencies), add/remove subtasks + [Execute] button
- Execution Dashboard β Subtask cards with dependency topology (showing Round progress), real-time status updates, each card has [View Session] to navigate to the child session chat view
- Result View β LLM-aggregated summary + per-subtask results (collapsible) + worktree merge/delete actions
Execution Dashboard example with DAG visualization:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β π₯ Refactor auth module β Running Round 2/3β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββ 1. Analyze arch βββ Claude βββββββββββββββββββ β
β β β
Completed Β· 45s β β
β ββββββββββββββββββββββββ¬βββββββββββββββββββββββββ β
β ββββββ΄βββββ β
β βΌ βΌ β
β ββ 2. Write tests β Copilotβ ββ 3. Refactor ββ Claude βββ
β β π΅ Running Β· Bash β β π΅ Running Β· Edit ββ
β ββββββββββββββββ¬ββββββββββββ ββββββββββ¬ββββββββββββββ
β ββββββββββ¬ββββββββββββββ β
β βΌ β
β ββ 4. Verify integration βββ Claude βββββββββββββ β
β β β Blocked Β· waiting for #2, #3 β β
β βββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β [Cancel All] β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Child session navigation: Child sessions appear naturally in the Active Sessions sidebar section. The child session titlebar shows a breadcrumb "β Back to Team Task" to return to the Dashboard.
Task Decomposition Strategy
- LLM proposes + user confirms: The Orchestrator sends a structured prompt; the LLM returns a JSON subtask array (with
dependsOn dependencies)
- Engine recommendation: The prompt describes each engine's strengths; the LLM recommends engine assignments; users can freely change these in the confirmation UI
- Same-engine multi-session: A single engine can run multiple parallel sessions (each in its own worktree) β even single-engine setups benefit from orchestration
Data Model
interface OrchestrationRun {
id: string;
parentSessionId: string; // orchestrator session
directory: string;
status: "setup" | "decomposing" | "confirming" | "dispatching"
| "running" | "aggregating" | "completed" | "failed" | "cancelled";
prompt: string;
engineTypes: EngineType[];
subtasks: OrchestrationSubtask[];
resultSummary?: string;
createdAt: number;
completedAt?: number;
}
interface OrchestrationSubtask {
id: string;
description: string;
engineType: EngineType;
dependsOn: string[]; // subtask IDs
sessionId?: string;
worktreeId?: string;
needsWorktree: boolean;
status: "blocked" | "pending" | "running" | "completed" | "failed";
resultSummary?: string;
error?: string;
duration?: number;
toolUses?: number;
}
Implementation Steps
| Step |
File |
Operation |
Description |
| 1 |
src/types/unified.ts |
Modify |
Add OrchestrationRun/Subtask types and Gateway message types |
| 2 |
electron/main/services/orchestrator-service.ts |
New |
Core orchestration service: DAG execution, context injection, result aggregation |
| 3 |
electron/main/gateway/ws-server.ts |
Modify |
Route orchestration requests + broadcast orchestration.updated events |
| 4 |
electron/main/index.ts |
Modify |
Initialize OrchestratorService |
| 5 |
src/lib/gateway-api.ts |
Modify |
Frontend API methods + notification handler |
| 6 |
src/stores/orchestration.ts |
New |
Orchestration state store |
| 7 |
src/components/TeamTaskSection.tsx |
New |
Sidebar Team Tasks section |
| 8 |
src/components/SessionSidebar.tsx |
Modify |
Insert TeamTaskSection |
| 9 |
src/components/OrchestrationDashboard.tsx |
New |
Main Dashboard component (4-phase views) |
| 10 |
src/pages/Chat.tsx |
Modify |
View switching + child session breadcrumb navigation |
Reused Existing Infrastructure
WorktreeManager.create/remove/merge β worktree lifecycle management
EngineManager.createSession/sendMessage β session lifecycle management
ScheduledTaskService permission auto-approve pattern β unattended subtask execution
computeActiveSessions β child sessions automatically appear in Active Sessions
getEngineBadge() / StatusIndicator β engine badges and status icon reuse
Phase 2: Intelligence
Phase 3: Advanced
ποΈ Why CodeMux Is Uniquely Positioned
| Existing Infrastructure |
How It Enables Agent Team |
| EngineManager + multi-session routing |
Natural foundation for parallel session dispatch |
| WorktreeManager |
Code isolation between parallel agents is already built |
| Unified Type System |
Results from any engine already normalized β aggregation is straightforward |
| WebSocket Gateway |
Real-time progress streaming to all clients (desktop, browser, IM) |
| IM Channel Adapters |
Agent Team results accessible from Feishu/DingTalk/Telegram |
| ScheduledTaskService |
Permission auto-approve pattern reusable for unattended subtask execution |
| Permission/Question System |
Supports human-in-the-loop approval during orchestration |
π€ Design Decisions (Resolved)
| Question |
Decision |
| Orchestrator implementation |
OrchestratorService as a layer above EngineManager, using LLM for task decomposition |
| Task decomposition strategy |
LLM-driven decomposition with user confirmation/editing in UI |
| Scope of first iteration |
Jump directly to cross-engine orchestration (same-engine internal parallelism deferred to Agent Team) |
| Inter-session communication |
Hub-and-Spoke: Orchestrator extracts upstream results β injects into downstream prompts |
| Execution model |
DAG-based with multi-round iteration, not simple parallel-then-aggregate |
| UX approach |
Explicit UI (Sidebar section + Dashboard), no slash commands |
π Related
This feature would make CodeMux the first multi-engine AI coding client with cross-engine collaborative agent workflows β a capability that no single-engine tool (Claude Code, Copilot, Cursor, etc.) can offer on its own.
π‘ Vision
CodeMux already unifies multiple AI coding engines (OpenCode, Copilot, Claude Code) under a single gateway. The next leap is enabling these engines to work together as a team β automatically decomposing complex tasks and distributing subtasks across engines/sessions in parallel, each working in an isolated environment, then aggregating results back to the user.
This is not about wrapping a single engine's sub-agent system (like Claude Code's internal Agent tool). Instead, it's about building a cross-engine orchestration layer that is unique to CodeMux's multi-engine architecture β something no single-engine tool can achieve.
π― Core Concept
π§ Claude Agent Team vs CodeMux Orchestration
Claude Code already has built-in Agent Team capabilities (
AgentInput.team_name,agents,TeammateIdlehook) for sub-agent parallelism within a single session. This is fundamentally different from what CodeMux orchestration provides:Conclusion: Intra-engine parallelism is deferred to Agent Team's own mechanism. CodeMux focuses on cross-engine orchestration and user-controlled task decomposition. Even with a single engine, CodeMux provides true file-level worktree isolation that Agent Team cannot achieve.
β¨ Roadmap
Phase 0: Sub-agent Visibility β (PR #99, merged)
Capture previously-dropped SDK messages (
task_started,task_progress,task_notification,tool_progress) inClaudeCodeAdapterand surface real-time sub-agent activity in the UI:RunningToolCardshows current subtool name and tool-use count during executionTaskToolcompleted state displays AI-generated summary and tool-use statsPhase 1: Cross-Engine Task Orchestration π§
Core Architecture: Hub-and-Spoke
Sessions do not communicate directly. All information flows through the Orchestrator (an LLM session):
Execution Model: DAG + Multi-Round Iteration
Rather than simple "parallel dispatch β wait all β aggregate", execution follows a dependency graph with iterative rounds:
Execution loop:
Context injection (the core mechanism for inter-session communication):
When a downstream subtask starts, the Orchestrator injects upstream results into its prompt:
UX Design: Explicit UI, No Slash Commands
Entry point: A new "Team Tasks" collapsible section in the sidebar (between Active Sessions and Scheduled Tasks):
4-phase view (main content area switches to Orchestration Dashboard):
Execution Dashboard example with DAG visualization:
Child session navigation: Child sessions appear naturally in the Active Sessions sidebar section. The child session titlebar shows a breadcrumb "β Back to Team Task" to return to the Dashboard.
Task Decomposition Strategy
dependsOndependencies)Data Model
Implementation Steps
src/types/unified.tselectron/main/services/orchestrator-service.tselectron/main/gateway/ws-server.tselectron/main/index.tssrc/lib/gateway-api.tssrc/stores/orchestration.tssrc/components/TeamTaskSection.tsxsrc/components/SessionSidebar.tsxsrc/components/OrchestrationDashboard.tsxsrc/pages/Chat.tsxReused Existing Infrastructure
WorktreeManager.create/remove/mergeβ worktree lifecycle managementEngineManager.createSession/sendMessageβ session lifecycle managementScheduledTaskServicepermission auto-approve pattern β unattended subtask executioncomputeActiveSessionsβ child sessions automatically appear in Active SessionsgetEngineBadge()/StatusIndicatorβ engine badges and status icon reusePhase 2: Intelligence
Phase 3: Advanced
ποΈ Why CodeMux Is Uniquely Positioned
π€ Design Decisions (Resolved)
OrchestratorServiceas a layer above EngineManager, using LLM for task decompositionπ Related
electron/main/services/worktree-manager.tselectron/main/engines/