maestro-flow 0.4.13 → 0.4.14

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.
@@ -14,7 +14,7 @@ allowed-tools:
14
14
  <!-- Open-standard mirror generated by scripts/build-agents-standard.mjs — do not edit; re-run after editing .claude/ source. -->
15
15
 
16
16
  <purpose>
17
- Unified brainstorming combining interactive framework generation, multi-role parallel analysis, cross-role review, and resolution writeback. Two modes: Auto (full pipeline: guidance-specification → parallel {role}/ multi-file analysis → cross-role-reviewer compares Decision Digests for conflicts/gaps/synergies → user-confirmed resolutions patched into role files + logged in guidance §12) and Single Role (individual role analysis for an existing session). Outputs structured artifacts in `.workflow/scratch/brainstorm-{slug}-{date}/` ready for downstream planning (roadmap / analyze / blueprint consume `guidance-specification.md`).
17
+ Unified brainstorming combining interactive framework generation, multi-role parallel analysis, cross-role review, and resolution writeback. Two modes: Auto (full pipeline: guidance-specification → parallel {role}/ multi-file analysis → cross-role-reviewer compares Decision Digests for conflicts/gaps/synergies → user-confirmed resolutions patched into role files + logged in guidance §12) and Single Role (individual role analysis for an existing session). Outputs structured artifacts in `.workflow/scratch/{YYYYMMDD}-brainstorm-{slug}/` ready for downstream planning (roadmap / analyze / blueprint consume `guidance-specification.md`).
18
18
  </purpose>
19
19
 
20
20
  <required_reading>
@@ -32,7 +32,7 @@ $ARGUMENTS -- topic text for auto mode, or role name for single role mode.
32
32
 
33
33
  **Auto mode**: topic text (e.g., "Build real-time collaboration platform") triggers full pipeline.
34
34
  **Single role mode**: valid role name (e.g., "system-architect") runs one role analysis.
35
- **All output** goes to `.workflow/scratch/brainstorm-{slug}-{YYYYMMDD}/` (orchestrator MUST resolve this to an absolute path before passing to sub-agents).
35
+ **All output** goes to `.workflow/scratch/{YYYYMMDD}-brainstorm-{slug}/` (orchestrator MUST resolve this to an absolute path before passing to sub-agents).
36
36
  **Artifact registration**: On completion, registers artifact (type=brainstorm) in state.json.
37
37
  **Output boundary**: ALL file writes MUST target `{output_dir}/` or `.workflow/state.json` only. NEVER modify source code or files outside these paths.
38
38
  **Produced files**: `guidance-specification.md`, `design-research.md` (optional), `{role}/analysis.md` + `{role}/analysis-F-*.md` + `{role}/findings-*.md` (per selected role).
@@ -19,10 +19,12 @@ Closed-loop decision engine for the maestro workflow lifecycle.
19
19
  Reads project state → infers position → builds adaptive chain → delegates execution.
20
20
 
21
21
  Entry points:
22
- - **`/maestro-ralph "intent"`** — New session: infer → decompose → build → execute
23
- - **`/maestro-ralph continue`** — Resume via maestro-ralph-execute
22
+ - **`/maestro-ralph "intent"`** — New session: infer → decompose → build → (decomposition → emit /goal prompt, STOP;否则 dispatch ralph-execute)
23
+ - **`/maestro-ralph continue`** — Wrapper; dispatches to ralph-execute(首选直接 `/maestro-ralph-execute` 推进 step)
24
24
  - **`/maestro-ralph status`** — Display session progress
25
25
 
26
+ > 推进规则:**step 推进由 `/maestro-ralph-execute` 负责**;ralph 仅在 build / decision 评估时介入。decision 节点由 ralph-execute 自动 `invoke_skill("maestro-ralph")` handoff,无需用户手动切换。
27
+
26
28
  Initial decomposition (S_DECOMPOSE): boundary-clarified via ≤3 questions for broad intents (重构/全面/迁移/重写). 写入 status.json 的 `boundary_contract` / `execution_criteria` / `task_decomposition`,附 `/goal` prompt。
27
29
 
28
30
  Node types:
@@ -70,15 +72,16 @@ Remaining → intent
70
72
 
71
73
  <invariants>
72
74
  1. **Ralph never executes steps** — only creates sessions and evaluates decisions
73
- 2. **Handoff via invoke_skill("maestro-ralph-execute")** — at session creation and after decision evaluation
75
+ 2. **Handoff via invoke_skill("maestro-ralph-execute")** — 仅当 session `task_decomposition` 时在创建后自动 handoff;decomposition 路径 STOP 等用户输入。decision 评估后始终 handoff
74
76
  3. **Decision delegates read-only** — `maestro delegate --role analyze --mode analysis`
75
77
  4. **Default type = internal** — `external` 仅显式标注时出现,build 不默认生成
76
78
  5. **status.json 是唯一真源** — 不生成 markdown 清单或侧文件
77
79
  6. **每个 step 必须 `completion_confirmed: true`** — 基于 `--- COMPLETION STATUS ---` 的 `STATUS: DONE`;缺失则视为未完成
78
80
  7. **command_path 在 A_BUILD_STEPS 解析** — 全局优先 `~/.claude/commands/{name}.md`,fallback 项目 `.claude/commands/{name}.md`,写入 status.json
79
- 8. **Decomposition is outcome-oriented**sub-goals 为可观测交付,禁止 lifecycle 复刻;`/goal` 用户绑定,ralph 只发提示词
80
- 9. **planning_mode governs arg granularity** — `unified` skill args 无 `{phase}`;`independent` `{phase}`
81
- 10. **task_decomposition 驱动 steps[] 动态生长** — `post-goal-audit` unmet 子目标插入 scoped mini-loop;字段可选/累加,既有字段不删不改
81
+ 8. **Internal step 加载契约**ralph-execute `command_path` 后,必须解析并加载该命令 `<required_reading>` 引用的所有文件("入口 + workflow"形式的核心),并把 `<deferred_reading>` 路径记录到 `step.deferred_reads`;加载完成后输出 `✓ skill {name} 加载完成`。ralph 在 build 阶段只解析路径,不读 .md 内容
82
+ 9. **Decomposition is outcome-oriented** — sub-goals 为可观测交付,禁止 lifecycle 复刻;`/goal` 用户绑定,ralph 只发提示词后 STOP,等用户输入
83
+ 10. **planning_mode governs arg granularity** — `unified` skill args `{phase}`;`independent` → 含 `{phase}`
84
+ 11. **task_decomposition 驱动 steps[] 动态生长** — `post-goal-audit` 按 unmet 子目标插入 scoped mini-loop;字段可选/累加,既有字段不删不改
82
85
  </invariants>
83
86
 
84
87
  <state_machine>
@@ -148,8 +151,9 @@ S_BUILD_CHAIN:
148
151
  → S_CREATE_SESSION DO: A_BUILD_STEPS
149
152
 
150
153
  S_CREATE_SESSION:
151
- S_CONFIRM WHEN: not auto_confirm DO: A_CREATE_SESSION
152
- S_DISPATCH WHEN: auto_confirm DO: A_CREATE_SESSION
154
+ END WHEN: task_decomposition present DO: A_CREATE_SESSION (emits Goal Prompt → STOP,等用户输入 /goal 后手动 /maestro-ralph-execute)
155
+ S_CONFIRM WHEN: not auto_confirm AND no decomposition DO: A_CREATE_SESSION
156
+ → S_DISPATCH WHEN: auto_confirm AND no decomposition DO: A_CREATE_SESSION
153
157
 
154
158
  S_CONFIRM:
155
159
  → S_DISPATCH WHEN: user selects "Proceed"
@@ -413,7 +417,8 @@ Generate steps from `session.lifecycle_position` to `milestone-complete`.
413
417
  - 全局优先:`~/.claude/commands/{name}.md` 存在 → `command_scope = "global"`
414
418
  - Fallback:`.claude/commands/{name}.md` 存在 → `command_scope = "project"`
415
419
  - 两者都缺 → `command_scope = "missing"`, `command_path = null`,A_CREATE_SESSION 报错 E006
416
- 10. **每个 step 初始化** `completion_confirmed: false`, `completion_status: null`, `completion_evidence: null`
420
+ - **不在 build 阶段读取 .md 内容**;`<required_reading>` / `<deferred_reading>` 解析与加载由 ralph-execute A_EXEC_INTERNAL 负责(保持入口/工作流分离)
421
+ 10. **每个 step 初始化** `completion_confirmed: false`, `completion_status: null`, `completion_evidence: null`, `deferred_reads: []`
417
422
  11. **scope_verdict gating**(仅当 chain 起点 = `analyze-macro`):
418
423
  - `scope_verdict ∈ {medium, small}` → 跳过 `roadmap` + `analyze` 两 stage;`plan` 选 standalone 列(`--from analyze:{analyze_macro_id}`),不带 `{phase}`
419
424
  - `scope_verdict == large` → 保留 `roadmap` + `analyze`;`plan` 选 phase 列(`{phase}`)
@@ -431,7 +436,7 @@ Generate steps from `session.lifecycle_position` to `milestone-complete`.
431
436
  1. Validate: 所有 step 的 `command_scope != "missing"`;否则 raise E006 + 列出缺失 skill
432
437
  2. Write `.workflow/.maestro/ralph-{YYYYMMDD-HHmmss}/status.json` (Appendix: Session Schema)
433
438
  3. Display chain overview:每步显示 `{index}. {skill} [{type}] [{command_scope}]`
434
- 4. If `task_decomposition` present: display the **Goal Prompt block** (Appendix: Goal Prompt Template)
439
+ 4. If `task_decomposition` present: display **Goal Prompt block** (Appendix) STOP,等用户输入 `/goal`(auto_confirm 也不跳过)
435
440
 
436
441
  ### A_DELEGATE_EVALUATE
437
442
 
@@ -620,7 +625,8 @@ Runs only when `task_decomposition` present.
620
625
  "completion_confirmed": false,
621
626
  "completion_status": null,
622
627
  "completion_evidence": null,
623
- "completed_at": null
628
+ "completed_at": null,
629
+ "deferred_reads": [] // 由 ralph-execute A_EXEC_INTERNAL 解析 .md 时填充
624
630
  }],
625
631
  "waves": [], "current_step": 0,
626
632
 
@@ -704,11 +710,9 @@ decision:post-goal-audit {retry+1}
704
710
  链路概览后逐字显示(仅当 decomposition 已产出):
705
711
 
706
712
  ```
707
- 📋 任务分解完成。复制下面一行设定目标,会话在子目标全部达成前不停:
708
-
709
- /goal 目标达成条件: {session_dir}/status.json 中 task_decomposition[*].status == "done" 且 task_decomposition[*].completion_confirmed == true 且 steps[*].completion_confirmed == true。未达成时:阅读 {session_dir}/status.json 取得 execution_criteria / boundary_contract / task_decomposition / steps 作为行动手册,调用 /maestro-ralph continue 推进;严禁手动执行 skill 或越界修改 status.json.boundary_contract.out_of_scope。
713
+ 📋 任务分解完成。复制以下 /goal 设定终止条件,随后运行 /maestro-ralph-execute:
710
714
 
711
- 随后运行 /maestro-ralph continue 立即开始执行。
715
+ /goal 直到 {session_dir}/status.json 的 task_decomposition[*] 与 steps[*] 全部 completion_confirmed=true 才停。每轮以 status.json 为唯一行动手册,通过 /maestro-ralph-execute 推进 step;decision 节点由其自动 handoff 回 ralph 评估。禁止手动执行 skill 或修改 boundary_contract.out_of_scope。
712
716
  ```
713
717
 
714
718
  `/goal` 由用户输入;ralph 只输出此提示词。判据以 status.json 为权威。
@@ -744,7 +748,8 @@ decision:post-goal-audit {retry+1}
744
748
  - [ ] Decomposition: broad intent ≤3 question clarify;narrow auto-derive
745
749
  - [ ] status.json 唯一真源:boundary_contract + execution_criteria + task_decomposition;无外部清单
746
750
  - [ ] 每个 step 默认 `type: "internal"`,含 `command_scope` + `command_path`(全局优先 fallback 项目)
747
- - [ ] 每个 step `completion_confirmed` + `completion_status` + `completion_evidence`(初始 false/null)
751
+ - [ ] Ralph build 阶段只解析路径,不读 .md 内容;`<required_reading>` 加载由 ralph-execute A_EXEC_INTERNAL 完成
752
+ - [ ] 每个 step 含 `completion_confirmed` + `completion_status` + `completion_evidence` + `deferred_reads`(初始 false/null/[])
748
753
  - [ ] 每个 sub-goal 含 `completion_confirmed`(初始 false)
749
754
  - [ ] post-goal-audit decision 仅在 decomposed 时插入,位于 milestone-complete 之前
750
755
  - [ ] Unmet sub-goals 动态 grow steps[](goal_ref tagged);max retries → escalate
@@ -41,6 +41,7 @@ Also read `session.auto_mode` from status.json — if true, treat as `-y`.
41
41
 
42
42
  HARD RULES:
43
43
  - internal step:优先通过 `read_file({command_path})` 把命令 .md 加载进当前会话,再按内容执行;不要对 internal step 使用 `invoke_skill({skill})` 调用
44
+ - **必须遵循 `<required_reading>` / `<deferred_reading>` 标签**:命令 .md 通常采用"入口 + workflow"形式,主体逻辑放在 workflow 文件中并通过 `<required_reading>` 引用;不加载 required_reading 会导致命令执行不完整
44
45
  - decision 节点例外:A_EXEC_DECISION 必须使用 `invoke_skill({ skill: "maestro-ralph" })` 进行 handoff(这是 decision 节点的唯一允许用法)
45
46
  - `command_path` 由 ralph 在 A_BUILD_STEPS 写入 status.json;ralph-execute 不再自行解析(缺失 → 报错 E002)
46
47
  - external 仅在 `step.type == "external"` 显式声明时使用,并 always append `-y` 到 prompt args
@@ -49,10 +50,13 @@ HARD RULES:
49
50
 
50
51
  <invariants>
51
52
  1. **Internal = Read + inline** — 通过 Read 读取 `step.command_path`,按其指令在当前 session 内执行
52
- 2. **External = explicit only** — `step.type == "external"` 才走 delegate;默认绝不发起
53
- 3. **必须显式 completion confirmation** — 每个 step 完成时需有 `STATUS: DONE` 且写入 `step.completion_confirmed = true`
54
- 4. **Self-invocation chain** — 持续直到全部 `completion_confirmed` paused
55
- 5. **status.json 每步骤后写盘**resume-safe
53
+ 2. **Required reading must be loaded** — 命令 .md 中的 `<required_reading>` 引用的所有文件必须立即 Read;缺一 → 视为加载失败,pause session(E007)
54
+ 3. **Deferred reading recorded only** — `<deferred_reading>` 列出的文件路径需记录,执行过程按需 Read;不在加载阶段读取
55
+ 4. **Skill loaded confirmation** — 所有 required_reading 加载完成后必须输出一行确认:`✓ skill {step.skill} 加载完成 (required: N, deferred: M)`
56
+ 5. **External = explicit only** `step.type == "external"` 才走 delegate;默认绝不发起
57
+ 6. **必须显式 completion confirmation** — 每个 step 完成时需有 `STATUS: DONE` 且写入 `step.completion_confirmed = true`
58
+ 7. **Self-invocation chain** — 持续直到全部 `completion_confirmed` 或 paused
59
+ 8. **status.json 每步骤后写盘** — resume-safe
56
60
  </invariants>
57
61
 
58
62
  <state_machine>
@@ -161,11 +165,20 @@ Write enriched args back to status.json.
161
165
  2. Mark step running, write status.json
162
166
  3. Display: `[{index}/{total}] {step.skill} [internal · {step.command_scope}]`
163
167
  4. `read_file({ file_path: step.command_path })` — 把命令 .md 全文加载进当前会话(prefer Read over Skill for internal steps;decision 节点另行使用 Skill 见 A_EXEC_DECISION)
164
- 5. 解析 frontmatter `argument-hint` `<purpose>/<state_machine>/<actions>` 等指令块
165
- 6. 计算 `effective_args`:`step.args` + auto flag(`auto ? (flag_map[step.skill] || "") : ""`)
166
- 7. 按读到的指令在本会话中**内联执行**:调用允许的工具完成命令所规定的工作,不再发起 delegate
167
- 8. 执行结束:要求最后一段必须包含 `--- COMPLETION STATUS ---` 块(见 A_MARK_COMPLETE)
168
- 9. Return success / failure
168
+ 5. **解析 reading 标签**("入口 + workflow"形式核心步骤):
169
+ - 抽取 frontmatter `argument-hint` / `allowed-tools`
170
+ - 抽取 `<required_reading>` 块的所有 `@path` 引用 → 立刻 `read_file({ file_path: <expanded path> })` 加载(`~/` / `@~/` 展开为用户主目录);任一文件缺失或读取失败 → raise E007,pause session
171
+ - 抽取 `<deferred_reading>` 块的所有路径 仅记录到 `step.deferred_reads = [...]`,执行阶段按需 Read
172
+ - 抽取 `<purpose>/<context>/<state_machine>/<execution>/<actions>` 等指令块
173
+ 6. **加载完成确认**:required_reading 全部成功 Read 后,输出一行:
174
+ ```
175
+ ✓ skill {step.skill} 加载完成 (required: {N}, deferred: {M})
176
+ ```
177
+ 其中 N = required_reading 引用数,M = deferred_reading 路径数(缺省块按 0 计)
178
+ 7. 计算 `effective_args`:`step.args` + auto flag(`auto ? (flag_map[step.skill] || "") : ""`)
179
+ 8. 按读到的指令在本会话中**内联执行**:调用允许的工具完成命令所规定的工作,不再发起 delegate;执行过程中如触发 deferred_reading 引用的资源 → 按需 Read
180
+ 9. 执行结束:要求最后一段必须包含 `--- COMPLETION STATUS ---` 块(见 A_MARK_COMPLETE)
181
+ 10. Return success / failure
169
182
 
170
183
  **Auto flag map**: 所有 lifecycle skill → `-y`; `quality-test` → `-y --auto-fix`; 未列出 → 无 flag
171
184
 
@@ -253,7 +266,9 @@ Write enriched args back to status.json.
253
266
  | E003 | error | status.json corrupt | Show path, manual check |
254
267
  | E004 | error | Delegate failed + user abort | Mark paused, suggest resume |
255
268
  | E005 | error | COMPLETION STATUS block missing | Trigger NEEDS_RETRY |
269
+ | E007 | error | required_reading file 缺失或读取失败 | List missing paths, pause session |
256
270
  | W001 | warning | Step completed with concerns | Log and continue |
271
+ | W002 | warning | command .md 无 `<required_reading>` 标签 | 直接执行 .md 主体,跳过加载阶段 |
257
272
 
258
273
  ### Success Criteria
259
274
 
@@ -262,6 +277,9 @@ Write enriched args back to status.json.
262
277
  - [ ] Placeholders resolved;per-skill enrichment 正确
263
278
  - [ ] Decision 节点 invoke_skill("maestro-ralph") handoff
264
279
  - [ ] Internal 节点通过 read_file({step.command_path}) 内联执行,禁止 invoke_skill()
280
+ - [ ] Internal 节点 Read 后必须解析并加载 `<required_reading>` 引用的文件;缺失 → E007 pause
281
+ - [ ] `<deferred_reading>` 仅记录路径到 `step.deferred_reads`,执行阶段按需 Read
282
+ - [ ] required_reading 加载完成后输出 `✓ skill {name} 加载完成 (required: N, deferred: M)`
265
283
  - [ ] External 仅在显式声明时走 delegate,prompt 必带 `-y`
266
284
  - [ ] 每个 step 强制 `--- COMPLETION STATUS ---`;缺失 → NEEDS_RETRY
267
285
  - [ ] step.completion_confirmed = true 仅在 STATUS: DONE/DONE_WITH_CONCERNS 时设置
@@ -21,7 +21,7 @@ Verify execution results through three complementary methods:
21
21
  3. **Nyquist test coverage validation** — requirement-to-test mapping with gap classification
22
22
 
23
23
  Supports dual-level verification:
24
- - **Single plan**: `verify --dir scratch/plan-xxx` — verifies one plan, writes `verification.json` into plan dir
24
+ - **Single plan**: `verify --dir scratch/{YYYYMMDD}-plan-xxx` — verifies one plan, writes `verification.json` into plan dir
25
25
  - **Milestone**: `verify` (no args) — aggregates all execute artifacts for current milestone into `scratch/{YYYYMMDD}-verify-M{N}-{slug}/milestone-verification.json`
26
26
 
27
27
  Registers VRF artifact in state.json on completion.
@@ -14,7 +14,7 @@ allowed-tools:
14
14
  - write_to_file
15
15
  ---
16
16
  <purpose>
17
- Unified brainstorming combining interactive framework generation, multi-role parallel analysis, cross-role review, and resolution writeback. Two modes: Auto (full pipeline: guidance-specification → parallel {role}/ multi-file analysis → cross-role-reviewer compares Decision Digests for conflicts/gaps/synergies → user-confirmed resolutions patched into role files + logged in guidance §12) and Single Role (individual role analysis for an existing session). Outputs structured artifacts in `.workflow/scratch/brainstorm-{slug}-{date}/` ready for downstream planning (roadmap / analyze / blueprint consume `guidance-specification.md`).
17
+ Unified brainstorming combining interactive framework generation, multi-role parallel analysis, cross-role review, and resolution writeback. Two modes: Auto (full pipeline: guidance-specification → parallel {role}/ multi-file analysis → cross-role-reviewer compares Decision Digests for conflicts/gaps/synergies → user-confirmed resolutions patched into role files + logged in guidance §12) and Single Role (individual role analysis for an existing session). Outputs structured artifacts in `.workflow/scratch/{YYYYMMDD}-brainstorm-{slug}/` ready for downstream planning (roadmap / analyze / blueprint consume `guidance-specification.md`).
18
18
  </purpose>
19
19
 
20
20
  <required_reading>
@@ -32,7 +32,7 @@ $ARGUMENTS -- topic text for auto mode, or role name for single role mode.
32
32
 
33
33
  **Auto mode**: topic text (e.g., "Build real-time collaboration platform") triggers full pipeline.
34
34
  **Single role mode**: valid role name (e.g., "system-architect") runs one role analysis.
35
- **All output** goes to `.workflow/scratch/brainstorm-{slug}-{YYYYMMDD}/` (orchestrator MUST resolve this to an absolute path before passing to sub-agents).
35
+ **All output** goes to `.workflow/scratch/{YYYYMMDD}-brainstorm-{slug}/` (orchestrator MUST resolve this to an absolute path before passing to sub-agents).
36
36
  **Artifact registration**: On completion, registers artifact (type=brainstorm) in state.json.
37
37
  **Output boundary**: ALL file writes MUST target `{output_dir}/` or `.workflow/state.json` only. NEVER modify source code or files outside these paths.
38
38
  **Produced files**: `guidance-specification.md`, `design-research.md` (optional), `{role}/analysis.md` + `{role}/analysis-F-*.md` + `{role}/findings-*.md` (per selected role).
@@ -15,10 +15,12 @@ Closed-loop decision engine for the maestro workflow lifecycle.
15
15
  Reads project state → infers position → builds adaptive chain → delegates execution.
16
16
 
17
17
  Entry points:
18
- - **`/maestro-ralph "intent"`** — New session: infer → decompose → build → execute
19
- - **`/maestro-ralph continue`** — Resume via maestro-ralph-execute
18
+ - **`/maestro-ralph "intent"`** — New session: infer → decompose → build → (decomposition → emit /goal prompt, STOP;否则 dispatch ralph-execute)
19
+ - **`/maestro-ralph continue`** — Wrapper; dispatches to ralph-execute(首选直接 `/maestro-ralph-execute` 推进 step)
20
20
  - **`/maestro-ralph status`** — Display session progress
21
21
 
22
+ > 推进规则:**step 推进由 `/maestro-ralph-execute` 负责**;ralph 仅在 build / decision 评估时介入。decision 节点由 ralph-execute 自动 `Skill("maestro-ralph")` handoff,无需用户手动切换。
23
+
22
24
  Initial decomposition (S_DECOMPOSE): boundary-clarified via ≤3 questions for broad intents (重构/全面/迁移/重写). 写入 status.json 的 `boundary_contract` / `execution_criteria` / `task_decomposition`,附 `/goal` prompt。
23
25
 
24
26
  Node types:
@@ -66,15 +68,16 @@ Remaining → intent
66
68
 
67
69
  <invariants>
68
70
  1. **Ralph never executes steps** — only creates sessions and evaluates decisions
69
- 2. **Handoff via Skill("maestro-ralph-execute")** — at session creation and after decision evaluation
71
+ 2. **Handoff via Skill("maestro-ralph-execute")** — 仅当 session `task_decomposition` 时在创建后自动 handoff;decomposition 路径 STOP 等用户输入。decision 评估后始终 handoff
70
72
  3. **Decision delegates read-only** — `maestro delegate --role analyze --mode analysis`
71
73
  4. **Default type = internal** — `external` 仅显式标注时出现,build 不默认生成
72
74
  5. **status.json 是唯一真源** — 不生成 markdown 清单或侧文件
73
75
  6. **每个 step 必须 `completion_confirmed: true`** — 基于 `--- COMPLETION STATUS ---` 的 `STATUS: DONE`;缺失则视为未完成
74
76
  7. **command_path 在 A_BUILD_STEPS 解析** — 全局优先 `~/.claude/commands/{name}.md`,fallback 项目 `.claude/commands/{name}.md`,写入 status.json
75
- 8. **Decomposition is outcome-oriented**sub-goals 为可观测交付,禁止 lifecycle 复刻;`/goal` 用户绑定,ralph 只发提示词
76
- 9. **planning_mode governs arg granularity** — `unified` skill args 无 `{phase}`;`independent` `{phase}`
77
- 10. **task_decomposition 驱动 steps[] 动态生长** — `post-goal-audit` unmet 子目标插入 scoped mini-loop;字段可选/累加,既有字段不删不改
77
+ 8. **Internal step 加载契约**ralph-execute `command_path` 后,必须解析并加载该命令 `<required_reading>` 引用的所有文件("入口 + workflow"形式的核心),并把 `<deferred_reading>` 路径记录到 `step.deferred_reads`;加载完成后输出 `✓ skill {name} 加载完成`。ralph 在 build 阶段只解析路径,不读 .md 内容
78
+ 9. **Decomposition is outcome-oriented** — sub-goals 为可观测交付,禁止 lifecycle 复刻;`/goal` 用户绑定,ralph 只发提示词后 STOP,等用户输入
79
+ 10. **planning_mode governs arg granularity** — `unified` skill args `{phase}`;`independent` → 含 `{phase}`
80
+ 11. **task_decomposition 驱动 steps[] 动态生长** — `post-goal-audit` 按 unmet 子目标插入 scoped mini-loop;字段可选/累加,既有字段不删不改
78
81
  </invariants>
79
82
 
80
83
  <state_machine>
@@ -144,8 +147,9 @@ S_BUILD_CHAIN:
144
147
  → S_CREATE_SESSION DO: A_BUILD_STEPS
145
148
 
146
149
  S_CREATE_SESSION:
147
- S_CONFIRM WHEN: not auto_confirm DO: A_CREATE_SESSION
148
- S_DISPATCH WHEN: auto_confirm DO: A_CREATE_SESSION
150
+ END WHEN: task_decomposition present DO: A_CREATE_SESSION (emits Goal Prompt → STOP,等用户输入 /goal 后手动 /maestro-ralph-execute)
151
+ S_CONFIRM WHEN: not auto_confirm AND no decomposition DO: A_CREATE_SESSION
152
+ → S_DISPATCH WHEN: auto_confirm AND no decomposition DO: A_CREATE_SESSION
149
153
 
150
154
  S_CONFIRM:
151
155
  → S_DISPATCH WHEN: user selects "Proceed"
@@ -409,7 +413,8 @@ Generate steps from `session.lifecycle_position` to `milestone-complete`.
409
413
  - 全局优先:`~/.claude/commands/{name}.md` 存在 → `command_scope = "global"`
410
414
  - Fallback:`.claude/commands/{name}.md` 存在 → `command_scope = "project"`
411
415
  - 两者都缺 → `command_scope = "missing"`, `command_path = null`,A_CREATE_SESSION 报错 E006
412
- 10. **每个 step 初始化** `completion_confirmed: false`, `completion_status: null`, `completion_evidence: null`
416
+ - **不在 build 阶段读取 .md 内容**;`<required_reading>` / `<deferred_reading>` 解析与加载由 ralph-execute A_EXEC_INTERNAL 负责(保持入口/工作流分离)
417
+ 10. **每个 step 初始化** `completion_confirmed: false`, `completion_status: null`, `completion_evidence: null`, `deferred_reads: []`
413
418
  11. **scope_verdict gating**(仅当 chain 起点 = `analyze-macro`):
414
419
  - `scope_verdict ∈ {medium, small}` → 跳过 `roadmap` + `analyze` 两 stage;`plan` 选 standalone 列(`--from analyze:{analyze_macro_id}`),不带 `{phase}`
415
420
  - `scope_verdict == large` → 保留 `roadmap` + `analyze`;`plan` 选 phase 列(`{phase}`)
@@ -427,7 +432,7 @@ Generate steps from `session.lifecycle_position` to `milestone-complete`.
427
432
  1. Validate: 所有 step 的 `command_scope != "missing"`;否则 raise E006 + 列出缺失 skill
428
433
  2. Write `.workflow/.maestro/ralph-{YYYYMMDD-HHmmss}/status.json` (Appendix: Session Schema)
429
434
  3. Display chain overview:每步显示 `{index}. {skill} [{type}] [{command_scope}]`
430
- 4. If `task_decomposition` present: display the **Goal Prompt block** (Appendix: Goal Prompt Template)
435
+ 4. If `task_decomposition` present: display **Goal Prompt block** (Appendix) STOP,等用户输入 `/goal`(auto_confirm 也不跳过)
431
436
 
432
437
  ### A_DELEGATE_EVALUATE
433
438
 
@@ -616,7 +621,8 @@ Runs only when `task_decomposition` present.
616
621
  "completion_confirmed": false,
617
622
  "completion_status": null,
618
623
  "completion_evidence": null,
619
- "completed_at": null
624
+ "completed_at": null,
625
+ "deferred_reads": [] // 由 ralph-execute A_EXEC_INTERNAL 解析 .md 时填充
620
626
  }],
621
627
  "waves": [], "current_step": 0,
622
628
 
@@ -700,11 +706,9 @@ decision:post-goal-audit {retry+1}
700
706
  链路概览后逐字显示(仅当 decomposition 已产出):
701
707
 
702
708
  ```
703
- 📋 任务分解完成。复制下面一行设定目标,会话在子目标全部达成前不停:
704
-
705
- /goal 目标达成条件: {session_dir}/status.json 中 task_decomposition[*].status == "done" 且 task_decomposition[*].completion_confirmed == true 且 steps[*].completion_confirmed == true。未达成时:阅读 {session_dir}/status.json 取得 execution_criteria / boundary_contract / task_decomposition / steps 作为行动手册,调用 /maestro-ralph continue 推进;严禁手动执行 skill 或越界修改 status.json.boundary_contract.out_of_scope。
709
+ 📋 任务分解完成。复制以下 /goal 设定终止条件,随后运行 /maestro-ralph-execute:
706
710
 
707
- 随后运行 /maestro-ralph continue 立即开始执行。
711
+ /goal 直到 {session_dir}/status.json 的 task_decomposition[*] 与 steps[*] 全部 completion_confirmed=true 才停。每轮以 status.json 为唯一行动手册,通过 /maestro-ralph-execute 推进 step;decision 节点由其自动 handoff 回 ralph 评估。禁止手动执行 skill 或修改 boundary_contract.out_of_scope。
708
712
  ```
709
713
 
710
714
  `/goal` 由用户输入;ralph 只输出此提示词。判据以 status.json 为权威。
@@ -740,7 +744,8 @@ decision:post-goal-audit {retry+1}
740
744
  - [ ] Decomposition: broad intent ≤3 question clarify;narrow auto-derive
741
745
  - [ ] status.json 唯一真源:boundary_contract + execution_criteria + task_decomposition;无外部清单
742
746
  - [ ] 每个 step 默认 `type: "internal"`,含 `command_scope` + `command_path`(全局优先 fallback 项目)
743
- - [ ] 每个 step `completion_confirmed` + `completion_status` + `completion_evidence`(初始 false/null)
747
+ - [ ] Ralph build 阶段只解析路径,不读 .md 内容;`<required_reading>` 加载由 ralph-execute A_EXEC_INTERNAL 完成
748
+ - [ ] 每个 step 含 `completion_confirmed` + `completion_status` + `completion_evidence` + `deferred_reads`(初始 false/null/[])
744
749
  - [ ] 每个 sub-goal 含 `completion_confirmed`(初始 false)
745
750
  - [ ] post-goal-audit decision 仅在 decomposed 时插入,位于 milestone-complete 之前
746
751
  - [ ] Unmet sub-goals 动态 grow steps[](goal_ref tagged);max retries → escalate
@@ -37,6 +37,7 @@ Also read `session.auto_mode` from status.json — if true, treat as `-y`.
37
37
 
38
38
  HARD RULES:
39
39
  - internal step:优先通过 `view_file({command_path})` 把命令 .md 加载进当前会话,再按内容执行;不要对 internal step 使用 `Skill({skill})` 调用
40
+ - **必须遵循 `<required_reading>` / `<deferred_reading>` 标签**:命令 .md 通常采用"入口 + workflow"形式,主体逻辑放在 workflow 文件中并通过 `<required_reading>` 引用;不加载 required_reading 会导致命令执行不完整
40
41
  - decision 节点例外:A_EXEC_DECISION 必须使用 `view_file(AbsolutePath="<agy-skills-dir>/maestro-ralph/SKILL.md") + execute inline` 进行 handoff(这是 decision 节点的唯一允许用法)
41
42
  - `command_path` 由 ralph 在 A_BUILD_STEPS 写入 status.json;ralph-execute 不再自行解析(缺失 → 报错 E002)
42
43
  - external 仅在 `step.type == "external"` 显式声明时使用,并 always append `-y` 到 prompt args
@@ -45,10 +46,13 @@ HARD RULES:
45
46
 
46
47
  <invariants>
47
48
  1. **Internal = Read + inline** — 通过 Read 读取 `step.command_path`,按其指令在当前 session 内执行
48
- 2. **External = explicit only** — `step.type == "external"` 才走 delegate;默认绝不发起
49
- 3. **必须显式 completion confirmation** — 每个 step 完成时需有 `STATUS: DONE` 且写入 `step.completion_confirmed = true`
50
- 4. **Self-invocation chain** — 持续直到全部 `completion_confirmed` paused
51
- 5. **status.json 每步骤后写盘**resume-safe
49
+ 2. **Required reading must be loaded** — 命令 .md 中的 `<required_reading>` 引用的所有文件必须立即 Read;缺一 → 视为加载失败,pause session(E007)
50
+ 3. **Deferred reading recorded only** — `<deferred_reading>` 列出的文件路径需记录,执行过程按需 Read;不在加载阶段读取
51
+ 4. **Skill loaded confirmation** — 所有 required_reading 加载完成后必须输出一行确认:`✓ skill {step.skill} 加载完成 (required: N, deferred: M)`
52
+ 5. **External = explicit only** `step.type == "external"` 才走 delegate;默认绝不发起
53
+ 6. **必须显式 completion confirmation** — 每个 step 完成时需有 `STATUS: DONE` 且写入 `step.completion_confirmed = true`
54
+ 7. **Self-invocation chain** — 持续直到全部 `completion_confirmed` 或 paused
55
+ 8. **status.json 每步骤后写盘** — resume-safe
52
56
  </invariants>
53
57
 
54
58
  <state_machine>
@@ -157,11 +161,20 @@ Write enriched args back to status.json.
157
161
  2. Mark step running, write status.json
158
162
  3. Display: `[{index}/{total}] {step.skill} [internal · {step.command_scope}]`
159
163
  4. `view_file({ file_path: step.command_path })` — 把命令 .md 全文加载进当前会话(prefer Read over Skill for internal steps;decision 节点另行使用 Skill 见 A_EXEC_DECISION)
160
- 5. 解析 frontmatter `argument-hint` `<purpose>/<state_machine>/<actions>` 等指令块
161
- 6. 计算 `effective_args`:`step.args` + auto flag(`auto ? (flag_map[step.skill] || "") : ""`)
162
- 7. 按读到的指令在本会话中**内联执行**:调用允许的工具完成命令所规定的工作,不再发起 delegate
163
- 8. 执行结束:要求最后一段必须包含 `--- COMPLETION STATUS ---` 块(见 A_MARK_COMPLETE)
164
- 9. Return success / failure
164
+ 5. **解析 reading 标签**("入口 + workflow"形式核心步骤):
165
+ - 抽取 frontmatter `argument-hint` / `allowed-tools`
166
+ - 抽取 `<required_reading>` 块的所有 `@path` 引用 → 立刻 `view_file({ file_path: <expanded path> })` 加载(`~/` / `@~/` 展开为用户主目录);任一文件缺失或读取失败 → raise E007,pause session
167
+ - 抽取 `<deferred_reading>` 块的所有路径 仅记录到 `step.deferred_reads = [...]`,执行阶段按需 Read
168
+ - 抽取 `<purpose>/<context>/<state_machine>/<execution>/<actions>` 等指令块
169
+ 6. **加载完成确认**:required_reading 全部成功 Read 后,输出一行:
170
+ ```
171
+ ✓ skill {step.skill} 加载完成 (required: {N}, deferred: {M})
172
+ ```
173
+ 其中 N = required_reading 引用数,M = deferred_reading 路径数(缺省块按 0 计)
174
+ 7. 计算 `effective_args`:`step.args` + auto flag(`auto ? (flag_map[step.skill] || "") : ""`)
175
+ 8. 按读到的指令在本会话中**内联执行**:调用允许的工具完成命令所规定的工作,不再发起 delegate;执行过程中如触发 deferred_reading 引用的资源 → 按需 Read
176
+ 9. 执行结束:要求最后一段必须包含 `--- COMPLETION STATUS ---` 块(见 A_MARK_COMPLETE)
177
+ 10. Return success / failure
165
178
 
166
179
  **Auto flag map**: 所有 lifecycle skill → `-y`; `quality-test` → `-y --auto-fix`; 未列出 → 无 flag
167
180
 
@@ -249,7 +262,9 @@ Write enriched args back to status.json.
249
262
  | E003 | error | status.json corrupt | Show path, manual check |
250
263
  | E004 | error | Delegate failed + user abort | Mark paused, suggest resume |
251
264
  | E005 | error | COMPLETION STATUS block missing | Trigger NEEDS_RETRY |
265
+ | E007 | error | required_reading file 缺失或读取失败 | List missing paths, pause session |
252
266
  | W001 | warning | Step completed with concerns | Log and continue |
267
+ | W002 | warning | command .md 无 `<required_reading>` 标签 | 直接执行 .md 主体,跳过加载阶段 |
253
268
 
254
269
  ### Success Criteria
255
270
 
@@ -258,6 +273,9 @@ Write enriched args back to status.json.
258
273
  - [ ] Placeholders resolved;per-skill enrichment 正确
259
274
  - [ ] Decision 节点 Skill("maestro-ralph") handoff
260
275
  - [ ] Internal 节点通过 view_file({step.command_path}) 内联执行,禁止 Skill()
276
+ - [ ] Internal 节点 Read 后必须解析并加载 `<required_reading>` 引用的文件;缺失 → E007 pause
277
+ - [ ] `<deferred_reading>` 仅记录路径到 `step.deferred_reads`,执行阶段按需 Read
278
+ - [ ] required_reading 加载完成后输出 `✓ skill {name} 加载完成 (required: N, deferred: M)`
261
279
  - [ ] External 仅在显式声明时走 delegate,prompt 必带 `-y`
262
280
  - [ ] 每个 step 强制 `--- COMPLETION STATUS ---`;缺失 → NEEDS_RETRY
263
281
  - [ ] step.completion_confirmed = true 仅在 STATUS: DONE/DONE_WITH_CONCERNS 时设置
@@ -21,7 +21,7 @@ Verify execution results through three complementary methods:
21
21
  3. **Nyquist test coverage validation** — requirement-to-test mapping with gap classification
22
22
 
23
23
  Supports dual-level verification:
24
- - **Single plan**: `verify --dir scratch/plan-xxx` — verifies one plan, writes `verification.json` into plan dir
24
+ - **Single plan**: `verify --dir scratch/{YYYYMMDD}-plan-xxx` — verifies one plan, writes `verification.json` into plan dir
25
25
  - **Milestone**: `verify` (no args) — aggregates all execute artifacts for current milestone into `scratch/{YYYYMMDD}-verify-M{N}-{slug}/milestone-verification.json`
26
26
 
27
27
  Registers VRF artifact in state.json on completion.
@@ -12,7 +12,7 @@ allowed-tools:
12
12
  - AskUserQuestion
13
13
  ---
14
14
  <purpose>
15
- Unified brainstorming combining interactive framework generation, multi-role parallel analysis, cross-role review, and resolution writeback. Two modes: Auto (full pipeline: guidance-specification → parallel {role}/ multi-file analysis → cross-role-reviewer compares Decision Digests for conflicts/gaps/synergies → user-confirmed resolutions patched into role files + logged in guidance §12) and Single Role (individual role analysis for an existing session). Outputs structured artifacts in `.workflow/scratch/brainstorm-{slug}-{date}/` ready for downstream planning (roadmap / analyze / blueprint consume `guidance-specification.md`).
15
+ Unified brainstorming combining interactive framework generation, multi-role parallel analysis, cross-role review, and resolution writeback. Two modes: Auto (full pipeline: guidance-specification → parallel {role}/ multi-file analysis → cross-role-reviewer compares Decision Digests for conflicts/gaps/synergies → user-confirmed resolutions patched into role files + logged in guidance §12) and Single Role (individual role analysis for an existing session). Outputs structured artifacts in `.workflow/scratch/{YYYYMMDD}-brainstorm-{slug}/` ready for downstream planning (roadmap / analyze / blueprint consume `guidance-specification.md`).
16
16
  </purpose>
17
17
 
18
18
  <required_reading>
@@ -30,7 +30,7 @@ $ARGUMENTS -- topic text for auto mode, or role name for single role mode.
30
30
 
31
31
  **Auto mode**: topic text (e.g., "Build real-time collaboration platform") triggers full pipeline.
32
32
  **Single role mode**: valid role name (e.g., "system-architect") runs one role analysis.
33
- **All output** goes to `.workflow/scratch/brainstorm-{slug}-{YYYYMMDD}/` (orchestrator MUST resolve this to an absolute path before passing to sub-agents).
33
+ **All output** goes to `.workflow/scratch/{YYYYMMDD}-brainstorm-{slug}/` (orchestrator MUST resolve this to an absolute path before passing to sub-agents).
34
34
  **Artifact registration**: On completion, registers artifact (type=brainstorm) in state.json.
35
35
  **Output boundary**: ALL file writes MUST target `{output_dir}/` or `.workflow/state.json` only. NEVER modify source code or files outside these paths.
36
36
  **Produced files**: `guidance-specification.md`, `design-research.md` (optional), `{role}/analysis.md` + `{role}/analysis-F-*.md` + `{role}/findings-*.md` (per selected role).
@@ -39,6 +39,7 @@ Also read `session.auto_mode` from status.json — if true, treat as `-y`.
39
39
 
40
40
  HARD RULES:
41
41
  - internal step:优先通过 `Read({command_path})` 把命令 .md 加载进当前会话,再按内容执行;不要对 internal step 使用 `Skill({skill})` 调用
42
+ - **必须遵循 `<required_reading>` / `<deferred_reading>` 标签**:命令 .md 通常采用"入口 + workflow"形式,主体逻辑放在 workflow 文件中并通过 `<required_reading>` 引用;不加载 required_reading 会导致命令执行不完整
42
43
  - decision 节点例外:A_EXEC_DECISION 必须使用 `Skill({ skill: "maestro-ralph" })` 进行 handoff(这是 decision 节点的唯一允许用法)
43
44
  - `command_path` 由 ralph 在 A_BUILD_STEPS 写入 status.json;ralph-execute 不再自行解析(缺失 → 报错 E002)
44
45
  - external 仅在 `step.type == "external"` 显式声明时使用,并 always append `-y` 到 prompt args
@@ -47,10 +48,13 @@ HARD RULES:
47
48
 
48
49
  <invariants>
49
50
  1. **Internal = Read + inline** — 通过 Read 读取 `step.command_path`,按其指令在当前 session 内执行
50
- 2. **External = explicit only** — `step.type == "external"` 才走 delegate;默认绝不发起
51
- 3. **必须显式 completion confirmation** — 每个 step 完成时需有 `STATUS: DONE` 且写入 `step.completion_confirmed = true`
52
- 4. **Self-invocation chain** — 持续直到全部 `completion_confirmed` paused
53
- 5. **status.json 每步骤后写盘**resume-safe
51
+ 2. **Required reading must be loaded** — 命令 .md 中的 `<required_reading>` 引用的所有文件必须立即 Read;缺一 → 视为加载失败,pause session(E007)
52
+ 3. **Deferred reading recorded only** — `<deferred_reading>` 列出的文件路径需记录,执行过程按需 Read;不在加载阶段读取
53
+ 4. **Skill loaded confirmation** — 所有 required_reading 加载完成后必须输出一行确认:`✓ skill {step.skill} 加载完成 (required: N, deferred: M)`
54
+ 5. **External = explicit only** `step.type == "external"` 才走 delegate;默认绝不发起
55
+ 6. **必须显式 completion confirmation** — 每个 step 完成时需有 `STATUS: DONE` 且写入 `step.completion_confirmed = true`
56
+ 7. **Self-invocation chain** — 持续直到全部 `completion_confirmed` 或 paused
57
+ 8. **status.json 每步骤后写盘** — resume-safe
54
58
  </invariants>
55
59
 
56
60
  <state_machine>
@@ -159,11 +163,20 @@ Write enriched args back to status.json.
159
163
  2. Mark step running, write status.json
160
164
  3. Display: `[{index}/{total}] {step.skill} [internal · {step.command_scope}]`
161
165
  4. `Read({ file_path: step.command_path })` — 把命令 .md 全文加载进当前会话(prefer Read over Skill for internal steps;decision 节点另行使用 Skill 见 A_EXEC_DECISION)
162
- 5. 解析 frontmatter `argument-hint` `<purpose>/<state_machine>/<actions>` 等指令块
163
- 6. 计算 `effective_args`:`step.args` + auto flag(`auto ? (flag_map[step.skill] || "") : ""`)
164
- 7. 按读到的指令在本会话中**内联执行**:调用允许的工具完成命令所规定的工作,不再发起 delegate
165
- 8. 执行结束:要求最后一段必须包含 `--- COMPLETION STATUS ---` 块(见 A_MARK_COMPLETE)
166
- 9. Return success / failure
166
+ 5. **解析 reading 标签**("入口 + workflow"形式核心步骤):
167
+ - 抽取 frontmatter `argument-hint` / `allowed-tools`
168
+ - 抽取 `<required_reading>` 块的所有 `@path` 引用 → 立刻 `Read({ file_path: <expanded path> })` 加载(`~/` / `@~/` 展开为用户主目录);任一文件缺失或读取失败 → raise E007,pause session
169
+ - 抽取 `<deferred_reading>` 块的所有路径 仅记录到 `step.deferred_reads = [...]`,执行阶段按需 Read
170
+ - 抽取 `<purpose>/<context>/<state_machine>/<execution>/<actions>` 等指令块
171
+ 6. **加载完成确认**:required_reading 全部成功 Read 后,输出一行:
172
+ ```
173
+ ✓ skill {step.skill} 加载完成 (required: {N}, deferred: {M})
174
+ ```
175
+ 其中 N = required_reading 引用数,M = deferred_reading 路径数(缺省块按 0 计)
176
+ 7. 计算 `effective_args`:`step.args` + auto flag(`auto ? (flag_map[step.skill] || "") : ""`)
177
+ 8. 按读到的指令在本会话中**内联执行**:调用允许的工具完成命令所规定的工作,不再发起 delegate;执行过程中如触发 deferred_reading 引用的资源 → 按需 Read
178
+ 9. 执行结束:要求最后一段必须包含 `--- COMPLETION STATUS ---` 块(见 A_MARK_COMPLETE)
179
+ 10. Return success / failure
167
180
 
168
181
  **Auto flag map**: 所有 lifecycle skill → `-y`; `quality-test` → `-y --auto-fix`; 未列出 → 无 flag
169
182
 
@@ -251,7 +264,9 @@ Write enriched args back to status.json.
251
264
  | E003 | error | status.json corrupt | Show path, manual check |
252
265
  | E004 | error | Delegate failed + user abort | Mark paused, suggest resume |
253
266
  | E005 | error | COMPLETION STATUS block missing | Trigger NEEDS_RETRY |
267
+ | E007 | error | required_reading file 缺失或读取失败 | List missing paths, pause session |
254
268
  | W001 | warning | Step completed with concerns | Log and continue |
269
+ | W002 | warning | command .md 无 `<required_reading>` 标签 | 直接执行 .md 主体,跳过加载阶段 |
255
270
 
256
271
  ### Success Criteria
257
272
 
@@ -260,6 +275,9 @@ Write enriched args back to status.json.
260
275
  - [ ] Placeholders resolved;per-skill enrichment 正确
261
276
  - [ ] Decision 节点 Skill("maestro-ralph") handoff
262
277
  - [ ] Internal 节点通过 Read({step.command_path}) 内联执行,禁止 Skill()
278
+ - [ ] Internal 节点 Read 后必须解析并加载 `<required_reading>` 引用的文件;缺失 → E007 pause
279
+ - [ ] `<deferred_reading>` 仅记录路径到 `step.deferred_reads`,执行阶段按需 Read
280
+ - [ ] required_reading 加载完成后输出 `✓ skill {name} 加载完成 (required: N, deferred: M)`
263
281
  - [ ] External 仅在显式声明时走 delegate,prompt 必带 `-y`
264
282
  - [ ] 每个 step 强制 `--- COMPLETION STATUS ---`;缺失 → NEEDS_RETRY
265
283
  - [ ] step.completion_confirmed = true 仅在 STATUS: DONE/DONE_WITH_CONCERNS 时设置
@@ -17,10 +17,12 @@ Closed-loop decision engine for the maestro workflow lifecycle.
17
17
  Reads project state → infers position → builds adaptive chain → delegates execution.
18
18
 
19
19
  Entry points:
20
- - **`/maestro-ralph "intent"`** — New session: infer → decompose → build → execute
21
- - **`/maestro-ralph continue`** — Resume via maestro-ralph-execute
20
+ - **`/maestro-ralph "intent"`** — New session: infer → decompose → build → (decomposition → emit /goal prompt, STOP;否则 dispatch ralph-execute)
21
+ - **`/maestro-ralph continue`** — Wrapper; dispatches to ralph-execute(首选直接 `/maestro-ralph-execute` 推进 step)
22
22
  - **`/maestro-ralph status`** — Display session progress
23
23
 
24
+ > 推进规则:**step 推进由 `/maestro-ralph-execute` 负责**;ralph 仅在 build / decision 评估时介入。decision 节点由 ralph-execute 自动 `Skill("maestro-ralph")` handoff,无需用户手动切换。
25
+
24
26
  Initial decomposition (S_DECOMPOSE): boundary-clarified via ≤3 questions for broad intents (重构/全面/迁移/重写). 写入 status.json 的 `boundary_contract` / `execution_criteria` / `task_decomposition`,附 `/goal` prompt。
25
27
 
26
28
  Node types:
@@ -68,15 +70,16 @@ Remaining → intent
68
70
 
69
71
  <invariants>
70
72
  1. **Ralph never executes steps** — only creates sessions and evaluates decisions
71
- 2. **Handoff via Skill("maestro-ralph-execute")** — at session creation and after decision evaluation
73
+ 2. **Handoff via Skill("maestro-ralph-execute")** — 仅当 session `task_decomposition` 时在创建后自动 handoff;decomposition 路径 STOP 等用户输入。decision 评估后始终 handoff
72
74
  3. **Decision delegates read-only** — `maestro delegate --role analyze --mode analysis`
73
75
  4. **Default type = internal** — `external` 仅显式标注时出现,build 不默认生成
74
76
  5. **status.json 是唯一真源** — 不生成 markdown 清单或侧文件
75
77
  6. **每个 step 必须 `completion_confirmed: true`** — 基于 `--- COMPLETION STATUS ---` 的 `STATUS: DONE`;缺失则视为未完成
76
78
  7. **command_path 在 A_BUILD_STEPS 解析** — 全局优先 `~/.claude/commands/{name}.md`,fallback 项目 `.claude/commands/{name}.md`,写入 status.json
77
- 8. **Decomposition is outcome-oriented**sub-goals 为可观测交付,禁止 lifecycle 复刻;`/goal` 用户绑定,ralph 只发提示词
78
- 9. **planning_mode governs arg granularity** — `unified` skill args 无 `{phase}`;`independent` `{phase}`
79
- 10. **task_decomposition 驱动 steps[] 动态生长** — `post-goal-audit` unmet 子目标插入 scoped mini-loop;字段可选/累加,既有字段不删不改
79
+ 8. **Internal step 加载契约**ralph-execute `command_path` 后,必须解析并加载该命令 `<required_reading>` 引用的所有文件("入口 + workflow"形式的核心),并把 `<deferred_reading>` 路径记录到 `step.deferred_reads`;加载完成后输出 `✓ skill {name} 加载完成`。ralph 在 build 阶段只解析路径,不读 .md 内容
80
+ 9. **Decomposition is outcome-oriented** — sub-goals 为可观测交付,禁止 lifecycle 复刻;`/goal` 用户绑定,ralph 只发提示词后 STOP,等用户输入
81
+ 10. **planning_mode governs arg granularity** — `unified` skill args `{phase}`;`independent` → 含 `{phase}`
82
+ 11. **task_decomposition 驱动 steps[] 动态生长** — `post-goal-audit` 按 unmet 子目标插入 scoped mini-loop;字段可选/累加,既有字段不删不改
80
83
  </invariants>
81
84
 
82
85
  <state_machine>
@@ -146,8 +149,9 @@ S_BUILD_CHAIN:
146
149
  → S_CREATE_SESSION DO: A_BUILD_STEPS
147
150
 
148
151
  S_CREATE_SESSION:
149
- S_CONFIRM WHEN: not auto_confirm DO: A_CREATE_SESSION
150
- S_DISPATCH WHEN: auto_confirm DO: A_CREATE_SESSION
152
+ END WHEN: task_decomposition present DO: A_CREATE_SESSION (emits Goal Prompt → STOP,等用户输入 /goal 后手动 /maestro-ralph-execute)
153
+ S_CONFIRM WHEN: not auto_confirm AND no decomposition DO: A_CREATE_SESSION
154
+ → S_DISPATCH WHEN: auto_confirm AND no decomposition DO: A_CREATE_SESSION
151
155
 
152
156
  S_CONFIRM:
153
157
  → S_DISPATCH WHEN: user selects "Proceed"
@@ -411,7 +415,8 @@ Generate steps from `session.lifecycle_position` to `milestone-complete`.
411
415
  - 全局优先:`~/.claude/commands/{name}.md` 存在 → `command_scope = "global"`
412
416
  - Fallback:`.claude/commands/{name}.md` 存在 → `command_scope = "project"`
413
417
  - 两者都缺 → `command_scope = "missing"`, `command_path = null`,A_CREATE_SESSION 报错 E006
414
- 10. **每个 step 初始化** `completion_confirmed: false`, `completion_status: null`, `completion_evidence: null`
418
+ - **不在 build 阶段读取 .md 内容**;`<required_reading>` / `<deferred_reading>` 解析与加载由 ralph-execute A_EXEC_INTERNAL 负责(保持入口/工作流分离)
419
+ 10. **每个 step 初始化** `completion_confirmed: false`, `completion_status: null`, `completion_evidence: null`, `deferred_reads: []`
415
420
  11. **scope_verdict gating**(仅当 chain 起点 = `analyze-macro`):
416
421
  - `scope_verdict ∈ {medium, small}` → 跳过 `roadmap` + `analyze` 两 stage;`plan` 选 standalone 列(`--from analyze:{analyze_macro_id}`),不带 `{phase}`
417
422
  - `scope_verdict == large` → 保留 `roadmap` + `analyze`;`plan` 选 phase 列(`{phase}`)
@@ -429,7 +434,7 @@ Generate steps from `session.lifecycle_position` to `milestone-complete`.
429
434
  1. Validate: 所有 step 的 `command_scope != "missing"`;否则 raise E006 + 列出缺失 skill
430
435
  2. Write `.workflow/.maestro/ralph-{YYYYMMDD-HHmmss}/status.json` (Appendix: Session Schema)
431
436
  3. Display chain overview:每步显示 `{index}. {skill} [{type}] [{command_scope}]`
432
- 4. If `task_decomposition` present: display the **Goal Prompt block** (Appendix: Goal Prompt Template)
437
+ 4. If `task_decomposition` present: display **Goal Prompt block** (Appendix) STOP,等用户输入 `/goal`(auto_confirm 也不跳过)
433
438
 
434
439
  ### A_DELEGATE_EVALUATE
435
440
 
@@ -618,7 +623,8 @@ Runs only when `task_decomposition` present.
618
623
  "completion_confirmed": false,
619
624
  "completion_status": null,
620
625
  "completion_evidence": null,
621
- "completed_at": null
626
+ "completed_at": null,
627
+ "deferred_reads": [] // 由 ralph-execute A_EXEC_INTERNAL 解析 .md 时填充
622
628
  }],
623
629
  "waves": [], "current_step": 0,
624
630
 
@@ -702,11 +708,9 @@ decision:post-goal-audit {retry+1}
702
708
  链路概览后逐字显示(仅当 decomposition 已产出):
703
709
 
704
710
  ```
705
- 📋 任务分解完成。复制下面一行设定目标,会话在子目标全部达成前不停:
706
-
707
- /goal 目标达成条件: {session_dir}/status.json 中 task_decomposition[*].status == "done" 且 task_decomposition[*].completion_confirmed == true 且 steps[*].completion_confirmed == true。未达成时:阅读 {session_dir}/status.json 取得 execution_criteria / boundary_contract / task_decomposition / steps 作为行动手册,调用 /maestro-ralph continue 推进;严禁手动执行 skill 或越界修改 status.json.boundary_contract.out_of_scope。
711
+ 📋 任务分解完成。复制以下 /goal 设定终止条件,随后运行 /maestro-ralph-execute:
708
712
 
709
- 随后运行 /maestro-ralph continue 立即开始执行。
713
+ /goal 直到 {session_dir}/status.json 的 task_decomposition[*] 与 steps[*] 全部 completion_confirmed=true 才停。每轮以 status.json 为唯一行动手册,通过 /maestro-ralph-execute 推进 step;decision 节点由其自动 handoff 回 ralph 评估。禁止手动执行 skill 或修改 boundary_contract.out_of_scope。
710
714
  ```
711
715
 
712
716
  `/goal` 由用户输入;ralph 只输出此提示词。判据以 status.json 为权威。
@@ -742,7 +746,8 @@ decision:post-goal-audit {retry+1}
742
746
  - [ ] Decomposition: broad intent ≤3 question clarify;narrow auto-derive
743
747
  - [ ] status.json 唯一真源:boundary_contract + execution_criteria + task_decomposition;无外部清单
744
748
  - [ ] 每个 step 默认 `type: "internal"`,含 `command_scope` + `command_path`(全局优先 fallback 项目)
745
- - [ ] 每个 step `completion_confirmed` + `completion_status` + `completion_evidence`(初始 false/null)
749
+ - [ ] Ralph build 阶段只解析路径,不读 .md 内容;`<required_reading>` 加载由 ralph-execute A_EXEC_INTERNAL 完成
750
+ - [ ] 每个 step 含 `completion_confirmed` + `completion_status` + `completion_evidence` + `deferred_reads`(初始 false/null/[])
746
751
  - [ ] 每个 sub-goal 含 `completion_confirmed`(初始 false)
747
752
  - [ ] post-goal-audit decision 仅在 decomposed 时插入,位于 milestone-complete 之前
748
753
  - [ ] Unmet sub-goals 动态 grow steps[](goal_ref tagged);max retries → escalate
@@ -19,7 +19,7 @@ Verify execution results through three complementary methods:
19
19
  3. **Nyquist test coverage validation** — requirement-to-test mapping with gap classification
20
20
 
21
21
  Supports dual-level verification:
22
- - **Single plan**: `verify --dir scratch/plan-xxx` — verifies one plan, writes `verification.json` into plan dir
22
+ - **Single plan**: `verify --dir scratch/{YYYYMMDD}-plan-xxx` — verifies one plan, writes `verification.json` into plan dir
23
23
  - **Milestone**: `verify` (no args) — aggregates all execute artifacts for current milestone into `scratch/{YYYYMMDD}-verify-M{N}-{slug}/milestone-verification.json`
24
24
 
25
25
  Registers VRF artifact in state.json on completion.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maestro-flow",
3
- "version": "0.4.13",
3
+ "version": "0.4.14",
4
4
  "description": "Workflow orchestration CLI with MCP endpoint support and extensible architecture",
5
5
  "type": "module",
6
6
  "imports": {
@@ -60,12 +60,12 @@ Worktree guard: If .workflow/worktree-scope.json exists, reject phase args not i
60
60
  Auto-bootstrap: Create minimal .workflow/state.json if missing.
61
61
 
62
62
  Scope determination → OUTPUT_DIR:
63
- (no args) + milestone + roadmap → scope="milestone", mode="micro", OUTPUT_DIR=.workflow/scratch/analyze-{milestone_slug}-{date}/
63
+ (no args) + milestone + roadmap → scope="milestone", mode="micro", OUTPUT_DIR=.workflow/scratch/{YYYYMMDD}-analyze-M{N}-{milestone_slug}/
64
64
  (no args) without milestone/roadmap → ERROR E001
65
- (number) + milestone + roadmap → scope="phase", mode="micro", OUTPUT_DIR=.workflow/scratch/analyze-{phase_slug}-{date}/
65
+ (number) + milestone + roadmap → scope="phase", mode="micro", OUTPUT_DIR=.workflow/scratch/{YYYYMMDD}-analyze-P{N}-{phase_slug}/
66
66
  (number) without milestone/roadmap → ERROR
67
- (text) + milestone → scope="adhoc", mode="macro", OUTPUT_DIR=.workflow/scratch/analyze-{topic_slug}-{date}/
68
- (text) without milestone → scope="standalone", mode="macro", OUTPUT_DIR=.workflow/scratch/analyze-{topic_slug}-{date}/
67
+ (text) + milestone → scope="adhoc", mode="macro", OUTPUT_DIR=.workflow/scratch/{YYYYMMDD}-analyze-{topic_slug}/
68
+ (text) without milestone → scope="standalone", mode="macro", OUTPUT_DIR=.workflow/scratch/{YYYYMMDD}-analyze-{topic_slug}/
69
69
 
70
70
  Macro mode additions (scope="adhoc" or "standalone"):
71
71
  - In Step 6 Synthesis, evaluate scope_verdict: "small" | "medium" | "large"
@@ -113,8 +113,8 @@ Parse $ARGUMENTS to determine mode and flags:
113
113
  - `-c` present: locate existing session folder (discussion.md exists), resume from last round
114
114
  - `-y` present: set AUTO_MODE=true
115
115
  - `-q` present: set QUICK_MODE=true (skip Steps 2-7, jump to Step 8: Decision Extraction)
116
- - Number (e.g., "3") = phase scope: resolve phase slug from roadmap, output to scratch/analyze-{phase-slug}-{date}/
117
- - Text (e.g., "microservices vs monolith") = adhoc/standalone scope: output to scratch/analyze-{slug}-{date}/
116
+ - Number (e.g., "3") = phase scope: resolve phase slug from roadmap, output to scratch/{YYYYMMDD}-analyze-P{N}-{phase-slug}/
117
+ - Text (e.g., "microservices vs monolith") = adhoc/standalone scope: output to scratch/{YYYYMMDD}-analyze-{slug}/
118
118
  - Missing/empty = milestone scope (if roadmap exists) or error E001
119
119
 
120
120
  **Session initialization:**
@@ -50,7 +50,7 @@ Phase 3: Single Role Analysis → Detection → Context → Agent → Validation
50
50
  ## Input
51
51
 
52
52
  - `$ARGUMENTS`: topic text (auto mode) or role name (single role mode)
53
- - All output goes to `.workflow/scratch/brainstorm-{slug}-{date}/`
53
+ - All output goes to `.workflow/scratch/{YYYYMMDD}-brainstorm-{slug}/`
54
54
  - Registers artifact (type=brainstorm) in state.json on completion
55
55
 
56
56
  ### Parameters
@@ -86,7 +86,7 @@ Phase 3: Single Role Analysis → Detection → Context → Agent → Validation
86
86
 
87
87
  All brainstorm output goes to scratch:
88
88
  ```
89
- .workflow/scratch/brainstorm-{slug}-{date}/
89
+ .workflow/scratch/{YYYYMMDD}-brainstorm-{slug}/
90
90
  ├── guidance-specification.md # Phase 2 output — machine contract (downstream consumes this)
91
91
  ├── design-research.md # Optional Step 1.7 output
92
92
  ├── system-architect/ # Phase 3 per-role analysis (one folder per selected role)
@@ -129,14 +129,14 @@ Parse $ARGUMENTS to determine execution mode:
129
129
  - Missing/empty args without flags = error E001
130
130
 
131
131
  **Session Detection**:
132
- - Check `.workflow/scratch/brainstorm-*/` for existing sessions
132
+ - Check `.workflow/scratch/*-brainstorm-*/` for existing sessions
133
133
  - Multiple → AskUserQuestion to select | Single → use it
134
134
  - None + auto mode → will create new session
135
135
  - None + single role mode → error E002
136
136
 
137
137
  **Output Directory Resolution**:
138
138
  - Phase mode (number): resolve `state.json.artifacts[phase == phaseNum].path` → `.workflow/{path}/.brainstorming/` (ERROR if phase not found)
139
- - All output: `.workflow/scratch/brainstorm-{slug}-{date}/`
139
+ - All output: `.workflow/scratch/{YYYYMMDD}-brainstorm-{slug}/`
140
140
  - Existing session: use existing session directory
141
141
 
142
142
  ---
@@ -330,7 +330,7 @@ When `ui-designer` is among the selected roles, establish the project's visual d
330
330
  For EACH selected role, spawn a `role-design-author` agent in parallel. Each agent produces a multi-file analysis under `{output_dir}/{role}/`.
331
331
 
332
332
  **Path resolution (orchestrator responsibility, BEFORE invocation)**:
333
- - Resolve `{output_dir}` to an **absolute path** (e.g., `D:/proj/.workflow/scratch/brainstorm-foo-20260521`). Do NOT pass the literal `.workflow/...` relative form — agent Write tool requires absolute paths.
333
+ - Resolve `{output_dir}` to an **absolute path** (e.g., `D:/proj/.workflow/scratch/20260521-brainstorm-foo`). Do NOT pass the literal `.workflow/...` relative form — agent Write tool requires absolute paths.
334
334
  - Expand `~/` in `role_template_path` to the user home absolute path.
335
335
  - For absent optional fields (e.g., `style_skill` when role ≠ ui-designer, `design_research` when Step 1.7 was skipped), pass the literal string `null` — never a conditional placeholder like `{x if y}`.
336
336
 
@@ -102,8 +102,8 @@ Display:
102
102
 
103
103
  | # | Location | Status | Current Hypothesis |
104
104
  |---|----------|--------|--------------------|
105
- | 1 | scratch/plan-auth-2026-04-20/.debug/jwt-expiry/ | investigating | Token not refreshed on 401 |
106
- | 2 | scratch/debug-nav-crash-2026-03-14/ | checkpoint | Awaiting user input |
105
+ | 1 | scratch/20260420-plan-P3-auth/.debug/jwt-expiry/ | investigating | Token not refreshed on 401 |
106
+ | 2 | scratch/20260314-debug-nav-crash/ | checkpoint | Awaiting user input |
107
107
 
108
108
  Reply with a number to resume, or describe a new issue.
109
109
  ```
@@ -194,11 +194,11 @@ Create debug session directory and proceed to Step 6.
194
194
  | Mode | Directory |
195
195
  |------|-----------|
196
196
  | Phase-scoped (from UAT) | `{ARTIFACT_DIR}/.debug/{gap-slug}/` (ARTIFACT_DIR resolved from artifact registry) |
197
- | Standalone | `.workflow/scratch/debug-{slug}-{date}/` |
197
+ | Standalone | `.workflow/scratch/{YYYYMMDD}-debug-{slug}/` |
198
198
 
199
199
  Resolve `DEBUG_DIR` from artifact registry:
200
200
  - Phase-scoped: look up phase in `.workflow/state.json` artifacts (type=execute), set `DEBUG_DIR = ".workflow/{art.path}/.debug/{gap-slug}/"`. Error if not found.
201
- - Standalone: `DEBUG_DIR = ".workflow/scratch/debug-{slug}-{date}/"`
201
+ - Standalone: `DEBUG_DIR = ".workflow/scratch/{YYYYMMDD}-debug-{slug}/"`
202
202
 
203
203
  Create the directory.
204
204
 
@@ -67,7 +67,7 @@ Scan `.workflow/` for harvestable artifacts. Each source type has a known struct
67
67
  | Source Type | Scan Path | Key Files | ID Pattern |
68
68
  |-------------|-----------|-----------|------------|
69
69
  | `analysis` | `.workflow/.analysis/ANL-*/` | `conclusions.json`, `*.md` | `ANL-*` |
70
- | `brainstorm` | `.workflow/scratch/brainstorm-*/` | `guidance-specification.md`, `*/analysis.md`, `design-research.md` | directory name |
70
+ | `brainstorm` | `.workflow/scratch/*-brainstorm-*/` | `guidance-specification.md`, `*/analysis.md`, `design-research.md` | directory name |
71
71
  | `lite-plan` | `.workflow/.lite-plan/*/` | `plan.json`, `plan-overview.md` | directory name |
72
72
  | `lite-fix` | `.workflow/.lite-fix/*/` | `fix-plan.json` | directory name |
73
73
  | `debug` | `.workflow/.debug/*/` | `debug-log.md`, `hypothesis-*.md` | directory name |
package/workflows/init.md CHANGED
@@ -43,7 +43,7 @@ state.json exists → Path C (existing) | source files exist → Path B (brownfi
43
43
 
44
44
  If `--auto` flag: skip interactive questioning, extract from @ referenced document.
45
45
  If `--from <source>` (alias: `--from-brainstorm`):
46
- - Locate source directory (`.workflow/scratch/brainstorm-*/`, `.workflow/scratch/*-import-*/`, etc.)
46
+ - Locate source directory (`.workflow/scratch/*-brainstorm-*/`, `.workflow/scratch/*-import-*/`, etc.)
47
47
  - Load `context-package.json` (preferred) or fall back to `guidance-specification.md`:
48
48
  - `domain` (name, description, problem_statement) → project vision + core value
49
49
  - `requirements[]` → project goals (Active requirements)
package/workflows/plan.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Produces two-layer plan output: `plan.json` (overview with task_ids[] and waves[]) + `.task/TASK-{NNN}.json` (individual task definitions).
6
6
 
7
- All output goes to `.workflow/scratch/plan-{slug}-{date}/`.
7
+ All output goes to `.workflow/scratch/{YYYYMMDD}-plan-[P{N}-|M{N}-]{slug}/`. Date-first ordering enables chronological sorting; scope prefix (`P{N}` for phase, `M{N}` for milestone, omit for standalone/adhoc) enables fallback identification.
8
8
 
9
9
  ---
10
10
 
@@ -69,10 +69,10 @@ Quick tasks can run mid-phase -- validation only checks project exists, not phas
69
69
  **Create scratch directory:**
70
70
 
71
71
  Generate slug from $DESCRIPTION (lowercase, hyphens, max 40 chars).
72
- Set date to current date (YYYY-MM-DD).
72
+ Set date to current date (YYYYMMDD).
73
73
 
74
74
  ```bash
75
- QUICK_DIR=".workflow/scratch/quick-${slug}-${date}"
75
+ QUICK_DIR=".workflow/scratch/${date}-quick-${slug}"
76
76
  mkdir -p "$QUICK_DIR/.task"
77
77
  mkdir -p "$QUICK_DIR/.summaries"
78
78
  ```
@@ -80,7 +80,7 @@ mkdir -p "$QUICK_DIR/.summaries"
80
80
  Write index.json:
81
81
  ```json
82
82
  {
83
- "id": "quick-{slug}-{date}",
83
+ "id": "{YYYYMMDD}-quick-{slug}",
84
84
  "type": "quick",
85
85
  "title": "{$DESCRIPTION}",
86
86
  "status": "active",
@@ -315,7 +315,7 @@ Read state.json. Add quick task to accumulated_context or quick_tasks array.
315
315
  Record:
316
316
  ```json
317
317
  {
318
- "id": "quick-{slug}-{date}",
318
+ "id": "{YYYYMMDD}-quick-{slug}",
319
319
  "description": "{$DESCRIPTION}",
320
320
  "completed_at": "{ISO timestamp}",
321
321
  "directory": "{$QUICK_DIR}",
@@ -2,7 +2,7 @@
2
2
 
3
3
  Systematically reduce tech debt through scope analysis, task planning, and reflection-driven execution. Each refactoring round records strategy, outcome, and adjustments. Existing tests must pass after every change.
4
4
 
5
- Output: scratch/refactor-{slug}-{date}/ with index.json + reflection-log.md + .task/ + .summaries/
5
+ Output: scratch/{YYYYMMDD}-refactor-{slug}/ with index.json + reflection-log.md + .task/ + .summaries/
6
6
 
7
7
  ---
8
8
 
@@ -24,13 +24,13 @@ Output: scratch/refactor-{slug}-{date}/ with index.json + reflection-log.md + .t
24
24
 
25
25
  Prompt user for scope type: module path, feature area, or full codebase.
26
26
 
27
- Generate slug from scope (lowercase, hyphens, max 40 chars). Set date = YYYY-MM-DD.
27
+ Generate slug from scope (lowercase, hyphens, max 40 chars). Set date = YYYYMMDD.
28
28
 
29
29
  ---
30
30
 
31
31
  ### Step 2: Create Scratch Directory
32
32
 
33
- Create `REFACTOR_DIR=".workflow/scratch/refactor-${slug}-${date}"` with `.task/` and `.summaries/` subdirs.
33
+ Create `REFACTOR_DIR=".workflow/scratch/${date}-refactor-${slug}"` with `.task/` and `.summaries/` subdirs.
34
34
 
35
35
  Write index.json: id, type="refactor", title, status="active", scope, plan (empty task_ids), execution (method=agent, counts=0), reflection (rounds=0).
36
36
 
@@ -481,8 +481,8 @@ If `mode == "range"` or `--all`, loop Stages 3-8 per phase, then print aggregate
481
481
  "summary": "Refresh-on-use prevents replay attacks. Implemented in src/auth/refresh.ts; should become a project-wide convention.",
482
482
  "confidence": "high",
483
483
  "evidence_refs": [
484
- ".workflow/scratch/plan-auth-2026-04-15/verification.json#gaps[2]",
485
- ".workflow/scratch/plan-auth-2026-04-15/.summaries/TASK-005-summary.md:42"
484
+ ".workflow/scratch/20260415-plan-P1-auth/verification.json#gaps[2]",
485
+ ".workflow/scratch/20260415-plan-P1-auth/.summaries/TASK-005-summary.md:42"
486
486
  ],
487
487
  "tags": ["auth", "jwt", "security"],
488
488
  "routed_to": "spec",
@@ -508,7 +508,7 @@ Refresh-on-use prevents replay attacks. Implemented in src/auth/refresh.ts; shou
508
508
  - **Phase**: 1 (01-auth)
509
509
  - **Lens**: technical
510
510
  - **Confidence**: high
511
- - **Evidence**: .workflow/scratch/plan-auth-2026-04-15/verification.json#gaps[2]
511
+ - **Evidence**: .workflow/scratch/20260415-plan-P1-auth/verification.json#gaps[2]
512
512
  - **Routed to**: spec (coding-conventions.md#INS-a1b2c3d4)
513
513
 
514
514
  </spec-entry>
@@ -24,7 +24,7 @@ Pipeline position: analyze -> **ui-design** -> plan -> execute -> verify
24
24
 
25
25
  ```
26
26
  Input: <phase> (number) OR topic text
27
- Output: .workflow/scratch/ui-design-{slug}-{date}/
27
+ Output: .workflow/scratch/{YYYYMMDD}-ui-design-{slug}/
28
28
 
29
29
  Resolve scope:
30
30
  number → phase slug from roadmap.md, scope="phase", register with phase
@@ -23,7 +23,7 @@ If argument is phase number/slug:
23
23
  SCRATCH_MODE = false
24
24
 
25
25
  If argument is topic text (scratch mode):
26
- PHASE_DIR = .workflow/scratch/ui-design-{slug}-{YYYYMMDD}
26
+ PHASE_DIR = .workflow/scratch/{YYYYMMDD}-ui-design-{slug}
27
27
  Create directory + minimal index.json (type="ui-design", goal=topic).
28
28
  SCRATCH_MODE = true
29
29
  ```
@@ -82,7 +82,7 @@ Resolve PLAN_DIRS and VERIFY_MODE by input type:
82
82
  numeric arg → phase mode, collect completed execute artifacts for that phase from state.json
83
83
 
84
84
  If no matching artifacts found: ERROR E001.
85
- Milestone mode creates output dir: .workflow/scratch/verify-{milestone_slug}-{date}/
85
+ Milestone mode creates output dir: .workflow/scratch/{YYYYMMDD}-verify-{milestone_slug}/
86
86
  ```
87
87
 
88
88
  ---