pi-maestro-flow 0.2.0

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 (179) hide show
  1. package/README.md +124 -0
  2. package/agents/aggregator.md +27 -0
  3. package/agents/cli-explore-agent.md +188 -0
  4. package/agents/cross-role-reviewer.md +171 -0
  5. package/agents/delegate.md +19 -0
  6. package/agents/explorer.md +23 -0
  7. package/agents/impeccable-agent.md +99 -0
  8. package/agents/ralph-executor.md +81 -0
  9. package/agents/reference.md +24 -0
  10. package/agents/role-design-author.md +220 -0
  11. package/agents/team-supervisor.md +143 -0
  12. package/agents/team-worker.md +237 -0
  13. package/agents/ui-design-agent.md +270 -0
  14. package/agents/workflow-analyzer.md +116 -0
  15. package/agents/workflow-codebase-mapper.md +77 -0
  16. package/agents/workflow-collab-planner.md +147 -0
  17. package/agents/workflow-debugger.md +104 -0
  18. package/agents/workflow-executor.md +133 -0
  19. package/agents/workflow-external-researcher.md +86 -0
  20. package/agents/workflow-integration-checker.md +83 -0
  21. package/agents/workflow-nyquist-auditor.md +85 -0
  22. package/agents/workflow-phase-researcher.md +85 -0
  23. package/agents/workflow-plan-checker.md +100 -0
  24. package/agents/workflow-planner.md +200 -0
  25. package/agents/workflow-project-researcher.md +74 -0
  26. package/agents/workflow-research-synthesizer.md +70 -0
  27. package/agents/workflow-reviewer.md +82 -0
  28. package/agents/workflow-roadmapper.md +81 -0
  29. package/agents/workflow-verifier.md +120 -0
  30. package/package.json +58 -0
  31. package/skills/codify-to-knowhow/SKILL.md +167 -0
  32. package/skills/delegation-check/SKILL.md +297 -0
  33. package/skills/domain-add/SKILL.md +75 -0
  34. package/skills/insight-challenge/SKILL.md +226 -0
  35. package/skills/learn-decompose/SKILL.md +124 -0
  36. package/skills/learn-follow/SKILL.md +163 -0
  37. package/skills/learn-investigate/SKILL.md +160 -0
  38. package/skills/learn-second-opinion/SKILL.md +128 -0
  39. package/skills/maestro/SKILL.md +239 -0
  40. package/skills/maestro-amend/SKILL.md +169 -0
  41. package/skills/maestro-analyze/SKILL.md +173 -0
  42. package/skills/maestro-blueprint/SKILL.md +159 -0
  43. package/skills/maestro-brainstorm/SKILL.md +193 -0
  44. package/skills/maestro-collab/SKILL.md +181 -0
  45. package/skills/maestro-companion/SKILL.md +536 -0
  46. package/skills/maestro-composer/SKILL.md +192 -0
  47. package/skills/maestro-execute/SKILL.md +193 -0
  48. package/skills/maestro-fork/SKILL.md +104 -0
  49. package/skills/maestro-grill/SKILL.md +151 -0
  50. package/skills/maestro-guard/SKILL.md +124 -0
  51. package/skills/maestro-help/SKILL.md +328 -0
  52. package/skills/maestro-impeccable/SKILL.md +302 -0
  53. package/skills/maestro-init/SKILL.md +151 -0
  54. package/skills/maestro-merge/SKILL.md +90 -0
  55. package/skills/maestro-milestone-audit/SKILL.md +117 -0
  56. package/skills/maestro-milestone-complete/SKILL.md +133 -0
  57. package/skills/maestro-milestone-release/SKILL.md +131 -0
  58. package/skills/maestro-next/SKILL.md +269 -0
  59. package/skills/maestro-overlay/SKILL.md +203 -0
  60. package/skills/maestro-plan/SKILL.md +194 -0
  61. package/skills/maestro-player/SKILL.md +184 -0
  62. package/skills/maestro-quick/SKILL.md +117 -0
  63. package/skills/maestro-ralph/SKILL.md +905 -0
  64. package/skills/maestro-ralph-cli/SKILL.md +976 -0
  65. package/skills/maestro-ralph-cli-execute/SKILL.md +229 -0
  66. package/skills/maestro-ralph-execute/SKILL.md +409 -0
  67. package/skills/maestro-ralph-v2/SKILL.md +1198 -0
  68. package/skills/maestro-roadmap/SKILL.md +157 -0
  69. package/skills/maestro-swarm-workflow/SKILL.md +272 -0
  70. package/skills/maestro-tools-execute/SKILL.md +143 -0
  71. package/skills/maestro-tools-register/SKILL.md +192 -0
  72. package/skills/maestro-ui-codify/SKILL.md +127 -0
  73. package/skills/maestro-universal-workflow/SKILL.md +622 -0
  74. package/skills/maestro-update/SKILL.md +156 -0
  75. package/skills/manage-codebase-rebuild/SKILL.md +111 -0
  76. package/skills/manage-drift-realign/SKILL.md +159 -0
  77. package/skills/manage-harvest/SKILL.md +121 -0
  78. package/skills/manage-issue/SKILL.md +88 -0
  79. package/skills/manage-issue-discover/SKILL.md +104 -0
  80. package/skills/manage-kg-extractors/SKILL.md +147 -0
  81. package/skills/manage-knowhow/SKILL.md +102 -0
  82. package/skills/manage-knowhow-capture/SKILL.md +109 -0
  83. package/skills/manage-knowledge-audit/SKILL.md +147 -0
  84. package/skills/manage-status/SKILL.md +80 -0
  85. package/skills/manage-wiki/SKILL.md +104 -0
  86. package/skills/odyssey-debug/SKILL.md +344 -0
  87. package/skills/odyssey-improve/SKILL.md +423 -0
  88. package/skills/odyssey-planex/SKILL.md +542 -0
  89. package/skills/odyssey-review-test-fix/SKILL.md +392 -0
  90. package/skills/odyssey-ui/SKILL.md +388 -0
  91. package/skills/prompt-generator/SKILL.md +470 -0
  92. package/skills/quality-auto-test/SKILL.md +168 -0
  93. package/skills/quality-debug/SKILL.md +176 -0
  94. package/skills/quality-refactor/SKILL.md +108 -0
  95. package/skills/quality-retrospective/SKILL.md +134 -0
  96. package/skills/quality-review/SKILL.md +169 -0
  97. package/skills/quality-sync/SKILL.md +90 -0
  98. package/skills/quality-test/SKILL.md +183 -0
  99. package/skills/scholar-anti-ai-writing/SKILL.md +173 -0
  100. package/skills/scholar-anti-ai-writing/references/patterns-chinese.md +242 -0
  101. package/skills/scholar-anti-ai-writing/references/patterns-english.md +242 -0
  102. package/skills/scholar-citation-verify/SKILL.md +166 -0
  103. package/skills/scholar-citation-verify/references/api-usage.md +372 -0
  104. package/skills/scholar-citation-verify/references/common-errors.md +384 -0
  105. package/skills/scholar-citation-verify/references/verification-rules.md +399 -0
  106. package/skills/scholar-experiment/SKILL.md +321 -0
  107. package/skills/scholar-ideation/SKILL.md +288 -0
  108. package/skills/scholar-latex-organizer/SKILL.md +186 -0
  109. package/skills/scholar-publish/SKILL.md +220 -0
  110. package/skills/scholar-rebuttal-pro/README.md +313 -0
  111. package/skills/scholar-rebuttal-pro/SKILL.md +511 -0
  112. package/skills/scholar-review/SKILL.md +227 -0
  113. package/skills/scholar-thesis-docx/README.md +111 -0
  114. package/skills/scholar-thesis-docx/README_EN.md +108 -0
  115. package/skills/scholar-thesis-docx/SKILL.md +212 -0
  116. package/skills/scholar-thesis-docx/references/failure-patterns-and-quality-gates.md +178 -0
  117. package/skills/scholar-thesis-docx/references/figure-and-code-rules.md +33 -0
  118. package/skills/scholar-thesis-docx/references/paper-format-workflow.md +68 -0
  119. package/skills/scholar-thesis-docx/references/script-usage.md +157 -0
  120. package/skills/scholar-thesis-docx/scripts/audit_docx_ooxml.py +429 -0
  121. package/skills/scholar-thesis-docx/scripts/check_word_com.ps1 +50 -0
  122. package/skills/scholar-thesis-docx/scripts/export_word_pdf.ps1 +62 -0
  123. package/skills/scholar-thesis-docx/scripts/normalize_word_styles.ps1 +498 -0
  124. package/skills/scholar-thesis-docx/scripts/render_mermaid_figure.ps1 +148 -0
  125. package/skills/scholar-writing/SKILL.md +296 -0
  126. package/skills/security-audit/SKILL.md +244 -0
  127. package/skills/skill-generator/SKILL.md +472 -0
  128. package/skills/skill-iter-tune/SKILL.md +382 -0
  129. package/skills/skill-simplify/SKILL.md +63 -0
  130. package/skills/skill-tuning/SKILL.md +174 -0
  131. package/skills/spec-add/SKILL.md +105 -0
  132. package/skills/spec-load/SKILL.md +98 -0
  133. package/skills/spec-remove/SKILL.md +74 -0
  134. package/skills/spec-setup/SKILL.md +75 -0
  135. package/skills/team-adversarial-swarm/SKILL.md +233 -0
  136. package/skills/team-adversarial-swarm/scripts/__pycache__/pheromone.cpython-313.pyc +0 -0
  137. package/skills/team-adversarial-swarm/scripts/__pycache__/scoring.cpython-313.pyc +0 -0
  138. package/skills/team-adversarial-swarm/scripts/aco.py +473 -0
  139. package/skills/team-adversarial-swarm/scripts/pheromone.py +144 -0
  140. package/skills/team-adversarial-swarm/scripts/scoring.py +92 -0
  141. package/skills/team-adversarial-swarm/scripts/test_aco.py +475 -0
  142. package/skills/team-arch-opt/SKILL.md +158 -0
  143. package/skills/team-brainstorm/SKILL.md +171 -0
  144. package/skills/team-coordinate/SKILL.md +266 -0
  145. package/skills/team-designer/SKILL.md +160 -0
  146. package/skills/team-executor/SKILL.md +189 -0
  147. package/skills/team-frontend/SKILL.md +136 -0
  148. package/skills/team-frontend-debug/SKILL.md +198 -0
  149. package/skills/team-interactive-craft/SKILL.md +141 -0
  150. package/skills/team-issue/SKILL.md +171 -0
  151. package/skills/team-lifecycle-v4/SKILL.md +209 -0
  152. package/skills/team-motion-design/SKILL.md +142 -0
  153. package/skills/team-perf-opt/SKILL.md +175 -0
  154. package/skills/team-planex/SKILL.md +137 -0
  155. package/skills/team-quality-assurance/SKILL.md +147 -0
  156. package/skills/team-review/SKILL.md +147 -0
  157. package/skills/team-roadmap-dev/SKILL.md +169 -0
  158. package/skills/team-swarm/SKILL.md +178 -0
  159. package/skills/team-swarm/scripts/aco.py +473 -0
  160. package/skills/team-swarm/scripts/pheromone.py +144 -0
  161. package/skills/team-swarm/scripts/scoring.py +92 -0
  162. package/skills/team-swarm/scripts/test_aco.py +475 -0
  163. package/skills/team-tech-debt/SKILL.md +128 -0
  164. package/skills/team-testing/SKILL.md +143 -0
  165. package/skills/team-ui-polish/SKILL.md +141 -0
  166. package/skills/team-uidesign/SKILL.md +144 -0
  167. package/skills/team-ultra-analyze/SKILL.md +173 -0
  168. package/skills/team-ux-improve/SKILL.md +151 -0
  169. package/skills/team-visual-a11y/SKILL.md +156 -0
  170. package/skills/workflow-skill-designer/SKILL.md +496 -0
  171. package/src/extension/index.ts +222 -0
  172. package/src/extension/schemas.ts +131 -0
  173. package/src/providers/cli-tools-loader.ts +74 -0
  174. package/src/providers/provider-registry.ts +130 -0
  175. package/src/tools/delegate.ts +85 -0
  176. package/src/tools/explore.ts +134 -0
  177. package/src/tools/moa.ts +213 -0
  178. package/src/tools/status.ts +99 -0
  179. package/src/tools/wait.ts +166 -0
@@ -0,0 +1,239 @@
1
+ ---
2
+ name: maestro
3
+ description: "Auto-route intent to optimal command chain Arguments: <intent> [-y] [-c] [--dry-run] [--super]"
4
+ allowed-tools: Read Write Edit Bash Glob Grep Agent AskUserQuestion TodoWrite
5
+ ---
6
+
7
+ <purpose>
8
+ Orchestrate all maestro commands: classify intent → select chain → create session → dispatch to `maestro-ralph-execute`.
9
+ Session: `.workflow/.maestro/{session_id}/status.json`.
10
+ </purpose>
11
+
12
+ <deferred_reading>
13
+ - [maestro.md](~/.maestro/workflows/maestro.md) — read at execution start for intent analysis + chain selection
14
+ - [maestro-super.md](~/.maestro/workflows/maestro-super.md) — read when `--super` flag active
15
+ </deferred_reading>
16
+
17
+ <context>
18
+ $ARGUMENTS — user intent text, or special keywords.
19
+
20
+ **Keywords:** `continue`/`next`/`go` → state-based routing; `status` → `Skill("manage-status")`
21
+
22
+ **Flags:**
23
+ - `-y` / `--yes` — Auto mode: skip clarification, skip confirmation, auto-skip on errors
24
+ - `-c` / `--continue` — Resume previous session. **`-c` is reserved for `--continue` across all maestro commands** — downstream skills MUST NOT redefine `-c` for other purposes to prevent collision via transparent forwarding.
25
+ - `--dry-run` — Show chain without executing
26
+ - `--super` — Read and follow `maestro-super.md`
27
+ </context>
28
+
29
+ <invariants>
30
+ 1. **All chains dispatch via maestro-ralph-execute** — maestro never executes steps directly
31
+ 2. **Session before execution** — status.json created before any step runs
32
+ 3. **Auto flag pass-through** — 仅当用户传入 `-y` 时透传 `-y` 到 skill args
33
+ 4. **Decomposition contract — maestro owns** — `source=="maestro"` 的 session 由 maestro 拥有分解契约(`decomposition_owner="maestro"`):S_DECOMPOSE 产出 additive block (`boundary_contract`, `execution_criteria`, `task_decomposition`),下游 ralph 只消费不覆盖(当 `decomposition_owner == "maestro"` 时跳过二次提问,仅做 shape 校验 + 缺省字段补齐)
34
+ 5. **status.json 唯一真源** — 不生成 `goal-checklist.md` 或外部清单
35
+ 6. **执行步骤统一通过 `maestro ralph next` 加载** — `command_scope`/`command_path` 由 `maestro ralph skills --platform claude --json --quiet` 预校验(project 覆盖 global,限定 `.claude/`);decision 节点不走 CLI,走 `Skill("maestro-ralph")` handoff
36
+ 7. **Topology awareness** — chain catalog 含 grill / brainstorm / blueprint / analyze-macro / analyze / roadmap / plan(三路径) / execute / ...;scope_verdict 由 ralph 在 `post-analyze-scope` 决定
37
+ 8. **Grill `-y` 透传** — `-y` auto mode 透传 `-y` 到 grill args(grill 自身 Auto mode 用代码代答),不删除 grill stage;grill 仍产出 grill-report/terminology/context-package 供下游 brainstorm
38
+ 9. **D-007 milestone 反查** — 数字 phase 的 `milestone_id` 由 `state.json.milestones[].phase_slugs` 反查
39
+ 10. **每个 step 必须 `completion_confirmed: true`** — 由 `maestro ralph complete N --status DONE|DONE_WITH_CONCERNS` 写入
40
+ 11. **schema** — `ralph_protocol_version: "2"` 标记 CLI-driven session;新增字段全部可选
41
+ 12. **Invariant violation = BLOCK** — 违反上述任一 invariant 即阻断当前操作,不可绕过。特别是 invariant 1(dispatch via ralph-execute)和 invariant 2(session before execution)和 invariant 10(completion_confirmed 由 CLI 写入)为硬约束。
42
+ 13. **Classification evidence** — S_CLASSIFY 的 chain 选择决策 MUST 记录到 status.json 的 `classification_rationale` 字段:匹配了哪个 pattern、排除了哪些备选、confidence level。无记录的分类不可进入 S_CREATE。
43
+ 14. **禁止以上下文消耗为由中断执行** — harness 自动处理 context compression,以"上下文不足"或"避免 context overflow"为由中断属于 invariant violation
44
+ 15. **控制权优先级(范式治理)** — FSM(maestro/maestro-ralph)独占 session 生命周期 + step 排序 + cross-step decision 节点;Pipeline(plan/execute/analyze)只拥有自身 artifact GATE,由 ralph dispatch 时 GATE 失败 → `complete BLOCKED|NEEDS_RETRY`、自身 GATE 全过 → DONE;Router(maestro-next)只单次推荐,不得出现在 FSM step 内。
45
+ </invariants>
46
+
47
+ <state_machine>
48
+
49
+ <states>
50
+ S_PARSE — 解析参数、检测 flags PERSIST: —
51
+ S_RESUME — 扫描已有 session、恢复执行 PERSIST: —
52
+ S_CLASSIFY — 意图分类、chain 选择 PERSIST: —
53
+ S_DECOMPOSE — 边界澄清、写执行准则+子目标清单 PERSIST: session.boundary_contract, .execution_criteria, .task_decomposition
54
+ S_CREATE — 创建 session + status.json PERSIST: session (全量)
55
+ S_DRY_RUN — 显示 chain 后结束 PERSIST: —
56
+ S_CONFIRM — 用户确认(auto_mode 跳过) PERSIST: —
57
+ S_DISPATCH — 移交 maestro-ralph-execute PERSIST: —
58
+ S_FALLBACK — 意图无法分类、请求输入 PERSIST: —
59
+ </states>
60
+
61
+ <transitions>
62
+
63
+ S_PARSE:
64
+ → S_RESUME WHEN: -c / --continue flag
65
+ → S_CLASSIFY WHEN: intent text present
66
+ → S_CLASSIFY WHEN: keyword "continue"/"next"/"go" DO: A_STATE_BASED_ROUTE
67
+ → S_FALLBACK WHEN: no intent AND no flags
68
+
69
+ S_RESUME:
70
+ → S_DISPATCH WHEN: session found DO: A_LOCATE_SESSION
71
+ → S_FALLBACK WHEN: no session found
72
+
73
+ S_CLASSIFY:
74
+ → S_DECOMPOSE WHEN: chain resolved DO: A_CLASSIFY_INTENT
75
+ → S_FALLBACK WHEN: no match AND auto_mode
76
+ → S_CLASSIFY WHEN: no match AND not auto_mode DO: A_CLARIFY
77
+ GUARD: max 2 clarification rounds → S_FALLBACK
78
+
79
+ S_DECOMPOSE:
80
+ → S_CREATE DO: A_DECOMPOSE_TASKS
81
+ GUARD: broad intent (重构/全面/重写/迁移/overhaul/migrate/rewrite) on a multi-step lifecycle chain → MUST clarify even if auto_mode
82
+ GUARD: single-step chain OR narrow intent OR chain ∈ {status,init,quick} → skip decomposition (pass through)
83
+
84
+ S_CREATE:
85
+ → S_DRY_RUN WHEN: --dry-run flag DO: A_CREATE_SESSION
86
+ → S_CONFIRM WHEN: not auto_mode DO: A_CREATE_SESSION
87
+ → S_DISPATCH WHEN: auto_mode DO: A_CREATE_SESSION
88
+
89
+ S_DRY_RUN:
90
+ → END DO: display chain with step types
91
+
92
+ S_CONFIRM:
93
+ → S_DISPATCH WHEN: user confirms
94
+ → S_PARSE WHEN: user wants to modify
95
+ → END WHEN: user cancels
96
+
97
+ S_DISPATCH:
98
+ → END DO: Skill({ skill: "maestro-ralph-execute" })
99
+
100
+ S_FALLBACK:
101
+ → S_CLASSIFY WHEN: user provides new intent DO: AskUserQuestion
102
+ → END WHEN: user cancels
103
+
104
+ </transitions>
105
+
106
+ <actions>
107
+
108
+ ### A_STATE_BASED_ROUTE
109
+
110
+ 1. Read `.workflow/state.json` → determine next logical step
111
+ 2. Convert to equivalent intent for chain classification
112
+
113
+ ### A_LOCATE_SESSION
114
+
115
+ 1. Scan `.workflow/.maestro/*/status.json`, filter `status == "running"`, sort DESC
116
+ 2. Take most recent; if not found → S_FALLBACK
117
+
118
+ ### A_CLASSIFY_INTENT
119
+
120
+ 1. Read `~/.maestro/workflows/maestro.md` from deferred_reading
121
+ 2. Match intent to task_type via chain catalog (semantic)
122
+ 3. Select chain from chainMap,遵循拓扑约束:
123
+ - 压力测试/拷问/验证假设/grill/stress-test → `grill`(**-y 模式透传 `-y` 到 grill,grill 以 Auto mode 执行,不跳过**)
124
+ - 头脑风暴/探索 → `brainstorm`
125
+ - 学习/阅读代码/跟读/follow → `Skill("learn-follow")`;调查/为什么/investigate → `Skill("learn-investigate")`;分解/模式/decompose → `Skill("learn-decompose")`;评审/挑战/second-opinion → `Skill("learn-second-opinion")`;回顾/retro → `Skill("quality-retrospective")`
126
+ - 正式规格/spec-generate/7-phase → `blueprint`
127
+ - 项目初始化 → `init`
128
+ - 宽/中等意图 + 无数字 phase → `analyze-macro`(产 scope_verdict,由 ralph 在 `post-analyze-scope` 决定是否插入 roadmap+analyze 或直跳 plan --from analyze)
129
+ - 数字 milestone 上下文 → `analyze {milestone}` → `plan {milestone}` → `execute {milestone}` → quality pipeline
130
+ - 已有 analyze artifact 想直达执行 → `plan --from analyze:{ANL_ID}` → execute → quality pipeline
131
+ - 已有 blueprint artifact → `plan --from blueprint:{BLP_ID}` → execute → quality pipeline
132
+ 4. 执行 step:`Bash("maestro ralph skills --platform claude --json --quiet")` 预校验 skill 名,命中写绝对路径到 `command_path`,未命中标 `missing`;同时写 `step.stage` / `step.scope` / `step.source_artifact_ref`。decision 节点不解析 command_path
133
+
134
+ ### A_CLARIFY
135
+
136
+ 1. `AskUserQuestion` with parsed intent + available chain options
137
+ 2. Re-classify with user response
138
+
139
+ ### A_DECOMPOSE_TASKS
140
+
141
+ 设 `session.decomposition_owner = "maestro"`。下游 ralph 只消费不二次提问(invariant 4)。Condensed:
142
+
143
+ 1. 分类意图广度。narrow / 单步 / `{status,init,quick}` 链跳过
144
+ 2. broad/medium → `AskUserQuestion` ≤3 轮:Scope / Constraints / Definition of Done
145
+ 3. 派生 `execution_criteria` + `task_decomposition`(每个 sub-goal 含 `done_when` + `evidence` + `lifecycle` + `completion_confirmed: false`)
146
+ 4. **status.json 唯一真源**:写入 `boundary_contract` / `execution_criteria` / `task_decomposition`;不生成 markdown 清单
147
+ 5. 在最后一个 evidence-producing stage(execute/review/test)之后、`milestone-complete` 之前追加 `decision:post-goal-audit`。ralph-execute 在该节点按需动态生长 `steps[]`
148
+ 6. **输出 `/goal` 绑定提示词(不阻塞,用户可在执行过程中随时输入):**
149
+ ```
150
+ 📋 任务分解完成。可随时复制下面一行设定目标(执行过程中输入即可):
151
+
152
+ /goal 完成以下子目标:
153
+ {for each G in task_decomposition:}
154
+ - {G.id}: {G.goal} — 完成条件: {G.done_when}
155
+ {end for}
156
+ 达成条件: {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。
157
+ ```
158
+
159
+ ### A_CREATE_SESSION
160
+
161
+ 0. **Specs 预检**:当 chain 包含 `analyze-macro` / `analyze` / `plan` / `execute` 等执行 stage 且 `.workflow/specs/` 目录不存在时,在 steps 最前面插入 `spec-setup`(stage=`spec-setup`,无 decision)。确保下游可获得项目约束规则注入。chain ∈ {grill, brainstorm, blueprint, init, status, quick} 时跳过
162
+ 1. Read `.workflow/state.json` 获取 phase / milestone(含 D-007 反查 `phase_slugs`);读最新 macro analyze artifact 注入 `scope_verdict` + `analyze_macro_id`(如存在);读最新 blueprint artifact 注入 `blueprint_id`
163
+ 2. Create `.workflow/.maestro/maestro-{YYYYMMDD-HHMMSS}/status.json`(与 ralph 共用 schema):
164
+ ```json
165
+ {
166
+ "session_id", "source": "maestro", "intent", "task_type", "chain_name",
167
+ "ralph_protocol_version": "2", "active_step_index": null,
168
+ "phase", "phase_is_new": false, "milestone": "",
169
+ "scope_verdict": null, "analyze_macro_id": null, "blueprint_id": null,
170
+ "auto_mode": false, "decomposition_owner": "maestro", "cli_tool": "claude",
171
+ "context": { "scratch_dir": null, "plan_dir": null, "analysis_dir": null,
172
+ "brainstorm_dir": null, "blueprint_dir": null, "issue_id": null },
173
+ "steps": [{
174
+ "index": 0, "skill": "", "args": "",
175
+ "stage": "", "scope": null, "decision": null,
176
+ "command_scope": "global|project|missing|null", "command_path": "<abs> | null",
177
+ "milestone_id": null, "source_artifact_ref": null,
178
+ "status": "pending", "goal_ref": null,
179
+ "completion_confirmed": false, "completion_status": null,
180
+ "completion_evidence": null,
181
+ "completion_summary": null, "completion_decisions": null,
182
+ "completion_caveats": null, "completion_deferred": null,
183
+ "completed_at": null,
184
+ "deferred_reads": [], "load": null
185
+ }],
186
+ "waves": [], "current_step": 0, "status": "running",
187
+ "boundary_contract": {}, "execution_criteria": [],
188
+ "task_decomposition": [{ "status": "pending|done|superseded",
189
+ "superseded_by": null, "superseded_at": null, "origin": null }],
190
+ "task_decomposition_all_done": false,
191
+ "goal_changelog": []
192
+ }
193
+ ```
194
+ 3. Validate: 所有 step 的 `command_scope != "missing"`,否则 raise E005 列出缺失 skill
195
+ 4. Initialize tracking via `TodoWrite`
196
+ 5. If `--super`: read `maestro-super.md`, follow it completely
197
+
198
+ </actions>
199
+
200
+ </state_machine>
201
+
202
+ <appendix>
203
+
204
+ ### Error Codes
205
+
206
+ | Code | Severity | Description | Recovery |
207
+ |------|----------|-------------|----------|
208
+ | E001 | error | No intent and project not initialized | Prompt or suggest maestro-init |
209
+ | E002 | error | Clarity too low after 2 rounds | Show parsed intent, ask rephrase |
210
+ | E003 | error | Chain step failed + user abort | Record partial, suggest -c resume |
211
+ | E004 | error | Resume session not found | Show available sessions |
212
+ | E005 | error | command_scope == "missing" for one or more steps | List missing skills, abort build |
213
+ | W001 | warning | Ambiguous intent, multiple chains | Present options |
214
+ | W002 | warning | Step completed with warnings | Log and continue |
215
+ | W003 | warning | State suggests different chain | Show discrepancy |
216
+
217
+ ### Success Criteria
218
+
219
+ - [ ] Intent classified with task_type, complexity, clarity_score
220
+ - [ ] Chain catalog 覆盖 grill / brainstorm / blueprint / analyze-macro / analyze / roadmap / plan(三路径) / execute / quality pipeline
221
+ - [ ] `-y` 模式透传 `-y` 到 grill(grill 以 Auto mode 代码代答执行,stage 不跳过)
222
+ - [ ] D-007: 数字 phase 步骤的 `milestone_id` 通过 `state.json.milestones[].phase_slugs` 反查
223
+ - [ ] macro analyze 后跟 `decision:post-analyze-scope`(由 ralph 评估 scope_verdict 决定下游链路)
224
+ - [ ] plan 支持 `{phase}` / `--from analyze:{ANL_ID}` / `--from blueprint:{BLP_ID}` 三路径;`source_artifact_ref` 写入 step
225
+ - [ ] Broad lifecycle intents decomposed (≤3 boundary questions); narrow/single-step skip
226
+ - [ ] status.json 唯一真源;无 markdown 清单;post-goal-audit 节点在 decomposed 时追加;/goal 提示词以 status.json 为判据
227
+ - [ ] Specs 预检:chain 含执行 stage + `.workflow/specs/` 不存在 → steps 最前面插入 `spec-setup`
228
+ - [ ] Chain selected and confirmed (or auto-confirmed)
229
+ - [ ] Session dir created with status.json before execution; decomposition fields additive-only
230
+ - [ ] 执行 step 含 `command_scope` + `command_path` + `completion_confirmed`;decision step 由 `step.decision` 标识
231
+ - [ ] `command_scope`/`command_path` 由 `maestro ralph skills --platform claude --json --quiet` 预校验(project 覆盖 global)
232
+ - [ ] Session schema 含 `ralph_protocol_version: "2"` + `active_step_index: null` + step.load 占位
233
+ - [ ] 用户传入 `-y` 时透传到 skill args
234
+ - [ ] All chains dispatched via maestro-ralph-execute
235
+ - [ ] Low-complexity intents routed to maestro-quick
236
+ - [ ] (super) Requirements validated before roadmap
237
+ - [ ] (super) Each milestone scored >= 80%
238
+
239
+ </appendix>
@@ -0,0 +1,169 @@
1
+ ---
2
+ name: maestro-amend
3
+ description: "Generate overlays to fix workflow command deficiencies Arguments: [description] [--from-verify <dir>] [--from-review <dir>] [--from-session <id>] [--from-issues ISS-xxx,...] [--scan] [--dry-run] [-y]"
4
+ allowed-tools: Read Write Bash Glob Grep AskUserQuestion
5
+ ---
6
+
7
+ <purpose>
8
+ Signal-driven overlay generator — collect workflow deficiency signals from multiple sources, diagnose which commands need amendment, batch-generate targeted overlays. All amendments use overlay system (`~/.maestro/overlays/*.json`) — non-invasive, idempotent, survives reinstall.
9
+ </purpose>
10
+
11
+ <required_reading>
12
+ @~/.maestro/workflows/overlays.md
13
+ @~/.maestro/cli-tools.json
14
+ </required_reading>
15
+
16
+ <context>
17
+ $ARGUMENTS — optional description and/or source flags.
18
+
19
+ **Signal sources**:
20
+
21
+ | Flag | Source | Collects |
22
+ |------|--------|----------|
23
+ | `--from-verify <dir>` | verification.json | Workflow gaps from verify failures |
24
+ | `--from-review <dir>` | review.json | Process deficiencies from code review |
25
+ | `--from-session <id>` | Session artifacts | Problems during workflow execution |
26
+ | `--from-issues ISS-xxx,...` | issues.jsonl | Issues tracing to command deficiency |
27
+ | `--scan` | Auto-scan .workflow/ | Discover all workflow-related signals |
28
+ | _(positional text)_ | User description | Direct observation |
29
+
30
+ Multiple combinable. No flags + no description → interactive (scan + AskUserQuestion).
31
+
32
+ **Control**: `--dry-run` (preview, don't install), `-y` (skip confirmations)
33
+
34
+ **CLI targeting**: `"cli": "claude"` (default, patches .claude/commands/), `"codex"` (patches .codex/skills/), `"both"` (both paths)
35
+
36
+ **Output**: `~/.maestro/overlays/amend-{slug}.json` + optional `~/.maestro/overlays/docs/amend-{slug}.md`
37
+
38
+ **Output boundary**: ALL file writes MUST target `~/.maestro/overlays/` (overlay JSON + docs) only. NEVER modify `.claude/commands/*.md` directly — overlay installation is handled by `maestro overlay add`.
39
+ </context>
40
+
41
+ <invariants>
42
+ 1. **Non-invasive only** — amendments MUST use the overlay system (`~/.maestro/overlays/*.json`); direct edits to `.claude/commands/*.md` are NEVER permitted
43
+ 2. **Idempotent patches** — re-running the same amendment MUST produce identical overlay JSON; overlay markers prevent duplicate injection
44
+ 3. **Pristine source reads** — signal diagnosis MUST read from `$PKG_ROOT/.claude/commands/` (untouched originals), not installed copies
45
+ 4. **Code bugs excluded** — signals classified as code bugs MUST be routed to `/maestro-quick` or `/maestro-plan --gaps`, NEVER patched via overlay
46
+ 5. **User confirmation before install** — overlay JSON MUST be previewed and confirmed by the user before `maestro overlay add` runs (unless `-y`)
47
+ 6. **Section existence verified** — target section MUST be confirmed to exist in the pristine source before drafting a patch; missing sections trigger `new-section` mode
48
+ </invariants>
49
+
50
+ <state_machine>
51
+
52
+ <states>
53
+ S_COLLECT — 收集信号(从 flags / scan / description) PERSIST: —
54
+ S_DIAGNOSE — 映射信号到命令补丁 PERSIST: —
55
+ S_GROUP — 分组、规划 overlay 粒度 PERSIST: —
56
+ S_PREVIEW — 展示注入点地图、用户确认 PERSIST: —
57
+ S_DRAFT — 生成 overlay JSON PERSIST: overlay files
58
+ S_INSTALL — 安装 overlay PERSIST: command files
59
+ S_REPORT — 报告摘要 + post-patch routing PERSIST: —
60
+ </states>
61
+
62
+ <transitions>
63
+
64
+ S_COLLECT:
65
+ → S_DIAGNOSE WHEN: signals found DO: A_COLLECT_SIGNALS
66
+ → ERROR(E001) WHEN: no signals from any source
67
+
68
+ S_DIAGNOSE:
69
+ → S_GROUP WHEN: command deficiencies identified DO: A_DIAGNOSE_SIGNALS
70
+ → ERROR(E003) WHEN: all signals are code bugs (not command gaps)
71
+
72
+ S_GROUP:
73
+ → S_PREVIEW DO: A_GROUP_OVERLAYS
74
+
75
+ S_PREVIEW:
76
+ → S_DRAFT WHEN: user confirms "Apply all" or selects patches
77
+ → S_PREVIEW WHEN: user selects "Edit" DO: modify signal target/section
78
+ → END WHEN: user cancels
79
+
80
+ S_DRAFT:
81
+ → S_INSTALL WHEN: not --dry-run DO: A_DRAFT_OVERLAYS
82
+ → END WHEN: --dry-run DO: display JSON + section map preview
83
+
84
+ S_INSTALL:
85
+ → S_REPORT DO: A_INSTALL_OVERLAYS (`maestro overlay add`, retry max 2 on validation failure)
86
+
87
+ S_REPORT:
88
+ → END DO: display summary (signals collected/applied/skipped, overlay details, skipped code-bug routing)
89
+
90
+ </transitions>
91
+
92
+ <actions>
93
+
94
+ ### A_COLLECT_SIGNALS
95
+
96
+ **If source flags**: extract signals from each specified source.
97
+ **If --scan or interactive**: scan .workflow/ for:
98
+ - verification.json → must_have_failures, anti_patterns (filter for command gap direction)
99
+ - review.json → findings tagged "process" or "workflow"
100
+ - debug understanding.md → root causes with workflow/command cause_type
101
+ - issues.jsonl → status=open AND tags include "workflow"/"command"
102
+ - execution summaries → plan deviations suggesting missing command step
103
+
104
+ **If only description**: parse for affected command(s), what's missing, expected behavior.
105
+
106
+ ### A_DIAGNOSE_SIGNALS
107
+
108
+ Per signal, determine:
109
+ - signal_id, source, description, target_command, target_section, patch_mode, fix_direction, severity
110
+
111
+ **Section mapping**:
112
+
113
+ | Signal pattern | Section | Mode |
114
+ |---------------|---------|------|
115
+ | Missing pre-check/gate | execution | prepend |
116
+ | Missing post-step/verification | execution | append |
117
+ | Missing reading/context | required_reading / deferred_reading | append |
118
+ | Incomplete success criteria | success_criteria | append |
119
+ | Missing error handling | error_codes | append |
120
+ | Scope/context gap | context | append |
121
+ | Wrong/missing next-step routing | completion | replace / append |
122
+ | Missing/wrong invariant | invariants | append |
123
+ | Entirely new concern | _(new section)_ | new-section |
124
+
125
+ Read pristine source from `$PKG_ROOT/.claude/commands/<name>.md` to confirm section.
126
+ Classify: command deficiency → proceed; code bug → skip (suggest /maestro-quick).
127
+
128
+ ### A_GROUP_OVERLAYS
129
+
130
+ Group by target command + section (merge same command+section).
131
+ Granularity: 1-2 signals → `patch-{command}-{slug}.json`; 3+ cross-command → `amend-{slug}.json`.
132
+ Read target commands to verify sections exist, check existing overlays.
133
+
134
+ Display section map with injection points per target command.
135
+
136
+ ### A_DRAFT_OVERLAYS
137
+
138
+ Build overlay JSON per schema: name, description, targets[], cli, priority (60), enabled, patches[{section, mode, content}].
139
+ Content rules: heading includes `(patch: SIG-NNN)`, concise, supplementary doc to `~/.maestro/overlays/docs/` if >10 lines.
140
+
141
+ ### A_INSTALL_OVERLAYS
142
+
143
+ ```bash
144
+ maestro overlay add ~/.maestro/overlays/amend-{slug}.json
145
+ ```
146
+ On validation failure: fix JSON, retry (max 2).
147
+
148
+ </actions>
149
+
150
+ </state_machine>
151
+
152
+ <error_codes>
153
+ | Code | Condition | Recovery |
154
+ |------|-----------|----------|
155
+ | E001 | No signals from any source | Verify artifact paths or provide description |
156
+ | E002 | Signal source path invalid or unreadable | Check `--from-*` path; ensure artifact exists |
157
+ | E003 | All signals are code bugs, not command gaps | Use /maestro-quick or /maestro-plan --gaps |
158
+ | E004 | Overlay validation failed after 2 retries | Review JSON manually |
159
+ | W001 | Some signals skipped (code bugs) | Route to appropriate fix command |
160
+ | W002 | Target command has >= 3 existing overlays | Consider consolidating |
161
+ </error_codes>
162
+
163
+ <success_criteria>
164
+ - [ ] Signals classified: command deficiency vs code bug
165
+ - [ ] Pristine command sources read to verify injection points
166
+ - [ ] Section map with injection points confirmed by user
167
+ - [ ] Overlay JSON installed successfully; command files contain overlay markers
168
+ - [ ] Skipped code-bug signals routed to alternatives
169
+ </success_criteria>
@@ -0,0 +1,173 @@
1
+ ---
2
+ name: maestro-analyze
3
+ description: "Use when a topic needs structured multi-dimensional investigation before planning or decision-making Arguments: [milestone|topic] [-y] [-c] [-q] [--gaps [ISS-ID]]"
4
+ allowed-tools: Read Write Edit Bash Glob Grep Agent AskUserQuestion
5
+ ---
6
+
7
+ <purpose>
8
+ Multi-dimensional analysis of a proposal, decision, or architecture choice via CLI-assisted exploration and interactive discussion. Produces analysis.md (6-dimension scoring), context.md (Locked/Free/Deferred decisions), conclusions.json, and discussion.md with Go/No-Go recommendation. Use `--gaps` for issue root cause analysis feeding `plan --gaps`.
9
+ </purpose>
10
+
11
+ <required_reading>
12
+ @~/.maestro/workflows/analyze.md
13
+ </required_reading>
14
+
15
+ <deferred_reading>
16
+ - [state.json](~/.maestro/templates/state.json) — read when registering artifact
17
+ - [issue-gaps-analyze.md](~/.maestro/workflows/issue-gaps-analyze.md) — read when --gaps is triggered
18
+ - [boundary-grill.md](~/.maestro/workflows/boundary-grill.md) — read when boundary conflicts detected (between Phase 4 and Phase 5)
19
+ </deferred_reading>
20
+
21
+ <context>
22
+ $ARGUMENTS -- milestone number for micro mode, topic text for macro/adhoc mode, no args for current milestone.
23
+
24
+ **Dual-layer mode:**
25
+ - **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.
26
+ - **Micro mode** (numeric argument): Milestone-level deep analysis within an existing roadmap. Covers all phases under the milestone. Same analysis depth, broader scope. `analyze 1` = Milestone 1.
27
+
28
+ **Disambiguation rule (mode selection):**
29
+ - First positional arg matches `^\d+$` (pure digits, e.g. `1`, `42`) → **micro mode** (treat as milestone number)
30
+ - First positional arg is non-numeric text (e.g. `auth-refactor`, `improve search`) → **macro mode** (treat as topic)
31
+ - No positional arg → current milestone micro mode (when roadmap present) else macro fallback
32
+ - Mixed input like `"1 milestone"` is treated as text → macro mode (only bare numerics trigger micro)
33
+
34
+ **Flags:**
35
+
36
+ | Flag | Effect | Default |
37
+ |------|--------|---------|
38
+ | `-y` / `--yes` | Auto mode — skip interactive scoping, use recommended defaults, auto-deepen | false |
39
+ | `-c` / `--continue` | Resume from existing session (auto-detect session folder + discussion.md) | false |
40
+ | `-q` / `--quick` | Quick mode — skip exploration + scoring, go straight to decision extraction (context.md only). **Precedence**: when combined with `-c`, the resumed session preserves its original mode (full or quick); `-q` does NOT override a resumed full session to quick mode. | false |
41
+ | `--from <source>` | Load upstream context package (grill:ID, brainstorm:ID, blueprint:BLP-xxx, @file, or path) | — |
42
+ | `--gaps [ISS-ID]` | Issue root cause analysis mode. If ISS-ID provided, analyze single issue. If omitted, analyze all open/registered issues from issues.jsonl | — |
43
+
44
+ **Scope routing:**
45
+ | Input | Mode | Scope |
46
+ |-------|------|-------|
47
+ | Pure digits (e.g. `1`, `42`) | micro | Milestone-level deep analysis |
48
+ | Non-numeric text (e.g. `auth-refactor`) | macro | Topic impact surface |
49
+ | No positional arg + roadmap | micro | Current milestone |
50
+ | No positional arg + no roadmap | macro | Fallback |
51
+ | `--gaps [ISS-ID]` | gaps | Issue root cause analysis |
52
+
53
+ Output directory format, artifact registration schema, and output artifact listing are defined in workflow analyze.md (Output Structure section).
54
+
55
+ ### Pre-load
56
+
57
+ 1. **Codebase docs**: IF `.workflow/codebase/doc-index.json` exists → Read ARCHITECTURE.md for module boundaries
58
+ 2. **Specs**: `maestro load --type spec --category arch` — load architecture constraints
59
+ 3. **Wiki search**: `maestro search "{topic keywords}" --json` → top 5-10 entries as prior knowledge
60
+ 4. All optional — proceed without if unavailable (log warning)
61
+
62
+ ### Role Knowledge
63
+ `maestro search --category debug` → select relevant → `maestro load --type knowhow --id`
64
+ </context>
65
+
66
+ <interview_protocol>
67
+ Follows @~/.maestro/workflows/interview-mechanics.md standard.
68
+
69
+ **Interaction mode**: convergent menu-driven
70
+ **Decision tree** (strict order): scope (phase / topic / milestone-wide / adhoc / --gaps) → depth (quick / standard / deep) → dimensions (which of the 6 to keep) → Go/No-Go threshold
71
+ **Scope guard**: only analyze decisions; do not prejudge plan/execute concerns
72
+ **Writeback target**: discussion.md (top table) + context.md "Interview Decisions"
73
+ **Additional search sources**: issues.jsonl (--gaps mode), roadmap.md
74
+ **Additional skip conditions**: input is already specific (explicit milestone number or unambiguous topic)
75
+ **Exit condition**: all decision points settled → finalize session metadata
76
+ </interview_protocol>
77
+
78
+ <execution>
79
+ Follow '~/.maestro/workflows/analyze.md' completely.
80
+
81
+ ### --gaps Mode
82
+
83
+ When `--gaps` is present, follow `~/.maestro/workflows/issue-gaps-analyze.md` instead of the standard pipeline.
84
+ </execution>
85
+
86
+ <completion>
87
+ ### Standalone report
88
+
89
+ ```
90
+ === ANALYSIS READY ===
91
+ Artifact: ANL-{id}
92
+ Scope: {micro|macro|adhoc|gaps}
93
+ Go/No-Go: {GO|NO-GO|CONDITIONAL}
94
+ Confidence: {high|medium|low}
95
+ Outputs: analysis.md, context.md, conclusions.json, discussion.md
96
+ Session dir: {output_dir}
97
+ ===
98
+ ```
99
+
100
+ ### Ralph-invoked completion
101
+
102
+ End the step by calling the CLI (no text block output):
103
+ ```
104
+ maestro ralph complete <idx> --status {STATUS} [--evidence {path}]
105
+ ```
106
+
107
+ Status verdicts:
108
+ - **DONE** — Normal completion
109
+ - **DONE_WITH_CONCERNS** — Completed with caveats; pass `--concerns`
110
+ - **NEEDS_RETRY** — Tooling error / transient issue; ralph will retry
111
+ - **BLOCKED** — External hard blocker; pass `--reason`
112
+
113
+ ### Next-step routing
114
+
115
+ | Condition | Suggestion |
116
+ |-----------|-----------|
117
+ | Milestone scope, Go, UI work needed | `/maestro-impeccable build {target}` |
118
+ | Milestone scope, Go, ready to plan | `/maestro-plan` or `/maestro-plan {milestone}` |
119
+ | Milestone scope, No-Go | Revisit requirements or `/maestro-brainstorm {topic}` |
120
+ | Macro/Adhoc, scope_verdict = large | `/maestro-roadmap --from analyze:ANL-xxx` |
121
+ | Macro/Adhoc, scope_verdict = medium/small | `/maestro-plan --from analyze:ANL-xxx` |
122
+ | Need more exploration | `/maestro-analyze {topic} -c` |
123
+ | Gaps scope, issues analyzed | `/maestro-plan --gaps` |
124
+ | Gaps scope, need more context | `/maestro-analyze --gaps {ISS-ID}` |
125
+
126
+ ### Session seal
127
+
128
+ @~/.maestro/workflows/finish-work.md — SESSION_DIR=OUTPUT_DIR, SESSION_TYPE=analyze, SESSION_ID={artifact_id}, LINKED_MILESTONE={target_milestone or null}
129
+ </completion>
130
+
131
+ <error_codes>
132
+ | Code | Severity | Condition | Recovery |
133
+ |------|----------|-----------|----------|
134
+ | E001 | error | No args and no roadmap (cannot determine scope) | Prompt user for topic text or create roadmap first |
135
+ | W001 | warning | CLI exploration failed | Continue with available context, note limitation |
136
+ | W002 | warning | CLI analysis timeout | Retry with shorter prompt, or skip perspective |
137
+ | W003 | warning | Insufficient evidence for scoring dimensions | Note low-confidence dimensions, proceed with available evidence |
138
+ | W004 | warning | Max rounds reached (5) | Force synthesis, offer continuation option |
139
+ | E_NO_ISSUES | error | --gaps but no open/registered issues found | Suggest `/manage-issue-discover` or `/manage-issue create` |
140
+ | E_ISSUE_NOT_FOUND | error | --gaps with ISS-ID but issue not found | Suggest `/manage-issue list` to find valid IDs |
141
+ </error_codes>
142
+
143
+ <success_criteria>
144
+ Full mode:
145
+ - [ ] CLI exploration completed with code anchors and call chains
146
+ - [ ] discussion.md created with full timeline, TOC, Current Understanding
147
+ - [ ] analysis.md written with all 6 dimensions scored with evidence
148
+ - [ ] conclusions.json created with recommendations and decision trail
149
+ - [ ] Intent Coverage tracked and verified (no unresolved ❌ items)
150
+ - [ ] Confidence tracking initialized (Step 4.6) and re-scored each round (Step 5.8)
151
+ - [ ] Readiness gate checked before synthesis (Step 5.10)
152
+ - [ ] Pressure pass completed ≥ 1 time before Step 6
153
+ - [ ] Boundary grill executed between Phase 4 and Phase 5 (skip if no conflicts detected)
154
+ - [ ] Boundary grill results written to analysis.md § Boundary Grill Results (if conflicts found)
155
+ - [ ] Confidence summary with factor decomposition written to analysis.md
156
+
157
+ Gaps mode:
158
+ - [ ] Issues loaded from issues.jsonl (all open/registered, or single ISS-ID)
159
+ - [ ] CLI exploration executed per issue with codebase context
160
+ - [ ] Analysis record attached to each issue in issues.jsonl
161
+ - [ ] context.md written with aggregated root causes for plan --gaps
162
+
163
+ Both modes (full + quick):
164
+ - [ ] Interactive mode: interview decision table written to `discussion.md` and mirrored into `context.md` "Interview Decisions"
165
+ - [ ] context.md written with all decisions classified as Locked/Free/Deferred
166
+ - [ ] Gray areas identified through phase-specific analysis
167
+ - [ ] Decision Recording Protocol applied to all decisions
168
+ - [ ] Scope creep redirected to Deferred section
169
+ - [ ] Deferred items auto-created as issues (if any)
170
+ - [ ] Artifact registered in state.json with correct scope/milestone
171
+ - [ ] Next step routed (impeccable/plan for Go, brainstorm for No-Go)
172
+ - [ ] Session sealed via finish-work (archive.json written, optional spec/knowhow extraction)
173
+ </success_criteria>