pi-maestro-flow 0.2.0 → 0.3.1

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 (235) hide show
  1. package/README.md +44 -72
  2. package/agents/cross-role-reviewer.md +1 -1
  3. package/agents/impeccable-agent.md +1 -1
  4. package/agents/ralph-executor.md +1 -1
  5. package/agents/team-worker.md +1 -1
  6. package/agents/workflow-analyzer.md +1 -1
  7. package/agents/workflow-codebase-mapper.md +1 -1
  8. package/agents/workflow-collab-planner.md +1 -1
  9. package/agents/workflow-debugger.md +1 -1
  10. package/agents/workflow-executor.md +1 -1
  11. package/agents/workflow-integration-checker.md +1 -1
  12. package/agents/workflow-nyquist-auditor.md +1 -1
  13. package/agents/workflow-phase-researcher.md +1 -1
  14. package/agents/workflow-planner.md +1 -1
  15. package/agents/workflow-project-researcher.md +1 -1
  16. package/agents/workflow-reviewer.md +1 -1
  17. package/agents/workflow-verifier.md +1 -1
  18. package/package.json +18 -4
  19. package/skills/codify-to-knowhow/SKILL.md +1 -1
  20. package/skills/delegation-check/SKILL.md +1 -1
  21. package/skills/domain-add/SKILL.md +5 -5
  22. package/skills/insight-challenge/SKILL.md +1 -1
  23. package/skills/learn-decompose/SKILL.md +4 -4
  24. package/skills/learn-follow/SKILL.md +5 -5
  25. package/skills/learn-investigate/SKILL.md +5 -5
  26. package/skills/learn-second-opinion/SKILL.md +5 -5
  27. package/skills/maestro/SKILL.md +8 -8
  28. package/skills/maestro-amend/SKILL.md +4 -4
  29. package/skills/maestro-analyze/SKILL.md +9 -9
  30. package/skills/maestro-blueprint/SKILL.md +7 -7
  31. package/skills/maestro-brainstorm/SKILL.md +10 -10
  32. package/skills/maestro-collab/SKILL.md +4 -4
  33. package/skills/maestro-companion/SKILL.md +3 -3
  34. package/skills/maestro-composer/SKILL.md +10 -10
  35. package/skills/maestro-execute/SKILL.md +8 -8
  36. package/skills/maestro-fork/SKILL.md +7 -7
  37. package/skills/maestro-grill/SKILL.md +12 -12
  38. package/skills/maestro-guard/SKILL.md +5 -5
  39. package/skills/maestro-help/SKILL.md +3 -3
  40. package/skills/maestro-impeccable/SKILL.md +7 -7
  41. package/skills/maestro-init/SKILL.md +8 -8
  42. package/skills/maestro-merge/SKILL.md +6 -6
  43. package/skills/maestro-milestone-audit/SKILL.md +3 -3
  44. package/skills/maestro-milestone-complete/SKILL.md +8 -8
  45. package/skills/maestro-milestone-release/SKILL.md +9 -9
  46. package/skills/maestro-next/SKILL.md +5 -5
  47. package/skills/maestro-overlay/SKILL.md +19 -19
  48. package/skills/maestro-plan/SKILL.md +8 -8
  49. package/skills/maestro-player/SKILL.md +5 -5
  50. package/skills/maestro-quick/SKILL.md +5 -5
  51. package/skills/maestro-ralph/SKILL.md +15 -15
  52. package/skills/maestro-ralph-cli/SKILL.md +6 -6
  53. package/skills/maestro-ralph-cli-execute/SKILL.md +2 -2
  54. package/skills/maestro-ralph-execute/SKILL.md +4 -4
  55. package/skills/maestro-ralph-v2/SKILL.md +17 -17
  56. package/skills/maestro-roadmap/SKILL.md +7 -7
  57. package/skills/maestro-swarm-workflow/SKILL.md +9 -9
  58. package/skills/maestro-tools-execute/SKILL.md +5 -5
  59. package/skills/maestro-tools-register/SKILL.md +7 -7
  60. package/skills/maestro-ui-codify/SKILL.md +8 -8
  61. package/skills/maestro-universal-workflow/SKILL.md +15 -15
  62. package/skills/maestro-update/SKILL.md +10 -10
  63. package/skills/manage-codebase-rebuild/SKILL.md +4 -4
  64. package/skills/manage-drift-realign/SKILL.md +7 -7
  65. package/skills/manage-harvest/SKILL.md +5 -5
  66. package/skills/manage-issue/SKILL.md +4 -4
  67. package/skills/manage-issue-discover/SKILL.md +7 -7
  68. package/skills/manage-kg-extractors/SKILL.md +3 -3
  69. package/skills/manage-knowhow/SKILL.md +3 -3
  70. package/skills/manage-knowhow-capture/SKILL.md +4 -4
  71. package/skills/manage-knowledge-audit/SKILL.md +5 -5
  72. package/skills/manage-status/SKILL.md +3 -3
  73. package/skills/manage-wiki/SKILL.md +5 -5
  74. package/skills/odyssey-debug/SKILL.md +13 -13
  75. package/skills/odyssey-improve/SKILL.md +15 -15
  76. package/skills/odyssey-planex/SKILL.md +16 -16
  77. package/skills/odyssey-review-test-fix/SKILL.md +11 -11
  78. package/skills/odyssey-ui/SKILL.md +10 -10
  79. package/skills/prompt-generator/SKILL.md +5 -5
  80. package/skills/quality-auto-test/SKILL.md +3 -3
  81. package/skills/quality-debug/SKILL.md +3 -3
  82. package/skills/quality-refactor/SKILL.md +3 -3
  83. package/skills/quality-retrospective/SKILL.md +9 -9
  84. package/skills/quality-review/SKILL.md +4 -4
  85. package/skills/quality-sync/SKILL.md +3 -3
  86. package/skills/quality-test/SKILL.md +4 -4
  87. package/skills/scholar-anti-ai-writing/SKILL.md +1 -1
  88. package/skills/scholar-citation-verify/SKILL.md +1 -1
  89. package/skills/scholar-experiment/SKILL.md +2 -2
  90. package/skills/scholar-ideation/SKILL.md +7 -7
  91. package/skills/scholar-latex-organizer/SKILL.md +1 -1
  92. package/skills/scholar-publish/SKILL.md +3 -3
  93. package/skills/scholar-rebuttal-pro/SKILL.md +3 -3
  94. package/skills/scholar-review/SKILL.md +1 -1
  95. package/skills/scholar-writing/SKILL.md +1 -1
  96. package/skills/security-audit/SKILL.md +2 -2
  97. package/skills/skill-generator/SKILL.md +3 -3
  98. package/skills/skill-iter-tune/SKILL.md +3 -3
  99. package/skills/skill-simplify/SKILL.md +1 -1
  100. package/skills/skill-tuning/SKILL.md +1 -1
  101. package/skills/spec-add/SKILL.md +5 -5
  102. package/skills/spec-load/SKILL.md +3 -3
  103. package/skills/spec-remove/SKILL.md +4 -4
  104. package/skills/spec-setup/SKILL.md +6 -6
  105. package/skills/team-adversarial-swarm/SKILL.md +5 -5
  106. package/skills/team-arch-opt/SKILL.md +2 -2
  107. package/skills/team-brainstorm/SKILL.md +3 -3
  108. package/skills/team-coordinate/SKILL.md +4 -4
  109. package/skills/team-designer/SKILL.md +1 -1
  110. package/skills/team-executor/SKILL.md +3 -3
  111. package/skills/team-frontend/SKILL.md +2 -2
  112. package/skills/team-frontend-debug/SKILL.md +3 -3
  113. package/skills/team-interactive-craft/SKILL.md +2 -2
  114. package/skills/team-issue/SKILL.md +3 -3
  115. package/skills/team-lifecycle-v4/SKILL.md +4 -4
  116. package/skills/team-motion-design/SKILL.md +2 -2
  117. package/skills/team-perf-opt/SKILL.md +3 -3
  118. package/skills/team-planex/SKILL.md +2 -2
  119. package/skills/team-quality-assurance/SKILL.md +3 -3
  120. package/skills/team-review/SKILL.md +3 -3
  121. package/skills/team-roadmap-dev/SKILL.md +3 -3
  122. package/skills/team-swarm/SKILL.md +4 -4
  123. package/skills/team-tech-debt/SKILL.md +2 -2
  124. package/skills/team-testing/SKILL.md +3 -3
  125. package/skills/team-ui-polish/SKILL.md +2 -2
  126. package/skills/team-uidesign/SKILL.md +2 -2
  127. package/skills/team-ultra-analyze/SKILL.md +4 -4
  128. package/skills/team-ux-improve/SKILL.md +3 -3
  129. package/skills/team-visual-a11y/SKILL.md +2 -2
  130. package/skills/workflow-skill-designer/SKILL.md +8 -8
  131. package/templates/business-test-report.json +68 -0
  132. package/templates/config.json +48 -0
  133. package/templates/context.md +16 -0
  134. package/templates/doc-index.json +11 -0
  135. package/templates/index.json +68 -0
  136. package/templates/issue.json +36 -0
  137. package/templates/plan.json +38 -0
  138. package/templates/project.md +60 -0
  139. package/templates/reflection-log.md +20 -0
  140. package/templates/roadmap.md +45 -0
  141. package/templates/scratch-index.json +19 -0
  142. package/templates/search-tool.json +1 -0
  143. package/templates/search-tools.md +47 -0
  144. package/templates/state.json +18 -0
  145. package/templates/task-summary.md +21 -0
  146. package/templates/task.json +89 -0
  147. package/templates/terminology-template.json +22 -0
  148. package/templates/uat.md +21 -0
  149. package/templates/validation.json +31 -0
  150. package/templates/verification.json +37 -0
  151. package/templates/workflow.md +14 -0
  152. package/templates/worktree-scope.json +9 -0
  153. package/templates/worktrees.json +26 -0
  154. package/workflows/agy-instructions.md +156 -0
  155. package/workflows/analyze.md +768 -0
  156. package/workflows/auto-test.md +705 -0
  157. package/workflows/blueprint.md +406 -0
  158. package/workflows/boundary-grill.md +50 -0
  159. package/workflows/brainstorm.md +508 -0
  160. package/workflows/business-test.md +574 -0
  161. package/workflows/chinese-response.md +25 -0
  162. package/workflows/claude-instructions.md +167 -0
  163. package/workflows/codebase-rebuild.md +267 -0
  164. package/workflows/codebase-refresh.md +168 -0
  165. package/workflows/codex-instructions.md +156 -0
  166. package/workflows/coding-philosophy.md +70 -0
  167. package/workflows/command-authoring.md +823 -0
  168. package/workflows/debug.md +409 -0
  169. package/workflows/delegate-usage.md +99 -0
  170. package/workflows/domain-add.md +121 -0
  171. package/workflows/drift-realign.md +396 -0
  172. package/workflows/execute.md +631 -0
  173. package/workflows/explore-usage.md +93 -0
  174. package/workflows/finish-work.md +124 -0
  175. package/workflows/fork.md +162 -0
  176. package/workflows/grill.md +494 -0
  177. package/workflows/harvest.md +478 -0
  178. package/workflows/impeccable.md +168 -0
  179. package/workflows/init.md +157 -0
  180. package/workflows/instruction-authoring-guide.md +97 -0
  181. package/workflows/integration-test.md +186 -0
  182. package/workflows/interview-mechanics.md +8 -0
  183. package/workflows/issue-analyze.md +20 -0
  184. package/workflows/issue-discover.md +238 -0
  185. package/workflows/issue-execute.md +110 -0
  186. package/workflows/issue-gaps-analyze.codex.md +256 -0
  187. package/workflows/issue-gaps-analyze.md +215 -0
  188. package/workflows/issue-plan.md +110 -0
  189. package/workflows/issue.md +338 -0
  190. package/workflows/knowhow.md +429 -0
  191. package/workflows/knowledge-audit.md +355 -0
  192. package/workflows/learn.md +271 -0
  193. package/workflows/maestro-chain-execute.md +20 -0
  194. package/workflows/maestro-link-coordinate.md +114 -0
  195. package/workflows/maestro-super.md +120 -0
  196. package/workflows/maestro.md +501 -0
  197. package/workflows/map.md +74 -0
  198. package/workflows/merge.md +122 -0
  199. package/workflows/milestone-audit.md +155 -0
  200. package/workflows/milestone-complete.md +167 -0
  201. package/workflows/milestone-release.md +82 -0
  202. package/workflows/odyssey-base-codex.md +305 -0
  203. package/workflows/odyssey-base.md +256 -0
  204. package/workflows/overlays.md +109 -0
  205. package/workflows/plan.md +520 -0
  206. package/workflows/quick.md +350 -0
  207. package/workflows/ralph-amend-goal.md +177 -0
  208. package/workflows/refactor.md +87 -0
  209. package/workflows/retrospective.md +471 -0
  210. package/workflows/review.md +448 -0
  211. package/workflows/roadmap-common.md +193 -0
  212. package/workflows/roadmap.md +106 -0
  213. package/workflows/shell-exec-protocol.md +30 -0
  214. package/workflows/skill-authoring.md +265 -0
  215. package/workflows/spec-generate.md +475 -0
  216. package/workflows/specs-add.md +123 -0
  217. package/workflows/specs-load.md +76 -0
  218. package/workflows/specs-remove.md +104 -0
  219. package/workflows/specs-setup.md +316 -0
  220. package/workflows/status.md +149 -0
  221. package/workflows/sync.md +116 -0
  222. package/workflows/tdd.md +255 -0
  223. package/workflows/test-gen.md +226 -0
  224. package/workflows/test.md +385 -0
  225. package/workflows/tools-spec.md +70 -0
  226. package/workflows/ui-codify-extract.md +372 -0
  227. package/workflows/ui-codify-knowhow.md +258 -0
  228. package/workflows/ui-codify-package.md +159 -0
  229. package/workflows/ui-codify.md +227 -0
  230. package/workflows/ui-design.md +393 -0
  231. package/workflows/ui-style.md +201 -0
  232. package/workflows/verify.md +557 -0
  233. package/workflows/wiki-connect.md +153 -0
  234. package/workflows/wiki-digest.md +180 -0
  235. package/workflows/wiki-manage.md +113 -0
@@ -0,0 +1,238 @@
1
+ # Workflow: Issue Discovery
2
+
3
+ Automated issue discovery via multi-perspective analysis or prompt-driven exploration.
4
+
5
+ ## Input
6
+
7
+ - `$ARGUMENTS`: empty (multi-perspective) or `by-prompt [prompt text]`
8
+ - Operates on `.workflow/issues/`
9
+
10
+ ---
11
+
12
+ ### Step 1: Parse Mode
13
+
14
+ ```
15
+ Mode from $ARGUMENTS:
16
+ empty → MULTI_PERSPECTIVE (Step 3)
17
+ "by-prompt" → PROMPT_DRIVEN (Step 7), remaining tokens = USER_PROMPT
18
+ ```
19
+
20
+ ---
21
+
22
+ ### Step 2: Validate Environment
23
+
24
+ ```
25
+ Require .workflow/ exists → fatal if missing: "No project initialized. Run /maestro-init first."
26
+ Ensure .workflow/issues/ and issues.jsonl exist (create if missing).
27
+
28
+ Session ID: DBP-{YYYYMMDD}-{HHmmss}
29
+ Session dir: .workflow/issues/discoveries/{SESSION_ID}/
30
+
31
+ Initialize discovery-state.json:
32
+ {
33
+ "id": "{SESSION_ID}",
34
+ "mode": "{discover|discover-by-prompt}",
35
+ "status": "in_progress",
36
+ "started_at": "{NOW_ISO}",
37
+ "completed_at": null,
38
+ "perspectives_completed": [],
39
+ "issues_found": 0,
40
+ "issues_deduplicated": 0
41
+ }
42
+ ```
43
+
44
+ ---
45
+
46
+ ## Multi-Perspective Discovery (discover)
47
+
48
+ ### Step 3: Define Analysis Perspectives
49
+
50
+ ```
51
+ 8 analysis perspectives, each with a focus area and guiding questions:
52
+
53
+ 1. SECURITY
54
+ Focus: Authentication, authorization, input validation, secrets, injection
55
+ Question: "What security vulnerabilities or unsafe patterns exist?"
56
+
57
+ 2. PERFORMANCE
58
+ Focus: N+1 queries, unbounded loops, missing caching, memory leaks, large payloads
59
+ Question: "What performance bottlenecks or inefficiencies exist?"
60
+
61
+ 3. RELIABILITY
62
+ Focus: Error handling, retry logic, race conditions, data integrity, graceful degradation
63
+ Question: "What failure modes are unhandled or could cause data loss?"
64
+
65
+ 4. MAINTAINABILITY
66
+ Focus: Code duplication, tight coupling, missing abstractions, unclear naming, dead code
67
+ Question: "What makes this codebase harder to understand or change?"
68
+
69
+ 5. SCALABILITY
70
+ Focus: Hardcoded limits, single-threaded bottlenecks, stateful assumptions, schema rigidity
71
+ Question: "What will break or degrade as load/data/users increase?"
72
+
73
+ 6. UX
74
+ Focus: Confusing flows, missing feedback, inconsistent behavior, accessibility gaps
75
+ Question: "What creates friction or confusion for end users?"
76
+
77
+ 7. ACCESSIBILITY
78
+ Focus: Screen reader support, keyboard navigation, color contrast, ARIA labels, focus management
79
+ Question: "What barriers exist for users with disabilities?"
80
+
81
+ 8. COMPLIANCE
82
+ Focus: Logging gaps, audit trails, data retention, privacy controls, regulatory requirements
83
+ Question: "What regulatory or policy requirements are not met?"
84
+ ```
85
+
86
+ ### Step 3.5: Load Project Specs
87
+
88
+ ```
89
+ specs_content = maestro spec load --category coding
90
+ ```
91
+
92
+ Pass to each analysis agent so severity assessments align with project quality standards.
93
+
94
+ ---
95
+
96
+ ### Step 4: Launch Parallel Analysis
97
+
98
+ ```
99
+ Batches of 4 concurrent agents:
100
+ Batch 1: security, performance, reliability, maintainability
101
+ Batch 2: scalability, ux, accessibility, compliance
102
+
103
+ Per perspective → delegate analysis:
104
+
105
+ maestro delegate "PURPOSE: Discover {PERSPECTIVE} issues in the codebase.
106
+ Focus: {FOCUS_AREA} | Question: {QUESTION}
107
+ TASK: Scan source files → identify issues with file:line → rate severity → suggest fix
108
+ MODE: analysis
109
+ CONTEXT: @**/*
110
+ EXPECTED: JSON array: [{ title, severity, description, location, fix_direction, affected_components[] }]
111
+ CONSTRAINTS: Evidence-backed findings only
112
+ " --role analyze --mode analysis
113
+
114
+ Results → .workflow/issues/discoveries/{SESSION_ID}/{PERSPECTIVE}-findings.json
115
+ Update discovery-state.json: perspectives_completed += ["{PERSPECTIVE}"]
116
+ ```
117
+
118
+ ### Step 5: Deduplicate Findings
119
+
120
+ ```
121
+ Merge all *-findings.json → single list.
122
+ Deduplicate: group by file path, merge entries with >80% description overlap
123
+ or same file:line (keep higher severity).
124
+ Track issues_found (pre-dedup) and issues_deduplicated (post-dedup) in discovery-state.json.
125
+ ```
126
+
127
+ ### Step 6: Create Issues from Findings
128
+
129
+ ```
130
+ Per unique finding → generate ISS-YYYYMMDD-NNN, build issue record:
131
+ {
132
+ "id", "title", "status": "registered",
133
+ "priority": severity_to_priority(critical→1, high→2, medium→3, low→4),
134
+ "severity", "source": "discovery",
135
+ "description", "fix_direction",
136
+ "context": { "location", "notes": "Discovered by {PERSPECTIVE} in {SESSION_ID}" },
137
+ "tags": ["{PERSPECTIVE}"],
138
+ "affected_components",
139
+ "issue_history": [{ from: null, to: "registered", actor: "discovery-agent" }],
140
+ "created_at", "updated_at"
141
+ }
142
+
143
+ Append to: .workflow/issues/issues.jsonl + discoveries/{SESSION_ID}/discovery-issues.jsonl
144
+ Finalize discovery-state.json: status = "completed", completed_at = NOW_ISO
145
+
146
+ Display summary: session ID, mode, raw/unique counts, per-perspective breakdown, severity breakdown.
147
+
148
+ Next steps:
149
+ - manage-issue list --severity critical
150
+ - manage-issue list
151
+ - see also: /manage-issue-discover usage docs (by-prompt mode for focused scans)
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Prompt-Driven Discovery (discover-by-prompt)
157
+
158
+ ### Step 7: Parse User Prompt
159
+
160
+ ```
161
+ Extract USER_PROMPT from DISCOVERY_ARGS.
162
+ If empty → prompt user to select focus area:
163
+ - Error handling gaps | API contract violations | Test coverage gaps | Custom
164
+ ```
165
+
166
+ ### Step 8: Plan Exploration Dimensions
167
+
168
+ ```
169
+ Delegate to decompose USER_PROMPT into 3-5 exploration dimensions:
170
+
171
+ maestro delegate "Decompose into searchable dimensions: {USER_PROMPT}
172
+ EXPECTED: JSON array: [{ name, description, search_patterns[], file_patterns[], finding_criteria }]
173
+ " --role analyze --mode analysis
174
+
175
+ Store → .workflow/issues/discoveries/{SESSION_ID}/exploration-plan.json
176
+ ```
177
+
178
+ ### Step 9: Gather Codebase Context
179
+
180
+ ```
181
+ Per dimension (prefer maestro explore over rg):
182
+ 1. maestro explore "{dimension.description}" per dimension, parallel
183
+ 2. Fallback: Semantic search via {search_tool} + rg for dimension.search_patterns
184
+ 3. Collect matching files/snippets → {SESSION_ID}/{dimension.name}-context.md
185
+ ```
186
+
187
+ ### Step 10: Iterative Exploration Loop
188
+
189
+ ```
190
+ Up to 3 rounds (exit early if no new gaps/findings):
191
+ Round 1: Analyze context → identify issues + coverage gaps
192
+ Round 2: maestro explore for gap patterns → search adjacent files → merge findings
193
+ Round 3: Final sweep on uncovered high-severity patterns + cross-module interactions
194
+
195
+ Log per round → {SESSION_ID}/exploration-log.md:
196
+ Files analyzed, new/cumulative findings, remaining gaps.
197
+ ```
198
+
199
+ ### Step 11: Generate Issues from Findings
200
+
201
+ ```
202
+ Deduplicate all findings (same logic as Step 5).
203
+ Per unique finding → issue record (same structure as Step 6):
204
+ source = "discovery", tags = ["prompt-discovery", "{dimension.name}"]
205
+ context.notes = "Discovered via prompt: {USER_PROMPT}"
206
+
207
+ Append to: issues.jsonl + discoveries/{SESSION_ID}/discovery-issues.jsonl
208
+ Finalize discovery-state.json: status = "completed"
209
+
210
+ Display summary: session, prompt, rounds, raw/unique counts, per-dimension + severity breakdown.
211
+
212
+ Next steps:
213
+ - manage-issue list --source discovery
214
+ - see also: /manage-issue-discover usage docs (full 8-perspective scan and by-prompt mode)
215
+ ```
216
+
217
+ ---
218
+
219
+ ## Output
220
+
221
+ - **Session artifacts**: `.workflow/issues/discoveries/{SESSION_ID}/`
222
+ - `discovery-state.json` -- session metadata and progress
223
+ - `discovery-issues.jsonl` -- issues found in this session
224
+ - `*-findings.json` -- raw findings per perspective (discover mode)
225
+ - `exploration-plan.json` -- dimensions (discover-by-prompt mode)
226
+ - `*-context.md` -- gathered context per dimension
227
+ - `exploration-log.md` -- round-by-round exploration log
228
+ - **Issues**: appended to `.workflow/issues/issues.jsonl`
229
+
230
+ ## Quality Criteria
231
+
232
+ - Multi-perspective mode covers all 8 analysis angles
233
+ - Prompt-driven mode decomposes user intent into searchable dimensions
234
+ - Findings backed by concrete file:line evidence
235
+ - Deduplication prevents duplicate issue records
236
+ - Discovery session fully traceable via session directory
237
+ - All created issues follow the issue.json template schema
238
+ - ID generation avoids collisions with existing issues
@@ -0,0 +1,110 @@
1
+ # Workflow: Issue Execution
2
+
3
+ > **DEPRECATED**: This workflow was used by the deleted `manage-issue-execute` command.
4
+ > Use `maestro-execute` instead, which handles wave-based execution with automatic issue status sync.
5
+
6
+ Execute a planned solution for an issue via dual-mode agent dispatch (server or direct CLI).
7
+
8
+ ## Input
9
+
10
+ - `$ARGUMENTS`: `<ISS-ID> [--executor claude-code|codex|gemini] [--dry-run]`
11
+ - Operates on `.workflow/issues/`
12
+
13
+ ---
14
+
15
+ ### Step 1: Parse Arguments
16
+
17
+ ```
18
+ Extract ISS-ID (required, pattern ISS-\d{8}-\d{3}).
19
+ Flags: --executor claude-code|codex|gemini (default: claude-code), --dry-run (default: false)
20
+ ```
21
+
22
+ ---
23
+
24
+ ### Step 2: Load Issue and Validate
25
+
26
+ ```
27
+ Load ISS-ID from .workflow/issues/issues.jsonl → fatal if file missing or ID not found.
28
+ Require issue.solution with non-empty steps[] → error if missing (run `maestro-plan --gaps {ISS-ID}` first).
29
+ Resolve EXECUTOR → CLI tool (claude-code→claude, codex→codex, gemini→gemini), all with --mode write.
30
+ ```
31
+
32
+ ---
33
+
34
+ ### Step 3: Dry Run (if --dry-run)
35
+
36
+ ```
37
+ If DRY_RUN: display prompt template, steps table (action | title | files),
38
+ and context. No changes made. Exit before Step 4.
39
+ ```
40
+
41
+ ---
42
+
43
+ ### Step 4: Detect Execution Mode
44
+
45
+ ```
46
+ Health check: curl http://127.0.0.1:3001/api/health
47
+ HTTP 200 → SERVER_UP (server dispatch) | otherwise → Direct CLI
48
+ ```
49
+
50
+ ---
51
+
52
+ ### Step 5a: Server UP Path
53
+
54
+ ```
55
+ POST to http://127.0.0.1:3001/api/execution/dispatch:
56
+ { "issueId", "executor", "solution": { steps, context, promptTemplate } }
57
+
58
+ Success (200/201) → server manages status lifecycle, skip to Step 6.
59
+ Failure → fall through to Step 5b (direct CLI fallback).
60
+ ```
61
+
62
+ ### Step 5b: Server DOWN Path
63
+
64
+ ```
65
+ Build EXEC_PROMPT from SOLUTION (promptTemplate + steps + context + constraints).
66
+
67
+ Status transitions in issues.jsonl with issue_history entries:
68
+ 1. Set status → in_progress (actor: EXECUTOR, note: "Execution started")
69
+ 2. Execute: maestro delegate "{EXEC_PROMPT}" --to {CLI_TOOL} --mode write
70
+ 3. On success → status = "resolved", resolved_at = NOW_ISO
71
+ On failure → status = "open" (revert, no stuck in_progress)
72
+
73
+ Read-modify-write pattern preserves other issues.
74
+ ```
75
+
76
+ ---
77
+
78
+ ### Step 6: Display Result
79
+
80
+ ```
81
+ Display: execution status (COMPLETE/FAILED), mode, executor, issue title, new status.
82
+ Server dispatch → show dispatch ID, "server managing lifecycle"
83
+ Direct CLI success → show modified files list
84
+ Failure → "reverted to open", suggest re-run or revise plan
85
+ ```
86
+
87
+ ---
88
+
89
+ ### Step 7: Suggest Next Steps
90
+
91
+ ```
92
+ Success → close issue, view status, run tests
93
+ Failure → retry with different executor, revise plan, re-analyze with --depth deep
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Output
99
+
100
+ - **Updated**: `.workflow/issues/issues.jsonl` -- issue status transitions (open -> in_progress -> resolved/open)
101
+ - **Execution modes**: Server dispatch (POST /api/execution/dispatch) or Direct delegate (maestro delegate --mode write)
102
+
103
+ ## Quality Criteria
104
+
105
+ - Dual-mode execution: server dispatch preferred, CLI fallback automatic
106
+ - Dry-run mode shows full prompt without side effects
107
+ - Status transitions recorded in issue_history with actor and timestamp
108
+ - Failed execution reverts status to open (no stuck in_progress)
109
+ - Read-modify-write pattern preserves other issues in JSONL
110
+ - Next-step routing adapts based on success or failure
@@ -0,0 +1,256 @@
1
+ # Workflow: Issue Gaps Analysis (Codex — CSV Wave)
2
+
3
+ ## Pipeline
4
+
5
+ ```
6
+ Load Issues → Classify & Group → Generate tasks.csv → Wave 1: Explore (parallel per issue) → Wave 2: Synthesize (per group) → Write issue.analysis → Output context.md
7
+ ```
8
+
9
+ ---
10
+
11
+ ### Step 1: Load Issues
12
+
13
+ ```
14
+ If ISS-ID provided:
15
+ Load single issue from .workflow/issues/issues.jsonl
16
+ → fatal if file missing or ID not found (E_ISSUE_NOT_FOUND)
17
+ → skip Step 2 (single issue = single group)
18
+
19
+ If no ISS-ID:
20
+ Load all issues where status == "open" || status == "registered"
21
+ → fatal if none found (E_NO_ISSUES)
22
+ ```
23
+
24
+ ---
25
+
26
+ ### Step 2: Classify & Group (batch mode only)
27
+
28
+ ```
29
+ Group loaded issues by affected area overlap:
30
+
31
+ Classification dimensions:
32
+ - location: file path prefix (first 2 segments, e.g. src/auth/)
33
+ - component: affected_components field overlap
34
+ - category: issue.category or severity
35
+
36
+ Grouping rules:
37
+ 1. Same location prefix → same group
38
+ 2. Shared affected_components → same group
39
+ 3. Remaining ungrouped → individual groups (1 issue each)
40
+
41
+ Output: GROUPS[] = { group_id, label, issues[], shared_keywords[] }
42
+
43
+ Display group breakdown (skip if AUTO_YES).
44
+ ```
45
+
46
+ ---
47
+
48
+ ### Step 3: Generate tasks.csv
49
+
50
+ Generate CSV with two waves:
51
+ - **Wave 1**: One exploration row per issue (parallel within wave)
52
+ - **Wave 2**: One synthesis row per group (parallel across groups, depends on its issues in wave 1)
53
+
54
+ ```csv
55
+ id,title,description,iss_id,group_id,group_label,deps,context_from,wave,status,findings,analysis_json,error
56
+ ```
57
+
58
+ **Wave 1 rows** — one per issue:
59
+
60
+ ```csv
61
+ "1","Explore: ISS-xxx {title}","Root cause exploration for ISS-xxx: {description}. Location: {location}. Severity: {severity}. Fix hint: {fix_direction}. Search keywords: {keywords from title+description+components}. TASK: maestro explore keywords (preferred) or grep keywords → read top matches → trace call chain → identify root cause (file:line) → assess impact → list related files → rate confidence → suggest fix. EXPECTED: JSON { root_cause, impact, related_files[], confidence, suggested_approach }. CONSTRAINTS: Evidence-only, use file reads to verify.","ISS-xxx","G1","src/auth","","","1","","","",""
62
+ ```
63
+
64
+ **Wave 2 rows** — one per group:
65
+
66
+ ```csv
67
+ "N","Synthesize: {group_label}","Compile exploration findings for group [{group_label}]. For each issue: validate root cause evidence, identify cross-issue relationships, build analysis record. Output: JSON array [{ iss_id, root_cause, affected_files, impact_scope, fix_direction, confidence, cross_refs }]. Note shared root causes and dependency chains across issues in this group.","","G1","src/auth","1;2;3","1;2;3","2","","","",""
68
+ ```
69
+
70
+ **Column definitions**:
71
+
72
+ | Column | Phase | Description |
73
+ |--------|-------|-------------|
74
+ | `id` | Input | Unique task identifier |
75
+ | `title` | Input | Short task title |
76
+ | `description` | Input | Full exploration/synthesis instructions |
77
+ | `iss_id` | Input | Issue ID (wave 1 only, empty for wave 2) |
78
+ | `group_id` | Input | Group identifier |
79
+ | `group_label` | Input | Group label for display |
80
+ | `deps` | Input | Semicolon-separated dependency task IDs |
81
+ | `context_from` | Input | Task IDs whose findings this task needs |
82
+ | `wave` | Input | 1 = explore, 2 = synthesize |
83
+ | `status` | Output | `pending` → `completed` / `failed` |
84
+ | `findings` | Output | Key findings summary (max 500 chars) |
85
+ | `analysis_json` | Output | Structured analysis JSON (wave 2 only) |
86
+ | `error` | Output | Error message if failed |
87
+
88
+ Write `tasks.csv` to session folder.
89
+
90
+ ---
91
+
92
+ ### Step 4: Wave 1 — Explore (parallel per issue)
93
+
94
+ Filter `wave == 1 && status == pending`. Write `wave-1.csv`.
95
+
96
+ ```javascript
97
+ MANDATORY, NOT SUBSTITUTABLE by manual Read/Grep:
98
+ spawn_agents_on_csv({
99
+ csv_path: `${sessionFolder}/wave-1.csv`,
100
+ id_column: "id",
101
+ instruction: `You are analyzing a specific issue for root cause. Read the 'description' column for full instructions. Use file reads and grep to gather evidence. Write findings as a concise summary with file:line references. Write analysis_json as a JSON object: { root_cause, impact, related_files[], confidence, suggested_approach }.`,
102
+ max_concurrency: maxConcurrency,
103
+ max_runtime_seconds: 3600,
104
+ output_csv_path: `${sessionFolder}/wave-1-results.csv`,
105
+ output_schema: { id, status: ["completed"|"failed"], findings, analysis_json, error }
106
+ })
107
+ ```
108
+
109
+ Merge results into master `tasks.csv`, delete `wave-1.csv`.
110
+
111
+ **Per-issue agent responsibilities**:
112
+ 1. **Keyword Search** — grep issue keywords in source, find top 20 relevant paths
113
+ 2. **Context Read** — read top 5 matches with 10 lines surrounding context
114
+ 3. **Call Chain Trace** — trace 2-3 levels from issue location
115
+ 4. **Root Cause Identification** — pinpoint file:line with evidence
116
+ 5. **Impact Assessment** — scope of affected functionality
117
+
118
+ ---
119
+
120
+ ### Step 5: Wave 2 — Synthesize (parallel per group)
121
+
122
+ Filter `wave == 2 && status == pending`. Build `prev_context` from wave 1 findings of issues in same group. Write `wave-2.csv` with `prev_context` column.
123
+
124
+ ```javascript
125
+ MANDATORY, NOT SUBSTITUTABLE by manual Read/Grep:
126
+ spawn_agents_on_csv({
127
+ csv_path: `${sessionFolder}/wave-2.csv`,
128
+ id_column: "id",
129
+ instruction: `You are synthesizing root cause analysis for a group of related issues. Read prev_context for per-issue exploration findings. Validate evidence, identify cross-issue relationships and shared root causes. Output analysis_json as a JSON array: [{ iss_id, root_cause, affected_files, impact_scope, fix_direction, confidence, cross_refs }].`,
130
+ max_concurrency: maxConcurrency,
131
+ max_runtime_seconds: 3600,
132
+ output_csv_path: `${sessionFolder}/wave-2-results.csv`,
133
+ output_schema: { id, status: ["completed"|"failed"], findings, analysis_json, error }
134
+ })
135
+ ```
136
+
137
+ Merge results into master `tasks.csv`, delete `wave-2.csv`.
138
+
139
+ **Synthesis agent responsibilities**:
140
+ 1. Parse per-issue findings from prev_context
141
+ 2. Validate root cause evidence (file:line exists, logic holds)
142
+ 3. Identify cross-issue relationships within group
143
+ 4. Build consolidated analysis array with cross_refs
144
+ 5. Flag shared root causes that affect multiple issues
145
+
146
+ ---
147
+
148
+ ### Step 6: Write Analysis to issues.jsonl
149
+
150
+ ```
151
+ Parse analysis_json from wave 2 results.
152
+
153
+ For each issue in the analysis array:
154
+ Build IssueAnalysis record:
155
+ {
156
+ root_cause,
157
+ affected_files,
158
+ impact_scope,
159
+ fix_direction,
160
+ confidence,
161
+ cross_refs,
162
+ analyzed_at: NOW_ISO,
163
+ tool: "spawn_agents_on_csv",
164
+ depth: DEPTH
165
+ }
166
+
167
+ Read-modify-write issues.jsonl (single pass):
168
+ Set issue.analysis = ANALYSIS, updated_at = NOW_ISO
169
+ Append issue.history: { action: "analyzed", at: NOW_ISO, by: "maestro-analyze --gaps" }
170
+ Status unchanged (non-destructive enrichment).
171
+
172
+ Verify: re-read, confirm analysis field present for all updated issues.
173
+ ```
174
+
175
+ ---
176
+
177
+ ### Step 7: Output context.md
178
+
179
+ ```
180
+ Aggregate results organized by group:
181
+
182
+ # Context: Issue Gaps Analysis
183
+
184
+ **Date**: {date}
185
+ **Issues analyzed**: {count}
186
+ **Groups**: {group_count}
187
+ **Session**: {sessionFolder}
188
+
189
+ ## Group: {group.label}
190
+
191
+ ### ISS-{id}: {title}
192
+ - **Root cause**: {root_cause}
193
+ - **Affected files**: {affected_files}
194
+ - **Impact scope**: {impact_scope}
195
+ - **Fix direction**: {fix_direction}
196
+ - **Confidence**: {confidence}
197
+ - **Cross-refs**: {related ISS-IDs}
198
+
199
+ (repeat per issue, per group)
200
+
201
+ ## Cross-Group Dependencies
202
+ {issues sharing root causes across groups}
203
+
204
+ ## Constraints
205
+
206
+ ### Locked
207
+ {constraints from root cause evidence}
208
+
209
+ ### Free
210
+ {implementation choices left to planner}
211
+
212
+ Write context.md to session folder + copy to scratchDir.
213
+ Register artifact in state.json.
214
+ ```
215
+
216
+ ---
217
+
218
+ ### Step 8: Display Summary and Next Steps
219
+
220
+ ```
221
+ Display: group breakdown, per-issue root cause, confidence, cross-refs.
222
+
223
+ Next steps:
224
+ - maestro-plan --gaps (plan fix tasks linked to analyzed issues)
225
+ - maestro-analyze --gaps {ISS-ID} (re-analyze specific issue)
226
+ - manage-issue list (review all issues)
227
+ ```
228
+
229
+ ---
230
+
231
+ ## Session Structure
232
+
233
+ ```
234
+ .workflow/.csv-wave/{YYYYMMDD}-analyze-{slug}/
235
+ ├── tasks.csv # master state
236
+ ├── results.csv # final export
237
+ ├── wave-1.csv # temporary (deleted after merge)
238
+ ├── wave-2.csv # temporary (deleted after merge)
239
+ ├── discoveries.ndjson # shared board (append-only)
240
+ ├── context.md # decisions for plan --gaps
241
+ ```
242
+
243
+ ## Output
244
+
245
+ - **Updated**: `.workflow/issues/issues.jsonl` — enriched with `analysis` field per issue
246
+ - **Created**: `context.md` — grouped root causes for downstream `plan --gaps`
247
+ - **Created**: `results.csv` — full task execution results
248
+
249
+ ## Quality Criteria
250
+
251
+ - Issues classified into groups before CSV generation
252
+ - Wave 1 agents run parallel (one per issue, bounded by maxConcurrency)
253
+ - Wave 2 agents run parallel (one per group, after wave 1 deps met)
254
+ - Cross-issue relationships captured via cross_refs
255
+ - Single-pass JSONL update preserves integrity
256
+ - context.md organized by group with cross-group section