@anhth2/spec-driven-dev-plugin 0.9.2 → 0.11.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 (223) hide show
  1. package/commands/debug.md +50 -20
  2. package/commands/define-product.md +49 -19
  3. package/commands/{generate-tests.md → dev-gen-test.md} +85 -23
  4. package/commands/{generate-tests.tmpl → dev-gen-test.tmpl} +18 -4
  5. package/{core/commands/run-tests.md → commands/dev-run-test.md} +102 -21
  6. package/commands/{run-tests.tmpl → dev-run-test.tmpl} +35 -2
  7. package/commands/{smoke-test.md → dev-smoke-test.md} +54 -24
  8. package/commands/{smoke-test.tmpl → dev-smoke-test.tmpl} +5 -5
  9. package/commands/fix-bug.md +50 -20
  10. package/commands/generate-bdd.md +78 -21
  11. package/commands/generate-bdd.tmpl +11 -2
  12. package/commands/generate-code.md +123 -23
  13. package/commands/generate-code.tmpl +56 -4
  14. package/commands/generate-design-spec.md +142 -47
  15. package/commands/generate-design-spec.tmpl +93 -28
  16. package/commands/generate-prd.md +49 -19
  17. package/commands/generate-spec-manifest.md +49 -19
  18. package/commands/generate-tech-docs.md +50 -20
  19. package/commands/generate-tech-docs.tmpl +1 -1
  20. package/commands/learn.md +50 -20
  21. package/commands/propose-scenario.md +50 -20
  22. package/commands/propose-scenario.tmpl +1 -1
  23. package/commands/qc-analyze.md +514 -0
  24. package/commands/qc-analyze.tmpl +71 -0
  25. package/commands/qc-design-test.md +510 -0
  26. package/commands/qc-design-test.tmpl +67 -0
  27. package/commands/qc-plan.md +492 -0
  28. package/commands/qc-plan.tmpl +49 -0
  29. package/commands/qc-report.md +491 -0
  30. package/commands/qc-report.tmpl +48 -0
  31. package/commands/qc-review.md +496 -0
  32. package/commands/qc-review.tmpl +53 -0
  33. package/commands/qc-run-test.md +538 -0
  34. package/commands/qc-run-test.tmpl +77 -0
  35. package/commands/refine-prd.md +203 -24
  36. package/commands/refine-prd.tmpl +16 -5
  37. package/commands/report-bug.md +49 -19
  38. package/commands/review-code.md +51 -21
  39. package/commands/review-code.tmpl +1 -1
  40. package/commands/review-context.md +198 -20
  41. package/commands/review-context.tmpl +11 -1
  42. package/commands/review-tech-docs.md +49 -19
  43. package/commands/setup-ai-first.md +14 -7
  44. package/commands/sync.md +30 -20
  45. package/commands/sync.tmpl +16 -13
  46. package/commands/update-framework.md +14 -7
  47. package/commands/validate-traces.md +106 -45
  48. package/commands/validate-traces.tmpl +57 -26
  49. package/core/FRAMEWORK_VERSION +1 -1
  50. package/core/commands/debug.md +50 -20
  51. package/core/commands/define-product.md +49 -19
  52. package/core/commands/{generate-tests.md → dev-gen-test.md} +85 -23
  53. package/{commands/run-tests.md → core/commands/dev-run-test.md} +102 -21
  54. package/core/commands/{smoke-test.md → dev-smoke-test.md} +54 -24
  55. package/core/commands/fix-bug.md +50 -20
  56. package/core/commands/generate-bdd.md +78 -21
  57. package/core/commands/generate-code.md +123 -23
  58. package/core/commands/generate-design-spec.md +142 -47
  59. package/core/commands/generate-prd.md +49 -19
  60. package/core/commands/generate-spec-manifest.md +49 -19
  61. package/core/commands/generate-tech-docs.md +50 -20
  62. package/core/commands/learn.md +50 -20
  63. package/core/commands/propose-scenario.md +50 -20
  64. package/core/commands/qc-analyze.md +514 -0
  65. package/core/commands/qc-design-test.md +510 -0
  66. package/core/commands/qc-plan.md +492 -0
  67. package/core/commands/qc-report.md +491 -0
  68. package/core/commands/qc-review.md +496 -0
  69. package/core/commands/qc-run-test.md +538 -0
  70. package/core/commands/refine-prd.md +203 -24
  71. package/core/commands/report-bug.md +49 -19
  72. package/core/commands/review-code.md +51 -21
  73. package/core/commands/review-context.md +198 -20
  74. package/core/commands/review-tech-docs.md +49 -19
  75. package/core/commands/setup-ai-first.md +14 -7
  76. package/core/commands/sync.md +30 -20
  77. package/core/commands/update-framework.md +14 -7
  78. package/core/commands/validate-traces.md +106 -45
  79. package/core/modules/qc-playwright/stack-profile.yaml +65 -0
  80. package/core/skills/code/SKILL.md +63 -26
  81. package/core/skills/debug/SKILL.md +78 -34
  82. package/core/skills/design-spec/SKILL.md +49 -19
  83. package/core/skills/discovery/SKILL.md +49 -19
  84. package/core/skills/prd/SKILL.md +28 -14
  85. package/core/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  86. package/core/skills/qc/qa-analyst/acceptance-criteria.md +56 -0
  87. package/core/skills/qc/qa-analyst/business-rules.md +55 -0
  88. package/core/skills/qc/qa-analyst/data-flow.md +60 -0
  89. package/core/skills/qc/qa-analyst/spec-breakdown.md +57 -0
  90. package/core/skills/qc/qa-designer/e2e/journey.md +41 -0
  91. package/core/skills/qc/qa-designer/exploratory/charter.md +68 -0
  92. package/core/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  93. package/core/skills/qc/qa-designer/functional/api.md +45 -0
  94. package/core/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  95. package/core/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  96. package/core/skills/qc/qa-designer/integration/api.md +42 -0
  97. package/core/skills/qc/qa-designer/integration/db.md +39 -0
  98. package/core/skills/qc/qa-designer/integration/gui.md +40 -0
  99. package/core/skills/qc/qa-designer/integration/kafka.md +40 -0
  100. package/core/skills/qc/qa-designer/non-functional.md +40 -0
  101. package/core/skills/qc/qa-planner/test-plan.md +120 -0
  102. package/core/skills/qc/qa-reviewer/script/e2e.md +87 -0
  103. package/core/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  104. package/core/skills/qc/qa-reviewer/script/functional.md +101 -0
  105. package/core/skills/qc/qa-reviewer/script/integration.md +91 -0
  106. package/core/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  107. package/core/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  108. package/core/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  109. package/core/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  110. package/core/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  111. package/core/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  112. package/core/skills/qc/qa-runner/e2e.md +49 -0
  113. package/core/skills/qc/qa-runner/exploratory/session.md +36 -0
  114. package/core/skills/qc/qa-runner/functional/api.md +35 -0
  115. package/core/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  116. package/core/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  117. package/core/skills/qc/qa-runner/integration.md +47 -0
  118. package/core/skills/qc/qa-runner/non-functional.md +49 -0
  119. package/core/skills/qc/qa-runner/report/report.md +37 -0
  120. package/core/skills/setup-ai-first/SKILL.md +14 -7
  121. package/core/skills/spec/SKILL.md +28 -14
  122. package/core/skills/test/SKILL.md +121 -54
  123. package/core/steps/capture-lesson.md +1 -1
  124. package/core/steps/context-loader.md +35 -12
  125. package/core/steps/report-footer.md +14 -7
  126. package/core/steps/review-fanout.md +138 -0
  127. package/core/steps/spawn-agent.md +1 -1
  128. package/core/steps/trace-mirror.md +18 -0
  129. package/core/templates/design-spec.template.md +16 -8
  130. package/core/templates/project-context.yaml +8 -0
  131. package/docs/01-getting-started/README.md +19 -0
  132. package/docs/01-getting-started/core-concepts.md +102 -0
  133. package/docs/01-getting-started/installation.md +154 -0
  134. package/docs/01-getting-started/quickstart.md +85 -0
  135. package/docs/02-guides/README.md +27 -0
  136. package/docs/02-guides/developer/README.md +46 -0
  137. package/docs/02-guides/developer/bdd-and-trace.md +123 -0
  138. package/docs/02-guides/developer/commands.md +76 -0
  139. package/docs/02-guides/developer/pr-checklist.md +15 -0
  140. package/docs/02-guides/developer/scenarios.md +448 -0
  141. package/docs/02-guides/developer/workflow.md +59 -0
  142. package/docs/02-guides/product-owner/README.md +77 -0
  143. package/docs/02-guides/product-owner/commands.md +30 -0
  144. package/docs/02-guides/product-owner/handoff-checklist.md +42 -0
  145. package/docs/02-guides/product-owner/prd-writing-rules.md +45 -0
  146. package/docs/02-guides/product-owner/scenarios.md +357 -0
  147. package/docs/02-guides/qc-automation.md +92 -0
  148. package/docs/02-guides/tester/README.md +72 -0
  149. package/docs/02-guides/tester/bug-reporting.md +117 -0
  150. package/docs/02-guides/tester/reading-specs.md +79 -0
  151. package/docs/02-guides/tester/scenarios.md +186 -0
  152. package/docs/02-guides/tester/spec-manifest.md +124 -0
  153. package/docs/02-guides/tester/test-checklist.md +31 -0
  154. package/docs/02-guides/tester/workflow.md +79 -0
  155. package/docs/03-concepts/README.md +19 -0
  156. package/docs/03-concepts/architecture.md +243 -0
  157. package/docs/03-concepts/pipeline.md +249 -0
  158. package/docs/03-concepts/traceability.md +148 -0
  159. package/docs/04-operations/README.md +33 -0
  160. package/docs/04-operations/bug-flow.md +321 -0
  161. package/docs/04-operations/publishing.md +137 -0
  162. package/docs/04-operations/sync-and-update.md +328 -0
  163. package/docs/05-reference/README.md +29 -0
  164. package/docs/05-reference/commands.md +229 -0
  165. package/docs/05-reference/modules.md +110 -0
  166. package/docs/05-reference/trace-schema.md +146 -0
  167. package/docs/README.md +51 -0
  168. package/modules/qc-playwright/stack-profile.yaml +65 -0
  169. package/package.json +2 -2
  170. package/skills/code/SKILL.md +63 -26
  171. package/skills/debug/SKILL.md +78 -34
  172. package/skills/debug/SKILL.tmpl +1 -1
  173. package/skills/design-spec/SKILL.md +49 -19
  174. package/skills/discovery/SKILL.md +49 -19
  175. package/skills/prd/SKILL.md +28 -14
  176. package/skills/qc/qa-analyst/DOC_GAPS.template.md +63 -0
  177. package/skills/qc/qa-analyst/acceptance-criteria.md +56 -0
  178. package/skills/qc/qa-analyst/business-rules.md +55 -0
  179. package/skills/qc/qa-analyst/data-flow.md +60 -0
  180. package/skills/qc/qa-analyst/spec-breakdown.md +57 -0
  181. package/skills/qc/qa-designer/e2e/journey.md +41 -0
  182. package/skills/qc/qa-designer/exploratory/charter.md +68 -0
  183. package/skills/qc/qa-designer/exploratory/explore-to-functional.md +43 -0
  184. package/skills/qc/qa-designer/functional/api.md +45 -0
  185. package/skills/qc/qa-designer/functional/gui-feature.md +46 -0
  186. package/skills/qc/qa-designer/functional/gui-screen.md +52 -0
  187. package/skills/qc/qa-designer/integration/api.md +42 -0
  188. package/skills/qc/qa-designer/integration/db.md +39 -0
  189. package/skills/qc/qa-designer/integration/gui.md +40 -0
  190. package/skills/qc/qa-designer/integration/kafka.md +40 -0
  191. package/skills/qc/qa-designer/non-functional.md +40 -0
  192. package/skills/qc/qa-planner/test-plan.md +120 -0
  193. package/skills/qc/qa-reviewer/script/e2e.md +87 -0
  194. package/skills/qc/qa-reviewer/script/exploratory.md +45 -0
  195. package/skills/qc/qa-reviewer/script/functional.md +101 -0
  196. package/skills/qc/qa-reviewer/script/integration.md +91 -0
  197. package/skills/qc/qa-reviewer/script/non-functional.md +126 -0
  198. package/skills/qc/qa-reviewer/test-case/e2e.md +73 -0
  199. package/skills/qc/qa-reviewer/test-case/exploratory.md +43 -0
  200. package/skills/qc/qa-reviewer/test-case/functional.md +76 -0
  201. package/skills/qc/qa-reviewer/test-case/integration.md +69 -0
  202. package/skills/qc/qa-reviewer/test-case/non-functional.md +73 -0
  203. package/skills/qc/qa-runner/e2e.md +49 -0
  204. package/skills/qc/qa-runner/exploratory/session.md +36 -0
  205. package/skills/qc/qa-runner/functional/api.md +35 -0
  206. package/skills/qc/qa-runner/functional/gui-feature.md +51 -0
  207. package/skills/qc/qa-runner/functional/gui-screen.md +55 -0
  208. package/skills/qc/qa-runner/integration.md +47 -0
  209. package/skills/qc/qa-runner/non-functional.md +49 -0
  210. package/skills/qc/qa-runner/report/report.md +37 -0
  211. package/skills/setup-ai-first/SKILL.md +14 -7
  212. package/skills/spec/SKILL.md +28 -14
  213. package/skills/test/SKILL.md +121 -54
  214. package/skills/test/SKILL.tmpl +9 -9
  215. package/steps/capture-lesson.md +1 -1
  216. package/steps/context-loader.md +35 -12
  217. package/steps/report-footer.md +14 -7
  218. package/steps/review-fanout.md +138 -0
  219. package/steps/spawn-agent.md +1 -1
  220. package/steps/trace-mirror.md +18 -0
  221. package/templates/design-spec.template.md +16 -8
  222. package/templates/project-context.yaml +8 -0
  223. package/ARCHITECTURE.md +0 -247
@@ -170,7 +170,7 @@ If `services` section is present:
170
170
 
171
171
  **2. Route to service** — if active domain matches a key in `services`:
172
172
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
173
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
173
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, the tech-design (API contract) is a cross-team artifact and must live in the shared spec repo (handled in step 4), so leave `tech_docs_dir` for step 4 to route — do NOT pin it per-service here.
174
174
  - Store `active_service` = `services.{domain}.path`
175
175
  - Store `active_service_module` = `services.{domain}.module`
176
176
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -182,7 +182,7 @@ If `services` section is present:
182
182
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
183
183
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
184
184
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
185
- - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **only if step 2 did not already route it to a service** (multi-service umbrellas keep per-service tech-docs). This publishes the BE-authored API contract into the shared spec repo so FE/App can read it via the spec submodule at `/generate-code --phase=integration`.
185
+ - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **always when `spec_source` is set** (step 2 no longer pins tech-docs per-service in this case). The tech-design IS the cross-team API contract: BE authors it here, and FE/App read it from the same spec submodule at `/generate-code --phase=integration`. *(Per-service tech-docs only happen when there is no `spec_source` — a pure multi-service BE repo with no shared spec module.)*
186
186
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
187
187
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
188
188
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
@@ -213,7 +213,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
213
213
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
214
214
 
215
215
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
216
- - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
216
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
217
217
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
218
218
 
219
219
  **4. If service config not found** — keep umbrella defaults, still set `service_root = {active_service}` (path anchor is always needed even without a config override).
@@ -228,19 +228,41 @@ If the file does not exist → skip silently.
228
228
 
229
229
  ---
230
230
 
231
- ## Step 3 — [CRITICAL] Load CLAUDE.md
231
+ ## Step 3 — [CRITICAL] Load CLAUDE.md (layered: root + service overlay)
232
232
 
233
233
  *This is the highest-priority context — it defines HOW to write code and documents for this project.*
234
234
 
235
- Read `CLAUDE.md`. Extract and store:
235
+ CLAUDE.md is loaded in **two layers** so umbrella-wide rules and service-specific
236
+ architecture/coding standards compose correctly. The agent always sits at the umbrella
237
+ root, but the implementation code lives in a service submodule with its OWN stack,
238
+ architecture, and conventions — so the service's CLAUDE.md must win for code generation.
239
+
240
+ **Layer 1 — [BASE] Root CLAUDE.md (umbrella-wide).**
241
+ Read `CLAUDE.md` at the repo root. Treat its contents as the **shared baseline** for the
242
+ whole umbrella — git conventions, data-protection posture, cross-cutting rules, and (in
243
+ single-service mode) the project's only architecture + coding standards.
244
+
245
+ **Layer 2 — [OVERLAY] Service CLAUDE.md (umbrella mode only).**
246
+ *Run only if `service_root` was set in Step 1.6 (i.e. a real service was routed to).*
247
+ Read `{service_root}/CLAUDE.md`. This file defines the architecture + coding standards of
248
+ the **actual stack being implemented** (e.g. `user-service` = java-spring, `web` = nextjs).
249
+ Overlay it on top of Layer 1: **on any conflict, the service value WINS** for architecture,
250
+ coding standards, and error handling. Layer-1 values that the service does not redefine
251
+ (e.g. git conventions, banned patterns shared org-wide) remain in effect.
252
+
253
+ From the **merged** result, extract and store:
236
254
 
237
255
  - **§1 Project Overview** → project name, language, framework, build/test commands, domains
238
- - **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules
239
- - **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns
240
- - **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name
241
- - **§7 Git Conventions** → branch naming pattern, commit message format
256
+ - **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules — *service overlay wins*
257
+ - **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns — *service overlay wins*
258
+ - **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name — *service overlay wins*
259
+ - **§7 Git Conventions** → branch naming pattern, commit message format — *root baseline unless service redefines*
242
260
 
243
- If `CLAUDE.md` does not exist → note it as missing and continue with project-context.yaml data only.
261
+ **Resolution rules:**
262
+ - If both layers exist → merge as above; record `claude_md_source = root + {service_root}`.
263
+ - If only the service overlay exists (no root CLAUDE.md) → use the service file alone; `claude_md_source = {service_root}`.
264
+ - If `service_root` is set but `{service_root}/CLAUDE.md` is **missing** → fall back to root CLAUDE.md and flag ⚠️ in the Step 7 recap (the service has no architecture/coding-standards definition — code generation will use umbrella defaults, which may be the wrong stack).
265
+ - If neither exists → note CLAUDE.md as missing and continue with project-context.yaml data only.
244
266
 
245
267
  ---
246
268
 
@@ -306,7 +328,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
306
328
 
307
329
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
308
330
 
309
- These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
331
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (dev-gen-test, debug, fix-bug, dev-smoke-test).
310
332
 
311
333
  ---
312
334
 
@@ -340,7 +362,8 @@ Output exactly this block:
340
362
  [CTX LOADED]
341
363
  Stack : {language} / {framework} / {database}
342
364
  Platform : {active_module} ({platform_type})
343
- Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
365
+ Layers : {layer order from merged CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
366
+ CLAUDE.md : {root + {service_root} | {service_root} only | root only | ⚠️ service overlay MISSING — using root | missing}
344
367
  Ticket : {ticket_prefix}-
345
368
  Dict : {loaded — N canonical terms, M banned terms | missing}
346
369
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
@@ -387,6 +410,154 @@ Derive the output findings filename:
387
410
 
388
411
  ---
389
412
 
413
+ ## Review Procedure
414
+ # Exhaustive Review Fan-Out + Completeness Convergence
415
+
416
+ **Why this exists:** A single-pass review never lists every issue at once — the model
417
+ stops at "enough" findings, so each later review round surfaces *new* problems
418
+ (whack-a-mole). This procedure forces the review to **converge in one command run**:
419
+ fan out across review dimensions in parallel, then loop a completeness critic until a
420
+ round produces nothing new, *before* writing the findings file.
421
+
422
+ The calling command supplies two things:
423
+ - **DIMENSIONS** — the list of review dimensions to fan out over
424
+ (`/refine-prd` → the 4 lenses; `/review-context` → the P-checks or B-checks).
425
+ - **FINDINGS SCHEMA** — the YAML shape each finding must follow (defined in the command).
426
+
427
+ > **Sub-agent mode bypass:** If Gate Step 0 set `_agent_mode: true`, this whole
428
+ > procedure is **skipped** — the orchestrator is already running one dimension/UC per
429
+ > sub-agent. Run the command's checks directly on the scoped section and return findings.
430
+
431
+ ---
432
+
433
+ ## Phase 1 — Parallel dimension scan
434
+
435
+ **How many sub-agents:** the agent *count* is not the completeness lever — breadth is
436
+ fixed by the DIMENSION taxonomy (adding agents to the same dimension just re-finds the
437
+ same issues), and *depth* is owned by the Phase 2 critic loop. Pick the **fan-out
438
+ granularity** by target size, reusing the `steps/spawn-agent.md` thresholds:
439
+
440
+ | Target size | Granularity | Agent count |
441
+ |-------------|-------------|-------------|
442
+ | ≤ 3 UCs **and** ≤ 300 lines | one agent per DIMENSION over the whole file | = number of dimensions |
443
+ | > 3 UCs **or** > 300 lines | one agent per **DIMENSION × UC-scope** (UCs + a PRD-global scope), batched to fit the agent cap | `dimensions × (UCs + 1)`, capped (see below) |
444
+
445
+ The larger granularity keeps each sub-agent's context small and its scan exhaustive on a
446
+ single UC — which is what prevents misses on big PRDs.
447
+
448
+ > **Global (non-UC) sections — required in `DIMENSION × UC` mode.** Per-UC agents only
449
+ > see one UC each, so PRD-wide sections that belong to no UC (scope, success metrics,
450
+ > problem statement, terminology, glossary, changelog) would go unscanned. Whenever you
451
+ > fan out per UC, also include a **"PRD-global"** scope (the non-UC sections, findings get
452
+ > `uc_id: ""`) alongside the UC list. So the natural agent count is `dimensions × (UCs + 1)`.
453
+ > (Not needed in the whole-file mode — there each agent already sees the global sections.)
454
+
455
+ ### Agent cap — batch UCs when the fan-out gets too wide
456
+
457
+ `dimensions × (UCs + 1)` can explode on large PRDs (e.g. 6 checks × (8 UCs + 1) = 54
458
+ agents). Cap the wave at **`AGENT_CAP = 12`** agents and batch UC scopes to fit:
459
+
460
+ 1. Build the scope list = `[UC1, UC2, …, UCn, PRD-global]` (length `UCs + 1`).
461
+ 2. Compute scopes-per-agent-bucket: `groups = max(1, floor(AGENT_CAP / dimensions))`.
462
+ - If `groups ≥ UCs + 1` → no batching needed, run one agent per `DIMENSION × scope`.
463
+ - Else split the scope list into `groups` contiguous buckets of roughly equal size
464
+ (keep `PRD-global` in its own bucket if it fits; otherwise append it to the last
465
+ bucket). Each agent then handles **one DIMENSION over one bucket of UCs**.
466
+ 3. Resulting wave size = `dimensions × groups ≤ AGENT_CAP`.
467
+
468
+ A batched agent reviews several UCs at once — still scoped far tighter than the whole
469
+ file, so coverage stays high. `AGENT_CAP` is the only knob; raise it if the host allows
470
+ more concurrency, lower it to save tokens. Whole-file mode (≤ 3 UCs) never hits the cap.
471
+
472
+ Spawn the chosen sub-agents using the Agent tool (send them in a single message so they
473
+ run concurrently). Each sub-agent gets a **fresh context window** and scans its scope
474
+ through its **one** dimension only — deeper coverage than one session juggling every
475
+ dimension at once (avoids lost-in-the-middle).
476
+
477
+ Sub-agent prompt template (fill the braces):
478
+
479
+ ```
480
+ You are a {DIMENSION_NAME} reviewer. Read the full target file at {target_file}.
481
+ Scope: review ONLY through the {DIMENSION_NAME} lens/check — {DIMENSION_DESCRIPTION}.
482
+ Be exhaustive: scan every section, every UC, every AC/BR/scenario. Do not stop early.
483
+ Project context (terminology, entities, architecture):
484
+ {slim_context — banned terms, canonical entities, layer order, domains}
485
+
486
+ Return a JSON array of findings, each:
487
+ { "dimension": "{DIMENSION_NAME}", "severity": "critical|major|minor",
488
+ "section": "...", "uc_id": "...", "quote": "<verbatim ≤120 chars>",
489
+ "finding": "...", "suggestion": "...", "auto_fixable": true|false }
490
+ Return [] if this dimension is clean. Return ONLY the JSON array.
491
+ ```
492
+
493
+ Collect every sub-agent's array into one consolidated list `ALL_FINDINGS`.
494
+
495
+ ---
496
+
497
+ ## Phase 2 — Completeness-critic convergence loop
498
+
499
+ This is the anti-whack-a-mole step. Repeat until **two consecutive rounds add zero new
500
+ findings**, or a hard cap of **3 rounds**, whichever comes first:
501
+
502
+ 1. Spawn one **completeness-critic** sub-agent with the Agent tool. Give it:
503
+ - the full target file (`{target_file}`),
504
+ - the current `ALL_FINDINGS` list (so it knows what is already captured),
505
+ - the same slim context.
506
+ Prompt it:
507
+ ```
508
+ Here is a document and a list of issues already found. Read the WHOLE document.
509
+ List ONLY real, additional issues NOT already in the list — gaps, ambiguities,
510
+ contradictions, missing edge/negative paths, coverage holes, terminology drift,
511
+ structural omissions, and any issue that a fix to an existing finding would expose.
512
+ Do NOT repeat anything already listed. Return the same finding JSON shape, or [] if
513
+ nothing new.
514
+ ```
515
+ 2. Append any genuinely new findings (not already in `ALL_FINDINGS`) to the list.
516
+ 3. If this round returned 0 new → increment the dry-round counter; else reset it to 0.
517
+ 4. Stop when dry-round counter reaches 2, or after 3 rounds total.
518
+
519
+ Record `convergence_rounds` (how many critic rounds ran) for the report.
520
+
521
+ ---
522
+
523
+ ## Phase 3 — Dedup, resolve conflicts, merge
524
+
525
+ Sub-agents run **blind to each other** (independence = diverse coverage). They never
526
+ talk or reconcile among themselves — all duplicate/conflict resolution happens **here in
527
+ the orchestrator**, where the full set is visible.
528
+
529
+ 1. **Deduplicate** `ALL_FINDINGS`: two findings are duplicates if they target the same
530
+ `section` + `uc_id` and describe the same underlying issue. Keep the one with the
531
+ richer `suggestion`; if they differ on severity, keep the **higher** severity.
532
+ 2. **Resolve conflicts** — group remaining findings by `section` + `uc_id` and check for
533
+ contradictions (two findings whose `suggestion`s cannot both be applied, or that
534
+ propose opposite fixes for the same spot):
535
+ - If the two suggestions can be **merged** into one coherent fix → merge them into a
536
+ single finding.
537
+ - If they are **mutually exclusive** → emit **one** finding that states both options
538
+ and set `auto_fixable: false` with `status: "needs_discussion"` (PRD) /
539
+ `status: "pending"` (review) so a human picks — never silently drop one side.
540
+ - If a finding is **invalidated** by another (e.g. a structural finding says a section
541
+ is missing, but another quotes content from it) → drop the invalid one.
542
+ 3. **Sort** by severity (critical → major → minor), then by `section` order in the file.
543
+ 4. **Assign stable IDs** `F001, F002, …` in that sorted order.
544
+ 5. Map each finding's `dimension` into the command's schema field
545
+ (`lens` for `/refine-prd`; `check_id` for `/review-context`).
546
+ 6. Write the **single** findings file in the FINDINGS SCHEMA the command defines.
547
+
548
+ In the command's final report, add one line:
549
+ ```
550
+ Convergence: {convergence_rounds} critic round(s) — findings file is complete; re-running should surface 0 new issues.
551
+ ```
552
+
553
+
554
+ **How the checks below map onto the procedure:**
555
+ - **DIMENSIONS** = the check groups for the detected mode — PRD: `P1, P2, P4, P5`; BDD: `B1, B2, B3, B4, B5, B6`. Fan out one sub-agent per check group, each scanning the full target file for just that group.
556
+ - **Orchestrator-run checks (not fanned out):** `P0` (umbrella routing) and `P3` (cross-PRD conflict) need config / other-PRD context — the orchestrator runs these itself **before** the fan-out and adds their results to `ALL_FINDINGS`.
557
+ - The completeness-critic loop (Phase 2) guarantees the findings file is complete in one run — re-running `/review-context` should surface **0 new** findings. Map each dimension into the `check_id` field of the schema below.
558
+
559
+ ---
560
+
390
561
  ## PRD Review Mode
391
562
 
392
563
  ### P0 — Umbrella Routing Check (umbrella mode only)
@@ -631,15 +802,22 @@ Suggest the logical next command based on workflow phase:
631
802
  | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
632
803
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
633
804
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
805
+ | /qc-analyze | `/qc-plan {UC-ID}` (resolve 🔴 blocker gaps first) |
806
+ | /qc-plan | `/qc-design-test {UC-ID}` |
807
+ | /qc-design-test | `/qc-review {UC-ID}` (test-case review) |
808
+ | /qc-review (test-case) | `/qc-run-test {UC-ID}` if APPROVED; fix TCs if NEEDS_FIX |
809
+ | /qc-run-test | `/qc-report {UC-ID}` then `/qc-review {UC-ID}` (script review) |
810
+ | /qc-review (script) | `/qc-report {UC-ID}` then create PR if APPROVED |
811
+ | /qc-report | `/validate-traces {UC-ID}` to refresh Living Docs (qc_status) |
634
812
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
635
813
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
636
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
637
- | /generate-tests | `/run-tests {UC-ID}` |
638
- | /run-tests (passing) | `/review-code {UC-ID}` |
639
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
640
- | /review-code | `/smoke-test {UC-ID}` or create PR |
641
- | /smoke-test | Create PR and link to ticket |
642
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
814
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
815
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
816
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
817
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
818
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
819
+ | /dev-smoke-test | Create PR and link to ticket |
820
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
643
821
  | /fix-bug | Create PR and link to ticket |
644
822
  | /debug | `/fix-bug {ticket-id}` if fix needed |
645
823
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -690,7 +868,7 @@ to the findings file as usual and left `status: pending`.
690
868
 
691
869
  ### Phase 1 — Run analysis
692
870
 
693
- Run all checks (P1–P5 or B1–B6) exactly as in the default mode.
871
+ Run all checks via the **Review Procedure** (fan-out + completeness loop) exactly as in the default mode.
694
872
  Write the findings file with all `status: "pending"` as usual.
695
873
 
696
874
  ### Phase 2 — Apply auto-fixable findings
@@ -167,7 +167,7 @@ If `services` section is present:
167
167
 
168
168
  **2. Route to service** — if active domain matches a key in `services`:
169
169
  - Override `paths.specs_dir` → `services.{domain}.specs_dir`
170
- - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir`
170
+ - Override `paths.tech_docs_dir` → `services.{domain}.tech_docs_dir` — **only if `setup.spec_source` is NOT set.** When `spec_source` IS set, the tech-design (API contract) is a cross-team artifact and must live in the shared spec repo (handled in step 4), so leave `tech_docs_dir` for step 4 to route — do NOT pin it per-service here.
171
171
  - Store `active_service` = `services.{domain}.path`
172
172
  - Store `active_service_module` = `services.{domain}.module`
173
173
  - If service has its own `module` → use it as `active_module` (overrides `tech_stack.module`)
@@ -179,7 +179,7 @@ If `services` section is present:
179
179
  **4. Spec source auto-override** — if `setup.spec_source` is set AND the corresponding path was not already explicitly set in `paths:`:
180
180
  - Override `paths.prd_dir` → `{spec_source}/specs/prd`
181
181
  - Override `paths.design_spec_dir` → `{spec_source}/specs/design-spec`
182
- - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **only if step 2 did not already route it to a service** (multi-service umbrellas keep per-service tech-docs). This publishes the BE-authored API contract into the shared spec repo so FE/App can read it via the spec submodule at `/generate-code --phase=integration`.
182
+ - Override `paths.tech_docs_dir` → `{spec_source}/specs/tech-docs` — **always when `spec_source` is set** (step 2 no longer pins tech-docs per-service in this case). The tech-design IS the cross-team API contract: BE authors it here, and FE/App read it from the same spec submodule at `/generate-code --phase=integration`. *(Per-service tech-docs only happen when there is no `spec_source` — a pure multi-service BE repo with no shared spec module.)*
183
183
  - Override `paths.domain_knowledge_dir` → `{spec_source}/specs/domain-knowledge`
184
184
  - Override `paths.business_dictionary` → `{spec_source}/specs/domain-knowledge/business-dictionary.md`
185
185
  - Override `paths.core_entities` → `{spec_source}/specs/domain-knowledge/core-entities.md`
@@ -210,7 +210,7 @@ When `active_service` has been resolved to a real path in Step 1.5 (e.g., `user-
210
210
  | `paths.specs_dir` | `{active_service}/{service paths.specs_dir}` (if set in service config, else keep Step 1.5 override) |
211
211
 
212
212
  **3. Store** `service_root = {active_service}` as the working directory anchor for all downstream commands:
213
- - Shell commands (`/run-tests`, `/generate-tests`) run **from within** `service_root`
213
+ - Shell commands (`/dev-run-test`, `/dev-gen-test`) run **from within** `service_root`
214
214
  - File write operations (test files, trace TSVs) use paths **relative to** `service_root`
215
215
 
216
216
  **4. If service config not found** — keep umbrella defaults, still set `service_root = {active_service}` (path anchor is always needed even without a config override).
@@ -225,19 +225,41 @@ If the file does not exist → skip silently.
225
225
 
226
226
  ---
227
227
 
228
- ## Step 3 — [CRITICAL] Load CLAUDE.md
228
+ ## Step 3 — [CRITICAL] Load CLAUDE.md (layered: root + service overlay)
229
229
 
230
230
  *This is the highest-priority context — it defines HOW to write code and documents for this project.*
231
231
 
232
- Read `CLAUDE.md`. Extract and store:
232
+ CLAUDE.md is loaded in **two layers** so umbrella-wide rules and service-specific
233
+ architecture/coding standards compose correctly. The agent always sits at the umbrella
234
+ root, but the implementation code lives in a service submodule with its OWN stack,
235
+ architecture, and conventions — so the service's CLAUDE.md must win for code generation.
236
+
237
+ **Layer 1 — [BASE] Root CLAUDE.md (umbrella-wide).**
238
+ Read `CLAUDE.md` at the repo root. Treat its contents as the **shared baseline** for the
239
+ whole umbrella — git conventions, data-protection posture, cross-cutting rules, and (in
240
+ single-service mode) the project's only architecture + coding standards.
241
+
242
+ **Layer 2 — [OVERLAY] Service CLAUDE.md (umbrella mode only).**
243
+ *Run only if `service_root` was set in Step 1.6 (i.e. a real service was routed to).*
244
+ Read `{service_root}/CLAUDE.md`. This file defines the architecture + coding standards of
245
+ the **actual stack being implemented** (e.g. `user-service` = java-spring, `web` = nextjs).
246
+ Overlay it on top of Layer 1: **on any conflict, the service value WINS** for architecture,
247
+ coding standards, and error handling. Layer-1 values that the service does not redefine
248
+ (e.g. git conventions, banned patterns shared org-wide) remain in effect.
249
+
250
+ From the **merged** result, extract and store:
233
251
 
234
252
  - **§1 Project Overview** → project name, language, framework, build/test commands, domains
235
- - **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules
236
- - **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns
237
- - **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name
238
- - **§7 Git Conventions** → branch naming pattern, commit message format
253
+ - **§2 Architecture** → layer order (e.g., Controller → Facade → Service → Repository), architectural rules — *service overlay wins*
254
+ - **§3 Coding Standards** → naming conventions (classes, methods), response wrapper type, forbidden patterns — *service overlay wins*
255
+ - **§5 Error Handling** → exception types, HTTP status code mapping, not-found exception class name — *service overlay wins*
256
+ - **§7 Git Conventions** → branch naming pattern, commit message format — *root baseline unless service redefines*
239
257
 
240
- If `CLAUDE.md` does not exist → note it as missing and continue with project-context.yaml data only.
258
+ **Resolution rules:**
259
+ - If both layers exist → merge as above; record `claude_md_source = root + {service_root}`.
260
+ - If only the service overlay exists (no root CLAUDE.md) → use the service file alone; `claude_md_source = {service_root}`.
261
+ - If `service_root` is set but `{service_root}/CLAUDE.md` is **missing** → fall back to root CLAUDE.md and flag ⚠️ in the Step 7 recap (the service has no architecture/coding-standards definition — code generation will use umbrella defaults, which may be the wrong stack).
262
+ - If neither exists → note CLAUDE.md as missing and continue with project-context.yaml data only.
241
263
 
242
264
  ---
243
265
 
@@ -303,7 +325,7 @@ active_module = tech_stack.module (e.g. "java-spring", "react", "flutter")
303
325
 
304
326
  If `tech_stack.module` is blank or not recognized → set `platform_type = "unknown"` and flag as ⚠️ in the Step 7 recap.
305
327
 
306
- These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (generate-tests, debug, fix-bug, smoke-test).
328
+ These two variables (`active_module`, `platform_type`) are the canonical source for all branching logic in commands that need platform-specific behavior (dev-gen-test, debug, fix-bug, dev-smoke-test).
307
329
 
308
330
  ---
309
331
 
@@ -337,7 +359,8 @@ Output exactly this block:
337
359
  [CTX LOADED]
338
360
  Stack : {language} / {framework} / {database}
339
361
  Platform : {active_module} ({platform_type})
340
- Layers : {layer order from CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
362
+ Layers : {layer order from merged CLAUDE.md §2, e.g., Controller → Facade → Service → Repository}
363
+ CLAUDE.md : {root + {service_root} | {service_root} only | root only | ⚠️ service overlay MISSING — using root | missing}
341
364
  Ticket : {ticket_prefix}-
342
365
  Dict : {loaded — N canonical terms, M banned terms | missing}
343
366
  Entities : {loaded — EntityA, EntityB, EntityC | missing}
@@ -614,15 +637,22 @@ Suggest the logical next command based on workflow phase:
614
637
  | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
615
638
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
616
639
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
640
+ | /qc-analyze | `/qc-plan {UC-ID}` (resolve 🔴 blocker gaps first) |
641
+ | /qc-plan | `/qc-design-test {UC-ID}` |
642
+ | /qc-design-test | `/qc-review {UC-ID}` (test-case review) |
643
+ | /qc-review (test-case) | `/qc-run-test {UC-ID}` if APPROVED; fix TCs if NEEDS_FIX |
644
+ | /qc-run-test | `/qc-report {UC-ID}` then `/qc-review {UC-ID}` (script review) |
645
+ | /qc-review (script) | `/qc-report {UC-ID}` then create PR if APPROVED |
646
+ | /qc-report | `/validate-traces {UC-ID}` to refresh Living Docs (qc_status) |
617
647
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
618
648
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
619
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
620
- | /generate-tests | `/run-tests {UC-ID}` |
621
- | /run-tests (passing) | `/review-code {UC-ID}` |
622
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
623
- | /review-code | `/smoke-test {UC-ID}` or create PR |
624
- | /smoke-test | Create PR and link to ticket |
625
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
649
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
650
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
651
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
652
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
653
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
654
+ | /dev-smoke-test | Create PR and link to ticket |
655
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
626
656
  | /fix-bug | Create PR and link to ticket |
627
657
  | /debug | `/fix-bug {ticket-id}` if fix needed |
628
658
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -406,15 +406,22 @@ Suggest the logical next command based on workflow phase:
406
406
  | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
407
407
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
408
408
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
409
+ | /qc-analyze | `/qc-plan {UC-ID}` (resolve 🔴 blocker gaps first) |
410
+ | /qc-plan | `/qc-design-test {UC-ID}` |
411
+ | /qc-design-test | `/qc-review {UC-ID}` (test-case review) |
412
+ | /qc-review (test-case) | `/qc-run-test {UC-ID}` if APPROVED; fix TCs if NEEDS_FIX |
413
+ | /qc-run-test | `/qc-report {UC-ID}` then `/qc-review {UC-ID}` (script review) |
414
+ | /qc-review (script) | `/qc-report {UC-ID}` then create PR if APPROVED |
415
+ | /qc-report | `/validate-traces {UC-ID}` to refresh Living Docs (qc_status) |
409
416
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
410
417
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
411
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
412
- | /generate-tests | `/run-tests {UC-ID}` |
413
- | /run-tests (passing) | `/review-code {UC-ID}` |
414
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
415
- | /review-code | `/smoke-test {UC-ID}` or create PR |
416
- | /smoke-test | Create PR and link to ticket |
417
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
418
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
419
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
420
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
421
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
422
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
423
+ | /dev-smoke-test | Create PR and link to ticket |
424
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
418
425
  | /fix-bug | Create PR and link to ticket |
419
426
  | /debug | `/fix-bug {ticket-id}` if fix needed |
420
427
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -248,13 +248,15 @@ For each entry in `services[]`:
248
248
 
249
249
  ## Step 4 — Check `.gitignore`
250
250
 
251
- Check if `.trace/` appears in the umbrella root's `.gitignore` (or `.git/info/exclude`).
251
+ Check the generated Living Docs mirrors are gitignored:
252
+ - `.trace/` in the current repo's `.gitignore` (or `.git/info/exclude`)
253
+ - `.living-docs/` in the **specs module's** `.gitignore` (when `setup.spec_source` is set)
252
254
 
253
- If missing:
255
+ If either is missing:
254
256
  ```
255
- ⚠️ .trace/ is not in umbrella .gitignore
256
- Add it to prevent accidentally committing generated trace artifacts:
257
+ ⚠️ Living Docs mirrors not gitignored they are generated, never commit them:
257
258
  echo ".trace/" >> .gitignore
259
+ echo ".living-docs/" >> {spec_source}/.gitignore # specs module (if spec_source set)
258
260
  ```
259
261
 
260
262
  ---
@@ -263,20 +265,21 @@ If missing:
263
265
 
264
266
  *Skip if `services` is empty.*
265
267
 
266
- For each service in `services[]`:
267
- 1. Check if `{service.path}/.trace/` directory exists and contains `.tsv` files
268
- 2. If yes copy TSVs to `{umbrella_root}/.trace/{service-name}/` (create dir if needed)
268
+ **Resolve the Living Docs home (same rule as `/validate-traces`):**
269
+ - `living_docs_dir` = `{spec_source}/.living-docs` if `setup.spec_source` is set, else `.living-docs` at umbrella root. *(The specs module is mounted inside every service workspace, so the panel resolves it even when a dev opens a single service submodule.)*
270
+ - `panel_mirror` = `./.trace` at the current workspace root.
269
271
 
270
- After copying all services, write merged `{umbrella_root}/.trace/trace-report.json`:
271
- - Aggregate data from each service's `.trace/` TSVs
272
- - Include `"service"` field per scenario row
273
- - Recalculate summary totals
272
+ 1. For each service in `services[]`: if `{service.path}/.trace/` has `.tsv` files → copy them to `{living_docs_dir}/{service-name}/` (create dir if needed).
273
+ 2. Write merged `{living_docs_dir}/trace-report.json`:
274
+ - Aggregate each service's `.trace/` TSVs, add `"service"` field per row, recalc summary totals.
275
+ 3. **Mirror to the panel location:** copy `{living_docs_dir}/trace-report.json` (+ namespaced TSVs) → `{panel_mirror}/` so the panel in the currently-open repo is non-empty. Skip if `panel_mirror` already equals `living_docs_dir`.
274
276
 
275
277
  Print sync result:
276
278
  ```
277
- Living Docs → .trace/ synced
279
+ Living Docs → {living_docs_dir}/ synced (canonical, specs module)
278
280
  {service-name}: {N} TSVs
279
281
  trace-report.json: {total} scenarios across {S} services
282
+ Panel mirror → {panel_mirror}/ (current workspace)
280
283
  ```
281
284
 
282
285
  If no `.trace/` dirs found → `Living Docs: no trace data yet — run /generate-bdd then /generate-code first.`
@@ -332,15 +335,22 @@ Suggest the logical next command based on workflow phase:
332
335
  | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
333
336
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
334
337
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
338
+ | /qc-analyze | `/qc-plan {UC-ID}` (resolve 🔴 blocker gaps first) |
339
+ | /qc-plan | `/qc-design-test {UC-ID}` |
340
+ | /qc-design-test | `/qc-review {UC-ID}` (test-case review) |
341
+ | /qc-review (test-case) | `/qc-run-test {UC-ID}` if APPROVED; fix TCs if NEEDS_FIX |
342
+ | /qc-run-test | `/qc-report {UC-ID}` then `/qc-review {UC-ID}` (script review) |
343
+ | /qc-review (script) | `/qc-report {UC-ID}` then create PR if APPROVED |
344
+ | /qc-report | `/validate-traces {UC-ID}` to refresh Living Docs (qc_status) |
335
345
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
336
346
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
337
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
338
- | /generate-tests | `/run-tests {UC-ID}` |
339
- | /run-tests (passing) | `/review-code {UC-ID}` |
340
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
341
- | /review-code | `/smoke-test {UC-ID}` or create PR |
342
- | /smoke-test | Create PR and link to ticket |
343
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
347
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
348
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
349
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
350
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
351
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
352
+ | /dev-smoke-test | Create PR and link to ticket |
353
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
344
354
  | /fix-bug | Create PR and link to ticket |
345
355
  | /debug | `/fix-bug {ticket-id}` if fix needed |
346
356
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |
@@ -385,7 +395,7 @@ Service Configs
385
395
  ✅ user-service — test: mvn test | build: mvn compile
386
396
  ✅ order-service — test: mvn test | build: mvn compile
387
397
  ⚠️ payment-service — .agent/project-context.yaml missing
388
- → create it so /run-tests works correctly
398
+ → create it so /dev-run-test works correctly
389
399
 
390
400
  .gitignore
391
401
  ✅ .trace/ is gitignored
@@ -161,15 +161,22 @@ Suggest the logical next command based on workflow phase:
161
161
  | /generate-design-spec | Designer review → Figma links confirmed → PO + Designer sign-off → `/generate-bdd {prd-file}` |
162
162
  | /generate-bdd | `/review-context {feature-file}` to verify coverage |
163
163
  | /review-context (BDD) | `/generate-tech-docs {UC-ID}` if APPROVED; regenerate if NEEDS_FIX |
164
+ | /qc-analyze | `/qc-plan {UC-ID}` (resolve 🔴 blocker gaps first) |
165
+ | /qc-plan | `/qc-design-test {UC-ID}` |
166
+ | /qc-design-test | `/qc-review {UC-ID}` (test-case review) |
167
+ | /qc-review (test-case) | `/qc-run-test {UC-ID}` if APPROVED; fix TCs if NEEDS_FIX |
168
+ | /qc-run-test | `/qc-report {UC-ID}` then `/qc-review {UC-ID}` (script review) |
169
+ | /qc-review (script) | `/qc-report {UC-ID}` then create PR if APPROVED |
170
+ | /qc-report | `/validate-traces {UC-ID}` to refresh Living Docs (qc_status) |
164
171
  | /generate-tech-docs | `/review-tech-docs {tech-design-file}` |
165
172
  | /review-tech-docs | `/generate-code {feature-file}` if APPROVED; fix doc if NEEDS_FIX |
166
- | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/generate-tests {UC-ID}` |
167
- | /generate-tests | `/run-tests {UC-ID}` |
168
- | /run-tests (passing) | `/review-code {UC-ID}` |
169
- | /run-tests (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
170
- | /review-code | `/smoke-test {UC-ID}` or create PR |
171
- | /smoke-test | Create PR and link to ticket |
172
- | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/generate-tests {UC-ID}`; all OK → create PR |
173
+ | /generate-code | First gen → `/review-code {UC-ID}`; re-gen → `/dev-gen-test {UC-ID}` |
174
+ | /dev-gen-test | `/dev-run-test {UC-ID}` |
175
+ | /dev-run-test (passing) | `/review-code {UC-ID}` |
176
+ | /dev-run-test (failing) | `/fix-bug {ticket-id}` or `/debug {error}` |
177
+ | /review-code | `/dev-smoke-test {UC-ID}` or create PR |
178
+ | /dev-smoke-test | Create PR and link to ticket |
179
+ | /validate-traces | DRIFT/UNTRACKED → `/generate-code {UC-ID}`; GAP → `/dev-gen-test {UC-ID}`; all OK → create PR |
173
180
  | /fix-bug | Create PR and link to ticket |
174
181
  | /debug | `/fix-bug {ticket-id}` if fix needed |
175
182
  | /report-bug | Send to dev (`/fix-bug {BUG-ID}`); if coverage gap → `/propose-scenario {UC-ID}` |