maestro-flow 0.4.20 → 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/skills/maestro-ralph-execute/SKILL.md +2 -1
- package/.agents/skills/maestro-swarm-workflow/SKILL.md +27 -19
- package/.agents/skills/maestro-universal-workflow/SKILL.md +563 -0
- 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/skills/maestro-ralph-execute/SKILL.md +2 -1
- package/.agy/skills/maestro-swarm-workflow/SKILL.md +27 -19
- package/.agy/skills/maestro-universal-workflow/SKILL.md +560 -0
- 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/commands/maestro-ralph-execute.md +2 -1
- package/.claude/commands/maestro-swarm-workflow.md +27 -19
- package/.claude/commands/maestro-universal-workflow.md +561 -0
- 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/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.js +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/search.js +1 -1
- 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 +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js +5 -5
- 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.js +3 -3
- 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/commands/install-backend.d.ts +0 -7
- package/dist/src/commands/install-backend.d.ts.map +1 -1
- package/dist/src/commands/install-backend.js +0 -14
- package/dist/src/commands/install-backend.js.map +1 -1
- package/dist/src/commands/install.d.ts.map +1 -1
- package/dist/src/commands/install.js +0 -18
- package/dist/src/commands/install.js.map +1 -1
- package/dist/src/commands/kg.d.ts +2 -2
- package/dist/src/commands/kg.d.ts.map +1 -1
- package/dist/src/commands/kg.js +150 -179
- package/dist/src/commands/kg.js.map +1 -1
- 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/i18n/locales/en.d.ts.map +1 -1
- package/dist/src/i18n/locales/en.js +0 -10
- package/dist/src/i18n/locales/en.js.map +1 -1
- package/dist/src/i18n/locales/zh.d.ts.map +1 -1
- package/dist/src/i18n/locales/zh.js +0 -10
- package/dist/src/i18n/locales/zh.js.map +1 -1
- package/dist/src/i18n/types.d.ts +0 -9
- package/dist/src/i18n/types.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallConfirm.d.ts +0 -1
- package/dist/src/tui/install-ui/InstallConfirm.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallConfirm.js +1 -1
- package/dist/src/tui/install-ui/InstallConfirm.js.map +1 -1
- package/dist/src/tui/install-ui/InstallExecution.d.ts +0 -1
- package/dist/src/tui/install-ui/InstallExecution.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallExecution.js +0 -22
- package/dist/src/tui/install-ui/InstallExecution.js.map +1 -1
- package/dist/src/tui/install-ui/InstallFlow.d.ts +1 -1
- package/dist/src/tui/install-ui/InstallFlow.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallFlow.js +5 -23
- package/dist/src/tui/install-ui/InstallFlow.js.map +1 -1
- package/dist/src/tui/install-ui/InstallHub.d.ts +0 -2
- package/dist/src/tui/install-ui/InstallHub.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallHub.js +0 -6
- package/dist/src/tui/install-ui/InstallHub.js.map +1 -1
- package/dist/src/tui/install-ui/InstallResult.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallResult.js +1 -1
- package/dist/src/tui/install-ui/InstallResult.js.map +1 -1
- package/dist/src/utils/update-notices.js +12 -0
- package/dist/src/utils/update-notices.js.map +1 -1
- package/package.json +1 -1
- package/workflows/swarm/wf-analyze.js +195 -34
- package/workflows/swarm/wf-brainstorm.js +225 -53
- package/workflows/swarm/wf-execute.js +199 -23
- package/workflows/swarm/wf-grill.js +181 -20
- package/workflows/swarm/wf-milestone-audit.js +178 -29
- package/workflows/swarm/wf-plan.js +288 -53
- package/workflows/swarm/wf-review.js +195 -80
- package/workflows/swarm/wf-verify.js +125 -28
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export const meta = {
|
|
2
2
|
name: 'wf-analyze',
|
|
3
|
-
description: 'Multi-dimensional
|
|
4
|
-
whenToUse: 'Accelerate maestro-analyze with parallel
|
|
3
|
+
description: 'Multi-dimensional analysis with adversarial score verification and 3-way advocacy synthesis',
|
|
4
|
+
whenToUse: 'Accelerate maestro-analyze with parallel exploration + scoring + adversarial cross-verify + judge panel Go/No-Go',
|
|
5
5
|
phases: [
|
|
6
6
|
{ title: 'Explore', detail: '3-layer codebase exploration via cli-explore-agent' },
|
|
7
7
|
{ title: 'Score', detail: 'Parallel 6-dimension scoring via workflow-analyzer' },
|
|
8
|
-
{ title: '
|
|
8
|
+
{ title: 'CrossVerify', detail: 'Adversarial skeptic challenges each dimension score' },
|
|
9
|
+
{ title: 'Synthesize', detail: '3-way adversarial advocacy (go/no-go/conditional) + referee verdict' },
|
|
9
10
|
],
|
|
10
11
|
}
|
|
11
12
|
|
|
@@ -43,6 +44,32 @@ const DIMENSION_SCHEMA = {
|
|
|
43
44
|
required: ['dimension', 'score', 'confidence', 'evidence', 'summary'],
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
const SCORE_CHALLENGE_SCHEMA = {
|
|
48
|
+
type: 'object',
|
|
49
|
+
properties: {
|
|
50
|
+
dimension: { type: 'string' },
|
|
51
|
+
original_score: { type: 'number' },
|
|
52
|
+
challenge_result: { type: 'string', enum: ['confirmed', 'inflated', 'deflated'] },
|
|
53
|
+
adjusted_score: { type: 'number', minimum: 1, maximum: 5 },
|
|
54
|
+
counter_evidence: { type: 'array', items: { type: 'object', properties: { claim: { type: 'string' }, source: { type: 'string' } }, required: ['claim', 'source'] } },
|
|
55
|
+
reasoning: { type: 'string' },
|
|
56
|
+
},
|
|
57
|
+
required: ['dimension', 'original_score', 'challenge_result', 'adjusted_score', 'reasoning'],
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const ADVOCACY_SCHEMA = {
|
|
61
|
+
type: 'object',
|
|
62
|
+
properties: {
|
|
63
|
+
stance: { type: 'string', enum: ['go', 'conditional-go', 'no-go'] },
|
|
64
|
+
argument: { type: 'string' },
|
|
65
|
+
key_evidence: { type: 'array', items: { type: 'object', properties: { point: { type: 'string' }, source: { type: 'string' }, strength: { type: 'string', enum: ['strong', 'moderate', 'weak'] } }, required: ['point', 'source'] } },
|
|
66
|
+
weaknesses_acknowledged: { type: 'array', items: { type: 'string' } },
|
|
67
|
+
conditions: { type: 'array', items: { type: 'string' } },
|
|
68
|
+
confidence: { type: 'number', minimum: 0, maximum: 100 },
|
|
69
|
+
},
|
|
70
|
+
required: ['stance', 'argument', 'key_evidence', 'confidence'],
|
|
71
|
+
}
|
|
72
|
+
|
|
46
73
|
const SYNTHESIS_SCHEMA = {
|
|
47
74
|
type: 'object',
|
|
48
75
|
properties: {
|
|
@@ -50,18 +77,19 @@ const SYNTHESIS_SCHEMA = {
|
|
|
50
77
|
overall_confidence: { type: 'number', minimum: 0, maximum: 100 },
|
|
51
78
|
recommendation: { type: 'string', enum: ['go', 'conditional-go', 'no-go'] },
|
|
52
79
|
scope_verdict: { type: 'string', enum: ['large', 'medium', 'small'] },
|
|
80
|
+
adversarial_outcome: { type: 'object', properties: { winning_stance: { type: 'string' }, go_confidence: { type: 'number' }, nogo_confidence: { type: 'number' }, conditional_confidence: { type: 'number' }, decisive_factor: { type: 'string' } }, required: ['winning_stance', 'decisive_factor'] },
|
|
53
81
|
risk_matrix: { type: 'array', items: { type: 'object', properties: { risk: { type: 'string' }, probability: { type: 'string' }, impact: { type: 'string' }, dimension: { type: 'string' } }, required: ['risk', 'probability', 'impact', 'dimension'] } },
|
|
54
82
|
decisions: { type: 'array', items: { type: 'object', properties: { id: { type: 'string' }, decision: { type: 'string' }, status: { type: 'string', enum: ['locked', 'free', 'deferred'] }, rationale: { type: 'string' }, options_considered: { type: 'array', items: { type: 'string' } } }, required: ['id', 'decision', 'status', 'rationale'] } },
|
|
55
83
|
implementation_scope: { type: 'array', items: { type: 'object', properties: { objective: { type: 'string' }, acceptance_criteria: { type: 'string' }, priority: { type: 'string', enum: ['high', 'medium', 'low'] }, target_files: { type: 'array', items: { type: 'string' } } }, required: ['objective', 'priority'] } },
|
|
56
84
|
executive_summary: { type: 'string' },
|
|
57
85
|
},
|
|
58
|
-
required: ['overall_score', 'overall_confidence', 'recommendation', 'scope_verdict', 'risk_matrix', 'decisions', 'executive_summary'],
|
|
86
|
+
required: ['overall_score', 'overall_confidence', 'recommendation', 'scope_verdict', 'adversarial_outcome', 'risk_matrix', 'decisions', 'executive_summary'],
|
|
59
87
|
}
|
|
60
88
|
|
|
61
89
|
const target = args?.target || 'the current codebase'
|
|
62
90
|
const scope = args?.scope || ''
|
|
63
91
|
const context = args?.context || ''
|
|
64
|
-
const
|
|
92
|
+
const phaseArg = args?.phase || null
|
|
65
93
|
const selectedDimensions = args?.dimensions
|
|
66
94
|
? DIMENSIONS.filter(d => args.dimensions.includes(d.key))
|
|
67
95
|
: DIMENSIONS
|
|
@@ -74,7 +102,7 @@ const exploration = await agent(
|
|
|
74
102
|
`Perform 3-layer codebase exploration for: ${target}
|
|
75
103
|
${scope ? 'File scope: ' + scope : 'Explore the full project structure.'}
|
|
76
104
|
${context ? 'Additional context: ' + context : ''}
|
|
77
|
-
${
|
|
105
|
+
${phaseArg ? 'Phase context: ' + phaseArg : ''}
|
|
78
106
|
|
|
79
107
|
Layer 1 — Module Discovery (Breadth):
|
|
80
108
|
Search by topic keywords, identify ALL relevant files, map module boundaries.
|
|
@@ -107,7 +135,7 @@ const scores = await parallel(
|
|
|
107
135
|
`Evaluate dimension: ${dim.key}
|
|
108
136
|
Focus areas: ${dim.focus}
|
|
109
137
|
Target: ${target}
|
|
110
|
-
${
|
|
138
|
+
${phaseArg ? 'Phase: ' + phaseArg : ''}
|
|
111
139
|
|
|
112
140
|
Codebase exploration context:
|
|
113
141
|
${explorationContext}
|
|
@@ -130,57 +158,190 @@ For Risk dimension: include probability × impact matrix entries.`,
|
|
|
130
158
|
const validScores = scores.filter(Boolean)
|
|
131
159
|
log(`${validScores.length}/${selectedDimensions.length} dimensions scored`)
|
|
132
160
|
|
|
133
|
-
// Phase 3:
|
|
161
|
+
// Phase 3: Adversarial CrossVerify — skeptic challenges each dimension score
|
|
162
|
+
phase('CrossVerify')
|
|
163
|
+
log(`Adversarial challenge of ${validScores.length} dimension scores...`)
|
|
164
|
+
|
|
165
|
+
const challenges = await pipeline(
|
|
166
|
+
validScores,
|
|
167
|
+
(score) => agent(
|
|
168
|
+
`You are an adversarial SKEPTIC. Your job is to REFUTE this dimension score.
|
|
169
|
+
|
|
170
|
+
Dimension: ${score.dimension}
|
|
171
|
+
Original Score: ${score.score}/5 (confidence: ${score.confidence}%)
|
|
172
|
+
Evidence cited:
|
|
173
|
+
${score.evidence.map(e => '- ' + e.claim + ' [' + e.strength + '] @ ' + e.source).join('\n')}
|
|
174
|
+
Risks identified: ${(score.risks || []).map(r => r.risk + ' (' + r.probability + '/' + r.impact + ')').join('; ') || 'none'}
|
|
175
|
+
Summary: ${score.summary}
|
|
176
|
+
|
|
177
|
+
Target: ${target}
|
|
178
|
+
${explorationContext}
|
|
179
|
+
|
|
180
|
+
CHALLENGE the score by:
|
|
181
|
+
1. Read the ACTUAL source files cited as evidence — does the code actually support the claim?
|
|
182
|
+
2. Search for counter-evidence the scorer missed (contradictory patterns, hidden complexity)
|
|
183
|
+
3. Check for cognitive biases: anchoring to first impression, confirmation bias, optimism bias
|
|
184
|
+
4. Evaluate if the confidence level is justified by evidence quantity and strength
|
|
185
|
+
|
|
186
|
+
Challenge result:
|
|
187
|
+
- "confirmed": evidence holds, score is fair (only if you genuinely cannot find counter-evidence)
|
|
188
|
+
- "inflated": score should be LOWER — evidence is weak, cherry-picked, or missing key risks
|
|
189
|
+
- "deflated": score should be HIGHER — scorer was too pessimistic, missed positive signals
|
|
190
|
+
|
|
191
|
+
DEFAULT to "inflated" if uncertain — skeptics err on the side of caution.
|
|
192
|
+
Provide your adjusted_score and specific counter_evidence.`,
|
|
193
|
+
{ label: `challenge:${score.dimension}`, phase: 'CrossVerify', schema: SCORE_CHALLENGE_SCHEMA, agentType: 'workflow-analyzer' }
|
|
194
|
+
)
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
const adjustedScores = validScores.map((score, i) => {
|
|
198
|
+
const challenge = challenges[i]
|
|
199
|
+
if (!challenge) return score
|
|
200
|
+
return {
|
|
201
|
+
...score,
|
|
202
|
+
original_score: score.score,
|
|
203
|
+
score: challenge.adjusted_score,
|
|
204
|
+
challenge_result: challenge.challenge_result,
|
|
205
|
+
challenge_reasoning: challenge.reasoning,
|
|
206
|
+
counter_evidence: challenge.counter_evidence,
|
|
207
|
+
}
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
const challengedCount = challenges.filter(Boolean).filter(c => c.challenge_result !== 'confirmed').length
|
|
211
|
+
log(`${challengedCount}/${validScores.length} scores adjusted by adversarial challenge`)
|
|
212
|
+
|
|
213
|
+
// Phase 4: 3-way Adversarial Advocacy Panel + Referee
|
|
134
214
|
phase('Synthesize')
|
|
135
215
|
|
|
136
|
-
const scoreDigest =
|
|
137
|
-
`${s.dimension}: ${s.score}/5 (confidence: ${s.confidence}%)\n ${s.summary}\n Evidence: ${s.evidence.slice(0, 3).map(e => e.claim + ' [' + e.strength + ']').join('; ')}\n Risks: ${(s.risks || []).map(r => r.risk + ' (' + r.probability + '/' + r.impact + ')').join('; ') || 'none identified'}`
|
|
216
|
+
const scoreDigest = adjustedScores.map(s =>
|
|
217
|
+
`${s.dimension}: ${s.score}/5${s.original_score !== undefined && s.original_score !== s.score ? ' (was ' + s.original_score + '/5, ' + s.challenge_result + ')' : ''} (confidence: ${s.confidence}%)\n ${s.summary}${s.challenge_reasoning ? '\n Skeptic: ' + s.challenge_reasoning : ''}\n Evidence: ${s.evidence.slice(0, 3).map(e => e.claim + ' [' + e.strength + ']').join('; ')}\n Risks: ${(s.risks || []).map(r => r.risk + ' (' + r.probability + '/' + r.impact + ')').join('; ') || 'none identified'}`
|
|
218
|
+
).join('\n\n')
|
|
219
|
+
|
|
220
|
+
log('Launching 3-way adversarial advocacy panel (go / no-go / conditional)...')
|
|
221
|
+
|
|
222
|
+
const advocacies = await parallel([
|
|
223
|
+
() => agent(
|
|
224
|
+
`You are the GO ADVOCATE. Argue that this project SHOULD proceed immediately.
|
|
225
|
+
|
|
226
|
+
Target: ${target}
|
|
227
|
+
${phaseArg ? 'Phase: ' + phaseArg : ''}
|
|
228
|
+
|
|
229
|
+
Dimension Scores (after adversarial challenge):
|
|
230
|
+
${scoreDigest}
|
|
231
|
+
|
|
232
|
+
Codebase: ${explorationContext}
|
|
233
|
+
|
|
234
|
+
Make the STRONGEST possible case for GO:
|
|
235
|
+
- Highlight favorable scores and strong evidence
|
|
236
|
+
- Reframe manageable risks with concrete mitigation strategies
|
|
237
|
+
- Emphasize opportunity cost of NOT proceeding (market window, tech debt accumulation)
|
|
238
|
+
- Acknowledge weaknesses honestly — admitted weaknesses strengthen credibility
|
|
239
|
+
|
|
240
|
+
You MUST argue for "go". Your confidence reflects how strong your case actually is, not how much you want it to succeed.`,
|
|
241
|
+
{ label: 'advocate:go', phase: 'Synthesize', schema: ADVOCACY_SCHEMA }
|
|
242
|
+
),
|
|
243
|
+
() => agent(
|
|
244
|
+
`You are the NO-GO ADVOCATE. Argue that this project should NOT proceed.
|
|
245
|
+
|
|
246
|
+
Target: ${target}
|
|
247
|
+
${phaseArg ? 'Phase: ' + phaseArg : ''}
|
|
248
|
+
|
|
249
|
+
Dimension Scores (after adversarial challenge):
|
|
250
|
+
${scoreDigest}
|
|
251
|
+
|
|
252
|
+
Codebase: ${explorationContext}
|
|
253
|
+
|
|
254
|
+
Make the STRONGEST possible case for NO-GO:
|
|
255
|
+
- Highlight unfavorable scores, especially where skeptics adjusted downward
|
|
256
|
+
- Emphasize cascading failure risks and evidence gaps
|
|
257
|
+
- Point out where confidence is low but implications are high
|
|
258
|
+
- Acknowledge strengths honestly — admitted strengths strengthen credibility
|
|
259
|
+
|
|
260
|
+
You MUST argue for "no-go". Your confidence reflects how strong your case actually is.`,
|
|
261
|
+
{ label: 'advocate:no-go', phase: 'Synthesize', schema: ADVOCACY_SCHEMA }
|
|
262
|
+
),
|
|
263
|
+
() => agent(
|
|
264
|
+
`You are the CONDITIONAL-GO ADVOCATE. Argue this should proceed ONLY under specific conditions.
|
|
265
|
+
|
|
266
|
+
Target: ${target}
|
|
267
|
+
${phaseArg ? 'Phase: ' + phaseArg : ''}
|
|
268
|
+
|
|
269
|
+
Dimension Scores (after adversarial challenge):
|
|
270
|
+
${scoreDigest}
|
|
271
|
+
|
|
272
|
+
Codebase: ${explorationContext}
|
|
273
|
+
|
|
274
|
+
Make the case for CONDITIONAL-GO:
|
|
275
|
+
- Identify which risks are blocking vs manageable with mitigation
|
|
276
|
+
- Define SPECIFIC, MEASURABLE conditions that must be met before proceeding
|
|
277
|
+
- Propose staged approach that limits downside (MVP → iterate)
|
|
278
|
+
- Specify non-negotiable prerequisites vs nice-to-haves
|
|
279
|
+
|
|
280
|
+
You MUST argue for "conditional-go". List concrete conditions in the conditions[] field.`,
|
|
281
|
+
{ label: 'advocate:conditional', phase: 'Synthesize', schema: ADVOCACY_SCHEMA }
|
|
282
|
+
),
|
|
283
|
+
])
|
|
284
|
+
|
|
285
|
+
const validAdvocacies = advocacies.filter(Boolean)
|
|
286
|
+
const advocacyDigest = validAdvocacies.map(a =>
|
|
287
|
+
`### ${a.stance.toUpperCase()} ADVOCATE (confidence: ${a.confidence}%)\n${a.argument}\nKey evidence: ${a.key_evidence.map(e => e.point + ' [' + e.strength + ']').join('; ')}\nWeaknesses admitted: ${(a.weaknesses_acknowledged || []).join('; ') || 'none'}\nConditions: ${(a.conditions || []).join('; ') || 'n/a'}`
|
|
138
288
|
).join('\n\n')
|
|
139
289
|
|
|
290
|
+
log('Referee resolving adversarial debate...')
|
|
291
|
+
|
|
140
292
|
const synthesis = await agent(
|
|
141
|
-
`
|
|
293
|
+
`You are the REFEREE. Three advocates have argued their positions on this project.
|
|
142
294
|
|
|
143
295
|
Target: ${target}
|
|
144
|
-
${
|
|
296
|
+
${phaseArg ? 'Phase: ' + phaseArg : ''}
|
|
145
297
|
|
|
146
|
-
|
|
298
|
+
=== ADVERSARIAL DEBATE ===
|
|
299
|
+
${advocacyDigest}
|
|
300
|
+
|
|
301
|
+
=== ADJUSTED DIMENSION SCORES ===
|
|
147
302
|
${scoreDigest}
|
|
148
303
|
|
|
149
|
-
|
|
304
|
+
=== CODEBASE EXPLORATION ===
|
|
150
305
|
${explorationContext}
|
|
151
306
|
|
|
152
|
-
|
|
153
|
-
1.
|
|
154
|
-
2.
|
|
155
|
-
3.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
307
|
+
RESOLVE the debate:
|
|
308
|
+
1. Evaluate each advocate's argument strength + acknowledged weaknesses
|
|
309
|
+
2. Cross-reference evidence claims against actual dimension scores
|
|
310
|
+
3. Higher confidence + stronger evidence = more weight
|
|
311
|
+
4. Record the adversarial_outcome: which stance won and the decisive factor
|
|
312
|
+
|
|
313
|
+
Decision rules:
|
|
314
|
+
- Any adjusted dimension at 1/5 with confirmed evidence → no-go
|
|
315
|
+
- Average adjusted score < 2.5 → no-go
|
|
316
|
+
- No-go confidence > 80% AND go confidence < 50% → no-go
|
|
317
|
+
- Go confidence > 80% AND no-go confidence < 40% → go
|
|
318
|
+
- If go and no-go are BOTH high-confidence (>60%) → conditional-go (genuine controversy)
|
|
319
|
+
- Otherwise → weigh by evidence strength
|
|
320
|
+
|
|
321
|
+
Then:
|
|
322
|
+
5. Calculate weighted overall score (Feasibility .25, Impact .20, Risk .20, Complexity .15, Dependencies .15, Alternatives .05)
|
|
323
|
+
6. Build risk_matrix from all dimensions
|
|
324
|
+
7. Extract decisions (locked/free/deferred)
|
|
325
|
+
8. Define implementation_scope
|
|
326
|
+
9. Write executive summary including adversarial debate outcome`,
|
|
327
|
+
{ label: 'referee', phase: 'Synthesize', schema: SYNTHESIS_SCHEMA, agentType: 'workflow-analyzer' }
|
|
170
328
|
)
|
|
171
329
|
|
|
172
330
|
return {
|
|
173
331
|
exploration: exploration,
|
|
174
|
-
dimensions:
|
|
332
|
+
dimensions: adjustedScores,
|
|
333
|
+
advocacies: validAdvocacies,
|
|
175
334
|
synthesis: synthesis,
|
|
176
335
|
metadata: {
|
|
177
336
|
target: target,
|
|
178
337
|
scope: scope,
|
|
179
|
-
phase:
|
|
338
|
+
phase: phaseArg,
|
|
180
339
|
dimension_count: selectedDimensions.length,
|
|
181
340
|
completed_count: validScores.length,
|
|
341
|
+
scores_challenged: challengedCount,
|
|
182
342
|
overall_score: synthesis ? synthesis.overall_score : null,
|
|
183
343
|
recommendation: synthesis ? synthesis.recommendation : null,
|
|
184
344
|
scope_verdict: synthesis ? synthesis.scope_verdict : null,
|
|
345
|
+
adversarial_outcome: synthesis ? synthesis.adversarial_outcome : null,
|
|
185
346
|
},
|
|
186
347
|
}
|