maestro-flow 0.4.12 → 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.
Files changed (141) hide show
  1. package/.agents/agents/role-design-author.md +6 -4
  2. package/.agents/skills/learn-decompose/SKILL.md +6 -6
  3. package/.agents/skills/learn-follow/SKILL.md +4 -4
  4. package/.agents/skills/learn-investigate/SKILL.md +6 -6
  5. package/.agents/skills/learn-retro/SKILL.md +7 -7
  6. package/.agents/skills/learn-second-opinion/SKILL.md +4 -4
  7. package/.agents/skills/maestro-amend/SKILL.md +1 -0
  8. package/.agents/skills/maestro-analyze/SKILL.md +10 -3
  9. package/.agents/skills/maestro-blueprint/SKILL.md +4 -3
  10. package/.agents/skills/maestro-brainstorm/SKILL.md +6 -5
  11. package/.agents/skills/maestro-fork/SKILL.md +1 -1
  12. package/.agents/skills/maestro-guard/SKILL.md +3 -2
  13. package/.agents/skills/maestro-impeccable/SKILL.md +13 -11
  14. package/.agents/skills/maestro-milestone-release/SKILL.md +1 -1
  15. package/.agents/skills/maestro-plan/SKILL.md +3 -1
  16. package/.agents/skills/maestro-ralph/SKILL.md +21 -16
  17. package/.agents/skills/maestro-ralph-execute/SKILL.md +30 -11
  18. package/.agents/skills/maestro-roadmap/SKILL.md +4 -3
  19. package/.agents/skills/maestro-verify/SKILL.md +1 -1
  20. package/.agents/skills/manage-harvest/SKILL.md +1 -0
  21. package/.agents/skills/manage-issue-discover/SKILL.md +1 -1
  22. package/.agents/skills/manage-knowhow/SKILL.md +1 -1
  23. package/.agents/skills/manage-learn/SKILL.md +4 -4
  24. package/.agents/skills/quality-auto-test/SKILL.md +5 -5
  25. package/.agents/skills/quality-refactor/SKILL.md +1 -1
  26. package/.agents/skills/quality-retrospective/SKILL.md +2 -2
  27. package/.agents/skills/security-audit/SKILL.md +24 -0
  28. package/.agents/skills/spec-remove/SKILL.md +6 -2
  29. package/.agy/agents/role-design-author.md +6 -4
  30. package/.agy/skills/learn-decompose/SKILL.md +6 -6
  31. package/.agy/skills/learn-follow/SKILL.md +4 -4
  32. package/.agy/skills/learn-investigate/SKILL.md +6 -6
  33. package/.agy/skills/learn-retro/SKILL.md +7 -7
  34. package/.agy/skills/learn-second-opinion/SKILL.md +4 -4
  35. package/.agy/skills/maestro-amend/SKILL.md +1 -0
  36. package/.agy/skills/maestro-analyze/SKILL.md +10 -3
  37. package/.agy/skills/maestro-blueprint/SKILL.md +4 -3
  38. package/.agy/skills/maestro-brainstorm/SKILL.md +6 -5
  39. package/.agy/skills/maestro-fork/SKILL.md +1 -1
  40. package/.agy/skills/maestro-guard/SKILL.md +3 -2
  41. package/.agy/skills/maestro-impeccable/SKILL.md +13 -11
  42. package/.agy/skills/maestro-milestone-release/SKILL.md +1 -1
  43. package/.agy/skills/maestro-plan/SKILL.md +3 -1
  44. package/.agy/skills/maestro-ralph/SKILL.md +21 -16
  45. package/.agy/skills/maestro-ralph-execute/SKILL.md +30 -11
  46. package/.agy/skills/maestro-roadmap/SKILL.md +4 -3
  47. package/.agy/skills/maestro-verify/SKILL.md +1 -1
  48. package/.agy/skills/manage-harvest/SKILL.md +1 -0
  49. package/.agy/skills/manage-issue-discover/SKILL.md +1 -1
  50. package/.agy/skills/manage-knowhow/SKILL.md +1 -1
  51. package/.agy/skills/manage-learn/SKILL.md +4 -4
  52. package/.agy/skills/quality-auto-test/SKILL.md +5 -5
  53. package/.agy/skills/quality-refactor/SKILL.md +1 -1
  54. package/.agy/skills/quality-retrospective/SKILL.md +2 -2
  55. package/.agy/skills/security-audit/SKILL.md +24 -0
  56. package/.agy/skills/spec-remove/SKILL.md +6 -2
  57. package/.claude/agents/role-design-author.md +6 -4
  58. package/.claude/commands/learn-decompose.md +6 -6
  59. package/.claude/commands/learn-follow.md +4 -4
  60. package/.claude/commands/learn-investigate.md +6 -6
  61. package/.claude/commands/learn-retro.md +7 -7
  62. package/.claude/commands/learn-second-opinion.md +4 -4
  63. package/.claude/commands/maestro-amend.md +1 -0
  64. package/.claude/commands/maestro-analyze.md +10 -3
  65. package/.claude/commands/maestro-blueprint.md +4 -3
  66. package/.claude/commands/maestro-brainstorm.md +6 -5
  67. package/.claude/commands/maestro-fork.md +1 -1
  68. package/.claude/commands/maestro-guard.md +3 -2
  69. package/.claude/commands/maestro-impeccable.md +13 -11
  70. package/.claude/commands/maestro-milestone-release.md +1 -1
  71. package/.claude/commands/maestro-plan.md +3 -1
  72. package/.claude/commands/maestro-ralph-execute.md +30 -11
  73. package/.claude/commands/maestro-ralph.md +21 -16
  74. package/.claude/commands/maestro-roadmap.md +4 -3
  75. package/.claude/commands/maestro-verify.md +1 -1
  76. package/.claude/commands/manage-harvest.md +1 -0
  77. package/.claude/commands/manage-issue-discover.md +1 -1
  78. package/.claude/commands/manage-knowhow.md +1 -1
  79. package/.claude/commands/manage-learn.md +4 -4
  80. package/.claude/commands/quality-auto-test.md +5 -5
  81. package/.claude/commands/quality-refactor.md +1 -1
  82. package/.claude/commands/quality-retrospective.md +2 -2
  83. package/.claude/commands/security-audit.md +24 -0
  84. package/.claude/commands/spec-remove.md +6 -2
  85. package/.codex/skills/learn-decompose/SKILL.md +4 -4
  86. package/.codex/skills/learn-follow/SKILL.md +3 -3
  87. package/.codex/skills/learn-investigate/SKILL.md +3 -3
  88. package/.codex/skills/learn-retro/SKILL.md +3 -3
  89. package/.codex/skills/learn-second-opinion/SKILL.md +3 -3
  90. package/.codex/skills/maestro-analyze/SKILL.md +4 -3
  91. package/.codex/skills/maestro-blueprint/SKILL.md +4 -3
  92. package/.codex/skills/maestro-brainstorm/SKILL.md +148 -7
  93. package/.codex/skills/maestro-fork/SKILL.md +2 -0
  94. package/.codex/skills/maestro-guard/SKILL.md +3 -2
  95. package/.codex/skills/maestro-impeccable/SKILL.md +13 -11
  96. package/.codex/skills/maestro-ralph/SKILL.md +1 -1
  97. package/.codex/skills/maestro-roadmap/SKILL.md +4 -3
  98. package/.codex/skills/manage-codebase-rebuild/SKILL.md +9 -5
  99. package/.codex/skills/manage-harvest/SKILL.md +1 -1
  100. package/.codex/skills/manage-issue-discover/SKILL.md +1 -1
  101. package/.codex/skills/manage-knowhow/SKILL.md +1 -1
  102. package/.codex/skills/manage-learn/SKILL.md +3 -3
  103. package/.codex/skills/quality-refactor/SKILL.md +2 -2
  104. package/.codex/skills/quality-retrospective/SKILL.md +3 -3
  105. package/.codex/skills/security-audit/SKILL.md +24 -0
  106. package/.codex/skills/spec-remove/SKILL.md +8 -2
  107. package/package.json +1 -1
  108. package/workflows/agy-instructions.md +2 -0
  109. package/workflows/analyze.md +6 -6
  110. package/workflows/auto-test.md +6 -1
  111. package/workflows/brainstorm.md +26 -12
  112. package/workflows/claude-instructions.md +2 -0
  113. package/workflows/codex-instructions.md +16 -83
  114. package/workflows/debug.md +5 -5
  115. package/workflows/harvest.md +2 -2
  116. package/workflows/impeccable.md +2 -0
  117. package/workflows/init.md +1 -1
  118. package/workflows/issue-analyze.md +14 -100
  119. package/workflows/issue-discover.md +2 -3
  120. package/workflows/issue-execute.md +1 -1
  121. package/workflows/issue-gaps-analyze.md +2 -0
  122. package/workflows/learn.md +1 -1
  123. package/workflows/maestro-chain-execute.md +10 -228
  124. package/workflows/maestro.md +1 -0
  125. package/workflows/milestone-complete.md +3 -3
  126. package/workflows/milestone-release.md +82 -0
  127. package/workflows/plan.md +5 -5
  128. package/workflows/quick.md +4 -4
  129. package/workflows/refactor.md +3 -3
  130. package/workflows/retrospective.md +4 -4
  131. package/workflows/roadmap.md +1 -1
  132. package/workflows/spec-generate.md +2 -0
  133. package/workflows/specs-add.md +6 -1
  134. package/workflows/specs-load.md +6 -1
  135. package/workflows/specs-setup.md +6 -1
  136. package/workflows/sync.md +13 -0
  137. package/workflows/tools-spec.md +4 -0
  138. package/workflows/ui-design.md +4 -4
  139. package/workflows/ui-style.md +1 -1
  140. package/workflows/verify.md +1 -1
  141. package/workflows/wiki-manage.md +2 -0
@@ -40,7 +40,9 @@ Also read `session.auto_mode` from status.json — if true, treat as `-y`.
40
40
  | external (opt-in) | `maestro delegate --to claude --mode write` (STOP → callback) | Self-invoke next |
41
41
 
42
42
  HARD RULES:
43
- - internal step MUST 通过 `read_file({command_path})` 把命令 .md 加载进当前会话,再按内容执行;禁止 `invoke_skill({skill})` 调用
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 会导致命令执行不完整
45
+ - decision 节点例外:A_EXEC_DECISION 必须使用 `invoke_skill({ skill: "maestro-ralph" })` 进行 handoff(这是 decision 节点的唯一允许用法)
44
46
  - `command_path` 由 ralph 在 A_BUILD_STEPS 写入 status.json;ralph-execute 不再自行解析(缺失 → 报错 E002)
45
47
  - external 仅在 `step.type == "external"` 显式声明时使用,并 always append `-y` 到 prompt args
46
48
  - 每个 step 必须产出 `--- COMPLETION STATUS ---` 块,否则视为 NEEDS_RETRY
@@ -48,10 +50,13 @@ HARD RULES:
48
50
 
49
51
  <invariants>
50
52
  1. **Internal = Read + inline** — 通过 Read 读取 `step.command_path`,按其指令在当前 session 内执行
51
- 2. **External = explicit only** — `step.type == "external"` 才走 delegate;默认绝不发起
52
- 3. **必须显式 completion confirmation** — 每个 step 完成时需有 `STATUS: DONE` 且写入 `step.completion_confirmed = true`
53
- 4. **Self-invocation chain** — 持续直到全部 `completion_confirmed` paused
54
- 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
55
60
  </invariants>
56
61
 
57
62
  <state_machine>
@@ -159,12 +164,21 @@ Write enriched args back to status.json.
159
164
  1. Validate `step.command_path != null`;否则 raise E002,pause session
160
165
  2. Mark step running, write status.json
161
166
  3. Display: `[{index}/{total}] {step.skill} [internal · {step.command_scope}]`
162
- 4. `read_file({ file_path: step.command_path })` — 把命令 .md 全文加载进当前会话
163
- 5. 解析 frontmatter `argument-hint` `<purpose>/<state_machine>/<actions>` 等指令块
164
- 6. 计算 `effective_args`:`step.args` + auto flag(`auto ? (flag_map[step.skill] || "") : ""`)
165
- 7. 按读到的指令在本会话中**内联执行**:调用允许的工具完成命令所规定的工作,不再发起 invoke_skill() delegate
166
- 8. 执行结束:要求最后一段必须包含 `--- COMPLETION STATUS ---` 块(见 A_MARK_COMPLETE)
167
- 9. Return success / failure
167
+ 4. `read_file({ file_path: step.command_path })` — 把命令 .md 全文加载进当前会话(prefer Read over Skill for internal steps;decision 节点另行使用 Skill 见 A_EXEC_DECISION)
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
168
182
 
169
183
  **Auto flag map**: 所有 lifecycle skill → `-y`; `quality-test` → `-y --auto-fix`; 未列出 → 无 flag
170
184
 
@@ -252,7 +266,9 @@ Write enriched args back to status.json.
252
266
  | E003 | error | status.json corrupt | Show path, manual check |
253
267
  | E004 | error | Delegate failed + user abort | Mark paused, suggest resume |
254
268
  | E005 | error | COMPLETION STATUS block missing | Trigger NEEDS_RETRY |
269
+ | E007 | error | required_reading file 缺失或读取失败 | List missing paths, pause session |
255
270
  | W001 | warning | Step completed with concerns | Log and continue |
271
+ | W002 | warning | command .md 无 `<required_reading>` 标签 | 直接执行 .md 主体,跳过加载阶段 |
256
272
 
257
273
  ### Success Criteria
258
274
 
@@ -261,6 +277,9 @@ Write enriched args back to status.json.
261
277
  - [ ] Placeholders resolved;per-skill enrichment 正确
262
278
  - [ ] Decision 节点 invoke_skill("maestro-ralph") handoff
263
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)`
264
283
  - [ ] External 仅在显式声明时走 delegate,prompt 必带 `-y`
265
284
  - [ ] 每个 step 强制 `--- COMPLETION STATUS ---`;缺失 → NEEDS_RETRY
266
285
  - [ ] step.completion_confirmed = true 仅在 STATUS: DONE/DONE_WITH_CONCERNS 时设置
@@ -71,14 +71,15 @@ maestro-analyze {phase} → maestro-plan → maestro-execute → maestro-verify
71
71
  <interview_protocol>
72
72
  Interview the user relentlessly until shared understanding is reached. Active only in interactive mode; skip when `-y/--yes`, `--revise`, `--review`, `-c/--continue`, or input is already specific (clear requirement + mode).
73
73
 
74
- - One decision per turn via ask_user with 2–4 options + a (Recommended) default; every question must include a `Proceed now` option.
75
- - Never ask what code can verify — resolve via `state.json`, existing `roadmap.md`, `project.md`, or `maestro spec load`.
74
+ - One decision per turn via ask_user with 2–4 options + a (Recommended) default. The user controls termination — keep interviewing until convergence; they can interrupt naturally or via `Other` at any time.
75
+ - Search-first when uncertain: before asking, resolve via `state.json`, existing `roadmap.md`, `project.md`, `maestro spec load`, `maestro wiki search`, Glob/Grep/Read, or — for open-ended multi-file scans — spawn `delegate_subagent(subagent_type: Explore)` / `maestro delegate ... --role explore`. Never ask what code or memory can verify; never bounce your own ambiguity back to the user — search first, then ask only what truly needs human judgment.
76
+ - Writeback cadence: each settled decision is immediately appended/updated in the `Roadmap Decisions` section at the top of `.workflow/roadmap.md` (create the section if absent). Do NOT batch writeback to the end — partial decisions must already be on disk before the next question.
76
77
  - Walk the decision dependency tree strictly: mode → requirement scope → decomposition strategy → phase dependencies/order. Do not open the next branch until the current one is settled.
77
78
  - Scope guard: only decide the shape of the roadmap. Do not pre-resolve intra-phase task breakdown — that belongs to `plan`.
78
79
 
79
80
  Decision points: scope (MVP / complete / phased) → strategy (progressive / direct / auto) → milestone boundaries → phase dependencies and order.
80
81
 
81
- Exit: on consensus or `Proceed now`, append the table below to a `Roadmap Decisions` section at the top of `.workflow/roadmap.md`:
82
+ Exit: on consensus or explicit user signal to proceed, finalize the `Roadmap Decisions` section (rows already populated incrementally). Schema:
82
83
  `| # | Decision | Choice | Source (user / code / default) |`
83
84
  </interview_protocol>
84
85
 
@@ -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.
@@ -49,6 +49,7 @@ Follow '~/.maestro/workflows/harvest.md' Stages 1-8 in order.
49
49
  1. **Read-only until Stage 6** — extraction and classification happen in-memory.
50
50
  2. **Dedup before write** — check harvest-log.jsonl and existing stores before each write.
51
51
  3. **Never modify source artifacts** — harvest is purely extractive.
52
+ 4. **Dedup contract with parallel writers** — when appending to `issues.jsonl`, set `source: "harvest"` on each row so concurrent writers (e.g. `manage-issue-discover` with `source: "discover"`) can be distinguished and deduplicated.
52
53
 
53
54
  Extraction patterns, classification rules, routing infrastructure, and fragment ID scheme defined in workflow harvest.md.
54
55
 
@@ -48,7 +48,7 @@ $ARGUMENTS -- optional. Parse first token to determine mode.
48
48
  - `--depth=standard|deep` -- exploration depth (by-prompt only, default: `standard`)
49
49
 
50
50
  **State files:**
51
- - `.workflow/issues/issues.jsonl` -- issues appended here
51
+ - `.workflow/issues/issues.jsonl` -- issues appended here (set `source: "discover"` on each row so concurrent writers like `manage-harvest` with `source: "harvest"` can be distinguished and deduplicated)
52
52
  - `.workflow/issues/discoveries/{SESSION_ID}/` -- session artifacts
53
53
 
54
54
  ### Pre-load specs
@@ -55,7 +55,7 @@ Follow '~/.maestro/workflows/knowhow.md' Part A (KnowHow Management) completely.
55
55
  <error_codes>
56
56
  | Code | Severity | Description | Stage |
57
57
  |------|----------|-------------|-------|
58
- | E001 | error | No memory stores found — run `/manage-knowhow-capture` or create MEMORY.md | resolve_paths |
58
+ | E001 | error | No memory stores found — for workflow store run `/manage-knowhow-capture`; for system store create `~/.claude/projects/{project}/memory/MEMORY.md` manually | resolve_paths |
59
59
  | E002 | error | Entry ID or filename not found | execute_view, execute_delete |
60
60
  | E003 | error | Prune requires at least one filter (--tag, --type, --before, --after) | execute_prune |
61
61
  | E004 | error | Cannot delete MEMORY.md — use `edit` subcommand instead | execute_delete |
@@ -32,7 +32,7 @@ Arguments: $ARGUMENTS
32
32
  - `"<insight text>"` (or any non-keyword text) → insight capture mode
33
33
  - `tip <text>` → tip capture mode (quick contextual note, auto-tagged `tip`)
34
34
  - `list` → list recent entries (default 20)
35
- - `search <query>` → `maestro spec load --category learning` or text search across `specs/learnings.md`
35
+ - `search <query>` → `maestro spec load --category learning` or text search across `.workflow/specs/learnings.md`
36
36
  - `show <INS-id>` → full detail with phase context
37
37
  - empty → ask_user to prompt for text
38
38
 
@@ -49,19 +49,19 @@ Follow `~/.maestro/workflows/learn.md` Stages 1–5 in order.
49
49
  | E001 | error | `.workflow/` not initialized — run `/maestro-init` first | parse_input |
50
50
  | E002 | error | Unknown `--category` value (allowed: pattern, antipattern, decision, tool, gotcha, technique, tip) | parse_input |
51
51
  | E003 | error | `show` mode requires an INS-id argument | show |
52
- | E004 | error | Insight id not found in `specs/learnings.md` | show |
52
+ | E004 | error | Insight id not found in `.workflow/specs/learnings.md` | show |
53
53
  | W001 | warning | Auto-phase detection found a current_phase but no matching artifact in registry; phase set to null | capture |
54
54
  </error_codes>
55
55
 
56
56
  <success_criteria>
57
57
  - [ ] Mode correctly routed (capture / list / search / show)
58
- - [ ] Capture: `<spec-entry>` block appended to `specs/learnings.md` with all required fields
58
+ - [ ] Capture: `<spec-entry>` block appended to `.workflow/specs/learnings.md` with all required fields
59
59
  - [ ] Capture: phase auto-link resolves correctly via artifact registry when `state.json` has `current_phase`
60
60
  - [ ] Capture: category inference produces a sensible default when `--category` absent
61
61
  - [ ] List: filters apply, output sorted newest-first, default limit 20
62
62
  - [ ] Search: results ranked by title (3) > tags (2) > summary (1) match
63
63
  - [ ] Show: full insight displayed with phase context and routed-artifact link if any
64
- - [ ] No file modifications outside `.workflow/knowhow/`
64
+ - [ ] No file modifications outside `.workflow/specs/learnings.md` and `.workflow/knowhow/`
65
65
  - [ ] Confirmation banner displayed with INS-id and next-step hints
66
66
  - [ ] Next step: `/manage-learn list` to browse, or `/manage-learn search <query>` to find related insights
67
67
  </success_criteria>
@@ -42,13 +42,13 @@ Phase or task: $ARGUMENTS (required — phase number)
42
42
 
43
43
  **Intelligent routing** (auto-detected from project state):
44
44
 
45
- | Priority | Condition | Route | Equivalent to |
46
- |----------|-----------|-------|---------------|
45
+ | Priority | Condition | Route | Reference skill |
46
+ |----------|-----------|-------|-----------------|
47
47
  | 1 | Active session exists (state.json status=running) | Resume | — |
48
48
  | 2 | --re-run flag + previous failures | Re-run | — |
49
- | 3 | Spec package exists (REQ-*.md) | spec | quality-business-test |
50
- | 4 | Nyquist gaps exist (verification.json) | gap | quality-test-gen |
51
- | 5 | Default | code | quality-integration-test |
49
+ | 3 | Spec package exists (REQ-*.md) | spec | quality-business-test (separate skill) |
50
+ | 4 | Nyquist gaps exist (verification.json) | gap | quality-test-gen (separate skill) |
51
+ | 5 | Default | code | quality-integration-test (separate skill) |
52
52
 
53
53
  Flags, artifact context resolution, and output formats defined in workflow auto-test.md.
54
54
 
@@ -48,7 +48,7 @@ After successful refactoring, ask user once: "Record refactoring pattern as codi
48
48
 
49
49
  **Next-step routing on completion:**
50
50
  - All tests pass → `/quality-sync` (update codebase docs)
51
- - Test failures after refactor → `/quality-debug {scope}`
51
+ - Test failures after refactor → `/quality-debug "test failures after refactor in {scope}"`
52
52
  - No test suite available → `/quality-auto-test {phase}`
53
53
  </execution>
54
54
 
@@ -15,7 +15,7 @@ allowed-tools:
15
15
  <!-- Open-standard mirror generated by scripts/build-agents-standard.mjs — do not edit; re-run after editing .claude/ source. -->
16
16
 
17
17
  <purpose>
18
- Post-execution multi-perspective retrospective (复盘) for completed phases. Consumes existing execution artifacts (verification.json, review.json, issues.jsonl, plan.json, .summaries/, uat.md, state.json) and runs four parallel lenses — technical, process, quality, decision — to distill reusable insights. Routes each insight into the appropriate store: spec stub for reusable patterns, memory tip for process notes, issue for recurring gaps. Auto-scans for unreviewed completed phases and reports the backlog. Every insight is also persisted to `.workflow/knowhow/specs/learnings.md` as `<spec-entry>` blocks for cross-phase queryability.
18
+ Post-execution multi-perspective retrospective (复盘) for completed phases. Consumes existing execution artifacts (verification.json, review.json, issues.jsonl, plan.json, .summaries/, uat.md, state.json) and runs four parallel lenses — technical, process, quality, decision — to distill reusable insights. Routes each insight into the appropriate store: spec stub for reusable patterns, memory tip for process notes, issue for recurring gaps. Auto-scans for unreviewed completed phases and reports the backlog. Every insight is also persisted to `.workflow/specs/learnings.md` as `<spec-entry>` blocks for cross-phase queryability.
19
19
  </purpose>
20
20
 
21
21
  <required_reading>
@@ -72,7 +72,7 @@ Follow `~/.maestro/workflows/retrospective.md` Stages 1–8 in order. Key invari
72
72
  - [ ] Spec entries (if any) appended as `<spec-entry>` to matching `.workflow/specs/{category-file}.md`
73
73
  - [ ] Issue rows (if any) match canonical issues.jsonl schema (status "open", full issue_history, all required fields)
74
74
  - [ ] Note tips (if any) created via `invoke_skill({ skill: "manage-learn", args: "tip ..." })`
75
- - [ ] `specs/learnings.md` appended with one `<spec-entry>` per insight regardless of routing target
75
+ - [ ] `.workflow/specs/learnings.md` appended with one `<spec-entry>` per insight regardless of routing target
76
76
  - [ ] No existing phase artifacts modified (verification.json, review.json, plan.json untouched)
77
77
  - [ ] Confirmation banner displays routing counts and next-step suggestions
78
78
  - [ ] Next step: `/manage-status` to review state, or `/manage-issue list --source retrospective` to triage created issues, or `/manage-learn list` to browse the knowhow library
@@ -18,6 +18,10 @@ Systematic security audit covering OWASP Top 10, dependency supply chain, secret
18
18
  CI/CD pipeline review, and optional STRIDE threat modeling. Three tiers control depth vs speed.
19
19
  </purpose>
20
20
 
21
+ <required_reading>
22
+ @~/.maestro/workflows/review.md
23
+ </required_reading>
24
+
21
25
  <context>
22
26
  $ARGUMENTS — Parse tier and scope:
23
27
  - Tier: `quick` (default) | `standard` | `deep`
@@ -145,6 +149,26 @@ CONCERNS: {count} critical findings require immediate action
145
149
  NEXT: /quality-review
146
150
  --- END STATUS ---
147
151
  ```
152
+
153
+ **Register artifact on completion** (so retrospective/harvest can trace this audit):
154
+ ```
155
+ Append to state.json.artifacts[]:
156
+ {
157
+ id: nextArtifactId(artifacts, "review"), // RVW-NNN (security-audit reuses review type)
158
+ type: "review",
159
+ subtype: "security-audit",
160
+ milestone: current_milestone || null,
161
+ phase: target_phase || null,
162
+ scope: target_phase ? "phase" : "standalone",
163
+ path: "scratch/{YYYYMMDD}-security-audit-{tier}-{slug}",
164
+ status: critical_count == 0 ? "completed" : "completed_with_concerns",
165
+ tier: tier, // quick|standard|deep
166
+ harvested: false,
167
+ created_at: start_time,
168
+ completed_at: now()
169
+ }
170
+ ```
171
+ Write findings report to the same `path` (severity matrix, file:line refs, remediation).
148
172
  </execution>
149
173
 
150
174
  <success_criteria>
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: spec-remove
3
3
  description: Remove spec entry by ID
4
- argument-hint: "<entry-id>"
4
+ argument-hint: "<entry-id> [--cascade]"
5
5
  allowed-tools:
6
6
  - read_file
7
7
  - write_file
@@ -28,6 +28,9 @@ $ARGUMENTS -- expects `<entry-id>` (e.g., `spec-learnings-003`, `spec-coding-con
28
28
  **Entry ID format**: `spec-{file-stem}-{NNN}` — the sub-node ID assigned by WikiIndexer when indexing `<spec-entry>` blocks.
29
29
 
30
30
  **Discovery**: Use `maestro wiki list --type spec --json` or `/spec-load --keyword <term>` to find entry IDs.
31
+
32
+ **Flags:**
33
+ - `--cascade` — When the target spec is a ref-type entry (created via `spec-add --ref` and linked to a knowhow document), also delete the referenced knowhow file. Without this flag, ref-type removal leaves an orphan knowhow file.
31
34
  </context>
32
35
 
33
36
  <execution>
@@ -49,5 +52,6 @@ Follow '~/.maestro/workflows/specs-remove.md' completely.
49
52
  - [ ] User confirmed removal (unless -y flag)
50
53
  - [ ] Entry removed from container file via `maestro wiki remove-entry`
51
54
  - [ ] Wiki index auto-updated
52
- - [ ] Confirmation displayed with removed entry details
55
+ - [ ] If `--cascade` and entry has a `ref` attribute: referenced knowhow file deleted, orphan avoided
56
+ - [ ] Confirmation displayed with removed entry details (and cascaded knowhow path if applicable)
53
57
  </success_criteria>
@@ -16,9 +16,9 @@ You produce a set of analysis files for one role in a brainstorm session, organi
16
16
  | Field | Required | Notes |
17
17
  |---|---|---|
18
18
  | `role_name` | yes | kebab-case slug, e.g. `system-architect` |
19
- | `role_template_path` | yes | `~/.maestro/templates/planning-roles/{role}.md` |
20
- | `guidance_path` | yes | path to `guidance-specification.md` |
21
- | `output_dir` | yes | absolute path to role folder — `{session_dir}/{role}/` |
19
+ | `role_template_path` | yes | **absolute** path to `planning-roles/{role}.md` (orchestrator MUST expand `~/`) |
20
+ | `guidance_path` | yes | **absolute** path to `guidance-specification.md` |
21
+ | `output_dir` | yes | **absolute** path to role folder — `{session_dir}/{role}/`. If you receive a relative path or a literal `{output_dir}` placeholder, fail fast with `TASK BLOCKED: output_dir is not absolute`. |
22
22
  | `feature_list` | optional | F-id + slug + title rows; if missing, fall back to non-feature organization |
23
23
  | `design_research` | optional | external research markdown to integrate as evidence |
24
24
  | `project_specs` | optional | pre-loaded `maestro spec load` output |
@@ -27,7 +27,9 @@ You produce a set of analysis files for one role in a brainstorm session, organi
27
27
 
28
28
  ## Output Contract
29
29
 
30
- Write files to `output_dir/`. Do NOT write files anywhere else.
30
+ Write files to `output_dir/` using the Write tool. Do NOT write files anywhere else. Do NOT return analysis as chat text — files on disk are the only valid deliverable. After writing, verify with Glob that `analysis.md` exists; if any Write call fails (e.g. relative path rejected), fail fast with `TASK BLOCKED`.
31
+
32
+ **Authority note**: This Output Contract is authoritative for file layout. The role template at `role_template_path` may contain a legacy "## Brainstorming Analysis Structure" section describing a single-file layout — ignore it for file structure. Use the role template ONLY to source §3 subsection headings (via its "## MUST-Have Sections (Brainstorming)" block when present).
31
33
 
32
34
  ### File Structure
33
35
 
@@ -27,8 +27,8 @@ $ARGUMENTS — target path/module and optional flags.
27
27
  - `--save-spec`: `Skill("spec-add")` for each new pattern
28
28
  - `--save-wiki`: create wiki note per dimension group
29
29
 
30
- **Storage read**: target files + `coding-conventions.md` + `specs/learnings.md` (dedup)
31
- **Storage write**: `.workflow/knowhow/KNW-decompose-{slug}-{date}.md` + append `specs/learnings.md`
30
+ **Storage read**: target files + `coding-conventions.md` + `.workflow/specs/learnings.md` (dedup)
31
+ **Storage write**: `.workflow/knowhow/KNW-decompose-{slug}-{date}.md` + append `.workflow/specs/learnings.md`
32
32
  </context>
33
33
 
34
34
  <state_machine>
@@ -49,7 +49,7 @@ S_RESOLVE:
49
49
  → S_RESOLVE WHEN: unresolvable DO: ask_question
50
50
 
51
51
  S_DEDUP:
52
- → S_ANALYZE DO: read coding-conventions.md + specs/learnings.md → build known pattern set
52
+ → S_ANALYZE DO: read coding-conventions.md + .workflow/specs/learnings.md → build known pattern set
53
53
 
54
54
  S_ANALYZE:
55
55
  → S_CROSSREF DO: A_PARALLEL_DIMENSION_ANALYSIS
@@ -61,7 +61,7 @@ S_CATALOG:
61
61
  → S_PERSIST DO: write KNW-decompose report (grouped by dimension: pattern table + details)
62
62
 
63
63
  S_PERSIST:
64
- → END DO: append specs/learnings.md [+ spec-add if --save-spec] [+ wiki note if --save-wiki]
64
+ → END DO: append .workflow/specs/learnings.md [+ spec-add if --save-spec] [+ wiki note if --save-wiki]
65
65
 
66
66
  </transitions>
67
67
 
@@ -88,7 +88,7 @@ For each finding, match against known pattern set:
88
88
  | Status | Condition |
89
89
  |--------|-----------|
90
90
  | documented | Already in coding-conventions.md |
91
- | known | In specs/learnings.md |
91
+ | known | In .workflow/specs/learnings.md |
92
92
  | new | Not seen before |
93
93
 
94
94
  Flag contradictions (finding conflicts with documented convention). Merge duplicates across agents (same pattern found by multiple dimensions).
@@ -108,7 +108,7 @@ Flag contradictions (finding conflicts with documented convention). Merge duplic
108
108
  <success_criteria>
109
109
  - [ ] 4 dimension agents spawned in parallel, findings with anchors
110
110
  - [ ] Cross-reference: documented/known/new status assigned
111
- - [ ] Pattern catalog written + specs/learnings.md appended
111
+ - [ ] Pattern catalog written + .workflow/specs/learnings.md appended
112
112
  </success_criteria>
113
113
 
114
114
  <next_step_routing>
@@ -14,7 +14,7 @@ allowed-tools:
14
14
  - write_to_file
15
15
  ---
16
16
  <purpose>
17
- Guided reading: walk through content section-by-section using forcing questions to extract patterns, identify assumptions, and build an understanding map. Findings persist to `specs/learnings.md` as `<spec-entry>` blocks.
17
+ Guided reading: walk through content section-by-section using forcing questions to extract patterns, identify assumptions, and build an understanding map. Findings persist to `.workflow/specs/learnings.md` as `<spec-entry>` blocks.
18
18
  </purpose>
19
19
 
20
20
  <context>
@@ -32,8 +32,8 @@ $ARGUMENTS — target and optional flags.
32
32
  - `--depth deep`: every function, every branch, every assumption
33
33
  - `--save-wiki`: create wiki note entry with reading notes
34
34
 
35
- **Storage read**: target file + wiki forward/backlinks + `coding-conventions.md` + `specs/learnings.md` (dedup)
36
- **Storage write**: `.workflow/knowhow/KNW-follow-{slug}-{date}.md` + append `specs/learnings.md`
35
+ **Storage read**: target file + wiki forward/backlinks + `coding-conventions.md` + `.workflow/specs/learnings.md` (dedup)
36
+ **Storage write**: `.workflow/knowhow/KNW-follow-{slug}-{date}.md` + append `.workflow/specs/learnings.md`
37
37
  </context>
38
38
 
39
39
  <state_machine>
@@ -66,7 +66,7 @@ S_EXTRACT:
66
66
  → S_PERSIST DO: A_EXTRACT_PATTERNS
67
67
 
68
68
  S_PERSIST:
69
- → END DO: write KNW-follow + append specs/learnings.md [+ wiki note if --save-wiki]
69
+ → END DO: write KNW-follow + append .workflow/specs/learnings.md [+ wiki note if --save-wiki]
70
70
 
71
71
  </transitions>
72
72
 
@@ -30,9 +30,9 @@ $ARGUMENTS — question text and optional flags.
30
30
  - `.workflow/knowhow/KNW-investigate-{slug}/evidence.ndjson` — structured evidence (one JSON line per item)
31
31
  - `.workflow/knowhow/KNW-investigate-{slug}/understanding.md` — evolving understanding
32
32
  - `.workflow/knowhow/KNW-investigate-{slug}/report.md` — final report
33
- - `specs/learnings.md` — appended `<spec-entry>` blocks
33
+ - `.workflow/specs/learnings.md` — appended `<spec-entry>` blocks
34
34
 
35
- **Storage read**: source files in scope + `maestro wiki search` + `specs/learnings.md` + `debug-notes.md` + `codebase/architecture.md`
35
+ **Storage read**: source files in scope + `maestro wiki search` + `.workflow/specs/learnings.md` + `debug-notes.md` + `codebase/architecture.md`
36
36
  </context>
37
37
 
38
38
  <state_machine>
@@ -45,7 +45,7 @@ S_HYPOTHESIZE — 生成假设列表 PERSIST:
45
45
  S_CLI_EXPLORE — CLI 辅助探索(可选) PERSIST: evidence.ndjson (append)
46
46
  S_TEST — 逐假设测试 PERSIST: evidence.ndjson + understanding.md
47
47
  S_ESCALATE — 3-strike 升级 PERSIST: —
48
- S_REPORT — 综合报告 + persist PERSIST: report.md + specs/learnings.md
48
+ S_REPORT — 综合报告 + persist PERSIST: report.md + .workflow/specs/learnings.md
49
49
  </states>
50
50
 
51
51
  <transitions>
@@ -57,7 +57,7 @@ S_EVIDENCE:
57
57
  → S_PATTERN DO: A_COLLECT_EVIDENCE
58
58
 
59
59
  S_PATTERN:
60
- → S_HYPOTHESIZE DO: match evidence against debug-notes.md + specs/learnings.md patterns
60
+ → S_HYPOTHESIZE DO: match evidence against debug-notes.md + .workflow/specs/learnings.md patterns
61
61
 
62
62
  S_HYPOTHESIZE:
63
63
  → S_CLI_EXPLORE WHEN: CLI tools enabled AND hypotheses non-trivial DO: A_FORM_HYPOTHESES
@@ -85,7 +85,7 @@ S_REPORT:
85
85
  ### A_FRAME_QUESTION
86
86
 
87
87
  1. Parse question, generate slug, create KNW-investigate-{slug}/
88
- 2. Search prior knowledge: `maestro wiki search "<question>"` + search specs/learnings.md + read debug-notes.md
88
+ 2. Search prior knowledge: `maestro wiki search "<question>"` + search .workflow/specs/learnings.md + read debug-notes.md
89
89
  3. Write initial understanding.md (question, prior knowledge summary, scope, timestamp)
90
90
 
91
91
  ### A_COLLECT_EVIDENCE
@@ -126,7 +126,7 @@ For each hypothesis (rank order):
126
126
  ### A_SYNTHESIZE_REPORT
127
127
 
128
128
  Write report.md: Answer (or INCONCLUSIVE), Evidence Trail table, Hypotheses Tested table, Key Learnings, Open Questions.
129
- Append to specs/learnings.md: confirmed → roles="implement", disproved → roles="analyze" (gotcha).
129
+ Append to .workflow/specs/learnings.md: confirmed → roles="implement", disproved → roles="analyze" (gotcha).
130
130
 
131
131
  </actions>
132
132
 
@@ -16,7 +16,7 @@ allowed-tools:
16
16
  <purpose>
17
17
  Unified retrospective combining git activity analysis and decision quality evaluation. Works on raw git history and wiki/spec data. Two lenses (git, decision), usable independently or together.
18
18
 
19
- All insights persist to `specs/learnings.md` as `<spec-entry>` blocks.
19
+ All insights persist to `.workflow/specs/learnings.md` as `<spec-entry>` blocks.
20
20
  </purpose>
21
21
 
22
22
  <context>
@@ -30,9 +30,9 @@ $ARGUMENTS — lens selection and scope flags.
30
30
  **Storage write**:
31
31
  - `.workflow/knowhow/KNW-retro-{date}.md` — unified report
32
32
  - `.workflow/knowhow/KNW-retro-{date}.json` — structured metrics
33
- - `specs/learnings.md` — appended `<spec-entry>` blocks (source: retro-git / retro-decision)
33
+ - `.workflow/specs/learnings.md` — appended `<spec-entry>` blocks (source: retro-git / retro-decision)
34
34
 
35
- **Storage read**: git history, `.workflow/state.json`, prior `KNW-retro-*.json`, `specs/learnings.md`, wiki specs, `architecture-constraints.md`, phase context files
35
+ **Storage read**: git history, `.workflow/state.json`, prior `KNW-retro-*.json`, `.workflow/specs/learnings.md`, wiki specs, `architecture-constraints.md`, phase context files
36
36
  </context>
37
37
 
38
38
  <state_machine>
@@ -42,7 +42,7 @@ S_PARSE — 解析 lens + flags PERSIST: —
42
42
  S_GIT — git 活动分析(lens=git/all 时) PERSIST: metrics
43
43
  S_DECISION — 决策质量评估(lens=decision/all 时) PERSIST: evaluations
44
44
  S_REPORT — 生成统一报告 PERSIST: .md + .json
45
- S_PERSIST — 写 spec-entry 块 PERSIST: specs/learnings.md
45
+ S_PERSIST — 写 spec-entry 块 PERSIST: .workflow/specs/learnings.md
46
46
  </states>
47
47
 
48
48
  <transitions>
@@ -62,7 +62,7 @@ S_REPORT:
62
62
  → S_PERSIST DO: write KNW-retro-{date}.md + .json
63
63
 
64
64
  S_PERSIST:
65
- → END DO: append insights to specs/learnings.md via `maestro spec add learning`
65
+ → END DO: append insights to .workflow/specs/learnings.md via `maestro spec add learning`
66
66
  RULE: INS-id = hash(lens + metric_or_decision_id + date) for cross-session stability
67
67
 
68
68
  </transitions>
@@ -104,7 +104,7 @@ maestro wiki search "decision" --json
104
104
  maestro wiki list --type spec --json
105
105
  git log --oneline --all --grep="decision\|chose\|decided" -20
106
106
  ```
107
- Plus: architecture-constraints.md, phase context Locked/Deferred sections, specs/learnings.md.
107
+ Plus: architecture-constraints.md, phase context Locked/Deferred sections, .workflow/specs/learnings.md.
108
108
  Apply --phase/--tag/--id filters.
109
109
 
110
110
  **Build registry** per decision: id, title, source, date, rationale, alternatives, phase, implementation_evidence [file paths].
@@ -148,7 +148,7 @@ Apply --phase/--tag/--id filters.
148
148
  - [ ] Git lens: metrics computed (commits, LOC, test ratio, churn, sessions), insights distilled
149
149
  - [ ] Decision lens: decisions collected, 3 agents evaluated in parallel, lifecycle classified
150
150
  - [ ] Unified report + structured JSON written
151
- - [ ] specs/learnings.md appended with stable INS-ids
151
+ - [ ] .workflow/specs/learnings.md appended with stable INS-ids
152
152
  </success_criteria>
153
153
 
154
154
  <next_step_routing>
@@ -19,7 +19,7 @@ Structured second-opinion on code, decisions, or plans. Three modes:
19
19
  - **challenge**: single adversarial agent — break assumptions, propose alternatives
20
20
  - **consult**: interactive Q&A — agent studies target, answers your questions
21
21
 
22
- Findings persist to `specs/learnings.md` as `<spec-entry>` blocks.
22
+ Findings persist to `.workflow/specs/learnings.md` as `<spec-entry>` blocks.
23
23
  </purpose>
24
24
 
25
25
  <context>
@@ -47,7 +47,7 @@ S_RESOLVE — 解析 target PERSIST: —
47
47
  S_CONTEXT — 加载 specs/wiki 上下文 PERSIST: —
48
48
  S_EXECUTE — 按 mode 执行分析 PERSIST: —
49
49
  S_SYNTHESIZE — 综合观点、生成报告 PERSIST: outputs
50
- S_PERSIST — 写文件、append specs/learnings.md PERSIST: knowhow files
50
+ S_PERSIST — 写文件、append .workflow/specs/learnings.md PERSIST: knowhow files
51
51
  </states>
52
52
 
53
53
  <transitions>
@@ -68,7 +68,7 @@ S_SYNTHESIZE:
68
68
  → S_PERSIST DO: merge perspectives → agreements, disagreements, verdict, top 3 recommendations
69
69
 
70
70
  S_PERSIST:
71
- → END DO: write KNW-opinion + append <spec-entry> blocks to specs/learnings.md
71
+ → END DO: write KNW-opinion + append <spec-entry> blocks to .workflow/specs/learnings.md
72
72
 
73
73
  </transitions>
74
74
 
@@ -114,7 +114,7 @@ Interactive loop:
114
114
  <success_criteria>
115
115
  - [ ] Mode executed: review (3 parallel agents) / challenge (adversarial) / consult (interactive Q&A)
116
116
  - [ ] Synthesis with agreements, disagreements, verdict
117
- - [ ] Report written + findings appended to specs/learnings.md
117
+ - [ ] Report written + findings appended to .workflow/specs/learnings.md
118
118
  </success_criteria>
119
119
 
120
120
  <next_step_routing>
@@ -147,6 +147,7 @@ On validation failure: fix JSON, retry (max 2).
147
147
  | Code | Condition | Recovery |
148
148
  |------|-----------|----------|
149
149
  | E001 | No signals from any source | Verify artifact paths or provide description |
150
+ | E002 | Signal source path invalid or unreadable | Check `--from-*` path; ensure artifact exists |
150
151
  | E003 | All signals are code bugs, not command gaps | Use /maestro-quick or /maestro-plan --gaps |
151
152
  | E004 | Overlay validation failed after 2 retries | Review JSON manually |
152
153
  | W001 | Some signals skipped (code bugs) | Route to appropriate fix command |
@@ -40,6 +40,12 @@ $ARGUMENTS -- phase number for micro mode, topic text for macro/adhoc mode, no a
40
40
  - **Macro mode** (text argument): Explore impact surface of a topic/requirement. Produces coarse-grained context with `scope_verdict` to route next step. Use before roadmap or for standalone analysis.
41
41
  - **Micro mode** (numeric argument): Phase-level deep analysis within an existing roadmap. Produces fine-grained context for plan consumption. `analyze 1` = Phase 1 of current milestone.
42
42
 
43
+ **Disambiguation rule (mode selection):**
44
+ - First positional arg matches `^\d+$` (pure digits, e.g. `1`, `42`) → **micro mode** (treat as phase number)
45
+ - First positional arg is non-numeric text (e.g. `auth-refactor`, `improve search`) → **macro mode** (treat as topic)
46
+ - No positional arg → milestone-wide micro mode (when roadmap present) else macro fallback
47
+ - Mixed input like `"1 phase"` is treated as text → macro mode (only bare numerics trigger micro)
48
+
43
49
  **Flags:**
44
50
  - `-y` / `--yes`: Auto mode — skip interactive scoping, use recommended defaults, auto-deepen
45
51
  - `-c` / `--continue`: Resume from existing session (auto-detect session folder + discussion.md)
@@ -56,14 +62,15 @@ Scope routing, output directory format, artifact registration schema, and output
56
62
  <interview_protocol>
57
63
  Interview the user relentlessly until shared understanding is reached. Active only in interactive mode; skip when `-y/--yes`, `-c/--continue`, or input is already specific (explicit phase number or unambiguous topic).
58
64
 
59
- - One decision per turn via ask_question with 2–4 options + a (Recommended) default; every question must include a `Proceed now` option so the user can end the interview at any time.
60
- - Never ask what code can verify — resolve via `state.json`, `roadmap.md`, `issues.jsonl`, `maestro spec load`, `maestro wiki search`, Grep, or Read.
65
+ - One decision per turn via ask_question with 2–4 options + a (Recommended) default. The user controls termination keep interviewing until convergence; they can interrupt naturally or via `Other` at any time.
66
+ - Search-first when uncertain: before asking, resolve via `state.json`, `roadmap.md`, `issues.jsonl`, `maestro spec load`, `maestro wiki search`, Grep, Read, or — for open-ended multi-file scans — spawn `invoke_subagent([{ TypeName: "<TypeName>", Role: "<Role>", Prompt: "<Prompt>", Workspace: "inherit" }])` / `maestro delegate ... --role explore`. Never ask what code or memory can verify; never bounce your own ambiguity back to the user — search first, then ask only what truly needs human judgment.
67
+ - Writeback cadence: each settled decision is immediately appended/updated in `discussion.md` (top table) and mirrored into `context.md` "Interview Decisions". Do NOT batch writeback to the end — partial decisions must already be on disk before the next question.
61
68
  - Walk the decision dependency tree strictly: scope → depth → dimensions → Go/No-Go threshold. Do not open the next branch until the current one is settled.
62
69
  - Scope guard: only ask about decisions owned by `analyze`. Do not prejudge plan/execute concerns.
63
70
 
64
71
  Decision points: scope (phase / topic / milestone-wide / adhoc / --gaps) → depth (quick / standard / deep) → dimensions (which of the 6 to keep) → Go/No-Go threshold.
65
72
 
66
- Exit: on `Proceed now` or when all decision points are settled, write the table below to the top of `discussion.md` and mirror it into `context.md` under an `Interview Decisions` section:
73
+ Exit: when all decision points are settled (or user explicitly signals to proceed), finalize session metadata. The decision table (populated incrementally during interview) uses this schema:
67
74
  `| # | Decision | Choice | Source (user / code / default) |`
68
75
  </interview_protocol>
69
76
 
@@ -66,14 +66,15 @@ maestro-analyze → maestro-roadmap → maestro-plan
66
66
  <interview_protocol>
67
67
  Interview the user relentlessly about every aspect of the spec until shared understanding is reached. Walk down each branch of the design tree, resolving dependencies between decisions one-by-one; if a question can be answered by exploring the codebase, explore the codebase instead. Active only in interactive mode; skip when `-y/--yes`, `-c/--continue`, or input is already specific (clear idea + scope).
68
68
 
69
- - Ask one question per turn via ask_question and wait for the user's feedback before continuing; every question must carry a recommended answer marked `(Recommended)`, 2–4 options total, and a `Proceed now` option.
70
- - Never ask what code can verify — resolve via `state.json`, existing artifacts, `maestro spec load`, or direct codebase exploration (Glob/Grep/Read) instead of prompting.
69
+ - Ask one question per turn via ask_question and wait for the user's feedback before continuing; every question must carry a recommended answer marked `(Recommended)`, 2–4 options total. The user controls termination — keep interviewing until convergence; they can interrupt naturally or via `Other` at any time.
70
+ - Search-first when uncertain: before asking, resolve via `state.json`, existing artifacts, `maestro spec load`, direct codebase exploration (Glob/Grep/Read), or for open-ended multi-file scans — spawn `invoke_subagent([{ TypeName: "<TypeName>", Role: "<Role>", Prompt: "<Prompt>", Workspace: "inherit" }])` / `maestro delegate ... --role explore`. Never ask what code or memory can verify; never bounce your own ambiguity back to the user — search first, then ask only what truly needs human judgment.
71
+ - Writeback cadence: each settled decision is immediately persisted into `blueprint-config.json` before the next question. Do NOT batch writeback to the end — partial decisions must already be on disk.
71
72
  - Walk the decision dependency tree depth-first: scope → spec type → focus areas → requirement priorities. Do not open the next branch until the current one is settled.
72
73
  - Scope guard: only decide the shape of the specification. Do not pre-resolve roadmap phases or plan tasks — those belong to downstream commands.
73
74
 
74
75
  Decision points: scope (full product / feature set / single feature) → spec type (service / api / library / platform) → focus areas → whether to run codebase exploration.
75
76
 
76
- Exit: on consensus or `Proceed now`, persist decisions in blueprint-config.json and proceed to Phase 1.
77
+ Exit: on consensus or explicit user signal to proceed, finalize blueprint-config.json (decisions already written incrementally) and proceed to Phase 1.
77
78
  </interview_protocol>
78
79
 
79
80
  <execution>