bmad-speckit-sdd-flow 1.0.2 → 1.0.3

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 (219) hide show
  1. package/README.md +16 -14
  2. package/README.zh-CN.md +16 -14
  3. package/_bmad/_config/governance-remediation.yaml +26 -0
  4. package/_bmad/claude/agents/auditors/auditor-bugfix.md +6 -0
  5. package/_bmad/claude/agents/auditors/auditor-spec.md +8 -2
  6. package/_bmad/claude/agents/auditors/auditor-tasks-doc.md +6 -0
  7. package/_bmad/claude/agents/bmad-epic-audit.md +4 -1
  8. package/_bmad/claude/agents/bmad-master.md +39 -24
  9. package/_bmad/claude/agents/bmad-story-audit.md +5 -1
  10. package/_bmad/claude/agents/bmad-story-create.md +3 -1
  11. package/_bmad/claude/agents/layers/bmad-bug-agent.md +7 -1
  12. package/_bmad/claude/agents/layers/bmad-code-reviewer-lifecycle.md +4 -0
  13. package/_bmad/claude/agents/layers/bmad-layer4-speckit-gaps.md +4 -1
  14. package/_bmad/claude/agents/layers/bmad-layer4-speckit-implement.md +4 -1
  15. package/_bmad/claude/agents/layers/bmad-layer4-speckit-plan.md +4 -1
  16. package/_bmad/claude/agents/layers/bmad-layer4-speckit-specify.md +9 -1
  17. package/_bmad/claude/agents/layers/bmad-layer4-speckit-tasks.md +4 -1
  18. package/_bmad/claude/agents/layers/bmad-standalone-tasks.md +7 -1
  19. package/_bmad/claude/hooks/post-tool-use.cjs +8 -43
  20. package/_bmad/claude/hooks/stop.cjs +8 -28
  21. package/_bmad/claude/protocols/handoff-schema.md +39 -0
  22. package/_bmad/claude/skills/bmad-bug-assistant/SKILL.en.md +24 -0
  23. package/_bmad/claude/skills/bmad-bug-assistant/SKILL.md +36 -1
  24. package/_bmad/claude/skills/bmad-bug-assistant/SKILL.zh.md +18 -0
  25. package/_bmad/claude/skills/bmad-code-reviewer-lifecycle/SKILL.en.md +23 -1
  26. package/_bmad/claude/skills/bmad-code-reviewer-lifecycle/SKILL.md +195 -169
  27. package/_bmad/claude/skills/bmad-code-reviewer-lifecycle/SKILL.zh.md +18 -0
  28. package/_bmad/claude/skills/bmad-rca-helper/SKILL.en.md +18 -0
  29. package/_bmad/claude/skills/bmad-rca-helper/SKILL.md +161 -142
  30. package/_bmad/claude/skills/bmad-rca-helper/SKILL.zh.md +16 -0
  31. package/_bmad/claude/skills/bmad-standalone-tasks/SKILL.en.md +44 -0
  32. package/_bmad/claude/skills/bmad-standalone-tasks/SKILL.md +66 -3
  33. package/_bmad/claude/skills/bmad-standalone-tasks/SKILL.zh.md +38 -0
  34. package/_bmad/claude/skills/bmad-standalone-tasks-doc-review/SKILL.en.md +33 -2
  35. package/_bmad/claude/skills/bmad-standalone-tasks-doc-review/SKILL.md +165 -118
  36. package/_bmad/claude/skills/bmad-standalone-tasks-doc-review/SKILL.zh.md +31 -1
  37. package/_bmad/claude/skills/bmad-story-assistant/SKILL.en.md +40 -0
  38. package/_bmad/claude/skills/bmad-story-assistant/SKILL.md +52 -1
  39. package/_bmad/claude/skills/bmad-story-assistant/SKILL.zh.md +34 -0
  40. package/_bmad/claude/skills/speckit-workflow/SKILL.en.md +35 -0
  41. package/_bmad/claude/skills/speckit-workflow/SKILL.md +27 -1
  42. package/_bmad/claude/skills/speckit-workflow/SKILL.zh.md +27 -1
  43. package/_bmad/cursor/hooks/post-tool-use.cjs +7 -42
  44. package/_bmad/cursor/skills/bmad-bug-assistant/SKILL.en.md +18 -0
  45. package/_bmad/cursor/skills/bmad-bug-assistant/SKILL.md +30 -1
  46. package/_bmad/cursor/skills/bmad-bug-assistant/SKILL.zh.md +16 -1
  47. package/_bmad/cursor/skills/bmad-code-reviewer-lifecycle/SKILL.en.md +15 -1
  48. package/_bmad/cursor/skills/bmad-code-reviewer-lifecycle/SKILL.md +57 -38
  49. package/_bmad/cursor/skills/bmad-code-reviewer-lifecycle/SKILL.zh.md +14 -0
  50. package/_bmad/cursor/skills/bmad-rca-helper/SKILL.en.md +14 -0
  51. package/_bmad/cursor/skills/bmad-rca-helper/SKILL.md +77 -62
  52. package/_bmad/cursor/skills/bmad-rca-helper/SKILL.zh.md +14 -0
  53. package/_bmad/cursor/skills/bmad-standalone-tasks/SKILL.en.md +18 -0
  54. package/_bmad/cursor/skills/bmad-standalone-tasks/SKILL.md +39 -3
  55. package/_bmad/cursor/skills/bmad-standalone-tasks/SKILL.zh.md +16 -0
  56. package/_bmad/cursor/skills/bmad-standalone-tasks-doc-review/SKILL.en.md +14 -0
  57. package/_bmad/cursor/skills/bmad-standalone-tasks-doc-review/SKILL.md +54 -38
  58. package/_bmad/cursor/skills/bmad-standalone-tasks-doc-review/SKILL.zh.md +14 -0
  59. package/_bmad/cursor/skills/bmad-story-assistant/SKILL.en.md +18 -0
  60. package/_bmad/cursor/skills/bmad-story-assistant/SKILL.md +37 -8
  61. package/_bmad/cursor/skills/bmad-story-assistant/SKILL.zh.md +16 -1
  62. package/_bmad/cursor/skills/speckit-workflow/SKILL.en.md +29 -0
  63. package/_bmad/cursor/skills/speckit-workflow/SKILL.md +30 -2
  64. package/_bmad/cursor/skills/speckit-workflow/SKILL.zh.md +30 -2
  65. package/_bmad/runtime/hooks/governance-packet-hard-closeout.cjs +172 -49
  66. package/_bmad/runtime/hooks/party-mode-read-current-session.cjs +1 -2
  67. package/_bmad/runtime/hooks/pre-continue-check.cjs +225 -1
  68. package/_bmad/runtime/hooks/runtime-policy-inject-core.cjs +536 -7
  69. package/_bmad/skills/consumer-governance-validation/SKILL.md +30 -69
  70. package/_bmad/skills/consumer-governance-validation/references/consumer-governance-validation.md +34 -258
  71. package/docs/assets/readme-architecture-overview.final.svg +54 -8
  72. package/docs/assets/readme-slogan.final.svg +10 -51
  73. package/node_modules/@bmad-speckit/ralph-method/package.json +1 -1
  74. package/node_modules/@bmad-speckit/runtime-context/package.json +1 -1
  75. package/node_modules/@bmad-speckit/runtime-emit/dist/auditor-post-actions.cjs +6 -0
  76. package/node_modules/@bmad-speckit/runtime-emit/dist/emit-runtime-policy.cjs +2625 -408
  77. package/node_modules/@bmad-speckit/runtime-emit/dist/resolve-for-session.cjs +3005 -909
  78. package/node_modules/@bmad-speckit/runtime-emit/dist/run-auditor-host.cjs +259 -40
  79. package/node_modules/@bmad-speckit/runtime-emit/dist/update-runtime-audit-index.cjs +6 -0
  80. package/node_modules/@bmad-speckit/runtime-emit/package.json +2 -7
  81. package/node_modules/@bmad-speckit/schema/package.json +1 -1
  82. package/node_modules/@bmad-speckit/scoring/dist/dashboard/mcp-server.js +1 -1
  83. package/node_modules/@bmad-speckit/scoring/dist/gate/version-lock.d.ts +2 -1
  84. package/node_modules/@bmad-speckit/scoring/dist/gate/version-lock.d.ts.map +1 -1
  85. package/node_modules/@bmad-speckit/scoring/dist/gate/version-lock.js +17 -2
  86. package/node_modules/@bmad-speckit/scoring/dist/gate/version-lock.js.map +1 -1
  87. package/node_modules/@bmad-speckit/scoring/package.json +1 -1
  88. package/node_modules/bmad-speckit/_bmad/_config/governance-remediation.yaml +26 -0
  89. package/node_modules/bmad-speckit/_bmad/claude/agents/auditors/auditor-bugfix.md +6 -0
  90. package/node_modules/bmad-speckit/_bmad/claude/agents/auditors/auditor-spec.md +8 -2
  91. package/node_modules/bmad-speckit/_bmad/claude/agents/auditors/auditor-tasks-doc.md +6 -0
  92. package/node_modules/bmad-speckit/_bmad/claude/agents/bmad-epic-audit.md +4 -1
  93. package/node_modules/bmad-speckit/_bmad/claude/agents/bmad-master.md +39 -24
  94. package/node_modules/bmad-speckit/_bmad/claude/agents/bmad-story-audit.md +5 -1
  95. package/node_modules/bmad-speckit/_bmad/claude/agents/bmad-story-create.md +3 -1
  96. package/node_modules/bmad-speckit/_bmad/claude/agents/layers/bmad-bug-agent.md +7 -1
  97. package/node_modules/bmad-speckit/_bmad/claude/agents/layers/bmad-code-reviewer-lifecycle.md +4 -0
  98. package/node_modules/bmad-speckit/_bmad/claude/agents/layers/bmad-layer4-speckit-gaps.md +4 -1
  99. package/node_modules/bmad-speckit/_bmad/claude/agents/layers/bmad-layer4-speckit-implement.md +4 -1
  100. package/node_modules/bmad-speckit/_bmad/claude/agents/layers/bmad-layer4-speckit-plan.md +4 -1
  101. package/node_modules/bmad-speckit/_bmad/claude/agents/layers/bmad-layer4-speckit-specify.md +9 -1
  102. package/node_modules/bmad-speckit/_bmad/claude/agents/layers/bmad-layer4-speckit-tasks.md +4 -1
  103. package/node_modules/bmad-speckit/_bmad/claude/agents/layers/bmad-standalone-tasks.md +7 -1
  104. package/node_modules/bmad-speckit/_bmad/claude/hooks/post-tool-use.cjs +8 -43
  105. package/node_modules/bmad-speckit/_bmad/claude/hooks/stop.cjs +8 -28
  106. package/node_modules/bmad-speckit/_bmad/claude/protocols/handoff-schema.md +39 -0
  107. package/node_modules/bmad-speckit/_bmad/claude/skills/bmad-bug-assistant/SKILL.en.md +24 -0
  108. package/node_modules/bmad-speckit/_bmad/claude/skills/bmad-bug-assistant/SKILL.md +36 -1
  109. package/node_modules/bmad-speckit/_bmad/claude/skills/bmad-bug-assistant/SKILL.zh.md +18 -0
  110. package/node_modules/bmad-speckit/_bmad/claude/skills/bmad-code-reviewer-lifecycle/SKILL.en.md +23 -1
  111. package/node_modules/bmad-speckit/_bmad/claude/skills/bmad-code-reviewer-lifecycle/SKILL.md +195 -169
  112. package/node_modules/bmad-speckit/_bmad/claude/skills/bmad-code-reviewer-lifecycle/SKILL.zh.md +18 -0
  113. package/node_modules/bmad-speckit/_bmad/claude/skills/bmad-rca-helper/SKILL.en.md +18 -0
  114. package/node_modules/bmad-speckit/_bmad/claude/skills/bmad-rca-helper/SKILL.md +161 -142
  115. package/node_modules/bmad-speckit/_bmad/claude/skills/bmad-rca-helper/SKILL.zh.md +16 -0
  116. package/node_modules/bmad-speckit/_bmad/claude/skills/bmad-standalone-tasks/SKILL.en.md +44 -0
  117. package/node_modules/bmad-speckit/_bmad/claude/skills/bmad-standalone-tasks/SKILL.md +66 -3
  118. package/node_modules/bmad-speckit/_bmad/claude/skills/bmad-standalone-tasks/SKILL.zh.md +38 -0
  119. package/node_modules/bmad-speckit/_bmad/claude/skills/bmad-standalone-tasks-doc-review/SKILL.en.md +33 -2
  120. package/node_modules/bmad-speckit/_bmad/claude/skills/bmad-standalone-tasks-doc-review/SKILL.md +165 -118
  121. package/node_modules/bmad-speckit/_bmad/claude/skills/bmad-standalone-tasks-doc-review/SKILL.zh.md +31 -1
  122. package/node_modules/bmad-speckit/_bmad/claude/skills/bmad-story-assistant/SKILL.en.md +40 -0
  123. package/node_modules/bmad-speckit/_bmad/claude/skills/bmad-story-assistant/SKILL.md +52 -1
  124. package/node_modules/bmad-speckit/_bmad/claude/skills/bmad-story-assistant/SKILL.zh.md +34 -0
  125. package/node_modules/bmad-speckit/_bmad/claude/skills/speckit-workflow/SKILL.en.md +35 -0
  126. package/node_modules/bmad-speckit/_bmad/claude/skills/speckit-workflow/SKILL.md +27 -1
  127. package/node_modules/bmad-speckit/_bmad/claude/skills/speckit-workflow/SKILL.zh.md +27 -1
  128. package/node_modules/bmad-speckit/_bmad/cursor/hooks/post-tool-use.cjs +7 -42
  129. package/node_modules/bmad-speckit/_bmad/cursor/skills/bmad-bug-assistant/SKILL.en.md +18 -0
  130. package/node_modules/bmad-speckit/_bmad/cursor/skills/bmad-bug-assistant/SKILL.md +30 -1
  131. package/node_modules/bmad-speckit/_bmad/cursor/skills/bmad-bug-assistant/SKILL.zh.md +16 -1
  132. package/node_modules/bmad-speckit/_bmad/cursor/skills/bmad-code-reviewer-lifecycle/SKILL.en.md +15 -1
  133. package/node_modules/bmad-speckit/_bmad/cursor/skills/bmad-code-reviewer-lifecycle/SKILL.md +57 -38
  134. package/node_modules/bmad-speckit/_bmad/cursor/skills/bmad-code-reviewer-lifecycle/SKILL.zh.md +14 -0
  135. package/node_modules/bmad-speckit/_bmad/cursor/skills/bmad-rca-helper/SKILL.en.md +14 -0
  136. package/node_modules/bmad-speckit/_bmad/cursor/skills/bmad-rca-helper/SKILL.md +77 -62
  137. package/node_modules/bmad-speckit/_bmad/cursor/skills/bmad-rca-helper/SKILL.zh.md +14 -0
  138. package/node_modules/bmad-speckit/_bmad/cursor/skills/bmad-standalone-tasks/SKILL.en.md +18 -0
  139. package/node_modules/bmad-speckit/_bmad/cursor/skills/bmad-standalone-tasks/SKILL.md +39 -3
  140. package/node_modules/bmad-speckit/_bmad/cursor/skills/bmad-standalone-tasks/SKILL.zh.md +16 -0
  141. package/node_modules/bmad-speckit/_bmad/cursor/skills/bmad-standalone-tasks-doc-review/SKILL.en.md +14 -0
  142. package/node_modules/bmad-speckit/_bmad/cursor/skills/bmad-standalone-tasks-doc-review/SKILL.md +54 -38
  143. package/node_modules/bmad-speckit/_bmad/cursor/skills/bmad-standalone-tasks-doc-review/SKILL.zh.md +14 -0
  144. package/node_modules/bmad-speckit/_bmad/cursor/skills/bmad-story-assistant/SKILL.en.md +18 -0
  145. package/node_modules/bmad-speckit/_bmad/cursor/skills/bmad-story-assistant/SKILL.md +37 -8
  146. package/node_modules/bmad-speckit/_bmad/cursor/skills/bmad-story-assistant/SKILL.zh.md +16 -1
  147. package/node_modules/bmad-speckit/_bmad/cursor/skills/speckit-workflow/SKILL.en.md +29 -0
  148. package/node_modules/bmad-speckit/_bmad/cursor/skills/speckit-workflow/SKILL.md +30 -2
  149. package/node_modules/bmad-speckit/_bmad/cursor/skills/speckit-workflow/SKILL.zh.md +30 -2
  150. package/node_modules/bmad-speckit/_bmad/runtime/hooks/governance-packet-hard-closeout.cjs +172 -49
  151. package/node_modules/bmad-speckit/_bmad/runtime/hooks/party-mode-read-current-session.cjs +1 -2
  152. package/node_modules/bmad-speckit/_bmad/runtime/hooks/pre-continue-check.cjs +225 -1
  153. package/node_modules/bmad-speckit/_bmad/runtime/hooks/runtime-policy-inject-core.cjs +536 -7
  154. package/node_modules/bmad-speckit/_bmad/skills/consumer-governance-validation/SKILL.md +30 -69
  155. package/node_modules/bmad-speckit/_bmad/skills/consumer-governance-validation/references/consumer-governance-validation.md +34 -258
  156. package/node_modules/bmad-speckit/package.json +6 -6
  157. package/node_modules/bmad-speckit/src/services/install-surface-manifest.js +52 -10
  158. package/node_modules/bmad-speckit/src/services/sync-service.js +5 -21
  159. package/node_modules/bmad-speckit/tests/pack-bmad-mirror.test.js +0 -2
  160. package/package.json +16 -12
  161. package/packages/bmad-speckit/node_modules/@bmad-speckit/ralph-method/package.json +1 -1
  162. package/packages/bmad-speckit/node_modules/@bmad-speckit/runtime-context/package.json +1 -1
  163. package/packages/bmad-speckit/node_modules/@bmad-speckit/runtime-emit/dist/auditor-post-actions.cjs +6 -0
  164. package/packages/bmad-speckit/node_modules/@bmad-speckit/runtime-emit/dist/emit-runtime-policy.cjs +2625 -408
  165. package/packages/bmad-speckit/node_modules/@bmad-speckit/runtime-emit/dist/resolve-for-session.cjs +3005 -909
  166. package/packages/bmad-speckit/node_modules/@bmad-speckit/runtime-emit/dist/run-auditor-host.cjs +259 -40
  167. package/packages/bmad-speckit/node_modules/@bmad-speckit/runtime-emit/dist/update-runtime-audit-index.cjs +6 -0
  168. package/packages/bmad-speckit/node_modules/@bmad-speckit/runtime-emit/package.json +2 -7
  169. package/packages/bmad-speckit/node_modules/@bmad-speckit/schema/package.json +1 -1
  170. package/packages/bmad-speckit/node_modules/@bmad-speckit/scoring/dist/dashboard/mcp-server.js +1 -1
  171. package/packages/bmad-speckit/node_modules/@bmad-speckit/scoring/dist/gate/version-lock.d.ts +2 -1
  172. package/packages/bmad-speckit/node_modules/@bmad-speckit/scoring/dist/gate/version-lock.d.ts.map +1 -1
  173. package/packages/bmad-speckit/node_modules/@bmad-speckit/scoring/dist/gate/version-lock.js +17 -2
  174. package/packages/bmad-speckit/node_modules/@bmad-speckit/scoring/dist/gate/version-lock.js.map +1 -1
  175. package/packages/bmad-speckit/node_modules/@bmad-speckit/scoring/package.json +1 -1
  176. package/scripts/assert-implementation-entry.ts +23 -37
  177. package/scripts/bmad-config.ts +13 -4
  178. package/scripts/bmad-help-routing-state.ts +149 -0
  179. package/scripts/bmad-runtime-worker.ts +89 -21
  180. package/scripts/continue-state-contract.ts +52 -0
  181. package/scripts/emit-runtime-policy.ts +142 -2
  182. package/scripts/governance-execution-result-ingestor.ts +13 -3
  183. package/scripts/governance-host-dispatch-adapter.ts +21 -0
  184. package/scripts/governance-packet-dispatch-worker.ts +7 -1
  185. package/scripts/governance-remediation-config.ts +12 -0
  186. package/scripts/governance-remediation-runner.ts +133 -13
  187. package/scripts/governance-runtime-queue.ts +2 -0
  188. package/scripts/i18n/resolve-for-session-cli.ts +5 -3
  189. package/scripts/init-to-root.js +9 -21
  190. package/scripts/live-smoke-main-agent-runtime.ts +309 -0
  191. package/scripts/live-smoke-speckit-workflow.ts +226 -0
  192. package/scripts/main-agent-orchestration.ts +1103 -0
  193. package/scripts/orchestration-dispatch-contract.ts +143 -0
  194. package/scripts/orchestration-state.ts +312 -0
  195. package/scripts/parse-bmad-audit-result.ts +7 -0
  196. package/scripts/prepublish-check.js +6 -7
  197. package/scripts/reviewer-schema.ts +26 -4
  198. package/scripts/run-auditor-host.ts +108 -5
  199. package/scripts/runtime-context-registry.ts +10 -0
  200. package/scripts/skill-inventory-provider.ts +0 -6
  201. package/scripts/skill-orchestration-audit.ts +336 -0
  202. package/scripts/speckit-cli.ts +1 -1
  203. package/scripts/validate-consumer-governance.ps1 +103 -134
  204. package/_bmad/runtime/hooks/governance-remediation-runner.cjs +0 -42
  205. package/_bmad/runtime/hooks/governance-runtime-worker.cjs +0 -43
  206. package/_bmad/runtime/hooks/run-bmad-runtime-worker.cjs +0 -1456
  207. package/node_modules/@bmad-speckit/runtime-emit/dist/governance-execution-result-ingestor.cjs +0 -10713
  208. package/node_modules/@bmad-speckit/runtime-emit/dist/governance-packet-dispatch-worker.cjs +0 -11055
  209. package/node_modules/@bmad-speckit/runtime-emit/dist/governance-packet-reconciler.cjs +0 -10712
  210. package/node_modules/@bmad-speckit/runtime-emit/dist/governance-remediation-runner.cjs +0 -16184
  211. package/node_modules/@bmad-speckit/runtime-emit/dist/governance-runtime-worker.cjs +0 -18563
  212. package/node_modules/bmad-speckit/_bmad/runtime/hooks/governance-remediation-runner.cjs +0 -42
  213. package/node_modules/bmad-speckit/_bmad/runtime/hooks/governance-runtime-worker.cjs +0 -43
  214. package/node_modules/bmad-speckit/_bmad/runtime/hooks/run-bmad-runtime-worker.cjs +0 -1456
  215. package/packages/bmad-speckit/node_modules/@bmad-speckit/runtime-emit/dist/governance-execution-result-ingestor.cjs +0 -10713
  216. package/packages/bmad-speckit/node_modules/@bmad-speckit/runtime-emit/dist/governance-packet-dispatch-worker.cjs +0 -11055
  217. package/packages/bmad-speckit/node_modules/@bmad-speckit/runtime-emit/dist/governance-packet-reconciler.cjs +0 -10712
  218. package/packages/bmad-speckit/node_modules/@bmad-speckit/runtime-emit/dist/governance-remediation-runner.cjs +0 -16184
  219. package/packages/bmad-speckit/node_modules/@bmad-speckit/runtime-emit/dist/governance-runtime-worker.cjs +0 -18563
package/README.md CHANGED
@@ -46,10 +46,11 @@ Traditional AI tooling often stops at prompt orchestration. BMAD-Speckit-SDD-Flo
46
46
  ## Runtime Governance At A Glance
47
47
 
48
48
  - **Four-Signal readiness gate** runs before implementation entry and keeps readiness scoring separate from implementation scoring.
49
- - **Runtime gates loop** keeps workflow progression aligned with stage truth instead of letting hosts continue optimistically.
50
- - **Rerun gates** carry remediation and re-entry through the same governed path after fixes.
51
- - **Packet execution closure** preserves evidence for every governed execution outcome across Cursor and Claude Code hosts.
52
- - **Post-audit close-out** feeds scoring, dashboard, coach, and SFT extraction from the same runtime close-out path.
49
+ - **`main-agent-orchestration inspect` is the first read**: the main agent reads the repo-native authoritative surface before choosing the next global branch.
50
+ - **`dispatch-plan` is conditional**: only materialize a plan when the surface says the next branch should dispatch a packet.
51
+ - **Child agents only execute a bounded packet**: they return packet results, but they do not choose the next global branch.
52
+ - **`runAuditorHost` is post-audit close-out only**: it closes approved audits into scoring, dashboard, coach, and SFT outputs, then the main agent re-reads `inspect`.
53
+ - **Legacy worker/manual close-out playbooks are historical evidence**: keep them for auditability, but they are not the active accepted runtime path.
53
54
 
54
55
  ## Dashboard And MCP
55
56
 
@@ -164,16 +165,16 @@ This only removes installer-managed entries. It does not delete `.cursor`, `.cla
164
165
 
165
166
  ### Core Components
166
167
 
167
- | Component | Purpose |
168
- | :-------------------------- | :-------------------------------------------------------------------------------------------------- |
169
- | **`_bmad/`** | Canonical source of truth for workflow modules, hooks, prompts, routing, and host-facing assets. |
170
- | **`packages/scoring/`** | Scoring engine, readiness drift evaluation, dashboard projection, coach inputs, and SFT extraction. |
171
- | **`dashboard`** | Default runtime observability surface: live dashboard, runtime snapshots, and scoring projections. |
172
- | **`runtime-mcp`** | Optional MCP surface for agent tools over runtime data; enabled explicitly with `--with-mcp`. |
173
- | **`speckit-workflow`** | Specify -> Plan -> GAPS -> Tasks -> TDD with mandatory audit loops. |
174
- | **`bmad-story-assistant`** | Story lifecycle path: Create Story -> Party Mode -> Dev Story -> Implement. |
175
- | **`bmad-bug-assistant`** | Bug lifecycle path: RCA -> Party Mode -> BUGFIX -> Implement. |
176
- | **`bmad-standalone-tasks`** | Standalone execution path for TASKS or BUGFIX documents through governed subagent delivery. |
168
+ | Component | Purpose |
169
+ | :-------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------- |
170
+ | **`_bmad/`** | Canonical source of truth for workflow modules, hooks, prompts, routing, and host-facing assets. |
171
+ | **`packages/scoring/`** | Scoring engine, readiness drift evaluation, dashboard projection, coach inputs, and SFT extraction. |
172
+ | **`dashboard`** | Default runtime observability surface: live dashboard, runtime snapshots, and scoring projections. |
173
+ | **`runtime-mcp`** | Optional MCP surface for agent tools over runtime data; enabled explicitly with `--with-mcp`. |
174
+ | **`speckit-workflow`** | Specify -> Plan -> GAPS -> Tasks -> TDD with mandatory audit loops. |
175
+ | **`bmad-story-assistant`** | Story lifecycle entry: main agent reads `inspect`, dispatches bounded packets when needed, and closes post-audit through `runAuditorHost`. |
176
+ | **`bmad-bug-assistant`** | Bug lifecycle path: RCA -> Party Mode -> BUGFIX -> Implement, while the main Agent still owns the global `inspect -> dispatch-plan -> closeout` chain. |
177
+ | **`bmad-standalone-tasks`** | TASKS/BUGFIX execution still follows the main-agent path: `inspect` first, `dispatch-plan` only when needed, then bounded subagent work. |
177
178
 
178
179
  <details>
179
180
  <summary><b>View Folder Structure</b></summary>
@@ -197,6 +198,7 @@ BMAD-Speckit-SDD-Flow/
197
198
  Key entry points:
198
199
 
199
200
  - [Getting Started](docs/tutorials/getting-started.md)
201
+ - [Main-Agent Orchestration Reference](docs/reference/main-agent-orchestration.md)
200
202
  - [Consumer Installation Guide](docs/how-to/consumer-installation.md)
201
203
  - [Runtime Dashboard Guide](docs/how-to/runtime-dashboard.md)
202
204
  - [Runtime MCP Installation](docs/how-to/runtime-mcp-installation.md)
package/README.zh-CN.md CHANGED
@@ -46,10 +46,11 @@
46
46
  ## 运行时管控一览
47
47
 
48
48
  - **四信号就绪检查**:在进入实现阶段前执行,与实现评分保持独立
49
- - **运行时管控循环**:工作流推进与阶段事实保持一致,不允许宿主"乐观继续"
50
- - **重跑检查点**:修复后沿同一条治理路径回到重试或重新进入
51
- - **执行闭环证据**:Cursor Claude Code 两侧都保留完整的治理执行记录
52
- - **事后审计收口**:通过同一条运行时收口路径驱动评分、看板、诊断和训练数据提取
49
+ - **先读 `main-agent-orchestration inspect`**:主 Agent 必须先读取 repo-native authoritative surface,再决定下一条全局分支
50
+ - **按需执行 `dispatch-plan`**:只有 surface 明确需要 materialize packet 时,才生成正式派发计划
51
+ - **子代理只执行 `bounded packet`**:子代理只返回 packet 结果,不负责决定下一条全局执行链
52
+ - **`runAuditorHost` 只负责 post-audit close-out**:审计通过后统一写入评分、看板、诊断和训练数据,然后主 Agent 重新读取 `inspect`
53
+ - **旧 worker / 手工 close-out 口径仅保留为历史证据**:可继续审计追溯,但不再是当前 accepted runtime path
53
54
 
54
55
  ## 看板与 MCP
55
56
 
@@ -164,16 +165,16 @@ npx --yes --package bmad-speckit-sdd-flow@latest bmad-speckit uninstall
164
165
 
165
166
  ### 核心组件
166
167
 
167
- | 组件 | 说明 |
168
- | :-------------------------- | :-------------------------------------------------------------------- |
169
- | **`_bmad/`** | 工作流模块、钩子、提示词、路由与宿主侧资产的规范源 |
170
- | **`packages/scoring/`** | 评分引擎、就绪漂移评估、看板投影、诊断输入与训练数据提取 |
171
- | **`dashboard`** | 默认运行时可观测层:实时看板、运行时快照、评分投影 |
172
- | **`runtime-mcp`** | 可选的 MCP 工具接口,通过 `--with-mcp` 显式启用 |
173
- | **`speckit-workflow`** | Specify → Plan → GAPS → Tasks → TDD,并带强制审计循环 |
174
- | **`bmad-story-assistant`** | Story 生命周期路径:Create Story Party Mode Dev Story Implement |
175
- | **`bmad-bug-assistant`** | Bug 生命周期路径:RCA → Party Mode → BUGFIX → Implement |
176
- | **`bmad-standalone-tasks`** | 针对 TASKS 或 BUGFIX 文档的独立受管子代理执行路径 |
168
+ | 组件 | 说明 |
169
+ | :-------------------------- | :----------------------------------------------------------------------------------------------------------------- |
170
+ | **`_bmad/`** | 工作流模块、钩子、提示词、路由与宿主侧资产的规范源 |
171
+ | **`packages/scoring/`** | 评分引擎、就绪漂移评估、看板投影、诊断输入与训练数据提取 |
172
+ | **`dashboard`** | 默认运行时可观测层:实时看板、运行时快照、评分投影 |
173
+ | **`runtime-mcp`** | 可选的 MCP 工具接口,通过 `--with-mcp` 显式启用 |
174
+ | **`speckit-workflow`** | Specify → Plan → GAPS → Tasks → TDD,并带强制审计循环 |
175
+ | **`bmad-story-assistant`** | Story 生命周期入口:主 Agent 先读 `inspect`,按需派发 bounded packet,并在 post-audit 后通过 `runAuditorHost` 收口 |
176
+ | **`bmad-bug-assistant`** | Bug 生命周期路径:RCA → Party Mode → BUGFIX → Implement,但全局 `inspect -> dispatch-plan -> closeout` 主链仍由主 Agent 控制 |
177
+ | **`bmad-standalone-tasks`** | 针对 TASKS 或 BUGFIX 文档的执行仍先经过主 Agent `inspect`,必要时 `dispatch-plan`,再进入 bounded 子代理实施 |
177
178
 
178
179
  <details>
179
180
  <summary><b>查看目录结构</b></summary>
@@ -195,6 +196,7 @@ BMAD-Speckit-SDD-Flow/
195
196
  ## 文档入口
196
197
 
197
198
  - [快速开始](docs/tutorials/getting-started.md)
199
+ - [主 Agent 编排参考](docs/reference/main-agent-orchestration.md)
198
200
  - [消费项目安装指南](docs/how-to/consumer-installation.md)
199
201
  - [运行时看板指南](docs/how-to/runtime-dashboard.md)
200
202
  - [运行时 MCP 安装](docs/how-to/runtime-mcp-installation.md)
@@ -4,6 +4,32 @@ packetHosts:
4
4
  - cursor
5
5
  - claude
6
6
  - codex
7
+ execution:
8
+ enabled: true
9
+ interactiveMode: main-agent
10
+ fallbackAutonomousMode: false
11
+ authoritativeHost: cursor
12
+ fallbackHosts:
13
+ - claude
14
+ - codex
15
+ dispatch:
16
+ leaseTimeoutSeconds: 900
17
+ heartbeatIntervalSeconds: 60
18
+ maxDispatchAttempts: 3
19
+ execution:
20
+ timeoutMinutes: 30
21
+ maxExecutionAttempts: 2
22
+ rerunGate:
23
+ required: true
24
+ autoSchedule: true
25
+ maxGateRetries: 2
26
+ escalation:
27
+ afterDispatchFailures: 3
28
+ afterExecutionFailures: 2
29
+ afterGateFailures: 2
30
+ projections:
31
+ emitNonAuthoritativePackets: true
32
+ archivePath: _bmad-output/runtime/governance/archive
7
33
  provider:
8
34
  mode: openai-compatible
9
35
  id: openai-governance
@@ -70,6 +70,8 @@ BUGFIX 文档严格审计 Agent,面向 bugfix 流程中的 BUGFIX 文档与修
70
70
  - `convergence_status`
71
71
  - `next_action`
72
72
  - `ready`
73
+ - `mainAgentNextAction`
74
+ - `mainAgentReady`
73
75
 
74
76
  ## Mandatory Startup
75
77
 
@@ -141,8 +143,12 @@ handoff:
141
143
  next_action: revise_bugfix_doc|implement_bugfix
142
144
  next_agent: auditor-bugfix|bmad-bug-agent
143
145
  ready: true|false
146
+ mainAgentNextAction: dispatch_remediation|dispatch_implement
147
+ mainAgentReady: true|false
144
148
  ```
145
149
 
150
+ 说明:这里的 `next_agent`、`mainAgentNextAction`、`mainAgentReady` 只作为 compatibility hint。审计返回后,真正的下一条全局分支必须回到主 Agent,并重新读取 `main-agent-orchestration` surface 后决定。
151
+
146
152
  ## Lifecycle
147
153
 
148
154
  1. Pre-Audit
@@ -141,7 +141,7 @@ Gap 修复决策:
141
141
 
142
142
  - `artifactDocPath`: 被审 spec.md 文件路径(必填)
143
143
  - `reportPath`: 审计报告保存路径(必填)
144
- - `storyPath`: 原始 Story 文档路径(可选)
144
+ - `storyPath`: 原始 Story 文档路径(**Story-flow 下必填**;standalone speckit 可不传)
145
145
  - `prdPath`: PRD 文档路径(可选)
146
146
  - `archPath`: 架构文档路径(可选)
147
147
  - `epic`: Epic 编号
@@ -157,9 +157,15 @@ Gap 修复决策:
157
157
  2. **读取批判审计员规范**:`.claude/skills/speckit-workflow/references/audit-prompts-critical-auditor-appendix.md`
158
158
  3. **读取文档迭代规则**:`.claude/skills/speckit-workflow/references/audit-document-iteration-rules.md`
159
159
  4. **读取被审文档**:`artifactDocPath` 指定的spec.md
160
- 5. **读取原始需求文档**:Story/PRD/ARCH(如果提供路径)
160
+ 5. **读取原始需求文档**:Story/PRD/ARCH(如果提供路径;若当前为 Story-flow,则必须读取 `storyPath`)
161
161
  6. **检查前置审计标记**:查看spec.md 末尾是否有`<!-- AUDIT: PASSED` 标记
162
162
 
163
+ ### Story-flow 硬约束
164
+
165
+ - 若 `artifactDocPath` 属于 Story-flow `spec-E{epic}-S{story}.md`,则 `storyPath` 为**强制输入**,不得省略。
166
+ - 审计报告控制字段中必须显式回传 `storyPath: <path>`,供 `runAuditorHost` 执行 `Story -> Spec` 版本锁。
167
+ - 缺失 `storyPath` 时,结论不得视为可 closeout。
168
+
163
169
  ## Execution Flow
164
170
 
165
171
  ### Step 1: 模型选择信息输出
@@ -70,6 +70,8 @@
70
70
  - `convergence_status`
71
71
  - `next_action`
72
72
  - `ready`
73
+ - `mainAgentNextAction`
74
+ - `mainAgentReady`
73
75
 
74
76
  ## Mandatory Startup
75
77
 
@@ -141,8 +143,12 @@ handoff:
141
143
  next_action: revise_tasks_doc|execute_standalone_tasks
142
144
  next_agent: auditor-tasks-doc|bmad-standalone-tasks
143
145
  ready: true|false
146
+ mainAgentNextAction: dispatch_remediation|dispatch_implement
147
+ mainAgentReady: true|false
144
148
  ```
145
149
 
150
+ 说明:这里的 `next_agent`、`mainAgentNextAction`、`mainAgentReady` 只作为 compatibility hint。审计返回后,真正的下一条全局分支必须回到主 Agent,并重新读取 `main-agent-orchestration` surface 后决定。
151
+
146
152
  ## Lifecycle
147
153
 
148
154
  1. Pre-Audit
@@ -274,9 +274,10 @@ PROMPT_PATH="_bmad-output/epic-{epic}-{epic-slug}/PROMPT_audit-epic-{epic}_round
274
274
  #### Step 3.2: 调用审计 Agent
275
275
 
276
276
  **Primary Executor**: `auditor-epic`
277
+ **当前 accepted path(强制)**:本执行体不得在自身上下文里直接 `Task(...)` 派发 auditor;以下内容只能作为返回给主 Agent 的 dispatch request / compatibility hint。真实派发必须回到主 Agent,由主 Agent 重新读取 `main-agent-orchestration inspect`,必要时执行 `dispatch-plan`,再决定是否派发 auditor。
277
278
 
278
279
  ```typescript
279
- Task({
280
+ MainAgentDispatchRequest({
280
281
  description: "审计 Epic {epic} 完成状态",
281
282
  subagent_type: "general-purpose",
282
283
  prompt: `
@@ -392,6 +393,8 @@ completion_report: "_bmad-output/epic-E001-test-epic/EPIC_COMPLETION_REPORT.md"
392
393
  next_action: "proceed_to_layer_5" # 进入收尾层
393
394
  ```
394
395
 
396
+ 说明:该 handoff 只作为 compatibility hint。Epic 审计后是否进入下一层,必须回到主 Agent,由主 Agent 重新读取 authoritative surface 后决定。
397
+
395
398
  ## Constraints
396
399
 
397
400
  - **禁止自行 commit**
@@ -34,15 +34,27 @@ BMAD Speckit SDD 流程的总控 Agent,负责多 Story 管理、阶段门控
34
34
  - `.claude/protocols/audit-result-schema.md`
35
35
  - `.claude/protocols/handoff-schema.md`
36
36
  - `.claude/protocols/commit-protocol.md`
37
+ 7. Read repo-native orchestration surface:
38
+ - `npm run main-agent-orchestration -- --cwd {project-root} --action inspect`
39
+ - if dispatch is needed: `--action dispatch-plan|claim|dispatch|complete|invalidate`
37
40
 
38
41
  ### Auto-Continue Detection
39
42
 
40
43
  `bmad-master` 必须区分:
41
44
 
42
- 1. **handoff readiness**:story state / handoff 中是否提供了 `next_action` 与 `ready: true`
43
- 2. **runtime permission to continue**:当前运行时是否显式启用了 auto-continue(CLI `--continue`、环境变量 `BMAD_AUTO_CONTINUE=true`、或配置文件 `auto_continue.enabled: true`)
45
+ 1. **stage handoff semantics**:story state / handoff 中可保留 `next_action` 与 `ready`,用于表达子阶段推荐结果
46
+ 2. **authoritative main-agent readiness**:优先读取 repo-native `main-agent-orchestration` surface;若该 surface 不可用,再读取 story state / handoff 中的 `mainAgentNextAction` `mainAgentReady: true`
47
+ 3. **runtime permission to continue**:当前运行时是否显式启用了 auto-continue(CLI `--continue`、环境变量 `BMAD_AUTO_CONTINUE=true`、或配置文件 `auto_continue.enabled: true`)
44
48
 
45
- 只有两者同时满足时,才允许自动推进。
49
+ 只有 2 与 3 同时满足时,才允许自动推进;若 repo-native `main-agent-orchestration` surface 与 `mainAgentNextAction / mainAgentReady` 冲突,以前者为准;若 `next_action` / `ready` 与 `mainAgentNextAction / mainAgentReady` 冲突,以后者为准。**但当 repo-native surface 可用时,不得直接从 handoff 或 story state 派发下一执行体。**
50
+
51
+ ### Canonical Runtime Surface
52
+
53
+ 主 Agent 的正式消费顺序是:
54
+
55
+ 1. `main-agent-orchestration`
56
+ 2. `mainAgentNextAction / mainAgentReady`
57
+ 3. `next_action / ready`
46
58
 
47
59
  ```yaml
48
60
  auto_continue_check:
@@ -54,36 +66,39 @@ auto_continue_check:
54
66
 
55
67
  conditions:
56
68
  - auto_continue.enabled === true
57
- - story_state.next_action 存在
58
- - story_state.ready === true
69
+ - orchestration_surface.mainAgentNextAction 存在
70
+ - orchestration_surface.mainAgentReady === true
71
+ - orchestration_surface.source in [orchestration_state, implementation_entry_gate, reviewer_closeout]
59
72
 
60
73
  action:
61
- - 自动解析 next_action 对应的 stage
74
+ - 自动解析 mainAgentNextAction 对应的主控分支
75
+ - 如需派发,先执行 dispatch-plan / claim / dispatch
62
76
  - 更新 story state stage / follow_up
63
77
  - 路由到下一个执行体
64
78
  - 输出:
65
79
  auto_proceed: true
66
- reason: "auto_continue enabled 且 handoff.next_action={action} 且 ready=true"
80
+ reason: "auto_continue enabled 且 orchestration_surface.mainAgentNextAction={action} 且 mainAgentReady=true"
67
81
  ```
68
82
 
69
- `next_action` / `ready` 满足,但 `auto_continue.enabled !== true`,则:
83
+ repo-native orchestration surface 已就绪,但 `auto_continue.enabled !== true`,则:
70
84
  - 不自动推进
71
85
  - 仅输出建议下一步
72
86
  - 等待用户确认或显式用 `--continue` 重入
73
87
 
74
- **next_action stage 的映射**:
88
+ repo-native orchestration surface 不可用,且仅 handoff 中的 `mainAgentNextAction / mainAgentReady` 已就绪,则:
89
+ - 这只属于 compatibility fallback
90
+ - 不得据此绕过 surface-first 规则重定义 accepted runtime path
91
+ - 仅在兼容恢复 / 旧 story state 回放时使用
92
+
93
+ **mainAgentNextAction 到主控分支的映射**:
75
94
 
76
95
  ```yaml
77
- action_to_stage_map:
78
- story_audit: story_audit_passed
79
- specify: specify_passed
80
- plan: plan_passed
81
- gaps: gaps_passed
82
- tasks: tasks_passed
83
- implement: implement_passed
84
- document_audit: document_audit_passed
85
- commit_gate: commit_gate_passed
86
- commit: commit_ready
96
+ main_agent_action_map:
97
+ dispatch_review: route_to_auditor_or_reviewer
98
+ dispatch_implement: route_to_implementation_executor
99
+ dispatch_remediation: rerun_fix_or_document_loop
100
+ run_closeout: enter_closeout_or_commit_gate
101
+ await_user: stop_and_wait_for_user
87
102
  ```
88
103
 
89
104
  **Output 增强**:
@@ -91,15 +106,15 @@ action_to_stage_map:
91
106
  当 auto-continue 触发时,输出:
92
107
  ```yaml
93
108
  auto_proceed: true
94
- reason: "auto_continue enabled 且 handoff.next_action={action} 且 ready=true"
95
- follow_up: <next_agent>
109
+ reason: "auto_continue enabled 且 orchestration_surface.mainAgentNextAction={action} 且 mainAgentReady=true"
110
+ follow_up: <next_agent|dispatch>
96
111
  ```
97
112
 
98
113
  当 handoff 已就绪但未开启 auto-continue 时,输出:
99
114
  ```yaml
100
115
  auto_proceed: false
101
- reason: "handoff 已就绪,但未启用 --continue / BMAD_AUTO_CONTINUE / auto_continue.enabled"
102
- follow_up: <next_agent>
116
+ reason: "main-agent handoff 已就绪,但未启用 --continue / BMAD_AUTO_CONTINUE / auto_continue.enabled"
117
+ follow_up: <next_agent|dispatch>
103
118
  suggested_command: "@bmad-master 继续 {epic}-{story} --continue"
104
119
  ```
105
120
 
@@ -500,7 +515,7 @@ Always state:
500
515
  4. `denial_reason` (if deny)
501
516
  5. `follow_up`: next agent/action
502
517
  6. `state_patch`: 应写回 story state 的变更
503
- 7. `auto_proceed`: true (当 next_action 存在且 ready=true 时)
518
+ 7. `auto_proceed`: true (当 mainAgentNextAction 存在且 mainAgentReady=true 时)
504
519
  8. `reason`: auto_proceed 触发原因
505
520
 
506
521
  ## Example Usage
@@ -201,7 +201,7 @@ Claude 端 Stage 2 Story 审计执行体,负责审计 Story 文档并决定是
201
201
 
202
202
  ### Runtime Contracts
203
203
  - 审计报告路径:`_bmad-output/implementation-artifacts/epic-{epic_num}-{epic_slug}/story-{story_num}-{story_slug}/AUDIT_story-{epic_num}-{story_num}.md`(与 create-story workflow、bmad-story-assistant 一致:story 子目录为 `story-{story}-{slug}`)
204
- - 审计通过:更新 story state 为 `story_audit_passed`,handoff `speckit-implement`
204
+ - 审计通过:更新 story state 为 `story_audit_passed`;`handoff -> speckit-implement` 只作为 compatibility hint,真正是否进入 Dev Story 必须回到主 Agent,由主 Agent 重新读取 `main-agent-orchestration` surface 后决定
205
205
  - 审计失败:更新 story state 为 `story_audit_failed`,要求修 Story 文档后重新审计
206
206
 
207
207
  ## Repo Add-ons
@@ -223,6 +223,8 @@ next_action: dev_story
223
223
  next_agent: speckit-implement
224
224
  ```
225
225
 
226
+ 说明:`next_agent: speckit-implement` 只作为 compatibility hint。
227
+
226
228
  ### FAIL
227
229
  ```yaml
228
230
  layer: 3
@@ -232,3 +234,5 @@ auditReportPath: _bmad-output/implementation-artifacts/epic-{epic_num}-{epic_slu
232
234
  next_action: revise_story
233
235
  next_agent: bmad-story-create
234
236
  ```
237
+
238
+ 说明:`next_agent: bmad-story-create` 同样只作为 compatibility hint。
@@ -159,7 +159,7 @@ Claude 端 Stage 1 Create Story 执行体,负责在 BMAD Story 流程中生成
159
159
  ### Runtime Contracts
160
160
  - 产物路径:`_bmad-output/implementation-artifacts/epic-{epic_num}-{epic_slug}/story-{story_num}-{story_slug}/{epic_num}-{story_num}-{story_slug}.md`(与 create-story workflow、bmad-story-assistant 一致:story 子目录为 `story-{story}-{slug}`,不含 epic 编号)
161
161
  - Story 产出完成后,必须将 story state 更新为 `story_created`
162
- - 必须写入 handoff,交由 `bmad-story-audit` 执行 Stage 2
162
+ - 必须写入 handoff;`next_agent: bmad-story-audit` 只作为 compatibility hint,真正是否进入 Stage 2 必须回到主 Agent,由主 Agent 重新读取 `main-agent-orchestration` surface 后决定
163
163
  - 若用户明确跳过 Create Story,必须记录跳过依据并直接进入 Story 审计
164
164
 
165
165
  ## Repo Add-ons
@@ -180,3 +180,5 @@ artifactPath: _bmad-output/implementation-artifacts/epic-{epic_num}-{epic_slug}/
180
180
  next_action: story_audit
181
181
  next_agent: bmad-story-audit
182
182
  ```
183
+
184
+ 说明:本执行体不得直接把控制链交给 `bmad-story-audit`;handoff 只是给主 Agent 的兼容提示。
@@ -56,8 +56,9 @@ Bug 修复专用流程。
56
56
  - BUGFIX 文档审计未执行、未通过或结论不明时,一律视为实现前阻断
57
57
  - 修复完成后必须进行实施后审计
58
58
  - 提交仅允许通过 `bmad-master` 的 `commit_request`
59
- - 返回必须包含:`execution_summary`、`artifacts`、`handoff`、`next_action`、`ready`
59
+ - 返回必须包含:`execution_summary`、`artifacts`、`handoff`、`next_action`、`ready`、`mainAgentNextAction`、`mainAgentReady`
60
60
  - 修复流程必须保留 RCA / BUGFIX / repro test / post-audit 的完整链路证据
61
+ - parent 主 Agent 在发起或回收本执行体前,必须优先读取 `npm run main-agent-orchestration -- --cwd {project-root} --action inspect|dispatch-plan`
61
62
 
62
63
  ## Repo Add-ons
63
64
 
@@ -109,6 +110,7 @@ Bug 修复专用流程。
109
110
 
110
111
  - 主 Agent 调用执行体时,必须完整复制 Cursor 侧 bug assistant / bugfix workflow 的对应正文模板,不得摘要化
111
112
  - 不得只传文件路径让执行体自行推断规则
113
+ - parent 主 Agent 不得只根据 `mainAgentNextAction / mainAgentReady` 派发本执行体;若 repo-native orchestration surface 可用,必须优先消费该 surface
112
114
  - 必须显式传入:
113
115
  - bug 描述
114
116
  - RCA 摘要或 RCA 文档路径
@@ -130,8 +132,12 @@ handoff:
130
132
  next_action: implement_bugfix|post_audit|commit_gate|revise_bugfix_doc
131
133
  next_agent: bmad-bug-agent|auditor-implement|bmad-master|auditor-bugfix
132
134
  ready: true|false
135
+ mainAgentNextAction: dispatch_implement|dispatch_review|dispatch_remediation|run_closeout|await_user
136
+ mainAgentReady: true|false
133
137
  ```
134
138
 
139
+ 说明:这里的 `next_agent`、`mainAgentNextAction`、`mainAgentReady` 只作为 compatibility hint。bugfix 子执行体返回后,主 Agent 必须重新读取 `main-agent-orchestration` surface,再决定下一条全局分支。
140
+
135
141
  ## State Updates
136
142
 
137
143
  ```yaml
@@ -136,8 +136,12 @@ handoff:
136
136
  next_action: scoring_trigger|return_to_auditor
137
137
  next_agent: bmad-master|auditor-implement
138
138
  ready: true|false
139
+ mainAgentNextAction: dispatch_review
140
+ mainAgentReady: true|false
139
141
  ```
140
142
 
143
+ 说明:这里的 `next_agent`、`mainAgentNextAction`、`mainAgentReady` 只作为 compatibility hint。review 返回后,主 Agent 必须重新读取 `main-agent-orchestration` surface,再决定下一条全局分支。
144
+
141
145
  ## State Updates
142
146
 
143
147
  ```yaml
@@ -243,9 +243,10 @@ PROMPT_PATH="_bmad-output/implementation-artifacts/epic-{epic}-{epic-slug}/story
243
243
  #### Step 3.2: 调用审计 Agent
244
244
 
245
245
  **Primary Executor**: `auditor-gaps` 通过 `subagent_type: general-purpose` 调用
246
+ **当前 accepted path(强制)**:本执行体不得在自身上下文里直接 `Task(...)` 派发 auditor;以下内容只能作为返回给主 Agent 的 dispatch request / compatibility hint。真实派发必须回到主 Agent,由主 Agent 重新读取 `main-agent-orchestration inspect`,必要时执行 `dispatch-plan`,再决定是否派发 auditor。
246
247
 
247
248
  ```typescript
248
- Task({
249
+ MainAgentDispatchRequest({
249
250
  description: "审计 IMPLEMENTATION_GAPS-E{epic}-S{story}.md",
250
251
  subagent_type: "general-purpose",
251
252
  prompt: `
@@ -337,6 +338,8 @@ auditReportPath: specs/epic-{epic}-{epic-slug}/story-{story}-{story-slug}/AUDIT_
337
338
  next_action: proceed_to_tasks
338
339
  ```
339
340
 
341
+ 说明:handoff 只作为 compatibility hint;是否进入 `tasks`,必须回到主 Agent,由主 Agent 重新读取 authoritative surface 后决定。
342
+
340
343
  ## Constraints
341
344
 
342
345
  - **禁止自行 commit**
@@ -420,9 +420,10 @@ PROMPT_PATH="_bmad-output/implementation-artifacts/epic-{epic}-{epic-slug}/story
420
420
  #### Step 5.2: 调用审计 Agent
421
421
 
422
422
  **Primary Executor**: `auditor-implement` 通过 `subagent_type: general-purpose` 调用
423
+ **当前 accepted path(强制)**:本执行体不得在自身上下文里直接 `Task(...)` 派发 auditor;以下内容只能作为返回给主 Agent 的 dispatch request / compatibility hint。真实派发必须回到主 Agent,由主 Agent 重新读取 `main-agent-orchestration inspect`,必要时执行 `dispatch-plan`,再决定是否派发 auditor。
423
424
 
424
425
  ```typescript
425
- Task({
426
+ MainAgentDispatchRequest({
426
427
  description: "审计 implement 阶段代码实现",
427
428
  subagent_type: "general-purpose",
428
429
  prompt: `
@@ -547,6 +548,8 @@ tddSummary:
547
548
  next_action: commit_gate
548
549
  ```
549
550
 
551
+ 说明:handoff 只作为 compatibility hint;是否进入 closeout / commit gate,必须回到主 Agent,由主 Agent 重新读取 authoritative surface 后决定。
552
+
550
553
  ## Constraints
551
554
 
552
555
  - **禁止自行 commit**
@@ -253,9 +253,10 @@ PROMPT_PATH="_bmad-output/implementation-artifacts/epic-{epic}-{epic-slug}/story
253
253
  #### Step 4.2: 调用审计 Agent
254
254
 
255
255
  **Primary Executor**: `auditor-plan` 通过 `subagent_type: general-purpose` 调用
256
+ **当前 accepted path(强制)**:本执行体不得在自身上下文里直接 `Task(...)` 派发 auditor;以下内容只能作为返回给主 Agent 的 dispatch request / compatibility hint。真实派发必须回到主 Agent,由主 Agent 重新读取 `main-agent-orchestration inspect`,必要时执行 `dispatch-plan`,再决定是否派发 auditor。
256
257
 
257
258
  ```typescript
258
- Task({
259
+ MainAgentDispatchRequest({
259
260
  description: "审计 plan-E{epic}-S{story}.md",
260
261
  subagent_type: "general-purpose",
261
262
  prompt: `
@@ -363,6 +364,8 @@ auditReportPath: specs/epic-{epic}-{epic-slug}/story-{story}-{story-slug}/AUDIT_
363
364
  next_action: proceed_to_gaps
364
365
  ```
365
366
 
367
+ 说明:handoff 只作为 compatibility hint;是否进入 `gaps`,必须回到主 Agent,由主 Agent 重新读取 authoritative surface 后决定。
368
+
366
369
  ## Constraints
367
370
 
368
371
  - **禁止自行 commit**
@@ -228,6 +228,9 @@ PROMPT_PATH="_bmad-output/implementation-artifacts/epic-{epic}-{epic-slug}/story
228
228
  - `_bmad-output/implementation-artifacts/epic-{epic}-{epic-slug}/story-{story}-{story-slug}/PROMPT_audit-spec-E{epic}-S{story}_round{N}.md`
229
229
  - 审计报告输出路径:
230
230
  - `specs/epic-{epic}-{epic-slug}/story-{story}-{story-slug}/AUDIT_spec-E{epic}-S{story}.md`
231
+ - Story-flow 约束:
232
+ - 若当前产物为 `spec-E{epic}-S{story}.md`,则审计子任务必须显式携带 `storyPath`
233
+ - 审计报告控制字段必须回传 `storyPath: <Story 文档路径>`,供 `runAuditorHost` 执行 `Story -> Spec` source_hash 版本锁
231
234
  - 审计失败处理:
232
235
  - 主 Agent 根据 required_fixes 修改 spec 文档后重新发起下一轮审计- 审计通过处理:
233
236
  - 追加通过标记
@@ -260,9 +263,10 @@ PROMPT_PATH="_bmad-output/implementation-artifacts/epic-{epic}-{epic-slug}/story
260
263
 
261
264
  **子任务prompt 不得再只是"读取并执行某个 Prompt 文件"。**
262
265
  **必须保证子任务收到的主文本基线仍然是 Cursor §1,而不是无法区分来源的本地重写版。**
266
+ **当前 accepted path(强制)**:本执行体不得在自身上下文里直接 `Task(...)` 派发 auditor;以下内容只能作为返回给主 Agent 的 dispatch request / compatibility hint。真实派发必须回到主 Agent,由主 Agent 重新读取 `main-agent-orchestration inspect`,必要时执行 `dispatch-plan`,再决定是否派发 auditor。
263
267
 
264
268
  ```typescript
265
- Task({
269
+ MainAgentDispatchRequest({
266
270
  description: "审计spec-E{epic}-S{story}.md",
267
271
  subagent_type: "general-purpose",
268
272
  prompt: `
@@ -275,6 +279,8 @@ Task({
275
279
  **Claude/OMC Runtime Adapter**
276
280
  - 审计报告输出至
277
281
  specs/epic-{epic}-{epic-slug}/story-{story}-{story-slug}/AUDIT_spec-E{epic}-S{story}.md
282
+ - Story-flow 必须携带
283
+ - `storyPath: _bmad-output/implementation-artifacts/epic-{epic}-{epic-slug}/story-{story}-{story-slug}/{epic}-{story}-{story-slug}.md`
278
284
  - 同时保存本轮 Prompt 存档至
279
285
  _bmad-output/implementation-artifacts/epic-{epic}-{epic-slug}/story-{story}-{story-slug}/PROMPT_audit-spec-E{epic}-S{story}_round{N}.md
280
286
 
@@ -363,6 +369,8 @@ auditReportPath: specs/epic-{epic}-{epic-slug}/story-{story}-{story-slug}/AUDIT_
363
369
  next_action: proceed_to_plan
364
370
  ```
365
371
 
372
+ 说明:handoff 只作为 compatibility hint;是否进入 `plan`,必须回到主 Agent,由主 Agent 重新读取 authoritative surface 后决定。
373
+
366
374
  ## Constraints
367
375
 
368
376
  - **禁止自行 commit**
@@ -320,9 +320,10 @@ PROMPT_PATH="_bmad-output/implementation-artifacts/epic-{epic}-{epic-slug}/story
320
320
  #### Step 4.2: 调用审计 Agent
321
321
 
322
322
  **Primary Executor**: `auditor-tasks` 通过 `subagent_type: general-purpose` 调用
323
+ **当前 accepted path(强制)**:本执行体不得在自身上下文里直接 `Task(...)` 派发 auditor;以下内容只能作为返回给主 Agent 的 dispatch request / compatibility hint。真实派发必须回到主 Agent,由主 Agent 重新读取 `main-agent-orchestration inspect`,必要时执行 `dispatch-plan`,再决定是否派发 auditor。
323
324
 
324
325
  ```typescript
325
- Task({
326
+ MainAgentDispatchRequest({
326
327
  description: "审计 tasks-E{epic}-S{story}.md",
327
328
  subagent_type: "general-purpose",
328
329
  prompt: `
@@ -421,6 +422,8 @@ next_action: proceed_to_implement
421
422
  next_agent: speckit-implement
422
423
  ```
423
424
 
425
+ 说明:`next_agent: speckit-implement` 只作为 compatibility hint;是否进入 implement,必须回到主 Agent,由主 Agent 重新读取 authoritative surface 后决定。
426
+
424
427
  ## Constraints
425
428
 
426
429
  - **禁止自行 commit**
@@ -52,8 +52,9 @@
52
52
  - 前置门控未执行、未通过或结论不明时,一律视为实施前阻断
53
53
  - 批次门控:每批任务完成后调用实现审计
54
54
  - 提交门控:仅允许向 `bmad-master` 返回 `commit_request`,禁止自行 commit
55
- - 返回必须包含:`execution_summary`、`artifacts`、`handoff`、`next_action`、`ready`
55
+ - 返回必须包含:`execution_summary`、`artifacts`、`handoff`、`next_action`、`ready`、`mainAgentNextAction`、`mainAgentReady`
56
56
  - 实施过程必须维护 standalone 模式下的 prd/progress 产物
57
+ - parent 主 Agent 在发起或回收本执行体前,必须优先读取 `npm run main-agent-orchestration -- --cwd {project-root} --action inspect|dispatch-plan`
57
58
 
58
59
  ## Repo Add-ons
59
60
 
@@ -112,6 +113,7 @@
112
113
 
113
114
  - 主 Agent 调用实施子代理时,必须完整复制 Cursor 侧对应正文模板,不得摘要化
114
115
  - 不得只传文件路径让子代理自行推断规则
116
+ - parent 主 Agent 不得只根据 `mainAgentNextAction / mainAgentReady` 派发本执行体;若 repo-native orchestration surface 可用,必须优先消费该 surface
115
117
  - 必须显式传入:
116
118
  - 文档路径
117
119
  - 未完成任务清单
@@ -134,8 +136,12 @@ handoff:
134
136
  next_action: implement_next_batch|post_batch_audit|commit_gate|revise_tasks_doc
135
137
  next_agent: bmad-standalone-tasks|auditor-implement|bmad-master|auditor-tasks-doc
136
138
  ready: true|false
139
+ mainAgentNextAction: dispatch_implement|dispatch_review|dispatch_remediation|run_closeout|await_user
140
+ mainAgentReady: true|false
137
141
  ```
138
142
 
143
+ 说明:这里的 `next_agent`、`mainAgentNextAction`、`mainAgentReady` 只作为 compatibility hint。standalone 执行体返回后,主 Agent 必须重新读取 `main-agent-orchestration` surface,再决定下一条全局分支。
144
+
139
145
  ## State Updates
140
146
 
141
147
  ```yaml