@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,53 @@
1
+ # Lightweight Mode — Detailed Workflow
2
+
3
+ <critical_requirement>
4
+ **Single-pass alternative — same artifact type, reduced research and validation.**
5
+
6
+ This mode skips parallel subagents entirely. The orchestrator performs all work in a single pass and writes the same solution-doc artifact type, but omits cross-referencing, duplicate detection, session-history research, and semantic grounding validation.
7
+
8
+ Headless mode enters Lightweight only when explicitly invoked with `depth:lightweight`; otherwise it defaults to Full for backward compatibility.
9
+ </critical_requirement>
10
+
11
+ The orchestrator (main conversation) performs ALL of the following in one sequential pass:
12
+
13
+ 1. **Extract from conversation**: Identify the problem and solution from conversation history. Also scan the "user's auto-memory" block injected into your system prompt, if present (Claude Code only) -- use any relevant notes as supplementary context alongside conversation history. Tag any memory-sourced content incorporated into the final doc with "(auto memory [claude])". Before asserting how code behaves (enum values, status semantics, limits, defaults), Read the defining line at the current tree — soften or attribute any claim you cannot verify. Cite PR numbers over bare commit SHAs, and phrase unmerged fixes as pending
14
+ 2. **Classify**: Read `references/schema.yaml` and `references/yaml-schema.md`, then determine track (bug vs knowledge), category, and filename
15
+ 3. **Write minimal doc**: Before writing, check whether the exact proposed `docs/solutions/[category]/[filename].md` path exists. If it exists, read it: update it only when it covers the same problem, preserving its path and frontmatter structure and adding `last_updated: YYYY-MM-DD`; otherwise choose a distinct, descriptive filename and re-check that exact path is absent before writing. This is exact-path collision handling only — do not run Full mode's semantic overlap research or dispatch subagents. Create or update the doc using the appropriate track template from `assets/resolution-template.md`, with:
16
+ - YAML frontmatter with track-appropriate fields, applying the YAML-safety quoting rule for array items (see `references/yaml-schema.md` > YAML Safety Rules)
17
+ - Bug track: Problem, root cause, solution with key code snippets, one prevention tip
18
+ - Knowledge track: Context, guidance with key examples, one applicability note
19
+ 4. **Vocabulary capture (update-only)**: if `CONCEPTS.md` exists at repo root, read `references/concepts-vocabulary.md`, then scan the new doc and the conversation for qualifying terms and add/refine entries silently (same criteria as Phase 2.4). Do **not** bootstrap or seed in lightweight mode — if `CONCEPTS.md` does not exist, defer creation to a Full run, which owns seeding. Record the outcome in the output (e.g., "Vocabulary: 1 entry refined" or "scanned, no qualifying terms"). If you refined `CONCEPTS.md` and the project's active instructions and conventions already in your context do not surface it, add the discoverability tip to the output below — lightweight **tips**, it does not edit instruction files (an interactive Full run owns that edit after consent; headless Full also tips/reports only).
20
+ 5. **Read-only discoverability check**: Using the project's active instructions and conventions already in your context, assess whether they surface `docs/solutions/` against the three criteria under **Discoverability Check** in `references/full-mode-workflow.md`. Do not open, offer to edit, or edit instruction files; Lightweight only reports the result. Record one of:
21
+ - `no gap` when active project instructions surface the knowledge store
22
+ - `gap noted — instruction-file tip emitted` when active project instructions exist but do not surface it
23
+ - `not applicable — no active project instructions` when no project instructions are active; emit no discoverability tip
24
+ 6. **Mechanical claims check**: run `scripts/validate-doc-claims.py` against the written doc exactly as in Phase 2.45 step 1 (same `SKILL_DIR` anchor, same adjudicate-not-auto-fix rule — read `references/grounding-validation.md` for the adjudication table when it flags anything). Lightweight skips only the semantic validator subagent, not this deterministic check.
25
+ 7. **Frontmatter parser-safety check**: validate the written doc exactly as in Phase 2 step 8, using the same bundled-script existence guard and manual fallback checklist. Fix any violation and repeat the check; do not report success until the written frontmatter is parser-safe.
26
+ 8. **Skip specialized agent reviews** (Phase 3) and the semantic grounding validator (Phase 2.45 step 2) to conserve context
27
+
28
+ ## Lightweight Completion Output
29
+
30
+ In headless Lightweight, do not emit this interactive block; use the depth-specific report under `references/output-standards.md` > `Headless mode` instead. In interactive Lightweight, emit:
31
+
32
+ ```
33
+ ✓ Documentation complete (lightweight mode)
34
+
35
+ File created:
36
+ - docs/solutions/[category]/[filename].md
37
+
38
+ [If discoverability check found instruction files don't surface the knowledge store:]
39
+ Tip: Your AGENTS.md/CLAUDE.md doesn't surface docs/solutions/ to agents —
40
+ a brief mention helps all agents discover these learnings.
41
+
42
+ [If CONCEPTS.md was refined this run and isn't surfaced in the instruction files:]
43
+ Tip: Your AGENTS.md/CLAUDE.md doesn't surface CONCEPTS.md —
44
+ a one-line mention helps agents find the shared vocabulary.
45
+
46
+ Note: This was created in lightweight mode. For richer documentation
47
+ (cross-references, detailed prevention strategies, specialized reviews,
48
+ semantic grounding validation), re-run /ce-compound in a fresh session.
49
+ ```
50
+
51
+ **No subagents are launched. No parallel tasks. The solution doc is the one deliverable** (Phase 2.4's update-only vocabulary capture may also refine an existing `CONCEPTS.md`).
52
+
53
+ In lightweight mode, the overlap check is skipped (no Related Docs Finder subagent). This means lightweight mode may create a doc that overlaps with an existing one. That is acceptable — `ce-compound-refresh` will catch it later. Only suggest `ce-compound-refresh` if there is an obvious narrow refresh target. Do not broaden into a large refresh sweep from a lightweight session.
@@ -0,0 +1,182 @@
1
+ # Output Standards & Common Mistakes
2
+
3
+ ## What It Captures
4
+
5
+ - **Problem symptom**: Exact error messages, observable behavior
6
+ - **Investigation steps tried**: What didn't work and why
7
+ - **Root cause analysis**: Technical explanation
8
+ - **Working solution**: Step-by-step fix with code examples
9
+ - **Prevention strategies**: How to avoid in future
10
+ - **Cross-references**: Links to related issues and docs
11
+
12
+ ## Categories (auto-detected from problem)
13
+
14
+ Bug track:
15
+ - build-errors/
16
+ - test-failures/
17
+ - runtime-errors/
18
+ - performance-issues/
19
+ - database-issues/
20
+ - security-issues/
21
+ - ui-bugs/
22
+ - integration-issues/
23
+ - logic-errors/
24
+
25
+ Knowledge track:
26
+ - architecture-patterns/ — architectural or structural patterns (agent/skill/pipeline/workflow shape decisions)
27
+ - design-patterns/ — reusable non-architectural design approaches (content generation, interaction patterns, prompt shapes)
28
+ - tooling-decisions/ — language, library, or tool choices with durable rationale
29
+ - conventions/ — team-agreed way of doing something, captured so it survives turnover
30
+ - workflow-issues/
31
+ - developer-experience/
32
+ - documentation-gaps/
33
+ - best-practices/ — fallback only, use when no narrower knowledge-track value applies
34
+
35
+ ## Common Mistakes to Avoid
36
+
37
+ | ❌ Wrong | ✅ Correct |
38
+ |----------|-----------|
39
+ | Subagents write product files into `docs/` or edit tracked paths | Subagents write only scratch artifacts under `<run-dir>/` and return the path; orchestrator writes the one final doc |
40
+ | Subagent returns a long prose body only as its inline response | Subagent writes full output to its run artifact; orchestrator Reads it back (inline return is fallback only) |
41
+ | Research and assembly run in parallel | Research completes → then assembly runs |
42
+ | Multiple files created during workflow | One solution doc written or updated: `docs/solutions/[category]/[filename].md` (plus optional maintenance writes: a `CONCEPTS.md` create/update from Phase 2.4, and — interactive Full only, after consent — a small instruction-file edit for discoverability) |
43
+ | Headless Discoverability Check edits AGENTS.md/CLAUDE.md | Headless Full reports `Instruction-file edit: gap noted, not applied`; headless Lightweight emits a discoverability tip; only interactive Full applies the edit after consent |
44
+ | Creating a new doc when an existing doc covers the same problem | Check overlap assessment; update the existing doc when overlap is high |
45
+ | Asserting code behavior or merge-state from conversation memory | Read the defining source line before asserting; cite PR numbers over SHAs; soften unverifiable claims (Phase 1 extractor rules, re-checked in Phase 2.45) |
46
+ | Batching several learnings through one run and stitching cross-references between drafts | One learning per run; run the skill sequentially for each additional learning |
47
+
48
+ ## Success Output — Headless Mode
49
+
50
+ Emit a structured terminal report and end the turn. No "What's next?" question, no blocking prompt. End with `Documentation complete` as the terminal signal so callers can detect completion.
51
+
52
+ For `depth:lightweight`, use this lower-overhead report after the Lightweight Mode workflow:
53
+
54
+ ```
55
+ ✓ Documentation complete (headless lightweight mode)
56
+
57
+ File: docs/solutions/<category>/<filename>.md (created | updated)
58
+ Track: <bug | knowledge>
59
+ Category: <category>
60
+ Grounding: <mechanical check clean | N flags adjudicated>
61
+ Discoverability: <no gap | gap noted — instruction-file tip emitted | not applicable — no active project instructions>
62
+ CONCEPTS.md: <not present | scanned, no qualifying terms | updated — N added, N refined>
63
+ CONCEPTS.md discoverability: <not checked — CONCEPTS.md not refined | no gap | gap noted — instruction-file tip emitted | not applicable — no active project instructions>
64
+ Refresh recommendation: <none | scope hint for /ce-compound-refresh>
65
+
66
+ Documentation complete
67
+ ```
68
+
69
+ For `depth:full` or backward-compatible headless calls with no depth token, use the Full report:
70
+
71
+ ```
72
+ ✓ Documentation complete (headless mode)
73
+
74
+ File: docs/solutions/<category>/<filename>.md (created | updated)
75
+ Track: <bug | knowledge>
76
+ Category: <category>
77
+ Overlap: <none | low | moderate — see <path> | high — existing doc updated>
78
+ Grounding: <clean | N flags adjudicated (X fixed, Y annotated, Z confirmed) | N claims softened or corrected | degraded — merge-state claims unverified offline>
79
+ Instruction-file edit: <none needed | gap noted, not applied>
80
+ CONCEPTS.md: <scanned, no qualifying terms | created with N entries (M seeded from the learning's area) | updated — N added, N refined>
81
+ Refresh recommendation: <none | scope hint for /ce-compound-refresh>
82
+
83
+ Documentation complete
84
+ ```
85
+
86
+ When no doc was written (e.g., headless invoked on a session where the problem is not yet solved), emit a structured failure instead and end with `Documentation skipped` so callers can distinguish success from no-op:
87
+
88
+ ```
89
+ ✗ Documentation skipped (headless mode)
90
+
91
+ Reason: <one-sentence explanation — e.g., "no solved problem detected in
92
+ conversation history" or "solution not yet verified">
93
+
94
+ Documentation skipped
95
+ ```
96
+
97
+ ## Success Output — Interactive Mode
98
+
99
+ ```
100
+ ✓ Documentation complete
101
+
102
+ Ran Full mode.
103
+ Auto memory: 2 relevant entries used as supplementary evidence
104
+
105
+ Subagent Results:
106
+ ✓ Context Analyzer: Identified performance_issue in brief_system, category: performance-issues/
107
+ ✓ Solution Extractor: 3 code fixes, prevention strategies
108
+ ✓ Related Docs Finder: 2 related issues
109
+ ✓ Session History: 3 prior sessions on same branch, 2 failed approaches surfaced
110
+
111
+ Grounding Validation:
112
+ ✓ Mechanical check: 14 paths, 2 SHAs, 3 links checked — 1 flag annotated as historical
113
+ ✓ Semantic validator: 9 claims verified, 1 merge-state claim softened to pending
114
+
115
+ Specialized Agent Reviews (Auto-Triggered):
116
+ ✓ performance-oracle: Validated query optimization approach
117
+ ✓ Code simplification review: Code examples are appropriately minimal
118
+
119
+ Files written:
120
+ - docs/solutions/performance-issues/n-plus-one-brief-generation.md (created)
121
+ - CONCEPTS.md (created with 3 entries: BriefSystem, EmailQueue, Brief Status)
122
+
123
+ This documentation will be searchable for future reference when similar
124
+ issues occur in the Email Processing or Brief System modules.
125
+
126
+ Refresh recommendation: none
127
+ ```
128
+
129
+ **End the turn after the summary — `ce-compound` does not present a "What's next?" menu.** The doc is written and any cross-references the workflow found are already in it. Cross-doc maintenance (fixing references in *other* docs, consolidation) is deferred to `ce-compound-refresh` via the `Refresh recommendation` line above — the skill designed for it — not auto-applied here, which would edit tracked docs beyond the one deliverable. If the user wants to view the file or take a follow-up action, they will ask. (Interactive mode only.)
130
+
131
+ **Alternate interactive output (when updating an existing doc due to high overlap):** in headless mode, this case is communicated via the `Overlap: high — existing doc updated` line of the headless terminal report above, not as a separate output block.
132
+
133
+ ```
134
+ ✓ Documentation updated (existing doc refreshed with current context)
135
+
136
+ Overlap detected: docs/solutions/performance-issues/n-plus-one-queries.md
137
+ Matched dimensions: problem statement, root cause, solution, referenced files
138
+ Action: Updated existing doc with fresher code examples and prevention tips
139
+
140
+ File updated:
141
+ - docs/solutions/performance-issues/n-plus-one-queries.md (added last_updated: 2026-03-24)
142
+ ```
143
+
144
+ ## The Compounding Philosophy
145
+
146
+ This creates a compounding knowledge system:
147
+
148
+ 1. First time you solve "N+1 query in brief generation" → Research (30 min)
149
+ 2. Document the solution → docs/solutions/performance-issues/n-plus-one-briefs.md (5 min)
150
+ 3. Next time similar issue occurs → Quick lookup (2 min)
151
+ 4. Knowledge compounds → Team gets smarter
152
+
153
+ The feedback loop:
154
+
155
+ ```
156
+ Build → Test → Find Issue → Research → Improve → Document → Validate → Deploy
157
+ ↑ ↓
158
+ └──────────────────────────────────────────────────────────────────────┘
159
+ ```
160
+
161
+ **Each unit of engineering work should make subsequent units of work easier—not harder.**
162
+
163
+ ## Applicable Specialized Local Prompts
164
+
165
+ Based on problem type, these local prompt assets can enhance documentation:
166
+
167
+ ### Code Quality & Review
168
+ - **Read-only code simplification review**: Checks solution examples and documentation claims for unnecessary complexity without mutating product code
169
+ - **references/agents/pattern-recognition-specialist.md**: Identifies anti-patterns or repeating issues
170
+
171
+ ### Specific Domain Experts
172
+ - **references/agents/performance-oracle.md**: Analyzes performance_issue category solutions
173
+ - **references/agents/security-sentinel.md**: Reviews security_issue solutions for vulnerabilities
174
+ - **references/agents/data-integrity-guardian.md**: Reviews database_issue migrations and queries
175
+
176
+ ### Enhancement & Research
177
+ - **references/agents/best-practices-researcher.md**: Enriches solution with industry best practices
178
+ - **references/agents/framework-docs-researcher.md**: Links to framework/library documentation references
179
+
180
+ ### When to Invoke
181
+ - **Auto-triggered** (optional): Generic subagents seeded with local prompts can run post-documentation for enhancement
182
+ - **Manual trigger**: User can run surviving skills such as `ce-simplify-code` after `/ce-compound` completes for deeper code review and mutation
@@ -0,0 +1,38 @@
1
+ # 晋升检查规则
2
+
3
+ ## 触发时机
4
+
5
+ release-archivist 归档时调用:
6
+
7
+ ```bash
8
+ tf solutions promote <change-dir>
9
+ ```
10
+
11
+ ## 晋升来源
12
+
13
+ 检查 `specs/<cap>/learnings.md` 中的经验。
14
+
15
+ ## 晋升条件
16
+
17
+ ### change → product 晋升
18
+
19
+ 满足以下条件的经验从 change 级别晋升到全局 `docs/solutions/`:
20
+
21
+ - **severity ≥ medium** 且 **type = pitfall 或 pattern** → 晋升到全局 `docs/solutions/`
22
+ - 与全局 INDEX 中已有条目 **domain + type 匹配** → 标记"已确认模式",severity 升级
23
+
24
+ ### Severity 标准
25
+
26
+ | Severity | 含义 | 晋升行为 |
27
+ |----------|------|----------|
28
+ | high | 阻塞性问题或关键模式 | 必须晋升 |
29
+ | medium | 有显著影响的问题或可复用模式 | 满足 type 条件时晋升 |
30
+ | low | 轻微问题或局部洞察 | 不晋升,保留在 change 级别 |
31
+
32
+ ### 已确认模式
33
+
34
+ 当晋升的经验与全局 INDEX 中已有条目的 domain + type 匹配时:
35
+ 1. 不创建新文件
36
+ 2. 在已有条目中标记"已确认模式"
37
+ 3. severity 升级(low → medium, medium → high)
38
+ 4. 更新 INDEX.md 中对应行的 severity 字段
@@ -0,0 +1,231 @@
1
+ # Documentation schema for learnings written by ce-compound
2
+ # Treat this as the canonical frontmatter contract for docs/solutions/.
3
+ #
4
+ # The schema has two tracks based on problem_type:
5
+ # Bug track — problem_type is a defect or failure (build_error, test_failure, etc.)
6
+ # Knowledge track — problem_type is guidance or practice (best_practice, workflow_issue, etc.)
7
+ #
8
+ # Both tracks share the same required core fields. The tracks differ in which
9
+ # additional fields are required vs optional (see track_rules below).
10
+
11
+ # --- Track classification ---------------------------------------------------
12
+ tracks:
13
+ bug:
14
+ description: "Defects, failures, and errors that were diagnosed and fixed"
15
+ problem_types:
16
+ - build_error
17
+ - test_failure
18
+ - runtime_error
19
+ - performance_issue
20
+ - database_issue
21
+ - security_issue
22
+ - ui_bug
23
+ - integration_issue
24
+ - logic_error
25
+ knowledge:
26
+ description: "Practices, patterns, conventions, decisions, workflow improvements, and documentation"
27
+ problem_types:
28
+ - best_practice
29
+ - documentation_gap
30
+ - workflow_issue
31
+ - developer_experience
32
+ - architecture_pattern
33
+ - design_pattern
34
+ - tooling_decision
35
+ - convention
36
+
37
+ # --- Fields required by BOTH tracks -----------------------------------------
38
+ required_fields:
39
+ module:
40
+ type: string
41
+ description: "Module or area affected"
42
+
43
+ date:
44
+ type: string
45
+ pattern: '^\d{4}-\d{2}-\d{2}$'
46
+ description: "Date documented (YYYY-MM-DD)"
47
+
48
+ problem_type:
49
+ type: enum
50
+ values:
51
+ - build_error
52
+ - test_failure
53
+ - runtime_error
54
+ - performance_issue
55
+ - database_issue
56
+ - security_issue
57
+ - ui_bug
58
+ - integration_issue
59
+ - logic_error
60
+ - developer_experience
61
+ - workflow_issue
62
+ - best_practice
63
+ - documentation_gap
64
+ - architecture_pattern
65
+ - design_pattern
66
+ - tooling_decision
67
+ - convention
68
+ description: "Primary category — determines track (bug vs knowledge). Prefer the narrowest applicable value; best_practice is the fallback when no narrower knowledge-track value fits."
69
+
70
+ component:
71
+ type: enum
72
+ values:
73
+ - rails_model
74
+ - rails_controller
75
+ - rails_view
76
+ - service_object
77
+ - background_job
78
+ - database
79
+ - frontend_stimulus
80
+ - hotwire_turbo
81
+ - email_processing
82
+ - brief_system
83
+ - assistant
84
+ - authentication
85
+ - payments
86
+ - development_workflow
87
+ - testing_framework
88
+ - documentation
89
+ - tooling
90
+ description: "Component involved"
91
+
92
+ severity:
93
+ type: enum
94
+ values:
95
+ - critical
96
+ - high
97
+ - medium
98
+ - low
99
+ description: "Impact severity"
100
+
101
+ # --- Track-specific rules ----------------------------------------------------
102
+ track_rules:
103
+ bug:
104
+ required:
105
+ symptoms:
106
+ type: array[string]
107
+ min_items: 1
108
+ max_items: 5
109
+ description: "Observable symptoms such as errors or broken behavior"
110
+ root_cause:
111
+ type: enum
112
+ values:
113
+ - missing_association
114
+ - missing_include
115
+ - missing_index
116
+ - wrong_api
117
+ - scope_issue
118
+ - thread_violation
119
+ - async_timing
120
+ - memory_leak
121
+ - config_error
122
+ - logic_error
123
+ - test_isolation
124
+ - missing_validation
125
+ - missing_permission
126
+ - missing_workflow_step
127
+ - inadequate_documentation
128
+ - missing_tooling
129
+ - incomplete_setup
130
+ description: "Fundamental technical cause of the problem"
131
+ resolution_type:
132
+ type: enum
133
+ values:
134
+ - code_fix
135
+ - migration
136
+ - config_change
137
+ - test_fix
138
+ - dependency_update
139
+ - environment_setup
140
+ - workflow_improvement
141
+ - documentation_update
142
+ - tooling_addition
143
+ - seed_data_update
144
+ description: "Type of fix applied"
145
+
146
+ knowledge:
147
+ optional:
148
+ applies_when:
149
+ type: array[string]
150
+ max_items: 5
151
+ description: "Conditions or situations where this guidance applies"
152
+ symptoms:
153
+ type: array[string]
154
+ max_items: 5
155
+ description: "Observable gaps or friction that prompted this guidance (optional for knowledge track)"
156
+ root_cause:
157
+ type: enum
158
+ values:
159
+ - missing_association
160
+ - missing_include
161
+ - missing_index
162
+ - wrong_api
163
+ - scope_issue
164
+ - thread_violation
165
+ - async_timing
166
+ - memory_leak
167
+ - config_error
168
+ - logic_error
169
+ - test_isolation
170
+ - missing_validation
171
+ - missing_permission
172
+ - missing_workflow_step
173
+ - inadequate_documentation
174
+ - missing_tooling
175
+ - incomplete_setup
176
+ description: "Underlying cause, if there is a specific one (optional for knowledge track)"
177
+ resolution_type:
178
+ type: enum
179
+ values:
180
+ - code_fix
181
+ - migration
182
+ - config_change
183
+ - test_fix
184
+ - dependency_update
185
+ - environment_setup
186
+ - workflow_improvement
187
+ - documentation_update
188
+ - tooling_addition
189
+ - seed_data_update
190
+ description: "Type of change, if applicable (optional for knowledge track)"
191
+
192
+ # --- Fields optional for BOTH tracks ----------------------------------------
193
+ optional_fields:
194
+ related_components:
195
+ type: array[string]
196
+ description: "Other components involved"
197
+
198
+ tags:
199
+ type: array[string]
200
+ max_items: 8
201
+ description: "Search keywords, lowercase and hyphen-separated"
202
+
203
+ # --- Fields optional for bug track only -------------------------------------
204
+ bug_optional_fields:
205
+ rails_version:
206
+ type: string
207
+ pattern: '^\d+\.\d+\.\d+$'
208
+ description: "Rails version in X.Y.Z format. Only relevant for bug-track docs."
209
+
210
+ # --- Backward compatibility --------------------------------------------------
211
+ # Docs created before the track system was introduced may have bug-track
212
+ # fields (symptoms, root_cause, resolution_type) on knowledge-type
213
+ # problem_types. These are valid legacy docs:
214
+ # - Bug-track fields present on a knowledge-track doc are harmless. Do not
215
+ # strip them during refresh unless the doc is being rewritten for other reasons.
216
+ # - When creating NEW docs, follow the track rules above.
217
+
218
+ # --- Validation rules --------------------------------------------------------
219
+ validation_rules:
220
+ - "Determine track from problem_type using the tracks section above"
221
+ - "All shared required_fields must be present"
222
+ - "Bug-track required fields (symptoms, root_cause, resolution_type) must be present on bug-track docs"
223
+ - "Knowledge-track docs have no additional required fields beyond the shared ones"
224
+ - "Bug-track fields on existing knowledge-track docs are harmless (see backward compatibility note)"
225
+ - "Track-specific optional fields may be included but are not required"
226
+ - "Enum fields must match allowed values exactly"
227
+ - "Array fields must respect min_items/max_items when specified"
228
+ - "date must match YYYY-MM-DD format"
229
+ - "rails_version, if provided, must match X.Y.Z format and only applies to bug-track docs"
230
+ - "tags should be lowercase and hyphen-separated"
231
+ - "Array-of-strings frontmatter items (symptoms, applies_when, tags, related_components, or any future array field) must be wrapped in double quotes when the value starts with a YAML reserved indicator (`, [, *, &, !, |, >, %, @, ?) or contains the substring `: ` — otherwise strict YAML parsers reject the file"
@@ -0,0 +1,55 @@
1
+ # 三层索引架构
2
+
3
+ ## 目录结构
4
+
5
+ ```
6
+ docs/solutions/
7
+ ├── INDEX.md # L1:轻量索引(≤150行,每条一行摘要+标签)
8
+ ├── prd/ # 按阶段分目录
9
+ ├── plan/
10
+ ├── prototype/
11
+ ├── spec/
12
+ ├── build/
13
+ ├── review/
14
+ └── cross-phase/ # 跨阶段通用经验
15
+ ```
16
+
17
+ ## INDEX.md 格式
18
+
19
+ ```markdown
20
+ # Solutions Index
21
+ <!-- 每条一行,按 severity 降序,≤150 行硬上限 -->
22
+ | date | phase | domain | type | severity | summary | file |
23
+ |------|-------|--------|------|----------|---------|------|
24
+ ```
25
+
26
+ ## 经验文件格式
27
+
28
+ 每条经验一个文件,frontmatter 包含标签:
29
+
30
+ ```yaml
31
+ ---
32
+ phase: prd # 阶段标签:prd | plan | prototype | spec | build | review | cross-phase
33
+ domain: auth # 领域标签(与 PRD/change 的领域对应)
34
+ type: pitfall # pitfall | pattern | decision | insight
35
+ severity: high # high | medium | low
36
+ date: 2026-07-15
37
+ source: change-id # 来源 change(晋升时保留)
38
+ ---
39
+
40
+ ## 问题描述
41
+ (一句话描述问题或经验)
42
+
43
+ ## 根因/模式
44
+ (为什么会出现,或为什么这个模式有效)
45
+
46
+ ## 预防措施/应用方式
47
+ (下次如何避免,或如何复用)
48
+ ```
49
+
50
+ ## 按需加载策略
51
+
52
+ 三层索引设计使最坏情况 token 消耗约 ~6.5k:
53
+ 1. **L1 INDEX.md**:始终加载(≤150 行,每条约 40 token)
54
+ 2. **L2 阶段目录**:按 phase 过滤后加载匹配文件列表
55
+ 3. **L3 经验文件**:仅加载与当前任务相关的具体文件
@@ -0,0 +1,32 @@
1
+ # v0.5 升级:复利贯穿引擎
2
+
3
+ ce-compound 从"手动触发的记录工具"升级为"复利贯穿引擎的执行层":
4
+
5
+ | 现有能力 | v0.5 升级 |
6
+ |---------|----------|
7
+ | 手动调用 `/ce-compound` 记录 | 阶段转换点自动检测 + 手动补充 |
8
+ | 写入 `docs/solutions/` 无索引 | 写入 INDEX.md + 分阶段目录(三层索引) |
9
+ | 无阶段感知 | 按 phase/domain 标签过滤注入 |
10
+ | 无晋升机制 | change→product 晋升规则 |
11
+ | 全量加载 | 三层索引按需加载(最坏 ~6.5k token) |
12
+
13
+ ## 自动调用场景(v0.5 新增)
14
+
15
+ 除手动调用外,以下场景由流程自动触发 ce-compound 写入:
16
+
17
+ - 原型审查发现 PRD 遗漏/矛盾(phase=prd, type=pitfall)
18
+ - spec/design 被拒绝或大幅修改(phase=spec, type=pitfall)
19
+ - bug-investigator 发现同类问题第 2 次(phase=build, type=pattern)
20
+ - change 执行中超出原始 scope(phase=build, type=pitfall)
21
+ - re-bridge 触发(phase=spec, type=pitfall)
22
+ - mandatory rewind 触发(phase=cross-phase, type=pitfall)
23
+
24
+ ## 被流程自动调用
25
+
26
+ 各 skill 在阶段转换点通过 CLI 调用:
27
+
28
+ ```bash
29
+ tf solutions capture --phase <p> --domain <d> --type <t> --severity <s> --summary "<text>"
30
+ ```
31
+
32
+ 此命令等价于手动调用 `/ce-compound` 但无需交互,直接写入。
@@ -0,0 +1,36 @@
1
+ # 写入流程
2
+
3
+ ## 记录一条经验的步骤
4
+
5
+ 1. 确定 phase/domain/type/severity 标签
6
+ 2. 在对应阶段目录下创建经验文件(如 `docs/solutions/prd/2026-07-15-需求歧义.md`)
7
+ 3. 在 INDEX.md 中追加一行摘要
8
+ 4. 如果 INDEX.md 超过 150 行,执行淘汰规则
9
+
10
+ ## 淘汰规则(Eviction)
11
+
12
+ 当 INDEX.md 超过 150 行硬上限时:
13
+ - 按 severity 降序排列(high > medium > low)
14
+ - 保留前 150 条
15
+ - 淘汰 low severity 且 date 最早的条目
16
+ - 被淘汰的经验文件保留在阶段目录中(可从文件系统找回),仅从 INDEX.md 移除
17
+
18
+ ## CLI 写入命令
19
+
20
+ 各 skill 在阶段转换点通过 CLI 调用(无需交互):
21
+
22
+ ```bash
23
+ tf solutions capture --phase <p> --domain <d> --type <t> --severity <s> --summary "<text>"
24
+ ```
25
+
26
+ ## 索引重建
27
+
28
+ ```bash
29
+ tf solutions index-gen # 重建复利索引
30
+ ```
31
+
32
+ ## 阶段感知注入
33
+
34
+ ```bash
35
+ tf solutions inject --phase <p> --domain <d> # 阶段感知注入(top-5)
36
+ ```