parallel-dev-cycle
npx skills add https://github.com/catlog22/claude-code-workflow --skill parallel-dev-cycle
Agent 安装分布
Skill 文档
Parallel Dev Cycle
Multi-agent parallel development cycle using Codex subagent pattern with four specialized workers:
- Requirements Analysis & Extension (RA) – Requirement analysis and self-enhancement
- Exploration & Planning (EP) – Codebase exploration and implementation planning
- Code Development (CD) – Code development with debug strategy support
- Validation & Archival Summary (VAS) – Validation and archival summary
Each agent maintains one main document (e.g., requirements.md, plan.json, implementation.md) that is completely rewritten per iteration, plus auxiliary logs (changes.log, debug-log.ndjson) that are append-only.
Architecture Overview
âââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââââ
â User Input (Task) â
ââââââââââââââââââââââââââââââ¬âââââââââââââââââââââââââââââââââ
â
v
ââââââââââââââââââââââââ
â Orchestrator Agent â (Coordinator)
â (spawned once) â
ââââââââââââââââââââââââ
â
ââââââââââââââââââââââ¼âââââââââââââââââââââ
â â â
v v v
ââââââââââ ââââââââââ ââââââââââ
â RA â â EP â â CD â
âAgent â âAgent â âAgent â
ââââââââââ ââââââââââ ââââââââââ
â â â
ââââââââââââââââââââââ¼âââââââââââââââââââââ
â
v
ââââââââââ
â VAS â
â Agent â
ââââââââââ
â
v
ââââââââââââââââââââââââ
â Summary Report â
â & Markdown Docs â
ââââââââââââââââââââââââ
Key Design Principles
- Main Document + Auxiliary Logs: Each agent maintains one main document (rewritten per iteration) and auxiliary logs (append-only)
- Version-Based Overwrite: Main documents completely rewritten per version; logs append-only
- Automatic Archival: Old main document versions automatically archived to
history/directory - Complete Audit Trail: Changes.log (NDJSON) preserves all change history
- Parallel Coordination: Four agents launched simultaneously; coordination via shared state and orchestrator
- File References: Use short file paths instead of content passing
- Self-Enhancement: RA agent proactively extends requirements based on context
Arguments
| Arg | Required | Description |
|---|---|---|
| TASK | One of TASK or –cycle-id | Task description (for new cycle, mutually exclusive with –cycle-id) |
| –cycle-id | One of TASK or –cycle-id | Existing cycle ID to continue (from API or previous session) |
| –extend | No | Extension description (only valid with –cycle-id) |
| –auto | No | Auto-cycle mode (run all phases sequentially without user confirmation) |
| –parallel | No | Number of parallel agents (default: 4, max: 4) |
Auto Mode
When --auto: Run all phases sequentially without user confirmation between iterations. Use recommended defaults for all decisions. Automatically continue iteration loop until tests pass or max iterations reached.
Execution Flow
Input Parsing:
ââ Parse arguments (TASK | --cycle-id + --extend)
ââ Convert to structured context (cycleId, state, progressDir)
Phase 1: Session Initialization
ââ Ref: phases/01-session-init.md
ââ Create new cycle OR resume existing cycle
ââ Initialize state file and directory structure
ââ Output: cycleId, state, progressDir
Phase 2: Agent Execution (Parallel)
ââ Ref: phases/02-agent-execution.md
ââ Tasks attached: Spawn RA â Spawn EP â Spawn CD â Spawn VAS â Wait all
ââ Spawn RA, EP, CD, VAS agents in parallel
ââ Wait for all agents with timeout handling
ââ Output: agentOutputs (4 agent results)
Phase 3: Result Aggregation & Iteration
ââ Ref: phases/03-result-aggregation.md
ââ Parse PHASE_RESULT from each agent
ââ Detect issues (test failures, blockers)
ââ Decision: Issues found AND iteration < max?
â ââ Yes â Send feedback via send_input, loop back to Phase 2
â ââ No â Proceed to Phase 4
ââ Output: parsedResults, iteration status
Phase 4: Completion & Summary
ââ Ref: phases/04-completion-summary.md
ââ Generate unified summary report
ââ Update final state
ââ Close all agents
ââ Output: final cycle report with continuation instructions
Phase Reference Documents (read on-demand when phase executes):
| Phase | Document | Purpose |
|---|---|---|
| 1 | phases/01-session-init.md | Session creation/resume and state initialization |
| 2 | phases/02-agent-execution.md | Parallel agent spawning and execution |
| 3 | phases/03-result-aggregation.md | Result parsing, feedback generation, iteration handling |
| 4 | phases/04-completion-summary.md | Final summary generation and cleanup |
Data Flow
User Input (TASK | --cycle-id + --extend)
â
[Parse Arguments]
â cycleId, state, progressDir
Phase 1: Session Initialization
â cycleId, state, progressDir (initialized/resumed)
Phase 2: Agent Execution
â agentOutputs {ra, ep, cd, vas}
Phase 3: Result Aggregation
â parsedResults, hasIssues, iteration count
â [Loop back to Phase 2 if issues and iteration < max]
Phase 4: Completion & Summary
â finalState, summaryReport
Return: cycle_id, iterations, final_state
Session Structure
{projectRoot}/.workflow/.cycle/
âââ {cycleId}.json # Master state file
âââ {cycleId}.progress/
âââ ra/
â âââ requirements.md # Current version (complete rewrite)
â âââ changes.log # NDJSON complete history (append-only)
â âââ history/ # Archived snapshots
âââ ep/
â âââ exploration.md # Codebase exploration report
â âââ architecture.md # Architecture design
â âââ plan.json # Structured task list (current version)
â âââ changes.log # NDJSON complete history
â âââ history/
âââ cd/
â âââ implementation.md # Current version
â âââ debug-log.ndjson # Debug hypothesis tracking
â âââ changes.log # NDJSON complete history
â âââ history/
âââ vas/
â âââ summary.md # Current version
â âââ changes.log # NDJSON complete history
â âââ history/
âââ coordination/
âââ timeline.md # Execution timeline
âââ decisions.log # Decision log
State Management
Master state file: {projectRoot}/.workflow/.cycle/{cycleId}.json
{
"cycle_id": "cycle-v1-20260122T100000-abc123",
"title": "Task title",
"description": "Full task description",
"status": "created | running | paused | completed | failed",
"created_at": "ISO8601", "updated_at": "ISO8601",
"max_iterations": 5, "current_iteration": 0,
"agents": {
"ra": { "status": "idle | running | completed | failed", "output_files": [] },
"ep": { "status": "idle", "output_files": [] },
"cd": { "status": "idle", "output_files": [] },
"vas": { "status": "idle", "output_files": [] }
},
"current_phase": "init | ra | ep | cd | vas | aggregation | complete",
"completed_phases": [],
"requirements": null, "plan": null, "changes": [], "test_results": null,
"coordination": { "feedback_log": [], "blockers": [] }
}
Recovery: If state corrupted, rebuild from .progress/ markdown files and changes.log.
TodoWrite Pattern
Phase-Level Tracking (Tasks Attached)
[
{"content": "Phase 1: Session Initialization", "status": "completed"},
{"content": "Phase 2: Agent Execution", "status": "in_progress"},
{"content": " â Spawn RA Agent", "status": "completed"},
{"content": " â Spawn EP Agent", "status": "completed"},
{"content": " â Spawn CD Agent", "status": "in_progress"},
{"content": " â Spawn VAS Agent", "status": "pending"},
{"content": "Phase 3: Result Aggregation", "status": "pending"},
{"content": "Phase 4: Completion & Summary", "status": "pending"}
]
Phase-Level Tracking (Collapsed)
[
{"content": "Phase 1: Session Initialization", "status": "completed"},
{"content": "Phase 2: Agent Execution (4 agents completed)", "status": "completed"},
{"content": "Phase 3: Result Aggregation", "status": "in_progress"},
{"content": "Phase 4: Completion & Summary", "status": "pending"}
]
Iteration Loop Tracking
[
{"content": "Phase 1: Session Initialization", "status": "completed"},
{"content": "Iteration 1: Agent Execution + Aggregation", "status": "completed"},
{"content": "Iteration 2: Feedback â Re-execution â Aggregation", "status": "in_progress"},
{"content": "Phase 4: Completion & Summary", "status": "pending"}
]
Versioning
- 1.0.0: Initial cycle â 1.x.0: Each iteration (minor bump)
- Each iteration: archive old â complete rewrite â append changes.log
Archive: copy requirements.md â history/requirements-v1.0.0.md
Rewrite: overwrite requirements.md with v1.1.0 (complete new content)
Append: changes.log â {"timestamp","version":"1.1.0","action":"update","description":"..."}
| Agent Output | Rewrite (per iteration) | Append-only |
|---|---|---|
| RA | requirements.md | changes.log |
| EP | exploration.md, architecture.md, plan.json | changes.log |
| CD | implementation.md, issues.md | changes.log, debug-log.ndjson |
| VAS | summary.md, test-results.json | changes.log |
Coordination Protocol
Execution Order: RA â EP â CD â VAS (dependency chain, all spawned in parallel but block on dependencies)
Agent â Orchestrator: Each agent outputs PHASE_RESULT: block:
PHASE_RESULT:
- phase: ra | ep | cd | vas
- status: success | failed | partial
- files_written: [list]
- summary: one-line summary
- issues: []
Orchestrator â Agent: Feedback via send_input (file refs + issue summary, never full content):
## FEEDBACK FROM [Source]
[Issue summary with file:line references]
## Reference
- File: .progress/vas/test-results.json (v1.0.0)
## Actions Required
1. [Specific fix]
Rules: Only orchestrator writes state file. Agents read state, write to own .progress/{agent}/ directory only.
Core Rules
- Start Immediately: First action is TodoWrite initialization, then Phase 1 execution
- Progressive Phase Loading: Read phase docs ONLY when that phase is about to execute
- Parse Every Output: Extract PHASE_RESULT data from each agent for next phase
- Auto-Continue: After each phase, execute next pending phase automatically
- Track Progress: Update TodoWrite dynamically with attachment/collapse pattern
- Single Writer: Only orchestrator writes to master state file; agents report via PHASE_RESULT
- File References: Pass file paths between agents, not content
- DO NOT STOP: Continuous execution until all phases complete or max iterations reached
Error Handling
| Error Type | Recovery |
|---|---|
| Agent timeout | send_input requesting convergence, then retry |
| State corrupted | Rebuild from progress markdown files and changes.log |
| Agent failed | Re-spawn agent with previous context |
| Conflicting results | Orchestrator sends reconciliation request |
| Missing files | RA/EP agents identify and request clarification |
| Max iterations reached | Generate summary with remaining issues documented |
Coordinator Checklist
Before Each Phase
- Read phase reference document
- Check current state for dependencies
- Update TodoWrite with phase tasks
After Each Phase
- Parse agent outputs (PHASE_RESULT)
- Update master state file
- Collapse TodoWrite sub-tasks
- Determine next action (continue / iterate / complete)
Reference Documents
| Document | Purpose |
|---|---|
| roles/ | Agent role definitions (RA, EP, CD, VAS) |
Usage
# Start new cycle
/parallel-dev-cycle TASK="Implement real-time notifications"
# Continue cycle
/parallel-dev-cycle --cycle-id=cycle-v1-20260122-abc123
# Iteration with extension
/parallel-dev-cycle --cycle-id=cycle-v1-20260122-abc123 --extend="Also add email notifications"
# Auto mode
/parallel-dev-cycle --auto TASK="Add OAuth authentication"