maestro-flow 0.4.19 → 0.4.21
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/.agents/agents/workflow-collab-planner.md +4 -1
- package/.agents/agents/workflow-plan-checker.md +11 -1
- package/.agents/agents/workflow-planner.md +4 -1
- package/.agents/skills/maestro/SKILL.md +8 -5
- package/.agents/skills/maestro-analyze/SKILL.md +1 -1
- package/.agents/skills/maestro-brainstorm/SKILL.md +2 -1
- package/.agents/skills/maestro-companion/SKILL.md +533 -0
- package/.agents/skills/maestro-grill/SKILL.md +116 -0
- package/.agents/skills/maestro-plan/SKILL.md +4 -0
- package/.agents/skills/maestro-ralph/SKILL.md +11 -7
- package/.agents/skills/maestro-ralph-execute/SKILL.md +2 -1
- package/.agents/skills/maestro-swarm-workflow/SKILL.md +266 -0
- package/.agents/skills/maestro-universal-workflow/SKILL.md +563 -0
- package/.agents/skills/manage-codebase-rebuild/SKILL.md +13 -1
- package/.agents/skills/manage-codebase-refresh/SKILL.md +3 -0
- package/.agents/skills/spec-setup/SKILL.md +9 -5
- package/.agents/skills/team-adversarial-swarm/SKILL.md +235 -0
- package/.agents/skills/team-adversarial-swarm/scripts/aco.py +473 -0
- package/.agents/skills/team-adversarial-swarm/scripts/pheromone.py +144 -0
- package/.agents/skills/team-adversarial-swarm/scripts/scoring.py +92 -0
- package/.agents/skills/team-adversarial-swarm/scripts/test_aco.py +475 -0
- package/.agents/skills/team-adversarial-swarm/specs/ant-output-schema.md +115 -0
- package/.agents/skills/team-adversarial-swarm/specs/convergence-criteria.md +75 -0
- package/.agents/skills/team-adversarial-swarm/specs/pheromone-schema.md +90 -0
- package/.agents/skills/team-adversarial-swarm/specs/swarm-config-template.json +66 -0
- package/.agents/skills/team-adversarial-swarm/specs/swarm-protocol.md +105 -0
- package/.agents/skills/team-adversarial-swarm/workflows/wf-swarm-converge.js +197 -0
- package/.agents/skills/team-adversarial-swarm/workflows/wf-swarm-explore.js +194 -0
- package/.agents/skills/team-adversarial-swarm/workflows/wf-swarm-score.js +188 -0
- package/.agents/skills/team-adversarial-swarm/workflows/wf-swarm-synthesize.js +248 -0
- package/.agy/agents/workflow-collab-planner.md +4 -1
- package/.agy/agents/workflow-plan-checker.md +11 -1
- package/.agy/agents/workflow-planner.md +4 -1
- package/.agy/skills/maestro/SKILL.md +8 -5
- package/.agy/skills/maestro-analyze/SKILL.md +1 -1
- package/.agy/skills/maestro-brainstorm/SKILL.md +2 -1
- package/.agy/skills/maestro-companion/SKILL.md +529 -0
- package/.agy/skills/maestro-grill/SKILL.md +116 -0
- package/.agy/skills/maestro-plan/SKILL.md +4 -0
- package/.agy/skills/maestro-ralph/SKILL.md +11 -7
- package/.agy/skills/maestro-ralph-execute/SKILL.md +2 -1
- package/.agy/skills/maestro-swarm-workflow/SKILL.md +263 -0
- package/.agy/skills/maestro-universal-workflow/SKILL.md +560 -0
- package/.agy/skills/manage-codebase-rebuild/SKILL.md +13 -1
- package/.agy/skills/manage-codebase-refresh/SKILL.md +3 -0
- package/.agy/skills/spec-setup/SKILL.md +9 -5
- package/.agy/skills/team-adversarial-swarm/SKILL.md +244 -0
- package/.agy/skills/team-adversarial-swarm/scripts/aco.py +473 -0
- package/.agy/skills/team-adversarial-swarm/scripts/pheromone.py +144 -0
- package/.agy/skills/team-adversarial-swarm/scripts/scoring.py +92 -0
- package/.agy/skills/team-adversarial-swarm/scripts/test_aco.py +475 -0
- package/.agy/skills/team-adversarial-swarm/specs/ant-output-schema.md +115 -0
- package/.agy/skills/team-adversarial-swarm/specs/convergence-criteria.md +75 -0
- package/.agy/skills/team-adversarial-swarm/specs/pheromone-schema.md +90 -0
- package/.agy/skills/team-adversarial-swarm/specs/swarm-config-template.json +66 -0
- package/.agy/skills/team-adversarial-swarm/specs/swarm-protocol.md +105 -0
- package/.agy/skills/team-adversarial-swarm/workflows/wf-swarm-converge.js +197 -0
- package/.agy/skills/team-adversarial-swarm/workflows/wf-swarm-explore.js +194 -0
- package/.agy/skills/team-adversarial-swarm/workflows/wf-swarm-score.js +188 -0
- package/.agy/skills/team-adversarial-swarm/workflows/wf-swarm-synthesize.js +248 -0
- package/.claude/agents/workflow-collab-planner.md +4 -1
- package/.claude/agents/workflow-plan-checker.md +11 -1
- package/.claude/agents/workflow-planner.md +4 -1
- package/.claude/commands/maestro-analyze.md +1 -1
- package/.claude/commands/maestro-brainstorm.md +2 -1
- package/.claude/commands/maestro-companion.md +531 -0
- package/.claude/commands/maestro-grill.md +114 -0
- package/.claude/commands/maestro-plan.md +4 -0
- package/.claude/commands/maestro-ralph-execute.md +2 -1
- package/.claude/commands/maestro-ralph.md +11 -7
- package/.claude/commands/maestro-swarm-workflow.md +264 -0
- package/.claude/commands/maestro-universal-workflow.md +561 -0
- package/.claude/commands/maestro.md +8 -5
- package/.claude/commands/manage-codebase-rebuild.md +13 -1
- package/.claude/commands/manage-codebase-refresh.md +3 -0
- package/.claude/commands/spec-setup.md +9 -5
- package/.claude/skills/team-adversarial-swarm/SKILL.md +233 -0
- package/.claude/skills/team-adversarial-swarm/scripts/aco.py +473 -0
- package/.claude/skills/team-adversarial-swarm/scripts/pheromone.py +144 -0
- package/.claude/skills/team-adversarial-swarm/scripts/scoring.py +92 -0
- package/.claude/skills/team-adversarial-swarm/scripts/test_aco.py +475 -0
- package/.claude/skills/team-adversarial-swarm/specs/ant-output-schema.md +115 -0
- package/.claude/skills/team-adversarial-swarm/specs/convergence-criteria.md +75 -0
- package/.claude/skills/team-adversarial-swarm/specs/pheromone-schema.md +90 -0
- package/.claude/skills/team-adversarial-swarm/specs/swarm-config-template.json +66 -0
- package/.claude/skills/team-adversarial-swarm/specs/swarm-protocol.md +105 -0
- package/.claude/skills/team-adversarial-swarm/workflows/wf-swarm-converge.js +197 -0
- package/.claude/skills/team-adversarial-swarm/workflows/wf-swarm-explore.js +194 -0
- package/.claude/skills/team-adversarial-swarm/workflows/wf-swarm-score.js +188 -0
- package/.claude/skills/team-adversarial-swarm/workflows/wf-swarm-synthesize.js +248 -0
- package/.codex/skills/maestro/SKILL.md +7 -2
- package/.codex/skills/maestro-companion/SKILL.md +485 -0
- package/.codex/skills/maestro-grill/SKILL.md +111 -0
- package/.codex/skills/maestro-ralph/SKILL.md +11 -7
- package/.codex/skills/manage-codebase-rebuild/SKILL.md +6 -0
- package/.codex/skills/manage-codebase-refresh/SKILL.md +6 -0
- package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.d.ts +36 -0
- package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.js +138 -2
- package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/search.js +13 -0
- package/dashboard/dist-server/dashboard/src/server/wiki/search.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.d.ts +11 -0
- package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js +178 -0
- package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +1 -0
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +39 -23
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
- package/dashboard/dist-server/src/graph/types.d.ts +111 -0
- package/dashboard/dist-server/src/graph/types.js +2 -0
- package/dashboard/dist-server/src/graph/types.js.map +1 -0
- package/dist/src/cli.js +1 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/kg.d.ts +11 -0
- package/dist/src/commands/kg.d.ts.map +1 -0
- package/dist/src/commands/kg.js +486 -0
- package/dist/src/commands/kg.js.map +1 -0
- package/dist/src/graph/analyzers/fs-analyzer.d.ts +10 -0
- package/dist/src/graph/analyzers/fs-analyzer.d.ts.map +1 -0
- package/dist/src/graph/analyzers/fs-analyzer.js +959 -0
- package/dist/src/graph/analyzers/fs-analyzer.js.map +1 -0
- package/dist/src/graph/index.d.ts +6 -0
- package/dist/src/graph/index.d.ts.map +1 -0
- package/dist/src/graph/index.js +6 -0
- package/dist/src/graph/index.js.map +1 -0
- package/dist/src/graph/loader.d.ts +3 -0
- package/dist/src/graph/loader.d.ts.map +1 -0
- package/dist/src/graph/loader.js +12 -0
- package/dist/src/graph/loader.js.map +1 -0
- package/dist/src/graph/merger.d.ts +56 -0
- package/dist/src/graph/merger.d.ts.map +1 -0
- package/dist/src/graph/merger.js +896 -0
- package/dist/src/graph/merger.js.map +1 -0
- package/dist/src/graph/query.d.ts +7 -0
- package/dist/src/graph/query.d.ts.map +1 -0
- package/dist/src/graph/query.js +126 -0
- package/dist/src/graph/query.js.map +1 -0
- package/dist/src/graph/types.d.ts +112 -0
- package/dist/src/graph/types.d.ts.map +1 -0
- package/dist/src/graph/types.js +2 -0
- package/dist/src/graph/types.js.map +1 -0
- package/dist/src/tui/install-ui/KgVendorConfig.d.ts +7 -0
- package/dist/src/tui/install-ui/KgVendorConfig.d.ts.map +1 -0
- package/dist/src/tui/install-ui/KgVendorConfig.js +9 -0
- package/dist/src/tui/install-ui/KgVendorConfig.js.map +1 -0
- package/dist/src/utils/update-notices.js +23 -0
- package/dist/src/utils/update-notices.js.map +1 -1
- package/package.json +1 -1
- package/workflows/analyze.md +2 -1
- package/workflows/brainstorm.md +24 -1
- package/workflows/codebase-rebuild.md +141 -1
- package/workflows/codebase-refresh.md +20 -0
- package/workflows/finish-work.md +7 -2
- package/workflows/grill.md +513 -0
- package/workflows/plan.md +7 -4
- package/workflows/specs-setup.md +99 -3
- package/workflows/swarm/wf-analyze.js +347 -0
- package/workflows/swarm/wf-brainstorm.js +456 -0
- package/workflows/swarm/wf-execute.js +379 -0
- package/workflows/swarm/wf-grill.js +359 -0
- package/workflows/swarm/wf-milestone-audit.js +385 -0
- package/workflows/swarm/wf-plan.js +468 -0
- package/workflows/swarm/wf-review.js +341 -0
- package/workflows/swarm/wf-verify.js +395 -0
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
export const meta = {
|
|
2
|
+
name: 'wf-brainstorm',
|
|
3
|
+
description: 'Multi-role brainstorm with 3-specialist cross-review and adversarial guidance arbitration',
|
|
4
|
+
whenToUse: 'Accelerate maestro-brainstorm with parallel roles + 3-specialist cross-review + adversarial guidance synthesis',
|
|
5
|
+
phases: [
|
|
6
|
+
{ title: 'Analyze', detail: 'Parallel multi-role analysis via role-design-author' },
|
|
7
|
+
{ title: 'CrossReview', detail: '3 specialized reviewers (conflict-hunter, synergy-finder, gap-detector) in parallel' },
|
|
8
|
+
{ title: 'Compete', detail: '3 independent guidance proposals from competing philosophies' },
|
|
9
|
+
{ title: 'Arbitrate', detail: 'Adversarial arbitrator resolves competing proposals into unified guidance' },
|
|
10
|
+
],
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const VALID_ROLES = [
|
|
14
|
+
{ key: 'system-architect', focus: 'System design, scalability, maintainability, module boundaries, technical debt, design patterns, infrastructure' },
|
|
15
|
+
{ key: 'product-manager', focus: 'User value, market fit, MVP scope, prioritization, success metrics, stakeholder management, feature ROI' },
|
|
16
|
+
{ key: 'test-strategist', focus: 'Testability, quality assurance, test pyramid, coverage strategy, risk-based testing, regression prevention' },
|
|
17
|
+
{ key: 'ux-expert', focus: 'User experience, interaction patterns, accessibility, cognitive load, information architecture, user flows' },
|
|
18
|
+
{ key: 'subject-matter-expert', focus: 'Domain knowledge, business rules, industry standards, compliance requirements, edge cases from domain' },
|
|
19
|
+
{ key: 'data-architect', focus: 'Data modeling, storage strategy, query patterns, migration paths, data integrity, caching, consistency' },
|
|
20
|
+
{ key: 'ui-designer', focus: 'Visual design, component hierarchy, design tokens, responsive layout, motion, color and typography' },
|
|
21
|
+
{ key: 'product-owner', focus: 'Business priorities, backlog management, acceptance criteria, stakeholder value, sprint planning' },
|
|
22
|
+
{ key: 'scrum-master', focus: 'Process efficiency, team dynamics, impediment removal, delivery cadence, continuous improvement' },
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
const ROLE_ANALYSIS_SCHEMA = {
|
|
26
|
+
type: 'object',
|
|
27
|
+
properties: {
|
|
28
|
+
role: { type: 'string' },
|
|
29
|
+
decision_digest: {
|
|
30
|
+
type: 'array',
|
|
31
|
+
items: {
|
|
32
|
+
type: 'object',
|
|
33
|
+
properties: {
|
|
34
|
+
id: { type: 'string' },
|
|
35
|
+
feature: { type: 'string' },
|
|
36
|
+
stance: { type: 'string' },
|
|
37
|
+
priority: { type: 'string', enum: ['must-have', 'should-have', 'nice-to-have'] },
|
|
38
|
+
rationale: { type: 'string' },
|
|
39
|
+
},
|
|
40
|
+
required: ['id', 'feature', 'stance', 'priority'],
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
interfaces: {
|
|
44
|
+
type: 'array',
|
|
45
|
+
items: {
|
|
46
|
+
type: 'object',
|
|
47
|
+
properties: {
|
|
48
|
+
contract: { type: 'string' },
|
|
49
|
+
consumers: { type: 'array', items: { type: 'string' } },
|
|
50
|
+
provider: { type: 'string' },
|
|
51
|
+
},
|
|
52
|
+
required: ['contract', 'consumers'],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
cross_cutting_positions: {
|
|
56
|
+
type: 'array',
|
|
57
|
+
items: {
|
|
58
|
+
type: 'object',
|
|
59
|
+
properties: {
|
|
60
|
+
topic: { type: 'string' },
|
|
61
|
+
position: { type: 'string' },
|
|
62
|
+
strength: { type: 'string', enum: ['strong', 'moderate', 'weak'] },
|
|
63
|
+
},
|
|
64
|
+
required: ['topic', 'position', 'strength'],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
findings: {
|
|
68
|
+
type: 'array',
|
|
69
|
+
items: {
|
|
70
|
+
type: 'object',
|
|
71
|
+
properties: {
|
|
72
|
+
finding: { type: 'string' },
|
|
73
|
+
impact: { type: 'string' },
|
|
74
|
+
evidence: { type: 'string' },
|
|
75
|
+
},
|
|
76
|
+
required: ['finding', 'impact'],
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
key_insight: { type: 'string' },
|
|
80
|
+
},
|
|
81
|
+
required: ['role', 'decision_digest', 'cross_cutting_positions', 'findings', 'key_insight'],
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const CROSS_REVIEW_SCHEMA = {
|
|
85
|
+
type: 'object',
|
|
86
|
+
properties: {
|
|
87
|
+
reviewer_type: { type: 'string' },
|
|
88
|
+
conflicts: {
|
|
89
|
+
type: 'array',
|
|
90
|
+
items: {
|
|
91
|
+
type: 'object',
|
|
92
|
+
properties: {
|
|
93
|
+
id: { type: 'string' },
|
|
94
|
+
roles: { type: 'array', items: { type: 'string' } },
|
|
95
|
+
topic: { type: 'string' },
|
|
96
|
+
stances: { type: 'array', items: { type: 'object', properties: { role: { type: 'string' }, stance: { type: 'string' } }, required: ['role', 'stance'] } },
|
|
97
|
+
resolution_suggestion: { type: 'string' },
|
|
98
|
+
severity: { type: 'string', enum: ['blocking', 'significant', 'minor'] },
|
|
99
|
+
},
|
|
100
|
+
required: ['id', 'roles', 'topic', 'stances', 'severity'],
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
synergies: {
|
|
104
|
+
type: 'array',
|
|
105
|
+
items: {
|
|
106
|
+
type: 'object',
|
|
107
|
+
properties: {
|
|
108
|
+
roles: { type: 'array', items: { type: 'string' } },
|
|
109
|
+
topic: { type: 'string' },
|
|
110
|
+
combined_value: { type: 'string' },
|
|
111
|
+
},
|
|
112
|
+
required: ['roles', 'topic', 'combined_value'],
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
gaps: {
|
|
116
|
+
type: 'array',
|
|
117
|
+
items: {
|
|
118
|
+
type: 'object',
|
|
119
|
+
properties: {
|
|
120
|
+
area: { type: 'string' },
|
|
121
|
+
missing_perspective: { type: 'string' },
|
|
122
|
+
impact: { type: 'string' },
|
|
123
|
+
},
|
|
124
|
+
required: ['area', 'missing_perspective'],
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
required: ['reviewer_type', 'conflicts', 'synergies', 'gaps'],
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const GUIDANCE_PROPOSAL_SCHEMA = {
|
|
132
|
+
type: 'object',
|
|
133
|
+
properties: {
|
|
134
|
+
philosophy: { type: 'string' },
|
|
135
|
+
guidelines: {
|
|
136
|
+
type: 'array',
|
|
137
|
+
items: {
|
|
138
|
+
type: 'object',
|
|
139
|
+
properties: {
|
|
140
|
+
id: { type: 'string' },
|
|
141
|
+
guideline: { type: 'string' },
|
|
142
|
+
category: { type: 'string', enum: ['must', 'must-not', 'should', 'should-not', 'may'] },
|
|
143
|
+
source_roles: { type: 'array', items: { type: 'string' } },
|
|
144
|
+
rationale: { type: 'string' },
|
|
145
|
+
resolved_conflict: { type: 'string' },
|
|
146
|
+
},
|
|
147
|
+
required: ['id', 'guideline', 'category', 'rationale'],
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
conflict_resolutions: {
|
|
151
|
+
type: 'array',
|
|
152
|
+
items: {
|
|
153
|
+
type: 'object',
|
|
154
|
+
properties: {
|
|
155
|
+
conflict_id: { type: 'string' },
|
|
156
|
+
resolution: { type: 'string' },
|
|
157
|
+
rationale: { type: 'string' },
|
|
158
|
+
winner_role: { type: 'string' },
|
|
159
|
+
},
|
|
160
|
+
required: ['conflict_id', 'resolution', 'rationale'],
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
trade_off_summary: { type: 'string' },
|
|
164
|
+
confidence: { type: 'number', minimum: 0, maximum: 100 },
|
|
165
|
+
},
|
|
166
|
+
required: ['philosophy', 'guidelines', 'conflict_resolutions', 'confidence'],
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const GUIDANCE_SCHEMA = {
|
|
170
|
+
type: 'object',
|
|
171
|
+
properties: {
|
|
172
|
+
guidelines: {
|
|
173
|
+
type: 'array',
|
|
174
|
+
items: {
|
|
175
|
+
type: 'object',
|
|
176
|
+
properties: {
|
|
177
|
+
id: { type: 'string' },
|
|
178
|
+
guideline: { type: 'string' },
|
|
179
|
+
category: { type: 'string', enum: ['must', 'must-not', 'should', 'should-not', 'may'] },
|
|
180
|
+
source_roles: { type: 'array', items: { type: 'string' } },
|
|
181
|
+
rationale: { type: 'string' },
|
|
182
|
+
resolved_conflict: { type: 'string' },
|
|
183
|
+
source_proposal: { type: 'string' },
|
|
184
|
+
},
|
|
185
|
+
required: ['id', 'guideline', 'category', 'source_roles', 'rationale'],
|
|
186
|
+
},
|
|
187
|
+
},
|
|
188
|
+
resolved_conflicts: {
|
|
189
|
+
type: 'array',
|
|
190
|
+
items: {
|
|
191
|
+
type: 'object',
|
|
192
|
+
properties: {
|
|
193
|
+
conflict_id: { type: 'string' },
|
|
194
|
+
resolution: { type: 'string' },
|
|
195
|
+
rationale: { type: 'string' },
|
|
196
|
+
winner_role: { type: 'string' },
|
|
197
|
+
dissenting_proposal: { type: 'string' },
|
|
198
|
+
},
|
|
199
|
+
required: ['conflict_id', 'resolution', 'rationale'],
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
arbitration_notes: { type: 'string' },
|
|
203
|
+
open_questions: { type: 'array', items: { type: 'string' } },
|
|
204
|
+
executive_summary: { type: 'string' },
|
|
205
|
+
},
|
|
206
|
+
required: ['guidelines', 'resolved_conflicts', 'arbitration_notes', 'executive_summary'],
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const topic = args?.topic || 'the proposed system'
|
|
210
|
+
const context = args?.context || ''
|
|
211
|
+
const roleCount = args?.count || 3
|
|
212
|
+
const selectedRoles = args?.roles
|
|
213
|
+
? VALID_ROLES.filter(r => args.roles.includes(r.key))
|
|
214
|
+
: VALID_ROLES.slice(0, roleCount)
|
|
215
|
+
|
|
216
|
+
// Phase 1: Parallel multi-role analysis via role-design-author
|
|
217
|
+
phase('Analyze')
|
|
218
|
+
log(`Launching ${selectedRoles.length} role analyses in parallel via role-design-author...`)
|
|
219
|
+
|
|
220
|
+
const analyses = await parallel(
|
|
221
|
+
selectedRoles.map(role => () =>
|
|
222
|
+
agent(
|
|
223
|
+
`You are the ${role.key} role analyzing: ${topic}
|
|
224
|
+
${context ? 'Context: ' + context : ''}
|
|
225
|
+
|
|
226
|
+
Your focus areas: ${role.focus}
|
|
227
|
+
|
|
228
|
+
Produce a structured role analysis with:
|
|
229
|
+
1. Decision Digest — your stances on each feature/aspect (id, feature, stance, priority, rationale)
|
|
230
|
+
2. Interfaces — contracts you propose/consume (contract, consumers, provider)
|
|
231
|
+
3. Cross-Cutting Positions — your stance on shared topics (topic, position, strength)
|
|
232
|
+
4. Findings — discoveries with impact and evidence
|
|
233
|
+
5. Key Insight — your single most important observation
|
|
234
|
+
|
|
235
|
+
Read relevant source files if needed to ground your analysis in reality.
|
|
236
|
+
Be specific and opinionated — take clear stances with rationale.`,
|
|
237
|
+
{ label: `role:${role.key}`, phase: 'Analyze', schema: ROLE_ANALYSIS_SCHEMA, agentType: 'role-design-author' }
|
|
238
|
+
)
|
|
239
|
+
)
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
const validAnalyses = analyses.filter(Boolean)
|
|
243
|
+
log(`${validAnalyses.length}/${selectedRoles.length} role analyses completed`)
|
|
244
|
+
|
|
245
|
+
const analysesDigest = validAnalyses.map(a => {
|
|
246
|
+
const decisions = a.decision_digest.map(d => ` ${d.id}: [${d.priority}] ${d.feature} — ${d.stance}`).join('\n')
|
|
247
|
+
const positions = a.cross_cutting_positions.map(p => ` ${p.topic}: ${p.position} [${p.strength}]`).join('\n')
|
|
248
|
+
const findings = a.findings.map(f => ` - ${f.finding} (impact: ${f.impact})`).join('\n')
|
|
249
|
+
return `## ${a.role}\nKey insight: ${a.key_insight}\n\nDecisions:\n${decisions}\n\nPositions:\n${positions}\n\nFindings:\n${findings}`
|
|
250
|
+
}).join('\n\n---\n\n')
|
|
251
|
+
|
|
252
|
+
// Phase 2: 3 specialized cross-reviewers in parallel
|
|
253
|
+
phase('CrossReview')
|
|
254
|
+
log('Launching 3 specialized cross-reviewers in parallel...')
|
|
255
|
+
|
|
256
|
+
const crossReviews = await parallel([
|
|
257
|
+
() => agent(
|
|
258
|
+
`You are the CONFLICT HUNTER. Your sole mission is to find contradictions between roles.
|
|
259
|
+
|
|
260
|
+
${validAnalyses.length} role analyses:
|
|
261
|
+
${analysesDigest}
|
|
262
|
+
|
|
263
|
+
Focus EXCLUSIVELY on:
|
|
264
|
+
1. Same feature/topic with CONTRADICTORY stances between roles
|
|
265
|
+
2. Incompatible priorities (one role says must-have, another says not needed)
|
|
266
|
+
3. Conflicting cross-cutting positions
|
|
267
|
+
4. Interface mismatches (one produces X, another expects Y)
|
|
268
|
+
|
|
269
|
+
Classify each conflict:
|
|
270
|
+
- blocking: fundamental disagreement that prevents progress
|
|
271
|
+
- significant: meaningful disagreement but can be resolved
|
|
272
|
+
- minor: style/preference difference
|
|
273
|
+
|
|
274
|
+
For each conflict, suggest a resolution direction.
|
|
275
|
+
Set reviewer_type="conflict-hunter".
|
|
276
|
+
Be AGGRESSIVE — surface every possible contradiction, even subtle ones.`,
|
|
277
|
+
{ label: 'review:conflicts', phase: 'CrossReview', schema: CROSS_REVIEW_SCHEMA, agentType: 'cross-role-reviewer' }
|
|
278
|
+
),
|
|
279
|
+
() => agent(
|
|
280
|
+
`You are the SYNERGY FINDER. Your sole mission is to find reinforcing alignments between roles.
|
|
281
|
+
|
|
282
|
+
${validAnalyses.length} role analyses:
|
|
283
|
+
${analysesDigest}
|
|
284
|
+
|
|
285
|
+
Focus EXCLUSIVELY on:
|
|
286
|
+
1. Compatible positions that create MORE value when combined
|
|
287
|
+
2. Shared priorities that validate importance
|
|
288
|
+
3. Complementary interfaces (one provides exactly what another needs)
|
|
289
|
+
4. Cross-cutting alignments that reveal strong consensus
|
|
290
|
+
|
|
291
|
+
For each synergy, explain the combined value — how the combination is more than the sum.
|
|
292
|
+
Set reviewer_type="synergy-finder".
|
|
293
|
+
Be GENEROUS — surface every alignment, including implicit ones.`,
|
|
294
|
+
{ label: 'review:synergies', phase: 'CrossReview', schema: CROSS_REVIEW_SCHEMA, agentType: 'cross-role-reviewer' }
|
|
295
|
+
),
|
|
296
|
+
() => agent(
|
|
297
|
+
`You are the GAP DETECTOR. Your sole mission is to find MISSING perspectives and blind spots.
|
|
298
|
+
|
|
299
|
+
${validAnalyses.length} role analyses:
|
|
300
|
+
${analysesDigest}
|
|
301
|
+
|
|
302
|
+
Focus EXCLUSIVELY on:
|
|
303
|
+
1. Topics addressed by one role but IGNORED by others who should care
|
|
304
|
+
2. Missing role perspectives entirely (security not represented? operations?)
|
|
305
|
+
3. Unstated assumptions that no role challenged
|
|
306
|
+
4. Edge cases and failure modes no one considered
|
|
307
|
+
5. Integration points that fall between role responsibilities
|
|
308
|
+
|
|
309
|
+
For each gap, identify what perspective is missing and the impact of that blindspot.
|
|
310
|
+
Set reviewer_type="gap-detector".
|
|
311
|
+
Be THOROUGH — missing perspectives are the most dangerous type of oversight.`,
|
|
312
|
+
{ label: 'review:gaps', phase: 'CrossReview', schema: CROSS_REVIEW_SCHEMA, agentType: 'cross-role-reviewer' }
|
|
313
|
+
),
|
|
314
|
+
])
|
|
315
|
+
|
|
316
|
+
const validReviews = crossReviews.filter(Boolean)
|
|
317
|
+
const allConflicts = validReviews.flatMap(r => r.conflicts)
|
|
318
|
+
const allSynergies = validReviews.flatMap(r => r.synergies)
|
|
319
|
+
const allGaps = validReviews.flatMap(r => r.gaps)
|
|
320
|
+
|
|
321
|
+
log(`Cross-review: ${allConflicts.length} conflicts, ${allSynergies.length} synergies, ${allGaps.length} gaps`)
|
|
322
|
+
|
|
323
|
+
const crossReviewDigest = `Conflicts (${allConflicts.length}):
|
|
324
|
+
${allConflicts.map(c => `[${c.severity}] ${c.topic}: ${c.stances.map(s => s.role + '→' + s.stance).join(' vs ')}\n Suggestion: ${c.resolution_suggestion || 'none'}`).join('\n')}
|
|
325
|
+
|
|
326
|
+
Synergies (${allSynergies.length}):
|
|
327
|
+
${allSynergies.map(s => `${s.roles.join(' + ')}: ${s.topic} — ${s.combined_value}`).join('\n')}
|
|
328
|
+
|
|
329
|
+
Gaps (${allGaps.length}):
|
|
330
|
+
${allGaps.map(g => `${g.area} — missing: ${g.missing_perspective}${g.impact ? ' (impact: ' + g.impact + ')' : ''}`).join('\n')}`
|
|
331
|
+
|
|
332
|
+
// Phase 3: 3 competing guidance proposals from different philosophies
|
|
333
|
+
phase('Compete')
|
|
334
|
+
log('Launching 3 competing guidance proposals...')
|
|
335
|
+
|
|
336
|
+
const proposals = await parallel([
|
|
337
|
+
() => agent(
|
|
338
|
+
`You are the CONSERVATIVE proposal author. Generate guidance that MINIMIZES RISK.
|
|
339
|
+
|
|
340
|
+
Topic: ${topic}
|
|
341
|
+
Role Analyses:\n${analysesDigest}
|
|
342
|
+
|
|
343
|
+
Cross-Review:\n${crossReviewDigest}
|
|
344
|
+
|
|
345
|
+
Your philosophy: SAFETY FIRST
|
|
346
|
+
- Resolve conflicts in favor of stability and backward compatibility
|
|
347
|
+
- MUST/MUST-NOT for anything with risk, SHOULD for everything else
|
|
348
|
+
- Prefer proven patterns over innovative approaches
|
|
349
|
+
- When in doubt, require explicit approval (deferred decision)
|
|
350
|
+
- Gaps should be addressed before proceeding
|
|
351
|
+
|
|
352
|
+
Generate guidelines using RFC-2119 (MUST, MUST NOT, SHOULD, SHOULD NOT, MAY).
|
|
353
|
+
Resolve each conflict with your conservative lens.
|
|
354
|
+
Report trade_off_summary: what you sacrifice for safety.`,
|
|
355
|
+
{ label: 'proposal:conservative', phase: 'Compete', schema: GUIDANCE_PROPOSAL_SCHEMA }
|
|
356
|
+
),
|
|
357
|
+
() => agent(
|
|
358
|
+
`You are the PROGRESSIVE proposal author. Generate guidance that MAXIMIZES VELOCITY.
|
|
359
|
+
|
|
360
|
+
Topic: ${topic}
|
|
361
|
+
Role Analyses:\n${analysesDigest}
|
|
362
|
+
|
|
363
|
+
Cross-Review:\n${crossReviewDigest}
|
|
364
|
+
|
|
365
|
+
Your philosophy: SHIP FAST, ITERATE
|
|
366
|
+
- Resolve conflicts in favor of speed and user value
|
|
367
|
+
- Use MAY/SHOULD liberally, reserve MUST only for safety-critical items
|
|
368
|
+
- Prefer pragmatic solutions, accept tech debt if it unblocks progress
|
|
369
|
+
- Gaps can be addressed incrementally post-launch
|
|
370
|
+
- Favor the role closest to the user (PM, UX) in conflict resolution
|
|
371
|
+
|
|
372
|
+
Generate guidelines using RFC-2119 (MUST, MUST NOT, SHOULD, SHOULD NOT, MAY).
|
|
373
|
+
Resolve each conflict with your progressive lens.
|
|
374
|
+
Report trade_off_summary: what risks you accept for velocity.`,
|
|
375
|
+
{ label: 'proposal:progressive', phase: 'Compete', schema: GUIDANCE_PROPOSAL_SCHEMA }
|
|
376
|
+
),
|
|
377
|
+
() => agent(
|
|
378
|
+
`You are the BALANCED proposal author. Generate guidance that OPTIMIZES FOR SUSTAINABILITY.
|
|
379
|
+
|
|
380
|
+
Topic: ${topic}
|
|
381
|
+
Role Analyses:\n${analysesDigest}
|
|
382
|
+
|
|
383
|
+
Cross-Review:\n${crossReviewDigest}
|
|
384
|
+
|
|
385
|
+
Your philosophy: SUSTAINABLE EXCELLENCE
|
|
386
|
+
- Resolve conflicts by weighing evidence strength from all perspectives
|
|
387
|
+
- Priority: security > correctness > user experience > performance > convenience
|
|
388
|
+
- "must-have" from multiple roles > "must-have" from single role
|
|
389
|
+
- Strong evidence > moderate > weak, regardless of role seniority
|
|
390
|
+
- Address critical gaps, defer minor ones
|
|
391
|
+
- Balance speed and quality based on risk level
|
|
392
|
+
|
|
393
|
+
Generate guidelines using RFC-2119 (MUST, MUST NOT, SHOULD, SHOULD NOT, MAY).
|
|
394
|
+
Resolve each conflict with your balanced lens.
|
|
395
|
+
Report trade_off_summary: what you optimize for and what you deprioritize.`,
|
|
396
|
+
{ label: 'proposal:balanced', phase: 'Compete', schema: GUIDANCE_PROPOSAL_SCHEMA }
|
|
397
|
+
),
|
|
398
|
+
])
|
|
399
|
+
|
|
400
|
+
const validProposals = proposals.filter(Boolean)
|
|
401
|
+
const proposalDigest = validProposals.map(p =>
|
|
402
|
+
`### ${p.philosophy} (confidence: ${p.confidence}%)\nGuidelines: ${p.guidelines.length}\nConflict resolutions: ${p.conflict_resolutions.length}\nTrade-offs: ${p.trade_off_summary}\nKey guidelines:\n${p.guidelines.slice(0, 5).map(g => ` [${g.category.toUpperCase()}] ${g.guideline}`).join('\n')}`
|
|
403
|
+
).join('\n\n')
|
|
404
|
+
|
|
405
|
+
log(`${validProposals.length} competing proposals generated`)
|
|
406
|
+
|
|
407
|
+
// Phase 4: Adversarial Arbitration
|
|
408
|
+
phase('Arbitrate')
|
|
409
|
+
log('Adversarial arbitrator resolving competing proposals...')
|
|
410
|
+
|
|
411
|
+
const guidance = await agent(
|
|
412
|
+
`You are the ARBITRATOR. Three competing guidance proposals approach the same problem differently.
|
|
413
|
+
|
|
414
|
+
Topic: ${topic}
|
|
415
|
+
|
|
416
|
+
=== COMPETING PROPOSALS ===
|
|
417
|
+
${proposalDigest}
|
|
418
|
+
|
|
419
|
+
=== FULL PROPOSALS ===
|
|
420
|
+
${validProposals.map(p => `## ${p.philosophy}\n${p.guidelines.map(g => `[${g.category}] ${g.id}: ${g.guideline} — ${g.rationale}`).join('\n')}\n\nConflict resolutions:\n${p.conflict_resolutions.map(r => `${r.conflict_id}: ${r.resolution} (winner: ${r.winner_role || 'compromise'})`).join('\n')}`).join('\n\n---\n\n')}
|
|
421
|
+
|
|
422
|
+
=== CROSS-REVIEW DATA ===
|
|
423
|
+
${crossReviewDigest}
|
|
424
|
+
|
|
425
|
+
ARBITRATE:
|
|
426
|
+
1. For each guideline topic, compare how all 3 proposals handle it
|
|
427
|
+
2. Select the BEST resolution for each conflict — not always the same philosophy
|
|
428
|
+
3. Cherry-pick the strongest guidelines from each proposal
|
|
429
|
+
4. When proposals agree → high-confidence MUST/MUST-NOT
|
|
430
|
+
5. When proposals split 2-1 → go with the 2, note the dissent
|
|
431
|
+
6. When all 3 disagree → evaluate evidence depth and pick the best-argued position
|
|
432
|
+
7. List remaining open_questions that genuinely need user input
|
|
433
|
+
8. Write arbitration_notes explaining your meta-reasoning
|
|
434
|
+
9. Write executive_summary (2-3 paragraphs)
|
|
435
|
+
|
|
436
|
+
Tag each output guideline with source_proposal to trace its origin.`,
|
|
437
|
+
{ label: 'arbitrate', phase: 'Arbitrate', schema: GUIDANCE_SCHEMA }
|
|
438
|
+
)
|
|
439
|
+
|
|
440
|
+
return {
|
|
441
|
+
analyses: validAnalyses,
|
|
442
|
+
crossReviews: validReviews,
|
|
443
|
+
proposals: validProposals,
|
|
444
|
+
guidance: guidance,
|
|
445
|
+
metadata: {
|
|
446
|
+
topic: topic,
|
|
447
|
+
role_count: selectedRoles.length,
|
|
448
|
+
completed_count: validAnalyses.length,
|
|
449
|
+
conflict_count: allConflicts.length,
|
|
450
|
+
blocking_conflicts: allConflicts.filter(c => c.severity === 'blocking').length,
|
|
451
|
+
synergy_count: allSynergies.length,
|
|
452
|
+
gap_count: allGaps.length,
|
|
453
|
+
proposal_count: validProposals.length,
|
|
454
|
+
guideline_count: guidance ? guidance.guidelines.length : 0,
|
|
455
|
+
},
|
|
456
|
+
}
|