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,347 @@
|
|
|
1
|
+
export const meta = {
|
|
2
|
+
name: 'wf-analyze',
|
|
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
|
+
phases: [
|
|
6
|
+
{ title: 'Explore', detail: '3-layer codebase exploration via cli-explore-agent' },
|
|
7
|
+
{ title: 'Score', detail: 'Parallel 6-dimension scoring via workflow-analyzer' },
|
|
8
|
+
{ title: 'CrossVerify', detail: 'Adversarial skeptic challenges each dimension score' },
|
|
9
|
+
{ title: 'Synthesize', detail: '3-way adversarial advocacy (go/no-go/conditional) + referee verdict' },
|
|
10
|
+
],
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const DIMENSIONS = [
|
|
14
|
+
{ key: 'feasibility', focus: 'Technical difficulty, team capability, time constraints, tooling availability, infrastructure readiness' },
|
|
15
|
+
{ key: 'impact', focus: 'User value, business value, tech debt reduction, developer experience improvement, ecosystem contribution' },
|
|
16
|
+
{ key: 'risk', focus: 'Failure modes, security vulnerabilities, scalability limits, regression potential, data integrity threats' },
|
|
17
|
+
{ key: 'complexity', focus: 'Integration points, dependency count, learning curve, testing difficulty, migration path complexity' },
|
|
18
|
+
{ key: 'dependencies', focus: 'External services, internal module coupling, data dependencies, infrastructure requirements, third-party stability' },
|
|
19
|
+
{ key: 'alternatives', focus: 'Compare 2+ approaches with tradeoffs, evaluate build-vs-buy, assess migration paths, weigh technology options' },
|
|
20
|
+
]
|
|
21
|
+
|
|
22
|
+
const EXPLORATION_SCHEMA = {
|
|
23
|
+
type: 'object',
|
|
24
|
+
properties: {
|
|
25
|
+
relevant_files: { type: 'array', items: { type: 'object', properties: { path: { type: 'string' }, role: { type: 'string' }, relevance: { type: 'string' } }, required: ['path', 'role'] } },
|
|
26
|
+
call_chains: { type: 'array', items: { type: 'object', properties: { entry: { type: 'string' }, chain: { type: 'array', items: { type: 'string' } }, purpose: { type: 'string' } }, required: ['entry', 'chain'] } },
|
|
27
|
+
data_flows: { type: 'array', items: { type: 'object', properties: { source: { type: 'string' }, sink: { type: 'string' }, transforms: { type: 'array', items: { type: 'string' } } }, required: ['source', 'sink'] } },
|
|
28
|
+
code_anchors: { type: 'array', items: { type: 'object', properties: { file: { type: 'string' }, line: { type: 'number' }, snippet: { type: 'string' }, significance: { type: 'string' } }, required: ['file', 'significance'] } },
|
|
29
|
+
module_boundaries: { type: 'array', items: { type: 'object', properties: { module: { type: 'string' }, exports: { type: 'array', items: { type: 'string' } }, depends_on: { type: 'array', items: { type: 'string' } } }, required: ['module'] } },
|
|
30
|
+
},
|
|
31
|
+
required: ['relevant_files', 'code_anchors'],
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const DIMENSION_SCHEMA = {
|
|
35
|
+
type: 'object',
|
|
36
|
+
properties: {
|
|
37
|
+
dimension: { type: 'string' },
|
|
38
|
+
score: { type: 'number', minimum: 1, maximum: 5 },
|
|
39
|
+
confidence: { type: 'number', minimum: 0, maximum: 100 },
|
|
40
|
+
evidence: { type: 'array', items: { type: 'object', properties: { claim: { type: 'string' }, source: { type: 'string' }, strength: { type: 'string', enum: ['strong', 'moderate', 'weak'] } }, required: ['claim', 'source', 'strength'] } },
|
|
41
|
+
risks: { type: 'array', items: { type: 'object', properties: { risk: { type: 'string' }, probability: { type: 'string', enum: ['high', 'medium', 'low'] }, impact: { type: 'string', enum: ['critical', 'high', 'medium', 'low'] }, mitigation: { type: 'string' } }, required: ['risk', 'probability', 'impact'] } },
|
|
42
|
+
summary: { type: 'string' },
|
|
43
|
+
},
|
|
44
|
+
required: ['dimension', 'score', 'confidence', 'evidence', 'summary'],
|
|
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
|
+
|
|
73
|
+
const SYNTHESIS_SCHEMA = {
|
|
74
|
+
type: 'object',
|
|
75
|
+
properties: {
|
|
76
|
+
overall_score: { type: 'number', minimum: 1, maximum: 5 },
|
|
77
|
+
overall_confidence: { type: 'number', minimum: 0, maximum: 100 },
|
|
78
|
+
recommendation: { type: 'string', enum: ['go', 'conditional-go', 'no-go'] },
|
|
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'] },
|
|
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'] } },
|
|
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'] } },
|
|
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'] } },
|
|
84
|
+
executive_summary: { type: 'string' },
|
|
85
|
+
},
|
|
86
|
+
required: ['overall_score', 'overall_confidence', 'recommendation', 'scope_verdict', 'adversarial_outcome', 'risk_matrix', 'decisions', 'executive_summary'],
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const target = args?.target || 'the current codebase'
|
|
90
|
+
const scope = args?.scope || ''
|
|
91
|
+
const context = args?.context || ''
|
|
92
|
+
const phaseArg = args?.phase || null
|
|
93
|
+
const selectedDimensions = args?.dimensions
|
|
94
|
+
? DIMENSIONS.filter(d => args.dimensions.includes(d.key))
|
|
95
|
+
: DIMENSIONS
|
|
96
|
+
|
|
97
|
+
// Phase 1: Codebase Exploration via cli-explore-agent
|
|
98
|
+
phase('Explore')
|
|
99
|
+
log('Launching 3-layer codebase exploration via cli-explore-agent...')
|
|
100
|
+
|
|
101
|
+
const exploration = await agent(
|
|
102
|
+
`Perform 3-layer codebase exploration for: ${target}
|
|
103
|
+
${scope ? 'File scope: ' + scope : 'Explore the full project structure.'}
|
|
104
|
+
${context ? 'Additional context: ' + context : ''}
|
|
105
|
+
${phaseArg ? 'Phase context: ' + phaseArg : ''}
|
|
106
|
+
|
|
107
|
+
Layer 1 — Module Discovery (Breadth):
|
|
108
|
+
Search by topic keywords, identify ALL relevant files, map module boundaries.
|
|
109
|
+
|
|
110
|
+
Layer 2 — Structure Tracing (Depth):
|
|
111
|
+
Top 3-5 key files: trace call chains 2-3 levels deep, identify data flow.
|
|
112
|
+
|
|
113
|
+
Layer 3 — Code Anchor Extraction (Detail):
|
|
114
|
+
Each key finding: extract code snippet (20-50 lines) with file:line reference.
|
|
115
|
+
|
|
116
|
+
Return structured exploration results.`,
|
|
117
|
+
{ label: 'explore:codebase', phase: 'Explore', schema: EXPLORATION_SCHEMA, agentType: 'cli-explore-agent' }
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
const explorationContext = exploration
|
|
121
|
+
? `Relevant files: ${exploration.relevant_files.map(f => f.path).join(', ')}
|
|
122
|
+
Call chains: ${(exploration.call_chains || []).map(c => c.entry + ' → ' + c.chain.join(' → ')).join('; ')}
|
|
123
|
+
Code anchors: ${exploration.code_anchors.map(a => a.file + ':' + (a.line || '?') + ' — ' + a.significance).join('\n')}`
|
|
124
|
+
: 'No exploration results available.'
|
|
125
|
+
|
|
126
|
+
log(`Exploration complete: ${exploration ? exploration.relevant_files.length : 0} files, ${exploration ? exploration.code_anchors.length : 0} anchors`)
|
|
127
|
+
|
|
128
|
+
// Phase 2: Parallel 6-Dimension Scoring via workflow-analyzer
|
|
129
|
+
phase('Score')
|
|
130
|
+
log(`Scoring ${selectedDimensions.length} dimensions in parallel via workflow-analyzer...`)
|
|
131
|
+
|
|
132
|
+
const scores = await parallel(
|
|
133
|
+
selectedDimensions.map(dim => () =>
|
|
134
|
+
agent(
|
|
135
|
+
`Evaluate dimension: ${dim.key}
|
|
136
|
+
Focus areas: ${dim.focus}
|
|
137
|
+
Target: ${target}
|
|
138
|
+
${phaseArg ? 'Phase: ' + phaseArg : ''}
|
|
139
|
+
|
|
140
|
+
Codebase exploration context:
|
|
141
|
+
${explorationContext}
|
|
142
|
+
|
|
143
|
+
Score this dimension on a 1-5 scale with specific evidence from the codebase:
|
|
144
|
+
- 1: Critical issues, blocks progress
|
|
145
|
+
- 2: Significant concerns, requires major effort
|
|
146
|
+
- 3: Manageable, standard effort required
|
|
147
|
+
- 4: Good position, minor concerns only
|
|
148
|
+
- 5: Excellent, minimal risk
|
|
149
|
+
|
|
150
|
+
Every score must have specific file:line evidence, not general impressions.
|
|
151
|
+
Include confidence percentage (0-100) based on evidence strength.
|
|
152
|
+
For Risk dimension: include probability × impact matrix entries.`,
|
|
153
|
+
{ label: `score:${dim.key}`, phase: 'Score', schema: DIMENSION_SCHEMA, agentType: 'workflow-analyzer' }
|
|
154
|
+
)
|
|
155
|
+
)
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
const validScores = scores.filter(Boolean)
|
|
159
|
+
log(`${validScores.length}/${selectedDimensions.length} dimensions scored`)
|
|
160
|
+
|
|
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
|
|
214
|
+
phase('Synthesize')
|
|
215
|
+
|
|
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'}`
|
|
288
|
+
).join('\n\n')
|
|
289
|
+
|
|
290
|
+
log('Referee resolving adversarial debate...')
|
|
291
|
+
|
|
292
|
+
const synthesis = await agent(
|
|
293
|
+
`You are the REFEREE. Three advocates have argued their positions on this project.
|
|
294
|
+
|
|
295
|
+
Target: ${target}
|
|
296
|
+
${phaseArg ? 'Phase: ' + phaseArg : ''}
|
|
297
|
+
|
|
298
|
+
=== ADVERSARIAL DEBATE ===
|
|
299
|
+
${advocacyDigest}
|
|
300
|
+
|
|
301
|
+
=== ADJUSTED DIMENSION SCORES ===
|
|
302
|
+
${scoreDigest}
|
|
303
|
+
|
|
304
|
+
=== CODEBASE EXPLORATION ===
|
|
305
|
+
${explorationContext}
|
|
306
|
+
|
|
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' }
|
|
328
|
+
)
|
|
329
|
+
|
|
330
|
+
return {
|
|
331
|
+
exploration: exploration,
|
|
332
|
+
dimensions: adjustedScores,
|
|
333
|
+
advocacies: validAdvocacies,
|
|
334
|
+
synthesis: synthesis,
|
|
335
|
+
metadata: {
|
|
336
|
+
target: target,
|
|
337
|
+
scope: scope,
|
|
338
|
+
phase: phaseArg,
|
|
339
|
+
dimension_count: selectedDimensions.length,
|
|
340
|
+
completed_count: validScores.length,
|
|
341
|
+
scores_challenged: challengedCount,
|
|
342
|
+
overall_score: synthesis ? synthesis.overall_score : null,
|
|
343
|
+
recommendation: synthesis ? synthesis.recommendation : null,
|
|
344
|
+
scope_verdict: synthesis ? synthesis.scope_verdict : null,
|
|
345
|
+
adversarial_outcome: synthesis ? synthesis.adversarial_outcome : null,
|
|
346
|
+
},
|
|
347
|
+
}
|