specweave 0.4.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (400) hide show
  1. package/.claude-plugin/README.md +312 -0
  2. package/.claude-plugin/marketplace.json +210 -0
  3. package/CLAUDE.md +952 -609
  4. package/README.md +179 -761
  5. package/bin/install-agents.sh +1 -1
  6. package/bin/install-commands.sh +66 -14
  7. package/bin/install-hooks.sh +1 -1
  8. package/bin/install-skills.sh +1 -1
  9. package/bin/specweave.js +2 -0
  10. package/dist/adapters/claude/adapter.d.ts +49 -11
  11. package/dist/adapters/claude/adapter.d.ts.map +1 -1
  12. package/dist/adapters/claude/adapter.js +175 -42
  13. package/dist/adapters/claude/adapter.js.map +1 -1
  14. package/dist/adapters/copilot/adapter.d.ts +20 -2
  15. package/dist/adapters/copilot/adapter.d.ts.map +1 -1
  16. package/dist/adapters/copilot/adapter.js +117 -7
  17. package/dist/adapters/copilot/adapter.js.map +1 -1
  18. package/dist/adapters/cursor/adapter.d.ts +18 -0
  19. package/dist/adapters/cursor/adapter.d.ts.map +1 -1
  20. package/dist/adapters/cursor/adapter.js +55 -3
  21. package/dist/adapters/cursor/adapter.js.map +1 -1
  22. package/dist/adapters/generic/adapter.d.ts +18 -0
  23. package/dist/adapters/generic/adapter.d.ts.map +1 -1
  24. package/dist/adapters/generic/adapter.js +55 -3
  25. package/dist/adapters/generic/adapter.js.map +1 -1
  26. package/dist/cli/commands/init.d.ts +1 -0
  27. package/dist/cli/commands/init.d.ts.map +1 -1
  28. package/dist/cli/commands/init.js +521 -185
  29. package/dist/cli/commands/init.js.map +1 -1
  30. package/dist/cli/commands/install.d.ts +2 -0
  31. package/dist/cli/commands/install.d.ts.map +1 -1
  32. package/dist/cli/commands/install.js +28 -25
  33. package/dist/cli/commands/install.js.map +1 -1
  34. package/dist/cli/commands/list.d.ts +2 -0
  35. package/dist/cli/commands/list.d.ts.map +1 -1
  36. package/dist/cli/commands/list.js +26 -24
  37. package/dist/cli/commands/list.js.map +1 -1
  38. package/dist/cli/commands/plugin.d.ts +23 -6
  39. package/dist/cli/commands/plugin.d.ts.map +1 -1
  40. package/dist/cli/commands/plugin.js +92 -66
  41. package/dist/cli/commands/plugin.js.map +1 -1
  42. package/dist/core/i18n/language-detector.d.ts +29 -0
  43. package/dist/core/i18n/language-detector.d.ts.map +1 -0
  44. package/dist/core/i18n/language-detector.js +143 -0
  45. package/dist/core/i18n/language-detector.js.map +1 -0
  46. package/dist/core/i18n/language-manager.d.ts +101 -0
  47. package/dist/core/i18n/language-manager.d.ts.map +1 -0
  48. package/dist/core/i18n/language-manager.js +232 -0
  49. package/dist/core/i18n/language-manager.js.map +1 -0
  50. package/dist/core/i18n/language-registry.d.ts +44 -0
  51. package/dist/core/i18n/language-registry.d.ts.map +1 -0
  52. package/dist/core/i18n/language-registry.js +234 -0
  53. package/dist/core/i18n/language-registry.js.map +1 -0
  54. package/dist/core/i18n/locale-manager.d.ts +62 -0
  55. package/dist/core/i18n/locale-manager.d.ts.map +1 -0
  56. package/dist/core/i18n/locale-manager.js +137 -0
  57. package/dist/core/i18n/locale-manager.js.map +1 -0
  58. package/dist/core/i18n/system-prompt-injector.d.ts +33 -0
  59. package/dist/core/i18n/system-prompt-injector.d.ts.map +1 -0
  60. package/dist/core/i18n/system-prompt-injector.js +131 -0
  61. package/dist/core/i18n/system-prompt-injector.js.map +1 -0
  62. package/dist/core/i18n/types.d.ts +151 -0
  63. package/dist/core/i18n/types.d.ts.map +1 -0
  64. package/dist/core/i18n/types.js +11 -0
  65. package/dist/core/i18n/types.js.map +1 -0
  66. package/dist/core/increment-status.d.ts +72 -0
  67. package/dist/core/increment-status.d.ts.map +1 -0
  68. package/dist/core/increment-status.js +227 -0
  69. package/dist/core/increment-status.js.map +1 -0
  70. package/dist/core/plugin-loader.d.ts +33 -13
  71. package/dist/core/plugin-loader.d.ts.map +1 -1
  72. package/dist/core/plugin-loader.js +145 -43
  73. package/dist/core/plugin-loader.js.map +1 -1
  74. package/dist/core/types/config.d.ts +51 -0
  75. package/dist/core/types/config.d.ts.map +1 -0
  76. package/dist/core/types/config.js +21 -0
  77. package/dist/core/types/config.js.map +1 -0
  78. package/dist/core/types/plugin.d.ts +73 -42
  79. package/dist/core/types/plugin.d.ts.map +1 -1
  80. package/dist/core/types/plugin.js +4 -3
  81. package/dist/core/types/plugin.js.map +1 -1
  82. package/dist/hooks/lib/sync-living-docs.d.ts +27 -0
  83. package/dist/hooks/lib/sync-living-docs.d.ts.map +1 -0
  84. package/dist/hooks/lib/sync-living-docs.js +116 -0
  85. package/dist/hooks/lib/sync-living-docs.js.map +1 -0
  86. package/dist/hooks/lib/translate-living-docs.d.ts +13 -0
  87. package/dist/hooks/lib/translate-living-docs.d.ts.map +1 -0
  88. package/dist/hooks/lib/translate-living-docs.js +166 -0
  89. package/dist/hooks/lib/translate-living-docs.js.map +1 -0
  90. package/dist/hooks/lib/update-tasks-md.d.ts +29 -0
  91. package/dist/hooks/lib/update-tasks-md.d.ts.map +1 -0
  92. package/dist/hooks/lib/update-tasks-md.js +203 -0
  93. package/dist/hooks/lib/update-tasks-md.js.map +1 -0
  94. package/dist/integrations/jira/jira-incremental-mapper.js.map +1 -1
  95. package/dist/integrations/jira/jira-mapper.js.map +1 -1
  96. package/dist/locales/de/.gitkeep +0 -0
  97. package/dist/locales/de/cli.json +108 -0
  98. package/dist/locales/en/cli.json +285 -0
  99. package/dist/locales/en/errors.json +7 -0
  100. package/dist/locales/en/templates.json +6 -0
  101. package/dist/locales/es/.gitkeep +0 -0
  102. package/dist/locales/es/cli.json +41 -0
  103. package/dist/locales/fr/.gitkeep +0 -0
  104. package/dist/locales/fr/cli.json +108 -0
  105. package/dist/locales/ja/.gitkeep +0 -0
  106. package/dist/locales/ja/cli.json +108 -0
  107. package/dist/locales/ko/.gitkeep +0 -0
  108. package/dist/locales/ko/cli.json +108 -0
  109. package/dist/locales/pt/.gitkeep +0 -0
  110. package/dist/locales/pt/cli.json +108 -0
  111. package/dist/locales/ru/.gitkeep +0 -0
  112. package/dist/locales/ru/cli.json +269 -0
  113. package/dist/locales/zh/.gitkeep +0 -0
  114. package/dist/locales/zh/cli.json +108 -0
  115. package/dist/plugins/specweave-github/lib/github-client.d.ts +86 -0
  116. package/dist/plugins/specweave-github/lib/github-client.d.ts.map +1 -0
  117. package/dist/plugins/specweave-github/lib/github-client.js +275 -0
  118. package/dist/plugins/specweave-github/lib/github-client.js.map +1 -0
  119. package/dist/plugins/specweave-github/lib/index.d.ts +10 -0
  120. package/dist/plugins/specweave-github/lib/index.d.ts.map +1 -0
  121. package/dist/plugins/specweave-github/lib/index.js +10 -0
  122. package/dist/plugins/specweave-github/lib/index.js.map +1 -0
  123. package/dist/plugins/specweave-github/lib/subtask-sync.d.ts +51 -0
  124. package/dist/plugins/specweave-github/lib/subtask-sync.d.ts.map +1 -0
  125. package/dist/plugins/specweave-github/lib/subtask-sync.js +147 -0
  126. package/dist/plugins/specweave-github/lib/subtask-sync.js.map +1 -0
  127. package/dist/plugins/specweave-github/lib/task-parser.d.ts +37 -0
  128. package/dist/plugins/specweave-github/lib/task-parser.d.ts.map +1 -0
  129. package/dist/plugins/specweave-github/lib/task-parser.js +211 -0
  130. package/dist/plugins/specweave-github/lib/task-parser.js.map +1 -0
  131. package/dist/plugins/specweave-github/lib/task-sync.d.ts +51 -0
  132. package/dist/plugins/specweave-github/lib/task-sync.d.ts.map +1 -0
  133. package/dist/plugins/specweave-github/lib/task-sync.js +332 -0
  134. package/dist/plugins/specweave-github/lib/task-sync.js.map +1 -0
  135. package/dist/plugins/specweave-github/lib/types.d.ts +80 -0
  136. package/dist/plugins/specweave-github/lib/types.d.ts.map +1 -0
  137. package/dist/plugins/specweave-github/lib/types.js +5 -0
  138. package/dist/plugins/specweave-github/lib/types.js.map +1 -0
  139. package/dist/utils/agents-md-compiler.d.ts +68 -0
  140. package/dist/utils/agents-md-compiler.d.ts.map +1 -0
  141. package/dist/utils/agents-md-compiler.js +420 -0
  142. package/dist/utils/agents-md-compiler.js.map +1 -0
  143. package/dist/utils/execFileNoThrow.d.ts +97 -0
  144. package/dist/utils/execFileNoThrow.d.ts.map +1 -0
  145. package/dist/utils/execFileNoThrow.js +130 -0
  146. package/dist/utils/execFileNoThrow.js.map +1 -0
  147. package/dist/utils/generate-skills-index.js +4 -4
  148. package/dist/utils/generate-skills-index.js.map +1 -1
  149. package/package.json +13 -14
  150. package/plugins/.specweave/logs/hooks-debug.log +24 -0
  151. package/plugins/.specweave/logs/last-hook-fire +1 -0
  152. package/plugins/.specweave/logs/last-todowrite-time +1 -0
  153. package/plugins/.specweave/logs/tasks.log +6 -0
  154. package/plugins/specweave/.claude-plugin/plugin.json +22 -0
  155. package/{src → plugins/specweave}/agents/pm/AGENT.md +80 -0
  156. package/plugins/specweave/agents/translator/AGENT.md +282 -0
  157. package/{src → plugins/specweave}/commands/README.md +11 -11
  158. package/{src/commands/specweave.costs.md → plugins/specweave/commands/costs.md} +8 -8
  159. package/{src/commands/specweave.do.md → plugins/specweave/commands/do.md} +35 -8
  160. package/{src/commands/specweave.done.md → plugins/specweave/commands/done.md} +1 -1
  161. package/{src/commands/specweave.inc.md → plugins/specweave/commands/inc.md} +1 -1
  162. package/{src/commands/specweave.increment.md → plugins/specweave/commands/increment.md} +84 -19
  163. package/{src/commands/specweave.next.md → plugins/specweave/commands/next.md} +1 -1
  164. package/{src/commands/specweave.progress.md → plugins/specweave/commands/progress.md} +1 -1
  165. package/{src → plugins/specweave}/commands/specweave.md +57 -25
  166. package/{src/commands/specweave.sync-docs.md → plugins/specweave/commands/sync-docs.md} +6 -6
  167. package/plugins/specweave/commands/translate.md +425 -0
  168. package/{src/commands/specweave.validate.md → plugins/specweave/commands/validate.md} +2 -2
  169. package/plugins/specweave/hooks/hooks.json +15 -0
  170. package/plugins/specweave/hooks/post-task-completion.sh +265 -0
  171. package/plugins/specweave/skills/SKILLS-INDEX.md +229 -0
  172. package/{src → plugins/specweave}/skills/brownfield-analyzer/SKILL.md +66 -24
  173. package/{src → plugins/specweave}/skills/context-loader/SKILL.md +1 -1
  174. package/plugins/specweave/skills/context-optimizer/SKILL.md +588 -0
  175. package/plugins/specweave/skills/docs-updater/SKILL.md +0 -0
  176. package/{src → plugins/specweave}/skills/increment-planner/SKILL.md +81 -4
  177. package/plugins/specweave/skills/plugin-detector/SKILL.md +211 -0
  178. package/{src → plugins/specweave}/skills/project-kickstarter/SKILL.md +7 -7
  179. package/plugins/specweave/skills/rfc-generator/SKILL.md +369 -0
  180. package/{src → plugins/specweave}/skills/specweave-detector/SKILL.md +2 -2
  181. package/plugins/specweave/skills/specweave-framework/SKILL.md +498 -0
  182. package/plugins/specweave/skills/specweave-framework/test-cases/test-1-increment-naming.yaml +11 -0
  183. package/plugins/specweave/skills/specweave-framework/test-cases/test-2-source-of-truth.yaml +11 -0
  184. package/plugins/specweave/skills/specweave-framework/test-cases/test-3-increment-discipline.yaml +12 -0
  185. package/plugins/specweave/skills/specweave-framework/test-cases/test-4-file-placement.yaml +11 -0
  186. package/{src → plugins/specweave}/skills/tdd-workflow/SKILL.md +21 -21
  187. package/plugins/specweave/skills/translator/SKILL.md +172 -0
  188. package/plugins/specweave-ado/.claude-plugin/plugin.json +8 -0
  189. package/plugins/specweave-alternatives/.claude-plugin/plugin.json +8 -0
  190. package/plugins/specweave-alternatives/skills/bmad-method-expert/SKILL.md +626 -0
  191. package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/analyze-project.js +318 -0
  192. package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/check-setup.js +208 -0
  193. package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/generate-template.js +1149 -0
  194. package/plugins/specweave-alternatives/skills/bmad-method-expert/scripts/validate-documents.js +340 -0
  195. package/plugins/specweave-alternatives/skills/spec-kit-expert/SKILL.md +1010 -0
  196. package/plugins/specweave-backend/.claude-plugin/plugin.json +8 -0
  197. package/plugins/specweave-cost-optimizer/.claude-plugin/plugin.json +8 -0
  198. package/plugins/specweave-diagrams/.claude-plugin/plugin.json +8 -0
  199. package/plugins/specweave-docs/.claude-plugin/plugin.json +8 -0
  200. package/plugins/specweave-docs/skills/docusaurus/SKILL.md +526 -0
  201. package/plugins/specweave-figma/.claude-plugin/.mcp.json +12 -0
  202. package/plugins/specweave-figma/.claude-plugin/plugin.json +8 -0
  203. package/plugins/specweave-figma/ARCHITECTURE.md +453 -0
  204. package/plugins/specweave-figma/README.md +728 -0
  205. package/plugins/specweave-figma/skills/figma-to-code/SKILL.md +632 -0
  206. package/plugins/specweave-figma/skills/figma-to-code/test-1-token-generation.yaml +29 -0
  207. package/plugins/specweave-figma/skills/figma-to-code/test-2-component-generation.yaml +27 -0
  208. package/plugins/specweave-figma/skills/figma-to-code/test-3-typescript-generation.yaml +28 -0
  209. package/plugins/specweave-frontend/.claude-plugin/plugin.json +8 -0
  210. package/plugins/specweave-github/.claude-plugin/plugin.json +19 -0
  211. package/plugins/specweave-github/agents/github-manager/AGENT.md +651 -0
  212. package/plugins/specweave-github/commands/github-close-issue.md +418 -0
  213. package/plugins/specweave-github/commands/github-create-issue.md +307 -0
  214. package/plugins/specweave-github/commands/github-status.md +533 -0
  215. package/plugins/specweave-github/commands/github-sync-tasks.md +530 -0
  216. package/plugins/specweave-github/commands/github-sync.md +443 -0
  217. package/plugins/specweave-github/lib/github-client.ts +330 -0
  218. package/plugins/specweave-github/lib/index.ts +10 -0
  219. package/plugins/specweave-github/lib/subtask-sync.ts +225 -0
  220. package/plugins/specweave-github/lib/task-parser.ts +246 -0
  221. package/plugins/specweave-github/lib/task-sync.ts +402 -0
  222. package/plugins/specweave-github/lib/types.ts +86 -0
  223. package/plugins/specweave-github/skills/github-issue-tracker/SKILL.md +497 -0
  224. package/plugins/specweave-github/skills/github-sync/SKILL.md +461 -0
  225. package/plugins/specweave-infrastructure/.claude-plugin/plugin.json +8 -0
  226. package/plugins/specweave-jira/.claude-plugin/plugin.json +8 -0
  227. package/{src → plugins/specweave-jira}/commands/specweave.sync-jira.md +18 -18
  228. package/plugins/specweave-kubernetes/.claude-plugin/plugin.json +8 -0
  229. package/plugins/specweave-ml/.claude-plugin/plugin.json +38 -0
  230. package/plugins/specweave-ml/README.md +885 -0
  231. package/plugins/specweave-ml/agents/ml-engineer/AGENT.md +402 -0
  232. package/plugins/specweave-ml/commands/ml-deploy.md +116 -0
  233. package/plugins/specweave-ml/commands/ml-evaluate.md +87 -0
  234. package/plugins/specweave-ml/commands/ml-explain.md +83 -0
  235. package/plugins/specweave-ml/skills/anomaly-detector/SKILL.md +559 -0
  236. package/plugins/specweave-ml/skills/automl-optimizer/SKILL.md +485 -0
  237. package/plugins/specweave-ml/skills/cv-pipeline-builder/SKILL.md +157 -0
  238. package/plugins/specweave-ml/skills/data-visualizer/SKILL.md +521 -0
  239. package/plugins/specweave-ml/skills/experiment-tracker/SKILL.md +535 -0
  240. package/plugins/specweave-ml/skills/feature-engineer/SKILL.md +566 -0
  241. package/plugins/specweave-ml/skills/ml-deployment-helper/SKILL.md +345 -0
  242. package/plugins/specweave-ml/skills/ml-pipeline-orchestrator/SKILL.md +518 -0
  243. package/plugins/specweave-ml/skills/model-evaluator/SKILL.md +155 -0
  244. package/plugins/specweave-ml/skills/model-explainer/SKILL.md +227 -0
  245. package/plugins/specweave-ml/skills/model-registry/SKILL.md +541 -0
  246. package/plugins/specweave-ml/skills/nlp-pipeline-builder/SKILL.md +180 -0
  247. package/plugins/specweave-ml/skills/time-series-forecaster/SKILL.md +569 -0
  248. package/plugins/specweave-payments/.claude-plugin/plugin.json +8 -0
  249. package/plugins/specweave-testing/.claude-plugin/plugin.json +8 -0
  250. package/plugins/specweave-tooling/.claude-plugin/plugin.json +8 -0
  251. package/plugins/specweave-ui/.claude-plugin/plugin.json +26 -0
  252. package/plugins/specweave-ui/.mcp.json +14 -0
  253. package/plugins/specweave-ui/README.md +386 -0
  254. package/src/adapters/claude/adapter.ts +193 -46
  255. package/src/adapters/copilot/adapter.ts +132 -7
  256. package/src/adapters/cursor/adapter.ts +62 -3
  257. package/src/adapters/generic/adapter.ts +62 -3
  258. package/src/templates/AGENTS.md.template +170 -1
  259. package/src/templates/CLAUDE.md.template +122 -24
  260. package/src/templates/tasks.md.template +261 -0
  261. package/src/agents/ml-engineer/AGENT.md +0 -150
  262. package/src/commands/specweave.sync-github.md +0 -269
  263. package/src/hooks/post-task-completion.sh +0 -121
  264. package/src/skills/SKILLS-INDEX.md +0 -444
  265. package/src/skills/github-sync/SKILL.md +0 -234
  266. /package/{src → plugins/specweave}/agents/architect/AGENT.md +0 -0
  267. /package/{src → plugins/specweave}/agents/code-reviewer.md +0 -0
  268. /package/{src → plugins/specweave}/agents/docs-writer/AGENT.md +0 -0
  269. /package/{src → plugins/specweave}/agents/performance/AGENT.md +0 -0
  270. /package/{src → plugins/specweave}/agents/qa-lead/AGENT.md +0 -0
  271. /package/{src → plugins/specweave}/agents/security/AGENT.md +0 -0
  272. /package/{src → plugins/specweave}/agents/tdd-orchestrator/AGENT.md +0 -0
  273. /package/{src → plugins/specweave}/agents/tech-lead/AGENT.md +0 -0
  274. /package/{src/commands/specweave.list-increments.md → plugins/specweave/commands/list-increments.md} +0 -0
  275. /package/{src/commands/specweave.tdd-cycle.md → plugins/specweave/commands/tdd-cycle.md} +0 -0
  276. /package/{src/commands/specweave.tdd-green.md → plugins/specweave/commands/tdd-green.md} +0 -0
  277. /package/{src/commands/specweave.tdd-red.md → plugins/specweave/commands/tdd-red.md} +0 -0
  278. /package/{src/commands/specweave.tdd-refactor.md → plugins/specweave/commands/tdd-refactor.md} +0 -0
  279. /package/{src → plugins/specweave}/hooks/README.md +0 -0
  280. /package/{src → plugins/specweave}/hooks/docs-changed.sh +0 -0
  281. /package/{src → plugins/specweave}/hooks/human-input-required.sh +0 -0
  282. /package/{src → plugins/specweave}/hooks/post-increment-plugin-detect.sh +0 -0
  283. /package/{src → plugins/specweave}/hooks/pre-implementation.sh +0 -0
  284. /package/{src → plugins/specweave}/hooks/pre-task-plugin-detect.sh +0 -0
  285. /package/{src → plugins/specweave}/skills/brownfield-onboarder/SKILL.md +0 -0
  286. /package/{src → plugins/specweave}/skills/docs-updater/README.md +0 -0
  287. /package/{src → plugins/specweave}/skills/increment-planner/scripts/feature-utils.js +0 -0
  288. /package/{src → plugins/specweave}/skills/increment-quality-judge/SKILL.md +0 -0
  289. /package/{src → plugins/specweave}/skills/project-kickstarter/test-cases/test-1-high-confidence-full-product.yaml +0 -0
  290. /package/{src → plugins/specweave}/skills/project-kickstarter/test-cases/test-2-medium-confidence-partial.yaml +0 -0
  291. /package/{src → plugins/specweave}/skills/project-kickstarter/test-cases/test-3-low-confidence-technical-question.yaml +0 -0
  292. /package/{src → plugins/specweave}/skills/project-kickstarter/test-cases/test-4-opt-out-explicit.yaml +0 -0
  293. /package/{src → plugins/specweave}/skills/role-orchestrator/README.md +0 -0
  294. /package/{src → plugins/specweave}/skills/role-orchestrator/SKILL.md +0 -0
  295. /package/{src → plugins/specweave}/skills/task-builder/README.md +0 -0
  296. /package/{src → plugins/specweave-ado}/skills/ado-sync/README.md +0 -0
  297. /package/{src → plugins/specweave-ado}/skills/ado-sync/SKILL.md +0 -0
  298. /package/{src → plugins/specweave-ado}/skills/specweave-ado-mapper/SKILL.md +0 -0
  299. /package/{src → plugins/specweave-backend}/agents/database-optimizer/AGENT.md +0 -0
  300. /package/{src → plugins/specweave-backend}/skills/dotnet-backend/SKILL.md +0 -0
  301. /package/{src → plugins/specweave-backend}/skills/nodejs-backend/SKILL.md +0 -0
  302. /package/{src → plugins/specweave-backend}/skills/python-backend/SKILL.md +0 -0
  303. /package/{src → plugins/specweave-cost-optimizer}/skills/cost-optimizer/SKILL.md +0 -0
  304. /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/AGENT.md +0 -0
  305. /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/templates/c4-component-template.mmd +0 -0
  306. /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/templates/c4-container-template.mmd +0 -0
  307. /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/templates/c4-context-template.mmd +0 -0
  308. /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/templates/deployment-template.mmd +0 -0
  309. /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/templates/er-diagram-template.mmd +0 -0
  310. /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/templates/sequence-template.mmd +0 -0
  311. /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/test-cases/test-1-c4-context.yaml +0 -0
  312. /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/test-cases/test-2-sequence.yaml +0 -0
  313. /package/{src → plugins/specweave-diagrams}/agents/diagrams-architect/test-cases/test-3-er-diagram.yaml +0 -0
  314. /package/{src → plugins/specweave-diagrams}/skills/diagrams-architect/SKILL.md +0 -0
  315. /package/{src → plugins/specweave-diagrams}/skills/diagrams-generator/SKILL.md +0 -0
  316. /package/{src → plugins/specweave-docs}/skills/spec-driven-brainstorming/README.md +0 -0
  317. /package/{src → plugins/specweave-docs}/skills/spec-driven-brainstorming/SKILL.md +0 -0
  318. /package/{src → plugins/specweave-docs}/skills/spec-driven-debugging/README.md +0 -0
  319. /package/{src → plugins/specweave-docs}/skills/spec-driven-debugging/SKILL.md +0 -0
  320. /package/{src → plugins/specweave-frontend}/skills/design-system-architect/SKILL.md +0 -0
  321. /package/{src → plugins/specweave-frontend}/skills/frontend/SKILL.md +0 -0
  322. /package/{src → plugins/specweave-frontend}/skills/nextjs/SKILL.md +0 -0
  323. /package/{src → plugins/specweave-infrastructure}/agents/devops/AGENT.md +0 -0
  324. /package/{src → plugins/specweave-infrastructure}/agents/network-engineer/AGENT.md +0 -0
  325. /package/{src → plugins/specweave-infrastructure}/agents/observability-engineer/AGENT.md +0 -0
  326. /package/{src → plugins/specweave-infrastructure}/agents/performance-engineer/AGENT.md +0 -0
  327. /package/{src → plugins/specweave-infrastructure}/agents/sre/AGENT.md +0 -0
  328. /package/{src → plugins/specweave-infrastructure}/agents/sre/modules/backend-diagnostics.md +0 -0
  329. /package/{src → plugins/specweave-infrastructure}/agents/sre/modules/database-diagnostics.md +0 -0
  330. /package/{src → plugins/specweave-infrastructure}/agents/sre/modules/infrastructure.md +0 -0
  331. /package/{src → plugins/specweave-infrastructure}/agents/sre/modules/monitoring.md +0 -0
  332. /package/{src → plugins/specweave-infrastructure}/agents/sre/modules/security-incidents.md +0 -0
  333. /package/{src → plugins/specweave-infrastructure}/agents/sre/modules/ui-diagnostics.md +0 -0
  334. /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/01-high-cpu-usage.md +0 -0
  335. /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/02-database-deadlock.md +0 -0
  336. /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/03-memory-leak.md +0 -0
  337. /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/04-slow-api-response.md +0 -0
  338. /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/05-ddos-attack.md +0 -0
  339. /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/06-disk-full.md +0 -0
  340. /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/07-service-down.md +0 -0
  341. /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/08-data-corruption.md +0 -0
  342. /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/09-cascade-failure.md +0 -0
  343. /package/{src → plugins/specweave-infrastructure}/agents/sre/playbooks/10-rate-limit-exceeded.md +0 -0
  344. /package/{src → plugins/specweave-infrastructure}/agents/sre/scripts/health-check.sh +0 -0
  345. /package/{src → plugins/specweave-infrastructure}/agents/sre/scripts/log-analyzer.py +0 -0
  346. /package/{src → plugins/specweave-infrastructure}/agents/sre/scripts/metrics-collector.sh +0 -0
  347. /package/{src → plugins/specweave-infrastructure}/agents/sre/scripts/trace-analyzer.js +0 -0
  348. /package/{src → plugins/specweave-infrastructure}/agents/sre/templates/incident-report.md +0 -0
  349. /package/{src → plugins/specweave-infrastructure}/agents/sre/templates/mitigation-plan.md +0 -0
  350. /package/{src → plugins/specweave-infrastructure}/agents/sre/templates/post-mortem.md +0 -0
  351. /package/{src → plugins/specweave-infrastructure}/agents/sre/templates/runbook-template.md +0 -0
  352. /package/{src → plugins/specweave-infrastructure}/commands/specweave.monitor-setup.md +0 -0
  353. /package/{src → plugins/specweave-infrastructure}/commands/specweave.slo-implement.md +0 -0
  354. /package/{src → plugins/specweave-infrastructure}/skills/distributed-tracing/SKILL.md +0 -0
  355. /package/{src → plugins/specweave-infrastructure}/skills/grafana-dashboards/SKILL.md +0 -0
  356. /package/{src → plugins/specweave-infrastructure}/skills/hetzner-provisioner/README.md +0 -0
  357. /package/{src → plugins/specweave-infrastructure}/skills/hetzner-provisioner/SKILL.md +0 -0
  358. /package/{src → plugins/specweave-infrastructure}/skills/prometheus-configuration/SKILL.md +0 -0
  359. /package/{src → plugins/specweave-infrastructure}/skills/slo-implementation/SKILL.md +0 -0
  360. /package/{src → plugins/specweave-jira}/skills/jira-sync/README.md +0 -0
  361. /package/{src → plugins/specweave-jira}/skills/jira-sync/SKILL.md +0 -0
  362. /package/{src → plugins/specweave-jira}/skills/specweave-jira-mapper/SKILL.md +0 -0
  363. /package/{src → plugins/specweave-kubernetes}/agents/kubernetes-architect/AGENT.md +0 -0
  364. /package/{src → plugins/specweave-kubernetes}/skills/gitops-workflow/SKILL.md +0 -0
  365. /package/{src → plugins/specweave-kubernetes}/skills/gitops-workflow/references/argocd-setup.md +0 -0
  366. /package/{src → plugins/specweave-kubernetes}/skills/gitops-workflow/references/sync-policies.md +0 -0
  367. /package/{src → plugins/specweave-kubernetes}/skills/helm-chart-scaffolding/SKILL.md +0 -0
  368. /package/{src → plugins/specweave-kubernetes}/skills/helm-chart-scaffolding/assets/Chart.yaml.template +0 -0
  369. /package/{src → plugins/specweave-kubernetes}/skills/helm-chart-scaffolding/assets/values.yaml.template +0 -0
  370. /package/{src → plugins/specweave-kubernetes}/skills/helm-chart-scaffolding/references/chart-structure.md +0 -0
  371. /package/{src → plugins/specweave-kubernetes}/skills/helm-chart-scaffolding/scripts/validate-chart.sh +0 -0
  372. /package/{src → plugins/specweave-kubernetes}/skills/k8s-manifest-generator/SKILL.md +0 -0
  373. /package/{src → plugins/specweave-kubernetes}/skills/k8s-manifest-generator/assets/configmap-template.yaml +0 -0
  374. /package/{src → plugins/specweave-kubernetes}/skills/k8s-manifest-generator/assets/deployment-template.yaml +0 -0
  375. /package/{src → plugins/specweave-kubernetes}/skills/k8s-manifest-generator/assets/service-template.yaml +0 -0
  376. /package/{src → plugins/specweave-kubernetes}/skills/k8s-manifest-generator/references/deployment-spec.md +0 -0
  377. /package/{src → plugins/specweave-kubernetes}/skills/k8s-manifest-generator/references/service-spec.md +0 -0
  378. /package/{src → plugins/specweave-kubernetes}/skills/k8s-security-policies/SKILL.md +0 -0
  379. /package/{src → plugins/specweave-kubernetes}/skills/k8s-security-policies/assets/network-policy-template.yaml +0 -0
  380. /package/{src → plugins/specweave-kubernetes}/skills/k8s-security-policies/references/rbac-patterns.md +0 -0
  381. /package/{src → plugins/specweave-ml}/agents/data-scientist/AGENT.md +0 -0
  382. /package/{src → plugins/specweave-ml}/agents/mlops-engineer/AGENT.md +0 -0
  383. /package/{src → plugins/specweave-ml}/commands/specweave.ml-pipeline.md +0 -0
  384. /package/{src → plugins/specweave-ml}/skills/ml-pipeline-workflow/SKILL.md +0 -0
  385. /package/{src → plugins/specweave-payments}/agents/payment-integration/AGENT.md +0 -0
  386. /package/{src → plugins/specweave-payments}/skills/billing-automation/SKILL.md +0 -0
  387. /package/{src → plugins/specweave-payments}/skills/paypal-integration/SKILL.md +0 -0
  388. /package/{src → plugins/specweave-payments}/skills/pci-compliance/SKILL.md +0 -0
  389. /package/{src → plugins/specweave-payments}/skills/stripe-integration/SKILL.md +0 -0
  390. /package/{src → plugins/specweave-testing}/skills/e2e-playwright/README.md +0 -0
  391. /package/{src → plugins/specweave-testing}/skills/e2e-playwright/SKILL.md +0 -0
  392. /package/{src → plugins/specweave-testing}/skills/e2e-playwright/execute.js +0 -0
  393. /package/{src → plugins/specweave-testing}/skills/e2e-playwright/lib/utils.js +0 -0
  394. /package/{src → plugins/specweave-testing}/skills/e2e-playwright/package.json +0 -0
  395. /package/{src → plugins/specweave-tooling}/skills/skill-creator/LICENSE.txt +0 -0
  396. /package/{src → plugins/specweave-tooling}/skills/skill-creator/SKILL.md +0 -0
  397. /package/{src → plugins/specweave-tooling}/skills/skill-creator/scripts/init_skill.py +0 -0
  398. /package/{src → plugins/specweave-tooling}/skills/skill-creator/scripts/package_skill.py +0 -0
  399. /package/{src → plugins/specweave-tooling}/skills/skill-creator/scripts/quick_validate.py +0 -0
  400. /package/{src → plugins/specweave-tooling}/skills/skill-router/SKILL.md +0 -0
@@ -0,0 +1,541 @@
1
+ ---
2
+ name: model-registry
3
+ description: |
4
+ Centralized model versioning, staging, and lifecycle management. Activates for "model registry", "model versioning", "model staging", "deploy to production", "rollback model", "model metadata", "model lineage", "promote model", "model catalog". Manages ML model lifecycle from development through production with SpecWeave increment integration.
5
+ ---
6
+
7
+ # Model Registry
8
+
9
+ ## Overview
10
+
11
+ Centralized system for managing ML model lifecycle: versioning, staging (dev/staging/prod), metadata tracking, lineage, and rollback. Ensures production models are tracked, reproducible, and can be safely deployed or rolled back—all integrated with SpecWeave's increment workflow.
12
+
13
+ ## Why Model Registry Matters
14
+
15
+ **Without Model Registry**:
16
+ - ❌ "Which model is in production?"
17
+ - ❌ "Can't reproduce model from 3 months ago"
18
+ - ❌ "Breaking change deployed, how to rollback?"
19
+ - ❌ "Model metadata scattered across notebooks"
20
+ - ❌ "No audit trail for model changes"
21
+
22
+ **With Model Registry**:
23
+ - ✅ Single source of truth for all models
24
+ - ✅ Full version history with metadata
25
+ - ✅ Safe staging pipeline (dev → staging → prod)
26
+ - ✅ One-command rollback
27
+ - ✅ Complete model lineage
28
+ - ✅ Audit trail for compliance
29
+
30
+ ## Model Registry Structure
31
+
32
+ ### Model Lifecycle Stages
33
+
34
+ ```
35
+ Development → Staging → Production → Archived
36
+
37
+ Dev: Training, experimentation
38
+ Staging: Validation, A/B testing (10% traffic)
39
+ Prod: Production deployment (100% traffic)
40
+ Archived: Decommissioned, kept for audit
41
+ ```
42
+
43
+ ## Core Operations
44
+
45
+ ### 1. Model Registration
46
+
47
+ ```python
48
+ from specweave import ModelRegistry
49
+
50
+ registry = ModelRegistry(increment="0042")
51
+
52
+ # Register new model version
53
+ model_version = registry.register_model(
54
+ name="fraud-detection-model",
55
+ model=trained_model,
56
+ version="v3",
57
+ metadata={
58
+ "algorithm": "XGBoost",
59
+ "accuracy": 0.87,
60
+ "precision": 0.85,
61
+ "recall": 0.62,
62
+ "training_date": "2024-01-15",
63
+ "training_data_version": "v2024-01",
64
+ "hyperparameters": {
65
+ "n_estimators": 673,
66
+ "max_depth": 6,
67
+ "learning_rate": 0.094
68
+ },
69
+ "features": feature_names,
70
+ "framework": "xgboost==1.7.0",
71
+ "python_version": "3.10",
72
+ "increment": "0042"
73
+ },
74
+ stage="dev", # Initial stage
75
+ tags=["fraud", "production-candidate"]
76
+ )
77
+
78
+ # Creates:
79
+ # - Model artifact (model.pkl)
80
+ # - Model metadata (metadata.json)
81
+ # - Model signature (inputs/outputs)
82
+ # - Environment file (requirements.txt)
83
+ # - Feature schema (features.yaml)
84
+ ```
85
+
86
+ ### 2. Model Versioning
87
+
88
+ ```python
89
+ # Semantic versioning: major.minor.patch
90
+ registry.version_model(
91
+ name="fraud-detection-model",
92
+ version_type="minor" # v3.0.0 → v3.1.0
93
+ )
94
+
95
+ # Auto-increments based on changes:
96
+ # - major: Breaking changes (different features, incompatible)
97
+ # - minor: Improvements (better accuracy, new features added)
98
+ # - patch: Bugfixes, retraining (same features, slight changes)
99
+ ```
100
+
101
+ ### 3. Model Promotion
102
+
103
+ **Stage Progression**:
104
+ ```python
105
+ # Promote from dev to staging
106
+ registry.promote_model(
107
+ name="fraud-detection-model",
108
+ version="v3.1.0",
109
+ from_stage="dev",
110
+ to_stage="staging",
111
+ approval_required=True # Requires review
112
+ )
113
+
114
+ # Validate in staging (A/B test)
115
+ ab_test_results = run_ab_test(
116
+ control="fraud-detection-v3.0.0",
117
+ treatment="fraud-detection-v3.1.0",
118
+ traffic_split=0.1, # 10% to new model
119
+ duration_days=7
120
+ )
121
+
122
+ # Promote to production if successful
123
+ if ab_test_results['treatment_is_better']:
124
+ registry.promote_model(
125
+ name="fraud-detection-model",
126
+ version="v3.1.0",
127
+ from_stage="staging",
128
+ to_stage="production"
129
+ )
130
+ ```
131
+
132
+ ### 4. Model Rollback
133
+
134
+ ```python
135
+ # Rollback to previous version
136
+ registry.rollback(
137
+ name="fraud-detection-model",
138
+ to_version="v3.0.0", # Previous stable version
139
+ reason="v3.1.0 causing high false positive rate"
140
+ )
141
+
142
+ # Automatic rollback triggers:
143
+ registry.set_auto_rollback_triggers(
144
+ error_rate_threshold=0.05, # Rollback if >5% errors
145
+ latency_threshold=200, # Rollback if p95 > 200ms
146
+ accuracy_drop_threshold=0.10 # Rollback if accuracy drops >10%
147
+ )
148
+ ```
149
+
150
+ ### 5. Model Retrieval
151
+
152
+ ```python
153
+ # Get latest production model
154
+ model = registry.get_model(
155
+ name="fraud-detection-model",
156
+ stage="production"
157
+ )
158
+
159
+ # Get specific version
160
+ model_v3 = registry.get_model(
161
+ name="fraud-detection-model",
162
+ version="v3.1.0"
163
+ )
164
+
165
+ # Get model by date
166
+ model_jan = registry.get_model_by_date(
167
+ name="fraud-detection-model",
168
+ date="2024-01-15"
169
+ )
170
+ ```
171
+
172
+ ## Model Metadata
173
+
174
+ ### Tracked Metadata
175
+
176
+ ```python
177
+ model_metadata = {
178
+ # Core Info
179
+ "name": "fraud-detection-model",
180
+ "version": "v3.1.0",
181
+ "stage": "production",
182
+ "created_at": "2024-01-15T10:30:00Z",
183
+ "updated_at": "2024-01-20T14:00:00Z",
184
+
185
+ # Training Info
186
+ "algorithm": "XGBoost",
187
+ "framework": "xgboost==1.7.0",
188
+ "python_version": "3.10",
189
+ "training_duration": "45min",
190
+ "training_data_size": "100k rows",
191
+
192
+ # Performance Metrics
193
+ "accuracy": 0.87,
194
+ "precision": 0.85,
195
+ "recall": 0.62,
196
+ "roc_auc": 0.92,
197
+ "f1_score": 0.72,
198
+
199
+ # Deployment Info
200
+ "inference_latency_p50": "35ms",
201
+ "inference_latency_p95": "80ms",
202
+ "model_size": "12MB",
203
+ "cpu_usage": "0.2 cores",
204
+ "memory_usage": "256MB",
205
+
206
+ # Lineage
207
+ "increment": "0042-fraud-detection",
208
+ "experiment": "exp-003-xgboost",
209
+ "training_data_version": "v2024-01",
210
+ "feature_engineering_version": "v1",
211
+ "parent_model": "fraud-detection-v3.0.0",
212
+
213
+ # Features
214
+ "features": [
215
+ "amount_vs_user_average",
216
+ "days_since_last_purchase",
217
+ "merchant_risk_score",
218
+ ...
219
+ ],
220
+ "num_features": 35,
221
+
222
+ # Tags & Labels
223
+ "tags": ["fraud", "production", "high-precision"],
224
+ "owner": "[email protected]",
225
+ "approver": "[email protected]"
226
+ }
227
+ ```
228
+
229
+ ## Model Lineage
230
+
231
+ ### Tracking Model Lineage
232
+
233
+ ```python
234
+ # Full lineage: data → features → training → model
235
+ lineage = registry.get_lineage(
236
+ name="fraud-detection-model",
237
+ version="v3.1.0"
238
+ )
239
+
240
+ # Lineage graph:
241
+ """
242
+ data:v2024-01
243
+ └─> feature-engineering:v1
244
+ └─> experiment:exp-003-xgboost
245
+ └─> model:fraud-detection-v3.1.0
246
+ └─> deployment:production
247
+ """
248
+
249
+ # Answer questions like:
250
+ # - "What data was used to train this model?"
251
+ # - "Which experiments led to this model?"
252
+ # - "What models use this feature set?"
253
+ # - "Impact of changing feature X?"
254
+ ```
255
+
256
+ ### Model Comparison
257
+
258
+ ```python
259
+ # Compare two model versions
260
+ comparison = registry.compare_models(
261
+ model_a="fraud-detection-v3.0.0",
262
+ model_b="fraud-detection-v3.1.0"
263
+ )
264
+
265
+ # Output:
266
+ """
267
+ Comparison: v3.0.0 vs v3.1.0
268
+ ============================
269
+
270
+ Metrics:
271
+ - Accuracy: 0.85 → 0.87 (+2.4%) ✅
272
+ - Precision: 0.83 → 0.85 (+2.4%) ✅
273
+ - Recall: 0.60 → 0.62 (+3.3%) ✅
274
+
275
+ Performance:
276
+ - Latency: 40ms → 35ms (-12.5%) ✅
277
+ - Size: 15MB → 12MB (-20.0%) ✅
278
+
279
+ Features:
280
+ - Added: merchant_reputation_score
281
+ - Removed: obsolete_feature_x
282
+ - Modified: 3 features rescaled
283
+
284
+ Recommendation: ✅ v3.1.0 is better (improvement in all metrics)
285
+ """
286
+ ```
287
+
288
+ ## Integration with SpecWeave
289
+
290
+ ### Automatic Registration
291
+
292
+ ```python
293
+ # Models automatically registered during increment completion
294
+ with track_experiment("xgboost-v1", increment="0042") as exp:
295
+ model = train_model(X_train, y_train)
296
+
297
+ # Auto-registers model to registry
298
+ exp.register_model(
299
+ model=model,
300
+ name="fraud-detection-model",
301
+ auto_version=True # Auto-increment version
302
+ )
303
+ ```
304
+
305
+ ### Increment-Model Mapping
306
+
307
+ ```
308
+ .specweave/increments/0042-fraud-detection/
309
+ ├── models/
310
+ │ ├── fraud-detection-v3.0.0/
311
+ │ │ ├── model.pkl
312
+ │ │ ├── metadata.json
313
+ │ │ ├── requirements.txt
314
+ │ │ └── features.yaml
315
+ │ └── fraud-detection-v3.1.0/
316
+ │ ├── model.pkl
317
+ │ ├── metadata.json
318
+ │ ├── requirements.txt
319
+ │ └── features.yaml
320
+ └── registry/
321
+ ├── model_catalog.yaml
322
+ ├── lineage_graph.json
323
+ └── deployment_history.md
324
+ ```
325
+
326
+ ### Living Docs Integration
327
+
328
+ ```bash
329
+ /specweave:sync-docs update
330
+ ```
331
+
332
+ Updates:
333
+ ```markdown
334
+ <!-- .specweave/docs/internal/architecture/model-registry.md -->
335
+
336
+ ## Fraud Detection Model - Production
337
+
338
+ ### Current Production Model
339
+ - Version: v3.1.0
340
+ - Deployed: 2024-01-20
341
+ - Accuracy: 87%
342
+ - Latency: 35ms (p50)
343
+
344
+ ### Version History
345
+ | Version | Stage | Accuracy | Deployed | Notes |
346
+ |---------|-------|----------|----------|-------|
347
+ | v3.1.0 | Prod | 0.87 | 2024-01-20 | Current ✅ |
348
+ | v3.0.0 | Archived | 0.85 | 2024-01-10 | Replaced by v3.1.0 |
349
+ | v2.5.0 | Archived | 0.83 | 2023-12-01 | Retired |
350
+
351
+ ### Rollback Plan
352
+ If v3.1.0 issues detected:
353
+ 1. Rollback to v3.0.0 (tested, stable)
354
+ 2. Investigate issue in staging
355
+ 3. Deploy fix as v3.1.1
356
+ ```
357
+
358
+ ## Model Registry Providers
359
+
360
+ ### MLflow Model Registry
361
+
362
+ ```python
363
+ from specweave import MLflowRegistry
364
+
365
+ # Use MLflow as backend
366
+ registry = MLflowRegistry(
367
+ tracking_uri="http://mlflow.company.com",
368
+ increment="0042"
369
+ )
370
+
371
+ # All SpecWeave operations work with MLflow backend
372
+ registry.register_model(...)
373
+ registry.promote_model(...)
374
+ ```
375
+
376
+ ### Custom Registry
377
+
378
+ ```python
379
+ from specweave import CustomRegistry
380
+
381
+ # Use custom storage (S3, GCS, Azure Blob)
382
+ registry = CustomRegistry(
383
+ storage_uri="s3://ml-models/registry",
384
+ increment="0042"
385
+ )
386
+ ```
387
+
388
+ ## Best Practices
389
+
390
+ ### 1. Semantic Versioning
391
+
392
+ ```python
393
+ # Breaking change (different features)
394
+ registry.version_model(version_type="major") # v3.0.0 → v4.0.0
395
+
396
+ # Feature addition (backward compatible)
397
+ registry.version_model(version_type="minor") # v3.0.0 → v3.1.0
398
+
399
+ # Bugfix or retraining (no API change)
400
+ registry.version_model(version_type="patch") # v3.0.0 → v3.0.1
401
+ ```
402
+
403
+ ### 2. Model Signatures
404
+
405
+ ```python
406
+ # Document input/output schema
407
+ registry.set_model_signature(
408
+ model="fraud-detection-v3.1.0",
409
+ inputs={
410
+ "amount": "float",
411
+ "merchant_id": "int",
412
+ "location": "str"
413
+ },
414
+ outputs={
415
+ "fraud_probability": "float",
416
+ "fraud_flag": "bool",
417
+ "risk_score": "float"
418
+ }
419
+ )
420
+
421
+ # Prevents breaking changes (validate on registration)
422
+ ```
423
+
424
+ ### 3. Model Approval Workflow
425
+
426
+ ```python
427
+ # Require approval before production
428
+ registry.set_approval_required(
429
+ stage="production",
430
+ approvers=["[email protected]", "[email protected]"]
431
+ )
432
+
433
+ # Approve model promotion
434
+ registry.approve_model(
435
+ name="fraud-detection-model",
436
+ version="v3.1.0",
437
+ approver="[email protected]",
438
+ comments="Tested in staging, accuracy improved 2%, latency reduced 12%"
439
+ )
440
+ ```
441
+
442
+ ### 4. Model Deprecation
443
+
444
+ ```python
445
+ # Mark old models as deprecated
446
+ registry.deprecate_model(
447
+ name="fraud-detection-model",
448
+ version="v2.5.0",
449
+ reason="Superseded by v3.x series",
450
+ end_of_life="2024-06-01"
451
+ )
452
+ ```
453
+
454
+ ## Commands
455
+
456
+ ```bash
457
+ # List all models
458
+ /ml:registry-list
459
+
460
+ # Get model info
461
+ /ml:registry-info fraud-detection-model
462
+
463
+ # Promote model
464
+ /ml:registry-promote fraud-detection-model v3.1.0 --to production
465
+
466
+ # Rollback model
467
+ /ml:registry-rollback fraud-detection-model --to v3.0.0
468
+
469
+ # Compare models
470
+ /ml:registry-compare fraud-detection-model v3.0.0 v3.1.0
471
+ ```
472
+
473
+ ## Advanced Features
474
+
475
+ ### 1. Model Monitoring Integration
476
+
477
+ ```python
478
+ # Automatically track production model performance
479
+ monitor = ModelMonitor(registry=registry)
480
+
481
+ monitor.track_model(
482
+ name="fraud-detection-model",
483
+ stage="production",
484
+ metrics=["accuracy", "latency", "error_rate"]
485
+ )
486
+
487
+ # Auto-rollback if metrics degrade
488
+ monitor.set_auto_rollback(
489
+ metric="accuracy",
490
+ threshold=0.80, # Rollback if < 80%
491
+ window="24h"
492
+ )
493
+ ```
494
+
495
+ ### 2. Model Governance
496
+
497
+ ```python
498
+ # Compliance and audit trail
499
+ governance = ModelGovernance(registry=registry)
500
+
501
+ # Generate audit report
502
+ audit_report = governance.generate_audit_report(
503
+ model="fraud-detection-model",
504
+ start_date="2023-01-01",
505
+ end_date="2024-01-31"
506
+ )
507
+
508
+ # Includes:
509
+ # - All model versions deployed
510
+ # - Who approved deployments
511
+ # - Performance metrics over time
512
+ # - Data sources used
513
+ # - Compliance checkpoints
514
+ ```
515
+
516
+ ### 3. Multi-Environment Registry
517
+
518
+ ```python
519
+ # Separate registries for dev, staging, prod
520
+ registry_dev = ModelRegistry(environment="dev")
521
+ registry_staging = ModelRegistry(environment="staging")
522
+ registry_prod = ModelRegistry(environment="production")
523
+
524
+ # Promote across environments
525
+ registry_dev.promote_to(
526
+ model="fraud-detection-v3.1.0",
527
+ target_env="staging"
528
+ )
529
+ ```
530
+
531
+ ## Summary
532
+
533
+ Model Registry is essential for:
534
+ - ✅ Model versioning (track all model versions)
535
+ - ✅ Safe deployment (dev → staging → prod pipeline)
536
+ - ✅ Fast rollback (one-command revert to stable version)
537
+ - ✅ Audit trail (who deployed what, when, why)
538
+ - ✅ Model lineage (data → features → model → deployment)
539
+ - ✅ Compliance (regulatory requirements, governance)
540
+
541
+ This skill brings enterprise-grade model lifecycle management to SpecWeave, ensuring all models are tracked, reproducible, and safely deployed.
@@ -0,0 +1,180 @@
1
+ ---
2
+ name: nlp-pipeline-builder
3
+ description: |
4
+ Natural language processing ML pipelines for text classification, NER, sentiment analysis, text generation, and embeddings. Activates for "nlp", "text classification", "sentiment analysis", "named entity recognition", "BERT", "transformers", "text preprocessing", "tokenization", "word embeddings". Builds NLP pipelines with transformers, integrated with SpecWeave increments.
5
+ ---
6
+
7
+ # NLP Pipeline Builder
8
+
9
+ ## Overview
10
+
11
+ Specialized ML pipelines for natural language processing. Handles text preprocessing, tokenization, transformer models (BERT, RoBERTa, GPT), fine-tuning, and deployment for production NLP systems.
12
+
13
+ ## NLP Tasks Supported
14
+
15
+ ### 1. Text Classification
16
+
17
+ ```python
18
+ from specweave import NLPPipeline
19
+
20
+ # Binary or multi-class text classification
21
+ pipeline = NLPPipeline(
22
+ task="classification",
23
+ classes=["positive", "negative", "neutral"],
24
+ increment="0042"
25
+ )
26
+
27
+ # Automatically configures:
28
+ # - Text preprocessing (lowercase, clean)
29
+ # - Tokenization (BERT tokenizer)
30
+ # - Model (BERT, RoBERTa, DistilBERT)
31
+ # - Fine-tuning on your data
32
+ # - Inference pipeline
33
+
34
+ pipeline.fit(train_texts, train_labels)
35
+ ```
36
+
37
+ ### 2. Named Entity Recognition (NER)
38
+
39
+ ```python
40
+ # Extract entities from text
41
+ pipeline = NLPPipeline(
42
+ task="ner",
43
+ entities=["PERSON", "ORG", "LOC", "DATE"],
44
+ increment="0042"
45
+ )
46
+
47
+ # Returns: [(entity_text, entity_type, start_pos, end_pos), ...]
48
+ ```
49
+
50
+ ### 3. Sentiment Analysis
51
+
52
+ ```python
53
+ # Sentiment classification (specialized)
54
+ pipeline = NLPPipeline(
55
+ task="sentiment",
56
+ increment="0042"
57
+ )
58
+
59
+ # Fine-tuned for sentiment (positive/negative/neutral)
60
+ ```
61
+
62
+ ### 4. Text Generation
63
+
64
+ ```python
65
+ # Generate text continuations
66
+ pipeline = NLPPipeline(
67
+ task="generation",
68
+ model="gpt2",
69
+ increment="0042"
70
+ )
71
+
72
+ # Fine-tune on your domain-specific text
73
+ ```
74
+
75
+ ## Best Practices for NLP
76
+
77
+ ### Text Preprocessing
78
+
79
+ ```python
80
+ from specweave import TextPreprocessor
81
+
82
+ preprocessor = TextPreprocessor(increment="0042")
83
+
84
+ # Standard preprocessing
85
+ preprocessor.add_steps([
86
+ "lowercase",
87
+ "remove_html",
88
+ "remove_urls",
89
+ "remove_emails",
90
+ "remove_special_chars",
91
+ "remove_extra_whitespace"
92
+ ])
93
+
94
+ # Advanced preprocessing
95
+ preprocessor.add_advanced([
96
+ "spell_correction",
97
+ "lemmatization",
98
+ "stopword_removal"
99
+ ])
100
+ ```
101
+
102
+ ### Model Selection
103
+
104
+ **Text Classification**:
105
+ - Small datasets (<10K): DistilBERT (6x faster than BERT)
106
+ - Medium datasets (10K-100K): BERT-base
107
+ - Large datasets (>100K): RoBERTa-large
108
+
109
+ **NER**:
110
+ - General: BERT + CRF layer
111
+ - Domain-specific: Fine-tune BERT on domain corpus
112
+
113
+ **Sentiment**:
114
+ - Product reviews: DistilBERT fine-tuned on Amazon reviews
115
+ - Social media: RoBERTa fine-tuned on Twitter
116
+
117
+ ### Transfer Learning
118
+
119
+ ```python
120
+ # Start from pre-trained language models
121
+ pipeline = NLPPipeline(task="classification")
122
+
123
+ # Option 1: Use pre-trained (no fine-tuning)
124
+ pipeline.use_pretrained("distilbert-base-uncased")
125
+
126
+ # Option 2: Fine-tune on your data
127
+ pipeline.use_pretrained_and_finetune(
128
+ model="bert-base-uncased",
129
+ epochs=3,
130
+ learning_rate=2e-5
131
+ )
132
+ ```
133
+
134
+ ### Handling Long Text
135
+
136
+ ```python
137
+ # For text longer than 512 tokens
138
+ pipeline = NLPPipeline(
139
+ task="classification",
140
+ max_length=512,
141
+ truncation_strategy="head_and_tail" # Keep start + end
142
+ )
143
+
144
+ # Or use Longformer for long documents
145
+ pipeline.use_model("longformer") # Handles 4096 tokens
146
+ ```
147
+
148
+ ## Integration with SpecWeave
149
+
150
+ ```python
151
+ # NLP increment structure
152
+ .specweave/increments/0042-sentiment-classifier/
153
+ ├── spec.md
154
+ ├── data/
155
+ │ ├── train.csv
156
+ │ ├── val.csv
157
+ │ └── test.csv
158
+ ├── models/
159
+ │ ├── tokenizer/
160
+ │ ├── model-epoch-1/
161
+ │ ├── model-epoch-2/
162
+ │ └── model-epoch-3/
163
+ ├── experiments/
164
+ │ ├── distilbert-baseline/
165
+ │ ├── bert-base-finetuned/
166
+ │ └── roberta-large/
167
+ └── deployment/
168
+ ├── model.onnx
169
+ └── inference.py
170
+ ```
171
+
172
+ ## Commands
173
+
174
+ ```bash
175
+ /ml:nlp-pipeline --task classification --model bert-base
176
+ /ml:nlp-evaluate 0042 # Evaluate on test set
177
+ /ml:nlp-deploy 0042 # Export for production
178
+ ```
179
+
180
+ Quick setup for NLP projects with state-of-the-art transformer models.