claude-code-workflow 6.3.37 → 6.3.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/commands/workflow/lite-execute.md +2 -0
- package/.codex/agents/action-planning-agent.md +885 -0
- package/.codex/agents/ccw-loop-b-complete.md +227 -0
- package/.codex/agents/ccw-loop-b-debug.md +172 -0
- package/.codex/agents/ccw-loop-b-develop.md +147 -0
- package/.codex/agents/ccw-loop-b-init.md +82 -0
- package/.codex/agents/ccw-loop-b-validate.md +204 -0
- package/.codex/agents/ccw-loop-executor.md +260 -0
- package/.codex/agents/cli-discuss-agent.md +391 -0
- package/.codex/agents/cli-execution-agent.md +333 -0
- package/.codex/agents/cli-explore-agent.md +186 -0
- package/.codex/agents/cli-lite-planning-agent.md +736 -0
- package/.codex/agents/cli-planning-agent.md +562 -0
- package/.codex/agents/code-developer.md +408 -0
- package/.codex/agents/conceptual-planning-agent.md +321 -0
- package/.codex/agents/context-search-agent.md +585 -0
- package/.codex/agents/debug-explore-agent.md +436 -0
- package/.codex/agents/doc-generator.md +334 -0
- package/.codex/agents/issue-plan-agent.md +417 -0
- package/.codex/agents/issue-queue-agent.md +311 -0
- package/.codex/agents/memory-bridge.md +96 -0
- package/.codex/agents/test-context-search-agent.md +402 -0
- package/.codex/agents/test-fix-agent.md +359 -0
- package/.codex/agents/ui-design-agent.md +595 -0
- package/.codex/agents/universal-executor.md +135 -0
- package/.codex/prompts/clean.md +409 -0
- package/.codex/prompts/issue-discover-by-prompt.md +364 -0
- package/.codex/prompts/issue-discover.md +261 -0
- package/.codex/prompts/issue-execute.md +10 -0
- package/.codex/prompts/issue-new.md +285 -0
- package/.codex/prompts/issue-plan.md +161 -63
- package/.codex/prompts/issue-queue.md +298 -288
- package/.codex/prompts/lite-execute.md +627 -133
- package/.codex/prompts/lite-fix.md +670 -0
- package/.codex/prompts/lite-plan-a.md +337 -0
- package/.codex/prompts/lite-plan-b.md +485 -0
- package/.codex/prompts/{lite-plan.md → lite-plan-c.md} +601 -469
- package/.codex/skills/ccw-loop/README.md +171 -0
- package/.codex/skills/ccw-loop/SKILL.md +349 -0
- package/.codex/skills/ccw-loop/phases/actions/action-complete.md +269 -0
- package/.codex/skills/ccw-loop/phases/actions/action-debug.md +286 -0
- package/.codex/skills/ccw-loop/phases/actions/action-develop.md +183 -0
- package/.codex/skills/ccw-loop/phases/actions/action-init.md +164 -0
- package/.codex/skills/ccw-loop/phases/actions/action-menu.md +205 -0
- package/.codex/skills/ccw-loop/phases/actions/action-validate.md +250 -0
- package/.codex/skills/ccw-loop/phases/orchestrator.md +416 -0
- package/.codex/skills/ccw-loop/phases/state-schema.md +388 -0
- package/.codex/skills/ccw-loop/specs/action-catalog.md +182 -0
- package/.codex/skills/ccw-loop-b/README.md +301 -0
- package/.codex/skills/ccw-loop-b/SKILL.md +322 -0
- package/.codex/skills/ccw-loop-b/phases/orchestrator.md +257 -0
- package/.codex/skills/ccw-loop-b/phases/state-schema.md +181 -0
- package/.codex/skills/ccw-loop-b/specs/action-catalog.md +383 -0
- package/.codex/skills/parallel-dev-cycle/README.md +382 -0
- package/.codex/skills/parallel-dev-cycle/SKILL.md +512 -0
- package/.codex/skills/parallel-dev-cycle/phases/agents/code-developer.md +242 -0
- package/.codex/skills/parallel-dev-cycle/phases/agents/exploration-planner.md +285 -0
- package/.codex/skills/parallel-dev-cycle/phases/agents/requirements-analyst.md +285 -0
- package/.codex/skills/parallel-dev-cycle/phases/agents/validation-archivist.md +381 -0
- package/.codex/skills/parallel-dev-cycle/phases/orchestrator.md +696 -0
- package/.codex/skills/parallel-dev-cycle/phases/state-schema.md +436 -0
- package/.codex/skills/parallel-dev-cycle/specs/communication-optimization.md +423 -0
- package/.codex/skills/parallel-dev-cycle/specs/coordination-protocol.md +391 -0
- package/.codex/skills/parallel-dev-cycle/specs/versioning-strategy.md +330 -0
- package/ccw/dist/cli.d.ts.map +1 -1
- package/ccw/dist/cli.js +4 -0
- package/ccw/dist/cli.js.map +1 -1
- package/ccw/dist/commands/install.d.ts.map +1 -1
- package/ccw/dist/commands/install.js +39 -8
- package/ccw/dist/commands/install.js.map +1 -1
- package/ccw/dist/commands/issue.d.ts +3 -0
- package/ccw/dist/commands/issue.d.ts.map +1 -1
- package/ccw/dist/commands/issue.js +107 -0
- package/ccw/dist/commands/issue.js.map +1 -1
- package/ccw/dist/commands/upgrade.js +1 -1
- package/ccw/dist/commands/upgrade.js.map +1 -1
- package/ccw/dist/config/litellm-api-config-manager.d.ts.map +1 -1
- package/ccw/dist/config/litellm-api-config-manager.js +3 -2
- package/ccw/dist/config/litellm-api-config-manager.js.map +1 -1
- package/ccw/dist/core/memory-embedder-bridge.d.ts.map +1 -1
- package/ccw/dist/core/memory-embedder-bridge.js +2 -5
- package/ccw/dist/core/memory-embedder-bridge.js.map +1 -1
- package/ccw/dist/core/routes/cli-routes.js.map +1 -1
- package/ccw/dist/core/routes/codexlens/config-handlers.d.ts.map +1 -1
- package/ccw/dist/core/routes/codexlens/config-handlers.js +7 -6
- package/ccw/dist/core/routes/codexlens/config-handlers.js.map +1 -1
- package/ccw/dist/core/routes/codexlens/semantic-handlers.d.ts.map +1 -1
- package/ccw/dist/core/routes/codexlens/semantic-handlers.js +2 -2
- package/ccw/dist/core/routes/codexlens/semantic-handlers.js.map +1 -1
- package/ccw/dist/core/routes/graph-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/graph-routes.js +17 -2
- package/ccw/dist/core/routes/graph-routes.js.map +1 -1
- package/ccw/dist/core/routes/issue-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/issue-routes.js +280 -33
- package/ccw/dist/core/routes/issue-routes.js.map +1 -1
- package/ccw/dist/core/routes/loop-v2-routes.d.ts +9 -0
- package/ccw/dist/core/routes/loop-v2-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/loop-v2-routes.js +56 -4
- package/ccw/dist/core/routes/loop-v2-routes.js.map +1 -1
- package/ccw/dist/core/routes/system-routes.d.ts.map +1 -1
- package/ccw/dist/core/routes/system-routes.js +3 -2
- package/ccw/dist/core/routes/system-routes.js.map +1 -1
- package/ccw/dist/core/server.d.ts.map +1 -1
- package/ccw/dist/core/server.js +5 -3
- package/ccw/dist/core/server.js.map +1 -1
- package/ccw/dist/tools/claude-cli-tools.d.ts.map +1 -1
- package/ccw/dist/tools/claude-cli-tools.js +4 -3
- package/ccw/dist/tools/claude-cli-tools.js.map +1 -1
- package/ccw/dist/tools/cli-config-manager.d.ts +1 -0
- package/ccw/dist/tools/cli-config-manager.d.ts.map +1 -1
- package/ccw/dist/tools/cli-config-manager.js +2 -1
- package/ccw/dist/tools/cli-config-manager.js.map +1 -1
- package/ccw/dist/tools/codex-lens-lsp.d.ts.map +1 -1
- package/ccw/dist/tools/codex-lens-lsp.js +2 -5
- package/ccw/dist/tools/codex-lens-lsp.js.map +1 -1
- package/ccw/dist/tools/codex-lens.d.ts.map +1 -1
- package/ccw/dist/tools/codex-lens.js +22 -32
- package/ccw/dist/tools/codex-lens.js.map +1 -1
- package/ccw/dist/tools/litellm-client.d.ts +6 -0
- package/ccw/dist/tools/litellm-client.d.ts.map +1 -1
- package/ccw/dist/tools/litellm-client.js +15 -2
- package/ccw/dist/tools/litellm-client.js.map +1 -1
- package/ccw/dist/tools/loop-task-manager.d.ts +13 -2
- package/ccw/dist/tools/loop-task-manager.d.ts.map +1 -1
- package/ccw/dist/tools/loop-task-manager.js.map +1 -1
- package/ccw/dist/tools/native-session-discovery.d.ts.map +1 -1
- package/ccw/dist/tools/native-session-discovery.js +35 -7
- package/ccw/dist/tools/native-session-discovery.js.map +1 -1
- package/ccw/dist/utils/codexlens-path.d.ts +36 -0
- package/ccw/dist/utils/codexlens-path.d.ts.map +1 -0
- package/ccw/dist/utils/codexlens-path.js +56 -0
- package/ccw/dist/utils/codexlens-path.js.map +1 -0
- package/ccw/dist/utils/uv-manager.d.ts.map +1 -1
- package/ccw/dist/utils/uv-manager.js +3 -2
- package/ccw/dist/utils/uv-manager.js.map +1 -1
- package/ccw/src/cli.ts +4 -0
- package/ccw/src/commands/install.ts +51 -8
- package/ccw/src/commands/issue.ts +119 -0
- package/ccw/src/commands/upgrade.ts +1 -1
- package/ccw/src/config/litellm-api-config-manager.ts +3 -2
- package/ccw/src/core/memory-embedder-bridge.ts +2 -6
- package/ccw/src/core/routes/cli-routes.ts +1 -1
- package/ccw/src/core/routes/codexlens/config-handlers.ts +7 -6
- package/ccw/src/core/routes/codexlens/semantic-handlers.ts +2 -2
- package/ccw/src/core/routes/graph-routes.ts +18 -2
- package/ccw/src/core/routes/issue-routes.ts +308 -33
- package/ccw/src/core/routes/loop-v2-routes.ts +64 -6
- package/ccw/src/core/routes/system-routes.ts +3 -2
- package/ccw/src/core/server.ts +6 -3
- package/ccw/src/templates/dashboard-css/02-session.css +2 -0
- package/ccw/src/templates/dashboard-css/04-lite-tasks.css +103 -1
- package/ccw/src/templates/dashboard-css/32-issue-manager.css +32 -0
- package/ccw/src/templates/dashboard-js/components/cli-history.js +48 -48
- package/ccw/src/templates/dashboard-js/components/navigation.js +6 -0
- package/ccw/src/templates/dashboard-js/components/notifications.js +6 -0
- package/ccw/src/templates/dashboard-js/components/version-check.js +38 -0
- package/ccw/src/templates/dashboard-js/i18n.js +126 -0
- package/ccw/src/templates/dashboard-js/state.js +2 -0
- package/ccw/src/templates/dashboard-js/views/cli-manager.js +1 -1
- package/ccw/src/templates/dashboard-js/views/issue-manager.js +183 -1
- package/ccw/src/templates/dashboard-js/views/lite-tasks.js +55 -11
- package/ccw/src/templates/dashboard-js/views/loop-monitor.js +112 -11
- package/ccw/src/templates/dashboard.html +48 -2
- package/ccw/src/tools/claude-cli-tools.ts +4 -3
- package/ccw/src/tools/cli-config-manager.ts +3 -1
- package/ccw/src/tools/codex-lens-lsp.ts +2 -5
- package/ccw/src/tools/codex-lens.ts +27 -38
- package/ccw/src/tools/litellm-client.ts +16 -2
- package/ccw/src/tools/loop-task-manager.ts +13 -2
- package/ccw/src/tools/native-session-discovery.ts +38 -7
- package/ccw/src/utils/codexlens-path.ts +60 -0
- package/ccw/src/utils/uv-manager.ts +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1,696 @@
|
|
|
1
|
+
# Orchestrator - Multi-Agent Coordination (Codex Pattern)
|
|
2
|
+
|
|
3
|
+
Orchestrate parallel dev cycle using Codex subagent pattern with continuous iteration support.
|
|
4
|
+
|
|
5
|
+
## Role
|
|
6
|
+
|
|
7
|
+
Coordinate four specialized agents → Manage state → Support continuous iteration → Generate unified documentation.
|
|
8
|
+
|
|
9
|
+
## Codex Pattern Overview
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
Main Orchestrator Flow:
|
|
13
|
+
|
|
14
|
+
┌─── spawn_agent (orchestrator role) ────────────────────────────┐
|
|
15
|
+
│ │
|
|
16
|
+
│ Phase 1: INIT (Check control signals) │
|
|
17
|
+
│ ↓ │
|
|
18
|
+
│ wait() → Parse cycle state │
|
|
19
|
+
│ ↓ │
|
|
20
|
+
│ Phase 2: AGENT ORCHESTRATION │
|
|
21
|
+
│ ↓ │
|
|
22
|
+
│ spawn_agent(RA) | spawn_agent(EP) │
|
|
23
|
+
│ spawn_agent(CD) | spawn_agent(VAS) │
|
|
24
|
+
│ ↓ │
|
|
25
|
+
│ wait({ ids: [RA, EP, CD, VAS] }) → Collect all results │
|
|
26
|
+
│ ↓ │
|
|
27
|
+
│ Phase 3: ITERATION HANDLING │
|
|
28
|
+
│ ↓ │
|
|
29
|
+
│ [If extension needed] │
|
|
30
|
+
│ send_input to affected agents │
|
|
31
|
+
│ wait() for updated results │
|
|
32
|
+
│ ↓ │
|
|
33
|
+
│ Phase 4: AGGREGATION │
|
|
34
|
+
│ ↓ │
|
|
35
|
+
│ Merge all outputs → Generate unified documentation │
|
|
36
|
+
│ ↓ │
|
|
37
|
+
│ Update cycle state │
|
|
38
|
+
│ ↓ │
|
|
39
|
+
│ [Loop if more iterations] │
|
|
40
|
+
│ ↓ │
|
|
41
|
+
│ close_agent() when complete │
|
|
42
|
+
│ │
|
|
43
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## State Management
|
|
47
|
+
|
|
48
|
+
### Read Cycle State
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
|
|
52
|
+
|
|
53
|
+
function readCycleState(cycleId) {
|
|
54
|
+
const stateFile = `.workflow/.cycle/${cycleId}.json`
|
|
55
|
+
if (!fs.existsSync(stateFile)) {
|
|
56
|
+
return null
|
|
57
|
+
}
|
|
58
|
+
return JSON.parse(Read(stateFile))
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Create New Cycle State
|
|
63
|
+
|
|
64
|
+
```javascript
|
|
65
|
+
function createCycleState(cycleId, taskDescription) {
|
|
66
|
+
const stateFile = `.workflow/.cycle/${cycleId}.json`
|
|
67
|
+
const now = getUtc8ISOString()
|
|
68
|
+
|
|
69
|
+
const state = {
|
|
70
|
+
// Metadata
|
|
71
|
+
cycle_id: cycleId,
|
|
72
|
+
title: taskDescription.substring(0, 100),
|
|
73
|
+
description: taskDescription,
|
|
74
|
+
max_iterations: 5,
|
|
75
|
+
status: 'running',
|
|
76
|
+
created_at: now,
|
|
77
|
+
updated_at: now,
|
|
78
|
+
|
|
79
|
+
// Agent tracking
|
|
80
|
+
agents: {
|
|
81
|
+
ra: { status: 'idle', output_files: [] },
|
|
82
|
+
ep: { status: 'idle', output_files: [] },
|
|
83
|
+
cd: { status: 'idle', output_files: [] },
|
|
84
|
+
vas: { status: 'idle', output_files: [] }
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
// Phase tracking
|
|
88
|
+
current_phase: 'init',
|
|
89
|
+
completed_phases: [],
|
|
90
|
+
current_iteration: 0,
|
|
91
|
+
|
|
92
|
+
// Shared context (populated by agents)
|
|
93
|
+
requirements: null,
|
|
94
|
+
exploration: null,
|
|
95
|
+
plan: null,
|
|
96
|
+
changes: [],
|
|
97
|
+
test_results: null
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// Create directories
|
|
101
|
+
mkdir -p `.workflow/.cycle/${cycleId}.progress/{ra,ep,cd,vas,coordination}`
|
|
102
|
+
|
|
103
|
+
Write(stateFile, JSON.stringify(state, null, 2))
|
|
104
|
+
return state
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Main Execution Flow (Codex Subagent)
|
|
109
|
+
|
|
110
|
+
```javascript
|
|
111
|
+
async function runOrchestrator(options = {}) {
|
|
112
|
+
const { cycleId: existingCycleId, task, mode = 'interactive', extension } = options
|
|
113
|
+
|
|
114
|
+
console.log('=== Parallel Dev Cycle Orchestrator Started ===')
|
|
115
|
+
|
|
116
|
+
// 1. Determine cycleId and initial state
|
|
117
|
+
let cycleId
|
|
118
|
+
let state
|
|
119
|
+
|
|
120
|
+
if (existingCycleId) {
|
|
121
|
+
// Continue existing cycle
|
|
122
|
+
cycleId = existingCycleId
|
|
123
|
+
state = readCycleState(cycleId)
|
|
124
|
+
|
|
125
|
+
if (!state) {
|
|
126
|
+
console.error(`Cycle not found: ${cycleId}`)
|
|
127
|
+
return { status: 'error', message: 'Cycle not found' }
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
console.log(`Resuming cycle: ${cycleId}`)
|
|
131
|
+
if (extension) {
|
|
132
|
+
console.log(`Extension: ${extension}`)
|
|
133
|
+
state.description += `\n\n--- ITERATION ${state.current_iteration + 1} ---\n${extension}`
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
} else if (task) {
|
|
137
|
+
// Create new cycle
|
|
138
|
+
const timestamp = getUtc8ISOString().replace(/[-:]/g, '').split('.')[0]
|
|
139
|
+
const random = Math.random().toString(36).substring(2, 10)
|
|
140
|
+
cycleId = `cycle-v1-${timestamp}-${random}`
|
|
141
|
+
|
|
142
|
+
console.log(`Creating new cycle: ${cycleId}`)
|
|
143
|
+
state = createCycleState(cycleId, task)
|
|
144
|
+
|
|
145
|
+
} else {
|
|
146
|
+
console.error('Either --cycle-id or task description is required')
|
|
147
|
+
return { status: 'error', message: 'Missing cycleId or task' }
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const progressDir = `.workflow/.cycle/${cycleId}.progress`
|
|
151
|
+
|
|
152
|
+
// 2. Main orchestration loop
|
|
153
|
+
let iteration = state.current_iteration || 0
|
|
154
|
+
const maxIterations = state.max_iterations || 5
|
|
155
|
+
let continueLoop = true
|
|
156
|
+
|
|
157
|
+
while (continueLoop && iteration < maxIterations) {
|
|
158
|
+
iteration++
|
|
159
|
+
state.current_iteration = iteration
|
|
160
|
+
|
|
161
|
+
console.log(`\n========== ITERATION ${iteration} ==========`)
|
|
162
|
+
|
|
163
|
+
// 3. Spawn four agents in parallel
|
|
164
|
+
console.log('Spawning agents...')
|
|
165
|
+
|
|
166
|
+
const agents = {
|
|
167
|
+
ra: spawnRAAgent(cycleId, state, progressDir),
|
|
168
|
+
ep: spawnEPAgent(cycleId, state, progressDir),
|
|
169
|
+
cd: spawnCDAgent(cycleId, state, progressDir),
|
|
170
|
+
vas: spawnVASAgent(cycleId, state, progressDir)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// 4. Wait for all agents to complete
|
|
174
|
+
console.log('Waiting for all agents...')
|
|
175
|
+
const results = wait({
|
|
176
|
+
ids: [agents.ra, agents.ep, agents.cd, agents.vas],
|
|
177
|
+
timeout_ms: 1800000 // 30 minutes
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
if (results.timed_out) {
|
|
181
|
+
console.log('Some agents timed out, sending convergence request...')
|
|
182
|
+
Object.entries(agents).forEach(([name, id]) => {
|
|
183
|
+
if (!results.status[id].completed) {
|
|
184
|
+
send_input({
|
|
185
|
+
id: id,
|
|
186
|
+
message: `
|
|
187
|
+
## TIMEOUT NOTIFICATION
|
|
188
|
+
|
|
189
|
+
Execution timeout reached. Please:
|
|
190
|
+
1. Output current progress to markdown file
|
|
191
|
+
2. Save all state updates
|
|
192
|
+
3. Return completion status
|
|
193
|
+
`
|
|
194
|
+
})
|
|
195
|
+
}
|
|
196
|
+
})
|
|
197
|
+
continue
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// 5. Collect all agent outputs
|
|
201
|
+
const agentOutputs = {
|
|
202
|
+
ra: results.status[agents.ra].completed,
|
|
203
|
+
ep: results.status[agents.ep].completed,
|
|
204
|
+
cd: results.status[agents.cd].completed,
|
|
205
|
+
vas: results.status[agents.vas].completed
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// 6. Parse and aggregate results
|
|
209
|
+
const parsedResults = parseAgentOutputs(agentOutputs)
|
|
210
|
+
|
|
211
|
+
// Update state with agent results
|
|
212
|
+
state.agents.ra.status = 'completed'
|
|
213
|
+
state.agents.ep.status = 'completed'
|
|
214
|
+
state.agents.cd.status = 'completed'
|
|
215
|
+
state.agents.vas.status = 'completed'
|
|
216
|
+
|
|
217
|
+
state.requirements = parsedResults.ra.requirements
|
|
218
|
+
state.exploration = parsedResults.ep.exploration
|
|
219
|
+
state.plan = parsedResults.ep.plan
|
|
220
|
+
state.changes = parsedResults.cd.changes
|
|
221
|
+
state.test_results = parsedResults.vas.test_results
|
|
222
|
+
|
|
223
|
+
state.completed_phases.push(...['ra', 'ep', 'cd', 'vas'])
|
|
224
|
+
state.updated_at = getUtc8ISOString()
|
|
225
|
+
|
|
226
|
+
// Save state
|
|
227
|
+
Write(`.workflow/.cycle/${cycleId}.json`, JSON.stringify(state, null, 2))
|
|
228
|
+
|
|
229
|
+
// 7. Check for issues and determine next iteration
|
|
230
|
+
const hasIssues = parsedResults.vas.test_results?.passed === false ||
|
|
231
|
+
parsedResults.cd.issues?.length > 0
|
|
232
|
+
|
|
233
|
+
if (hasIssues && iteration < maxIterations) {
|
|
234
|
+
console.log('Issues detected, preparing for next iteration...')
|
|
235
|
+
|
|
236
|
+
// Generate feedback for agents
|
|
237
|
+
const feedback = generateFeedback(parsedResults)
|
|
238
|
+
|
|
239
|
+
// Send feedback to relevant agents
|
|
240
|
+
if (feedback.ra) {
|
|
241
|
+
send_input({
|
|
242
|
+
id: agents.ra,
|
|
243
|
+
message: feedback.ra
|
|
244
|
+
})
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
if (feedback.cd) {
|
|
248
|
+
send_input({
|
|
249
|
+
id: agents.cd,
|
|
250
|
+
message: feedback.cd
|
|
251
|
+
})
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Wait for updates
|
|
255
|
+
const updatedResults = wait({
|
|
256
|
+
ids: [agents.ra, agents.cd].filter(Boolean),
|
|
257
|
+
timeout_ms: 900000
|
|
258
|
+
})
|
|
259
|
+
|
|
260
|
+
console.log('Agents updated, continuing...')
|
|
261
|
+
|
|
262
|
+
} else if (!hasIssues) {
|
|
263
|
+
console.log('All phases completed successfully')
|
|
264
|
+
continueLoop = false
|
|
265
|
+
|
|
266
|
+
} else if (iteration >= maxIterations) {
|
|
267
|
+
console.log(`Reached maximum iterations (${maxIterations})`)
|
|
268
|
+
continueLoop = false
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// 8. Generate unified summary
|
|
273
|
+
console.log('Generating final summary...')
|
|
274
|
+
generateFinalSummary(cycleId, state)
|
|
275
|
+
|
|
276
|
+
// 9. Update final state
|
|
277
|
+
state.status = 'completed'
|
|
278
|
+
state.completed_at = getUtc8ISOString()
|
|
279
|
+
Write(`.workflow/.cycle/${cycleId}.json`, JSON.stringify(state, null, 2))
|
|
280
|
+
|
|
281
|
+
// 10. Cleanup
|
|
282
|
+
Object.values(agents).forEach(id => {
|
|
283
|
+
try {
|
|
284
|
+
close_agent({ id })
|
|
285
|
+
} catch (e) {
|
|
286
|
+
console.warn(`Failed to close agent ${id}`)
|
|
287
|
+
}
|
|
288
|
+
})
|
|
289
|
+
|
|
290
|
+
console.log('\n=== Parallel Dev Cycle Orchestrator Finished ===')
|
|
291
|
+
|
|
292
|
+
return {
|
|
293
|
+
status: 'completed',
|
|
294
|
+
cycle_id: cycleId,
|
|
295
|
+
iterations: iteration,
|
|
296
|
+
final_state: state
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
## Agent Spawning Functions
|
|
302
|
+
|
|
303
|
+
### Spawn RA Agent
|
|
304
|
+
|
|
305
|
+
```javascript
|
|
306
|
+
function spawnRAAgent(cycleId, state, progressDir) {
|
|
307
|
+
return spawn_agent({
|
|
308
|
+
message: `
|
|
309
|
+
## TASK ASSIGNMENT
|
|
310
|
+
|
|
311
|
+
### MANDATORY FIRST STEPS (Agent Execute)
|
|
312
|
+
1. **Read role definition**: ~/.codex/agents/requirements-analyst.md
|
|
313
|
+
2. Read: .workflow/project-tech.json (if exists)
|
|
314
|
+
3. Read: .workflow/project-guidelines.json (if exists)
|
|
315
|
+
4. Read: .workflow/.cycle/${cycleId}.progress/coordination/feedback.md (if exists)
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
## CYCLE CONTEXT
|
|
320
|
+
|
|
321
|
+
- **Cycle ID**: ${cycleId}
|
|
322
|
+
- **Progress Dir**: ${progressDir}/ra/
|
|
323
|
+
- **Current Iteration**: ${state.current_iteration}
|
|
324
|
+
- **Task Description**: ${state.description}
|
|
325
|
+
|
|
326
|
+
## CURRENT REQUIREMENTS STATE
|
|
327
|
+
|
|
328
|
+
${state.requirements ? JSON.stringify(state.requirements, null, 2) : 'No previous requirements'}
|
|
329
|
+
|
|
330
|
+
## YOUR ROLE
|
|
331
|
+
|
|
332
|
+
Requirements Analyst - Analyze and refine requirements throughout the cycle.
|
|
333
|
+
|
|
334
|
+
## RESPONSIBILITIES
|
|
335
|
+
|
|
336
|
+
1. Analyze initial task description
|
|
337
|
+
2. Generate comprehensive requirements specification
|
|
338
|
+
3. Identify edge cases and implicit requirements
|
|
339
|
+
4. Track requirement changes across iterations
|
|
340
|
+
5. Maintain requirements.md and changes.log
|
|
341
|
+
|
|
342
|
+
## DELIVERABLES
|
|
343
|
+
|
|
344
|
+
Write files to ${progressDir}/ra/:
|
|
345
|
+
- requirements.md: Full requirements specification
|
|
346
|
+
- edge-cases.md: Edge case analysis
|
|
347
|
+
- changes.log: NDJSON format change tracking
|
|
348
|
+
|
|
349
|
+
## OUTPUT FORMAT
|
|
350
|
+
|
|
351
|
+
\`\`\`
|
|
352
|
+
PHASE_RESULT:
|
|
353
|
+
- phase: ra
|
|
354
|
+
- status: success | failed
|
|
355
|
+
- files_written: [list]
|
|
356
|
+
- summary: one-line summary
|
|
357
|
+
- issues: []
|
|
358
|
+
\`\`\`
|
|
359
|
+
`
|
|
360
|
+
})
|
|
361
|
+
}
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Spawn EP Agent
|
|
365
|
+
|
|
366
|
+
```javascript
|
|
367
|
+
function spawnEPAgent(cycleId, state, progressDir) {
|
|
368
|
+
return spawn_agent({
|
|
369
|
+
message: `
|
|
370
|
+
## TASK ASSIGNMENT
|
|
371
|
+
|
|
372
|
+
### MANDATORY FIRST STEPS (Agent Execute)
|
|
373
|
+
1. **Read role definition**: ~/.codex/agents/exploration-planner.md
|
|
374
|
+
2. Read: .workflow/project-tech.json
|
|
375
|
+
3. Read: .workflow/project-guidelines.json
|
|
376
|
+
4. Read: ${progressDir}/ra/requirements.md
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
## CYCLE CONTEXT
|
|
381
|
+
|
|
382
|
+
- **Cycle ID**: ${cycleId}
|
|
383
|
+
- **Progress Dir**: ${progressDir}/ep/
|
|
384
|
+
- **Requirements**: See requirements.md
|
|
385
|
+
- **Current Plan**: ${state.plan ? 'Existing' : 'None - first iteration'}
|
|
386
|
+
|
|
387
|
+
## YOUR ROLE
|
|
388
|
+
|
|
389
|
+
Exploration & Planning Agent - Explore architecture and generate implementation plan.
|
|
390
|
+
|
|
391
|
+
## RESPONSIBILITIES
|
|
392
|
+
|
|
393
|
+
1. Explore codebase architecture
|
|
394
|
+
2. Map integration points
|
|
395
|
+
3. Design implementation approach
|
|
396
|
+
4. Generate plan.json with task breakdown
|
|
397
|
+
5. Update or iterate on existing plan
|
|
398
|
+
|
|
399
|
+
## DELIVERABLES
|
|
400
|
+
|
|
401
|
+
Write files to ${progressDir}/ep/:
|
|
402
|
+
- exploration.md: Codebase exploration findings
|
|
403
|
+
- architecture.md: Architecture design
|
|
404
|
+
- plan.json: Implementation plan (structured)
|
|
405
|
+
|
|
406
|
+
## OUTPUT FORMAT
|
|
407
|
+
|
|
408
|
+
\`\`\`
|
|
409
|
+
PHASE_RESULT:
|
|
410
|
+
- phase: ep
|
|
411
|
+
- status: success | failed
|
|
412
|
+
- files_written: [list]
|
|
413
|
+
- summary: one-line summary
|
|
414
|
+
- plan_version: X.Y.Z
|
|
415
|
+
\`\`\`
|
|
416
|
+
`
|
|
417
|
+
})
|
|
418
|
+
}
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### Spawn CD Agent
|
|
422
|
+
|
|
423
|
+
```javascript
|
|
424
|
+
function spawnCDAgent(cycleId, state, progressDir) {
|
|
425
|
+
return spawn_agent({
|
|
426
|
+
message: `
|
|
427
|
+
## TASK ASSIGNMENT
|
|
428
|
+
|
|
429
|
+
### MANDATORY FIRST STEPS (Agent Execute)
|
|
430
|
+
1. **Read role definition**: ~/.codex/agents/code-developer.md
|
|
431
|
+
2. Read: ${progressDir}/ep/plan.json
|
|
432
|
+
3. Read: ${progressDir}/ra/requirements.md
|
|
433
|
+
|
|
434
|
+
---
|
|
435
|
+
|
|
436
|
+
## CYCLE CONTEXT
|
|
437
|
+
|
|
438
|
+
- **Cycle ID**: ${cycleId}
|
|
439
|
+
- **Progress Dir**: ${progressDir}/cd/
|
|
440
|
+
- **Plan Version**: ${state.plan?.version || 'N/A'}
|
|
441
|
+
- **Previous Changes**: ${state.changes?.length || 0} files
|
|
442
|
+
|
|
443
|
+
## YOUR ROLE
|
|
444
|
+
|
|
445
|
+
Code Developer - Implement features based on plan and requirements.
|
|
446
|
+
|
|
447
|
+
## RESPONSIBILITIES
|
|
448
|
+
|
|
449
|
+
1. Implement features from plan
|
|
450
|
+
2. Track code changes
|
|
451
|
+
3. Handle integration issues
|
|
452
|
+
4. Maintain code quality
|
|
453
|
+
5. Report implementation progress and issues
|
|
454
|
+
|
|
455
|
+
## DELIVERABLES
|
|
456
|
+
|
|
457
|
+
Write files to ${progressDir}/cd/:
|
|
458
|
+
- implementation.md: Implementation progress and decisions
|
|
459
|
+
- code-changes.log: NDJSON format, each line: {file, action, timestamp}
|
|
460
|
+
- issues.md: Development issues and blockers
|
|
461
|
+
|
|
462
|
+
## OUTPUT FORMAT
|
|
463
|
+
|
|
464
|
+
\`\`\`
|
|
465
|
+
PHASE_RESULT:
|
|
466
|
+
- phase: cd
|
|
467
|
+
- status: success | failed | partial
|
|
468
|
+
- files_changed: [count]
|
|
469
|
+
- summary: one-line summary
|
|
470
|
+
- blockers: []
|
|
471
|
+
\`\`\`
|
|
472
|
+
`
|
|
473
|
+
})
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
### Spawn VAS Agent
|
|
478
|
+
|
|
479
|
+
```javascript
|
|
480
|
+
function spawnVASAgent(cycleId, state, progressDir) {
|
|
481
|
+
return spawn_agent({
|
|
482
|
+
message: `
|
|
483
|
+
## TASK ASSIGNMENT
|
|
484
|
+
|
|
485
|
+
### MANDATORY FIRST STEPS (Agent Execute)
|
|
486
|
+
1. **Read role definition**: ~/.codex/agents/validation-archivist.md
|
|
487
|
+
2. Read: ${progressDir}/cd/code-changes.log
|
|
488
|
+
|
|
489
|
+
---
|
|
490
|
+
|
|
491
|
+
## CYCLE CONTEXT
|
|
492
|
+
|
|
493
|
+
- **Cycle ID**: ${cycleId}
|
|
494
|
+
- **Progress Dir**: ${progressDir}/vas/
|
|
495
|
+
- **Changes Count**: ${state.changes?.length || 0}
|
|
496
|
+
- **Iteration**: ${state.current_iteration}
|
|
497
|
+
|
|
498
|
+
## YOUR ROLE
|
|
499
|
+
|
|
500
|
+
Validation & Archival Specialist - Validate quality and create documentation.
|
|
501
|
+
|
|
502
|
+
## RESPONSIBILITIES
|
|
503
|
+
|
|
504
|
+
1. Run tests on implemented features
|
|
505
|
+
2. Generate coverage reports
|
|
506
|
+
3. Create archival documentation
|
|
507
|
+
4. Summarize cycle results
|
|
508
|
+
5. Generate version history
|
|
509
|
+
|
|
510
|
+
## DELIVERABLES
|
|
511
|
+
|
|
512
|
+
Write files to ${progressDir}/vas/:
|
|
513
|
+
- validation.md: Test validation results
|
|
514
|
+
- test-results.json: Detailed test results
|
|
515
|
+
- coverage.md: Coverage report
|
|
516
|
+
- summary.md: Cycle summary and recommendations
|
|
517
|
+
|
|
518
|
+
## OUTPUT FORMAT
|
|
519
|
+
|
|
520
|
+
\`\`\`
|
|
521
|
+
PHASE_RESULT:
|
|
522
|
+
- phase: vas
|
|
523
|
+
- status: success | failed
|
|
524
|
+
- test_pass_rate: X%
|
|
525
|
+
- coverage: X%
|
|
526
|
+
- issues: []
|
|
527
|
+
\`\`\`
|
|
528
|
+
`
|
|
529
|
+
})
|
|
530
|
+
}
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
## Result Parsing
|
|
534
|
+
|
|
535
|
+
```javascript
|
|
536
|
+
function parseAgentOutputs(agentOutputs) {
|
|
537
|
+
const results = {
|
|
538
|
+
ra: parseOutput(agentOutputs.ra, 'ra'),
|
|
539
|
+
ep: parseOutput(agentOutputs.ep, 'ep'),
|
|
540
|
+
cd: parseOutput(agentOutputs.cd, 'cd'),
|
|
541
|
+
vas: parseOutput(agentOutputs.vas, 'vas')
|
|
542
|
+
}
|
|
543
|
+
return results
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
function parseOutput(output, agent) {
|
|
547
|
+
const result = {
|
|
548
|
+
agent: agent,
|
|
549
|
+
status: 'unknown',
|
|
550
|
+
data: {}
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
// Parse PHASE_RESULT block
|
|
554
|
+
const match = output.match(/PHASE_RESULT:\s*([\s\S]*?)(?:\n\n|$)/)
|
|
555
|
+
if (match) {
|
|
556
|
+
const lines = match[1].split('\n')
|
|
557
|
+
for (const line of lines) {
|
|
558
|
+
const m = line.match(/^-\s*(\w+):\s*(.+)$/)
|
|
559
|
+
if (m) {
|
|
560
|
+
result[m[1]] = m[2].trim()
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
return result
|
|
566
|
+
}
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
## Feedback Generation
|
|
570
|
+
|
|
571
|
+
```javascript
|
|
572
|
+
function generateFeedback(parsedResults) {
|
|
573
|
+
const feedback = {}
|
|
574
|
+
|
|
575
|
+
// Check VAS results
|
|
576
|
+
if (parsedResults.vas.test_pass_rate < 100) {
|
|
577
|
+
feedback.cd = `
|
|
578
|
+
## FEEDBACK FROM VALIDATION
|
|
579
|
+
|
|
580
|
+
Test pass rate: ${parsedResults.vas.test_pass_rate}%
|
|
581
|
+
|
|
582
|
+
## ISSUES TO FIX
|
|
583
|
+
|
|
584
|
+
${parsedResults.vas.data.issues || 'See test-results.json for details'}
|
|
585
|
+
|
|
586
|
+
## NEXT STEP
|
|
587
|
+
|
|
588
|
+
Fix failing tests and update implementation.md with resolution.
|
|
589
|
+
`
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
// Check CD blockers
|
|
593
|
+
if (parsedResults.cd.blockers?.length > 0) {
|
|
594
|
+
feedback.ra = `
|
|
595
|
+
## FEEDBACK FROM DEVELOPMENT
|
|
596
|
+
|
|
597
|
+
Blockers encountered:
|
|
598
|
+
${parsedResults.cd.blockers.map(b => `- ${b}`).join('\n')}
|
|
599
|
+
|
|
600
|
+
## NEXT STEP
|
|
601
|
+
|
|
602
|
+
Clarify requirements or identify alternative approaches.
|
|
603
|
+
Update requirements.md if needed.
|
|
604
|
+
`
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
return feedback
|
|
608
|
+
}
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
## Summary Generation
|
|
612
|
+
|
|
613
|
+
```javascript
|
|
614
|
+
function generateFinalSummary(cycleId, state) {
|
|
615
|
+
const summaryFile = `.workflow/.cycle/${cycleId}.progress/coordination/summary.md`
|
|
616
|
+
|
|
617
|
+
const summary = `# Cycle Summary - ${cycleId}
|
|
618
|
+
|
|
619
|
+
## Metadata
|
|
620
|
+
- Cycle ID: ${cycleId}
|
|
621
|
+
- Started: ${state.created_at}
|
|
622
|
+
- Completed: ${state.completed_at}
|
|
623
|
+
- Iterations: ${state.current_iteration}
|
|
624
|
+
- Status: ${state.status}
|
|
625
|
+
|
|
626
|
+
## Phase Results
|
|
627
|
+
- Requirements Analysis: ✓ Completed
|
|
628
|
+
- Exploration & Planning: ✓ Completed
|
|
629
|
+
- Code Development: ✓ Completed
|
|
630
|
+
- Validation & Archival: ✓ Completed
|
|
631
|
+
|
|
632
|
+
## Key Deliverables
|
|
633
|
+
- Requirements: ${state.requirements ? '✓' : '✗'}
|
|
634
|
+
- Architecture Plan: ${state.plan ? '✓' : '✗'}
|
|
635
|
+
- Code Changes: ${state.changes?.length || 0} files
|
|
636
|
+
- Test Results: ${state.test_results?.pass_rate || '0'}% passing
|
|
637
|
+
|
|
638
|
+
## Generated Files
|
|
639
|
+
- .workflow/.cycle/${cycleId}.progress/ra/requirements.md
|
|
640
|
+
- .workflow/.cycle/${cycleId}.progress/ep/plan.json
|
|
641
|
+
- .workflow/.cycle/${cycleId}.progress/cd/code-changes.log
|
|
642
|
+
- .workflow/.cycle/${cycleId}.progress/vas/summary.md
|
|
643
|
+
|
|
644
|
+
## Continuation Instructions
|
|
645
|
+
|
|
646
|
+
To extend this cycle:
|
|
647
|
+
|
|
648
|
+
\`\`\`bash
|
|
649
|
+
/parallel-dev-cycle --cycle-id=${cycleId} --extend="New requirement or feedback"
|
|
650
|
+
\`\`\`
|
|
651
|
+
|
|
652
|
+
This will spawn agents for iteration ${state.current_iteration + 1}.
|
|
653
|
+
`
|
|
654
|
+
|
|
655
|
+
Write(summaryFile, summary)
|
|
656
|
+
}
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
## Control Signal Checking
|
|
660
|
+
|
|
661
|
+
```javascript
|
|
662
|
+
function checkControlSignals(cycleId) {
|
|
663
|
+
const state = readCycleState(cycleId)
|
|
664
|
+
|
|
665
|
+
switch (state?.status) {
|
|
666
|
+
case 'paused':
|
|
667
|
+
return { continue: false, action: 'pause_exit' }
|
|
668
|
+
case 'failed':
|
|
669
|
+
return { continue: false, action: 'stop_exit' }
|
|
670
|
+
case 'running':
|
|
671
|
+
return { continue: true, action: 'continue' }
|
|
672
|
+
default:
|
|
673
|
+
return { continue: false, action: 'stop_exit' }
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
## Error Recovery Strategies
|
|
679
|
+
|
|
680
|
+
| Error Type | Recovery |
|
|
681
|
+
|------------|----------|
|
|
682
|
+
| Agent timeout | send_input requesting convergence |
|
|
683
|
+
| State corrupted | Rebuild from progress markdown files |
|
|
684
|
+
| Agent failed | Re-spawn agent with previous context |
|
|
685
|
+
| Conflicting results | Orchestrator sends reconciliation request |
|
|
686
|
+
| Missing files | RA/EP agents identify and request clarification |
|
|
687
|
+
|
|
688
|
+
## Codex Best Practices Applied
|
|
689
|
+
|
|
690
|
+
1. **Single Orchestrator**: One main agent manages all phases
|
|
691
|
+
2. **Parallel Workers**: Four specialized agents execute simultaneously
|
|
692
|
+
3. **Batch wait()**: Wait for all agents with `wait({ ids: [...] })`
|
|
693
|
+
4. **Deep Interaction**: Use send_input for iteration and refinement
|
|
694
|
+
5. **Delayed close_agent**: Only after all phases and iterations complete
|
|
695
|
+
6. **Role Path Passing**: Each agent reads its own role definition
|
|
696
|
+
7. **Persistent Context**: Cycle state shared across all agents
|