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,494 @@
1
+ # Workflow: Grill
2
+
3
+ Socratic stress-testing of a plan/idea/requirement against codebase reality. Produces a verified context package for downstream consumption.
4
+
5
+ ## Architecture
6
+
7
+ ```
8
+ ┌──────────────────────────────────────────────────┐
9
+ │ /maestro-grill │
10
+ │ Entry Point + Interactive Routing │
11
+ └───────────────────────┬──────────────────────────┘
12
+
13
+ Step 1: Parse & Route (mode, depth, upstream)
14
+ Step 2: Discovery (docs + codebase scan)
15
+ Step 3: Terminology Alignment (code vs proposal)
16
+ Step 4: Branch Walking (Socratic grilling loop)
17
+ Step 5: Synthesis (report + terminology)
18
+ Step 6: Context Package (context-package.json)
19
+ Step 7: Register Artifact + finish-work
20
+ ```
21
+
22
+ ## Input
23
+
24
+ - `$ARGUMENTS`: topic/plan text, or `--from <source>` for upstream input
25
+ - All output goes to `.workflow/scratch/{YYYYMMDD}-grill-{slug}/`
26
+ - Registers artifact (type=grill) in state.json on completion
27
+ - **Output boundary**: ALL file writes MUST target `{output_dir}/` or `.workflow/state.json` only.
28
+
29
+ ### Parameters
30
+
31
+ | Parameter | Description | Default |
32
+ |-----------|-------------|---------|
33
+ | `--yes`, `-y` | Auto mode — use code exploration instead of human answers | - |
34
+ | `--depth` | Grilling depth: `shallow` (3 branches), `standard` (5), `deep` (8) | `standard` |
35
+ | `--from <source>` | Load upstream material: `blueprint:ID`, `@file`, or path | - |
36
+ | `--session ID` | Resume existing grill session | - |
37
+ | `-c`, `--continue` | Continue from last grill session | - |
38
+
39
+ ### Produced Files
40
+
41
+ | File | Description |
42
+ |------|-------------|
43
+ | `grill-report.md` | Main output — all grilling branches with decisions, evidence, risks |
44
+ | `terminology.md` | Glossary crystallized during grilling, cross-referenced with code |
45
+ | `context-package.json` | Standardized context package for downstream consumption |
46
+
47
+ ---
48
+
49
+ ## Step 1: Parse & Route
50
+
51
+ Parse $ARGUMENTS to determine execution mode:
52
+
53
+ **Mode Detection (ordered by priority)**:
54
+ 1. `-c` / `--continue` → **Resume Mode** (find latest grill session, continue from last branch)
55
+ 2. `--session ID` → **Resume Mode** (specific session)
56
+ 3. `--yes` / `-y` → **Auto Mode** (code exploration replaces human answers)
57
+ 4. Text provided → **Interactive Mode** (default, full Socratic grilling)
58
+ 5. No args → error E001
59
+
60
+ **Parameter Parsing**:
61
+ - `--depth shallow|standard|deep`: branch count 3/5/8, default `standard` (5)
62
+ - `--from <source>`: upstream material to grill against
63
+ - Missing/empty args without `--from` or `--continue` = error E001
64
+
65
+ **Session Detection**:
66
+ - Check `.workflow/scratch/*-grill-*/` for existing sessions
67
+ - Resume: load `grill-report.md` → find last completed branch → continue from next
68
+ - New: create `.workflow/scratch/{YYYYMMDD}-grill-{slug}/`
69
+
70
+ **Output Directory Resolution**:
71
+ ```
72
+ output_dir = .workflow/scratch/{YYYYMMDD}-grill-{slug}/
73
+ ```
74
+
75
+ ---
76
+
77
+ ## Step 2: Discovery
78
+
79
+ ### 2.1: Load Project State
80
+
81
+ ```
82
+ 1. Read .workflow/project.md (if exists) → tech_stack, validated_requirements, active_requirements
83
+ 2. Read .workflow/state.json (if exists) → accumulated_context, artifacts[]
84
+ 3. Read .workflow/roadmap.md (if exists) → phase structure
85
+ 4. specs_content = maestro spec load --category arch # MANDATORY, NOT SUBSTITUTABLE by manual Read/Grep
86
+ 5. wiki_hits = maestro wiki search "{topic keywords}" # MANDATORY, NOT SUBSTITUTABLE by manual Read/Grep
87
+ ```
88
+
89
+ ### 2.2: Load Upstream Material
90
+
91
+ If `--from` specified:
92
+ - `--from blueprint:ID` → `state.json.artifacts[type=blueprint, id=ID]` → load spec package
93
+ - `--from @file` → read file directly as proposal text
94
+ - `--from path/` → read `path/` directory for markdown files
95
+
96
+ Store as `upstream_material` (in-memory).
97
+
98
+ ### 2.3: Codebase Scan
99
+
100
+ MANDATORY, NOT SUBSTITUTABLE by manual Read/Grep: spawn `Agent(subagent_type: Explore)` to map the codebase surface relevant to the topic:
101
+
102
+ ```
103
+ Agent(
104
+ subagent_type="Explore",
105
+ prompt="""
106
+ Search breadth: medium
107
+ Find code relevant to: {topic}
108
+ Report:
109
+ 1. Existing modules/files that overlap with this topic
110
+ 2. Naming conventions used (variable names, function names, types)
111
+ 3. Patterns already established (error handling, data flow, API style)
112
+ 4. Dependencies and integration points
113
+ Return structured findings — file paths, symbol names, pattern descriptions.
114
+ """,
115
+ description="Codebase scan for grill context"
116
+ )
117
+ ```
118
+
119
+ Store as `codebase_context`. W001 on failure: continue without code grounding; flag grill output as [LOW CONFIDENCE] (no code grounding).
120
+
121
+ ### 2.4: Initialize Report
122
+
123
+ Write `{output_dir}/grill-report.md` with header:
124
+
125
+ ```markdown
126
+ # Grill Report: {topic}
127
+
128
+ **Session**: {session_id}
129
+ **Depth**: {depth} ({branch_count} branches)
130
+ **Date**: {ISO-8601}
131
+ **Upstream**: {source or "none"}
132
+
133
+ ## Discovery Summary
134
+
135
+ ### Project Context
136
+ {summary from Step 2.1}
137
+
138
+ ### Codebase Surface
139
+ {summary from Step 2.3}
140
+
141
+ ### Upstream Material
142
+ {summary from Step 2.2 or "N/A"}
143
+
144
+ ---
145
+
146
+ ## Branch Log
147
+
148
+ | # | Branch | Status | Decisions | Open Questions |
149
+ |---|--------|--------|-----------|----------------|
150
+
151
+ ---
152
+ ```
153
+
154
+ ---
155
+
156
+ ## Step 3: Terminology Alignment
157
+
158
+ ### 3.1: Extract Candidate Terms
159
+
160
+ From topic + upstream, identify 5-15 domain terms (entity nouns, operation verbs, property adjectives).
161
+
162
+ ### 3.2: Code Name Collision Check
163
+
164
+ For each candidate term, search the codebase:
165
+ ```
166
+ Grep(pattern="{term}", output_mode="files_with_matches")
167
+ ```
168
+
169
+ Build a collision table:
170
+
171
+ | Proposed Term | Code Usage | Conflict? | Resolution |
172
+ |---------------|------------|-----------|------------|
173
+ | "account" | `UserAccount` class (auth module) | Yes — ambiguous | Propose: "Organization" for billing, "UserAccount" for auth |
174
+
175
+ ### 3.3: Challenge Vague Terms
176
+
177
+ For each term with conflict or ambiguity, challenge the user via AskUserQuestion:
178
+
179
+ ```
180
+ AskUserQuestion({
181
+ questions: [{
182
+ question: "You said '{term}' — but the codebase uses '{code_name}' for {code_meaning}. Which do you mean?",
183
+ header: "Terminology",
184
+ options: [
185
+ { label: "Use '{code_name}'", description: "Align with existing codebase naming" },
186
+ { label: "New term: '{proposed}'", description: "Introduce new concept distinct from {code_name}" },
187
+ { label: "Rename existing", description: "The existing code should adopt the new term" }
188
+ ],
189
+ multiSelect: false
190
+ }]
191
+ })
192
+ ```
193
+
194
+ **Auto mode (`-y`)**: Use CLI exploration to resolve — prefer existing code naming; override only when name is semantically incorrect (verify via symbol lookup).
195
+
196
+ ### 3.4: Write Terminology File
197
+
198
+ Write `{output_dir}/terminology.md`:
199
+
200
+ ```markdown
201
+ # Terminology
202
+
203
+ | Term | Definition | Code Reference | Status |
204
+ |------|------------|----------------|--------|
205
+ | {term} | {definition} | `{file:symbol}` or "new" | locked/open |
206
+ ```
207
+
208
+ ---
209
+
210
+ ## Step 4: Branch Walking (Core Grilling Loop)
211
+
212
+ One branch at a time, one question per turn. Each branch fully explored before next.
213
+
214
+ ### Branch Categories
215
+
216
+ | Priority | Branch | Shallow | Standard | Deep |
217
+ |----------|--------|---------|----------|------|
218
+ | 1 | Scope & Boundaries | ✓ | ✓ | ✓ |
219
+ | 2 | Data Model & State | ✓ | ✓ | ✓ |
220
+ | 3 | Edge Cases & Failure Modes | ✓ | ✓ | ✓ |
221
+ | 4 | Integration & Dependencies | | ✓ | ✓ |
222
+ | 5 | Scale & Performance | | ✓ | ✓ |
223
+ | 6 | Security & Access Control | | | ✓ |
224
+ | 7 | Observability & Operations | | | ✓ |
225
+ | 8 | Migration & Rollback | | | ✓ |
226
+
227
+ ### Branch Walking Protocol
228
+
229
+ **4.1: Open the Branch**
230
+ ```markdown
231
+ ## Branch {N}: {branch_name}
232
+
233
+ **Status**: 🔴 In Progress
234
+ **Questions asked**: 0
235
+ **Decisions locked**: 0
236
+ ```
237
+
238
+ **4.2: Generate Probing Questions**
239
+
240
+ Generate 3-5 probing questions per branch. MUST: reference code findings, use concrete scenarios, challenge assumptions, escalate from basic to adversarial.
241
+
242
+ Question patterns per branch:
243
+
244
+ **Scope & Boundaries**:
245
+ - "What is the smallest version of this that delivers value?"
246
+ - "You mentioned {feature} — does it need {sub-feature}, or is that a separate concern?"
247
+ - "The codebase already has {existing_module} — where does your proposal's boundary end and {existing_module} begin?"
248
+
249
+ **Data Model & State**:
250
+ - "What are the core entities? Walk me through their lifecycle."
251
+ - "The code uses {existing_model} — does your {proposed_entity} extend it, replace it, or coexist?"
252
+ - "What happens to {entity} when {related_entity} is deleted?"
253
+
254
+ **Edge Cases & Failure Modes**:
255
+ - "What happens when {operation} is called with {extreme_input}?"
256
+ - "If {dependency} is unavailable, what does the user see?"
257
+ - "Two users do {action} simultaneously — what wins?"
258
+
259
+ **Integration & Dependencies**:
260
+ - "Which existing modules does this touch? Show me the call chain."
261
+ - "What contract does this establish with {consumer}? What can they NOT assume?"
262
+ - "If {upstream_service} changes its API, how much of this breaks?"
263
+
264
+ **Scale & Performance**:
265
+ - "At 10x current load, which part breaks first?"
266
+ - "This query touches {table} — how many rows at steady state? At peak?"
267
+ - "What's the cache invalidation strategy? What goes stale?"
268
+
269
+ **Security & Access Control**:
270
+ - "Who can perform {action}? Who explicitly cannot?"
271
+ - "What happens if an authenticated user sends a crafted {input}?"
272
+ - "Where does PII flow? Where is it stored? Who can access it?"
273
+
274
+ **Observability & Operations**:
275
+ - "How do you know this is working correctly in production?"
276
+ - "What alert fires first when this breaks? What's the runbook?"
277
+ - "How do you debug a user report of '{symptom}'?"
278
+
279
+ **Migration & Rollback**:
280
+ - "How do you deploy this without downtime?"
281
+ - "If this fails in production, what's the rollback procedure?"
282
+ - "What data migration is needed? Is it reversible?"
283
+
284
+ **4.3: Ask One Question at a Time**
285
+
286
+ For each question in the branch:
287
+
288
+ ```
289
+ AskUserQuestion({
290
+ questions: [{
291
+ question: "{probing_question}",
292
+ header: "{branch_name}",
293
+ options: [
294
+ { label: "{option_a}", description: "{implication_a}" },
295
+ { label: "{option_b}", description: "{implication_b}" },
296
+ { label: "Not applicable", description: "This concern doesn't apply to this proposal" }
297
+ ],
298
+ multiSelect: false
299
+ }]
300
+ })
301
+ ```
302
+
303
+ **Auto mode**: Instead of asking the user, use code exploration to answer:
304
+ ```
305
+ # MANDATORY, NOT SUBSTITUTABLE by manual Read/Grep
306
+ maestro delegate "PURPOSE: Answer '{question}' for the proposal '{topic}'
307
+ TASK: Search codebase for evidence | Analyze existing patterns | Determine most likely answer
308
+ MODE: analysis
309
+ CONTEXT: @**/* | Proposal: {topic_summary}
310
+ EXPECTED: Direct answer with code evidence (file:line references)
311
+ CONSTRAINTS: Answer based on code evidence only, flag uncertainty" --role analyze --mode analysis
312
+ ```
313
+
314
+ **4.4: Validate Answer Against Code**
315
+
316
+ After each answer, verify against codebase:
317
+ - "We'll use X pattern" → Grep for existing X usage, confirm consistency
318
+ - "This won't affect Y" → Explore call chains to verify isolation
319
+ - Contradiction found → immediately challenge with code evidence
320
+
321
+ **4.5: Record Decision**
322
+
323
+ After each question is settled, immediately append to `grill-report.md`:
324
+
325
+ ```markdown
326
+ ### Q{N}.{M}: {question_summary}
327
+
328
+ **Answer**: {user_answer_or_auto_answer}
329
+ **Evidence**: {code_references_or_reasoning}
330
+ **Decision**: {locked|open|deferred}
331
+ **Constraint**: {if locked, the RFC 2119 statement — e.g., "MUST use event sourcing for audit trail"}
332
+ ```
333
+
334
+ **4.6: Branch Completion**
335
+
336
+ All questions asked (or user signals "enough") → update branch status, update Branch Log table, move to next.
337
+
338
+ ---
339
+
340
+ ## Step 5: Synthesis
341
+
342
+ ### 5.1: Decision Summary
343
+
344
+ Classify all branch decisions:
345
+
346
+ | Classification | Criteria | Downstream Use |
347
+ |----------------|----------|----------------|
348
+ | **Locked** | User confirmed + code-verified | → `constraints[]` in context-package |
349
+ | **Open** | User answered but unverified or uncertain | → `open_questions[]` in context-package |
350
+ | **Deferred** | Explicitly postponed or "not applicable" | → `non_goals[]` or future work |
351
+
352
+ ### 5.2: Risk Register
353
+
354
+ ```markdown
355
+ ## Risk Register
356
+
357
+ | # | Risk | Branch | Severity | Mitigation |
358
+ |---|------|--------|----------|------------|
359
+ ```
360
+
361
+ ### 5.3: Finalize Report
362
+
363
+ Append to `grill-report.md`:
364
+
365
+ ```markdown
366
+ ## Synthesis
367
+
368
+ ### Decision Summary
369
+ | # | Decision | Status | Branch | RFC 2119 |
370
+ |---|----------|--------|--------|----------|
371
+
372
+ ### Verified Constraints
373
+ {locked decisions with code evidence}
374
+
375
+ ### Open Questions
376
+ {decisions needing further exploration}
377
+
378
+ ### Risk Register
379
+ {from 5.2}
380
+
381
+ ### Recommended Next Step
382
+ {routing based on findings}
383
+ ```
384
+
385
+ ### 5.4: Finalize Terminology
386
+
387
+ Update `{output_dir}/terminology.md` — mark all terms as locked/open based on grilling outcomes. Add any new terms surfaced during branch walking.
388
+
389
+ ---
390
+
391
+ ## Step 6: Generate Context Package
392
+
393
+ Write `{output_dir}/context-package.json`:
394
+
395
+ ```jsonc
396
+ {
397
+ "$schema": "context-package/1.0",
398
+ "source": {
399
+ "type": "grill",
400
+ "artifact_id": "{artifact_id}",
401
+ "session_path": "{output_dir relative to .workflow/}",
402
+ "generated_at": "{ISO-8601}"
403
+ },
404
+ "requirements": [],
405
+ "constraints": [],
406
+ "domain": {
407
+ "problem_statement": "",
408
+ "terminology": [],
409
+ "audience": "",
410
+ "industry": ""
411
+ },
412
+ "non_goals": [],
413
+ "insights": [],
414
+ "open_questions": [],
415
+ "references": []
416
+ }
417
+ ```
418
+
419
+ **Extraction mapping**:
420
+ - `requirements[]`: locked scope decisions from Branch 1 → `{ id: "R-{NNN}", title, description, priority: "must|should|may", ref: "grill-report.md#Branch-1" }`
421
+ - `constraints[]`: all locked decisions with RFC 2119 keywords → `{ id: "C-{NNN}", area, constraint, rationale, status: "locked", ref: "grill-report.md#Q{N}.{M}" }`
422
+ - `domain.problem_statement`: from topic + synthesis
423
+ - `domain.terminology[]`: from `terminology.md` → `{ term, definition, code_ref, status: "locked|open" }`
424
+ - `non_goals[]`: deferred decisions + explicit exclusions → `{ title, rationale, ref }`
425
+ - `insights[]`: code findings that contradicted or enriched the proposal → `{ area, summary, evidence, ref }`
426
+ - `open_questions[]`: open decisions needing brainstorm/analyze exploration → `{ area, question, options[], ref }`
427
+ - `references[]`: `{ type: "grill-report", path: "grill-report.md" }`, `{ type: "terminology", path: "terminology.md" }`
428
+
429
+ ---
430
+
431
+ ## Step 6.5: Artifact Verification (before completion)
432
+
433
+ Verify all required artifacts exist before proceeding to artifact registration:
434
+ - `grill-report.md` — Branch Log + Q&A entries + synthesis
435
+ - `terminology.md` — ≥5 terms with code refs
436
+ - `context-package.json` — schema "context-package/1.0"
437
+
438
+ If any missing: produce the missing artifact before Step 7. Do NOT register completion without all artifacts present.
439
+
440
+ ---
441
+
442
+ ## Step 7: Register Artifact
443
+
444
+ ### 7.1: Register in state.json
445
+
446
+ ```jsonc
447
+ {
448
+ "id": "GRL-{NNN}",
449
+ "type": "grill",
450
+ "scope": "standalone",
451
+ "path": "{output_dir relative to .workflow/}",
452
+ "status": "completed",
453
+ "context_package": "{output_dir}/context-package.json",
454
+ "created_at": "{ISO-8601}",
455
+ "metadata": {
456
+ "topic": "{topic}",
457
+ "depth": "{depth}",
458
+ "branches_completed": {N},
459
+ "decisions_locked": {N},
460
+ "decisions_open": {N},
461
+ "terms_defined": {N}
462
+ }
463
+ }
464
+ ```
465
+
466
+ ### 7.2: Domain Knowledge Flow
467
+
468
+ Grill 产出的领域术语通过以下路径沉淀到项目知识库:
469
+
470
+ ```
471
+ terminology.md (locked terms) ──→ finish-work Step 3.5 ──→ .workflow/domain/glossary.yaml
472
+ context-package.json#domain.terminology[] ──→ finish-work Step 3.5 ──→ glossary.yaml
473
+ ```
474
+
475
+ - Grill 期间**不应**直接调用 `maestro domain add` — 术语在 grilling 过程中可能被修改或推翻
476
+ - 所有术语经 Step 5 synthesis 锁定后,由 chain 末尾的 `manage-harvest --auto` 自动触发 finish-work 提取
477
+ - finish-work Step 3.5 的 domain extraction 始终交互确认(`-y` 对 domain 注册无效)
478
+
479
+ ### 7.3: Completion Report
480
+
481
+ ```
482
+ Grill session {artifact_id} completed.
483
+ - Branches walked: {N}/{total}
484
+ - Decisions locked: {N}
485
+ - Open questions: {N}
486
+ - Terms defined: {N}
487
+ - Risk items: {N}
488
+
489
+ Next steps:
490
+ /maestro-brainstorm "{topic}" --from grill:{artifact_id} — Multi-role brainstorm with grilled context
491
+ /maestro-analyze "{topic}" --from grill:{artifact_id} — Deep analysis with grilled constraints
492
+ /maestro-roadmap --from grill:{artifact_id} — Direct to roadmap (if scope is clear)
493
+ ```
494
+