@xulthekl/team-flow 0.22.4

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 (405) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/.agents/skills +1 -0
  3. package/.claude/always/phase-guard.md +3 -0
  4. package/.claude-plugin/marketplace.json +20 -0
  5. package/.claude-plugin/plugin.json +31 -0
  6. package/.codex-plugin/plugin.json +45 -0
  7. package/.codexignore +6 -0
  8. package/.cursor-plugin/marketplace.json +17 -0
  9. package/.cursor-plugin/plugin.json +31 -0
  10. package/.github/copilot-instructions.md +15 -0
  11. package/.github/dependabot.yml +10 -0
  12. package/.github/plugin/marketplace.json +42 -0
  13. package/.github/workflows/ci.yml +98 -0
  14. package/.github/workflows/hol-plugin-scanner.yml +17 -0
  15. package/.opencode/INSTALL.md +61 -0
  16. package/.opencode/plugins/team-flow.js +70 -0
  17. package/AGENTS.md +280 -0
  18. package/CHANGELOG.md +635 -0
  19. package/CONTRIBUTING.md +115 -0
  20. package/GEMINI.md +14 -0
  21. package/HANDOFF.md +219 -0
  22. package/INSTALL.md +810 -0
  23. package/LICENSE +21 -0
  24. package/README.md +185 -0
  25. package/SECURITY.md +37 -0
  26. package/agents/bug-investigator.md +180 -0
  27. package/agents/change-split-auditor.md +257 -0
  28. package/agents/code-reviewer.md +171 -0
  29. package/agents/cross-change-consistency-checker.md +215 -0
  30. package/agents/prd-completeness-reviewer.md +197 -0
  31. package/agents/prototype-builder.md +230 -0
  32. package/agents/prototype-env-scout.md +156 -0
  33. package/agents/prototype-reviewer.md +226 -0
  34. package/assets/icon.svg +6 -0
  35. package/dist/index.d.ts +13 -0
  36. package/dist/index.js +5 -0
  37. package/dist/parsing/change-parser.d.ts +12 -0
  38. package/dist/parsing/change-parser.js +54 -0
  39. package/dist/parsing/requirement-blocks.d.ts +31 -0
  40. package/dist/parsing/requirement-blocks.js +192 -0
  41. package/dist/schema/base.d.ts +7 -0
  42. package/dist/schema/base.js +1 -0
  43. package/dist/schema/change.d.ts +25 -0
  44. package/dist/schema/change.js +1 -0
  45. package/dist/schema/index.d.ts +3 -0
  46. package/dist/schema/index.js +1 -0
  47. package/dist/schema/spec.d.ts +11 -0
  48. package/dist/schema/spec.js +1 -0
  49. package/dist/validation/constants.d.ts +42 -0
  50. package/dist/validation/constants.js +42 -0
  51. package/dist/validation/tokenizer.d.ts +17 -0
  52. package/dist/validation/tokenizer.js +173 -0
  53. package/dist/validation/types.d.ts +40 -0
  54. package/dist/validation/types.js +1 -0
  55. package/dist/validation/validator.d.ts +21 -0
  56. package/dist/validation/validator.js +489 -0
  57. package/docs/README_en.md +358 -0
  58. package/docs/artifact-contract.md +96 -0
  59. package/docs/decision-points.md +88 -0
  60. package/docs/e2e-integration-design.md +207 -0
  61. package/docs/examples/README.md +25 -0
  62. package/docs/examples/add-dark-mode/README.md +13 -0
  63. package/docs/examples/add-dark-mode/design.md +49 -0
  64. package/docs/examples/add-dark-mode/execution-contract.md +56 -0
  65. package/docs/examples/add-dark-mode/proposal.md +46 -0
  66. package/docs/examples/add-dark-mode/specs/ui-theme/spec.md +35 -0
  67. package/docs/examples/add-dark-mode/tasks.md +26 -0
  68. package/docs/examples/refactor-auth-boundary/README.md +15 -0
  69. package/docs/examples/refactor-auth-boundary/design.md +41 -0
  70. package/docs/examples/refactor-auth-boundary/execution-contract.md +61 -0
  71. package/docs/examples/refactor-auth-boundary/proposal.md +47 -0
  72. package/docs/examples/refactor-auth-boundary/specs/auth-boundary/spec.md +45 -0
  73. package/docs/examples/refactor-auth-boundary/tasks.md +25 -0
  74. package/docs/plans/2026-07-07-fix-batch-design.md +68 -0
  75. package/docs/plans/2026-07-20-001-refactor-skill-collaboration-protocol-plan.md +128 -0
  76. package/docs/platform-matrix.md +45 -0
  77. package/docs/prototype-design-research.md +206 -0
  78. package/docs/release-checklist.md +96 -0
  79. package/docs/showcase.html +699 -0
  80. package/docs/skill-rename-v0.8.0.md +49 -0
  81. package/docs/state-machine.md +162 -0
  82. package/gemini-extension.json +6 -0
  83. package/hooks/hooks-cursor.json +8 -0
  84. package/hooks/hooks.json +26 -0
  85. package/hooks/pre-tool-use-guard +116 -0
  86. package/hooks/session-start +14 -0
  87. package/llms.txt +51 -0
  88. package/package.json +48 -0
  89. package/plugin.json +27 -0
  90. package/prd/v1/plan.md +443 -0
  91. package/prd/v1/prd.md +580 -0
  92. package/scripts/check-update.mjs +91 -0
  93. package/scripts/check-version-consistency.mjs +345 -0
  94. package/scripts/ensure-branch.mjs +71 -0
  95. package/scripts/get-config +31 -0
  96. package/scripts/guard/checks/artifacts-exist.mjs +36 -0
  97. package/scripts/guard/checks/contract-current.mjs +33 -0
  98. package/scripts/guard/checks/contract-fresh.mjs +17 -0
  99. package/scripts/guard/checks/dp-gate-passed.mjs +35 -0
  100. package/scripts/guard/checks/dp3-approved.mjs +22 -0
  101. package/scripts/guard/checks/execution-plan-ready.mjs +40 -0
  102. package/scripts/guard/checks/execution-reviews-passed.mjs +36 -0
  103. package/scripts/guard/checks/schema-valid.mjs +63 -0
  104. package/scripts/guard/checks/specs-merged.mjs +51 -0
  105. package/scripts/guard/checks/tasks-complete.mjs +31 -0
  106. package/scripts/guard/checks/tests-passing.mjs +31 -0
  107. package/scripts/guard/design-token-guard.mjs +237 -0
  108. package/scripts/guard/guard.mjs +205 -0
  109. package/scripts/infer-workflow.mjs +136 -0
  110. package/scripts/install-amazon-q.mjs +9 -0
  111. package/scripts/install-cline.mjs +9 -0
  112. package/scripts/install-continue.mjs +9 -0
  113. package/scripts/install-cursor.mjs +265 -0
  114. package/scripts/install-git-hooks.mjs +82 -0
  115. package/scripts/install-kiro.mjs +9 -0
  116. package/scripts/install-pi.mjs +9 -0
  117. package/scripts/install-qoder.mjs +9 -0
  118. package/scripts/install-qwen.mjs +9 -0
  119. package/scripts/install-roocode.mjs +9 -0
  120. package/scripts/install-windsurf.mjs +9 -0
  121. package/scripts/install-zcode.mjs +265 -0
  122. package/scripts/lib/cmd-audit.mjs +127 -0
  123. package/scripts/lib/cmd-checkpoint.mjs +118 -0
  124. package/scripts/lib/cmd-config.mjs +88 -0
  125. package/scripts/lib/cmd-doctor.mjs +267 -0
  126. package/scripts/lib/cmd-execution.mjs +206 -0
  127. package/scripts/lib/cmd-handoff.mjs +94 -0
  128. package/scripts/lib/cmd-inject.mjs +310 -0
  129. package/scripts/lib/cmd-install-amazon-q.mjs +11 -0
  130. package/scripts/lib/cmd-install-cline.mjs +11 -0
  131. package/scripts/lib/cmd-install-continue.mjs +11 -0
  132. package/scripts/lib/cmd-install-cursor.mjs +14 -0
  133. package/scripts/lib/cmd-install-kiro.mjs +11 -0
  134. package/scripts/lib/cmd-install-pi.mjs +11 -0
  135. package/scripts/lib/cmd-install-qoder.mjs +11 -0
  136. package/scripts/lib/cmd-install-qwen.mjs +11 -0
  137. package/scripts/lib/cmd-install-roocode.mjs +11 -0
  138. package/scripts/lib/cmd-install-windsurf.mjs +11 -0
  139. package/scripts/lib/cmd-install-workbuddy.mjs +359 -0
  140. package/scripts/lib/cmd-install-zcode.mjs +14 -0
  141. package/scripts/lib/cmd-isolate.mjs +37 -0
  142. package/scripts/lib/cmd-list.mjs +71 -0
  143. package/scripts/lib/cmd-runtime.mjs +85 -0
  144. package/scripts/lib/cmd-solutions.mjs +71 -0
  145. package/scripts/lib/cmd-state.mjs +231 -0
  146. package/scripts/lib/cmd-sync.mjs +102 -0
  147. package/scripts/lib/cmd-validate.mjs +105 -0
  148. package/scripts/lib/cmd-version.mjs +148 -0
  149. package/scripts/lib/config-loader.mjs +107 -0
  150. package/scripts/lib/execution-plan.mjs +492 -0
  151. package/scripts/lib/execution-recommendation.mjs +221 -0
  152. package/scripts/lib/hash.mjs +74 -0
  153. package/scripts/lib/install.mjs +267 -0
  154. package/scripts/lib/platform-runtime-inventory.mjs +27 -0
  155. package/scripts/lib/platforms.mjs +165 -0
  156. package/scripts/lib/prototype-sync.mjs +192 -0
  157. package/scripts/lib/sdd-overlay.mjs +262 -0
  158. package/scripts/lib/shell-quote.mjs +4 -0
  159. package/scripts/lib/solutions-capture.mjs +102 -0
  160. package/scripts/lib/solutions-index-gen.mjs +112 -0
  161. package/scripts/lib/solutions-inject.mjs +77 -0
  162. package/scripts/lib/solutions-promote.mjs +145 -0
  163. package/scripts/lib/spec-paths.mjs +85 -0
  164. package/scripts/lib/state-loader.mjs +154 -0
  165. package/scripts/lint/lint-skills.mjs +149 -0
  166. package/scripts/lint/rules/behavior-consistency.mjs +56 -0
  167. package/scripts/lint/rules/dp-trigger-points.mjs +60 -0
  168. package/scripts/lint/rules/exception-handling.mjs +59 -0
  169. package/scripts/lint/rules/no-contradictory-instructions.mjs +67 -0
  170. package/scripts/lint/rules/no-redundant-checks.mjs +50 -0
  171. package/scripts/lint/rules/token-rules.mjs +122 -0
  172. package/scripts/review-package +44 -0
  173. package/scripts/task-brief +40 -0
  174. package/scripts/team-flow.mjs +164 -0
  175. package/scripts/token-baseline.mjs +158 -0
  176. package/scripts/validate-artifacts +96 -0
  177. package/scripts/verify-marketplace-release.mjs +59 -0
  178. package/skills/architecture-design/SKILL.md +140 -0
  179. package/skills/architecture-design/chapters/ch01-4a-domains.md +27 -0
  180. package/skills/architecture-design/chapters/ch02-change-cascade.md +27 -0
  181. package/skills/architecture-design/chapters/ch03-architecture-outputs.md +25 -0
  182. package/skills/architecture-design/chapters/ch04-entity-to-aggregate.md +27 -0
  183. package/skills/architecture-design/chapters/ch05-cqrs.md +32 -0
  184. package/skills/architecture-design/chapters/ch06-integration.md +54 -0
  185. package/skills/architecture-design/cheatsheet.md +51 -0
  186. package/skills/architecture-design/glossary.md +23 -0
  187. package/skills/architecture-design/patterns.md +32 -0
  188. package/skills/bug-investigator/SKILL.md +77 -0
  189. package/skills/build-executor/SKILL.md +163 -0
  190. package/skills/build-executor/implementer-prompt.md +162 -0
  191. package/skills/build-executor/references/execution-modes.md +86 -0
  192. package/skills/build-executor/task-reviewer-prompt.md +195 -0
  193. package/skills/ce-brainstorm/SKILL.md +415 -0
  194. package/skills/ce-brainstorm/references/agents/slack-researcher.md +127 -0
  195. package/skills/ce-brainstorm/references/blindspot-pass.md +70 -0
  196. package/skills/ce-brainstorm/references/brainstorm-sections.md +285 -0
  197. package/skills/ce-brainstorm/references/handoff.md +168 -0
  198. package/skills/ce-brainstorm/references/html-rendering.md +634 -0
  199. package/skills/ce-brainstorm/references/markdown-rendering.md +241 -0
  200. package/skills/ce-brainstorm/references/model-tiers.md +9 -0
  201. package/skills/ce-brainstorm/references/prd-mapping.md +71 -0
  202. package/skills/ce-brainstorm/references/product-pressure-test.md +42 -0
  203. package/skills/ce-brainstorm/references/reasoning-elevation.md +63 -0
  204. package/skills/ce-brainstorm/references/settled-decisions.md +45 -0
  205. package/skills/ce-brainstorm/references/synthesis-summary.md +282 -0
  206. package/skills/ce-brainstorm/references/universal-brainstorming.md +73 -0
  207. package/skills/ce-brainstorm/references/verdict-routing.md +26 -0
  208. package/skills/ce-brainstorm/references/visual-probes.md +158 -0
  209. package/skills/ce-brainstorm/scripts/visual-probe-server.js +418 -0
  210. package/skills/ce-compound/SKILL.md +114 -0
  211. package/skills/ce-compound/assets/resolution-template.md +94 -0
  212. package/skills/ce-compound/references/agents/best-practices-researcher.md +115 -0
  213. package/skills/ce-compound/references/agents/data-integrity-guardian.md +68 -0
  214. package/skills/ce-compound/references/agents/framework-docs-researcher.md +93 -0
  215. package/skills/ce-compound/references/agents/pattern-recognition-specialist.md +55 -0
  216. package/skills/ce-compound/references/agents/performance-oracle.md +108 -0
  217. package/skills/ce-compound/references/agents/security-sentinel.md +91 -0
  218. package/skills/ce-compound/references/agents/session-historian.md +83 -0
  219. package/skills/ce-compound/references/concepts-vocabulary.md +78 -0
  220. package/skills/ce-compound/references/full-mode-workflow.md +413 -0
  221. package/skills/ce-compound/references/grounding-validation.md +84 -0
  222. package/skills/ce-compound/references/lightweight-mode.md +53 -0
  223. package/skills/ce-compound/references/output-standards.md +182 -0
  224. package/skills/ce-compound/references/promotion-rules.md +38 -0
  225. package/skills/ce-compound/references/schema.yaml +231 -0
  226. package/skills/ce-compound/references/three-tier-index.md +55 -0
  227. package/skills/ce-compound/references/v0.5-upgrade.md +32 -0
  228. package/skills/ce-compound/references/write-flow.md +36 -0
  229. package/skills/ce-compound/references/yaml-schema.md +118 -0
  230. package/skills/ce-compound/scripts/session-history/discover-sessions.sh +130 -0
  231. package/skills/ce-compound/scripts/session-history/extract-errors.py +254 -0
  232. package/skills/ce-compound/scripts/session-history/extract-metadata.py +456 -0
  233. package/skills/ce-compound/scripts/session-history/extract-skeleton.py +575 -0
  234. package/skills/ce-compound/scripts/validate-doc-claims.py +346 -0
  235. package/skills/ce-compound/scripts/validate-frontmatter.py +137 -0
  236. package/skills/ce-ideate/SKILL.md +402 -0
  237. package/skills/ce-ideate/references/agents/issue-intelligence-analyst.md +200 -0
  238. package/skills/ce-ideate/references/agents/learnings-researcher.md +247 -0
  239. package/skills/ce-ideate/references/agents/slack-researcher.md +127 -0
  240. package/skills/ce-ideate/references/agents/web-researcher.md +121 -0
  241. package/skills/ce-ideate/references/divergent-ideation.md +89 -0
  242. package/skills/ce-ideate/references/html-rendering.md +634 -0
  243. package/skills/ce-ideate/references/ideation-sections.md +191 -0
  244. package/skills/ce-ideate/references/markdown-rendering.md +238 -0
  245. package/skills/ce-ideate/references/post-ideation-workflow.md +167 -0
  246. package/skills/ce-ideate/references/universal-ideation.md +107 -0
  247. package/skills/ce-ideate/references/web-research-cache.md +56 -0
  248. package/skills/ce-plan/SKILL.md +137 -0
  249. package/skills/ce-plan/references/agents/agent-native-planning-strategist.md +62 -0
  250. package/skills/ce-plan/references/agents/architecture-strategist.md +46 -0
  251. package/skills/ce-plan/references/agents/best-practices-researcher.md +114 -0
  252. package/skills/ce-plan/references/agents/data-integrity-guardian.md +68 -0
  253. package/skills/ce-plan/references/agents/data-migration-reviewer.md +103 -0
  254. package/skills/ce-plan/references/agents/deployment-verification-agent.md +157 -0
  255. package/skills/ce-plan/references/agents/framework-docs-researcher.md +93 -0
  256. package/skills/ce-plan/references/agents/git-history-analyzer.md +40 -0
  257. package/skills/ce-plan/references/agents/learnings-researcher.md +247 -0
  258. package/skills/ce-plan/references/agents/pattern-recognition-specialist.md +55 -0
  259. package/skills/ce-plan/references/agents/performance-oracle.md +108 -0
  260. package/skills/ce-plan/references/agents/repo-research-analyst.md +258 -0
  261. package/skills/ce-plan/references/agents/security-sentinel.md +91 -0
  262. package/skills/ce-plan/references/agents/slack-researcher.md +127 -0
  263. package/skills/ce-plan/references/agents/spec-flow-analyzer.md +80 -0
  264. package/skills/ce-plan/references/agents/web-researcher.md +121 -0
  265. package/skills/ce-plan/references/approach-altitude.md +55 -0
  266. package/skills/ce-plan/references/change-splitting.md +65 -0
  267. package/skills/ce-plan/references/completion-contract.md +33 -0
  268. package/skills/ce-plan/references/core-principles.md +40 -0
  269. package/skills/ce-plan/references/deepening-workflow.md +263 -0
  270. package/skills/ce-plan/references/dependency-graph.md +36 -0
  271. package/skills/ce-plan/references/html-rendering.md +634 -0
  272. package/skills/ce-plan/references/intake-routing.md +189 -0
  273. package/skills/ce-plan/references/markdown-rendering.md +238 -0
  274. package/skills/ce-plan/references/plan-handoff.md +150 -0
  275. package/skills/ce-plan/references/plan-sections.md +427 -0
  276. package/skills/ce-plan/references/plan-structure.md +120 -0
  277. package/skills/ce-plan/references/planning-modes.md +69 -0
  278. package/skills/ce-plan/references/reasoning-elevation.md +63 -0
  279. package/skills/ce-plan/references/research-workflow.md +165 -0
  280. package/skills/ce-plan/references/review-and-write.md +127 -0
  281. package/skills/ce-plan/references/settled-decisions.md +45 -0
  282. package/skills/ce-plan/references/synthesis-summary.md +418 -0
  283. package/skills/ce-plan/references/universal-planning.md +168 -0
  284. package/skills/ce-proof/SKILL.md +346 -0
  285. package/skills/ce-strategy/SKILL.md +97 -0
  286. package/skills/ce-strategy/references/interview.md +143 -0
  287. package/skills/ce-strategy/references/strategy-template.md +89 -0
  288. package/skills/code-reviewer/SKILL.md +84 -0
  289. package/skills/code-reviewer/code-reviewer-prompt.md +195 -0
  290. package/skills/contract-builder/SKILL.md +72 -0
  291. package/skills/design-system/SKILL.md +75 -0
  292. package/skills/design-system/references/agents/design-system-architect.md +138 -0
  293. package/skills/design-system/references/creation-flow.md +170 -0
  294. package/skills/design-system/references/preview-template.html +319 -0
  295. package/skills/design-system/references/token-derivation.md +115 -0
  296. package/skills/design-system/references/variant-schema.md +60 -0
  297. package/skills/e2e/SKILL.md +56 -0
  298. package/skills/e2e/references/test-verifier.md +40 -0
  299. package/skills/need-explorer/SKILL.md +79 -0
  300. package/skills/prototype/SKILL.md +98 -0
  301. package/skills/prototype/references/agents/design-system-architect.md +122 -0
  302. package/skills/prototype/references/checklist.md +82 -0
  303. package/skills/prototype/references/craft/accessibility-baseline.md +71 -0
  304. package/skills/prototype/references/craft/anti-ai-slop.md +87 -0
  305. package/skills/prototype/references/craft/laws-of-ux.md +60 -0
  306. package/skills/prototype/references/craft/state-coverage.md +81 -0
  307. package/skills/prototype/references/craft/typography-hierarchy.md +50 -0
  308. package/skills/prototype/references/layouts.md +223 -0
  309. package/skills/prototype/references/orchestration-flow.md +101 -0
  310. package/skills/prototype/references/prototype-scaffold/assets/design-tokens.css +19 -0
  311. package/skills/prototype/references/prototype-scaffold/components/button.html +3 -0
  312. package/skills/prototype/references/prototype-scaffold/design-system.md +7 -0
  313. package/skills/prototype/references/prototype-scaffold/flow.md +11 -0
  314. package/skills/prototype/references/prototype-scaffold/index.html +20 -0
  315. package/skills/prototype/references/prototype-scaffold/pages/index.html +11 -0
  316. package/skills/prototype/references/template.html +396 -0
  317. package/skills/release-archivist/SKILL.md +166 -0
  318. package/skills/release-archivist/references/closing-procedures.md +81 -0
  319. package/skills/session-handoff/SKILL.md +110 -0
  320. package/skills/session-handoff/references/context-extraction.md +70 -0
  321. package/skills/session-handoff/references/handoff-template.md +90 -0
  322. package/skills/session-handoff/references/skill-recommendation.md +43 -0
  323. package/skills/spec-merger/SKILL.md +66 -0
  324. package/skills/spec-writer/SKILL.md +149 -0
  325. package/skills/workflow-bootstrap/SKILL.md +148 -0
  326. package/skills/workflow-bootstrap/references/agents/codebase-recon-analyst.md +121 -0
  327. package/skills/workflow-bootstrap/references/b1-reconnaissance.md +80 -0
  328. package/skills/workflow-bootstrap/scripts/recon-probe.sh +328 -0
  329. package/skills/workflow-feedback/SKILL.md +120 -0
  330. package/skills/workflow-feedback/references/category-guide.md +121 -0
  331. package/skills/workflow-feedback/references/feedback-template.md +73 -0
  332. package/skills/workflow-feedback/references/review-mode.md +92 -0
  333. package/skills/workflow-orchestrator/SKILL.md +94 -0
  334. package/skills/workflow-orchestrator/references/feedback-loops.md +56 -0
  335. package/skills/workflow-orchestrator/references/s1-path-router.md +81 -0
  336. package/skills/workflow-orchestrator/references/s2-prd-prototype-loop.md +96 -0
  337. package/skills/workflow-orchestrator/references/s3-plan-pipeline.md +50 -0
  338. package/skills/workflow-orchestrator/references/s4-split-validate.md +108 -0
  339. package/skills/workflow-orchestrator/references/s5-monitoring.md +61 -0
  340. package/skills/workflow-orchestrator/references/state-model.md +185 -0
  341. package/skills/workflow-start/SKILL.md +147 -0
  342. package/skills/workflow-start/references/routing-rules.md +155 -0
  343. package/src/index.ts +16 -0
  344. package/src/parsing/change-parser.ts +79 -0
  345. package/src/parsing/requirement-blocks.ts +244 -0
  346. package/src/schema/base.ts +8 -0
  347. package/src/schema/change.ts +29 -0
  348. package/src/schema/index.ts +3 -0
  349. package/src/schema/spec.ts +12 -0
  350. package/src/validation/constants.ts +53 -0
  351. package/src/validation/tokenizer.ts +180 -0
  352. package/src/validation/types.ts +47 -0
  353. package/src/validation/validator.ts +552 -0
  354. package/templates/abandonment-summary.md +29 -0
  355. package/templates/design.md +37 -0
  356. package/templates/execution-contract.md +99 -0
  357. package/templates/plan.md +86 -0
  358. package/templates/prd.md +468 -0
  359. package/templates/proposal.md +37 -0
  360. package/templates/spec.md +31 -0
  361. package/templates/tasks.md +47 -0
  362. package/tests/e2e.test.mjs +266 -0
  363. package/tests/lib/cmd-audit.test.mjs +202 -0
  364. package/tests/lib/cmd-checkpoint.test.mjs +98 -0
  365. package/tests/lib/cmd-config.test.mjs +101 -0
  366. package/tests/lib/cmd-doctor.test.mjs +450 -0
  367. package/tests/lib/cmd-execution.test.mjs +647 -0
  368. package/tests/lib/cmd-handoff.test.mjs +137 -0
  369. package/tests/lib/cmd-inject.test.mjs +218 -0
  370. package/tests/lib/cmd-install-workbuddy.test.mjs +113 -0
  371. package/tests/lib/cmd-install-zcode.test.mjs +42 -0
  372. package/tests/lib/cmd-isolate.test.mjs +68 -0
  373. package/tests/lib/cmd-list.test.mjs +127 -0
  374. package/tests/lib/cmd-runtime.test.mjs +83 -0
  375. package/tests/lib/cmd-state-missing.test.mjs +65 -0
  376. package/tests/lib/cmd-state.test.mjs +365 -0
  377. package/tests/lib/cmd-sync-paths.test.mjs +84 -0
  378. package/tests/lib/cmd-validate-paths.test.mjs +90 -0
  379. package/tests/lib/config-loader.test.mjs +175 -0
  380. package/tests/lib/ensure-branch.test.mjs +59 -0
  381. package/tests/lib/execution-control-plane.test.mjs +168 -0
  382. package/tests/lib/execution-plan.test.mjs +474 -0
  383. package/tests/lib/guard-specs-merged.test.mjs +108 -0
  384. package/tests/lib/guard-tests-passing.test.mjs +112 -0
  385. package/tests/lib/guard-transitions.test.mjs +262 -0
  386. package/tests/lib/guard.test.mjs +611 -0
  387. package/tests/lib/hash.test.mjs +138 -0
  388. package/tests/lib/infer-workflow.test.mjs +161 -0
  389. package/tests/lib/install-git-hooks.test.mjs +20 -0
  390. package/tests/lib/marketplace-release-docs.test.mjs +31 -0
  391. package/tests/lib/minimality-discipline.test.mjs +37 -0
  392. package/tests/lib/model-profiles-docs.test.mjs +33 -0
  393. package/tests/lib/node20-compatibility.test.mjs +73 -0
  394. package/tests/lib/node20-test-entry.test.mjs +17 -0
  395. package/tests/lib/platform-runtime-distribution.test.mjs +150 -0
  396. package/tests/lib/raw-mode-smoke.test.mjs +42 -0
  397. package/tests/lib/sdd-overlay.test.mjs +118 -0
  398. package/tests/lib/spec-paths.test.mjs +80 -0
  399. package/tests/lib/state-loader.test.mjs +251 -0
  400. package/tests/lib/token-baseline.test.mjs +72 -0
  401. package/tests/lib/token-rules.test.mjs +94 -0
  402. package/tests/lib/verify-marketplace-release.test.mjs +128 -0
  403. package/tests/tsconfig.json +12 -0
  404. package/token-baseline.json +95 -0
  405. package/tsconfig.json +14 -0
@@ -0,0 +1,427 @@
1
+ # Plan Sections
2
+
3
+ This reference describes what makes a great implementation plan. It does NOT
4
+ prescribe how the plan looks on the page — rendering is handled by the
5
+ format-specific references (`markdown-rendering.md`, `html-rendering.md`).
6
+
7
+ ## The outcome
8
+
9
+ A great plan enables three audiences to act:
10
+
11
+ - **The implementing agent** (`ce-work` or a human) starts from an informed
12
+ baseline — load-bearing decisions are named, research breadcrumbs orient
13
+ their own investigation, unit boundaries are clear. The plan gives the
14
+ implementer a starting point, not a substitute for their own investigation.
15
+ - **The reviewer** identifies the load-bearing decisions and the boundaries
16
+ of what's being changed in one pass.
17
+ - **The future reader** (anyone returning months later) traces why the work
18
+ was done, what shaped it, and where the artifacts live.
19
+
20
+ Sections earn their place by serving one of these audiences. Omit padding.
21
+
22
+ ## Unified plan artifact contract
23
+
24
+ `ce-plan` writes the canonical compound-engineering plan artifact. The same
25
+ artifact may begin as a requirements-only skeleton from `ce-brainstorm` and
26
+ later be enriched by `ce-plan`; it is still one plan file moving through
27
+ readiness states, not a requirements doc plus a separate implementation doc.
28
+
29
+ When the artifact is meant to be consumed by implementation agents, use:
30
+
31
+ - **`artifact_contract: ce-unified-plan/v1`** — declares this contract.
32
+ - **`artifact_readiness`** — document completeness, not work progress. Valid
33
+ values are:
34
+ - `requirements-only` — Product Contract exists; planning sections are not
35
+ complete and the artifact is not executable.
36
+ - `implementation-ready` — Product Contract, Planning Contract,
37
+ Implementation Units, Verification Contract, and Definition of Done are
38
+ complete enough for `ce-work`, `/goal`, or an equivalent executor, **and no
39
+ launch-blocking open question remains**. A plan that is otherwise complete
40
+ but still has a blocking product/architecture question stays
41
+ `requirements-only`, so the next step it routes to is blocker resolution /
42
+ planning, not implementation. Deferred (non-blocking) questions
43
+ do not hold readiness back — mark each open question as blocking or deferred
44
+ so this distinction is explicit.
45
+ - **`product_contract_source`** — where the Product Contract came from:
46
+ `ce-brainstorm`, `ce-plan-bootstrap`, `legacy-requirements`, or another
47
+ explicit source string when a repo has a specialized producer.
48
+ - **`execution`** — `code` for implementation plans, `knowledge-work` for
49
+ non-code deliverables. Absence remains legacy-compatible and means `code`
50
+ only for older plans without `artifact_contract`.
51
+
52
+ Do **not** use progress-like readiness values such as `active`,
53
+ `in_progress`, `completed`, or `done`. Readiness answers "can the artifact be
54
+ executed?", not "has execution happened?" Plans still carry no `status` field
55
+ and no mutable execution lifecycle.
56
+
57
+ Do **not** use `artifact_readiness: approach-plan`. Approach-plans,
58
+ answer-seeking outputs, and universal-planning outputs are outside this
59
+ software implementation artifact contract unless they include the full Product
60
+ Contract, Planning Contract, Implementation Units, Verification Contract, and
61
+ Definition of Done required for software execution. Route those artifacts by
62
+ their own shape or by `execution: knowledge-work`, not by adding a third
63
+ unified readiness value.
64
+
65
+ ## Section ID Registry
66
+
67
+ Unified artifacts use these stable logical sections. Markdown uses the
68
+ heading text; HTML uses matching visible headings and anchor IDs. Downstream
69
+ skills grep or anchor-scan for these names before reading large bodies.
70
+
71
+ | Logical section | Markdown heading | HTML id | Reader use |
72
+ |---|---|---|---|
73
+ | Goal Capsule | `## Goal Capsule` | `goal-capsule` | Objective, authority hierarchy, and stop conditions |
74
+ | Product Contract | `## Product Contract` | `product-contract` | Requirements, actors, flows, acceptance examples, product scope |
75
+ | Product Requirements | `### Requirements` under Product Contract | `product-requirements` | Requirement extraction for review and implementation trace |
76
+ | Planning Contract | `## Planning Contract` | `planning-contract` | KTDs, technical design, assumptions, sequencing |
77
+ | Implementation Units | `## Implementation Units` | `implementation-units` | U-ID work packets for execution |
78
+ | Verification Contract | `## Verification Contract` | `verification-contract` | Repo-specific test commands and quality gates |
79
+ | Definition of Done | `## Definition of Done` | `definition-of-done` | Global and per-unit completion criteria |
80
+ | Appendix | `## Appendix` | `appendix` | Long research, raw notes, or supporting detail |
81
+
82
+ Requirements-only artifacts are kept light: a Goal Capsule and the Product
83
+ Contract. They must not point implementers at absent Planning Contract,
84
+ Implementation Units, Verification Contract, or Definition of Done sections.
85
+ `ce-plan` adds those implementation sections when it enriches to
86
+ implementation-ready. Implementation-ready artifacts include the full registry
87
+ above, except Appendix remains optional.
88
+
89
+ ### Wayfinding: map before reading (size-aware)
90
+
91
+ The document does not carry a reading guide; consuming skills own the reading
92
+ algorithm. A **short** plan — a lightweight or requirements-only artifact that
93
+ fits in a screen or two — can just be read in full; that is cheaper and simpler
94
+ than scanning and ranging. But an implementation-ready unified plan is often
95
+ long, and HTML output (also supported) is more verbose still, so for anything
96
+ beyond short, do **not** load the entire artifact to find your way around.
97
+ Build a section map first, then read only the ranges the task needs:
98
+
99
+ - **Markdown:** scan headings to get the section and unit map — e.g.
100
+ `rg -n '^#{1,3} ' <plan>` (top-level sections plus `### U<N>.` units).
101
+ - **HTML:** scan the heading elements (`<h1>`–`<h3>`) and their anchor ids;
102
+ match on the section name and ignore the wrapper tags.
103
+
104
+ In both formats the section **names and anchor ids are the stable contract**
105
+ from the Section ID Registry above (`Goal Capsule`/`goal-capsule`,
106
+ `Verification Contract`/`verification-contract`, `### U<N>.` units, …). Wayfind
107
+ against those registry names, not a brittle tag/format pattern, so the
108
+ instruction survives rendering changes. After mapping, read metadata, then only
109
+ the sections the task needs — e.g. Goal Capsule, the active U-ID plus its cited
110
+ R/F/AE/KTD, Verification Contract, and Definition of Done. Read the Appendix or
111
+ unrelated units only when a section you are already reading cites them.
112
+
113
+ ## Decide whether a plan doc is warranted at all
114
+
115
+ Not every invocation of `ce-plan` should produce a plan document. For
116
+ genuinely atomic work, the doc is ceremony — the implementer (whether
117
+ `ce-work` or a human) can act directly without IDed units, KTDs, or
118
+ Requirements as a checklist.
119
+
120
+ **Bias toward producing a plan.** The risk asymmetry favors writing one:
121
+ a thin plan doc for small work is mild ceremony, but skipping a plan when
122
+ one was warranted costs the implementer real time (reinvented decisions,
123
+ lost unit boundaries, no IDed requirements to verify against). When unsure,
124
+ write the plan.
125
+
126
+ **Skip implementation-ready plan creation only when ALL of these hold:**
127
+
128
+ - The work is **atomic** — fits in one commit, no meaningful unit boundaries
129
+ to break out independently.
130
+ - There are **no design choices that constrain implementation** — no
131
+ Key Technical Decisions worth recording. If the work needs the implementer
132
+ to make a choice between two approaches, those approaches are KTDs and
133
+ a plan is warranted.
134
+ - There are **no scope boundaries worth pinning** in writing — the work
135
+ scope is self-evident from the user's request.
136
+ - **No upstream artifact** (a brainstorm with R-IDs, an incident report,
137
+ a deferred-follow-up item from a prior plan) needs traceability through
138
+ this plan.
139
+
140
+ **Stress test the "looks atomic" case.** Many requests look atomic at first
141
+ glance but hide design decisions:
142
+
143
+ - *"Add caching to this endpoint"* — sounds atomic, but TTL, invalidation,
144
+ cache key shape, and backend selection are all KTDs. Write the plan.
145
+ - *"Migrate from package A to package B"* — sounds mechanical, but
146
+ semantic differences between the packages create migration KTDs. Write
147
+ the plan.
148
+ - *"Add rate limiting"* — sounds small, but algorithm, scope, and
149
+ configurability are all KTDs. Write the plan.
150
+
151
+ vs. genuine skip cases:
152
+
153
+ - *"Fix typo in README line 47"* — atomic, no KTDs, skip the plan.
154
+ - *"Rename `oldFn` to `newFn` across the repo"* — mechanical, no design
155
+ choices, skip the plan.
156
+ - *"Bump dependency X to v2.3.1"* — mechanical, skip the plan (unless the
157
+ bump introduces breaking changes that warrant unit-by-unit migration).
158
+
159
+ When skipping the plan doc, the work proceeds directly to `ce-work` or to
160
+ implementation, and any decisions made along the way land in the commit
161
+ message or `docs/solutions/` if they're worth carrying forward.
162
+
163
+ ## Implementation-ready hard floor
164
+
165
+ When an implementation-ready software plan is warranted, these sections are
166
+ present. They carry the contracts downstream consumers depend on.
167
+
168
+ - **Goal Capsule** — objective, authority hierarchy, stop conditions, execution
169
+ profile, and tail ownership. This is the fastest way for an executor to
170
+ avoid drifting from the plan.
171
+ - **Product Contract** — product scope and behavior. Contains Summary, Problem
172
+ Frame, Requirements with stable R-IDs, and any material Actors, Flows,
173
+ Acceptance Examples, Success Criteria, Scope Boundaries, Dependencies,
174
+ Outstanding Questions, and Sources. This replaces the separate requirements
175
+ artifact in new brainstorm-to-plan flows.
176
+ - **Planning Contract** — the implementation-facing decisions: Key Technical
177
+ Decisions, high-level design, assumptions, implementation constraints,
178
+ sequencing, and research that shapes how the Product Contract will be built.
179
+ - **Implementation Units** (with stable U-IDs) — discrete work packets sized so
180
+ each is independently executable. Each unit names Goal, Requirements,
181
+ Files, Approach, Test Scenarios, and Verification. `ce-work` and goal-mode
182
+ executors consume these units.
183
+ - **Unit Index (large plans only, ~10+ units).** When the plan has roughly
184
+ ten or more units, open the section with a compact navigation table — one
185
+ row per unit: **U-ID · one-line title · files touched · depends-on**. It
186
+ lets an executor map units to files and resolve dependency order without
187
+ scanning every unit body. It is a **navigation aid only**: the unit bodies
188
+ stay authoritative, it carries nothing beyond those four fields (no
189
+ approach, tests, or rationale), and `files touched` is the key/primary
190
+ paths, not an exhaustive restatement. **Omit it below ~10 units** — there
191
+ the per-unit `Dependencies`/`Files` (and any sequencing or dependency
192
+ diagram) already suffice, and an index would be ceremony.
193
+ - **Verification Contract** — repo-specific commands and quality gates,
194
+ including which tests prove the plan, when `release:validate` applies, and
195
+ what behavioral skill evaluation is required. Avoid generic "run tests"
196
+ language when the repo has concrete commands. When the goal is
197
+ optimization-shaped (build time, latency, coverage, bundle size), express a
198
+ measurable threshold as the exit criterion (e.g., "p95 latency < 200ms",
199
+ "build time reduced 30%") and consider routing to `ce-optimize` — a metric
200
+ target is a sharper done signal for a long-running goal than a boolean check.
201
+ - **Definition of Done** — global and per-unit done criteria. This is the
202
+ completion contract for `/goal` or equivalent long-running workflows. Include
203
+ a cleanup criterion: a long autonomous run accumulates dead-end and
204
+ experimental code from approaches that did not pan out; declaring done
205
+ requires that abandoned-attempt code is removed, not left in the diff.
206
+
207
+ ## Include when material
208
+
209
+ These sections are present when they carry information that isn't covered
210
+ elsewhere. The test is not "is this a substantial plan?" — it is
211
+ *"does this specific plan have content this section would surface?"* Filling
212
+ a section with placeholder prose is worse than omitting it.
213
+
214
+ - **High-Level Technical Design** — include when the technical approach has
215
+ shape that prose alone doesn't carry well: architecture across components,
216
+ sequencing across processes, state machines, branching gates.
217
+ Visualizations (component topology, sequence, swim lane, flowchart,
218
+ data-flow) typically live here. Skip when the approach is a one-paragraph
219
+ pattern application that the prose itself conveys.
220
+
221
+ - **Scope Boundaries** — include when scope is contested, when there are
222
+ tempting non-goals worth naming explicitly, or when "deferred for later"
223
+ needs distinguishing from "outside the product's identity." Skip when scope
224
+ is obvious from Requirements alone.
225
+
226
+ - **Open Questions** — include when there are genuinely unresolved items that
227
+ block planning or implementation. Skip when the plan is complete; an empty
228
+ "Open Questions: none" section signals false uncertainty.
229
+
230
+ - **System-Wide Impact** — include when the change affects cross-cutting
231
+ concerns (data lifecycles, auth boundaries, performance posture, cardinal
232
+ rules, shared infrastructure, agent/tool parity, prompt context, shared
233
+ workspaces). Skip for changes localized to one component where the impact is
234
+ self-evident.
235
+
236
+ - **Risks & Dependencies** — include when there are real risks worth flagging
237
+ (external service changes, version pins under churn, behavioral assumptions
238
+ worth highlighting) or material upstream dependencies. Skip for low-risk
239
+ localized work.
240
+
241
+ - **Acceptance Examples** — include when any requirement has a state-dependent
242
+ or conditional shape ("When X, Y") where the prose alone leaves ambiguity
243
+ about edge cases. Skip when all requirements are unconditional and
244
+ unambiguous.
245
+
246
+ - **Documentation / Operational Notes** — include when documentation,
247
+ monitoring, runbooks, or rollout steps need explicit notes. Skip when the
248
+ work is purely internal and uses existing operational scaffolding without
249
+ modification.
250
+
251
+ - **Sources / Research** — surface the research that orients the implementer
252
+ or justifies load-bearing choices. The test: *"if I were the implementer
253
+ reading this cold, would this breadcrumb help me make better choices?"*
254
+ Yes → surface (code locations like `services/convex/reports.ts:174-176`,
255
+ external docs, RFCs, constraints, prior plans — the category is inclusive,
256
+ not enumerated). Process exhaust (reading the user's prompt, glancing at
257
+ obvious entry points, restating prose) → omit. Surface inline next to the
258
+ KTD or unit it justifies, or as a dedicated section — both shapes work.
259
+
260
+ ## Agent agency
261
+
262
+ The catalog is a floor, not a ceiling. When the plan's content doesn't fit
263
+ any catalog section, introduce a new one — don't force the content into a
264
+ section it doesn't belong in. Content drives section choices, not vice
265
+ versa.
266
+
267
+ The agent also picks per artifact:
268
+
269
+ - Whether Problem Frame merges into Summary
270
+ - Sub-groupings (Requirements by capability, KTDs by component, Units phased
271
+ into milestones)
272
+ - How much detail each section carries
273
+ - Whether HTD has one diagram, several, or none — and whether visualizations
274
+ live in HTD or embedded in other sections
275
+
276
+ ## Prose economy
277
+
278
+ "Include when material" sizes *which* sections appear; this sizes *how the kept
279
+ prose reads*. A section can be material and still be written loosely — the
280
+ failure mode is a material section padded into a wall of text where
281
+ contradictions hide and the implementing agent loses the thread. A deep plan
282
+ earns length through coverage (more units, more traced requirements, real
283
+ risks), never through wordiness around that coverage.
284
+
285
+ Hold every kept section to these:
286
+
287
+ - **Lead with the decision or outcome.** Put the conclusion first, then the
288
+ reason, then background; keep one claim plus its support per paragraph. Don't
289
+ bury a Key Technical Decision, the chosen scope, an open blocker, or a unit
290
+ goal beneath its rationale. This does not override section roles — Summary
291
+ stays proposal-only, Problem Frame stays motivation-only and never restates
292
+ the remedy.
293
+ - **One idea per sentence.** A Summary is a handful of sentences, not one
294
+ sentence with five semicolons and four parentheticals. A KTD's rationale is
295
+ the load-bearing reason, not every reason.
296
+ - **A requirement or unit is one sentence of intent plus at most one
297
+ qualifier.** When it would specify two outcomes ("either A or B, the
298
+ implementer decides"), state the intent and send the fork to Open Questions —
299
+ don't write both arms in full inside the item.
300
+ - **Cut hedges and intensifiers.** "Critically", "deliberately", "explicitly",
301
+ "genuinely", "actually", "simply" carry nothing the implementer acts on.
302
+ - **Prefer the verb to the nominalization.** "Demote the grid", not "the
303
+ demotion of the grid is the deliberate change in this plan".
304
+
305
+ Precision is not padding: keep file paths, IDs, dates, domain terms,
306
+ conditionals, and exact thresholds verbatim; when a concrete anchor is knowable
307
+ from the work already done, use it instead of a vague abstraction. Economy
308
+ targets the connective tissue around precision, never the precision itself.
309
+
310
+ **Resolve in place; don't stratify.** When deepening, a doc-review pass, or a
311
+ later decision supersedes earlier text, rewrite or remove the original — don't
312
+ leave it standing as strikethrough or stack a separate "resolutions" layer on
313
+ top of it. Version control holds the history. Stacked strata double the reading
314
+ surface and hide which text is live.
315
+
316
+ **Named test, run before the plan is declared written:** could the implementer
317
+ find a contradiction in each section in one pass? A sentence carrying more than
318
+ one parenthetical, or an item specifying two outcomes, fails the test — split it
319
+ or defer it.
320
+
321
+ ## Plan metadata fields
322
+
323
+ Every plan carries a small set of stable metadata fields that downstream
324
+ tooling depends on. The contract is format-independent: in markdown these
325
+ fields appear as YAML frontmatter at the top of the file; in HTML they
326
+ appear as visible header text (typically a `<dl>` of `<dt>`/`<dd>` pairs or
327
+ a stats strip). Field names and semantics are the same across both formats
328
+ so consumers can locate them without knowing which format produced the
329
+ plan.
330
+
331
+ ### Required
332
+
333
+ - **`title`** — the plan's descriptive name with a ` - Plan` suffix
334
+ (e.g., `Highlighter Tool - Plan`), matching the H1 (markdown) or document
335
+ `<h1>` (HTML) so file metadata and visible heading don't drift. Stable
336
+ across readiness states (it is a plan at every stage). Do not put a
337
+ conventional-commit prefix (`feat:`/`fix:`) in the title — the `type` field
338
+ carries that classification.
339
+ - **`type`** — conventional-commit-prefix-aligned classification (`feat`,
340
+ `fix`, `refactor`, `chore`, `docs`, `perf`, `test`, etc.). Carries the
341
+ intent the eventual commit message should reflect.
342
+ - **`date`** — creation date in ISO 8601 (`YYYY-MM-DD`), ASCII digits only.
343
+
344
+ Plans carry **no `status` field** — a plan is a decision artifact, not a
345
+ tracked work item. `ce-work` does not mutate the plan at ship time;
346
+ whether a plan shipped is derived from git, not stored in the doc. Do not
347
+ add a `status` field or an `active → completed` lifecycle.
348
+
349
+ ### Optional but well-known
350
+
351
+ These fields are not required, but when set they have fixed names and
352
+ semantics so downstream tooling can rely on them:
353
+
354
+ - **`origin`** — repo-relative path to an upstream brainstorm requirements
355
+ doc (e.g., `docs/brainstorms/2026-05-12-pagination-requirements.md`).
356
+ Set when planning from an upstream brainstorm; carried for traceability
357
+ and re-resolved when `ce-plan` re-deepens.
358
+ - **`deepened`** — ISO 8601 date marking the first time the confidence
359
+ check substantively strengthened the plan. Presence affects Phase 0.1
360
+ resume fast-path logic (see `references/deepening-workflow.md`).
361
+ - **`execution`** — execution domain for downstream routing: `code`
362
+ (the default when absent) or `knowledge-work`. `ce-work`'s input triage
363
+ reads this: a plan marked `execution: knowledge-work` routes to the
364
+ non-code carve-out (read sources, synthesize, produce a deliverable —
365
+ skipping the branch/test/commit/CI lifecycle); absent or `code` routes
366
+ to the normal code path. Written by `ce-plan`'s approach-altitude flow
367
+ (`references/approach-altitude.md`) when a non-code deliverable is
368
+ persisted for execution.
369
+
370
+ Field names are stable across plan revisions — never rename a field or
371
+ repurpose its semantics. Agents composing new plans MUST use these exact
372
+ names; adding new fields is fine, but renaming `origin` to `source` or
373
+ `date` to `created` breaks the downstream consumers above.
374
+
375
+ ## ID and content rules
376
+
377
+ These apply regardless of rendering format.
378
+
379
+ - **Stable IDs.** R-IDs (Requirements), U-IDs (Implementation Units), A-IDs
380
+ (if Actors fire), F-IDs (if Flows fire), AE-IDs (if Acceptance Examples
381
+ fire). IDs are stable across plan revisions — never renumber to "clean
382
+ up gaps."
383
+ - **Plain prefix.** `R1.`, `U1.` as bullet prefixes. Do not bold; the prefix
384
+ is visually distinctive on its own.
385
+ - **Repo-relative paths.** Always. Never absolute paths in plan content;
386
+ they break portability across machines, worktrees, teammates.
387
+ - **No process exhaust.** No "captured at Phase X" notes, no `## Next Steps`
388
+ pointing to the next skill, no italic provenance lines. Engineering process
389
+ metadata belongs in commit messages and tool output, not the artifact.
390
+ - **Session-settled annotations on KTDs.** A Key Technical Decision that
391
+ records a decision settled in the invoking conversation carries an inline
392
+ annotation on its entry:
393
+ `(session-settled: user-directed — chosen over <alternative>: <one-line reason>)`.
394
+ Exactly two classes: `user-directed` (the user chose against or between
395
+ surfaced options) and `user-approved` (the agent proposed with the tradeoff
396
+ surfaced; the user assented). An agent never labels its own unexamined
397
+ proposal. A KTD that instantiates a labeled brainstorm / Product Contract
398
+ Key Decision inherits the label and cites that decision. The annotation is
399
+ self-contained — decision, rejected alternative, and one-line reason
400
+ readable without the conversation — and lives inline on the entry: no
401
+ sidecar files, no frontmatter registry, no numeric weights, no lifecycle
402
+ field. Like a `(see origin: <path>)` citation, it is decision provenance,
403
+ not process exhaust — review passes must not strip it. A consumer that
404
+ does not recognize the annotation treats the entry as a normal KTD.
405
+ - **Group Requirements by concern when they span distinct logical areas.**
406
+ The trigger is distinct concerns, not item count — even four requirements
407
+ benefit from grouping if they cover three different topics. Skip grouping
408
+ only when all requirements are genuinely about the same thing; a long flat
409
+ list is a smell that subgroups were missed. Group by capability (e.g.,
410
+ "Packaging", "Migration and compatibility", "Contributor workflow"), not by
411
+ the order requirements were discussed. R-IDs stay continuous across groups
412
+ (R1, R2 in the first group; R3, R4 in the second; never restart at R1 per
413
+ group).
414
+
415
+ ## Rendering
416
+
417
+ The format-specific references describe how to render these sections in each
418
+ output format:
419
+
420
+ - **Markdown rendering:** `references/markdown-rendering.md`
421
+ - **HTML rendering:** `references/html-rendering.md`
422
+
423
+ This reference (`plan-sections.md`) is about WHAT the plan contains;
424
+ rendering references are about HOW each format presents it. The plan is
425
+ written in one format — markdown OR HTML, never both — based on the
426
+ resolved output mode. The section catalog is the same regardless of
427
+ format.
@@ -0,0 +1,120 @@
1
+ # Plan Structure and Writing Rules
2
+
3
+ Detailed structuring and writing logic for Phases 3 and 4.
4
+
5
+ ## 3.1 Title and File Naming
6
+
7
+ - Draft a clear title matching the PRD's project name: `{项目名称} - 实施方案`
8
+ - Determine the plan type: `feat`, `fix`, or `refactor`
9
+ - Build the filename: `prd/{ITERATION_VERSION}/plan.md`
10
+ - Use the same iteration version as the PRD (resolved at Phase 0.2)
11
+ - The plan lives in the same directory as the PRD: `prd/vN/prd.md` (PRD) and `prd/vN/plan.md` (plan)
12
+ - Create the directory if it does not exist
13
+ - If a plan already exists at this path, confirm whether to update it or create a new one
14
+
15
+ ## 3.2 Stakeholder and Impact Awareness
16
+
17
+ For **Standard** or **Deep** plans, briefly consider who is affected by this change — end users, developers, operations, other teams — and how that should shape the plan. For cross-cutting work, note affected parties in the System-Wide Impact section.
18
+
19
+ ## 3.4 High-Level Technical Design
20
+
21
+ When the plan's technical approach has shape that prose alone doesn't carry well — architecture across components, sequencing across processes, state machines, branching gates, lifecycles, quantitative comparisons — include a High-Level Technical Design section that conveys the shape. The exact form (component diagram, sequence, swim lane, flowchart, state machine, decision matrix, pseudo-code grammar, bar chart for sizing concerns) is the agent's call per artifact — pick what makes the content land fastest for the reader.
22
+
23
+ See `references/plan-sections.md` for the section catalog including HTD's "include when material" criterion. See the format-rendering reference loaded at Phase 0.0 for how visualizations render in the target format (mermaid in markdown, inline SVG in HTML — with the layout-legibility principles around halo, contrast, and label placement when in HTML).
24
+
25
+ When the plan's approach is a one-paragraph pattern application that prose conveys directly, skip the section. The presence of HTD should earn its keep with content that genuinely benefits from visualization.
26
+
27
+ Plan diagrams render authoritative content alongside the prose — they are not "directional sketches." Do not add hedging captions like *"directional guidance for review, not implementation specification"* to plan diagrams; the prose-is-authoritative rule already governs disagreement, and the hedging weakens the diagram unnecessarily.
28
+
29
+ ## 3.4b Output Structure (Optional)
30
+
31
+ For greenfield plans that create a new directory structure (new plugin, service, package, or module), include an `## Output Structure` section with a file tree showing the expected layout.
32
+
33
+ **When to include it:**
34
+ - The plan creates 3+ new files in a new directory hierarchy
35
+ - The directory layout itself is a meaningful design decision
36
+
37
+ **When to skip it:**
38
+ - The plan only modifies existing files
39
+ - The plan creates 1-2 files in an existing directory — the per-unit file lists are sufficient
40
+
41
+ The tree is a scope declaration showing the expected output shape. It is not a constraint — the implementer may adjust the structure if implementation reveals a better layout.
42
+
43
+ ## 3.6 Planning-Time and Implementation-Time Unknowns
44
+
45
+ If something is important but not knowable yet, record it explicitly under deferred implementation notes rather than pretending to resolve it in the plan.
46
+
47
+ Examples:
48
+ - Exact method or helper names
49
+ - Final SQL or query details after touching real code
50
+ - Runtime behavior that depends on seeing actual test failures
51
+ - Refactors that may become unnecessary once implementation starts
52
+
53
+ ## 3.7 Anti-Expansion: Tangential Cleanup and Scope Creep
54
+
55
+ Distinct from 3.6 (which is about *unknowns* at plan time): 3.7 is about *known but tangential* work that the agent notices while planning but that falls outside the user's confirmed scope. When research surfaces an adjacent refactor, a "while we're here" cleanup, or a scope-adjacent nice-to-have ("we could also add rate limiting"), route it to the existing `### Deferred to Follow-Up Work` subsection in Scope Boundaries, not into active Implementation Units.
56
+
57
+ This reinforces the synthesis discipline established at Phase 0.7 / Phase 5.1.5 — the user's confirmed scope is what the active plan executes; everything else is deferred. Does NOT impose architectural bias on extend-vs-invent decisions within confirmed scope. The user's explicit ask overrides this default — if the user explicitly requested a refactor, it's in-scope, not deferred.
58
+
59
+ ---
60
+
61
+ ## Writing Rules
62
+
63
+ ### 4.1 Plan Depth Guidance
64
+
65
+ **Lightweight**
66
+ - Keep the plan compact
67
+ - Usually 2-4 implementation units
68
+ - Omit optional sections that add little value
69
+
70
+ **Standard**
71
+ - Use the full core template, omitting optional sections (including High-Level Technical Design) that add no value for this particular work
72
+ - Usually 2-5 changes
73
+ - Include risks, deferred questions, and system-wide impact when relevant
74
+
75
+ **Deep**
76
+ - Use the full core template plus optional analysis sections where warranted
77
+ - Usually 3-6 changes
78
+ - Group units into phases when that improves clarity
79
+ - Include alternatives considered, documentation impacts, and deeper risk treatment when warranted
80
+
81
+ ### 4.1b Optional Deep Plan Extensions
82
+
83
+ For sufficiently large, risky, or cross-cutting work, add the sections that genuinely help:
84
+ - **Alternative Approaches Considered**
85
+ - **Success Metrics**
86
+ - **Dependencies / Prerequisites**
87
+ - **Risk Analysis & Mitigation**
88
+ - **Phased Delivery**
89
+ - **Documentation Plan**
90
+ - **Operational / Rollout Notes**
91
+ - **Future Considerations** only when they materially affect current design
92
+
93
+ Do not add these as boilerplate. Include them only when they improve execution quality or stakeholder alignment.
94
+
95
+ **Alternatives Considered — what to vary.** When this section is included, alternatives must differ on *how* the work is built: architecture, sequencing, boundaries, integration pattern, rollout strategy. Tiny implementation variants (which hash function, which serialization format) belong in Key Technical Decisions, not Alternatives. Product-shape alternatives (different actors, different core outcome, different positioning) belong in `ce-brainstorm`, not here.
96
+
97
+ ### 4.2 Section Contract and Rendering
98
+
99
+ Compose the plan using two paired references:
100
+
101
+ - `references/plan-sections.md` — the section contract. Describes what the plan contains: the outcome the plan must enable for downstream consumers, the hard floor (Summary, Problem Frame, Requirements, KTDs, Implementation Units), the include-when-material catalog (HTD, Scope Boundaries, Open Questions, System-Wide Impact, Risks & Dependencies, Acceptance Examples, Documentation/Operational Notes, Sources & Research), the agency-driven escape hatch (introduce new sections when content warrants), and the ID/content rules.
102
+ - The format-rendering reference loaded at Phase 0.0 (`markdown-rendering.md` OR `html-rendering.md`) — how to present the sections in the resolved output format.
103
+
104
+ The section catalog is the same regardless of format. Format-specific principles live in the rendering reference.
105
+
106
+ Omit "include when material" sections that don't carry information for this specific plan. Filling a section with placeholder prose is worse than omitting it.
107
+
108
+ ### 4.3 Planning Rules
109
+
110
+ - **Horizontal rules (`---`) between top-level sections** in Standard and Deep plans, mirroring the `ce-brainstorm` requirements doc convention. Improves scannability of dense plans where many H2 sections sit close together. Omit for Lightweight plans where the whole doc fits on a single screen.
111
+ - **All file paths must be repo-relative** — never use absolute paths like `/Users/name/Code/project/src/file.ts`. Use `src/file.ts` instead. Absolute paths make plans non-portable across machines, worktrees, and teammates. When a plan targets a different repo than the document's home, state the target repo once at the top of the plan (e.g., `**Target repo:** my-other-project`) and use repo-relative paths throughout
112
+ - Prefer path plus class/component/pattern references over brittle line numbers
113
+ - Do not include implementation code — no imports, exact method signatures, or framework-specific syntax
114
+ - Pseudo-code sketches and DSL grammars are allowed in the High-Level Technical Design section and per-unit technical design fields when they communicate design direction. Frame them explicitly as directional guidance, not implementation specification
115
+ - Mermaid diagrams are encouraged when they clarify relationships or flows that prose alone would make hard to follow — ERDs for data model changes, sequence diagrams for multi-service interactions, state diagrams for lifecycle transitions, flowcharts for complex branching logic
116
+ - Do not include git commands, commit messages, or exact test command recipes
117
+ - Do not expand implementation units into micro-step `RED/GREEN/REFACTOR` instructions
118
+ - Do not pretend an execution-time question is settled just to make the plan look complete
119
+
120
+ **Write tight.** A section being material is not license to pad it. Lead with the decision or outcome, one idea per sentence, a requirement is intent plus at most one qualifier. Before declaring the plan written, run the named test — could the implementer find a contradiction in each section in one pass?
@@ -0,0 +1,69 @@
1
+ # Planning Modes
2
+
3
+ ## Overview
4
+
5
+ `ce-plan` supports two planning modes, selected at Phase 0.2:
6
+
7
+ - **业务模式 (Business Mode)** — For product managers / business teams. Focuses on task breakdown, acceptance criteria, performance/compatibility requirements, and dependencies **from a business perspective**. Does NOT include technical architecture decisions, tech stack selection, or implementation details. The plan is a business-oriented implementation roadmap.
8
+
9
+ - **一人公司模式 (Solo-Founder Mode)** — For technical leaders who are both product owner and developer. Includes everything in business mode **plus** technical architecture decisions, tech stack selection, implementation approach, data model changes, and **high-level technical design**(模块边界 + 技术选型 + 数据流方向 + 关键聚合/上下文划分). **不含接口清单 / 字段定义 / 方法签名 / 请求响应 schema**——这些变更级详细设计属于各 change 的 spec-writer / architecture-design(见 SKILL.md「作用边界」)。The plan is a product-level technical implementation blueprint, not a per-change detailed design.
10
+
11
+ ## Mode Selection Logic
12
+
13
+ After resolving the PRD source, determine the planning mode:
14
+
15
+ 1. **Pipeline 显式传参优先(v0.8)**:若调用方(workflow-orchestrator)传入 `plan_mode: business | solo`(S3 入口已一次性问定),直接采用,**不再询问**。
16
+ 2. **standalone 强制询问(v0.8 修订,禁止隐式默认)**:未收到 `plan_mode` 时,**必须用阻塞问题工具询问**用户选择,**不得因"看起来是技术 leader"就静默默认一人公司模式**:
17
+ - 业务模式:从产品/业务视角制定实施方案(任务拆分、验收标准、非功能需求)
18
+ - 一人公司模式:在业务模式基础上补充**高阶技术方案**(技术选型、架构设计、数据模型、技术方向;**不含接口清单**)
19
+ 3. **Explicit mode in prompt.** If the user explicitly mentions "business mode" / "业务模式" or "solo mode" / "一人公司模式", honor it directly.
20
+ 4. **异常回退**:pipeline 调用但未收到 `plan_mode` → 回退到第 2 条强制询问(不隐式默认)。
21
+
22
+ ## PRD Input
23
+
24
+ ### Using the PRD as Primary Input
25
+
26
+ If a relevant PRD document exists:
27
+ 1. Read the PRD document thoroughly — all 11 chapters, focusing on filled chapters (业务流程, 系统功能清单, 画面原型, etc.).
28
+ 1b. Read `prd/vN/prototype-review.md` if it exists — confirm the prototype inner loop completed and PRD is frozen. If PRD is not frozen (no `frozen: true` in frontmatter), warn the user that the PRD has not been through prototype review and recommend completing the inner loop before planning.
29
+ 2. Announce the selected planning mode (业务模式 or 一人公司模式, resolved at Phase 0.2).
30
+ 3. Announce that `ce-plan` will produce an independent implementation plan at `prd/vN/plan.md` (not modify the PRD).
31
+ 4. The PRD is the WHAT; the plan is the HOW. Do not rewrite or re-interpret the PRD's business requirements.
32
+ 5. Carry forward all applicable information from the PRD:
33
+ - 业务流程 (§2-§3) → informs task breakdown and dependencies
34
+ - 系统功能清单 (§7) → maps to implementation tasks
35
+ - 画面原型 (§4) → informs UI implementation scope
36
+ - 功能处理说明书 (§8) → informs acceptance criteria and non-functional requirements
37
+ - 业务术语字典 (§6) → use canonical terms in the plan
38
+ 6. If the plan discovers a conflict with the PRD's business requirements, surface it as an explicit assumption or question — do not silently rewrite the PRD.
39
+
40
+ ### Using a Legacy Requirements Document
41
+
42
+ If a relevant legacy requirements document exists:
43
+ 1. Read it thoroughly
44
+ 2. Announce that it will serve as the origin document for planning
45
+ 3. Carry forward all of the following:
46
+ - Problem frame
47
+ - Requirements and success criteria
48
+ - Scope boundaries
49
+ - Key decisions and rationale
50
+ - Dependencies or assumptions
51
+ - Outstanding questions, preserving whether they are blocking or deferred
52
+ 4. Use the source document as the primary input to planning and research
53
+ 5. Reference important carried-forward decisions in the plan with `(see origin: <source-path>)`
54
+ 6. Do not silently omit source content — if the origin document discussed it, the plan must address it even if briefly.
55
+
56
+ If no relevant PRD source exists, planning may proceed from the user's request directly.
57
+
58
+ **Settled decisions get the same preservation discipline as origin Product Contract decisions.** Session-settled decisions (from the conversation or a passed brief) are augmented by research, never re-asked, and never silently rewritten. Contradiction evidence routes by the severity ladder: nothing found — proceed silently; suboptimal-but-workable — proceed as settled and attach a conflict call-out to the labeled KTD at plan-write; invalidating — stop as blocked per the Phase 5.2 pipeline contract.
59
+
60
+ ## Plan Composition
61
+
62
+ Write the plan following the template structure:
63
+
64
+ - **业务模式**: Fill sections 一~四 (需求摘要, 任务拆分, 验收标准, 风险与约束). Leave section 五 (技术方案) empty with a note: "由 team-flow 变更链在具体 change 中设计".
65
+ - **一人公司模式**: Fill all sections 一~七, including section 五 (技术方案) with tech stack, architecture, data model, and **high-level technical design**(模块边界 + 技术选型 + 数据流方向 + 关键聚合/上下文划分). **禁止输出「接口清单」段**——接口签名/字段/请求响应 schema 属各 change 的 spec-writer / architecture-design(见 SKILL.md「作用边界」)。
66
+ - Both modes: Include section 六 (里程碑计划) and section 七 (待定事项) when applicable.
67
+ - Include a metadata block at the top: `mode` (业务模式 or 一人公司模式), `prd_reference` (path to PRD), `iteration_version`, `date`.
68
+ - Reference the PRD's requirements by chapter number (e.g., "关联 PRD §7 系统功能清单 TF-F001").
69
+ - Do not write a launch prompt into the doc. The launch prompt is generated at handoff.