From workflowx
Provides orchestratorX workflow handbook with planning dialogue, Mode A/B/C workflows, iteration loop, Hybrid Tree routing, requirement change handling, and Auto-Routing. Useful for managing multi-agent orchestration sessions.
How this skill is triggered — by the user, by Claude, or both
Slash command
/workflowx:orchestrator-playbookThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> **Positioning**: orchestratorX's complete workflow handbook. Contains main workflow logic and on-demand trigger modules.
Positioning: orchestratorX's complete workflow handbook. Contains main workflow logic and on-demand trigger modules.
| # | Module | Trigger | File Path |
|---|---|---|---|
| 1 | Environment Init + MCP Degradation | First entry to xwhole/xlocal/xunit | modules/01-environment-init.md |
| 2 | Bus Payload Validation | Cross-agent handoff (coderX <-> evaluatorX) | modules/02-bus-payload.md |
| 3 | Post-Evaluation Document Update | After evaluatorX returns | modules/03-post-evaluation.md |
| 5 | Parallel Setup | /xwhole -parallel triggered | modules/05-parallel-setup.md |
| 6 | Task Coordination | Module 05 completed, continuous runtime | modules/06-task-coordination.md |
| 8 | Discovery & Solution Design | xwhole only: Phase 1 (exploration and design consensus) | modules/08-requirements-discovery.md |
| 9 | Workflow State Tracking | All checkpoints during workflow execution | modules/09-workflow-state.md |
Note: Module 00 (Auto-Routing) has been superseded by .claude/skills/auto-routing/SKILL.md — the consolidated routing specification for the main Claude agent. orchestratorX always receives an explicit mode parameter (Mode: xwhole/xlocal/xunit) and does NOT perform mode selection itself.
Loading rule (Optimized):
module_cache). Subsequent accesses read from cache instead of disk.orchestratorX responsibility: Parse parameters from
$ARGUMENTSbefore workflow execution.
| Parameter | Format | Scope | Default | Description |
|---|---|---|---|---|
-N | -N [number] | xwhole, xlocal | 2 | Maximum evaluation iteration rounds per Child |
-box | -box [name] | xwhole | N/A | Sandbox branch name for isolated execution |
-parallel | -parallel | xwhole | off | Enable Agent Teams parallel execution within Mode A |
-team | -team [name] | xwhole (with -parallel) | workflow-{timestamp} | Agent Team name for parallel workflow |
Step 1: Extract parameters from $ARGUMENTS
Extract sequentially from $ARGUMENTS: command name → optional flags → requirement text.
| Param | Match Rule | Default | Description |
|---|---|---|---|
| mode | Starts with /xwhole, /xlocal, /xunit, /xprompt | — | Command determines mode |
-N | Positive integer (1-10) after -N | 2 | Max evaluation iterations per Child |
-box | Branch name (alphanumeric, hyphens, underscores) after -box | skip | Sandbox branch name |
-parallel | Presence flag | off | Agent Teams parallel mode |
-team | Name after -team | workflow-{timestamp} | Team name for parallel mode |
| requirement | Remaining text after removing above params | — | User requirement |
Examples:
/xwhole -N 5 -box feature-test Add user authentication
→ mode=xwhole, N=5, box="feature-test", parallel=false, requirement="Add user authentication"
/xwhole -parallel -team my-team Implement auth module
→ mode=xwhole, N=2, parallel=true, team="my-team", requirement="Implement auth module"
Step 2: Validate parameters
-N: Must be positive integer (1-10). If invalid or missing, use default 2.-box: Must be valid branch name (alphanumeric, hyphens, underscores). If empty, skip sandbox.-parallel: No value needed. Presence flag enables Agent Teams mode within xwhole.Step 3: Remember parsed parameters
Store extracted results as session working memory (mode, iteration_limit, sandbox_branch, team_name, is_parallel, requirement). Reference directly in subsequent steps, no re-parsing.
Iteration Limit (-N):
Sandbox Branch (-box):
-box is explicitly provided
-box: Work directly on current branch, no stash/checkout needed-box: Execute full sandbox lifecycle (below)git stash → record original branch → git checkout -b {sandbox-branch} from maingit merge --ff-only {sandbox-branch} (fastest, no extra commit)git merge --squash {sandbox-branch} (single commit)git merge --no-commit --no-ff {sandbox-branch}git stash push -m "workflowX" -- file1 file2 ...git stash pop (auto-resolves if no conflicts)Rule: Every phase transition MUST write status.json using the exact template below. Do not construct JSON from memory — copy the template and fill in values.
{
"status": "xwhole",
"workflow": { "mode": "xwhole", "phase": "phase1", "started": "{ISO8601}" },
"execution": { "current_child": null, "iteration": 0, "agent": null },
"task": { "type": "coding", "subject": "{requirement_summary}" }
}
{
"status": "xwhole",
"workflow": { "mode": "xwhole", "phase": "phase2", "started": "{ISO8601}" },
"execution": { "current_child": null, "iteration": 0, "agent": null },
"task": { "type": "coding", "subject": "Generate Hybrid Tree: {requirement_summary}" }
}
{
"status": "xwhole",
"workflow": { "mode": "xwhole", "phase": "core_loop", "started": "{ISO8601}" },
"execution": { "current_child": "{first_child}.md", "iteration": 0, "agent": null },
"task": { "type": "coding", "subject": "{requirement_summary}" }
}
{
"status": "xlocal",
"workflow": { "mode": "xlocal", "phase": "core_loop", "started": "{ISO8601}" },
"execution": { "current_child": "{first_child}.md", "iteration": 0, "agent": null },
"task": { "type": "coding", "subject": "{requirement_summary}" }
}
{
"status": "xunit",
"workflow": { "mode": "xunit", "phase": "core_loop", "started": "{ISO8601}" },
"execution": { "current_child": null, "iteration": 0, "agent": "coderX" },
"task": { "type": "coding", "subject": "{requirement_summary}" }
}
{
"status": "{xwhole|xlocal}",
"workflow": { "mode": "{mode}", "phase": "waiting", "started": "{ISO8601}" },
"execution": { "current_child": null, "iteration": 0, "agent": null },
"task": { "type": "coding", "subject": "All Children completed" }
}
{
"status": "wait",
"workflow": { "mode": null, "phase": null, "started": null },
"execution": { "current_child": null, "iteration": 0, "agent": null },
"task": { "type": null, "subject": null }
}
{
"status": "normal",
"workflow": { "mode": null, "phase": null, "started": null },
"execution": { "current_child": null, "iteration": 0, "agent": null },
"task": { "type": "{analysis|git|browse}", "subject": "{task_description}" }
}
{
"status": "wait",
"workflow": { "mode": null, "phase": null, "started": null },
"execution": { "current_child": null, "iteration": 0, "agent": null },
"task": { "type": null, "subject": null }
}
isolation="worktree". Each agent works in an independent directory; branches merge back after completion.-box): When specified, creates a physically isolated sandbox branch. Before: stash, record original branch, create sandbox branch. After: merge worktree branches into sandbox, switch back, --no-commit --no-ff merge sandbox into original, restore stash.-N overrides). If limit reached and still failing, stop and report to human.env_init → phase1 templatephase1 template (phase already set above)phase1 → phase2 templatephase2 → core_loop templatecore_loop → waiting templateexit signal → wait template-parallel)When -parallel is specified, Mode A uses Agent Teams for parallel execution instead of sequential sub-agent dispatch:
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1), Claude Code v2.1.32+.claude/agents/coder-teammate.md: Code implementation teammate.claude/agents/evaluator-teammate.md: Code evaluation teammate.hybrid/[feature]/ directory exists with Hybrid Tree → use directlyenv_init → core_loop (xlocal) template (skip phase1/phase2)core_loop → waiting templateexit signal → wait templatekarpathy-guidelines, does not load codex-spec-implementation, no Bus Payload needed.env_init → core_loop (xunit) templateexit signal → wait templateMode A entry: Environment init (module 01) -> Phase 1: Discovery & Solution Design (module 08) -> user confirms -> Phase 2: Document Generation (Hybrid Tree creation) -> Core Iteration Loop
Phase 1: Discovery & Solution Design (module 08) — thinking and design stage:
Phase 2: Document Generation — triggered by user confirmation:
.hybrid/[feature]/ directoryCore behaviors (Phase 1):
Each turn follows this flow:
Full specification: modules/08-requirements-discovery.md
Phase 1 exit criteria:
Phase 1 exit signal template:
方案设计完成。以下是推荐方案:
[Brief design consensus summary]
等待你确认方案后,我会生成 Hybrid Tree 并启动开发流程。
Phase 2 entry:
When the user triggers Summary:
mcp/server-memory for the current session, generate a structured knowledge graphWrite confirmed findings into appropriate sections during Hybrid Tree creation:
| Finding Type | Target Section |
|---|---|
| Confirmed scope | Parent §1 Project Overview |
| Technical constraints | Parent §3 Technical Constraints |
| Edge cases | Child §7 AC |
| NFRs (security, perf) | Parent §4 NFR |
| Risk mitigations | Child §7 AC |
| Accepted risks | Parent §4 NFR |
| Cross-module dependencies | Parent §8.3 Dependencies |
| File index | Parent §8.1 (shared), Child §8.1 (private) |
| Knowledge insights | Parent §8.2 Knowledge Graph |
All planning outputs must use the Hybrid Tree structure. Regardless of requirement size, generate one Parent + at least one Child.
Design principles:
Creation flow:
.hybrid/[feature-name]/Template: Strictly follow hybrid-template.md. Section numbers and physical order must not change (adapted for Token caching: static sections first, incremental middle, dynamic last).
coderX and evaluatorX receive (Parent, Child) paths, then read according to the following scope:
| Document | Section | Content | Readers | Cache Strategy |
|---|---|---|---|---|
| Parent | 0-6 | Global spec (NFR, DoD, Scope) | coderX, evaluatorX | Session Cache: Read once, cache entire block. Invalidate only on requirement change. |
| Parent | 7 | Routing table (not AC source) | coderX | Session Cache: Read once per iteration round. |
| Parent | 8.1 | Shared file index | coderX, evaluatorX | Session Cache: Read once, invalidate on file structure change. |
| Parent | 8.2 | Knowledge graph outlines (details via MCP) | coderX, evaluatorX | Session Cache: Read once per session. |
| Parent | 8.3 | Cross-branch dependencies | coderX, evaluatorX | Session Cache + Invalidation: Read once, invalidate on requirement change only. |
| Child | 7 | Branch AC (evaluation target) | coderX, evaluatorX | No Cache: Changes frequently during iteration. |
| Child | 8.1 | Private file index | coderX, evaluatorX | Session Cache: Read once, invalidate on file change. |
| Child | 8.2 | Incremental references | coderX | No Cache: Iteration-specific. |
| Child | 9 | Prior evaluation results | evaluatorX (for inheritance) | No Cache: Changes every iteration. |
Shared by Mode A and Mode B (with Hybrid Tree).
Purpose: Guarantee status.json is always synchronized with actual workflow state.
Enforcement: This protocol runs before AND after every agent dispatch. Skipping any step is forbidden.
□ Step 1: Read .hybrid/status.json
□ Step 2: Verify status matches current workflow (xwhole/xlocal/xunit)
□ Step 3: Update execution fields:
- execution.current_child = target Child filename
- execution.agent = "coderX" or "evaluatorX"
- execution.iteration = current round number
□ Step 4: Write .hybrid/status.json (full overwrite)
□ Step 5: THEN dispatch agent
Template — Pre-dispatch for coderX:
{
"status": "{xwhole|xlocal}",
"workflow": { "mode": "{mode}", "phase": "core_loop", "started": "{ISO}" },
"execution": { "current_child": "{child-name}", "iteration": {N}, "agent": "coderX" },
"task": { "type": "coding", "subject": "{brief description}" }
}
Template — Pre-dispatch for evaluatorX:
{
"status": "{xwhole|xlocal}",
"workflow": { "mode": "{mode}", "phase": "core_loop", "started": "{ISO}" },
"execution": { "current_child": "{child-name}", "iteration": {N}, "agent": "evaluatorX" },
"task": { "type": "analysis", "subject": "Evaluate {child-name} round {N}" }
}
□ Step 1: Read .hybrid/status.json
□ Step 2: Update execution fields:
- execution.agent = null
- (keep current_child and iteration unchanged until next dispatch)
□ Step 3: Write .hybrid/status.json (full overwrite)
Template — Post-dispatch cleanup:
{
"status": "{xwhole|xlocal}",
"workflow": { "mode": "{mode}", "phase": "core_loop", "started": "{ISO}" },
"execution": { "current_child": "{child-name}", "iteration": {N}, "agent": null },
"task": { "type": "coding", "subject": "{brief description}" }
}
□ Step 1: Read .hybrid/status.json
□ Step 2: Update execution fields:
- execution.current_child = NEW child filename
- execution.iteration = 0 (reset)
- execution.agent = null
□ Step 3: Write .hybrid/status.json
□ Step 4: THEN dispatch coderX for new Child
1. Read Parent Section 7 → extract all Children
2. Read Parent Section 8.3 → extract dependency edges (CACHE THIS)
3. Build adjacency list + in-degree map:
- in_degree[child] = number of dependencies
- adj[parent_dep] = [children that depend on it]
4. Initialize per-child iteration counters:
- child_iterations[child] = { used: 0, remaining: sessionParams.iteration_limit }
5. Initialize ready_queue (FIFO):
- For each child where in_degree[child] == 0 → push to ready_queue
6. Critical Path Analysis (Optimized):
- Identify critical path: longest dependency chain
- Identify high-impact nodes: children with most dependents
- Priority score: impact_score = number_of_dependents + (1 / chain_position)
- Sort ready_queue by priority (highest first)
While ready_queue is not empty:
current = ready_queue.dequeue()
0. ITERATION CHECK:
- If child_iterations[current].remaining <= 0:
mark as "Limit Reached", report to human, continue to next
1. [STATUS CHECK] Execute Pre-Dispatch Checklist (coderX):
- Read status.json → update current_child, iteration, agent="coderX" → write status.json
2. Dispatch coderX: (Parent, current) + [prior Fix Instructions, if any]
3. coderX implements, outputs Change Summary Payload
4. [STATUS CHECK] Execute Post-Dispatch Checklist:
- Read status.json → set agent=null → write status.json
5. [STATUS CHECK] Execute Pre-Dispatch Checklist (evaluatorX):
- Read status.json → update agent="evaluatorX" → write status.json
6. Validate Payload (module 02), forward to evaluatorX: (Parent, current, Change Summary)
7. evaluatorX evaluates, outputs Evaluation Result Payload
8. [STATUS CHECK] Execute Post-Dispatch Checklist:
- Read status.json → set agent=null → write status.json
9. Load module 03 for Post-Evaluation document update (incremental, see §6)
10. Result handling:
- PASS:
a. Mark current as PASS
b. For each dependent in adj[current]:
in_degree[dependent]--
if in_degree[dependent] == 0 → enqueue to ready_queue
- Needs Fix + child_iterations[current].remaining > 0:
a. child_iterations[current].used++
b. child_iterations[current].remaining--
c. Extract Fix Instructions -> re-enqueue current to ready_queue
- Needs Fix + child_iterations[current].remaining <= 0:
a. Mark as "Limit Reached", report to human
b. Do NOT enqueue dependents (they remain blocked)
11. [STATUS CHECK] After Child completes (PASS or Limit Reached):
- If next Child in ready_queue:
→ Execute Child Switch Checklist (current_child = next child, iteration = 0)
- If ready_queue empty (all done):
→ Update status.json: workflow.phase = "waiting", execution.agent = null
Final status update (Core Loop exits):
{
"status": "{xwhole|xlocal}",
"workflow": { "mode": "{mode}", "phase": "waiting", "started": "{ISO}" },
"execution": { "current_child": null, "iteration": 0, "agent": null },
"task": { "type": "coding", "subject": "All Children completed" }
}
### Phase 2 — Blocked Queue Resolution
If ready_queue is empty but some children not completed:
**Early Exit (Optimized)**:
- PASS → immediately mark complete, enqueue dependents, move to next in queue
- No need to check iteration limit for PASS'd children
**Per-Child Counter State**:
```javascript
child_iterations = {
"child-1": { used: 0, remaining: 2 },
"child-2": { used: 1, remaining: 1 },
// ...
}
Dispatch Format:
Parent: [path] + Child: [path] (all modes use Hybrid Tree)When Mode B has no existing PRD or Hybrid Tree, orchestratorX auto-generates a minimal Hybrid Tree before entering the Core Iteration Loop. This replaces the former Simple Iteration Loop path.
orchestratorX executes (sole document writer):
hybrid-template.md):
hybrid-template.md):
.hybrid/[feature-name]/PRD file path input: When user passes a file path (e.g. /xlocal ./docs/prd.md), read the PRD file and use its content to populate Sections 1-6 and derive AC for Section 7, instead of inferring from the raw requirement.
Requirement Change: Follow the standard Requirement Change Handling (shared by Mode A and Mode B with Hybrid Tree).
Hybrid Tree exists when:
.hybrid/[feature]/ directory contains multiple *-hybrid.md filesDocument Type: Parent contains Section 7 routing tableWhen Requirement Change Handling determines Change Type = new_branch:
Shared by Mode A and Mode B (all paths use Hybrid Tree).
orchestratorX determines whether user input changed the current Child's requirement scope. Analyze user input, determine change type:
| Change Type | Detection Criteria | Action |
|---|---|---|
| Adjustment | Modifying existing AC of current Child | Update current Child |
| Optimization | Refining existing functionality of current Child | Update current Child |
| Scope Expansion | Adding to current Child's scope | Update current Child |
| Scope Reduction | Removing AC from current Child | Update current Child |
| New Branch Feature | Feature does not belong to any existing Child | Create new Child |
| Change Type | Confirmation Required |
|---|---|
| New Branch Feature | Yes — describe new feature, ask "Confirm creating new sub-module?" |
| Scope Expansion > 50% | Yes — describe expansion, ask "Confirm scope expansion?" |
| Scope Reduction (removing AC) | Yes — list deleted ACs, ask "Confirm deleting these acceptance criteria?" |
| Adjustment / Optimization | No — proceed directly |
If user rejects, discard the change and resume original flow.
Read change analysis results, execute:
Identify affected Children:
Constraints: traceability (all changes traceable to user description), Parent Sections 0-6 not modified, MECE principle.
new_branch: follow Child Creation FlowDelegated: Full routing logic is in
.claude/skills/auto-routing/SKILL.md. orchestratorX receives an explicit mode parameter and does NOT perform routing itself.
/xwhole, /xlocal, /xunit. Parallel execution via /xwhole -parallel.orchestrator-playbook/hybrid-template.md). unit exempt..hybrid/.workflow-lock. If lock exists, warn user and abort. Otherwise, create lock file with timestamp and mode. Remove lock on workflow completion or interruption.npx claudepluginhub treex-x/workflowx --plugin workflowxClassifies user requests and routes them to the correct handler based on status gate, workflow mode, and intent analysis. Used as the main entry point before dispatching orchestratorX.
Orchestrates plan-driven builds by reading plan.json or requirements.md and dispatching workers. Use when executing /execute or running a blueprint plan.
Orchestrates parallel multi-agent Evaluate-Loop v3 workflows for code tracks. Handles /go goals, worker dispatch, board deliberation, message bus monitoring, and metadata.json state tracking.