hatch3r 1.8.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (396) hide show
  1. package/README.md +68 -178
  2. package/dist/cli/index.js +26966 -15942
  3. package/{agents → dist/content/agents}/hatch3r-architect.md +39 -9
  4. package/dist/content/agents/hatch3r-brownfield-spec.md +254 -0
  5. package/{agents → dist/content/agents}/hatch3r-ci-watcher.md +10 -3
  6. package/{agents → dist/content/agents}/hatch3r-context-rules.md +24 -6
  7. package/{agents → dist/content/agents}/hatch3r-creator.md +78 -39
  8. package/dist/content/agents/hatch3r-dependency-drafter.md +162 -0
  9. package/{agents → dist/content/agents}/hatch3r-devops.md +14 -4
  10. package/{agents → dist/content/agents}/hatch3r-docs-writer.md +11 -1
  11. package/dist/content/agents/hatch3r-edge-case-analyst.md +134 -0
  12. package/dist/content/agents/hatch3r-enhancability.md +192 -0
  13. package/{agents → dist/content/agents}/hatch3r-fixer.md +61 -10
  14. package/dist/content/agents/hatch3r-greenfield-spec.md +256 -0
  15. package/{agents → dist/content/agents}/hatch3r-handoff-loader.md +40 -14
  16. package/{agents → dist/content/agents}/hatch3r-handoff-preparer.md +17 -8
  17. package/dist/content/agents/hatch3r-implementer.md +409 -0
  18. package/dist/content/agents/hatch3r-incident-responder.md +96 -0
  19. package/dist/content/agents/hatch3r-learnings-loader.md +377 -0
  20. package/{agents → dist/content/agents}/hatch3r-lint-fixer.md +16 -4
  21. package/dist/content/agents/hatch3r-maintainability.md +183 -0
  22. package/dist/content/agents/hatch3r-pack-installer.md +113 -0
  23. package/dist/content/agents/hatch3r-performance.md +179 -0
  24. package/dist/content/agents/hatch3r-reliability.md +193 -0
  25. package/{agents → dist/content/agents}/hatch3r-researcher.md +30 -7
  26. package/dist/content/agents/hatch3r-reviewer.md +364 -0
  27. package/dist/content/agents/hatch3r-scalability.md +162 -0
  28. package/dist/content/agents/hatch3r-security.md +197 -0
  29. package/dist/content/agents/hatch3r-testability.md +204 -0
  30. package/dist/content/agents/hatch3r-ui.md +175 -0
  31. package/dist/content/agents/hatch3r-ux.md +160 -0
  32. package/{agents → dist/content/agents}/modes/requirements-elicitation.md +1 -1
  33. package/{agents → dist/content/agents}/modes/user-flows.md +2 -2
  34. package/dist/content/agents/shared/clarification-default-block.md +44 -0
  35. package/dist/content/agents/shared/confidence-gate.md +42 -0
  36. package/dist/content/agents/shared/cq-specialist-roster.md +26 -0
  37. package/{agents → dist/content/agents}/shared/efficiency-patterns.md +32 -1
  38. package/{agents → dist/content/agents}/shared/external-knowledge.md +1 -1
  39. package/{agents → dist/content/agents}/shared/injection-patterns.md +19 -8
  40. package/dist/content/agents/shared/principles.md +60 -0
  41. package/{agents → dist/content/agents}/shared/prompt-structure.md +7 -1
  42. package/{agents → dist/content/agents}/shared/quality-charter.md +73 -9
  43. package/dist/content/agents/shared/quality-specialist-frame.md +141 -0
  44. package/dist/content/agents/shared/rigor-contract.md +151 -0
  45. package/dist/content/agents/shared/severity-mapping.md +92 -0
  46. package/dist/content/agents/shared/triage-vocabulary.md +46 -0
  47. package/{agents → dist/content/agents}/shared/user-content-templates.md +40 -14
  48. package/dist/content/agents/shared/user-question-protocol.md +139 -0
  49. package/{checks → dist/content/checks}/README.md +5 -0
  50. package/{checks → dist/content/checks}/accessibility.md +14 -7
  51. package/{checks → dist/content/checks}/code-quality.md +1 -1
  52. package/{checks → dist/content/checks}/performance.md +7 -4
  53. package/{checks → dist/content/checks}/security.md +6 -6
  54. package/{checks → dist/content/checks}/testing.md +1 -1
  55. package/{commands → dist/content/commands}/board/pickup-azure-devops.md +1 -1
  56. package/{commands → dist/content/commands}/board/pickup-delegation-multi.md +41 -14
  57. package/{commands → dist/content/commands}/board/pickup-delegation.md +10 -8
  58. package/{commands → dist/content/commands}/board/pickup-github.md +1 -1
  59. package/{commands → dist/content/commands}/board/pickup-gitlab.md +1 -1
  60. package/{commands → dist/content/commands}/board/pickup-modes.md +1 -0
  61. package/{commands → dist/content/commands}/board/pickup-post-impl.md +2 -2
  62. package/{commands → dist/content/commands}/board/shared-azure-devops.md +1 -1
  63. package/{commands → dist/content/commands}/board/shared-github.md +2 -2
  64. package/{commands → dist/content/commands}/board/shared-gitlab.md +1 -1
  65. package/{commands → dist/content/commands}/hatch3r-api-spec.md +80 -3
  66. package/dist/content/commands/hatch3r-auth-scaffold.md +250 -0
  67. package/{commands → dist/content/commands}/hatch3r-benchmark.md +91 -8
  68. package/{commands → dist/content/commands}/hatch3r-board-fill.md +104 -18
  69. package/{commands → dist/content/commands}/hatch3r-board-pickup.md +99 -15
  70. package/dist/content/commands/hatch3r-bug-pipeline.md +240 -0
  71. package/{commands → dist/content/commands}/hatch3r-bug-plan.md +84 -8
  72. package/{commands → dist/content/commands}/hatch3r-codebase-map.md +82 -6
  73. package/{commands → dist/content/commands}/hatch3r-create.md +116 -18
  74. package/{commands → dist/content/commands}/hatch3r-debug.md +112 -24
  75. package/dist/content/commands/hatch3r-diagnose.md +238 -0
  76. package/{commands → dist/content/commands}/hatch3r-feature-plan.md +130 -10
  77. package/dist/content/commands/hatch3r-handoff.md +213 -0
  78. package/{commands → dist/content/commands}/hatch3r-healthcheck.md +106 -6
  79. package/dist/content/commands/hatch3r-incident-response.md +228 -0
  80. package/{commands → dist/content/commands}/hatch3r-migration-plan.md +81 -5
  81. package/{commands → dist/content/commands}/hatch3r-onboard.md +100 -9
  82. package/dist/content/commands/hatch3r-pack-install.md +243 -0
  83. package/{commands → dist/content/commands}/hatch3r-pr-resolve.md +114 -31
  84. package/{commands → dist/content/commands}/hatch3r-project-spec.md +85 -9
  85. package/{commands → dist/content/commands}/hatch3r-quick-change.md +115 -20
  86. package/{commands → dist/content/commands}/hatch3r-refactor-plan.md +82 -6
  87. package/dist/content/commands/hatch3r-release.md +401 -0
  88. package/{commands → dist/content/commands}/hatch3r-revision.md +104 -18
  89. package/{commands → dist/content/commands}/hatch3r-roadmap.md +94 -12
  90. package/{commands → dist/content/commands}/hatch3r-security-audit.md +107 -7
  91. package/dist/content/commands/hatch3r-slo-scaffold.md +246 -0
  92. package/dist/content/commands/hatch3r-spec.md +216 -0
  93. package/{commands → dist/content/commands}/hatch3r-test-plan.md +90 -14
  94. package/dist/content/commands/hatch3r-workflow.md +628 -0
  95. package/{commands → dist/content/commands}/revision/revision-delegation.md +8 -7
  96. package/{commands → dist/content/commands}/revision/revision-modes.md +49 -4
  97. package/{commands → dist/content/commands}/revision/revision-quality.md +12 -9
  98. package/dist/content/commands/shared/orchestration-frame.md +119 -0
  99. package/{github-agents → dist/content/github-agents}/hatch3r-docs-agent.md +22 -2
  100. package/dist/content/github-agents/hatch3r-lint-agent.md +66 -0
  101. package/{github-agents → dist/content/github-agents}/hatch3r-security-agent.md +22 -2
  102. package/{github-agents → dist/content/github-agents}/hatch3r-test-agent.md +22 -2
  103. package/{hooks → dist/content/hooks}/hatch3r-ci-failure.md +3 -3
  104. package/{hooks → dist/content/hooks}/hatch3r-file-save.md +4 -4
  105. package/{hooks → dist/content/hooks}/hatch3r-post-merge.md +1 -1
  106. package/{hooks → dist/content/hooks}/hatch3r-pre-commit.md +1 -1
  107. package/{hooks → dist/content/hooks}/hatch3r-pre-push.md +7 -7
  108. package/dist/content/hooks/hatch3r-review-loop-cap.md +52 -0
  109. package/{hooks → dist/content/hooks}/hatch3r-session-start.md +3 -3
  110. package/{mcp → dist/content/mcp}/mcp.json +7 -5
  111. package/{rules → dist/content/rules}/hatch3r-accessibility-standards.md +16 -3
  112. package/{rules → dist/content/rules}/hatch3r-accessibility-standards.mdc +13 -1
  113. package/dist/content/rules/hatch3r-agent-orchestration-detail.md +250 -0
  114. package/dist/content/rules/hatch3r-agent-orchestration-detail.mdc +245 -0
  115. package/dist/content/rules/hatch3r-agent-orchestration.md +250 -0
  116. package/dist/content/rules/hatch3r-agent-orchestration.mdc +245 -0
  117. package/{rules → dist/content/rules}/hatch3r-ai-evals.md +7 -5
  118. package/{rules → dist/content/rules}/hatch3r-ai-evals.mdc +5 -4
  119. package/{rules → dist/content/rules}/hatch3r-ai-ux-patterns.md +7 -3
  120. package/{rules → dist/content/rules}/hatch3r-ai-ux-patterns.mdc +4 -1
  121. package/dist/content/rules/hatch3r-android-patterns.md +107 -0
  122. package/dist/content/rules/hatch3r-android-patterns.mdc +102 -0
  123. package/dist/content/rules/hatch3r-anti-duplication.md +115 -0
  124. package/dist/content/rules/hatch3r-anti-duplication.mdc +115 -0
  125. package/{rules → dist/content/rules}/hatch3r-api-design.md +5 -1
  126. package/{rules → dist/content/rules}/hatch3r-api-design.mdc +3 -0
  127. package/{rules → dist/content/rules}/hatch3r-api-versioning.md +3 -1
  128. package/{rules → dist/content/rules}/hatch3r-api-versioning.mdc +1 -0
  129. package/{rules → dist/content/rules}/hatch3r-auth-patterns.md +5 -2
  130. package/{rules → dist/content/rules}/hatch3r-auth-patterns.mdc +2 -0
  131. package/{rules → dist/content/rules}/hatch3r-browser-verification.md +8 -10
  132. package/{rules → dist/content/rules}/hatch3r-browser-verification.mdc +8 -10
  133. package/dist/content/rules/hatch3r-capability-matrix.md +108 -0
  134. package/dist/content/rules/hatch3r-capability-matrix.mdc +108 -0
  135. package/{rules → dist/content/rules}/hatch3r-ci-cd.md +9 -1
  136. package/{rules → dist/content/rules}/hatch3r-ci-cd.mdc +7 -0
  137. package/dist/content/rules/hatch3r-clarification-default.md +73 -0
  138. package/dist/content/rules/hatch3r-clarification-default.mdc +73 -0
  139. package/{rules → dist/content/rules}/hatch3r-code-standards.md +23 -47
  140. package/{rules → dist/content/rules}/hatch3r-code-standards.mdc +22 -46
  141. package/{rules → dist/content/rules}/hatch3r-component-conventions.md +4 -1
  142. package/{rules → dist/content/rules}/hatch3r-component-conventions.mdc +3 -0
  143. package/{rules → dist/content/rules}/hatch3r-container-hardening.md +13 -3
  144. package/{rules → dist/content/rules}/hatch3r-container-hardening.mdc +10 -1
  145. package/{rules → dist/content/rules}/hatch3r-contract-testing.md +3 -1
  146. package/{rules → dist/content/rules}/hatch3r-contract-testing.mdc +1 -0
  147. package/dist/content/rules/hatch3r-cost-visibility.md +135 -0
  148. package/dist/content/rules/hatch3r-cost-visibility.mdc +135 -0
  149. package/dist/content/rules/hatch3r-cq-rule-frame.md +54 -0
  150. package/dist/content/rules/hatch3r-cq-rule-frame.mdc +49 -0
  151. package/{rules → dist/content/rules}/hatch3r-data-classification.md +5 -2
  152. package/{rules → dist/content/rules}/hatch3r-data-classification.mdc +3 -1
  153. package/{rules → dist/content/rules}/hatch3r-deep-context.md +14 -14
  154. package/{rules → dist/content/rules}/hatch3r-deep-context.mdc +13 -13
  155. package/{rules → dist/content/rules}/hatch3r-dependency-management.md +18 -4
  156. package/{rules → dist/content/rules}/hatch3r-dependency-management.mdc +16 -3
  157. package/{rules → dist/content/rules}/hatch3r-design-system-detection.md +4 -2
  158. package/{rules → dist/content/rules}/hatch3r-design-system-detection.mdc +1 -0
  159. package/dist/content/rules/hatch3r-dotnet-patterns.md +104 -0
  160. package/dist/content/rules/hatch3r-dotnet-patterns.mdc +99 -0
  161. package/dist/content/rules/hatch3r-edge-case-discipline.md +65 -0
  162. package/dist/content/rules/hatch3r-edge-case-discipline.mdc +65 -0
  163. package/dist/content/rules/hatch3r-enhancability.md +147 -0
  164. package/dist/content/rules/hatch3r-enhancability.mdc +142 -0
  165. package/{rules → dist/content/rules}/hatch3r-event-schema-evolution.md +3 -1
  166. package/{rules → dist/content/rules}/hatch3r-event-schema-evolution.mdc +1 -0
  167. package/dist/content/rules/hatch3r-fan-out-discipline.md +91 -0
  168. package/dist/content/rules/hatch3r-fan-out-discipline.mdc +91 -0
  169. package/{rules → dist/content/rules}/hatch3r-feature-flags.md +2 -0
  170. package/{rules → dist/content/rules}/hatch3r-feature-flags.mdc +2 -0
  171. package/dist/content/rules/hatch3r-flutter-patterns.md +88 -0
  172. package/dist/content/rules/hatch3r-flutter-patterns.mdc +83 -0
  173. package/{rules → dist/content/rules}/hatch3r-git-conventions.md +5 -2
  174. package/{rules → dist/content/rules}/hatch3r-git-conventions.mdc +2 -0
  175. package/dist/content/rules/hatch3r-go-patterns.md +98 -0
  176. package/dist/content/rules/hatch3r-go-patterns.mdc +93 -0
  177. package/{rules → dist/content/rules}/hatch3r-handoff-readiness.md +14 -4
  178. package/{rules → dist/content/rules}/hatch3r-handoff-readiness.mdc +13 -3
  179. package/{rules → dist/content/rules}/hatch3r-i18n.md +3 -1
  180. package/{rules → dist/content/rules}/hatch3r-i18n.mdc +2 -0
  181. package/dist/content/rules/hatch3r-iteration-summary.md +108 -0
  182. package/dist/content/rules/hatch3r-iteration-summary.mdc +108 -0
  183. package/dist/content/rules/hatch3r-learning-system.md +202 -0
  184. package/dist/content/rules/hatch3r-learning-system.mdc +202 -0
  185. package/dist/content/rules/hatch3r-maintainability.md +157 -0
  186. package/dist/content/rules/hatch3r-maintainability.mdc +152 -0
  187. package/{rules → dist/content/rules}/hatch3r-migrations.md +4 -2
  188. package/{rules → dist/content/rules}/hatch3r-migrations.mdc +1 -0
  189. package/{rules → dist/content/rules}/hatch3r-observability-logging.md +2 -1
  190. package/{rules → dist/content/rules}/hatch3r-observability-logging.mdc +1 -0
  191. package/{rules → dist/content/rules}/hatch3r-observability-metrics.md +2 -1
  192. package/{rules → dist/content/rules}/hatch3r-observability-metrics.mdc +1 -0
  193. package/{rules → dist/content/rules}/hatch3r-observability-tracing.md +46 -36
  194. package/{rules → dist/content/rules}/hatch3r-observability-tracing.mdc +45 -35
  195. package/{rules → dist/content/rules}/hatch3r-operability.md +3 -1
  196. package/{rules → dist/content/rules}/hatch3r-operability.mdc +1 -0
  197. package/{rules → dist/content/rules}/hatch3r-passkey-server.md +4 -2
  198. package/{rules → dist/content/rules}/hatch3r-passkey-server.mdc +1 -0
  199. package/{rules → dist/content/rules}/hatch3r-performance-budgets.md +3 -1
  200. package/{rules → dist/content/rules}/hatch3r-performance-budgets.mdc +3 -1
  201. package/dist/content/rules/hatch3r-php-laravel-patterns.md +109 -0
  202. package/dist/content/rules/hatch3r-php-laravel-patterns.mdc +104 -0
  203. package/{rules → dist/content/rules}/hatch3r-progressive-delivery.md +5 -1
  204. package/{rules → dist/content/rules}/hatch3r-progressive-delivery.mdc +3 -0
  205. package/dist/content/rules/hatch3r-proof-model.md +131 -0
  206. package/dist/content/rules/hatch3r-proof-model.mdc +131 -0
  207. package/dist/content/rules/hatch3r-python-patterns.md +70 -0
  208. package/dist/content/rules/hatch3r-python-patterns.mdc +65 -0
  209. package/dist/content/rules/hatch3r-react-native-patterns.md +83 -0
  210. package/dist/content/rules/hatch3r-react-native-patterns.mdc +78 -0
  211. package/{rules → dist/content/rules}/hatch3r-resilience-patterns.md +3 -1
  212. package/{rules → dist/content/rules}/hatch3r-resilience-patterns.mdc +1 -0
  213. package/dist/content/rules/hatch3r-reviewer-calibration.md +84 -0
  214. package/dist/content/rules/hatch3r-reviewer-calibration.mdc +84 -0
  215. package/dist/content/rules/hatch3r-right-sizing.md +68 -0
  216. package/dist/content/rules/hatch3r-right-sizing.mdc +66 -0
  217. package/dist/content/rules/hatch3r-ruby-rails-patterns.md +111 -0
  218. package/dist/content/rules/hatch3r-ruby-rails-patterns.mdc +106 -0
  219. package/dist/content/rules/hatch3r-rust-patterns.md +107 -0
  220. package/dist/content/rules/hatch3r-rust-patterns.mdc +102 -0
  221. package/dist/content/rules/hatch3r-scalability.md +137 -0
  222. package/dist/content/rules/hatch3r-scalability.mdc +132 -0
  223. package/{rules → dist/content/rules}/hatch3r-secrets-management.md +12 -2
  224. package/{rules → dist/content/rules}/hatch3r-secrets-management.mdc +9 -0
  225. package/{rules → dist/content/rules}/hatch3r-security-patterns.md +38 -35
  226. package/{rules → dist/content/rules}/hatch3r-security-patterns.mdc +36 -34
  227. package/dist/content/rules/hatch3r-security.md +97 -0
  228. package/dist/content/rules/hatch3r-security.mdc +92 -0
  229. package/dist/content/rules/hatch3r-swiftui-patterns.md +98 -0
  230. package/dist/content/rules/hatch3r-swiftui-patterns.mdc +93 -0
  231. package/dist/content/rules/hatch3r-testability.md +115 -0
  232. package/dist/content/rules/hatch3r-testability.mdc +110 -0
  233. package/{rules → dist/content/rules}/hatch3r-testing.md +6 -2
  234. package/{rules → dist/content/rules}/hatch3r-testing.mdc +3 -0
  235. package/{rules → dist/content/rules}/hatch3r-theming.md +3 -1
  236. package/{rules → dist/content/rules}/hatch3r-theming.mdc +2 -0
  237. package/dist/content/rules/hatch3r-tool-currency.md +91 -0
  238. package/dist/content/rules/hatch3r-tool-currency.mdc +86 -0
  239. package/{rules → dist/content/rules}/hatch3r-tooling-hierarchy.md +30 -32
  240. package/{rules → dist/content/rules}/hatch3r-tooling-hierarchy.mdc +28 -31
  241. package/dist/content/rules/hatch3r-typescript-patterns.md +58 -0
  242. package/dist/content/rules/hatch3r-typescript-patterns.mdc +53 -0
  243. package/{rules → dist/content/rules}/hatch3r-ux-states-and-flows.md +13 -5
  244. package/{rules → dist/content/rules}/hatch3r-ux-states-and-flows.mdc +10 -3
  245. package/{skills → dist/content/skills}/hatch3r-a11y-audit/SKILL.md +11 -9
  246. package/{skills → dist/content/skills}/hatch3r-a11y-audit/references/manual-audit-checklist.md +7 -5
  247. package/dist/content/skills/hatch3r-adhoc-orchestrate/SKILL.md +131 -0
  248. package/{skills → dist/content/skills}/hatch3r-ai-feature/SKILL.md +4 -6
  249. package/{skills → dist/content/skills}/hatch3r-api-spec/SKILL.md +27 -2
  250. package/{skills → dist/content/skills}/hatch3r-architecture-review/SKILL.md +5 -8
  251. package/{commands/hatch3r-board-groom.md → dist/content/skills/hatch3r-board-groom/SKILL.md} +16 -18
  252. package/{commands/hatch3r-board-init.md → dist/content/skills/hatch3r-board-init/SKILL.md} +34 -31
  253. package/{commands/hatch3r-board-refresh.md → dist/content/skills/hatch3r-board-refresh/SKILL.md} +17 -19
  254. package/{commands/hatch3r-board-shared.md → dist/content/skills/hatch3r-board-shared/SKILL.md} +45 -15
  255. package/dist/content/skills/hatch3r-browser-verify/SKILL.md +307 -0
  256. package/{skills → dist/content/skills}/hatch3r-bug-fix/SKILL.md +16 -3
  257. package/{skills → dist/content/skills}/hatch3r-ci-pipeline/SKILL.md +17 -7
  258. package/{skills → dist/content/skills}/hatch3r-cli-fd/SKILL.md +34 -2
  259. package/{skills → dist/content/skills}/hatch3r-cli-fzf/SKILL.md +34 -2
  260. package/dist/content/skills/hatch3r-cli-gh/SKILL.md +139 -0
  261. package/{skills → dist/content/skills}/hatch3r-cli-jq/SKILL.md +43 -9
  262. package/{skills → dist/content/skills}/hatch3r-cli-ripgrep/SKILL.md +36 -4
  263. package/dist/content/skills/hatch3r-cli-toolbox/SKILL.md +376 -0
  264. package/dist/content/skills/hatch3r-containerize/SKILL.md +157 -0
  265. package/{skills → dist/content/skills}/hatch3r-context-health/SKILL.md +27 -9
  266. package/dist/content/skills/hatch3r-cost-tracking/SKILL.md +164 -0
  267. package/{skills → dist/content/skills}/hatch3r-customize/SKILL.md +9 -13
  268. package/{skills → dist/content/skills}/hatch3r-dep-audit/SKILL.md +29 -9
  269. package/{skills → dist/content/skills}/hatch3r-design-system-detect/SKILL.md +4 -8
  270. package/dist/content/skills/hatch3r-docs-writing/SKILL.md +159 -0
  271. package/dist/content/skills/hatch3r-enhancability-verify/SKILL.md +152 -0
  272. package/{skills → dist/content/skills}/hatch3r-feature/SKILL.md +54 -4
  273. package/dist/content/skills/hatch3r-feedback/SKILL.md +103 -0
  274. package/{skills → dist/content/skills}/hatch3r-gh-agentic-workflows/SKILL.md +14 -12
  275. package/{skills → dist/content/skills}/hatch3r-gh-agentic-workflows/references/azure-devops.md +2 -2
  276. package/{skills → dist/content/skills}/hatch3r-gh-agentic-workflows/references/gitlab-ci.md +1 -1
  277. package/{skills → dist/content/skills}/hatch3r-handoff-prepare/SKILL.md +12 -15
  278. package/{skills → dist/content/skills}/hatch3r-handoff-resume/SKILL.md +5 -8
  279. package/{commands/hatch3r-hooks.md → dist/content/skills/hatch3r-hooks/SKILL.md} +59 -148
  280. package/dist/content/skills/hatch3r-incident-response/SKILL.md +174 -0
  281. package/{skills → dist/content/skills}/hatch3r-issue-workflow/SKILL.md +15 -4
  282. package/dist/content/skills/hatch3r-learn/SKILL.md +317 -0
  283. package/{skills → dist/content/skills}/hatch3r-logical-refactor/SKILL.md +6 -7
  284. package/dist/content/skills/hatch3r-maintainability-verify/SKILL.md +146 -0
  285. package/{skills → dist/content/skills}/hatch3r-migration/SKILL.md +9 -8
  286. package/{skills → dist/content/skills}/hatch3r-observability-verify/SKILL.md +17 -13
  287. package/{skills → dist/content/skills}/hatch3r-perf-audit/SKILL.md +14 -10
  288. package/{skills → dist/content/skills}/hatch3r-pr-creation/SKILL.md +8 -11
  289. package/{skills → dist/content/skills}/hatch3r-qa-validation/SKILL.md +8 -7
  290. package/dist/content/skills/hatch3r-recipe/SKILL.md +174 -0
  291. package/{skills → dist/content/skills}/hatch3r-refactor/SKILL.md +7 -8
  292. package/dist/content/skills/hatch3r-release/SKILL.md +265 -0
  293. package/{skills → dist/content/skills}/hatch3r-reliability-verify/SKILL.md +9 -5
  294. package/{commands/hatch3r-report.md → dist/content/skills/hatch3r-report/SKILL.md} +21 -18
  295. package/dist/content/skills/hatch3r-scalability-verify/SKILL.md +145 -0
  296. package/dist/content/skills/hatch3r-security-verify/SKILL.md +144 -0
  297. package/dist/content/skills/hatch3r-team-convention-author/SKILL.md +126 -0
  298. package/dist/content/skills/hatch3r-testability-verify/SKILL.md +147 -0
  299. package/{skills → dist/content/skills}/hatch3r-ui-ux-verify/SKILL.md +20 -12
  300. package/{skills → dist/content/skills}/hatch3r-visual-refactor/SKILL.md +12 -8
  301. package/package.json +53 -46
  302. package/agents/hatch3r-a11y-auditor.md +0 -159
  303. package/agents/hatch3r-dependency-auditor.md +0 -219
  304. package/agents/hatch3r-implementer.md +0 -278
  305. package/agents/hatch3r-learnings-loader.md +0 -343
  306. package/agents/hatch3r-perf-profiler.md +0 -166
  307. package/agents/hatch3r-reviewer.md +0 -314
  308. package/agents/hatch3r-security-auditor.md +0 -180
  309. package/agents/hatch3r-test-writer.md +0 -171
  310. package/agents/shared/user-question-protocol.md +0 -95
  311. package/commands/hatch3r-agent-customize.md +0 -201
  312. package/commands/hatch3r-command-customize.md +0 -113
  313. package/commands/hatch3r-context-health.md +0 -147
  314. package/commands/hatch3r-cost-tracking.md +0 -163
  315. package/commands/hatch3r-dep-audit.md +0 -188
  316. package/commands/hatch3r-handoff.md +0 -133
  317. package/commands/hatch3r-learn.md +0 -312
  318. package/commands/hatch3r-recipe.md +0 -194
  319. package/commands/hatch3r-release.md +0 -350
  320. package/commands/hatch3r-rule-customize.md +0 -133
  321. package/commands/hatch3r-skill-customize.md +0 -112
  322. package/commands/hatch3r-workflow.md +0 -504
  323. package/dist/cli/index.d.ts +0 -2
  324. package/dist/cli/index.js.map +0 -1
  325. package/github-agents/hatch3r-lint-agent.md +0 -46
  326. package/prompts/hatch3r-bug-triage.md +0 -158
  327. package/prompts/hatch3r-code-review.md +0 -134
  328. package/prompts/hatch3r-pr-description.md +0 -176
  329. package/rules/hatch3r-agent-orchestration-detail.md +0 -211
  330. package/rules/hatch3r-agent-orchestration-detail.mdc +0 -206
  331. package/rules/hatch3r-agent-orchestration.md +0 -376
  332. package/rules/hatch3r-agent-orchestration.mdc +0 -371
  333. package/rules/hatch3r-iteration-summary.md +0 -90
  334. package/rules/hatch3r-iteration-summary.mdc +0 -85
  335. package/rules/hatch3r-learning-consult.md +0 -42
  336. package/rules/hatch3r-learning-consult.mdc +0 -38
  337. package/rules/hatch3r-observability-tracing-detail.md +0 -20
  338. package/rules/hatch3r-observability-tracing-detail.mdc +0 -14
  339. package/rules/hatch3r-observability.md +0 -20
  340. package/rules/hatch3r-observability.mdc +0 -14
  341. package/skills/hatch3r-agent-customize/SKILL.md +0 -23
  342. package/skills/hatch3r-cli-aichat/SKILL.md +0 -84
  343. package/skills/hatch3r-cli-ast-grep/SKILL.md +0 -85
  344. package/skills/hatch3r-cli-az-devops/SKILL.md +0 -89
  345. package/skills/hatch3r-cli-bat/SKILL.md +0 -85
  346. package/skills/hatch3r-cli-comby/SKILL.md +0 -85
  347. package/skills/hatch3r-cli-csvkit/SKILL.md +0 -84
  348. package/skills/hatch3r-cli-delta/SKILL.md +0 -86
  349. package/skills/hatch3r-cli-difftastic/SKILL.md +0 -84
  350. package/skills/hatch3r-cli-docker/SKILL.md +0 -89
  351. package/skills/hatch3r-cli-duckdb/SKILL.md +0 -84
  352. package/skills/hatch3r-cli-gh/SKILL.md +0 -90
  353. package/skills/hatch3r-cli-glab/SKILL.md +0 -89
  354. package/skills/hatch3r-cli-lazygit/SKILL.md +0 -78
  355. package/skills/hatch3r-cli-llm/SKILL.md +0 -84
  356. package/skills/hatch3r-cli-miller/SKILL.md +0 -84
  357. package/skills/hatch3r-cli-mods/SKILL.md +0 -84
  358. package/skills/hatch3r-cli-overview/SKILL.md +0 -60
  359. package/skills/hatch3r-cli-playwright/SKILL.md +0 -89
  360. package/skills/hatch3r-cli-podman/SKILL.md +0 -84
  361. package/skills/hatch3r-cli-qsv/SKILL.md +0 -91
  362. package/skills/hatch3r-cli-rtk/SKILL.md +0 -91
  363. package/skills/hatch3r-cli-sd/SKILL.md +0 -85
  364. package/skills/hatch3r-cli-stagehand/SKILL.md +0 -111
  365. package/skills/hatch3r-cli-taplo/SKILL.md +0 -84
  366. package/skills/hatch3r-cli-yq/SKILL.md +0 -85
  367. package/skills/hatch3r-cli-zstd/SKILL.md +0 -85
  368. package/skills/hatch3r-command-customize/SKILL.md +0 -23
  369. package/skills/hatch3r-cost-tracking/SKILL.md +0 -92
  370. package/skills/hatch3r-incident-response/SKILL.md +0 -115
  371. package/skills/hatch3r-recipe/SKILL.md +0 -91
  372. package/skills/hatch3r-release/SKILL.md +0 -120
  373. package/skills/hatch3r-rule-customize/SKILL.md +0 -23
  374. package/skills/hatch3r-skill-customize/SKILL.md +0 -23
  375. /package/{agents → dist/content/agents}/modes/architecture.md +0 -0
  376. /package/{agents → dist/content/agents}/modes/boundary-analysis.md +0 -0
  377. /package/{agents → dist/content/agents}/modes/codebase-impact.md +0 -0
  378. /package/{agents → dist/content/agents}/modes/complexity-risk.md +0 -0
  379. /package/{agents → dist/content/agents}/modes/coverage-analysis.md +0 -0
  380. /package/{agents → dist/content/agents}/modes/current-state.md +0 -0
  381. /package/{agents → dist/content/agents}/modes/feature-design.md +0 -0
  382. /package/{agents → dist/content/agents}/modes/impact-analysis.md +0 -0
  383. /package/{agents → dist/content/agents}/modes/library-docs.md +0 -0
  384. /package/{agents → dist/content/agents}/modes/migration-path.md +0 -0
  385. /package/{agents → dist/content/agents}/modes/prior-art.md +0 -0
  386. /package/{agents → dist/content/agents}/modes/refactoring-strategy.md +0 -0
  387. /package/{agents → dist/content/agents}/modes/regression.md +0 -0
  388. /package/{agents → dist/content/agents}/modes/risk-assessment.md +0 -0
  389. /package/{agents → dist/content/agents}/modes/risk-prioritization.md +0 -0
  390. /package/{agents → dist/content/agents}/modes/root-cause.md +0 -0
  391. /package/{agents → dist/content/agents}/modes/similar-implementation.md +0 -0
  392. /package/{agents → dist/content/agents}/modes/symptom-trace.md +0 -0
  393. /package/{agents → dist/content/agents}/modes/test-pattern.md +0 -0
  394. /package/{commands → dist/content/commands}/board/shared-board-overview.md +0 -0
  395. /package/{commands → dist/content/commands}/revision/revision-board-integration.md +0 -0
  396. /package/{skills → dist/content/skills}/hatch3r-issue-workflow/references/delegation-patterns.md +0 -0
@@ -0,0 +1,157 @@
1
+ ---
2
+ id: hatch3r-maintainability-rule
3
+ type: rule
4
+ description: CQ8 Maintainability Quality measurement rule — jscpd duplication index, pattern-reuse ratio, cyclomatic complexity, expand-contract migrations, API breaking-change discipline, ADR presence on architectural changes
5
+ scope: conditional
6
+ globs: "src/**,**/migrations/**,**/db/migrations/**,**/prisma/migrations/**,**/openapi.yaml,**/openapi.json,**/*.proto,**/schema.graphql,**/asyncapi.yaml"
7
+ tags: [review, maintainability, code-standards, floor:content-quality]
8
+ precedence: high
9
+ quality_charter: agents/shared/quality-charter.md
10
+ cache_friendly: true
11
+ ---
12
+ # Maintainability Quality (CQ8)
13
+
14
+ **Pillars:** P4 (Comprehensive Lean Coverage), CQ8 (Maintainability Quality)
15
+
16
+ ## Scope
17
+
18
+ This rule binds the CQ8 measurement set across end-user code that hatch3r-generated agents produce AND the framework's own source tree. It owns:
19
+
20
+ - The jscpd duplication-index ceiling.
21
+ - The pattern-reuse ratio floor.
22
+ - The cyclomatic-complexity per-function ceiling.
23
+ - The expand-contract migration conformance gate.
24
+ - The API breaking-change discipline on stable endpoints.
25
+ - ADR presence on architectural-decision-class changes.
26
+ - Specialist routing to `agents/hatch3r-maintainability.md`.
27
+
28
+ This complements (does not duplicate) `rules/hatch3r-anti-duplication.md` (the pre-implementation discovery gate). Anti-duplication is the discipline; this rule owns the measurement set + thresholds + specialist routing.
29
+
30
+ ## CQ8 Threshold Set
31
+
32
+ Source: pillar CQ8 (see `agents/shared/principles.md`). Every threshold below is measurable per audit cycle.
33
+
34
+ | Threshold | Target | Measurement source |
35
+ |-----------|--------|--------------------|
36
+ | jscpd duplication index | ≤5% per cycle | `npx jscpd --min-tokens 50 --min-lines 5 src/` JSON report |
37
+ | Pattern-reuse ratio (reused / newly-authored) | ≥70% | Diff grep against named patterns (circuit breaker, retry-with-jitter, error handler, idempotency-key handler) |
38
+ | Cyclomatic complexity per function | ≤10 | ESLint `complexity` rule (JS/TS), radon (Python), lizard (polyglot) |
39
+ | Documentation currency on user-facing API surfaces | ≤180 days | Last-modified timestamp on doc files; vs API surface diff |
40
+ | Expand-contract migration conformance | 100% | Per `rules/hatch3r-migrations.md` — expand → migrate → contract phases |
41
+ | API breaking-change events on stable endpoints | 0 per release | `oasdiff` (OpenAPI), `buf breaking` (protobuf), `graphql-inspector diff` (GraphQL SDL) |
42
+ | ADR presence on architectural-decision-class changes | 100% | Nygard-format ADR with one of {Proposed, Accepted, Superseded, Deprecated} |
43
+
44
+ ## Duplication Scan
45
+
46
+ Run `npx jscpd` against in-scope directories every cycle and surface the JSON report path in the finding. The duplication-index is the percentage of duplicated tokens over total tokens — not the percentage of duplicated lines. Configure the scan via `.jscpd.json` with:
47
+
48
+ - `min-tokens: 50`
49
+ - `min-lines: 5`
50
+ - `ignore: ["**/__tests__/**", "**/node_modules/**", "**/dist/**", "**/build/**"]`
51
+ - `reporters: ["json", "console"]`
52
+
53
+ Critical-path duplication (auth, payment, settlement, ledger) is escalated regardless of the global index — even <5% global can hide a duplicated security-critical helper.
54
+
55
+ ## Pattern-Reuse Ratio
56
+
57
+ Count reused vs newly-authored patterns per diff:
58
+
59
+ - **Reused** — code references a named existing module (e.g. `import { withCircuitBreaker } from '@/lib/resilience'`).
60
+ - **Newly-authored** — code introduces a new pattern that overlaps with an existing one.
61
+
62
+ Ratio target: ≥70% reused. Per cycle, list the named patterns with their canonical file path:
63
+
64
+ | Pattern | Canonical location |
65
+ |---------|--------------------|
66
+ | Circuit breaker | `src/lib/resilience/circuitBreaker.ts` (or project equivalent) |
67
+ | Retry with decorrelated jitter | `src/lib/resilience/retryWithBackoff.ts` |
68
+ | Error handler / RFC 9457 problem details | `src/lib/errors/problemDetails.ts` |
69
+ | Idempotency-Key handler | `src/lib/middleware/idempotencyKey.ts` |
70
+
71
+ Authoring a fifth circuit-breaker implementation in `src/auth/jwt.ts` is a CQ8 violation regardless of unit-test quality.
72
+
73
+ ## Cyclomatic Complexity
74
+
75
+ Per function, complexity ≤10 (McCabe). Configure linter rules:
76
+
77
+ - **JS/TS:** ESLint `complexity: ['error', 10]`.
78
+ - **Python:** `radon cc -s -n B` (block B threshold = 6-10).
79
+ - **JVM:** detekt `ComplexMethod: threshold=10`, ktlint, or Checkstyle `CyclomaticComplexity max=10`.
80
+ - **Go:** `gocyclo -over 10 ./...`.
81
+ - **Rust:** `cargo clippy -- -W clippy::cognitive_complexity`.
82
+
83
+ Functions above the threshold MUST be refactored before merge unless an explicit exception is documented in an ADR (see ADR Presence below).
84
+
85
+ ## Expand-Contract Migrations
86
+
87
+ Source: `rules/hatch3r-migrations.md`. Schema migrations on shared databases (multi-deploy environments) follow the three-phase pattern:
88
+
89
+ 1. **Expand** — add the new column/table/index in a backward-compatible way. Old code keeps working.
90
+ 2. **Migrate** — backfill data; deploy code that writes to both old + new locations or reads from both.
91
+ 3. **Contract** — remove the old column/table/index after the migrate phase is verified.
92
+
93
+ Destructive single-deploy schema changes (drop column, rename column without alias, alter type without conversion) are CRITICAL findings. The specialist names the missing phase in the finding.
94
+
95
+ ## API Breaking-Change Discipline
96
+
97
+ On stable endpoints (versioned `v1`, `v2`; or unversioned with public-consumer commitment), zero breaking changes per release. Run the per-spec diff tool in CI:
98
+
99
+ - **OpenAPI 3.x:** `oasdiff breaking --fail-on-diff` exits non-zero on breaks.
100
+ - **Protobuf:** `buf breaking --against '.git#branch=main'` exits non-zero.
101
+ - **GraphQL SDL:** `graphql-inspector diff schema.graphql https://api/graphql --rule considerUsage`.
102
+
103
+ A breaking change requires a major-version bump per semver 2.0.0 (semver.org). Bypass requires a documented deprecation timeline per `rules/hatch3r-api-versioning.md` — `Deprecation` (RFC 9745) + `Sunset` (RFC 8594) headers + migration guide.
104
+
105
+ ## ADR Presence
106
+
107
+ Architectural-decision-class changes per `rules/hatch3r-code-standards.md` ADR-trigger list require a Nygard-format ADR with status one of {Proposed, Accepted, Superseded, Deprecated}. Triggers:
108
+
109
+ - New external dependency (npm package, system tool, managed service).
110
+ - Cross-module API change (public interface, exported types, plugin contract).
111
+ - Performance trade-off requiring documentation (caching strategy, batch size, partition scheme).
112
+ - Security trade-off requiring documentation (auth flow choice, token TTL, encryption algorithm).
113
+
114
+ ADRs live under `docs/adr/NNNN-{slug}.md` (or project equivalent) and are linked from the PR description.
115
+
116
+ ## Specialist Agent Routing
117
+
118
+ | Trigger | Route to |
119
+ |---------|----------|
120
+ | Any code mutation | `agents/hatch3r-maintainability.md` (post-write duplication + complexity scan) |
121
+ | Schema or migration file modified | `agents/hatch3r-maintainability.md` (expand-contract conformance) |
122
+ | API spec (OpenAPI / GraphQL SDL / protobuf / AsyncAPI) modified | `agents/hatch3r-maintainability.md` (breaking-change diff) |
123
+ | Architectural decision per ADR-trigger list | `agents/hatch3r-maintainability.md` (ADR presence audit) |
124
+ | Pre-write duplication scan during Implementer phase | `agents/hatch3r-maintainability.md` invoked by `agents/hatch3r-implementer.md` post-write |
125
+ | Release-prep audit | `agents/hatch3r-maintainability.md` |
126
+
127
+ ## Per-Finding Output Format
128
+
129
+ Every finding emitted under this rule uses the CQ per-finding rigor-field schema per `rules/hatch3r-cq-rule-frame.md` → Per-Finding Output Format (rigor-contract fields per `agents/shared/rigor-contract.md`), with `<N>` = CQ8. The `proof_trace` excerpt is the file:line citation + jscpd/oasdiff/buf-breaking output for the threshold that produced the finding.
130
+
131
+ ## Severity Mapping
132
+
133
+ The Specialist-Status to canonical-severity map (`CRITICAL` → Critical, `FINDINGS` → High + Medium, `PASS` → Low + Info) is the shared CQ frame per `rules/hatch3r-cq-rule-frame.md` → Specialist-Status to Canonical-Severity Map, sourced from `agents/shared/severity-mapping.md`. CQ8 Action per status:
134
+
135
+ - `CRITICAL`: Destructive single-deploy migration; breaking change on stable endpoint without major-version bump; missing ADR on decision-class change.
136
+ - `FINDINGS`: Duplication-index >5%; pattern-reuse ratio <70%; cyclomatic complexity >10; documentation staleness >180 days.
137
+ - `PASS`: All thresholds met; surface in iteration summary.
138
+
139
+ ## When to Invoke
140
+
141
+ - Every PR that mutates code, schema, or API spec.
142
+ - `agents/hatch3r-implementer.md` invokes this rule's checks post-write to scan its own diff for duplication before declaring completion (anti-duplication procedure per `agents/shared/quality-charter.md` §12).
143
+ - Pre-merge full CQ8 gate — duplication + complexity + pattern-reuse + migration + API-breaking + ADR-presence.
144
+ - Schema-change audits — any migration file triggers an expand-contract conformance scan.
145
+ - API-change audits — any diff touching `openapi.yaml`, `openapi.json`, `*.proto`, or GraphQL SDL triggers the breaking-change CI gate.
146
+ - Release-prep audit before publishing.
147
+
148
+ ## References
149
+
150
+ - Pillar CQ8 (measurement set + specialist owner; see `agents/shared/principles.md`).
151
+ - The prompt-engineering and compound-system audit domains (maintainability domains).
152
+ - `agents/hatch3r-maintainability.md` (CQ8 reviewer / gate).
153
+ - `rules/hatch3r-anti-duplication.md` (pre-implementation discovery gate).
154
+ - `rules/hatch3r-migrations.md` (expand-contract migration pattern).
155
+ - `rules/hatch3r-api-versioning.md` (semver + deprecation + sunset policy).
156
+ - `rules/hatch3r-code-standards.md` (ADR-trigger list).
157
+ - `rules/hatch3r-resilience-patterns.md` (named patterns for the reuse ratio).
@@ -0,0 +1,152 @@
1
+ ---
2
+ description: CQ8 Maintainability Quality measurement rule — jscpd duplication index, pattern-reuse ratio, cyclomatic complexity, expand-contract migrations, API breaking-change discipline, ADR presence on architectural changes
3
+ globs: ["src/**", "**/migrations/**", "**/db/migrations/**", "**/prisma/migrations/**", "**/openapi.yaml", "**/openapi.json", "**/*.proto", "**/schema.graphql", "**/asyncapi.yaml"]
4
+ alwaysApply: false
5
+ precedence: high
6
+ ---
7
+ # Maintainability Quality (CQ8)
8
+
9
+ **Pillars:** P4 (Comprehensive Lean Coverage), CQ8 (Maintainability Quality)
10
+
11
+ ## Scope
12
+
13
+ This rule binds the CQ8 measurement set across end-user code that hatch3r-generated agents produce AND the framework's own source tree. It owns:
14
+
15
+ - The jscpd duplication-index ceiling.
16
+ - The pattern-reuse ratio floor.
17
+ - The cyclomatic-complexity per-function ceiling.
18
+ - The expand-contract migration conformance gate.
19
+ - The API breaking-change discipline on stable endpoints.
20
+ - ADR presence on architectural-decision-class changes.
21
+ - Specialist routing to `agents/hatch3r-maintainability.md`.
22
+
23
+ This complements (does not duplicate) `rules/hatch3r-anti-duplication.md` (the pre-implementation discovery gate). Anti-duplication is the discipline; this rule owns the measurement set + thresholds + specialist routing.
24
+
25
+ ## CQ8 Threshold Set
26
+
27
+ Source: pillar CQ8 (see `agents/shared/principles.md`). Every threshold below is measurable per audit cycle.
28
+
29
+ | Threshold | Target | Measurement source |
30
+ |-----------|--------|--------------------|
31
+ | jscpd duplication index | ≤5% per cycle | `npx jscpd --min-tokens 50 --min-lines 5 src/` JSON report |
32
+ | Pattern-reuse ratio (reused / newly-authored) | ≥70% | Diff grep against named patterns (circuit breaker, retry-with-jitter, error handler, idempotency-key handler) |
33
+ | Cyclomatic complexity per function | ≤10 | ESLint `complexity` rule (JS/TS), radon (Python), lizard (polyglot) |
34
+ | Documentation currency on user-facing API surfaces | ≤180 days | Last-modified timestamp on doc files; vs API surface diff |
35
+ | Expand-contract migration conformance | 100% | Per `rules/hatch3r-migrations.md` — expand → migrate → contract phases |
36
+ | API breaking-change events on stable endpoints | 0 per release | `oasdiff` (OpenAPI), `buf breaking` (protobuf), `graphql-inspector diff` (GraphQL SDL) |
37
+ | ADR presence on architectural-decision-class changes | 100% | Nygard-format ADR with one of {Proposed, Accepted, Superseded, Deprecated} |
38
+
39
+ ## Duplication Scan
40
+
41
+ Run `npx jscpd` against in-scope directories every cycle and surface the JSON report path in the finding. The duplication-index is the percentage of duplicated tokens over total tokens — not the percentage of duplicated lines. Configure the scan via `.jscpd.json` with:
42
+
43
+ - `min-tokens: 50`
44
+ - `min-lines: 5`
45
+ - `ignore: ["**/__tests__/**", "**/node_modules/**", "**/dist/**", "**/build/**"]`
46
+ - `reporters: ["json", "console"]`
47
+
48
+ Critical-path duplication (auth, payment, settlement, ledger) is escalated regardless of the global index — even <5% global can hide a duplicated security-critical helper.
49
+
50
+ ## Pattern-Reuse Ratio
51
+
52
+ Count reused vs newly-authored patterns per diff:
53
+
54
+ - **Reused** — code references a named existing module (e.g. `import { withCircuitBreaker } from '@/lib/resilience'`).
55
+ - **Newly-authored** — code introduces a new pattern that overlaps with an existing one.
56
+
57
+ Ratio target: ≥70% reused. Per cycle, list the named patterns with their canonical file path:
58
+
59
+ | Pattern | Canonical location |
60
+ |---------|--------------------|
61
+ | Circuit breaker | `src/lib/resilience/circuitBreaker.ts` (or project equivalent) |
62
+ | Retry with decorrelated jitter | `src/lib/resilience/retryWithBackoff.ts` |
63
+ | Error handler / RFC 9457 problem details | `src/lib/errors/problemDetails.ts` |
64
+ | Idempotency-Key handler | `src/lib/middleware/idempotencyKey.ts` |
65
+
66
+ Authoring a fifth circuit-breaker implementation in `src/auth/jwt.ts` is a CQ8 violation regardless of unit-test quality.
67
+
68
+ ## Cyclomatic Complexity
69
+
70
+ Per function, complexity ≤10 (McCabe). Configure linter rules:
71
+
72
+ - **JS/TS:** ESLint `complexity: ['error', 10]`.
73
+ - **Python:** `radon cc -s -n B` (block B threshold = 6-10).
74
+ - **JVM:** detekt `ComplexMethod: threshold=10`, ktlint, or Checkstyle `CyclomaticComplexity max=10`.
75
+ - **Go:** `gocyclo -over 10 ./...`.
76
+ - **Rust:** `cargo clippy -- -W clippy::cognitive_complexity`.
77
+
78
+ Functions above the threshold MUST be refactored before merge unless an explicit exception is documented in an ADR (see ADR Presence below).
79
+
80
+ ## Expand-Contract Migrations
81
+
82
+ Source: `rules/hatch3r-migrations.md`. Schema migrations on shared databases (multi-deploy environments) follow the three-phase pattern:
83
+
84
+ 1. **Expand** — add the new column/table/index in a backward-compatible way. Old code keeps working.
85
+ 2. **Migrate** — backfill data; deploy code that writes to both old + new locations or reads from both.
86
+ 3. **Contract** — remove the old column/table/index after the migrate phase is verified.
87
+
88
+ Destructive single-deploy schema changes (drop column, rename column without alias, alter type without conversion) are CRITICAL findings. The specialist names the missing phase in the finding.
89
+
90
+ ## API Breaking-Change Discipline
91
+
92
+ On stable endpoints (versioned `v1`, `v2`; or unversioned with public-consumer commitment), zero breaking changes per release. Run the per-spec diff tool in CI:
93
+
94
+ - **OpenAPI 3.x:** `oasdiff breaking --fail-on-diff` exits non-zero on breaks.
95
+ - **Protobuf:** `buf breaking --against '.git#branch=main'` exits non-zero.
96
+ - **GraphQL SDL:** `graphql-inspector diff schema.graphql https://api/graphql --rule considerUsage`.
97
+
98
+ A breaking change requires a major-version bump per semver 2.0.0 (semver.org). Bypass requires a documented deprecation timeline per `rules/hatch3r-api-versioning.md` — `Deprecation` (RFC 9745) + `Sunset` (RFC 8594) headers + migration guide.
99
+
100
+ ## ADR Presence
101
+
102
+ Architectural-decision-class changes per `rules/hatch3r-code-standards.md` ADR-trigger list require a Nygard-format ADR with status one of {Proposed, Accepted, Superseded, Deprecated}. Triggers:
103
+
104
+ - New external dependency (npm package, system tool, managed service).
105
+ - Cross-module API change (public interface, exported types, plugin contract).
106
+ - Performance trade-off requiring documentation (caching strategy, batch size, partition scheme).
107
+ - Security trade-off requiring documentation (auth flow choice, token TTL, encryption algorithm).
108
+
109
+ ADRs live under `docs/adr/NNNN-{slug}.md` (or project equivalent) and are linked from the PR description.
110
+
111
+ ## Specialist Agent Routing
112
+
113
+ | Trigger | Route to |
114
+ |---------|----------|
115
+ | Any code mutation | `agents/hatch3r-maintainability.md` (post-write duplication + complexity scan) |
116
+ | Schema or migration file modified | `agents/hatch3r-maintainability.md` (expand-contract conformance) |
117
+ | API spec (OpenAPI / GraphQL SDL / protobuf / AsyncAPI) modified | `agents/hatch3r-maintainability.md` (breaking-change diff) |
118
+ | Architectural decision per ADR-trigger list | `agents/hatch3r-maintainability.md` (ADR presence audit) |
119
+ | Pre-write duplication scan during Implementer phase | `agents/hatch3r-maintainability.md` invoked by `agents/hatch3r-implementer.md` post-write |
120
+ | Release-prep audit | `agents/hatch3r-maintainability.md` |
121
+
122
+ ## Per-Finding Output Format
123
+
124
+ Every finding emitted under this rule uses the CQ per-finding rigor-field schema per `rules/hatch3r-cq-rule-frame.md` → Per-Finding Output Format (rigor-contract fields per `agents/shared/rigor-contract.md`), with `<N>` = CQ8. The `proof_trace` excerpt is the file:line citation + jscpd/oasdiff/buf-breaking output for the threshold that produced the finding.
125
+
126
+ ## Severity Mapping
127
+
128
+ The Specialist-Status to canonical-severity map (`CRITICAL` → Critical, `FINDINGS` → High + Medium, `PASS` → Low + Info) is the shared CQ frame per `rules/hatch3r-cq-rule-frame.md` → Specialist-Status to Canonical-Severity Map, sourced from `agents/shared/severity-mapping.md`. CQ8 Action per status:
129
+
130
+ - `CRITICAL`: Destructive single-deploy migration; breaking change on stable endpoint without major-version bump; missing ADR on decision-class change.
131
+ - `FINDINGS`: Duplication-index >5%; pattern-reuse ratio <70%; cyclomatic complexity >10; documentation staleness >180 days.
132
+ - `PASS`: All thresholds met; surface in iteration summary.
133
+
134
+ ## When to Invoke
135
+
136
+ - Every PR that mutates code, schema, or API spec.
137
+ - `agents/hatch3r-implementer.md` invokes this rule's checks post-write to scan its own diff for duplication before declaring completion (anti-duplication procedure per `agents/shared/quality-charter.md` §12).
138
+ - Pre-merge full CQ8 gate — duplication + complexity + pattern-reuse + migration + API-breaking + ADR-presence.
139
+ - Schema-change audits — any migration file triggers an expand-contract conformance scan.
140
+ - API-change audits — any diff touching `openapi.yaml`, `openapi.json`, `*.proto`, or GraphQL SDL triggers the breaking-change CI gate.
141
+ - Release-prep audit before publishing.
142
+
143
+ ## References
144
+
145
+ - Pillar CQ8 (measurement set + specialist owner; see `agents/shared/principles.md`).
146
+ - The prompt-engineering and compound-system audit domains (maintainability domains).
147
+ - `agents/hatch3r-maintainability.md` (CQ8 reviewer / gate).
148
+ - `rules/hatch3r-anti-duplication.md` (pre-implementation discovery gate).
149
+ - `rules/hatch3r-migrations.md` (expand-contract migration pattern).
150
+ - `rules/hatch3r-api-versioning.md` (semver + deprecation + sunset policy).
151
+ - `rules/hatch3r-code-standards.md` (ADR-trigger list).
152
+ - `rules/hatch3r-resilience-patterns.md` (named patterns for the reuse ratio).
@@ -2,8 +2,10 @@
2
2
  id: hatch3r-migrations
3
3
  type: rule
4
4
  description: Database migration and schema change patterns — expand-contract, online DDL, backfills, compatibility windows, reversibility, multi-region, tooling
5
- scope: "**/migrations/**,**/*migration*,**/migrate/**,**/seeds/**,**/seeders/**,**/prisma/migrations/**,**/drizzle/**,**/knex/**"
6
- tags: [implementation, brownfield]
5
+ scope: conditional
6
+ globs: "**/migrations/**,**/*migration*,**/migrate/**,**/seeds/**,**/seeders/**,**/prisma/migrations/**,**/drizzle/**,**/knex/**"
7
+ tags: [implementation, ctx:brownfield-only]
8
+ precedence: high
7
9
  quality_charter: agents/shared/quality-charter.md
8
10
  cache_friendly: true
9
11
  ---
@@ -2,6 +2,7 @@
2
2
  description: Database migration and schema change patterns — expand-contract, online DDL, backfills, compatibility windows, reversibility, multi-region, tooling
3
3
  globs: ["**/migrations/**", "**/*migration*", "**/migrate/**", "**/seeds/**", "**/seeders/**", "**/prisma/migrations/**", "**/drizzle/**", "**/knex/**"]
4
4
  alwaysApply: false
5
+ precedence: high
5
6
  ---
6
7
  # Migrations
7
8
 
@@ -4,7 +4,8 @@ type: rule
4
4
  description: Structured logging and error reporting conventions for the project
5
5
  scope: conditional
6
6
  globs: "**/*log*,**/*logger*,**/*logging*,**/*error*,**/observability/**,**/routes/**,**/handlers/**,**/services/**,**/api/**,**/middleware/**,**/controllers/**,**/lib/**"
7
- tags: [devops]
7
+ tags: [devops, observability]
8
+ precedence: high
8
9
  quality_charter: agents/shared/quality-charter.md
9
10
  cache_friendly: true
10
11
  ---
@@ -2,6 +2,7 @@
2
2
  description: Structured logging and error reporting conventions for the project
3
3
  globs: ["**/*log*", "**/*logger*", "**/*logging*", "**/*error*", "**/observability/**", "**/routes/**", "**/handlers/**", "**/services/**", "**/api/**", "**/middleware/**", "**/controllers/**", "**/lib/**"]
4
4
  alwaysApply: false
5
+ precedence: high
5
6
  ---
6
7
  # Observability -- Logging & Error Reporting
7
8
 
@@ -4,7 +4,8 @@ type: rule
4
4
  description: Metrics, SLO/SLI definitions, alerting, and dashboard conventions for the project
5
5
  scope: conditional
6
6
  globs: "**/*metric*,**/*slo*,**/*sli*,**/*alert*,**/*dashboard*,**/observability/**,**/routes/**,**/handlers/**,**/services/**,**/api/**,**/middleware/**,**/controllers/**,**/lib/**"
7
- tags: [devops]
7
+ tags: [devops, observability]
8
+ precedence: high
8
9
  quality_charter: agents/shared/quality-charter.md
9
10
  cache_friendly: true
10
11
  ---
@@ -2,6 +2,7 @@
2
2
  description: Metrics, SLO/SLI definitions, alerting, and dashboard conventions for the project
3
3
  globs: ["**/*metric*", "**/*slo*", "**/*sli*", "**/*alert*", "**/*dashboard*", "**/observability/**", "**/routes/**", "**/handlers/**", "**/services/**", "**/api/**", "**/middleware/**", "**/controllers/**", "**/lib/**"]
4
4
  alwaysApply: false
5
+ precedence: high
5
6
  ---
6
7
  # Observability -- Metrics, SLOs & Alerting
7
8
 
@@ -4,7 +4,8 @@ type: rule
4
4
  description: Distributed tracing, OpenTelemetry conventions, and AI agent instrumentation for the project
5
5
  scope: conditional
6
6
  globs: "**/*trac*,**/*span*,**/*telemetry*,**/*otel*,**/*agent*,**/observability/**,**/routes/**,**/handlers/**,**/services/**,**/api/**,**/middleware/**,**/controllers/**,**/lib/**"
7
- tags: [devops]
7
+ tags: [devops, observability]
8
+ precedence: high
8
9
  quality_charter: agents/shared/quality-charter.md
9
10
  cache_friendly: true
10
11
  ---
@@ -34,7 +35,7 @@ Distributed tracing, OpenTelemetry semantic conventions, AI agent instrumentatio
34
35
 
35
36
  ## OpenTelemetry Semantic Conventions
36
37
 
37
- Follow the [OpenTelemetry Semantic Conventions](https://opentelemetry.io/docs/specs/semconv/) (v1.29+) for consistent attribute naming across all telemetry signals.
38
+ Follow the [OpenTelemetry Semantic Conventions](https://opentelemetry.io/docs/specs/semconv/) (v1.41.1) for consistent attribute naming across all telemetry signals.
38
39
 
39
40
  ### Standard Attribute Namespaces
40
41
 
@@ -84,43 +85,46 @@ Every telemetry-producing service must declare resource attributes at startup:
84
85
 
85
86
  ## AI Agent Instrumentation
86
87
 
87
- Follow the [OpenTelemetry GenAI Semantic Conventions](https://opentelemetry.io/docs/specs/semconv/gen-ai/) for AI/LLM agent instrumentation.
88
+ Follow the [OpenTelemetry GenAI Semantic Conventions](https://opentelemetry.io/docs/specs/semconv/gen-ai/) for AI/LLM agent instrumentation. The GenAI conventions are Development status — gate any opt-in alias emission on `OTEL_SEMCONV_STABILITY_OPT_IN` and re-check the spec each P3 currency cycle.
88
89
 
89
90
  ### GenAI Span Attributes
90
91
 
91
92
  Use these attributes on all spans representing interactions with generative AI models:
92
93
 
93
- | Attribute | Type | Description | Example |
94
- |-----------|------|-------------|---------|
95
- | `gen_ai.system` | string | GenAI provider system name | `openai`, `anthropic`, `azure_openai` |
96
- | `gen_ai.request.model` | string | Model name as specified in the request | `gpt-4o`, `claude-sonnet-4-20250514` |
97
- | `gen_ai.response.model` | string | Model name as returned in the response | `gpt-4o-2024-08-06` |
98
- | `gen_ai.request.max_tokens` | int | Maximum tokens requested for generation | `4096` |
99
- | `gen_ai.request.temperature` | float | Temperature parameter | `0.7` |
100
- | `gen_ai.response.finish_reasons` | string[] | Reasons the model stopped generating | `["stop"]`, `["length"]` |
101
- | `gen_ai.usage.input_tokens` | int | Tokens in the input/prompt | `1250` |
102
- | `gen_ai.usage.output_tokens` | int | Tokens in the generated output | `530` |
103
-
104
- - Always set `gen_ai.system` and `gen_ai.request.model` on every GenAI span.
105
- - Record `gen_ai.usage.input_tokens` and `gen_ai.usage.output_tokens` from the API response for cost dashboards.
94
+ | Attribute | Type | Requirement | Description | Example |
95
+ |-----------|------|-------------|-------------|---------|
96
+ | `gen_ai.operation.name` | string | Required | Operation kind: `chat`, `generate_content`, `embeddings`, `create_agent`, `invoke_agent`, `execute_tool` | `chat`, `invoke_agent` |
97
+ | `gen_ai.provider.name` | string | Required | GenAI provider name | `openai`, `anthropic`, `azure.ai.openai` |
98
+ | `gen_ai.request.model` | string | Required | Model name as specified in the request | `gpt-4o`, `claude-sonnet-4-20250514` |
99
+ | `gen_ai.response.model` | string | Recommended | Model name as returned in the response | `gpt-4o-2024-08-06` |
100
+ | `gen_ai.request.max_tokens` | int | Recommended | Maximum tokens requested for generation | `4096` |
101
+ | `gen_ai.request.temperature` | float | Recommended | Temperature parameter | `0.7` |
102
+ | `gen_ai.response.finish_reasons` | string[] | Recommended | Reasons the model stopped generating | `["stop"]`, `["length"]` |
103
+ | `gen_ai.usage.input_tokens` | int | Recommended | Tokens in the input/prompt | `1250` |
104
+ | `gen_ai.usage.output_tokens` | int | Recommended | Tokens in the generated output | `530` |
105
+
106
+ - Always set `gen_ai.operation.name`, `gen_ai.provider.name`, and `gen_ai.request.model` on every GenAI span.
107
+ - Record `gen_ai.usage.input_tokens` and `gen_ai.usage.output_tokens` from the API response for cost dashboards. `gen_ai.operation.name` + `gen_ai.provider.name` are the required label pair on GenAI metrics (`gen_ai.client.token.usage`, `gen_ai.client.operation.duration`).
106
108
  - Use `gen_ai.response.finish_reasons` to detect truncated outputs (`length`) and trigger re-prompting.
109
+ - **Migration (SemConv v1.37.0, 2025-07-05):** `gen_ai.system` is renamed to `gen_ai.provider.name`; emit the new key. Instrumentations bridging older collectors may dual-emit the legacy `gen_ai.system` alias only under `OTEL_SEMCONV_STABILITY_OPT_IN=gen_ai_latest_experimental`.
107
110
 
108
111
  ### Agent Invocation Spans
109
112
 
110
113
  Instrument the full lifecycle of an agent invocation with a dedicated span. This span is the parent for all LLM calls, tool executions, and sub-agent delegations.
111
114
 
112
- - **Span name pattern:** `agent.{agent_name}.invoke`
113
- - **Required attributes:** `agent.id`, `agent.name`, `agent.parent_id`, `agent.task`, `agent.framework`
115
+ - **Span name pattern:** `invoke_agent {gen_ai.agent.name}` (OTel GenAI agent span naming).
116
+ - **Required attributes:** `gen_ai.operation.name` = `invoke_agent`, `gen_ai.agent.id`, `gen_ai.agent.name`. Use `create_agent` for the agent-construction span.
117
+ - **Project-namespaced extras:** `app.agent.parent_id`, `app.agent.task` carry hatch3r-specific context the GenAI namespace does not define (prefix custom attributes per the Attribute Naming Guidelines above).
114
118
  - **Span events for state transitions:** `agent.planning`, `agent.tool_selection`, `agent.awaiting_human`, `agent.delegating`, `agent.completed`, `agent.error`
115
119
 
116
120
  ```typescript
117
- const agentSpan = tracer.startSpan('agent.code_reviewer.invoke', {
121
+ const agentSpan = tracer.startSpan('invoke_agent code_reviewer', {
118
122
  attributes: {
119
- 'agent.id': invocationId,
120
- 'agent.name': 'code_reviewer',
121
- 'agent.parent_id': parentAgentId ?? '',
122
- 'agent.task': `review PR #${prNumber}`,
123
- 'agent.framework': 'custom',
123
+ 'gen_ai.operation.name': 'invoke_agent',
124
+ 'gen_ai.agent.id': invocationId,
125
+ 'gen_ai.agent.name': 'code_reviewer',
126
+ 'app.agent.parent_id': parentAgentId ?? '',
127
+ 'app.agent.task': `review PR #${prNumber}`,
124
128
  },
125
129
  });
126
130
  agentSpan.addEvent('agent.planning');
@@ -133,26 +137,32 @@ agentSpan.end();
133
137
 
134
138
  Every tool invocation by an agent creates a child span of the agent invocation span.
135
139
 
136
- - **Span name pattern:** `tool.{tool_name}.execute`
137
- - **Required attributes:** `tool.name`, `tool.input_hash` (SHA-256), `tool.output_status`, `tool.duration_ms`, `tool.parameters_count`
138
- - Tool spans must be children of the invoking agent span. Set span status to `ERROR` when `tool.output_status` is `error` or `timeout`.
140
+ - **Span name pattern:** `execute_tool {gen_ai.tool.name}` (OTel GenAI tool span naming).
141
+ - **Required attributes:** `gen_ai.operation.name` = `execute_tool`, `gen_ai.tool.name`.
142
+ - **Project-namespaced extras:** `app.tool.input_hash` (SHA-256), `app.tool.output_status`, `app.tool.duration_ms`, `app.tool.parameters_count` hatch3r audit-trail fields the GenAI namespace does not define.
143
+ - Tool spans must be children of the invoking agent span. Set span status to `ERROR` when `app.tool.output_status` is `error` or `timeout`.
139
144
  - For tools performing I/O, create nested child spans using appropriate semantic conventions (`http.*`, `db.*`).
140
145
 
141
146
  ```typescript
142
147
  const toolSpan = tracer.startSpan(
143
- 'tool.git_diff.execute',
144
- { attributes: { 'tool.name': 'git_diff' } },
148
+ 'execute_tool git_diff',
149
+ {
150
+ attributes: {
151
+ 'gen_ai.operation.name': 'execute_tool',
152
+ 'gen_ai.tool.name': 'git_diff',
153
+ },
154
+ },
145
155
  trace.setSpan(context.active(), agentSpan),
146
156
  );
147
157
  try {
148
158
  const result = await tools.gitDiff(params);
149
159
  toolSpan.setAttributes({
150
- 'tool.output_status': 'success',
151
- 'tool.duration_ms': performance.now() - startTime,
152
- 'tool.input_hash': hashInput(params),
160
+ 'app.tool.output_status': 'success',
161
+ 'app.tool.duration_ms': performance.now() - startTime,
162
+ 'app.tool.input_hash': hashInput(params),
153
163
  });
154
164
  } catch (err) {
155
- toolSpan.setAttributes({ 'tool.output_status': 'error' });
165
+ toolSpan.setAttributes({ 'app.tool.output_status': 'error' });
156
166
  toolSpan.setStatus({ code: SpanStatusCode.ERROR, message: err.message });
157
167
  toolSpan.recordException(err);
158
168
  throw err;
@@ -163,8 +173,8 @@ try {
163
173
 
164
174
  ### LLM Request/Response Tracing
165
175
 
166
- - **Span name pattern:** `gen_ai.{operation}` (e.g., `gen_ai.chat`, `gen_ai.completion`)
167
- - **Token tracking:** Capture `gen_ai.usage.input_tokens` and `gen_ai.usage.output_tokens`. Aggregate in metrics: Counter `gen_ai.tokens_total` with labels `{direction, model, agent_name}`, Histogram `gen_ai.request_duration_ms`.
176
+ - **Span name pattern:** `{gen_ai.operation.name} {gen_ai.request.model}` (e.g., `chat gpt-4o`, `generate_content claude-sonnet-4-20250514`)
177
+ - **Token tracking:** Capture `gen_ai.usage.input_tokens` and `gen_ai.usage.output_tokens`. Aggregate in the registered GenAI metrics: Histogram `gen_ai.client.token.usage` (attribute `gen_ai.token.type` = `input`/`output`), Histogram `gen_ai.client.operation.duration`.
168
178
  - **Model version tracking:** Record both `gen_ai.request.model` and `gen_ai.response.model` for drift detection.
169
179
  - **Retry spans:** Each retry attempt is a separate child span. Set `gen_ai.request.retries` on the final span. Record `http.response.status_code` on failed spans (429 vs 500+).
170
180
  - Never log raw prompt content or full model responses as span attributes. Use token counts for cost tracking and correlated logs for prompt debugging in non-production environments.
@@ -172,7 +182,7 @@ try {
172
182
 
173
183
  ### Tool Call Audit Trail
174
184
 
175
- Maintain a structured audit log for every tool invocation in agentic workflows, separate from tracing spans.
185
+ Maintain a structured audit log for every tool invocation in agentic workflows, separate from tracing spans. These are hatch3r log-schema field names (not OTel span attributes); on the tool span itself, emit the OTel GenAI keys (`gen_ai.tool.name`, `gen_ai.operation.name`) plus the `app.tool.*` extras from "Tool Call Spans" above.
176
186
 
177
187
  | Field | Type | Description |
178
188
  |-------|------|-------------|