@guanlin4924/devflow-pi 0.1.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 (254) hide show
  1. package/README.md +164 -0
  2. package/docs/OMP-NATIVE-ARCHITECTURE.md +104 -0
  3. package/package.json +40 -0
  4. package/plugins/devflow-core/extensions/devflow-core.ts +1642 -0
  5. package/plugins/devflow-core/package.json +14 -0
  6. package/plugins/devflow-core/runtime/hooks/context_sync_gate.py +174 -0
  7. package/plugins/devflow-core/runtime/hooks/hook_common.py +696 -0
  8. package/plugins/devflow-core/runtime/hooks/index_gate.py +63 -0
  9. package/plugins/devflow-core/runtime/hooks/injection_code_specification.py +7 -0
  10. package/plugins/devflow-core/runtime/hooks/post_tool.py +44 -0
  11. package/plugins/devflow-core/runtime/hooks/start.py +288 -0
  12. package/plugins/devflow-core/skills/workflow-orchestrator/SKILL.md +265 -0
  13. package/plugins/devflow-core/skills/workflow-orchestrator/agents/openai.yaml +4 -0
  14. package/plugins/devflow-core/skills/workflow-orchestrator/scripts/advance_state.rb +520 -0
  15. package/plugins/devflow-core/skills/workflow-orchestrator/scripts/control_io.rb +42 -0
  16. package/plugins/devflow-core/skills/workflow-orchestrator/scripts/init_state.rb +138 -0
  17. package/plugins/devflow-core/skills/workflow-orchestrator/scripts/init_workflow.rb +121 -0
  18. package/plugins/devflow-core/skills/workflow-orchestrator/scripts/inspect_state.rb +553 -0
  19. package/plugins/devflow-core/skills/workflow-orchestrator/scripts/manage_lessons.rb +219 -0
  20. package/plugins/devflow-core/skills/workflow-orchestrator/scripts/sync_artifacts.rb +168 -0
  21. package/plugins/devflow-core/skills/workflow-orchestrator/scripts/update_triage_route.rb +110 -0
  22. package/plugins/devflow-core/skills/workflow-orchestrator/scripts/validate_state.rb +565 -0
  23. package/plugins/devflow-core/skills/workflow-orchestrator/templates/feature-development.yaml +783 -0
  24. package/plugins/devflow-core/skills/workflow-orchestrator/templates/uat-remediation.yaml +143 -0
  25. package/plugins/devflow-core/skills/workflow-orchestrator/templates/workflows-README.md +10 -0
  26. package/plugins/devflow-core/skills/workflow-pipeline/SKILL.md +117 -0
  27. package/plugins/devflow-core/skills/workflow-pipeline/references/pipeline-flow.md +167 -0
  28. package/plugins/devflow-core/skills/workflow-pipeline/references/slice-safety-guide.md +125 -0
  29. package/plugins/devflow-core/skills/workflow-project-context/SKILL.md +819 -0
  30. package/plugins/devflow-core/skills/workflow-project-context/assets/agents-md-template.md +25 -0
  31. package/plugins/devflow-core/skills/workflow-project-context/assets/codebase-backend-spec-template.md +68 -0
  32. package/plugins/devflow-core/skills/workflow-project-context/assets/codebase-frontend-spec-template.md +64 -0
  33. package/plugins/devflow-core/skills/workflow-project-context/assets/codebase-navigation-template.md +168 -0
  34. package/plugins/devflow-core/skills/workflow-project-context/assets/context-domain-index-template.md +43 -0
  35. package/plugins/devflow-core/skills/workflow-project-context/assets/context-spec-index-template.md +45 -0
  36. package/plugins/devflow-core/skills/workflow-project-context/assets/execution-contract-template.md +57 -0
  37. package/plugins/devflow-core/skills/workflow-project-context/assets/navigation-index-template.md +40 -0
  38. package/plugins/devflow-core/skills/workflow-project-context/assets/project-initialization-template.md +109 -0
  39. package/plugins/devflow-core/skills/workflow-project-context/assets/rules-index-template.md +80 -0
  40. package/plugins/devflow-core/skills/workflow-project-context/assets/run-manifest-template.json +40 -0
  41. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/directory-structure.md +46 -0
  42. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/engine.md +46 -0
  43. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/errors.md +46 -0
  44. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/locator.md +46 -0
  45. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/model.md +46 -0
  46. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/repository.md +46 -0
  47. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/router.md +46 -0
  48. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/scheduler.md +46 -0
  49. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/schema.md +46 -0
  50. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/service.md +46 -0
  51. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/backend/testing.md +46 -0
  52. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/frontend/api-client.md +46 -0
  53. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/frontend/case-editor.md +46 -0
  54. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/frontend/components.md +46 -0
  55. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/frontend/directory-structure.md +46 -0
  56. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/frontend/forms.md +46 -0
  57. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/frontend/routing.md +46 -0
  58. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/frontend/state.md +46 -0
  59. package/plugins/devflow-core/skills/workflow-project-context/assets/spec-templates/frontend/testing.md +46 -0
  60. package/plugins/devflow-core/skills/workflow-project-context/assets/stack-spec-template.md +106 -0
  61. package/plugins/devflow-core/skills/workflow-project-context/assets/state-template.md +77 -0
  62. package/plugins/devflow-core/skills/workflow-project-context/assets/toolchain-template.md +37 -0
  63. package/plugins/devflow-core/skills/workflow-project-context/references/navigation-guide.md +262 -0
  64. package/plugins/devflow-core/skills/workflow-project-context/scripts/validate_initialization.py +545 -0
  65. package/plugins/devflow-design/agents/contract-auditor.md +18 -0
  66. package/plugins/devflow-design/extensions/devflow-design.ts +47 -0
  67. package/plugins/devflow-design/package.json +14 -0
  68. package/plugins/devflow-design/skills/workflow-api-call-guide/SKILL.md +142 -0
  69. package/plugins/devflow-design/skills/workflow-api-contract/SKILL.md +150 -0
  70. package/plugins/devflow-design/skills/workflow-api-supplement/SKILL.md +121 -0
  71. package/plugins/devflow-design/skills/workflow-backend-tech-spec/SKILL.md +257 -0
  72. package/plugins/devflow-design/skills/workflow-backend-tech-spec/assets/adr-template.md +57 -0
  73. package/plugins/devflow-design/skills/workflow-backend-tech-spec/assets/backend-spec-template.md +205 -0
  74. package/plugins/devflow-design/skills/workflow-backend-tech-spec/references/affected-module-exploration.md +59 -0
  75. package/plugins/devflow-design/skills/workflow-backend-tech-spec/references/backend-conventions.md +30 -0
  76. package/plugins/devflow-design/skills/workflow-backend-tech-spec/references/code-explore-guide.md +40 -0
  77. package/plugins/devflow-design/skills/workflow-backend-tech-spec/references/project-rule-contract.md +66 -0
  78. package/plugins/devflow-design/skills/workflow-design-rule-pack/SKILL.md +91 -0
  79. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/index.md +71 -0
  80. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/recommendations/accessibility.md +31 -0
  81. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/recommendations/component-library.md +31 -0
  82. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/recommendations/design-systems.md +47 -0
  83. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/recommendations/responsive-grid.md +29 -0
  84. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/recommendations/stack-guidelines.md +31 -0
  85. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/recommendations/ux-patterns.md +40 -0
  86. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tokens/project-tokens.md +19 -0
  87. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/SKILL.md +377 -0
  88. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/charts.csv +26 -0
  89. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/colors.csv +97 -0
  90. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/icons.csv +101 -0
  91. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/landing.csv +31 -0
  92. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/products.csv +97 -0
  93. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/react-performance.csv +45 -0
  94. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/astro.csv +54 -0
  95. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  96. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  97. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
  98. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  99. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  100. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  101. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  102. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/react.csv +54 -0
  103. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  104. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  105. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  106. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  107. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/styles.csv +68 -0
  108. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/typography.csv +58 -0
  109. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  110. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  111. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/data/web-interface.csv +31 -0
  112. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/scripts/core.py +253 -0
  113. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/scripts/design_system.py +1067 -0
  114. package/plugins/devflow-design/skills/workflow-design-rule-pack/assets/design/tools/ui-ux-pro-max/scripts/search.py +114 -0
  115. package/plugins/devflow-design/skills/workflow-design-rule-pack/scripts/install.py +67 -0
  116. package/plugins/devflow-design/skills/workflow-feature-breakdown/SKILL.md +370 -0
  117. package/plugins/devflow-design/skills/workflow-feature-breakdown/assets/admin-system-template.md +57 -0
  118. package/plugins/devflow-design/skills/workflow-feature-breakdown/assets/api-service-template.md +42 -0
  119. package/plugins/devflow-design/skills/workflow-feature-breakdown/assets/c-end-system-template.md +25 -0
  120. package/plugins/devflow-design/skills/workflow-feature-breakdown/assets/output-template.md +139 -0
  121. package/plugins/devflow-design/skills/workflow-feature-breakdown/references/bug-rules.md +12 -0
  122. package/plugins/devflow-design/skills/workflow-feature-breakdown/references/exception-checklist.md +31 -0
  123. package/plugins/devflow-design/skills/workflow-feature-breakdown/references/trace-integrity-guide.md +153 -0
  124. package/plugins/devflow-design/skills/workflow-feature-breakdown/references/writing-guide.md +92 -0
  125. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/SKILL.md +223 -0
  126. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/assets/frontend-spec-template.md +204 -0
  127. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/references/affected-module-exploration.md +58 -0
  128. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/references/component-patterns.md +42 -0
  129. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/references/frontend-conventions.md +28 -0
  130. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/references/frontend-stack-slots/common-web.md +53 -0
  131. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/references/frontend-stack-slots/next.md +40 -0
  132. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/references/frontend-stack-slots/react.md +41 -0
  133. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/references/frontend-stack-slots/vue.md +41 -0
  134. package/plugins/devflow-design/skills/workflow-frontend-tech-spec/references/project-rule-contract.md +95 -0
  135. package/plugins/devflow-design/skills/workflow-integration-verify/SKILL.md +172 -0
  136. package/plugins/devflow-design/skills/workflow-ui-spec/SKILL.md +302 -0
  137. package/plugins/devflow-design/skills/workflow-ui-spec/assets/ui-spec-template.md +244 -0
  138. package/plugins/devflow-design/skills/workflow-ui-spec/references/affected-module-exploration.md +55 -0
  139. package/plugins/devflow-implementation/agents/implementation-worker.md +20 -0
  140. package/plugins/devflow-implementation/package.json +6 -0
  141. package/plugins/devflow-implementation/skills/workflow-bug-fix/SKILL.md +124 -0
  142. package/plugins/devflow-implementation/skills/workflow-bug-fix/references/INDEX.md +13 -0
  143. package/plugins/devflow-implementation/skills/workflow-bug-fix/references/adversarial-review.md +35 -0
  144. package/plugins/devflow-implementation/skills/workflow-bug-fix/references/first-principles.md +26 -0
  145. package/plugins/devflow-implementation/skills/workflow-bug-fix/references/lesson-format.md +28 -0
  146. package/plugins/devflow-implementation/skills/workflow-bug-fix/references/root-cause-ladder.md +51 -0
  147. package/plugins/devflow-implementation/skills/workflow-bug-fix/references/seam-analysis.md +30 -0
  148. package/plugins/devflow-implementation/skills/workflow-change-plan/SKILL.md +160 -0
  149. package/plugins/devflow-implementation/skills/workflow-change-plan/references/code-conventions.md +33 -0
  150. package/plugins/devflow-implementation/skills/workflow-change-plan/references/ddl-guidelines.md +60 -0
  151. package/plugins/devflow-implementation/skills/workflow-change-plan/references/output-template.md +217 -0
  152. package/plugins/devflow-implementation/skills/workflow-change-plan/references/project-rule-contract.md +55 -0
  153. package/plugins/devflow-implementation/skills/workflow-execute-phase/SKILL.md +271 -0
  154. package/plugins/devflow-implementation/skills/workflow-execute-phase/references/execute-phase.md +1251 -0
  155. package/plugins/devflow-implementation/skills/workflow-execute-phase/references/ui-brand.md +160 -0
  156. package/plugins/devflow-intel/agents/project-scout.md +27 -0
  157. package/plugins/devflow-intel/extensions/devflow-intel.ts +104 -0
  158. package/plugins/devflow-intel/package.json +14 -0
  159. package/plugins/devflow-intel/skills/code-index-query/SKILL.md +37 -0
  160. package/plugins/devflow-intel/skills/code-index-query/references/query-patterns.md +27 -0
  161. package/plugins/devflow-intel/skills/workflow-code-index/SKILL.md +68 -0
  162. package/plugins/devflow-intel/skills/workflow-code-index/references/adapter-contract.md +38 -0
  163. package/plugins/devflow-intel/skills/workflow-code-index/references/audit-checklist.md +10 -0
  164. package/plugins/devflow-intel/skills/workflow-code-index/references/confidence-rules.md +43 -0
  165. package/plugins/devflow-intel/skills/workflow-code-index/references/data-model.md +74 -0
  166. package/plugins/devflow-intel/skills/workflow-code-index/references/discovery.md +24 -0
  167. package/plugins/devflow-intel/skills/workflow-code-index/references/query-guide.md +20 -0
  168. package/plugins/devflow-intel/skills/workflow-code-index/scripts/adapters/__init__.py +1 -0
  169. package/plugins/devflow-intel/skills/workflow-code-index/scripts/adapters/base.py +30 -0
  170. package/plugins/devflow-intel/skills/workflow-code-index/scripts/adapters/generic_text.py +287 -0
  171. package/plugins/devflow-intel/skills/workflow-code-index/scripts/adapters/registry.py +17 -0
  172. package/plugins/devflow-intel/skills/workflow-code-index/scripts/code_index.py +437 -0
  173. package/plugins/devflow-intel/skills/workflow-code-index/scripts/core/__init__.py +1 -0
  174. package/plugins/devflow-intel/skills/workflow-code-index/scripts/core/discovery.py +139 -0
  175. package/plugins/devflow-intel/skills/workflow-code-index/scripts/core/hashing.py +11 -0
  176. package/plugins/devflow-intel/skills/workflow-code-index/scripts/core/scanner.py +115 -0
  177. package/plugins/devflow-intel/skills/workflow-code-index/scripts/core/schema.py +123 -0
  178. package/plugins/devflow-intel/skills/workflow-code-index/scripts/validators/__init__.py +1 -0
  179. package/plugins/devflow-intel/skills/workflow-code-index/scripts/validators/project_binding_check.py +66 -0
  180. package/plugins/devflow-intel/skills/workflow-code-index/scripts/validators/relation_check.py +36 -0
  181. package/plugins/devflow-intel/skills/workflow-code-index/scripts/validators/schema_validate.py +11 -0
  182. package/plugins/devflow-intel/skills/workflow-code-index/scripts/validators/stale_check.py +42 -0
  183. package/plugins/devflow-intel/skills/workflow-code-index/scripts/writers/__init__.py +1 -0
  184. package/plugins/devflow-intel/skills/workflow-code-index/scripts/writers/jsonl_writer.py +25 -0
  185. package/plugins/devflow-intel/skills/workflow-code-index/scripts/writers/markdown_writer.py +106 -0
  186. package/plugins/devflow-intel/skills/workflow-code-index/scripts/writers/sqlite_writer.py +143 -0
  187. package/plugins/devflow-intel/skills/workflow-context-sync/SKILL.md +381 -0
  188. package/plugins/devflow-intel/skills/workflow-context-sync/agents/openai.yaml +4 -0
  189. package/plugins/devflow-intel/skills/workflow-context-sync/scripts/context_sync_cursor.py +241 -0
  190. package/plugins/devflow-intel/skills/workflow-update-navigation/SKILL.md +186 -0
  191. package/plugins/devflow-intel/skills/workflow-update-navigation/references/incremental-update-guide.md +47 -0
  192. package/plugins/devflow-quality/agents/code-reviewer.md +18 -0
  193. package/plugins/devflow-quality/agents/verification-runner.md +21 -0
  194. package/plugins/devflow-quality/extensions/devflow-quality.ts +59 -0
  195. package/plugins/devflow-quality/package.json +14 -0
  196. package/plugins/devflow-quality/skills/code-review/SKILL.md +288 -0
  197. package/plugins/devflow-quality/skills/code-review/references/cross-layer-checklist.md +70 -0
  198. package/plugins/devflow-quality/skills/code-review/references/dao-checklist.md +70 -0
  199. package/plugins/devflow-quality/skills/code-review/references/handler-checklist.md +48 -0
  200. package/plugins/devflow-quality/skills/code-review/references/repository-checklist.md +44 -0
  201. package/plugins/devflow-quality/skills/code-review/references/service-checklist.md +57 -0
  202. package/plugins/devflow-quality/skills/code-review/references/spec-checklist.md +34 -0
  203. package/plugins/devflow-quality/skills/code-review/references/vo-checklist.md +26 -0
  204. package/plugins/devflow-quality/skills/workflow-audit-milestone/SKILL.md +31 -0
  205. package/plugins/devflow-quality/skills/workflow-audit-milestone/references/audit-milestone.md +328 -0
  206. package/plugins/devflow-quality/skills/workflow-complete-milestone/SKILL.md +132 -0
  207. package/plugins/devflow-quality/skills/workflow-complete-milestone/assets/milestone-archive.md +123 -0
  208. package/plugins/devflow-quality/skills/workflow-complete-milestone/references/complete-milestone.md +775 -0
  209. package/plugins/devflow-quality/skills/workflow-complete-milestone/references/milestone-archive.md +123 -0
  210. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/SKILL.md +126 -0
  211. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/references/api-mainflow-rules.md +27 -0
  212. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/references/codebase-discovery.md +54 -0
  213. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/references/intermediate-format.md +244 -0
  214. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/references/mainflow-selection.md +36 -0
  215. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/references/project-dsl-contract.md +190 -0
  216. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/references/ui-mainflow-rules.md +110 -0
  217. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/scripts/compile_dsl.py +583 -0
  218. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/scripts/discover_codebases.py +199 -0
  219. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/scripts/normalize_case_payloads.py +177 -0
  220. package/plugins/devflow-quality/skills/workflow-generate-mainflow-cases/scripts/validate_case_payloads.py +370 -0
  221. package/plugins/devflow-quality/skills/workflow-verify-work/SKILL.md +106 -0
  222. package/plugins/devflow-quality/skills/workflow-verify-work/assets/UAT.md +265 -0
  223. package/plugins/devflow-quality/skills/workflow-verify-work/references/verify-work.md +759 -0
  224. package/plugins/devflow-requirements/agents/requirements-auditor.md +20 -0
  225. package/plugins/devflow-requirements/package.json +6 -0
  226. package/plugins/devflow-requirements/skills/requirement-feasibility-review/SKILL.md +219 -0
  227. package/plugins/devflow-requirements/skills/requirement-feasibility-review/agents/openai.yaml +4 -0
  228. package/plugins/devflow-requirements/skills/requirement-feasibility-review/references/review-method.md +257 -0
  229. package/plugins/devflow-requirements/skills/requirement-feasibility-review/references/review-template.md +80 -0
  230. package/plugins/devflow-requirements/skills/workflow-demand-clarify/SKILL.md +325 -0
  231. package/plugins/devflow-requirements/skills/workflow-domain-modeling/SKILL.md +163 -0
  232. package/plugins/devflow-requirements/skills/workflow-requirement-baseline/SKILL.md +748 -0
  233. package/plugins/devflow-requirements/skills/workflow-requirement-baseline/assets/baseline-template.md +281 -0
  234. package/plugins/devflow-requirements/skills/workflow-requirement-baseline/references/antipatterns.md +69 -0
  235. package/plugins/devflow-requirements/skills/workflow-requirement-baseline/references/challenge-review-guide.md +158 -0
  236. package/plugins/devflow-requirements/skills/workflow-requirement-baseline/references/decomposition-guide.md +115 -0
  237. package/plugins/devflow-requirements/skills/workflow-requirement-baseline/references/project-context-guide.md +119 -0
  238. package/plugins/devflow-requirements/skills/workflow-requirement-baseline/references/questioning.md +76 -0
  239. package/plugins/devflow-requirements/skills/workflow-requirement-baseline/references/requirement-review-checklist.md +115 -0
  240. package/plugins/devflow-requirements/skills/workflow-requirement-triage/SKILL.md +204 -0
  241. package/plugins/devflow-requirements/skills/workflow-wayfinder/SKILL.md +183 -0
  242. package/src/cli.ts +76 -0
  243. package/src/constants.ts +15 -0
  244. package/src/doctor.ts +66 -0
  245. package/src/paths.ts +37 -0
  246. package/src/platform-extension.ts +46 -0
  247. package/src/project-context.ts +165 -0
  248. package/src/runtime.ts +167 -0
  249. package/src/usage-stats.ts +101 -0
  250. package/templates/commands/start.md +58 -0
  251. package/templates/omp/AGENTS.md +36 -0
  252. package/templates/omp/config.yml +112 -0
  253. package/templates/omp/hook-config.json +18 -0
  254. package/templates/omp/index-policy.json +57 -0
@@ -0,0 +1,143 @@
1
+ schema_version: 1
2
+ id: uat-remediation
3
+ name: Verify Failure Remediation
4
+ description: >
5
+ Generic remediation flow for failed verification or rejected acceptance checkpoints.
6
+
7
+ entry:
8
+ from_flow: feature-development
9
+ from_step: verify
10
+ triggers:
11
+ state_statuses:
12
+ - failed
13
+ checkpoint_decisions:
14
+ - rejected
15
+ - needs_fix
16
+ artifact_statuses:
17
+ - failed
18
+ initial_step: diagnose
19
+
20
+ state_contract:
21
+ source: ".planning/STATE.md"
22
+ suggested_transition:
23
+ current_flow: uat-remediation
24
+ current_step: diagnose
25
+ status: in_progress
26
+ completed_steps: []
27
+ pending_steps:
28
+ - diagnose
29
+ - execute-fix
30
+ - reverify
31
+ - lesson
32
+
33
+ variables:
34
+ feature:
35
+ source: state.current_feature
36
+ phase:
37
+ source: state.current_phase
38
+
39
+ lessons_policy:
40
+ sources:
41
+ - path: ".context/lessons/README.md"
42
+ required: false
43
+ - path: ".planning/lessons/README.md"
44
+ required: false
45
+ selection:
46
+ enabled: true
47
+ max_candidates: 8
48
+ min_score: 1
49
+ write:
50
+ enabled: true
51
+ default_dir: ".context/lessons"
52
+ index_path: ".context/lessons/README.md"
53
+ template_only: true
54
+
55
+ steps:
56
+ - id: diagnose
57
+ order: 10
58
+ label: Diagnose failure
59
+ skill: workflow-bug-fix
60
+ depends_on: []
61
+ inputs:
62
+ - ".planning/phases/{phase}/01-UAT.md"
63
+ - ".planning/phases/{phase}/01-VERIFICATION.md"
64
+ - ".planning/phases/{phase}/SUMMARY.md"
65
+ - ".planning/features/{feature}/PROGRESS.md"
66
+ - ".planning/artifacts/index.yaml"
67
+ outputs:
68
+ - path: ".planning/phases/{phase}/REMEDIATION.md"
69
+ type: remediation-diagnosis
70
+ required: true
71
+
72
+ - id: execute-fix
73
+ order: 20
74
+ label: Execute fix
75
+ skill: workflow-execute-phase
76
+ depends_on:
77
+ - diagnose
78
+ inputs:
79
+ - ".planning/phases/{phase}/REMEDIATION.md"
80
+ - ".planning/features/{feature}/变更清单.md"
81
+ - ".planning/features/{feature}/PROGRESS.md"
82
+ outputs:
83
+ - path: ".planning/phases/{phase}/REMEDIATION-SUMMARY.md"
84
+ type: remediation-summary
85
+ required: true
86
+
87
+ - id: code-index-refresh
88
+ order: 25
89
+ label: Code index refresh
90
+ skill: workflow-code-index
91
+ depends_on:
92
+ - execute-fix
93
+ inputs:
94
+ - ".planning/phases/{phase}/REMEDIATION-SUMMARY.md"
95
+ - ".planning/features/{feature}/变更清单.md"
96
+ - ".planning/features/{feature}/PROGRESS.md"
97
+ outputs:
98
+ - path: ".planning/code-index/index.sqlite"
99
+ type: code-index-sqlite
100
+ required: true
101
+ - path: ".planning/code-index/AUDIT.md"
102
+ type: code-index-audit
103
+ required: true
104
+
105
+ - id: reverify
106
+ order: 30
107
+ label: Reverify
108
+ skill: workflow-verify-work
109
+ depends_on:
110
+ - code-index-refresh
111
+ inputs:
112
+ - ".planning/phases/{phase}/REMEDIATION-SUMMARY.md"
113
+ - ".planning/features/{feature}/PROGRESS.md"
114
+ outputs:
115
+ - path: ".planning/phases/{phase}/01-UAT.md"
116
+ type: uat-report
117
+ required: true
118
+ - path: ".planning/phases/{phase}/01-VERIFICATION.md"
119
+ type: verification-report
120
+ required: true
121
+ checkpoint: CP-4
122
+
123
+ - id: lesson
124
+ order: 40
125
+ label: Record lesson if needed
126
+ action: write-lesson-if-needed
127
+ depends_on:
128
+ - reverify
129
+ inputs:
130
+ - ".planning/phases/{phase}/REMEDIATION.md"
131
+ - ".planning/phases/{phase}/01-UAT.md"
132
+ - ".planning/phases/{phase}/01-VERIFICATION.md"
133
+ outputs:
134
+ - path: ".context/lessons/README.md"
135
+ type: lessons-index
136
+ required: false
137
+
138
+ return_to:
139
+ flow: feature-development
140
+ step: verify
141
+ status: waiting_checkpoint
142
+ checkpoint: CP-4
143
+ condition: "reverify outputs pass and user confirms CP-4"
@@ -0,0 +1,10 @@
1
+ # Workflow Runtime Files
2
+
3
+ These files are generated and validated by the Devflow OMP runtime.
4
+
5
+ - Inspect state with `devflow_state(action="inspect")`.
6
+ - Initialize a feature with `devflow_bootstrap(feature="...", phase="...")`.
7
+ - Advance only with `devflow_transition`.
8
+ - Rebuild the artifact registry with `devflow_artifact(action="sync")`.
9
+
10
+ Do not edit workflow state or artifact registry files directly.
@@ -0,0 +1,117 @@
1
+ ---
2
+ name: workflow-pipeline
3
+ description: Use when running or resuming the full .planning delivery pipeline from requirements through implementation, verification, audit, and milestone archive.
4
+ ---
5
+
6
+ <objective>
7
+ 全链路研发交付入口。解析用户参数,先确保需求主链“入口分诊 → 探索地图 → 领域建模 → 可实现性审查”完成,再检测当前状态,然后委托 workflow-orchestrator 接管后续所有步骤调度。
8
+ pipeline 本身不包含执行规则——所有门禁、CP 协议、失败分支、并行窗口、lessons 注入规则均由 orchestrator 维护。
9
+ </objective>
10
+
11
+ <process>
12
+
13
+ ## 0. 解析参数
14
+
15
+ 解析 `$ARGUMENTS`:
16
+
17
+ - **功能名**:第一个不以 `@` 或 `--` 开头的参数
18
+ - **需求文档**:以 `@` 开头的参数(如 `@prd.md`),去掉 `@` 即为文件路径
19
+ - **`--resume`**:从 state 记录的位置继续
20
+ - **`--step N`**:从以下步骤编号开始
21
+
22
+ ### 步骤编号(双轨制)
23
+
24
+ | 编号 | 步骤 | 说明 |
25
+ |:----:|------|------|
26
+ | 5 | requirement-triage | 需求入口分诊 |
27
+ | 6 | requirement-wayfinder | 需求探索地图 |
28
+ | 7 | domain-modeling | 领域模型 |
29
+ | 8 | requirement-feasibility-review | 可实现性审查 |
30
+ | 10 | requirement-baseline | 需求基线 |
31
+ | 15 | api-contract | API 契约(分叉前共同事实) |
32
+ | 20 | ui-spec | Track B:UI 设计规范 |
33
+ | 30 | feature-breakdown | Track B:功能点梳理 |
34
+ | 40 | backend-tech-spec | Track A:后端方案 |
35
+ | 45 | api-call-guide | Track A:API 调用指南 |
36
+ | 50 | frontend-tech-spec | Track B:前端方案 |
37
+ | 58 | integration-verify | Merge Gate:契约/后端/前端三方一致性验证 |
38
+ | 60 | change-plan | 变更清单 |
39
+ | 70 | phase-structure | Phase 结构初始化 |
40
+ | 80 | execute | 代码执行 |
41
+ | 84 | code-index-refresh | 刷新机器代码索引并审查 |
42
+ | 85 | code-review | 代码审查(完成标准验证) |
43
+ | 86 | generate-mainflow-cases | 主流程自动化用例生成 |
44
+ | 90 | verify | UAT 验收 |
45
+ | 100 | audit | 里程碑审计 |
46
+ | 110 | update-navigation | 更新导航 |
47
+ | 120 | archive | 里程碑归档 |
48
+
49
+ - **`--track A`**:后端/API 轨道产物模式。可跑 `requirement-triage → requirement-wayfinder → domain-modeling → requirement-feasibility-review → requirement-baseline → api-contract → backend-tech-spec → api-call-guide`,但不能自动进入 `integration-verify / change-plan / execute`。
50
+ - **`--track B`**:前端/UI 轨道产物模式。要求 `api-contract` 已存在且 approved;新需求从需求主链开始,已有契约可跑 `ui-spec → feature-breakdown → frontend-tech-spec`,但不能自动进入 `change-plan / execute`。
51
+ - **未设置 track**:完整交付模式。必须完成双轨并通过 `integration-verify` 后才能进入 `change-plan`。
52
+ - **`--no-review`**:保留参数位,但当前双轨 workflow 不自动跳过 CP-2。Merge Gate 不能跳过。
53
+
54
+ 双轨制原则:API 契约是分叉前的共同事实,`integration-verify` 是合并前的强门禁。单轨只产出局部轨道文档,不代表完整交付。
55
+
56
+ 如果提供了需求文档但未指定功能名,从文档标题自动提取功能名。
57
+
58
+ ## 1. 需求入口前置路由
59
+
60
+ 当用户提供新的需求、PRD、会议纪要或功能描述时,需求主链按依赖顺序强制执行:
61
+
62
+ 1. `workflow-requirement-triage` 只做轻量分类、查重和历史范围检查;正常需求路由到 `ready_for_wayfinder`。
63
+ 2. `workflow-wayfinder` 建立目标、已知事实、边界、迷雾与 ticket;只有活动切片的 L1/L2 迷雾收束后才可完成。
64
+ 3. `workflow-domain-modeling` 固化共同语言、所有权、状态和边缘案例。
65
+ 4. `requirement-feasibility-review` 以流程证明、代码事实和外部能力检查作为进入基线前的最终门禁。
66
+ 5. 仅当审查 meta 的 `baseline_gate = pass` 时,才可进入 `workflow-requirement-baseline`。
67
+
68
+ 若分诊结论为 `already_done`、`wontfix`、`ready_for_human` 或 `needs_info`,停止主链并报告最小下一步。`workflow-demand-clarify` 不再作为固定主链步骤;需要业务问答时,由 Wayfinder 的 Grilling ticket 调用。
69
+
70
+ 如果是 `--resume` 或 STATE.md 已处于 baseline 之后的步骤,不倒灌新增需求主链,除非用户提供了新需求或显式要求重新审查。
71
+
72
+ ## 2. 断点检测
73
+
74
+ 每次启动时,通过 workflow-orchestrator 的程序化 inspector 判断当前状态和下一步动作:
75
+
76
+ ```bash
77
+ devflow_state(action="inspect")
78
+ ```
79
+
80
+ 根据返回的 `action` 字段路由:
81
+
82
+ | `action` | 行为 |
83
+ |----------|------|
84
+ | `run_next_step` | 将控制权交给 orchestrator,由它加载并执行 `next_step.skill` |
85
+ | `run_current_step` | 将控制权交给 orchestrator,由它重新执行 `current_step.skill` |
86
+ | `await_user_confirmation` | 将控制权交给 orchestrator,由它执行 CP 确认流程 |
87
+ | `route_failure_branch` | 将控制权交给 orchestrator,由它切入修复分支 |
88
+ | `run_parallel_window` | 将控制权交给 orchestrator,由它调度并行窗口 |
89
+ | `run_project_context` | 将控制权交给 orchestrator,由它执行项目初始化后重新 inspect |
90
+ | `blocked` | 将阻塞原因报告给用户 |
91
+ | `workflow_complete` | 报告完成,流程结束 |
92
+
93
+ **降级策略**:如果 `inspect_state.rb` 不可用或 `.planning/STATE.md` 缺少 YAML front matter,回退到手动读取 `.planning/pipeline-state.md`,并提示用户运行 `init_state.rb`。
94
+
95
+ ### 轨道参数传递
96
+
97
+ `--track A` 或 `--track B` 参数会写入 `.planning/STATE.md` 的 `active_track` 字段。orchestrator 读取该字段后:
98
+
99
+ - **active_track: A** → 只路由 Track A 允许步骤,Track A 完成后以 `track_scope_complete` 阻断,不进入完整交付。
100
+ - **active_track: B** → 新需求从完整需求主链开始;前端设计步骤依赖 `api-contract` 完成。Track B 完成后以 `track_scope_complete` 阻断。
101
+ - **未设置** → 执行完整双轨交付,`change-plan` 依赖 `integration-verify`。
102
+
103
+ ## 3. 委托 orchestrator
104
+
105
+ 无论 inspect_state 返回什么 action,pipeline 本身的职责到此为止。后续所有调度逻辑由 `workflow-orchestrator` skill 全权处理:
106
+
107
+ ```
108
+ /workflow-orchestrator
109
+ ```
110
+
111
+ orchestrator 读取 `feature-development.yaml` 获取步骤拓扑和 CP 定义,按自己的 Dispatch Rules / Checkpoint Rules / Failure Branch Rules / Parallel Window Rules 执行。
112
+
113
+ </process>
114
+
115
+ <output>
116
+ pipeline 本身不产出文件。所有产物由各 workflow-* skill 写入,由 orchestrator 的 `advance_state.rb` 更新 STATE.md。
117
+ </output>
@@ -0,0 +1,167 @@
1
+ # 研发交付全链路流程
2
+
3
+ ```
4
+ workflow-pipeline 启动
5
+ │
6
+ ▼
7
+ ┌─────────────────────────────────────┐
8
+ │ Step 0: 断点检测 │
9
+ │ 读取 pipeline-state.md 恢复进度 │
10
+ └─────────────────────────────────────┘
11
+ │
12
+ ▼
13
+ ┌─────────────────────────────────────┐
14
+ │ Step 1: 项目初始化 │
15
+ │ workflow-project-context │
16
+ │ 输出: .planning/PROJECT.md │
17
+ └─────────────────────────────────────┘
18
+ │
19
+ ▼
20
+ ┌─────────────────────────────────────┐
21
+ │ Step 2: 需求完善 │
22
+ │ workflow-requirement-baseline │
23
+ │ 输出: .planning/requirements/baseline.md │
24
+ │ 门禁: 冲突/复用/过度工程/替代方案已拍板 │
25
+ └──────────────┬──────────────────────┘
26
+ │ ↑
27
+ ▼ │ 用户拒绝
28
+ ┌─────────────────────────────────────┐
29
+ │ 🔴 CP-1: 需求基线人工确认 │
30
+ │ ask 强制暂停 │
31
+ │ 确认: FP/BR/BC 准确完整 │
32
+ └──────────────┬──────────────────────┘
33
+ │ 用户确认
34
+ ▼
35
+ ┌─────────────────────────────────────┐
36
+ │ Step 3: 三文档并行生成 │
37
+ │ │
38
+ │ ┌──────────┐ ┌──────────┐ ┌──────┐ │
39
+ │ │ feature- │ │frontend- │ │back- │ │
40
+ │ │breakdown │ │tech-spec │ │end- │ │
41
+ │ │ │ │ │ │tech- │ │
42
+ │ │ 功能点 │ │ 前端方案 │ │spec │ │
43
+ │ │ 梳理.md │ │ .md │ │后端 │ │
44
+ │ └──────────┘ └──────────┘ └──────┘ │
45
+ └─────────────────────────────────────┘
46
+ │ ↑
47
+ ▼ │ 用户拒绝
48
+ ┌─────────────────────────────────────┐
49
+ │ 🟡 CP-2: 技术方案人工确认 │
50
+ │ ask 强制暂停 │
51
+ │ --no-review 可跳过 │
52
+ │ 确认: DB/API/架构决策合理可行 │
53
+ └──────────────┬──────────────────────┘
54
+ │ 用户确认
55
+ ▼
56
+ ┌─────────────────────────────────────┐
57
+ │ Step 4: 变更清单 │
58
+ │ workflow-change-plan │
59
+ │ 输入: 前端+后端技术方案 │
60
+ │ 输出: .planning/features/{功能名}/变更清单.md │
61
+ └──────────────┬──────────────────────┘
62
+ │ ↑
63
+ ▼ │ 用户拒绝
64
+ ┌─────────────────────────────────────┐
65
+ │ 🔴 CP-3: 变更清单人工确认 │
66
+ │ ask 强制暂停 │
67
+ │ 不可跳过 │
68
+ │ 确认: DDL/代码/上线步骤可执行 │
69
+ └──────────────┬──────────────────────┘
70
+ │ 用户确认
71
+ ▼
72
+ ┌─────────────────────────────────────┐
73
+ │ Step 4.5: Phase 结构初始化 │
74
+ │ phase-init │
75
+ │ 创建 ROADMAP.md + .planning/phases/ │
76
+ │ 桥接 workflow 产物到 phase 结构 │
77
+ └─────────────────────────────────────┘
78
+ │
79
+ ▼
80
+ ┌─────────────────────────────────────┐
81
+ │ Step 5: 代码执行 │
82
+ │ workflow-execute-phase │
83
+ │ Wave1: DDL → Wave2: Domain/Service │
84
+ │ Wave3: API → Wave4: 前端 → Wave5: 联调│
85
+ │ 输出: SUMMARY.md 写入 phases/ 目录 │
86
+ └──────────────┬──────────────────────┘
87
+ │ ↑
88
+ ▼ │ 修复后重试
89
+ ┌─────────────────────────────────────┐
90
+ │ Step 5.5: 代码索引刷新 │
91
+ │ workflow-code-index │
92
+ │ 刷新 Symbol/Relation/Call Graph │
93
+ │ 输出 .planning/code-index/ + AUDIT │
94
+ └──────────────┬──────────────────────┘
95
+ │ ↑
96
+ ▼ │ 索引审查失败
97
+ ┌─────────────────────────────────────┐
98
+ │ Step 5.6: 代码审查 + 主流程用例 │
99
+ │ code-review + generate-mainflow-cases│
100
+ │ 基于 code-index + 源码 evidence │
101
+ └──────────────┬──────────────────────┘
102
+ │ ↑
103
+ ▼ │ 审查失败/用例生成失败
104
+ ┌─────────────────────────────────────┐
105
+ │ Step 6: UAT 验证 │
106
+ │ workflow-verify-work │
107
+ │ 按功能点逐条验证 │
108
+ │ 失败 → 诊断 → 修复 → 回 Step 5 │
109
+ └──────────────┬──────────────────────┘
110
+ │ ↑
111
+ ▼ │ 用户拒绝
112
+ ┌─────────────────────────────────────┐
113
+ │ 🔴 CP-4: 验收人工确认 │
114
+ │ ask 强制暂停 │
115
+ │ 不可跳过 │
116
+ │ 确认: UAT/5门gate通过,可归档 │
117
+ └──────────────┬──────────────────────┘
118
+ │ 用户确认
119
+ ▼
120
+ ┌─────────────────────────────────────┐
121
+ │ Step 7: 里程碑审计 │
122
+ │ workflow-audit-milestone │
123
+ │ gaps → Bug 修复或人工拆分后重审 │
124
+ └──────────────┬──────────────────────┘
125
+ │ ↑
126
+ ▼ │ 补齐后重试
127
+ ┌─────────────────────────────────────┐
128
+ │ Step 7.5: 更新导航 │
129
+ │ workflow-update-navigation │
130
+ │ 增量同步 navigation 到代码结构 │
131
+ └──────────────┬──────────────────────┘
132
+ ▼
133
+ ┌─────────────────────────────────────┐
134
+ │ Step 8: 里程碑归档 │
135
+ │ workflow-complete-milestone │
136
+ │ 归档 → 更新 PROJECT.md → git tag │
137
+ └─────────────────────────────────────┘
138
+ │
139
+ ▼
140
+ 完成 ✓
141
+ ```
142
+
143
+ ## 断点续接
144
+
145
+ 每次启动时,workflow-pipeline 先读 `.planning/pipeline-state.md`:
146
+
147
+ ```
148
+ 1. 解析 state 文件
149
+ 2. 跳过所有 done 的步骤
150
+ 3. 从第一个 pending/in_progress 的步骤继续
151
+ 4. 如果 state 文件不存在,从头开始
152
+ ```
153
+
154
+ ## 简化流程门禁
155
+
156
+ 只有单文件/单方法/单文档、无跨层影响、无未拍板需求决策时,才允许向用户提议简化流程。用户未明确同意时,继续完整 pipeline。
157
+
158
+ ## 需求拍板门禁
159
+
160
+ Step 2 之后必须检查 `.planning/requirements/baseline.md`:
161
+
162
+ - `待确认事项`
163
+ - `反向审视与用户拍板`
164
+ - `下游输入契约`
165
+ - `.planning/requirements/baseline.meta.json` 中 `review_status` 必须为 `passed`,且 `blocking_pending_count`、`critical_image_missing_count`、`challenge_pending_count`、`code_reality_missing_count` 必须全为 0
166
+
167
+ 影响 scope、语义、归属、兼容性或实现成本的未确认项是阻塞项。不能把它们传入技术方案或变更清单当成已确认范围。
@@ -0,0 +1,125 @@
1
+ # 大需求分片安全指南
2
+
3
+ Use this guide when a requirement is broad enough that one document can hide broken traceability. This is a pipeline-level rule: the same slice must flow from requirement baseline to feature breakdown, API contract, technical specs, change plan, execution, and verification.
4
+
5
+ ## 1. First Principles
6
+
7
+ The executable unit is not "the whole PRD" and not necessarily one FP. The executable unit is a slice that can be reasoned about, implemented, and verified without losing the chain from user outcome to code task.
8
+
9
+ A valid slice has:
10
+
11
+ - One primary business outcome.
12
+ - A bounded actor/entry set.
13
+ - A closed write/read/state chain.
14
+ - Clear dependencies on earlier slices.
15
+ - A test anchor that can prove the slice works.
16
+ - A failure boundary: what is explicitly not included.
17
+
18
+ If a slice cannot be explained in one short table row, it is probably still too large.
19
+
20
+ ## 2. Oversize Triggers
21
+
22
+ Split the requirement before downstream generation when any trigger applies:
23
+
24
+ | Trigger | Threshold |
25
+ |---------|-----------|
26
+ | FP count | More than 8 current-slice FP |
27
+ | Codebase count | More than 2 codebases with code changes |
28
+ | High-risk chains | More than 3 high-risk chains from `trace-integrity-guide.md` |
29
+ | Migration scope | Old-system migration plus new user workflow in the same PRD |
30
+ | Runtime scope | Async job/callback/polling plus user-facing CRUD/list pages |
31
+ | Contract replacement | A new field/config source replaces an old one across multiple callers |
32
+ | Document size | Any planning artifact is projected to exceed about 500 lines before examples |
33
+ | Review failure | Reviewer cannot verify FP -> BR/BC -> tech-spec -> task traceability in one pass |
34
+
35
+ Oversize does not mean reject the requirement. It means create a slice plan and process one slice at a time.
36
+
37
+ ## 3. Slice Design Rules
38
+
39
+ Prefer slices in this order:
40
+
41
+ 1. Foundation slice: schema/config/shared contract needed by later slices, only when independently verifiable.
42
+ 2. Core user journey slice: the smallest path that produces user-visible value.
43
+ 3. Integration/runtime slice: async jobs, callbacks, polling, external platform sync.
44
+ 4. Existing-entry compatibility slice: old callers, old pages, permission/menu reachability.
45
+ 5. Secondary management slice: CRUD/config/reporting pages.
46
+ 6. Hardening slice: observability, cleanup, migration backfill, performance if not needed for core correctness.
47
+
48
+ Do not create a slice that only says "frontend" or "backend". Slice by business outcome and chain closure; each slice may contain frontend and backend work.
49
+
50
+ ## 4. Slice Plan Schema
51
+
52
+ Write this table into the baseline and carry `SL-*` IDs downstream:
53
+
54
+ | Slice ID | Name | Outcome | Included FP/BR/BC | Depends on | Entry/chain | Excluded/deferred | Gate |
55
+ |----------|------|---------|-------------------|------------|-------------|-------------------|------|
56
+ | SL-001 | Core path | User can complete X | FP-001, BR-001, BC-001 | none | page -> API -> table -> list | reporting | UAT path |
57
+
58
+ Rules:
59
+
60
+ - Each FP belongs to exactly one primary slice.
61
+ - A BR/BC may be referenced by multiple slices, but one slice owns its first implementation.
62
+ - Dependencies must be acyclic.
63
+ - Cross-slice shared work must be an explicit foundation slice or a named prerequisite task in the later slice, not hidden inside a broad task.
64
+
65
+ ## 4.5 Coverage Conservation Gate
66
+
67
+ Splitting is allowed to defer implementation, but it must never delete scope silently. Every source item and every decomposed object must have an explicit disposition.
68
+
69
+ Required ledgers:
70
+
71
+ 1. Source coverage ledger: every raw requirement/source row maps to one of `FP-*`, `BR-*`, `BC-*`, `Q-*`, `OUT-*`, or `DUP-*`.
72
+ 2. Slice assignment ledger: every current-feature `FP-*` has exactly one primary disposition: `active slice`, `deferred slice`, or `out of scope`.
73
+ 3. Rule/case ownership ledger: every `BR-*` and `BC-*` has an owner slice or a referenced-slice list plus first-implementation slice.
74
+ 4. Deferred ledger: every deferred item has a reason, dependency, re-entry condition, and gate. "后续处理" without a trigger is not valid.
75
+
76
+ Count checks:
77
+
78
+ | Check | Required result |
79
+ |-------|-----------------|
80
+ | Raw source rows | all mapped to FP/BR/BC/Q/OUT/DUP |
81
+ | Current-feature FP | active + deferred + out-of-scope = total current-feature FP |
82
+ | Active slice FP | all appear in downstream feature-breakdown traceability |
83
+ | Deferred FP | none appear in implementation tasks; all appear in deferred ledger |
84
+ | Out-of-scope items | all have source and user/project reason |
85
+
86
+ Review fails if:
87
+
88
+ - A source row disappears instead of being mapped.
89
+ - A deferred item lacks a re-entry condition.
90
+ - A downstream artifact implements a deferred item without changing the active slice.
91
+ - An item is marked out of scope without source-backed reason or user decision.
92
+ - The count check does not balance.
93
+
94
+ ## 5. Downstream Contract
95
+
96
+ Every downstream artifact must include:
97
+
98
+ - Active slice ID and name.
99
+ - Included FP/BR/BC.
100
+ - Excluded/deferred FP/BR/BC.
101
+ - Cross-slice dependencies read as context only.
102
+ - Slice gate: what must pass before the next slice starts.
103
+
104
+ Downstream skills must fail review when:
105
+
106
+ - They include FP from another slice as implementation scope without marking it as dependency context.
107
+ - They generate tech-spec or change-plan tasks for deferred slice content.
108
+ - They merge multiple slice gates into one "all done" checklist.
109
+ - They omit the active slice ID from traceability tables or task sources.
110
+ - Their traceability count does not match the active slice FP/BR/BC count.
111
+
112
+ ## 6. Adversarial Review
113
+
114
+ Ask these questions before accepting a slice plan:
115
+
116
+ | Attack | Question | Failure signal |
117
+ |--------|----------|----------------|
118
+ | Scope smuggling | Can a later slice's work sneak in as "shared setup"? | Shared task has no independent gate |
119
+ | Dependency fog | Can a slice pass without its prerequisite really working? | Depends on vague module names, not gates |
120
+ | Orphan output | Does any generated page/API/task have no slice outcome? | Task maps only to "migration" or "cleanup" |
121
+ | Cross-layer drift | Can frontend/backend/change-plan pick different FP sets? | No active slice ID in artifacts |
122
+ | Review fatigue | Is the document too long for reviewer to trace all chains? | More than 500 lines or >8 FP without split |
123
+ | False completeness | Can "all FP covered" pass while core chain is broken? | No write/read/test anchor per slice |
124
+
125
+ If any failure signal is present, split again or mark the baseline review as not passed.