maestro-flow 0.4.18 → 0.4.20

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.
Files changed (181) hide show
  1. package/.agents/agents/workflow-collab-planner.md +4 -1
  2. package/.agents/agents/workflow-plan-checker.md +11 -1
  3. package/.agents/agents/workflow-planner.md +4 -1
  4. package/.agents/skills/maestro/SKILL.md +8 -5
  5. package/.agents/skills/maestro-analyze/SKILL.md +1 -1
  6. package/.agents/skills/maestro-brainstorm/SKILL.md +2 -1
  7. package/.agents/skills/maestro-companion/SKILL.md +533 -0
  8. package/.agents/skills/maestro-grill/SKILL.md +116 -0
  9. package/.agents/skills/maestro-next/SKILL.md +147 -112
  10. package/.agents/skills/maestro-plan/SKILL.md +4 -0
  11. package/.agents/skills/maestro-ralph/SKILL.md +11 -7
  12. package/.agents/skills/maestro-swarm-workflow/SKILL.md +258 -0
  13. package/.agents/skills/manage-codebase-rebuild/SKILL.md +13 -1
  14. package/.agents/skills/manage-codebase-refresh/SKILL.md +3 -0
  15. package/.agents/skills/spec-setup/SKILL.md +9 -5
  16. package/.agents/skills/team-swarm/SKILL.md +180 -0
  17. package/.agents/skills/team-swarm/roles/analyst/role.md +187 -0
  18. package/.agents/skills/team-swarm/roles/ant/role.md +169 -0
  19. package/.agents/skills/team-swarm/roles/coordinator/commands/converge.md +146 -0
  20. package/.agents/skills/team-swarm/roles/coordinator/commands/init-swarm.md +136 -0
  21. package/.agents/skills/team-swarm/roles/coordinator/commands/iterate.md +232 -0
  22. package/.agents/skills/team-swarm/roles/coordinator/role.md +211 -0
  23. package/.agents/skills/team-swarm/roles/scorer/role.md +157 -0
  24. package/.agents/skills/team-swarm/scripts/aco.py +473 -0
  25. package/.agents/skills/team-swarm/scripts/pheromone.py +144 -0
  26. package/.agents/skills/team-swarm/scripts/scoring.py +92 -0
  27. package/.agents/skills/team-swarm/scripts/test_aco.py +475 -0
  28. package/.agents/skills/team-swarm/specs/ant-output-schema.md +119 -0
  29. package/.agents/skills/team-swarm/specs/convergence-criteria.md +106 -0
  30. package/.agents/skills/team-swarm/specs/pheromone-schema.md +123 -0
  31. package/.agents/skills/team-swarm/specs/swarm-config-template.json +71 -0
  32. package/.agents/skills/team-swarm/specs/swarm-protocol.md +117 -0
  33. package/.agy/agents/workflow-collab-planner.md +4 -1
  34. package/.agy/agents/workflow-plan-checker.md +11 -1
  35. package/.agy/agents/workflow-planner.md +4 -1
  36. package/.agy/skills/maestro/SKILL.md +8 -5
  37. package/.agy/skills/maestro-analyze/SKILL.md +1 -1
  38. package/.agy/skills/maestro-brainstorm/SKILL.md +2 -1
  39. package/.agy/skills/maestro-companion/SKILL.md +529 -0
  40. package/.agy/skills/maestro-grill/SKILL.md +116 -0
  41. package/.agy/skills/maestro-next/SKILL.md +147 -112
  42. package/.agy/skills/maestro-plan/SKILL.md +4 -0
  43. package/.agy/skills/maestro-ralph/SKILL.md +11 -7
  44. package/.agy/skills/maestro-swarm-workflow/SKILL.md +255 -0
  45. package/.agy/skills/manage-codebase-rebuild/SKILL.md +13 -1
  46. package/.agy/skills/manage-codebase-refresh/SKILL.md +3 -0
  47. package/.agy/skills/spec-setup/SKILL.md +9 -5
  48. package/.agy/skills/team-swarm/SKILL.md +176 -0
  49. package/.agy/skills/team-swarm/roles/analyst/role.md +183 -0
  50. package/.agy/skills/team-swarm/roles/ant/role.md +165 -0
  51. package/.agy/skills/team-swarm/roles/coordinator/commands/converge.md +134 -0
  52. package/.agy/skills/team-swarm/roles/coordinator/commands/init-swarm.md +136 -0
  53. package/.agy/skills/team-swarm/roles/coordinator/commands/iterate.md +202 -0
  54. package/.agy/skills/team-swarm/roles/coordinator/role.md +209 -0
  55. package/.agy/skills/team-swarm/roles/scorer/role.md +153 -0
  56. package/.agy/skills/team-swarm/scripts/aco.py +473 -0
  57. package/.agy/skills/team-swarm/scripts/pheromone.py +144 -0
  58. package/.agy/skills/team-swarm/scripts/scoring.py +92 -0
  59. package/.agy/skills/team-swarm/scripts/test_aco.py +475 -0
  60. package/.agy/skills/team-swarm/specs/ant-output-schema.md +119 -0
  61. package/.agy/skills/team-swarm/specs/convergence-criteria.md +106 -0
  62. package/.agy/skills/team-swarm/specs/pheromone-schema.md +123 -0
  63. package/.agy/skills/team-swarm/specs/swarm-config-template.json +71 -0
  64. package/.agy/skills/team-swarm/specs/swarm-protocol.md +117 -0
  65. package/.claude/agents/workflow-collab-planner.md +4 -1
  66. package/.claude/agents/workflow-plan-checker.md +11 -1
  67. package/.claude/agents/workflow-planner.md +4 -1
  68. package/.claude/commands/maestro-analyze.md +1 -1
  69. package/.claude/commands/maestro-brainstorm.md +2 -1
  70. package/.claude/commands/maestro-companion.md +531 -0
  71. package/.claude/commands/maestro-grill.md +114 -0
  72. package/.claude/commands/maestro-next.md +147 -112
  73. package/.claude/commands/maestro-plan.md +4 -0
  74. package/.claude/commands/maestro-ralph.md +11 -7
  75. package/.claude/commands/maestro-swarm-workflow.md +256 -0
  76. package/.claude/commands/maestro.md +8 -5
  77. package/.claude/commands/manage-codebase-rebuild.md +13 -1
  78. package/.claude/commands/manage-codebase-refresh.md +3 -0
  79. package/.claude/commands/spec-setup.md +9 -5
  80. package/.claude/skills/team-swarm/SKILL.md +178 -0
  81. package/.claude/skills/team-swarm/roles/analyst/role.md +185 -0
  82. package/.claude/skills/team-swarm/roles/ant/role.md +167 -0
  83. package/.claude/skills/team-swarm/roles/coordinator/commands/converge.md +146 -0
  84. package/.claude/skills/team-swarm/roles/coordinator/commands/init-swarm.md +136 -0
  85. package/.claude/skills/team-swarm/roles/coordinator/commands/iterate.md +232 -0
  86. package/.claude/skills/team-swarm/roles/coordinator/role.md +209 -0
  87. package/.claude/skills/team-swarm/roles/scorer/role.md +155 -0
  88. package/.claude/skills/team-swarm/scripts/aco.py +473 -0
  89. package/.claude/skills/team-swarm/scripts/pheromone.py +144 -0
  90. package/.claude/skills/team-swarm/scripts/scoring.py +92 -0
  91. package/.claude/skills/team-swarm/scripts/test_aco.py +475 -0
  92. package/.claude/skills/team-swarm/specs/ant-output-schema.md +119 -0
  93. package/.claude/skills/team-swarm/specs/convergence-criteria.md +106 -0
  94. package/.claude/skills/team-swarm/specs/pheromone-schema.md +123 -0
  95. package/.claude/skills/team-swarm/specs/swarm-config-template.json +71 -0
  96. package/.claude/skills/team-swarm/specs/swarm-protocol.md +117 -0
  97. package/.codex/skills/maestro/SKILL.md +7 -2
  98. package/.codex/skills/maestro-companion/SKILL.md +485 -0
  99. package/.codex/skills/maestro-grill/SKILL.md +111 -0
  100. package/.codex/skills/maestro-next/SKILL.md +297 -0
  101. package/.codex/skills/maestro-ralph/SKILL.md +11 -7
  102. package/.codex/skills/manage-codebase-rebuild/SKILL.md +6 -0
  103. package/.codex/skills/manage-codebase-refresh/SKILL.md +6 -0
  104. package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.d.ts +36 -0
  105. package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.js +138 -2
  106. package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.js.map +1 -1
  107. package/dashboard/dist-server/dashboard/src/server/wiki/search.js +13 -0
  108. package/dashboard/dist-server/dashboard/src/server/wiki/search.js.map +1 -1
  109. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.d.ts +11 -0
  110. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js +178 -0
  111. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js.map +1 -1
  112. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +1 -0
  113. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +39 -23
  114. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  115. package/dist/src/cli.js +1 -0
  116. package/dist/src/cli.js.map +1 -1
  117. package/dist/src/commands/install-backend.d.ts +7 -0
  118. package/dist/src/commands/install-backend.d.ts.map +1 -1
  119. package/dist/src/commands/install-backend.js +14 -0
  120. package/dist/src/commands/install-backend.js.map +1 -1
  121. package/dist/src/commands/install.d.ts.map +1 -1
  122. package/dist/src/commands/install.js +23 -1
  123. package/dist/src/commands/install.js.map +1 -1
  124. package/dist/src/commands/kg.d.ts +11 -0
  125. package/dist/src/commands/kg.d.ts.map +1 -0
  126. package/dist/src/commands/kg.js +515 -0
  127. package/dist/src/commands/kg.js.map +1 -0
  128. package/dist/src/i18n/locales/en.d.ts.map +1 -1
  129. package/dist/src/i18n/locales/en.js +19 -0
  130. package/dist/src/i18n/locales/en.js.map +1 -1
  131. package/dist/src/i18n/locales/zh.d.ts.map +1 -1
  132. package/dist/src/i18n/locales/zh.js +19 -0
  133. package/dist/src/i18n/locales/zh.js.map +1 -1
  134. package/dist/src/i18n/types.d.ts +12 -0
  135. package/dist/src/i18n/types.d.ts.map +1 -1
  136. package/dist/src/tui/install-ui/HooksConfig.d.ts +5 -1
  137. package/dist/src/tui/install-ui/HooksConfig.d.ts.map +1 -1
  138. package/dist/src/tui/install-ui/HooksConfig.js +5 -3
  139. package/dist/src/tui/install-ui/HooksConfig.js.map +1 -1
  140. package/dist/src/tui/install-ui/InstallConfirm.d.ts +3 -0
  141. package/dist/src/tui/install-ui/InstallConfirm.d.ts.map +1 -1
  142. package/dist/src/tui/install-ui/InstallConfirm.js +1 -1
  143. package/dist/src/tui/install-ui/InstallConfirm.js.map +1 -1
  144. package/dist/src/tui/install-ui/InstallExecution.d.ts +2 -0
  145. package/dist/src/tui/install-ui/InstallExecution.d.ts.map +1 -1
  146. package/dist/src/tui/install-ui/InstallExecution.js +48 -3
  147. package/dist/src/tui/install-ui/InstallExecution.js.map +1 -1
  148. package/dist/src/tui/install-ui/InstallFlow.d.ts +1 -1
  149. package/dist/src/tui/install-ui/InstallFlow.d.ts.map +1 -1
  150. package/dist/src/tui/install-ui/InstallFlow.js +95 -17
  151. package/dist/src/tui/install-ui/InstallFlow.js.map +1 -1
  152. package/dist/src/tui/install-ui/InstallHub.d.ts +4 -0
  153. package/dist/src/tui/install-ui/InstallHub.d.ts.map +1 -1
  154. package/dist/src/tui/install-ui/InstallHub.js +14 -0
  155. package/dist/src/tui/install-ui/InstallHub.js.map +1 -1
  156. package/dist/src/tui/install-ui/InstallResult.d.ts.map +1 -1
  157. package/dist/src/tui/install-ui/InstallResult.js +1 -1
  158. package/dist/src/tui/install-ui/InstallResult.js.map +1 -1
  159. package/dist/src/tui/install-ui/KgVendorConfig.d.ts +7 -0
  160. package/dist/src/tui/install-ui/KgVendorConfig.d.ts.map +1 -0
  161. package/dist/src/tui/install-ui/KgVendorConfig.js +9 -0
  162. package/dist/src/tui/install-ui/KgVendorConfig.js.map +1 -0
  163. package/dist/src/utils/update-notices.js +22 -0
  164. package/dist/src/utils/update-notices.js.map +1 -1
  165. package/package.json +1 -1
  166. package/workflows/analyze.md +2 -1
  167. package/workflows/brainstorm.md +24 -1
  168. package/workflows/codebase-rebuild.md +141 -1
  169. package/workflows/codebase-refresh.md +20 -0
  170. package/workflows/finish-work.md +7 -2
  171. package/workflows/grill.md +513 -0
  172. package/workflows/plan.md +7 -4
  173. package/workflows/specs-setup.md +99 -3
  174. package/workflows/swarm/wf-analyze.js +186 -0
  175. package/workflows/swarm/wf-brainstorm.js +284 -0
  176. package/workflows/swarm/wf-execute.js +203 -0
  177. package/workflows/swarm/wf-grill.js +198 -0
  178. package/workflows/swarm/wf-milestone-audit.js +236 -0
  179. package/workflows/swarm/wf-plan.js +233 -0
  180. package/workflows/swarm/wf-review.js +226 -0
  181. package/workflows/swarm/wf-verify.js +298 -0
@@ -0,0 +1,198 @@
1
+ export const meta = {
2
+ name: 'wf-grill',
3
+ description: 'Parallel adversarial stress-testing across decision branches',
4
+ whenToUse: 'Accelerate maestro-grill auto mode with parallel branch exploration and contradiction detection',
5
+ phases: [
6
+ { title: 'Explore', detail: 'Codebase evidence gathering via cli-explore-agent' },
7
+ { title: 'Stress', detail: 'Parallel adversarial branch probing' },
8
+ { title: 'Synthesize', detail: 'Contradiction detection and terminology crystallization' },
9
+ ],
10
+ }
11
+
12
+ const BRANCHES = [
13
+ { key: 'scope', focus: 'Scope & Boundaries — What is explicitly in/out? Where are the edges? Challenge vague boundaries with concrete code symbols.' },
14
+ { key: 'data-model', focus: 'Data Model & State — How does data flow? What state transitions exist? Challenge naming conflicts with codebase terminology.' },
15
+ { key: 'edge-cases', focus: 'Edge Cases & Failure Modes — What breaks at scale? What happens on invalid input? What if dependent services fail?' },
16
+ { key: 'integration', focus: 'Integration & Dependencies — What existing systems are touched? What contracts must be honored? What breaks if we change X?' },
17
+ { key: 'scale', focus: 'Scale & Performance — At 10x/100x current load, what breaks first? Which queries degrade? Where are the O(n^2) risks?' },
18
+ { key: 'security', focus: 'Security & Access Control — What is the attack surface? Who can access what? Where is trust assumed but not verified?' },
19
+ { key: 'operations', focus: 'Observability & Operations — How do we know it is working? What alerts fire? How do we debug production issues?' },
20
+ { key: 'migration', focus: 'Migration & Rollback — What is the rollback path? Can we do a zero-downtime deploy? What data migration is needed?' },
21
+ ]
22
+
23
+ const EXPLORATION_SCHEMA = {
24
+ type: 'object',
25
+ properties: {
26
+ relevant_symbols: { type: 'array', items: { type: 'object', properties: { symbol: { type: 'string' }, file: { type: 'string' }, line: { type: 'number' }, type: { type: 'string' } }, required: ['symbol', 'file'] } },
27
+ existing_terminology: { type: 'array', items: { type: 'object', properties: { term: { type: 'string' }, usage_location: { type: 'string' }, context: { type: 'string' } }, required: ['term', 'usage_location'] } },
28
+ data_flows: { type: 'array', items: { type: 'object', properties: { from: { type: 'string' }, to: { type: 'string' }, data_shape: { type: 'string' } }, required: ['from', 'to'] } },
29
+ integration_points: { type: 'array', items: { type: 'object', properties: { system: { type: 'string' }, interface: { type: 'string' }, contract: { type: 'string' } }, required: ['system', 'interface'] } },
30
+ },
31
+ required: ['relevant_symbols', 'existing_terminology'],
32
+ }
33
+
34
+ const BRANCH_SCHEMA = {
35
+ type: 'object',
36
+ properties: {
37
+ branch: { type: 'string' },
38
+ challenges: {
39
+ type: 'array',
40
+ items: {
41
+ type: 'object',
42
+ properties: {
43
+ question: { type: 'string' },
44
+ code_evidence: { type: 'string' },
45
+ contradiction: { type: 'string' },
46
+ severity: { type: 'string', enum: ['blocking', 'significant', 'minor'] },
47
+ proposed_resolution: { type: 'string' },
48
+ },
49
+ required: ['question', 'severity'],
50
+ },
51
+ },
52
+ terminology_conflicts: {
53
+ type: 'array',
54
+ items: {
55
+ type: 'object',
56
+ properties: {
57
+ proposed_term: { type: 'string' },
58
+ codebase_term: { type: 'string' },
59
+ location: { type: 'string' },
60
+ recommendation: { type: 'string' },
61
+ },
62
+ required: ['proposed_term', 'codebase_term', 'recommendation'],
63
+ },
64
+ },
65
+ assumptions_challenged: { type: 'array', items: { type: 'string' } },
66
+ verdict: { type: 'string', enum: ['sound', 'needs-clarification', 'fundamentally-flawed'] },
67
+ },
68
+ required: ['branch', 'challenges', 'terminology_conflicts', 'assumptions_challenged', 'verdict'],
69
+ }
70
+
71
+ const SYNTHESIS_SCHEMA = {
72
+ type: 'object',
73
+ properties: {
74
+ overall_verdict: { type: 'string', enum: ['ready-for-brainstorm', 'needs-refinement', 'back-to-drawing-board'] },
75
+ blocking_issues: { type: 'array', items: { type: 'object', properties: { branch: { type: 'string' }, issue: { type: 'string' }, must_resolve_before: { type: 'string' } }, required: ['branch', 'issue'] } },
76
+ terminology: { type: 'array', items: { type: 'object', properties: { term: { type: 'string' }, definition: { type: 'string' }, code_alignment: { type: 'string' } }, required: ['term', 'definition'] } },
77
+ contradictions: { type: 'array', items: { type: 'object', properties: { between_branches: { type: 'array', items: { type: 'string' } }, description: { type: 'string' }, resolution: { type: 'string' } }, required: ['between_branches', 'description'] } },
78
+ constraints_discovered: { type: 'array', items: { type: 'object', properties: { constraint: { type: 'string' }, source: { type: 'string' }, impact: { type: 'string' }, status: { type: 'string', enum: ['locked', 'free', 'deferred'] } }, required: ['constraint', 'source', 'status'] } },
79
+ executive_summary: { type: 'string' },
80
+ },
81
+ required: ['overall_verdict', 'blocking_issues', 'terminology', 'contradictions', 'constraints_discovered', 'executive_summary'],
82
+ }
83
+
84
+ const topic = args?.topic || ''
85
+ const context = args?.context || ''
86
+ const depth = args?.depth || 'standard'
87
+ const branchCount = depth === 'shallow' ? 3 : depth === 'deep' ? 8 : 5
88
+ const selectedBranches = BRANCHES.slice(0, branchCount)
89
+
90
+ // Phase 1: Codebase evidence gathering
91
+ phase('Explore')
92
+ log('Gathering codebase evidence for stress-testing...')
93
+
94
+ const exploration = await agent(
95
+ `Explore the codebase to gather evidence for stress-testing this proposal:
96
+ Topic: ${topic}
97
+ ${context ? 'Context: ' + context : ''}
98
+
99
+ Find:
100
+ 1. Relevant symbols — functions, classes, types, variables related to this topic
101
+ 2. Existing terminology — how the codebase names things in this domain (for conflict detection)
102
+ 3. Data flows — how data moves through the system in this area
103
+ 4. Integration points — external systems, internal modules, APIs touched
104
+
105
+ This evidence will be used to challenge assumptions and detect contradictions.`,
106
+ { label: 'explore:evidence', phase: 'Explore', schema: EXPLORATION_SCHEMA, agentType: 'cli-explore-agent' }
107
+ )
108
+
109
+ const evidenceContext = exploration
110
+ ? `Codebase evidence:
111
+ Symbols: ${exploration.relevant_symbols.map(s => s.symbol + ' @ ' + s.file).join(', ')}
112
+ Terminology: ${exploration.existing_terminology.map(t => t.term + ' (' + t.usage_location + ')').join(', ')}
113
+ Data flows: ${(exploration.data_flows || []).map(d => d.from + ' → ' + d.to).join(', ')}
114
+ Integration: ${(exploration.integration_points || []).map(i => i.system + ':' + i.interface).join(', ')}`
115
+ : ''
116
+
117
+ // Phase 2: Parallel adversarial branch probing
118
+ phase('Stress')
119
+ log(`Stress-testing ${selectedBranches.length} branches in parallel...`)
120
+
121
+ const branchResults = await parallel(
122
+ selectedBranches.map(branch => () =>
123
+ agent(
124
+ `You are an adversarial stress-tester for the "${branch.key}" branch.
125
+
126
+ Proposal being tested: ${topic}
127
+ ${context ? 'Proposal context: ' + context : ''}
128
+ ${evidenceContext}
129
+
130
+ Your focus: ${branch.focus}
131
+
132
+ Your job is to BREAK this proposal by:
133
+ 1. Finding contradictions with existing code (cite file:line)
134
+ 2. Detecting terminology conflicts (proposed names vs codebase names)
135
+ 3. Challenging unstated assumptions with concrete counter-scenarios
136
+ 4. Probing for cases the proposal hasn't considered
137
+
138
+ For each challenge:
139
+ - Ground it in code evidence (file paths, symbol names, data shapes)
140
+ - Classify severity: blocking (must fix before proceeding), significant (should address), minor (nice to clarify)
141
+ - Propose a resolution direction
142
+
143
+ Be adversarial but fair — only raise real issues backed by evidence.`,
144
+ { label: `stress:${branch.key}`, phase: 'Stress', schema: BRANCH_SCHEMA }
145
+ )
146
+ )
147
+ )
148
+
149
+ const validBranches = branchResults.filter(Boolean)
150
+ log(`${validBranches.length}/${selectedBranches.length} branches probed`)
151
+
152
+ // Phase 3: Cross-branch synthesis
153
+ phase('Synthesize')
154
+
155
+ const branchDigest = validBranches.map(b => {
156
+ const blocking = b.challenges.filter(c => c.severity === 'blocking')
157
+ return `## ${b.branch} [${b.verdict}]
158
+ Challenges: ${b.challenges.length} (${blocking.length} blocking)
159
+ ${blocking.map(c => ` ⚠ ${c.question}${c.contradiction ? ' — ' + c.contradiction : ''}`).join('\n')}
160
+ Terminology conflicts: ${b.terminology_conflicts.map(t => t.proposed_term + ' vs ' + t.codebase_term).join(', ') || 'none'}
161
+ Assumptions challenged: ${b.assumptions_challenged.join('; ') || 'none'}`
162
+ }).join('\n\n')
163
+
164
+ const synthesis = await agent(
165
+ `Synthesize stress-test results across all branches.
166
+
167
+ Proposal: ${topic}
168
+
169
+ Branch Results:
170
+ ${branchDigest}
171
+
172
+ Tasks:
173
+ 1. Identify cross-branch CONTRADICTIONS — where one branch's finding conflicts with another's
174
+ 2. Compile unified TERMINOLOGY list (proposed term → aligned codebase term → definition)
175
+ 3. Extract CONSTRAINTS discovered (things that MUST be true based on evidence) — classify as locked/free/deferred
176
+ 4. List all BLOCKING issues that must resolve before brainstorm/planning
177
+ 5. Determine overall verdict:
178
+ - "ready-for-brainstorm": no blocking issues, well-scoped
179
+ - "needs-refinement": some blocking issues but fixable
180
+ - "back-to-drawing-board": fundamental flaws detected
181
+ 6. Write executive summary`,
182
+ { label: 'synthesize', phase: 'Synthesize', schema: SYNTHESIS_SCHEMA }
183
+ )
184
+
185
+ return {
186
+ exploration: exploration,
187
+ branches: validBranches,
188
+ synthesis: synthesis,
189
+ metadata: {
190
+ topic: topic,
191
+ depth: depth,
192
+ branch_count: selectedBranches.length,
193
+ completed_count: validBranches.length,
194
+ blocking_count: synthesis ? synthesis.blocking_issues.length : 0,
195
+ contradiction_count: synthesis ? synthesis.contradictions.length : 0,
196
+ overall_verdict: synthesis ? synthesis.overall_verdict : 'unknown',
197
+ },
198
+ }
@@ -0,0 +1,236 @@
1
+ export const meta = {
2
+ name: 'wf-milestone-audit',
3
+ description: 'Parallel cross-phase integration audit via workflow-integration-checker',
4
+ whenToUse: 'Accelerate maestro-milestone-audit with parallel phase coverage, execution completeness, and integration checks',
5
+ phases: [
6
+ { title: 'Audit', detail: 'Parallel 4-dimension milestone audit' },
7
+ { title: 'Report', detail: 'Consolidated audit verdict' },
8
+ ],
9
+ }
10
+
11
+ const COVERAGE_SCHEMA = {
12
+ type: 'object',
13
+ properties: {
14
+ check_type: { type: 'string' },
15
+ passed: { type: 'boolean' },
16
+ phases: {
17
+ type: 'array',
18
+ items: {
19
+ type: 'object',
20
+ properties: {
21
+ phase: { type: 'string' },
22
+ has_plan: { type: 'boolean' },
23
+ has_execute: { type: 'boolean' },
24
+ has_verify: { type: 'boolean' },
25
+ plan_artifact_id: { type: 'string' },
26
+ execute_artifact_id: { type: 'string' },
27
+ status: { type: 'string', enum: ['complete', 'partial', 'missing'] },
28
+ },
29
+ required: ['phase', 'has_plan', 'has_execute', 'status'],
30
+ },
31
+ },
32
+ summary: { type: 'string' },
33
+ },
34
+ required: ['check_type', 'passed', 'phases', 'summary'],
35
+ }
36
+
37
+ const EXECUTION_SCHEMA = {
38
+ type: 'object',
39
+ properties: {
40
+ check_type: { type: 'string' },
41
+ passed: { type: 'boolean' },
42
+ plans: {
43
+ type: 'array',
44
+ items: {
45
+ type: 'object',
46
+ properties: {
47
+ plan_id: { type: 'string' },
48
+ plan_dir: { type: 'string' },
49
+ total_tasks: { type: 'number' },
50
+ completed_tasks: { type: 'number' },
51
+ failed_tasks: { type: 'number' },
52
+ pending_tasks: { type: 'number' },
53
+ incomplete_task_ids: { type: 'array', items: { type: 'string' } },
54
+ },
55
+ required: ['plan_id', 'total_tasks', 'completed_tasks'],
56
+ },
57
+ },
58
+ summary: { type: 'string' },
59
+ },
60
+ required: ['check_type', 'passed', 'plans', 'summary'],
61
+ }
62
+
63
+ const INTEGRATION_SCHEMA = {
64
+ type: 'object',
65
+ properties: {
66
+ check_type: { type: 'string' },
67
+ passed: { type: 'boolean' },
68
+ interfaces: {
69
+ type: 'array',
70
+ items: {
71
+ type: 'object',
72
+ properties: {
73
+ interface_name: { type: 'string' },
74
+ producer_phase: { type: 'string' },
75
+ consumer_phase: { type: 'string' },
76
+ status: { type: 'string', enum: ['pass', 'fail', 'warning'] },
77
+ issue: { type: 'string' },
78
+ },
79
+ required: ['interface_name', 'producer_phase', 'consumer_phase', 'status'],
80
+ },
81
+ },
82
+ data_contract_issues: { type: 'array', items: { type: 'object', properties: { contract: { type: 'string' }, mismatch: { type: 'string' }, affected_phases: { type: 'array', items: { type: 'string' } } }, required: ['contract', 'mismatch'] } },
83
+ circular_dependencies: { type: 'array', items: { type: 'string' } },
84
+ summary: { type: 'string' },
85
+ },
86
+ required: ['check_type', 'passed', 'interfaces', 'summary'],
87
+ }
88
+
89
+ const REPORT_SCHEMA = {
90
+ type: 'object',
91
+ properties: {
92
+ verdict: { type: 'string', enum: ['PASS', 'FAIL'] },
93
+ confidence: { type: 'number', minimum: 0, maximum: 100 },
94
+ dimension_results: {
95
+ type: 'array',
96
+ items: {
97
+ type: 'object',
98
+ properties: {
99
+ dimension: { type: 'string' },
100
+ passed: { type: 'boolean' },
101
+ issue_count: { type: 'number' },
102
+ },
103
+ required: ['dimension', 'passed'],
104
+ },
105
+ },
106
+ blocking_issues: { type: 'array', items: { type: 'object', properties: { dimension: { type: 'string' }, description: { type: 'string' }, remediation: { type: 'string' } }, required: ['dimension', 'description', 'remediation'] } },
107
+ next_step: { type: 'string', enum: ['milestone-complete', 'plan-gaps', 'execute', 'verify'] },
108
+ summary: { type: 'string' },
109
+ },
110
+ required: ['verdict', 'confidence', 'dimension_results', 'blocking_issues', 'next_step', 'summary'],
111
+ }
112
+
113
+ const milestone = args?.milestone || ''
114
+ const isAdhoc = args?.is_adhoc || false
115
+
116
+ // Phase 1: Parallel 4-dimension audit
117
+ phase('Audit')
118
+
119
+ const checks = [
120
+ // Dimension 1: Phase coverage (skip for adhoc milestones)
121
+ () => agent(
122
+ `Phase Coverage Audit${isAdhoc ? ' (ADHOC — skip roadmap phase checks, only verify artifact chain PLN→EXC exists)' : ''}.
123
+ ${milestone ? 'Milestone: ' + milestone : 'Use current_milestone from .workflow/state.json'}
124
+
125
+ ${isAdhoc ? `Adhoc milestone: skip roadmap.md parsing. Only check:
126
+ 1. At least one PLN artifact exists for this milestone
127
+ 2. Each PLN has a corresponding EXC artifact
128
+ 3. All are status=completed` : `Standard milestone:
129
+ 1. Read .workflow/roadmap.md to get milestone → phase mapping
130
+ 2. Read .workflow/state.json artifacts[] filtered by this milestone
131
+ 3. For each phase in the milestone:
132
+ - Check: has plan artifact (type=plan, status=completed)?
133
+ - Check: has execute artifact (type=execute, status=completed)?
134
+ - Check: has verify artifact (type=verify)? (optional but noted)
135
+ 4. Report each phase as complete/partial/missing`}
136
+
137
+ Set check_type="phase-coverage" in output.`,
138
+ { label: 'audit:coverage', phase: 'Audit', schema: COVERAGE_SCHEMA }
139
+ ),
140
+
141
+ // Dimension 2: Execution completeness
142
+ () => agent(
143
+ `Execution Completeness Audit.
144
+ ${milestone ? 'Milestone: ' + milestone : 'Use current_milestone from .workflow/state.json'}
145
+
146
+ 1. Read .workflow/state.json — find all execute artifacts for this milestone
147
+ 2. For each execute artifact:
148
+ - Resolve its plan directory (artifact.path)
149
+ - Read all .task/TASK-*.json files in that directory
150
+ - Count: total, completed, failed, pending
151
+ - List any incomplete task IDs
152
+ 3. Passed only if ALL tasks across ALL plans are completed (no pending/failed)
153
+
154
+ Set check_type="execution-completeness" in output.`,
155
+ { label: 'audit:execution', phase: 'Audit', schema: EXECUTION_SCHEMA }
156
+ ),
157
+
158
+ // Dimension 3: Cross-phase integration
159
+ () => agent(
160
+ `Cross-Phase Integration Audit.
161
+ ${milestone ? 'Milestone: ' + milestone : 'Use current_milestone from .workflow/state.json'}
162
+
163
+ Check that phases compose correctly:
164
+ 1. Scan for shared interfaces, types, APIs across phase boundaries
165
+ 2. Verify contract compliance:
166
+ - Type definitions match usage across phases
167
+ - API request/response schemas are consistent
168
+ - Event names and payloads align between producer and consumer
169
+ 3. Check dependency health:
170
+ - Cross-phase imports resolve correctly
171
+ - No circular dependencies across phase boundaries
172
+ - Shared dependency versions are compatible
173
+ 4. Trace data flow across boundaries:
174
+ - Input/output formats match
175
+ - Error propagation is handled at boundaries
176
+
177
+ Report each interface check as pass/fail/warning with specific issues.
178
+ Set check_type="integration" in output.`,
179
+ { label: 'audit:integration', phase: 'Audit', schema: INTEGRATION_SCHEMA, agentType: 'workflow-integration-checker' }
180
+ ),
181
+ ]
182
+
183
+ log(`Running ${checks.length} audit dimensions in parallel...`)
184
+ const results = await parallel(checks)
185
+ const validResults = results.filter(Boolean)
186
+
187
+ // Phase 2: Consolidated report
188
+ phase('Report')
189
+
190
+ const coverage = validResults.find(r => r.check_type === 'phase-coverage')
191
+ const execution = validResults.find(r => r.check_type === 'execution-completeness')
192
+ const integration = validResults.find(r => r.check_type === 'integration')
193
+
194
+ const auditDigest = `Phase Coverage: ${coverage ? (coverage.passed ? 'PASS' : 'FAIL') + ' — ' + coverage.summary : 'NOT RUN'}
195
+
196
+ Execution Completeness: ${execution ? (execution.passed ? 'PASS' : 'FAIL') + ' — ' + execution.summary : 'NOT RUN'}
197
+ ${execution && !execution.passed ? 'Incomplete plans: ' + execution.plans.filter(p => p.pending_tasks > 0 || p.failed_tasks > 0).map(p => p.plan_id + ' (' + p.pending_tasks + ' pending, ' + p.failed_tasks + ' failed)').join('; ') : ''}
198
+
199
+ Integration: ${integration ? (integration.passed ? 'PASS' : 'FAIL') + ' — ' + integration.summary : 'NOT RUN'}
200
+ ${integration && !integration.passed ? 'Failed interfaces: ' + integration.interfaces.filter(i => i.status === 'fail').map(i => i.interface_name + ': ' + i.issue).join('; ') : ''}
201
+ ${integration && integration.data_contract_issues.length > 0 ? 'Data contract issues: ' + integration.data_contract_issues.map(d => d.contract + ' — ' + d.mismatch).join('; ') : ''}`
202
+
203
+ const report = await agent(
204
+ `Generate consolidated milestone audit report.
205
+
206
+ ${auditDigest}
207
+
208
+ Determine:
209
+ 1. Overall verdict: PASS only if ALL dimensions pass
210
+ 2. Confidence score (0-100)
211
+ 3. List blocking issues with specific remediation
212
+ 4. Determine next step:
213
+ - "milestone-complete": all pass → ready to close milestone
214
+ - "plan-gaps": integration issues need new plan
215
+ - "execute": incomplete execution
216
+ - "verify": missing verification artifacts
217
+ 5. Write summary`,
218
+ { label: 'report', phase: 'Report', schema: REPORT_SCHEMA }
219
+ )
220
+
221
+ return {
222
+ coverage: coverage,
223
+ execution: execution,
224
+ integration: integration,
225
+ report: report,
226
+ metadata: {
227
+ milestone: milestone,
228
+ is_adhoc: isAdhoc,
229
+ dimensions_checked: validResults.length,
230
+ coverage_passed: coverage ? coverage.passed : null,
231
+ execution_passed: execution ? execution.passed : null,
232
+ integration_passed: integration ? integration.passed : null,
233
+ verdict: report ? report.verdict : 'UNKNOWN',
234
+ next_step: report ? report.next_step : null,
235
+ },
236
+ }
@@ -0,0 +1,233 @@
1
+ export const meta = {
2
+ name: 'wf-plan',
3
+ description: 'Parallel context exploration + task decomposition via workflow-planner',
4
+ whenToUse: 'Accelerate maestro-plan with parallel context gathering and plan generation',
5
+ phases: [
6
+ { title: 'Context', detail: 'Parallel context exploration from multiple sources' },
7
+ { title: 'Plan', detail: 'Task decomposition and wave assignment via workflow-planner' },
8
+ { title: 'Check', detail: 'Plan quality verification via workflow-plan-checker' },
9
+ ],
10
+ }
11
+
12
+ const CONTEXT_SCHEMA = {
13
+ type: 'object',
14
+ properties: {
15
+ source: { type: 'string' },
16
+ decisions: { type: 'array', items: { type: 'object', properties: { id: { type: 'string' }, decision: { type: 'string' }, status: { type: 'string', enum: ['locked', 'free', 'deferred'] }, rationale: { type: 'string' } }, required: ['decision', 'status'] } },
17
+ requirements: { type: 'array', items: { type: 'object', properties: { id: { type: 'string' }, objective: { type: 'string' }, acceptance_criteria: { type: 'string' }, priority: { type: 'string' }, target_files: { type: 'array', items: { type: 'string' } } }, required: ['objective'] } },
18
+ constraints: { type: 'array', items: { type: 'string' } },
19
+ existing_patterns: { type: 'array', items: { type: 'object', properties: { pattern: { type: 'string' }, file: { type: 'string' }, usage: { type: 'string' } }, required: ['pattern', 'file'] } },
20
+ dependencies: { type: 'array', items: { type: 'string' } },
21
+ },
22
+ required: ['source', 'decisions', 'requirements'],
23
+ }
24
+
25
+ const PLAN_SCHEMA = {
26
+ type: 'object',
27
+ properties: {
28
+ summary: { type: 'string' },
29
+ approach: { type: 'string' },
30
+ complexity: { type: 'string', enum: ['low', 'medium', 'high'] },
31
+ waves: {
32
+ type: 'array',
33
+ items: {
34
+ type: 'object',
35
+ properties: {
36
+ wave_index: { type: 'number' },
37
+ rationale: { type: 'string' },
38
+ tasks: {
39
+ type: 'array',
40
+ items: {
41
+ type: 'object',
42
+ properties: {
43
+ task_id: { type: 'string' },
44
+ title: { type: 'string' },
45
+ description: { type: 'string' },
46
+ scope: { type: 'string' },
47
+ focus_paths: { type: 'array', items: { type: 'string' } },
48
+ depends_on: { type: 'array', items: { type: 'string' } },
49
+ convergence_criteria: { type: 'array', items: { type: 'string' } },
50
+ files: { type: 'array', items: { type: 'object', properties: { path: { type: 'string' }, action: { type: 'string', enum: ['create', 'modify', 'delete'] }, change: { type: 'string' } }, required: ['path', 'action'] } },
51
+ issue_id: { type: 'string' },
52
+ },
53
+ required: ['task_id', 'title', 'description', 'convergence_criteria'],
54
+ },
55
+ },
56
+ },
57
+ required: ['wave_index', 'tasks'],
58
+ },
59
+ },
60
+ total_tasks: { type: 'number' },
61
+ },
62
+ required: ['summary', 'approach', 'waves', 'total_tasks'],
63
+ }
64
+
65
+ const CHECK_SCHEMA = {
66
+ type: 'object',
67
+ properties: {
68
+ verdict: { type: 'string', enum: ['pass', 'pass-with-notes', 'needs-revision'] },
69
+ issues: {
70
+ type: 'array',
71
+ items: {
72
+ type: 'object',
73
+ properties: {
74
+ severity: { type: 'string', enum: ['critical', 'warning', 'note'] },
75
+ category: { type: 'string' },
76
+ description: { type: 'string' },
77
+ affected_tasks: { type: 'array', items: { type: 'string' } },
78
+ suggestion: { type: 'string' },
79
+ },
80
+ required: ['severity', 'category', 'description'],
81
+ },
82
+ },
83
+ metrics: {
84
+ type: 'object',
85
+ properties: {
86
+ task_count: { type: 'number' },
87
+ wave_count: { type: 'number' },
88
+ avg_convergence_criteria: { type: 'number' },
89
+ dependency_depth: { type: 'number' },
90
+ estimated_parallelism: { type: 'number' },
91
+ },
92
+ },
93
+ summary: { type: 'string' },
94
+ },
95
+ required: ['verdict', 'issues', 'summary'],
96
+ }
97
+
98
+ const contextDir = args?.context_dir || ''
99
+ const fromSource = args?.from || ''
100
+ const phase_num = args?.phase || null
101
+ const scope = args?.scope || ''
102
+ const specs = args?.specs || ''
103
+ const gaps = args?.gaps || false
104
+ const quick = args?.quick || false
105
+
106
+ // Phase 1: Parallel context exploration
107
+ phase('Context')
108
+ log('Gathering context from multiple sources in parallel...')
109
+
110
+ const contextSources = [
111
+ () => agent(
112
+ `Load analysis context for planning.
113
+ ${contextDir ? 'Context directory: ' + contextDir + ' — read context.md and context-package.json' : ''}
114
+ ${fromSource ? 'Upstream source: ' + fromSource + ' — resolve and load context-package.json' : ''}
115
+ ${phase_num ? 'Phase: ' + phase_num + ' — read roadmap.md for phase definition' : ''}
116
+ ${gaps ? 'Gap-fix mode: load issues from .workflow/issues/issues.jsonl with analysis records' : ''}
117
+
118
+ Extract:
119
+ 1. Locked/Free/Deferred decisions from context.md
120
+ 2. Requirements with acceptance criteria from context-package.json or conclusions.json
121
+ 3. Constraints from upstream analysis
122
+ 4. Dependencies identified`,
123
+ { label: 'ctx:analysis', phase: 'Context', schema: CONTEXT_SCHEMA }
124
+ ),
125
+ () => agent(
126
+ `Explore existing codebase patterns relevant to the planned work.
127
+ ${scope ? 'Scope: ' + scope : phase_num ? 'Phase ' + phase_num + ' scope from roadmap' : 'Full project'}
128
+ ${specs ? 'Specs to respect: ' + specs : 'Load via: maestro spec load --category arch'}
129
+
130
+ Find:
131
+ 1. Existing patterns in the target area (how similar features are implemented)
132
+ 2. File organization conventions
133
+ 3. Test patterns used
134
+ 4. Import/export conventions
135
+ 5. Error handling patterns
136
+
137
+ Report as existing_patterns[] with file references.`,
138
+ { label: 'ctx:patterns', phase: 'Context', schema: CONTEXT_SCHEMA, agentType: 'cli-explore-agent' }
139
+ ),
140
+ ]
141
+
142
+ const contexts = await parallel(contextSources)
143
+ const validContexts = contexts.filter(Boolean)
144
+
145
+ const mergedDecisions = validContexts.flatMap(c => c.decisions || [])
146
+ const mergedRequirements = validContexts.flatMap(c => c.requirements || [])
147
+ const mergedPatterns = validContexts.flatMap(c => c.existing_patterns || [])
148
+ const mergedConstraints = validContexts.flatMap(c => c.constraints || [])
149
+
150
+ log(`Context gathered: ${mergedDecisions.length} decisions, ${mergedRequirements.length} requirements, ${mergedPatterns.length} patterns`)
151
+
152
+ // Phase 2: Plan generation via workflow-planner
153
+ phase('Plan')
154
+ log('Generating execution plan with task decomposition...')
155
+
156
+ const contextDigest = `Decisions (${mergedDecisions.length}):
157
+ ${mergedDecisions.map(d => `- [${d.status}] ${d.decision}${d.rationale ? ' — ' + d.rationale : ''}`).join('\n')}
158
+
159
+ Requirements (${mergedRequirements.length}):
160
+ ${mergedRequirements.map(r => `- ${r.objective}${r.acceptance_criteria ? ' (done when: ' + r.acceptance_criteria + ')' : ''}${r.target_files ? ' [' + r.target_files.join(', ') + ']' : ''}`).join('\n')}
161
+
162
+ Constraints: ${mergedConstraints.join('; ') || 'none'}
163
+
164
+ Existing patterns:
165
+ ${mergedPatterns.map(p => `- ${p.pattern} @ ${p.file}`).join('\n') || 'none found'}`
166
+
167
+ const plan = await agent(
168
+ `Create an execution plan from the following context.
169
+ ${phase_num ? 'Phase: ' + phase_num : ''}
170
+ ${scope ? 'Scope: ' + scope : ''}
171
+ ${quick ? 'MODE: QUICK — one task per feature, minimal waves, fast execution' : 'MODE: STANDARD — full decomposition with convergence criteria'}
172
+ ${gaps ? 'MODE: GAP-FIX — tasks fix identified issues, link via issue_id' : ''}
173
+
174
+ Context:
175
+ ${contextDigest}
176
+
177
+ Rules:
178
+ 1. Group work into FEATURE-LEVEL tasks (one feature = one task, even if 3-5 files)
179
+ 2. Assign independent tasks to same wave (parallel execution)
180
+ 3. Dependent tasks in later waves — only add depends_on when truly needed
181
+ 4. Each task needs ≥2 testable convergence criteria (grep-verifiable or command-runnable)
182
+ 5. Include focus_paths and files[] with specific paths and actions
183
+ 6. Respect all Locked decisions — they are non-negotiable
184
+ 7. Free decisions are implementer's choice — don't over-specify
185
+ 8. Task IDs: TASK-001, TASK-002, etc.
186
+
187
+ ${quick ? 'Quick mode: single wave unless genuine dependency. Batch unrelated small changes into one task.' : ''}`,
188
+ { label: 'plan:generate', phase: 'Plan', schema: PLAN_SCHEMA, agentType: 'workflow-planner' }
189
+ )
190
+
191
+ log(`Plan generated: ${plan ? plan.total_tasks : 0} tasks across ${plan ? plan.waves.length : 0} waves`)
192
+
193
+ // Phase 3: Plan quality check
194
+ phase('Check')
195
+ log('Verifying plan quality...')
196
+
197
+ const check = await agent(
198
+ `Verify this execution plan for quality and completeness.
199
+
200
+ Plan:
201
+ ${plan ? `Summary: ${plan.summary}\nApproach: ${plan.approach}\nComplexity: ${plan.complexity}\nTasks: ${plan.total_tasks} across ${plan.waves.length} waves` : 'No plan generated'}
202
+
203
+ Task details:
204
+ ${plan ? plan.waves.map(w => `Wave ${w.wave_index}: ${w.tasks.map(t => t.task_id + ': ' + t.title + ' [' + (t.convergence_criteria || []).length + ' criteria]').join(', ')}`).join('\n') : 'none'}
205
+
206
+ Check:
207
+ 1. DEPENDENCY CORRECTNESS: Are depends_on relationships correct? Any missing?
208
+ 2. WAVE EFFICIENCY: Could more tasks be parallelized? Are waves minimized?
209
+ 3. CONVERGENCE QUALITY: Are criteria specific and testable (not vague)?
210
+ 4. SCOPE COMPLETENESS: Do tasks cover all requirements?
211
+ 5. FILE CONFLICTS: Do parallel tasks modify the same files?
212
+ 6. MISSING TASKS: Are there requirements without corresponding tasks?
213
+
214
+ Requirements to cover:
215
+ ${mergedRequirements.map(r => r.objective).join('\n')}`,
216
+ { label: 'check:quality', phase: 'Check', schema: CHECK_SCHEMA, agentType: 'workflow-plan-checker' }
217
+ )
218
+
219
+ return {
220
+ contexts: validContexts,
221
+ plan: plan,
222
+ check: check,
223
+ metadata: {
224
+ phase: phase_num,
225
+ scope: scope,
226
+ decision_count: mergedDecisions.length,
227
+ requirement_count: mergedRequirements.length,
228
+ total_tasks: plan ? plan.total_tasks : 0,
229
+ wave_count: plan ? plan.waves.length : 0,
230
+ check_verdict: check ? check.verdict : 'unknown',
231
+ critical_issues: check ? check.issues.filter(i => i.severity === 'critical').length : 0,
232
+ },
233
+ }