unified-execute-parallel
Codex Unified-Execute-Parallel Workflow
Quick Start
Execute tasks for a specific execution group in isolated Git worktree.
Core workflow: Load Plan → Select Group → Create Worktree → Execute Tasks → Mark Complete
Key features:
- Worktree isolation: Each group executes in
.ccw/worktree/{group-id}/ - Parallel execution: Multiple codex instances can run different groups simultaneously
- Simple focus: Execute only, merge handled by separate command
Overview
- Plan & Group Selection - Load plan, select execution group
- Worktree Setup - Create Git worktree for group's branch
- Task Execution - Execute group tasks serially in worktree
- Mark Complete - Record completion status
Note: Merging is handled by /workflow:worktree-merge command.
Output Structure
.ccw/worktree/
├── {group-id}/ # Git worktree for group
│ ├── (full project checkout)
│ └── .execution/ # Execution artifacts
│ ├── execution.md # Task overview
│ └── execution-events.md # Execution log
.workflow/.execution/
└── worktree-status.json # ⭐ All groups completion status
Implementation Details
Session Variables
planPath: Path to plan filegroupId: Selected execution group ID (required)worktreePath:.ccw/worktree/{groupId}branchName: From execution-groups.jsonautoCommit: Boolean for auto-commit modedryRun: Boolean for dry-run mode
Phase 1: Plan & Group Selection
Objective: Load plan, extract group metadata, filter tasks.
Step 1.1: Load Plan File
Read plan file and execution-groups.json from same directory.
Required Files:
plan-note.mdorplan.json- Task definitionsexecution-groups.json- Group metadata with branch names
Step 1.2: Select Group
Validate GROUP parameter.
Validation:
- Group exists in execution-groups.json
- Group has assigned tasks
- Branch name is defined
Step 1.3: Filter Group Tasks
Extract only tasks belonging to selected group.
Task Filtering:
- Match by
execution_groupfield, OR - Match by
domainif domain in group.domains
Build execution order from filtered tasks.
Phase 2: Worktree Setup
Objective: Create Git worktree for isolated execution.
Step 2.1: Create Worktree Directory
Ensure worktree base directory exists.
mkdir -p .ccw/worktree
Step 2.2: Create Git Worktree
Create worktree with group's branch.
If worktree doesn't exist:
# Create branch and worktree
git worktree add -b {branch-name} .ccw/worktree/{group-id} main
If worktree exists:
# Verify worktree is on correct branch
cd .ccw/worktree/{group-id}
git status
Branch Naming: From execution-groups.json branch_name field.
Step 2.3: Initialize Execution Folder
Create execution tracking folder inside worktree.
mkdir -p .ccw/worktree/{group-id}/.execution
Create initial execution.md:
- Group ID and branch name
- Task list for this group
- Start timestamp
Success Criteria:
- Worktree created at
.ccw/worktree/{group-id}/ - Working on correct branch
- Execution folder initialized
Phase 3: Task Execution
Objective: Execute group tasks serially in worktree.
Step 3.1: Change to Worktree Directory
All execution happens inside worktree.
cd .ccw/worktree/{group-id}
Step 3.2: Execute Tasks Sequentially
For each task in group:
- Execute via CLI in worktree directory
- Record result in
.execution/execution-events.md - Auto-commit if enabled
- Continue to next task
CLI Execution:
--cd .ccw/worktree/{group-id}- Execute in worktree--mode write- Allow file modifications
Step 3.3: Record Progress
Update .execution/execution-events.md after each task:
- Task ID and title
- Timestamp
- Status (completed/failed)
- Files modified
Step 3.4: Auto-Commit (if enabled)
Commit task changes in worktree.
cd .ccw/worktree/{group-id}
git add .
git commit -m "feat: {task-title} [TASK-{id}]"
Phase 4: Mark Complete
Objective: Record group completion status.
Step 4.1: Update worktree-status.json
Write/update status file in main project.
worktree-status.json (in .workflow/.execution/):
{
"plan_session": "CPLAN-auth-2025-02-03",
"groups": {
"EG-001": {
"worktree_path": ".ccw/worktree/EG-001",
"branch": "feature/cplan-auth-eg-001-frontend",
"status": "completed",
"tasks_total": 15,
"tasks_completed": 15,
"tasks_failed": 0,
"completed_at": "2025-02-03T14:30:00Z"
},
"EG-002": {
"status": "in_progress",
"tasks_completed": 8,
"tasks_total": 12
}
}
}
Step 4.2: Display Summary
Report group execution results:
- Group ID and worktree path
- Tasks completed/failed
- Next step: Use
/workflow:worktree-mergeto merge
Configuration
| Parameter | Default | Description |
|---|---|---|
PLAN |
Auto-detect | Path to plan file |
GROUP |
Required | Execution group ID (e.g., EG-001) |
--auto-commit |
false | Commit after each task |
--dry-run |
false | Simulate without changes |
Error Handling
| Situation | Action |
|---|---|
| GROUP missing | Error: Require GROUP parameter |
| Group not found | Error: Check execution-groups.json |
| Worktree exists with wrong branch | Warning: Clean or remove existing worktree |
| Task fails | Record failure, continue to next |
Parallel Execution Example
3 terminals, 3 groups:
# Terminal 1
PLAN=".workflow/.planning/CPLAN-auth/plan-note.md" GROUP="EG-001" --auto-commit
# Terminal 2
PLAN=".workflow/.planning/CPLAN-auth/plan-note.md" GROUP="EG-002" --auto-commit
# Terminal 3
PLAN=".workflow/.planning/CPLAN-auth/plan-note.md" GROUP="EG-003" --auto-commit
Each executes in isolated worktree:
.ccw/worktree/EG-001/.ccw/worktree/EG-002/.ccw/worktree/EG-003/
After all complete, use /workflow:worktree-merge to merge.
Now execute unified-execute-parallel for: $PLAN with GROUP=$GROUP
More from catlog22/claude-code-workflow
skill-generator
Meta-skill for creating new Claude Code skills with configurable execution modes. Supports sequential (fixed order) and autonomous (stateless) phase patterns. Use for skill scaffolding, skill creation, or building new workflows. Triggers on "create skill", "new skill", "skill generator".
127ccw-help
CCW command help system. Search, browse, recommend commands, skills, teams. Triggers "ccw-help", "ccw-issue".
70workflow-skill-designer
Meta-skill for designing orchestrator+phases structured workflow skills. Creates SKILL.md coordinator with progressive phase loading, TodoWrite patterns, and data flow. Triggers on "design workflow skill", "create workflow skill", "workflow skill designer".
64analyze-with-file
Interactive collaborative analysis with documented discussions, inline exploration, and evolving understanding.
62workflow-test-fix-cycle
End-to-end test-fix workflow generate test sessions with progressive layers (L0-L3), then execute iterative fix cycles until pass rate >= 95%. Combines test-fix-gen and test-cycle-execute into a unified pipeline. Triggers on \"workflow:test-fix-cycle\".
60clean
Intelligent code cleanup with mainline detection, stale artifact discovery, and safe execution. Supports targeted cleanup and confirmation.
58