maestro-flow 0.3.13 → 0.3.15

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 (38) hide show
  1. package/.claude/commands/maestro-composer.md +354 -0
  2. package/.claude/commands/maestro-player.md +404 -0
  3. package/.claude/skills/skill-iter-tune/SKILL.md +382 -0
  4. package/.claude/skills/skill-iter-tune/phases/01-setup.md +144 -0
  5. package/.claude/skills/skill-iter-tune/phases/02-execute.md +292 -0
  6. package/.claude/skills/skill-iter-tune/phases/03-evaluate.md +312 -0
  7. package/.claude/skills/skill-iter-tune/phases/04-improve.md +186 -0
  8. package/.claude/skills/skill-iter-tune/phases/05-report.md +166 -0
  9. package/.claude/skills/skill-iter-tune/specs/evaluation-criteria.md +63 -0
  10. package/.claude/skills/skill-iter-tune/templates/eval-prompt.md +134 -0
  11. package/.claude/skills/skill-iter-tune/templates/execute-prompt.md +97 -0
  12. package/.claude/skills/workflow-skill-designer/SKILL.md +496 -0
  13. package/.claude/skills/workflow-skill-designer/phases/01-requirements-analysis.md +356 -0
  14. package/.claude/skills/workflow-skill-designer/phases/02-orchestrator-design.md +444 -0
  15. package/.claude/skills/workflow-skill-designer/phases/03-phase-design.md +458 -0
  16. package/.claude/skills/workflow-skill-designer/phases/04-validation.md +471 -0
  17. package/.codex/skills/maestro-composer/SKILL.md +285 -0
  18. package/.codex/skills/maestro-link-coordinate/SKILL.md +430 -224
  19. package/.codex/skills/maestro-player/SKILL.md +448 -0
  20. package/chains/milestone-fork-merge.json +6 -6
  21. package/dist/src/hooks/auto-mode.d.ts +18 -0
  22. package/dist/src/hooks/auto-mode.d.ts.map +1 -0
  23. package/dist/src/hooks/auto-mode.js +28 -0
  24. package/dist/src/hooks/auto-mode.js.map +1 -0
  25. package/dist/src/hooks/context-monitor.d.ts.map +1 -1
  26. package/dist/src/hooks/context-monitor.js +14 -3
  27. package/dist/src/hooks/context-monitor.js.map +1 -1
  28. package/dist/src/hooks/coordinator-tracker.d.ts +1 -0
  29. package/dist/src/hooks/coordinator-tracker.d.ts.map +1 -1
  30. package/dist/src/hooks/coordinator-tracker.js +19 -9
  31. package/dist/src/hooks/coordinator-tracker.js.map +1 -1
  32. package/package.json +1 -1
  33. package/templates/workflows/specs/node-catalog.md +170 -0
  34. package/templates/workflows/specs/template-schema.md +157 -0
  35. package/workflows/maestro-coordinate.codex.md +9 -9
  36. package/workflows/maestro-coordinate.md +9 -9
  37. package/workflows/maestro.md +2 -2
  38. package/.codex/skills/maestro-chain/SKILL.md +0 -233
@@ -0,0 +1,496 @@
1
+ ---
2
+ name: workflow-skill-designer
3
+ description: Meta-skill for designing orchestrator+phases structured workflow skills. Creates SKILL.md coordinator with progressive phase loading, TodoWrite patterns, and data flow. Triggers on "design workflow skill", "create workflow skill", "workflow skill designer".
4
+ allowed-tools: Agent, AskUserQuestion, TodoWrite, Read, Write, Edit, Bash, Glob, Grep
5
+ ---
6
+
7
+ # Workflow Skill Designer
8
+
9
+ Meta-skill for creating structured workflow skills following the orchestrator + phases pattern. Generates complete skill packages with SKILL.md as coordinator and phases/ folder for execution details.
10
+
11
+ ## Architecture Overview
12
+
13
+ ```
14
+ ┌─────────────────────────────────────────────────────────────────┐
15
+ │ Workflow Skill Designer │
16
+ │ → Analyze requirements → Design orchestrator → Generate phases │
17
+ └───────────────┬─────────────────────────────────────────────────┘
18
+
19
+ ┌───────────┼───────────┬───────────┐
20
+ ↓ ↓ ↓ ↓
21
+ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
22
+ │ Phase 1 │ │ Phase 2 │ │ Phase 3 │ │ Phase 4 │
23
+ │ Require │ │ Orch │ │ Phases │ │ Valid │
24
+ │ Analysis│ │ Design │ │ Design │ │ & Integ │
25
+ └─────────┘ └─────────┘ └─────────┘ └─────────┘
26
+ ↓ ↓ ↓ ↓
27
+ workflow SKILL.md phases/ Complete
28
+ config generated 0N-*.md skill pkg
29
+ ```
30
+
31
+ ## Target Output Structure
32
+
33
+ The skill this meta-skill produces follows this structure:
34
+
35
+ ```
36
+ .claude/skills/{skill-name}/
37
+ ├── SKILL.md # Orchestrator: coordination, data flow, TodoWrite
38
+ ├── phases/
39
+ │ ├── 01-{phase-name}.md # Phase execution detail (full content)
40
+ │ ├── 02-{phase-name}.md
41
+ │ ├── ...
42
+ │ └── 0N-{phase-name}.md
43
+ ├── specs/ # [Optional] Domain specifications
44
+ └── templates/ # [Optional] Reusable templates
45
+ ```
46
+
47
+ ## Core Design Patterns
48
+
49
+ Patterns extracted from successful workflow skill implementations (workflow-plan, project-analyze, etc.):
50
+
51
+ ### Pattern 1: Orchestrator + Progressive Loading
52
+
53
+ **SKILL.md** = Pure coordinator. Contains:
54
+ - Architecture diagram (ASCII)
55
+ - Execution flow with `Ref: phases/0N-xxx.md` markers
56
+ - Phase Reference Documents table (read on-demand)
57
+ - Data flow between phases
58
+ - Core rules and error handling
59
+
60
+ **Phase files** = Full execution detail. Contains:
61
+ - Complete agent prompts, bash commands, code implementations
62
+ - Validation checklists, error handling
63
+ - Input/Output specification
64
+ - Next Phase link
65
+
66
+ **Key Rule**: SKILL.md references phase docs via `Ref:` markers. Phase docs are read **only when that phase executes**, not all at once.
67
+
68
+ ### Pattern 2: TodoWrite Attachment/Collapse
69
+
70
+ ```
71
+ Phase starts:
72
+ → Sub-tasks ATTACHED to TodoWrite (in_progress + pending)
73
+ → Orchestrator executes sub-tasks sequentially
74
+
75
+ Phase ends:
76
+ → Sub-tasks COLLAPSED back to high-level summary (completed)
77
+ → Next phase begins
78
+ ```
79
+
80
+ ### Pattern 3: Inter-Phase Data Flow
81
+
82
+ ```
83
+ Phase N output → stored in memory/variable → Phase N+1 input
84
+ └─ or written to session file for persistence
85
+ ```
86
+
87
+ Each phase receives outputs from prior phases via:
88
+ - In-memory variables (sessionId, contextPath, etc.)
89
+ - Session directory files (.workflow/active/{sessionId}/...)
90
+ - Planning notes (accumulated constraints document)
91
+
92
+ ### Pattern 4: Conditional Phase Execution
93
+
94
+ ```
95
+ Phase N output contains condition flag
96
+ ├─ condition met → Execute Phase N+1
97
+ └─ condition not met → Skip to Phase N+2
98
+ ```
99
+
100
+ ### Pattern 5: Input Structuring
101
+
102
+ User input (free text) → Structured format before Phase 1:
103
+ ```
104
+ GOAL: [objective]
105
+ SCOPE: [boundaries]
106
+ CONTEXT: [background/constraints]
107
+ ```
108
+
109
+ ### Pattern 6: Interactive Preference Collection (SKILL.md Responsibility)
110
+
111
+ Workflow preferences (auto mode, force explore, etc.) MUST be collected via AskUserQuestion in SKILL.md **before** dispatching to phases. Phases reference these as `workflowPreferences.{key}` context variables.
112
+
113
+ **Anti-Pattern**: Command-line flags (`--yes`, `-e`, `--explore`) parsed within phase files via `$ARGUMENTS.includes(...)`.
114
+
115
+ ```javascript
116
+ // CORRECT: In SKILL.md (before phase dispatch)
117
+ const prefResponse = AskUserQuestion({
118
+ questions: [
119
+ { question: "是否跳过确认?", header: "Auto Mode", options: [
120
+ { label: "Interactive (Recommended)", description: "交互模式" },
121
+ { label: "Auto", description: "跳过所有确认" }
122
+ ]}
123
+ ]
124
+ })
125
+ workflowPreferences = { autoYes: prefResponse.autoMode === 'Auto' }
126
+
127
+ // CORRECT: In phase files (reference only)
128
+ const autoYes = workflowPreferences.autoYes
129
+
130
+ // WRONG: In phase files (flag parsing)
131
+ const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
132
+ ```
133
+
134
+ ### Pattern 7: Direct Phase Handoff
135
+
136
+ When one phase needs to invoke another phase within the same skill, read and execute the phase document directly. Do NOT use Skill() routing back through SKILL.md.
137
+
138
+ ```javascript
139
+ // CORRECT: Direct handoff (executionContext already set)
140
+ Read("phases/02-lite-execute.md")
141
+ // Execute with executionContext (Mode 1)
142
+
143
+ // WRONG: Skill routing (unnecessary round-trip)
144
+ Skill(skill="workflow-lite-plan", args="--in-memory")
145
+ ```
146
+
147
+ ### Pattern 8: Phase File Hygiene
148
+
149
+ Phase files are internal execution documents. They MUST NOT contain:
150
+
151
+ | Prohibited | Reason | Correct Location |
152
+ |------------|--------|------------------|
153
+ | Flag parsing (`$ARGUMENTS.includes(...)`) | Preferences collected in SKILL.md | SKILL.md via AskUserQuestion |
154
+ | Invocation syntax (`/skill-name "..."`) | Not user-facing docs | Removed or SKILL.md only |
155
+ | Conversion provenance (`Source: Converted from...`) | Implementation detail | Removed |
156
+ | Skill routing for inter-phase (`Skill(skill="...")`) | Use direct phase read | Direct `Read("phases/...")` |
157
+
158
+ ### Pattern 9: Compact Recovery (Phase Persistence)
159
+
160
+ Multi-phase workflows span long conversations. Context compression (compact) will naturally summarize earlier phase documents. The strategy uses **双重保险**: TodoWrite 跟踪 active phase 保护其不被压缩,sentinel 作为兜底在压缩发生时触发恢复。
161
+
162
+ **Design principle**: TodoWrite `in_progress` = active phase → protect from compact | Sentinel = re-read fallback if protection fails.
163
+
164
+ **Double insurance mechanism**:
165
+
166
+ | Layer | Role | Mechanism |
167
+ |-------|------|-----------|
168
+ | **1. Active Phase Protection** | 预防 | TodoWrite `in_progress` 标记当前 phase → compact 时保留该 phase 完整内容,不压缩 |
169
+ | **2. Sentinel Re-read** | 恢复 | Phase 文件嵌入标识符 → 若仍被压缩,检测到 sentinel-only 状态时立即 re-read |
170
+
171
+ **When to apply**: 任何通过 direct handoff (Pattern 7) 跨 phase 执行的场景,尤其是后续 phase 包含复杂执行协议(多 Step、agent 调度、CLI 编排)时。
172
+
173
+ ---
174
+
175
+ #### Layer 1: Active Phase Protection (TodoWrite 联动)
176
+
177
+ TodoWrite 已经跟踪每个 phase 的执行状态。利用此信息驱动 compact 策略:
178
+
179
+ ```
180
+ TodoWrite status → Compact behavior:
181
+ ┌─ completed → ✅ 可压缩(已完成,不再需要完整内容)
182
+ ├─ in_progress → 🛡️ 禁止压缩(正在执行,必须保留完整协议)
183
+ └─ pending → ✅ 可压缩(尚未加载,无内容)
184
+ ```
185
+
186
+ **SKILL.md Execution Flow** 中标注 compact 联动:
187
+ ```markdown
188
+ ## Execution Flow
189
+
190
+ > **⚠️ COMPACT DIRECTIVE**: Context compression MUST check TodoWrite phase status.
191
+ > The phase currently marked `in_progress` is the active execution phase — preserve its FULL content.
192
+ > Only compress phases marked `completed` or `pending`.
193
+
194
+ Phase 1: Requirements Analysis ← TodoWrite tracks status
195
+ └─ Ref: phases/01-xxx.md
196
+ Phase 2: Execution Engine ← TodoWrite tracks status
197
+ └─ Ref: phases/02-xxx.md
198
+ ...
199
+ ```
200
+
201
+ **TodoWrite 状态转换** 时自动更新 compact 保护范围:
202
+ ```
203
+ Phase 1: in_progress 🛡️ → completed ✅ (compact 可压缩 Phase 1)
204
+ Phase 2: pending ✅ → in_progress 🛡️ (compact 保护 Phase 2)
205
+ ```
206
+
207
+ ---
208
+
209
+ #### Layer 2: Sentinel Re-read (兜底恢复)
210
+
211
+ 即使有 Layer 1 保护,compact 仍可能在极端场景(超长上下文、多轮 agent 调度)下压缩 active phase。Sentinel 确保恢复能力:
212
+
213
+ **Phase 文件顶部嵌入 sentinel**:
214
+ ```markdown
215
+ > **📌 COMPACT SENTINEL [Phase N: {phase-name}]**
216
+ > This phase contains {M} execution steps (Step N.1 — N.{M}).
217
+ > If you can read this sentinel but cannot find the full Step protocol below, context has been compressed.
218
+ > Recovery: `Read("phases/0N-xxx.md")`
219
+ ```
220
+
221
+ Sentinel 设计特点:
222
+ - 结构化、醒目 → compact 会将其作为关键信息保留在摘要中
223
+ - 包含 step 数量 → 提供自检依据("应该看到 M 个 Step,但只有摘要")
224
+ - 包含 re-read 路径 → 无需查表即可恢复
225
+
226
+ ---
227
+
228
+ #### Phase Reference Table (整合双重保险)
229
+
230
+ ```markdown
231
+ | Phase | Document | Purpose | Compact |
232
+ |-------|----------|---------|---------|
233
+ | 1 | phases/01-xxx.md | Planning | TodoWrite 驱动 |
234
+ | 2 | phases/02-xxx.md | Execution | TodoWrite 驱动 + 🔄 sentinel |
235
+
236
+ **Compact Rules**:
237
+ 1. **TodoWrite `in_progress`** → 保留完整内容,禁止压缩
238
+ 2. **TodoWrite `completed`** → 可压缩为摘要
239
+ 3. **🔄 sentinel fallback** → 带此标记的 phase 包含 compact sentinel;若 compact 后仅存 sentinel 而无完整 Step 协议,**必须立即 `Read("phases/0N-xxx.md")` 恢复后再继续**
240
+ ```
241
+
242
+ ---
243
+
244
+ #### Checkpoint (执行步骤前双重验证)
245
+
246
+ ```markdown
247
+ > **⚠️ CHECKPOINT**: Before proceeding, verify:
248
+ > 1. This phase is TodoWrite `in_progress` (active phase protection)
249
+ > 2. Full protocol (Step N.X — N.{M}) is in active memory, not just sentinel
250
+ > If only sentinel remains → `Read("phases/0N-xxx.md")` now.
251
+ ```
252
+
253
+ #### Handoff 注释
254
+
255
+ ```javascript
256
+ // Phase N is tracked by TodoWrite — active phase protection applies.
257
+ // Sentinel fallback: if compressed despite protection, re-read triggers automatically.
258
+ Read("phases/0N-xxx.md")
259
+ ```
260
+
261
+ ## Execution Flow
262
+
263
+ ```
264
+ Phase 1: Requirements Analysis
265
+ └─ Ref: phases/01-requirements-analysis.md
266
+ ├─ Input source: commands, descriptions, user interaction
267
+ └─ Output: workflowConfig (phases, data flow, agents, conditions)
268
+
269
+ Phase 2: Orchestrator Design (SKILL.md)
270
+ └─ Ref: phases/02-orchestrator-design.md
271
+ ├─ Input: workflowConfig
272
+ └─ Output: .claude/skills/{name}/SKILL.md
273
+
274
+ Phase 3: Phase Files Design
275
+ └─ Ref: phases/03-phase-design.md
276
+ ├─ Input: workflowConfig + source content
277
+ └─ Output: .claude/skills/{name}/phases/0N-*.md
278
+
279
+ Phase 4: Validation & Integration
280
+ └─ Ref: phases/04-validation.md
281
+ └─ Output: Validated skill package
282
+ ```
283
+
284
+ **Phase Reference Documents** (read on-demand):
285
+
286
+ | Phase | Document | Purpose |
287
+ |-------|----------|---------|
288
+ | 1 | [phases/01-requirements-analysis.md](phases/01-requirements-analysis.md) | Analyze workflow requirements from various sources |
289
+ | 2 | [phases/02-orchestrator-design.md](phases/02-orchestrator-design.md) | Generate SKILL.md with orchestration patterns |
290
+ | 3 | [phases/03-phase-design.md](phases/03-phase-design.md) | Generate phase files preserving full execution detail |
291
+ | 4 | [phases/04-validation.md](phases/04-validation.md) | Validate structure, references, and integration |
292
+
293
+ ## Input Sources
294
+
295
+ This meta-skill accepts workflow definitions from multiple sources:
296
+
297
+ | Source | Description | Example |
298
+ |--------|-------------|---------|
299
+ | **Existing commands** | Convert `.claude/commands/` orchestrator + sub-commands | `plan.md` + `session/start.md` + `tools/*.md` |
300
+ | **Text description** | User describes workflow in natural language | "Create a 3-phase code review workflow" |
301
+ | **Requirements doc** | Structured requirements file | `requirements.md` with phases/agents/outputs |
302
+ | **Existing skill** | Refactor/redesign an existing skill | Restructure a flat skill into phases |
303
+
304
+ ## Frontmatter Conversion Rules
305
+
306
+ When converting from command format to skill format:
307
+
308
+ | Command Field | Skill Field | Transformation |
309
+ |---------------|-------------|----------------|
310
+ | `name` | `name` | Prefix with group: `plan` → `workflow-plan` |
311
+ | `description` | `description` | Append trigger phrase: `Triggers on "xxx"` |
312
+ | `argument-hint` | _(removed)_ | Arguments handled in Input Processing section |
313
+ | `examples` | _(removed)_ | Examples moved to inline documentation |
314
+ | `allowed-tools` | `allowed-tools` | Expand wildcards: `Skill(*)` → `Skill`, add commonly needed tools |
315
+ | `group` | _(removed)_ | Embedded in `name` prefix |
316
+
317
+ ## Orchestrator Content Mapping
318
+
319
+ What goes into SKILL.md vs what goes into phase files:
320
+
321
+ ### SKILL.md (Coordinator)
322
+
323
+ | Section | Content | Source |
324
+ |---------|---------|--------|
325
+ | Frontmatter | name, description, allowed-tools | Command frontmatter (converted) |
326
+ | Architecture Overview | ASCII diagram of phase flow | Derived from execution structure |
327
+ | Key Design Principles | Coordination rules | Extracted from command coordinator role |
328
+ | Execution Flow | Phase sequence with `Ref:` markers + Phase Reference table | Command execution process |
329
+ | Core Rules | Orchestration constraints | Command core rules |
330
+ | Input Processing | Structured format conversion | Command input processing |
331
+ | Data Flow | Inter-phase data passing | Command data flow |
332
+ | TodoWrite Pattern | Attachment/collapse lifecycle | Command TodoWrite sections |
333
+ | Post-Phase Updates | Planning notes / state updates between phases | Command inter-phase update code |
334
+ | Error Handling | Failure recovery | Command error handling |
335
+ | Coordinator Checklist | Pre/post phase actions | Command coordinator checklist |
336
+ | Related Commands | Prerequisites and follow-ups | Command related commands |
337
+
338
+ ### Phase Files (Execution Detail)
339
+
340
+ | Content | Rule |
341
+ |---------|------|
342
+ | Full agent prompts | Preserve verbatim from source command |
343
+ | Bash command blocks | Preserve verbatim |
344
+ | Code implementations | Preserve verbatim |
345
+ | Validation checklists | Preserve verbatim |
346
+ | Error handling details | Preserve verbatim |
347
+ | Input/Output spec | Add if not present in source |
348
+ | Phase header | Add `# Phase N: {Name}` |
349
+ | Objective section | Add `## Objective` with bullet points |
350
+ | Next Phase link | Add `## Next Phase` with link to next |
351
+
352
+ **Critical Rule**: Phase files must be **content-faithful** to their source. Do NOT summarize, abbreviate, or simplify. The phase file IS the execution instruction - every bash command, every agent prompt, every validation step must be preserved.
353
+
354
+ ## SKILL.md Template
355
+
356
+ ```markdown
357
+ ---
358
+ name: {skill-name}
359
+ description: {description}. Triggers on "{trigger1}", "{trigger2}".
360
+ allowed-tools: {tools}
361
+ ---
362
+
363
+ # {Title}
364
+
365
+ {One-paragraph description of what this skill does and what it produces.}
366
+
367
+ ## Architecture Overview
368
+
369
+ {ASCII diagram showing phases and data flow}
370
+
371
+ ## Key Design Principles
372
+
373
+ 1. **{Principle}**: {Description}
374
+ ...
375
+
376
+ ## Interactive Preference Collection
377
+
378
+ Collect workflow preferences via AskUserQuestion before dispatching to phases:
379
+ {AskUserQuestion code with preference derivation → workflowPreferences}
380
+
381
+ ## Auto Mode Defaults
382
+
383
+ When `workflowPreferences.autoYes === true`: {auto-mode behavior}.
384
+
385
+ ## Execution Flow
386
+
387
+ {Phase sequence with Ref: markers}
388
+
389
+ **Phase Reference Documents** (read on-demand when phase executes):
390
+
391
+ | Phase | Document | Purpose | Compact |
392
+ |-------|----------|---------|---------|
393
+ | 1 | [phases/01-xxx.md](phases/01-xxx.md) | ... | TodoWrite 驱动 |
394
+ | N | [phases/0N-xxx.md](phases/0N-xxx.md) | ... | TodoWrite 驱动 + 🔄 sentinel |
395
+ ...
396
+
397
+ **Compact Rules**:
398
+ 1. **TodoWrite `in_progress`** → 保留完整内容,禁止压缩
399
+ 2. **TodoWrite `completed`** → 可压缩为摘要
400
+ 3. **🔄 sentinel fallback** → 带此标记的 phase 包含 compact sentinel;若 compact 后仅存 sentinel 而无完整 Step 协议,必须立即 `Read()` 恢复
401
+
402
+ ## Core Rules
403
+
404
+ 1. {Rule}
405
+ ...
406
+
407
+ ## Input Processing
408
+
409
+ {How user input is converted to structured format}
410
+
411
+ ## Data Flow
412
+
413
+ {Inter-phase data passing diagram}
414
+
415
+ ## TodoWrite Pattern
416
+
417
+ {Attachment/collapse lifecycle description with examples}
418
+
419
+ ## Post-Phase Updates
420
+
421
+ {State updates between phases}
422
+
423
+ ## Error Handling
424
+
425
+ {Failure recovery rules}
426
+
427
+ ## Coordinator Checklist
428
+
429
+ {Pre/post phase action list}
430
+
431
+ ## Related Commands
432
+
433
+ {Prerequisites and follow-ups}
434
+ ```
435
+
436
+ ## Phase File Template
437
+
438
+ ```markdown
439
+ # Phase N: {Phase Name}
440
+
441
+ > **📌 COMPACT SENTINEL [Phase N: {phase-name}]**
442
+ > This phase contains {M} execution steps (Step N.1 — N.{M}).
443
+ > If you can read this sentinel but cannot find the full Step protocol below, context has been compressed.
444
+ > Recovery: `Read("phases/0N-xxx.md")`
445
+ > _(Include for phases marked 🔄 in SKILL.md Phase Reference table — see Pattern 9)_
446
+
447
+ {One-sentence description of this phase's goal.}
448
+
449
+ ## Objective
450
+
451
+ - {Goal 1}
452
+ - {Goal 2}
453
+
454
+ ## Execution
455
+
456
+ ### Step N.1: {Step Name}
457
+
458
+ {Full execution detail: commands, agent prompts, code}
459
+
460
+ ### Step N.2: {Step Name}
461
+
462
+ > **⚠️ CHECKPOINT**: Before proceeding, verify:
463
+ > 1. This phase is TodoWrite `in_progress` (active phase protection)
464
+ > 2. Full protocol (Step N.X — N.{M}) is in active memory, not just sentinel
465
+ > If only sentinel remains → `Read("phases/0N-xxx.md")` now.
466
+ > _(Add checkpoints before critical execution steps: agent dispatch, CLI launch, review — see Pattern 9)_
467
+
468
+ {Full execution detail}
469
+
470
+ ## Output
471
+
472
+ - **Variable**: `{variableName}` (e.g., `sessionId`)
473
+ - **File**: `{output file path}`
474
+ - **TodoWrite**: Mark Phase N completed, Phase N+1 in_progress
475
+
476
+ ## Next Phase
477
+
478
+ Return to orchestrator, then auto-continue to [Phase N+1: xxx](0N+1-xxx.md).
479
+ ```
480
+
481
+ ## Design Decision Framework
482
+
483
+ When designing a new workflow skill, answer these questions:
484
+
485
+ | Question | Impact | Example |
486
+ |----------|--------|---------|
487
+ | How many phases? | Directory structure | 3-7 phases typical |
488
+ | Which phases are conditional? | Orchestrator logic | "Phase 3 only if conflict_risk >= medium" |
489
+ | What data flows between phases? | Data Flow section | sessionId, contextPath, configFlags |
490
+ | Which phases use agents? | Phase file complexity | Agent prompts need verbatim preservation |
491
+ | What's the TodoWrite granularity? | TodoWrite Pattern | Some phases have sub-tasks, others are atomic |
492
+ | Is there a planning notes pattern? | Post-Phase Updates | Accumulated state document across phases |
493
+ | What's the error recovery? | Error Handling | Retry once then report, vs rollback |
494
+ | Does it need preference collection? | Interactive Preference Collection | Collect via AskUserQuestion in SKILL.md, pass as workflowPreferences |
495
+ | Does phase N hand off to phase M? | Direct Phase Handoff (Pattern 7) | Read phase doc directly, not Skill() routing |
496
+ | Will later phases run after long context? | Compact Recovery (Pattern 9) | Add sentinel + checkpoints, mark 🔄 in Phase Reference table |