claude-code-workflow 6.3.51 → 6.3.52
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/merge-plans-with-file.md +807 -0
- package/.claude/commands/workflow/quick-plan-with-file.md +808 -0
- package/.codex/prompts/brainstorm-with-file.md +99 -32
- package/.codex/prompts/merge-plans-with-file.md +530 -0
- package/.codex/prompts/quick-plan-with-file.md +450 -0
- package/.codex/skills/codex-issue-plan-execute/SKILL.md +17 -42
- package/.codex/skills/codex-issue-plan-execute/phases/orchestrator.md +2 -0
- package/.codex/skills/codex-issue-plan-execute/prompts/execution-agent-system.md +32 -136
- package/.codex/skills/codex-issue-plan-execute/prompts/execution-agent.md +323 -135
- package/.codex/skills/codex-issue-plan-execute/prompts/planning-agent-system.md +32 -107
- package/.codex/skills/codex-issue-plan-execute/prompts/planning-agent.md +224 -122
- package/.codex/skills/codex-issue-plan-execute/specs/agent-roles.md +468 -0
- package/.codex/skills/codex-issue-plan-execute/specs/subagent-roles.md +32 -268
- package/ccw/dist/tools/cli-executor-utils.d.ts.map +1 -1
- package/ccw/dist/tools/cli-executor-utils.js +6 -0
- package/ccw/dist/tools/cli-executor-utils.js.map +1 -1
- package/ccw/src/tools/cli-executor-utils.ts +6 -0
- package/package.json +1 -1
- package/.codex/prompts/UNIFIED_EXECUTE_COMPARISON.md +0 -205
|
@@ -231,53 +231,97 @@ ${newFocusFromUser}
|
|
|
231
231
|
|
|
232
232
|
### Phase 2: Divergent Exploration (Multi-Perspective)
|
|
233
233
|
|
|
234
|
-
|
|
234
|
+
Launch 3 parallel agents for multi-perspective brainstorming:
|
|
235
235
|
|
|
236
|
-
|
|
236
|
+
```javascript
|
|
237
|
+
const cliPromises = []
|
|
237
238
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
239
|
+
// Agent 1: Creative/Innovative Perspective (Gemini)
|
|
240
|
+
cliPromises.push(
|
|
241
|
+
Bash({
|
|
242
|
+
command: `ccw cli -p "
|
|
243
|
+
PURPOSE: Creative brainstorming for '$TOPIC' - generate innovative, unconventional ideas
|
|
244
|
+
Success: 5+ unique creative solutions that push boundaries
|
|
243
245
|
|
|
244
|
-
|
|
246
|
+
TASK:
|
|
247
|
+
• Think beyond obvious solutions - what would be surprising/delightful?
|
|
248
|
+
• Explore cross-domain inspiration (what can we learn from other industries?)
|
|
249
|
+
• Challenge assumptions - what if the opposite were true?
|
|
250
|
+
• Generate 'moonshot' ideas alongside practical ones
|
|
251
|
+
• Consider future trends and emerging technologies
|
|
252
|
+
|
|
253
|
+
MODE: analysis
|
|
254
|
+
|
|
255
|
+
CONTEXT: @**/* | Topic: $TOPIC
|
|
256
|
+
Exploration vectors: ${explorationVectors.map(v => v.title).join(', ')}
|
|
257
|
+
|
|
258
|
+
EXPECTED:
|
|
245
259
|
- 5+ creative ideas with brief descriptions
|
|
246
260
|
- Each idea rated: novelty (1-5), potential impact (1-5)
|
|
247
261
|
- Key assumptions challenged
|
|
248
262
|
- Cross-domain inspirations
|
|
249
263
|
- One 'crazy' idea that might just work
|
|
250
264
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
265
|
+
CONSTRAINTS: ${brainstormMode === 'structured' ? 'Keep ideas technically feasible' : 'No constraints - think freely'}
|
|
266
|
+
" --tool gemini --mode analysis`,
|
|
267
|
+
run_in_background: true
|
|
268
|
+
})
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
// Agent 2: Pragmatic/Implementation Perspective (Codex)
|
|
272
|
+
cliPromises.push(
|
|
273
|
+
Bash({
|
|
274
|
+
command: \`ccw cli -p "
|
|
275
|
+
PURPOSE: Pragmatic analysis for '$TOPIC' - focus on implementation reality
|
|
276
|
+
Success: Actionable approaches with clear implementation paths
|
|
277
|
+
|
|
278
|
+
TASK:
|
|
279
|
+
• Evaluate technical feasibility of core concept
|
|
280
|
+
• Identify existing patterns/libraries that could help
|
|
281
|
+
• Consider integration with current codebase
|
|
282
|
+
• Estimate implementation complexity
|
|
283
|
+
• Highlight potential technical blockers
|
|
284
|
+
• Suggest incremental implementation approach
|
|
285
|
+
|
|
286
|
+
MODE: analysis
|
|
287
|
+
|
|
288
|
+
CONTEXT: @**/* | Topic: $TOPIC
|
|
289
|
+
Exploration vectors: \${explorationVectors.map(v => v.title).join(', ')}
|
|
290
|
+
|
|
291
|
+
EXPECTED:
|
|
263
292
|
- 3-5 practical implementation approaches
|
|
264
293
|
- Each rated: effort (1-5), risk (1-5), reuse potential (1-5)
|
|
265
294
|
- Technical dependencies identified
|
|
266
295
|
- Quick wins vs long-term solutions
|
|
267
296
|
- Recommended starting point
|
|
268
297
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
298
|
+
CONSTRAINTS: Focus on what can actually be built with current tech stack
|
|
299
|
+
" --tool codex --mode analysis\`,
|
|
300
|
+
run_in_background: true
|
|
301
|
+
})
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
// Agent 3: Systematic/Architectural Perspective (Claude)
|
|
305
|
+
cliPromises.push(
|
|
306
|
+
Bash({
|
|
307
|
+
command: \`ccw cli -p "
|
|
308
|
+
PURPOSE: Systematic analysis for '$TOPIC' - architectural and structural thinking
|
|
309
|
+
Success: Well-structured solution framework with clear tradeoffs
|
|
310
|
+
|
|
311
|
+
TASK:
|
|
312
|
+
• Decompose the problem into sub-problems
|
|
313
|
+
• Identify architectural patterns that apply
|
|
314
|
+
• Map dependencies and interactions
|
|
315
|
+
• Consider scalability implications
|
|
316
|
+
• Evaluate long-term maintainability
|
|
317
|
+
• Propose systematic solution structure
|
|
318
|
+
|
|
319
|
+
MODE: analysis
|
|
320
|
+
|
|
321
|
+
CONTEXT: @**/* | Topic: $TOPIC
|
|
322
|
+
Exploration vectors: \${explorationVectors.map(v => v.title).join(', ')}
|
|
323
|
+
|
|
324
|
+
EXPECTED:
|
|
281
325
|
- Problem decomposition diagram (text)
|
|
282
326
|
- 2-3 architectural approaches with tradeoffs
|
|
283
327
|
- Dependency mapping
|
|
@@ -285,6 +329,29 @@ Output:
|
|
|
285
329
|
- Recommended architecture pattern
|
|
286
330
|
- Risk matrix
|
|
287
331
|
|
|
332
|
+
CONSTRAINTS: Consider existing system architecture
|
|
333
|
+
" --tool claude --mode analysis\`,
|
|
334
|
+
run_in_background: true
|
|
335
|
+
})
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
// Wait for all CLI analyses to complete
|
|
339
|
+
const [creativeResult, pragmaticResult, systematicResult] = await Promise.all(cliPromises)
|
|
340
|
+
|
|
341
|
+
// Parse results from each perspective
|
|
342
|
+
const creativeIdeas = parseCreativeResult(creativeResult)
|
|
343
|
+
const pragmaticApproaches = parsePragmaticResult(pragmaticResult)
|
|
344
|
+
const architecturalOptions = parseSystematicResult(systematicResult)
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
**Multi-Perspective Coordination**:
|
|
348
|
+
|
|
349
|
+
| Agent | Perspective | Tool | Focus Areas |
|
|
350
|
+
|-------|-------------|------|-------------|
|
|
351
|
+
| 1 | Creative/Innovative | Gemini | Novel ideas, cross-domain inspiration, moonshots |
|
|
352
|
+
| 2 | Pragmatic/Implementation | Codex | Feasibility, tech stack, blockers, quick wins |
|
|
353
|
+
| 3 | Systematic/Architectural | Claude | Decomposition, patterns, scalability, risks |
|
|
354
|
+
|
|
288
355
|
#### Step 2.4: Aggregate Multi-Perspective Findings
|
|
289
356
|
|
|
290
357
|
```javascript
|
|
@@ -0,0 +1,530 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Merge multiple planning/brainstorm/analysis outputs, resolve conflicts, and synthesize unified plan. Multi-team input aggregation and plan crystallization
|
|
3
|
+
argument-hint: "PATTERN=\"<plan pattern or topic>\" [--rule=consensus|priority|hierarchy] [--output=<path>] [--auto] [--verbose]"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Codex Merge-Plans-With-File Prompt
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Plan aggregation and conflict resolution workflow. Takes multiple planning artifacts (brainstorm conclusions, analysis recommendations, quick-plans, implementation plans) and synthesizes them into a unified, conflict-resolved execution plan.
|
|
11
|
+
|
|
12
|
+
**Core workflow**: Load Sources → Parse Plans → Conflict Analysis → Arbitration → Unified Plan
|
|
13
|
+
|
|
14
|
+
**Key features**:
|
|
15
|
+
- **Multi-Source Support**: brainstorm, analysis, quick-plan, IMPL_PLAN, task JSONs
|
|
16
|
+
- **Conflict Detection**: Identify contradictions across all input plans
|
|
17
|
+
- **Resolution Rules**: consensus, priority-based, or hierarchical resolution
|
|
18
|
+
- **Unified Synthesis**: Single authoritative plan from multiple perspectives
|
|
19
|
+
- **Decision Tracking**: Full audit trail of conflicts and resolutions
|
|
20
|
+
|
|
21
|
+
## Target Pattern
|
|
22
|
+
|
|
23
|
+
**$PATTERN**
|
|
24
|
+
|
|
25
|
+
- `--rule`: Conflict resolution (consensus | priority | hierarchy) - consensus by default
|
|
26
|
+
- `--output`: Output directory (default: .workflow/.merged/{pattern})
|
|
27
|
+
- `--auto`: Auto-resolve conflicts using rule, skip confirmations
|
|
28
|
+
- `--verbose`: Include detailed conflict analysis
|
|
29
|
+
|
|
30
|
+
## Execution Process
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
Phase 1: Discovery & Loading
|
|
34
|
+
├─ Search for artifacts matching pattern
|
|
35
|
+
├─ Load synthesis.json, conclusions.json, IMPL_PLAN.md, task JSONs
|
|
36
|
+
├─ Parse into normalized task structure
|
|
37
|
+
└─ Validate completeness
|
|
38
|
+
|
|
39
|
+
Phase 2: Plan Normalization
|
|
40
|
+
├─ Convert all formats to common task representation
|
|
41
|
+
├─ Extract: tasks, dependencies, effort, risks
|
|
42
|
+
├─ Identify scope and boundaries
|
|
43
|
+
└─ Aggregate recommendations
|
|
44
|
+
|
|
45
|
+
Phase 3: Conflict Detection (Parallel)
|
|
46
|
+
├─ Architecture conflicts: different design approaches
|
|
47
|
+
├─ Task conflicts: overlapping or duplicated tasks
|
|
48
|
+
├─ Effort conflicts: different estimates
|
|
49
|
+
├─ Risk conflicts: different risk assessments
|
|
50
|
+
├─ Scope conflicts: different feature sets
|
|
51
|
+
└─ Generate conflict matrix
|
|
52
|
+
|
|
53
|
+
Phase 4: Conflict Resolution
|
|
54
|
+
├─ Analyze source rationale for each conflict
|
|
55
|
+
├─ Apply resolution rule (consensus / priority / hierarchy)
|
|
56
|
+
├─ Escalate unresolvable conflicts to user (unless --auto)
|
|
57
|
+
├─ Document decision rationale
|
|
58
|
+
└─ Generate resolutions.json
|
|
59
|
+
|
|
60
|
+
Phase 5: Plan Synthesis
|
|
61
|
+
├─ Merge task lists (deduplicate, combine insights)
|
|
62
|
+
├─ Integrate dependencies
|
|
63
|
+
├─ Consolidate effort and risk estimates
|
|
64
|
+
├─ Generate execution sequence
|
|
65
|
+
└─ Output unified-plan.json
|
|
66
|
+
|
|
67
|
+
Output:
|
|
68
|
+
├─ .workflow/.merged/{sessionId}/merge.md (process log)
|
|
69
|
+
├─ .workflow/.merged/{sessionId}/source-index.json (input sources)
|
|
70
|
+
├─ .workflow/.merged/{sessionId}/conflicts.json (conflict matrix)
|
|
71
|
+
├─ .workflow/.merged/{sessionId}/resolutions.json (decisions)
|
|
72
|
+
├─ .workflow/.merged/{sessionId}/unified-plan.json (for execution)
|
|
73
|
+
└─ .workflow/.merged/{sessionId}/unified-plan.md (human-readable)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Implementation Details
|
|
77
|
+
|
|
78
|
+
### Phase 1: Discover & Load Sources
|
|
79
|
+
|
|
80
|
+
```javascript
|
|
81
|
+
const getUtc8ISOString = () => new Date(Date.now() + 8 * 60 * 60 * 1000).toISOString()
|
|
82
|
+
|
|
83
|
+
const mergeSlug = "$PATTERN".toLowerCase()
|
|
84
|
+
.replace(/[*?]/g, '-')
|
|
85
|
+
.replace(/[^a-z0-9\u4e00-\u9fa5-]+/g, '-')
|
|
86
|
+
.substring(0, 30)
|
|
87
|
+
const sessionId = `MERGE-${mergeSlug}-${getUtc8ISOString().substring(0, 10)}`
|
|
88
|
+
const sessionFolder = `.workflow/.merged/${sessionId}`
|
|
89
|
+
|
|
90
|
+
bash(`mkdir -p ${sessionFolder}`)
|
|
91
|
+
|
|
92
|
+
// Search paths for matching artifacts
|
|
93
|
+
const searchPaths = [
|
|
94
|
+
`.workflow/.brainstorm/*${$PATTERN}*/synthesis.json`,
|
|
95
|
+
`.workflow/.analysis/*${$PATTERN}*/conclusions.json`,
|
|
96
|
+
`.workflow/.planning/*${$PATTERN}*/synthesis.json`,
|
|
97
|
+
`.workflow/.plan/*${$PATTERN}*IMPL_PLAN.md`,
|
|
98
|
+
`.workflow/**/*${$PATTERN}*.json`
|
|
99
|
+
]
|
|
100
|
+
|
|
101
|
+
// Load and validate each source
|
|
102
|
+
const sourcePlans = []
|
|
103
|
+
for (const pattern of searchPaths) {
|
|
104
|
+
const matches = glob(pattern)
|
|
105
|
+
for (const path of matches) {
|
|
106
|
+
const plan = loadAndParsePlan(path)
|
|
107
|
+
if (plan?.tasks?.length > 0) {
|
|
108
|
+
sourcePlans.push({ path, type: inferType(path), plan })
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Phase 2: Normalize Plans
|
|
115
|
+
|
|
116
|
+
Convert all source formats to common structure:
|
|
117
|
+
|
|
118
|
+
```javascript
|
|
119
|
+
const normalizedPlans = sourcePlans.map((src, idx) => ({
|
|
120
|
+
index: idx,
|
|
121
|
+
source: src.path,
|
|
122
|
+
type: src.type,
|
|
123
|
+
|
|
124
|
+
metadata: {
|
|
125
|
+
title: src.plan.title || `Plan ${idx + 1}`,
|
|
126
|
+
topic: src.plan.topic,
|
|
127
|
+
complexity: src.plan.complexity_level || 'unknown'
|
|
128
|
+
},
|
|
129
|
+
|
|
130
|
+
tasks: src.plan.tasks.map(task => ({
|
|
131
|
+
id: `T${idx}-${task.id || task.title.substring(0, 20)}`,
|
|
132
|
+
title: task.title,
|
|
133
|
+
description: task.description,
|
|
134
|
+
type: task.type || inferTaskType(task),
|
|
135
|
+
priority: task.priority || 'normal',
|
|
136
|
+
|
|
137
|
+
effort: { estimated: task.effort_estimate, from_plan: idx },
|
|
138
|
+
risk: { level: task.risk_level || 'medium', from_plan: idx },
|
|
139
|
+
dependencies: task.dependencies || [],
|
|
140
|
+
|
|
141
|
+
source_plan_index: idx
|
|
142
|
+
}))
|
|
143
|
+
}))
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Phase 3: Parallel Conflict Detection
|
|
147
|
+
|
|
148
|
+
Launch parallel agents to detect and analyze conflicts:
|
|
149
|
+
|
|
150
|
+
```javascript
|
|
151
|
+
// Parallel conflict detection with CLI agents
|
|
152
|
+
const conflictPromises = []
|
|
153
|
+
|
|
154
|
+
// Agent 1: Detect effort and task conflicts
|
|
155
|
+
conflictPromises.push(
|
|
156
|
+
Bash({
|
|
157
|
+
command: `ccw cli -p "
|
|
158
|
+
PURPOSE: Detect effort conflicts and task duplicates across multiple plans
|
|
159
|
+
Success: Complete identification of conflicting estimates and duplicate tasks
|
|
160
|
+
|
|
161
|
+
TASK:
|
|
162
|
+
• Identify tasks with significantly different effort estimates (>50% variance)
|
|
163
|
+
• Detect duplicate/similar tasks across plans
|
|
164
|
+
• Analyze effort estimation reasoning
|
|
165
|
+
• Suggest resolution for each conflict
|
|
166
|
+
|
|
167
|
+
MODE: analysis
|
|
168
|
+
|
|
169
|
+
CONTEXT:
|
|
170
|
+
- Plan 1: ${JSON.stringify(normalizedPlans[0]?.tasks?.slice(0,3) || [], null, 2)}
|
|
171
|
+
- Plan 2: ${JSON.stringify(normalizedPlans[1]?.tasks?.slice(0,3) || [], null, 2)}
|
|
172
|
+
- [Additional plans...]
|
|
173
|
+
|
|
174
|
+
EXPECTED:
|
|
175
|
+
- Effort conflicts detected (task name, estimate in each plan, variance %)
|
|
176
|
+
- Duplicate task analysis (similar tasks, scope differences)
|
|
177
|
+
- Resolution recommendation for each conflict
|
|
178
|
+
- Confidence level for each detection
|
|
179
|
+
|
|
180
|
+
CONSTRAINTS: Focus on significant conflicts (>30% effort variance)
|
|
181
|
+
" --tool gemini --mode analysis`,
|
|
182
|
+
run_in_background: true
|
|
183
|
+
})
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
// Agent 2: Analyze architecture and scope conflicts
|
|
187
|
+
conflictPromises.push(
|
|
188
|
+
Bash({
|
|
189
|
+
command: \`ccw cli -p "
|
|
190
|
+
PURPOSE: Analyze architecture and scope conflicts across plans
|
|
191
|
+
Success: Clear identification of design approach differences and scope gaps
|
|
192
|
+
|
|
193
|
+
TASK:
|
|
194
|
+
• Identify different architectural approaches in plans
|
|
195
|
+
• Detect scope differences (features included/excluded)
|
|
196
|
+
• Analyze design philosophy conflicts
|
|
197
|
+
• Suggest approach to reconcile different visions
|
|
198
|
+
|
|
199
|
+
MODE: analysis
|
|
200
|
+
|
|
201
|
+
CONTEXT:
|
|
202
|
+
- Plan 1 architecture: \${normalizedPlans[0]?.metadata?.complexity || 'unknown'}
|
|
203
|
+
- Plan 2 architecture: \${normalizedPlans[1]?.metadata?.complexity || 'unknown'}
|
|
204
|
+
- Different design approaches detected: \${JSON.stringify(['approach1', 'approach2'])}
|
|
205
|
+
|
|
206
|
+
EXPECTED:
|
|
207
|
+
- Architecture conflicts identified (approach names and trade-offs)
|
|
208
|
+
- Scope conflicts (features/components in plan A but not B, vice versa)
|
|
209
|
+
- Design philosophy alignment/misalignment
|
|
210
|
+
- Recommendation for unified approach
|
|
211
|
+
- Pros/cons of each architectural approach
|
|
212
|
+
|
|
213
|
+
CONSTRAINTS: Consider both perspectives objectively
|
|
214
|
+
" --tool codex --mode analysis\`,
|
|
215
|
+
run_in_background: true
|
|
216
|
+
})
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
// Agent 3: Analyze risk assessment conflicts
|
|
220
|
+
conflictPromises.push(
|
|
221
|
+
Bash({
|
|
222
|
+
command: \`ccw cli -p "
|
|
223
|
+
PURPOSE: Analyze risk assessment conflicts across plans
|
|
224
|
+
Success: Unified risk assessment with conflict resolution
|
|
225
|
+
|
|
226
|
+
TASK:
|
|
227
|
+
• Identify tasks/areas with significantly different risk ratings
|
|
228
|
+
• Analyze risk assessment reasoning
|
|
229
|
+
• Detect missing risks in some plans
|
|
230
|
+
• Propose unified risk assessment
|
|
231
|
+
|
|
232
|
+
MODE: analysis
|
|
233
|
+
|
|
234
|
+
CONTEXT:
|
|
235
|
+
- Risk areas with disagreement: [list areas]
|
|
236
|
+
- Plan 1 risk ratings: [risk matrix]
|
|
237
|
+
- Plan 2 risk ratings: [risk matrix]
|
|
238
|
+
|
|
239
|
+
EXPECTED:
|
|
240
|
+
- Risk conflicts identified (area, plan A rating, plan B rating)
|
|
241
|
+
- Explanation of why assessments differ
|
|
242
|
+
- Missing risks analysis (important in one plan but not others)
|
|
243
|
+
- Unified risk rating recommendation
|
|
244
|
+
- Confidence level for each assessment
|
|
245
|
+
|
|
246
|
+
CONSTRAINTS: Be realistic in risk assessment, not pessimistic
|
|
247
|
+
" --tool claude --mode analysis\`,
|
|
248
|
+
run_in_background: true
|
|
249
|
+
})
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
// Agent 4: Synthesize conflicts into resolution strategy
|
|
253
|
+
conflictPromises.push(
|
|
254
|
+
Bash({
|
|
255
|
+
command: \`ccw cli -p "
|
|
256
|
+
PURPOSE: Synthesize all conflicts into unified resolution strategy
|
|
257
|
+
Success: Clear path to merge plans with informed trade-off decisions
|
|
258
|
+
|
|
259
|
+
TASK:
|
|
260
|
+
• Analyze all detected conflicts holistically
|
|
261
|
+
• Identify which conflicts are critical vs. non-critical
|
|
262
|
+
• Propose resolution for each conflict type
|
|
263
|
+
• Suggest unified approach that honors valid insights from all plans
|
|
264
|
+
|
|
265
|
+
MODE: analysis
|
|
266
|
+
|
|
267
|
+
CONTEXT:
|
|
268
|
+
- Total conflicts detected: [number]
|
|
269
|
+
- Conflict types: effort, architecture, scope, risk
|
|
270
|
+
- Resolution rule: \${resolutionRule}
|
|
271
|
+
- Plan importance: \${normalizedPlans.map(p => p.metadata.title).join(', ')}
|
|
272
|
+
|
|
273
|
+
EXPECTED:
|
|
274
|
+
- Conflict priority ranking (critical, important, minor)
|
|
275
|
+
- Recommended resolution for each conflict
|
|
276
|
+
- Rationale for each recommendation
|
|
277
|
+
- Potential issues with proposed resolution
|
|
278
|
+
- Fallback options if recommendation not accepted
|
|
279
|
+
- Overall merge strategy and sequencing
|
|
280
|
+
|
|
281
|
+
CONSTRAINTS: Aim for solution that maximizes learning from all perspectives
|
|
282
|
+
" --tool gemini --mode analysis\`,
|
|
283
|
+
run_in_background: true
|
|
284
|
+
})
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
// Wait for all conflict detection agents to complete
|
|
288
|
+
const [effortConflicts, archConflicts, riskConflicts, resolutionStrategy] =
|
|
289
|
+
await Promise.all(conflictPromises)
|
|
290
|
+
|
|
291
|
+
// Parse and consolidate all conflict findings
|
|
292
|
+
const allConflicts = {
|
|
293
|
+
effort: parseEffortConflicts(effortConflicts),
|
|
294
|
+
architecture: parseArchConflicts(archConflicts),
|
|
295
|
+
risk: parseRiskConflicts(riskConflicts),
|
|
296
|
+
strategy: parseResolutionStrategy(resolutionStrategy),
|
|
297
|
+
timestamp: getUtc8ISOString()
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
Write(\`\${sessionFolder}/conflicts.json\`, JSON.stringify(allConflicts, null, 2))
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**Conflict Detection Workflow**:
|
|
304
|
+
|
|
305
|
+
| Agent | Conflict Type | Focus | Output |
|
|
306
|
+
|-------|--------------|--------|--------|
|
|
307
|
+
| Gemini | Effort & Tasks | Duplicate detection, estimate variance | Conflicts with variance %, resolution suggestions |
|
|
308
|
+
| Codex | Architecture & Scope | Design approach differences | Design conflicts, scope gaps, recommendations |
|
|
309
|
+
| Claude | Risk Assessment | Risk rating disagreements | Risk conflicts, missing risks, unified assessment |
|
|
310
|
+
| Gemini | Resolution Strategy | Holistic synthesis | Priority ranking, resolution path, trade-offs |
|
|
311
|
+
|
|
312
|
+
### Phase 4: Resolve Conflicts
|
|
313
|
+
|
|
314
|
+
**Rule: Consensus (default)**
|
|
315
|
+
- Use median/average of conflicting estimates
|
|
316
|
+
- Merge scope differences
|
|
317
|
+
- Document minority viewpoints
|
|
318
|
+
|
|
319
|
+
**Rule: Priority**
|
|
320
|
+
- First plan has highest authority
|
|
321
|
+
- Later plans supplement but don't override
|
|
322
|
+
|
|
323
|
+
**Rule: Hierarchy**
|
|
324
|
+
- User ranks plan importance
|
|
325
|
+
- Higher-ranked plan wins conflicts
|
|
326
|
+
|
|
327
|
+
```javascript
|
|
328
|
+
const resolutions = {}
|
|
329
|
+
|
|
330
|
+
if (rule === 'consensus') {
|
|
331
|
+
for (const conflict of conflicts.effort) {
|
|
332
|
+
resolutions[conflict.task] = {
|
|
333
|
+
resolved: calculateMedian(conflict.estimates),
|
|
334
|
+
method: 'consensus-median',
|
|
335
|
+
rationale: 'Used median of all estimates'
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
} else if (rule === 'priority') {
|
|
339
|
+
for (const conflict of conflicts.effort) {
|
|
340
|
+
const primary = conflict.estimates[0] // First plan
|
|
341
|
+
resolutions[conflict.task] = {
|
|
342
|
+
resolved: primary.value,
|
|
343
|
+
method: 'priority-based',
|
|
344
|
+
rationale: `Selected from plan ${primary.from_plan} (highest priority)`
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
} else if (rule === 'hierarchy') {
|
|
348
|
+
// Request user ranking if not --auto
|
|
349
|
+
const ranking = getUserPlanRanking(normalizedPlans)
|
|
350
|
+
// Apply hierarchy-based resolution
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
Write(`${sessionFolder}/resolutions.json`, JSON.stringify(resolutions, null, 2))
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### Phase 5: Generate Unified Plan
|
|
357
|
+
|
|
358
|
+
```javascript
|
|
359
|
+
const unifiedPlan = {
|
|
360
|
+
session_id: sessionId,
|
|
361
|
+
merge_timestamp: getUtc8ISOString(),
|
|
362
|
+
|
|
363
|
+
summary: {
|
|
364
|
+
total_source_plans: sourcePlans.length,
|
|
365
|
+
original_tasks: allTasks.length,
|
|
366
|
+
merged_tasks: deduplicatedTasks.length,
|
|
367
|
+
conflicts_resolved: Object.keys(resolutions).length,
|
|
368
|
+
resolution_rule: rule
|
|
369
|
+
},
|
|
370
|
+
|
|
371
|
+
tasks: deduplicatedTasks.map(task => ({
|
|
372
|
+
id: task.id,
|
|
373
|
+
title: task.title,
|
|
374
|
+
description: task.description,
|
|
375
|
+
effort: task.resolved_effort,
|
|
376
|
+
risk: task.resolved_risk,
|
|
377
|
+
dependencies: task.merged_dependencies,
|
|
378
|
+
source_plans: task.contributing_plans
|
|
379
|
+
})),
|
|
380
|
+
|
|
381
|
+
execution_sequence: topologicalSort(tasks),
|
|
382
|
+
critical_path: identifyCriticalPath(tasks),
|
|
383
|
+
|
|
384
|
+
risks: aggregateRisks(tasks),
|
|
385
|
+
success_criteria: aggregateCriteria(tasks)
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
Write(`${sessionFolder}/unified-plan.json`, JSON.stringify(unifiedPlan, null, 2))
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### Phase 6: Generate Human-Readable Plan
|
|
392
|
+
|
|
393
|
+
```markdown
|
|
394
|
+
# Merged Planning Session
|
|
395
|
+
|
|
396
|
+
**Session ID**: ${sessionId}
|
|
397
|
+
**Pattern**: $PATTERN
|
|
398
|
+
**Created**: ${timestamp}
|
|
399
|
+
|
|
400
|
+
---
|
|
401
|
+
|
|
402
|
+
## Merge Summary
|
|
403
|
+
|
|
404
|
+
**Source Plans**: ${summary.total_source_plans}
|
|
405
|
+
**Original Tasks**: ${summary.original_tasks}
|
|
406
|
+
**Merged Tasks**: ${summary.merged_tasks}
|
|
407
|
+
**Conflicts Resolved**: ${summary.conflicts_resolved}
|
|
408
|
+
**Resolution Method**: ${summary.resolution_rule}
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
412
|
+
## Unified Task List
|
|
413
|
+
|
|
414
|
+
${tasks.map((task, i) => `
|
|
415
|
+
${i+1}. **${task.id}: ${task.title}**
|
|
416
|
+
- Effort: ${task.effort}
|
|
417
|
+
- Risk: ${task.risk}
|
|
418
|
+
- From plans: ${task.source_plans.join(', ')}
|
|
419
|
+
`).join('\n')}
|
|
420
|
+
|
|
421
|
+
---
|
|
422
|
+
|
|
423
|
+
## Execution Sequence
|
|
424
|
+
|
|
425
|
+
**Critical Path**: ${critical_path.join(' → ')}
|
|
426
|
+
|
|
427
|
+
---
|
|
428
|
+
|
|
429
|
+
## Conflict Resolution Report
|
|
430
|
+
|
|
431
|
+
${Object.entries(resolutions).map(([key, res]) => `
|
|
432
|
+
- **${key}**: ${res.rationale}
|
|
433
|
+
`).join('\n')}
|
|
434
|
+
|
|
435
|
+
---
|
|
436
|
+
|
|
437
|
+
## Next Steps
|
|
438
|
+
|
|
439
|
+
**Execute**:
|
|
440
|
+
\`\`\`
|
|
441
|
+
/workflow:unified-execute-with-file -p ${sessionFolder}/unified-plan.json
|
|
442
|
+
\`\`\`
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
## Session Folder Structure
|
|
446
|
+
|
|
447
|
+
```
|
|
448
|
+
.workflow/.merged/{sessionId}/
|
|
449
|
+
├── merge.md # Process log
|
|
450
|
+
├── source-index.json # All input sources
|
|
451
|
+
├── conflicts.json # Detected conflicts
|
|
452
|
+
├── resolutions.json # How resolved
|
|
453
|
+
├── unified-plan.json # Merged plan (for execution)
|
|
454
|
+
└── unified-plan.md # Human-readable
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
## Resolution Rules Comparison
|
|
458
|
+
|
|
459
|
+
| Rule | Method | Best For | Tradeoff |
|
|
460
|
+
|------|--------|----------|----------|
|
|
461
|
+
| **Consensus** | Median/average | Similar-quality inputs | May miss extremes |
|
|
462
|
+
| **Priority** | First wins | Clear authority order | Discards alternatives |
|
|
463
|
+
| **Hierarchy** | User-ranked | Mixed stakeholders | Needs user input |
|
|
464
|
+
|
|
465
|
+
## Input Format Support
|
|
466
|
+
|
|
467
|
+
| Source Type | Detection Pattern | Parsing |
|
|
468
|
+
|-------------|-------------------|---------|
|
|
469
|
+
| Brainstorm | `.brainstorm/*/synthesis.json` | Top ideas → tasks |
|
|
470
|
+
| Analysis | `.analysis/*/conclusions.json` | Recommendations → tasks |
|
|
471
|
+
| Quick-Plan | `.planning/*/synthesis.json` | Direct task list |
|
|
472
|
+
| IMPL_PLAN | `*IMPL_PLAN.md` | Markdown → tasks |
|
|
473
|
+
| Task JSON | `*.json` with `tasks` | Direct mapping |
|
|
474
|
+
|
|
475
|
+
## Error Handling
|
|
476
|
+
|
|
477
|
+
| Situation | Action |
|
|
478
|
+
|-----------|--------|
|
|
479
|
+
| No plans found | List available plans, suggest search terms |
|
|
480
|
+
| Incompatible format | Skip, continue with others |
|
|
481
|
+
| Circular dependencies | Alert user, suggest manual review |
|
|
482
|
+
| Unresolvable conflict | Require user decision (unless --auto) |
|
|
483
|
+
|
|
484
|
+
## Integration Flow
|
|
485
|
+
|
|
486
|
+
```
|
|
487
|
+
Brainstorm Sessions / Analyses / Plans
|
|
488
|
+
│
|
|
489
|
+
├─ synthesis.json (session 1)
|
|
490
|
+
├─ conclusions.json (session 2)
|
|
491
|
+
├─ synthesis.json (session 3)
|
|
492
|
+
│
|
|
493
|
+
▼
|
|
494
|
+
merge-plans-with-file
|
|
495
|
+
│
|
|
496
|
+
├─ unified-plan.json
|
|
497
|
+
│
|
|
498
|
+
▼
|
|
499
|
+
unified-execute-with-file
|
|
500
|
+
│
|
|
501
|
+
▼
|
|
502
|
+
Implementation
|
|
503
|
+
```
|
|
504
|
+
|
|
505
|
+
## Usage Patterns
|
|
506
|
+
|
|
507
|
+
**Pattern 1: Merge all auth-related plans**
|
|
508
|
+
```
|
|
509
|
+
PATTERN="authentication" --rule=consensus --auto
|
|
510
|
+
→ Finds all auth plans
|
|
511
|
+
→ Merges with consensus method
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
**Pattern 2: Prioritized merge**
|
|
515
|
+
```
|
|
516
|
+
PATTERN="payment" --rule=priority
|
|
517
|
+
→ First plan has authority
|
|
518
|
+
→ Others supplement
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
**Pattern 3: Team input merge**
|
|
522
|
+
```
|
|
523
|
+
PATTERN="feature-*" --rule=hierarchy
|
|
524
|
+
→ Asks for plan ranking
|
|
525
|
+
→ Applies hierarchy resolution
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
---
|
|
529
|
+
|
|
530
|
+
**Now execute merge-plans-with-file for pattern**: $PATTERN
|