hatch3r 1.9.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 (288) hide show
  1. package/README.md +52 -143
  2. package/dist/cli/index.js +28453 -15831
  3. package/dist/content/agents/hatch3r-architect.md +39 -9
  4. package/dist/content/agents/hatch3r-brownfield-spec.md +254 -0
  5. package/dist/content/agents/hatch3r-ci-watcher.md +8 -1
  6. package/dist/content/agents/hatch3r-context-rules.md +19 -1
  7. package/dist/content/agents/hatch3r-creator.md +65 -26
  8. package/dist/content/agents/hatch3r-dependency-drafter.md +162 -0
  9. package/dist/content/agents/hatch3r-devops.md +11 -1
  10. package/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/dist/content/agents/hatch3r-fixer.md +59 -8
  14. package/dist/content/agents/hatch3r-greenfield-spec.md +256 -0
  15. package/dist/content/agents/hatch3r-handoff-loader.md +29 -3
  16. package/dist/content/agents/hatch3r-handoff-preparer.md +10 -1
  17. package/dist/content/agents/hatch3r-implementer.md +139 -8
  18. package/dist/content/agents/hatch3r-incident-responder.md +96 -0
  19. package/dist/content/agents/hatch3r-learnings-loader.md +122 -88
  20. package/dist/content/agents/hatch3r-lint-fixer.md +15 -3
  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/dist/content/agents/hatch3r-researcher.md +27 -4
  26. package/dist/content/agents/hatch3r-reviewer.md +153 -103
  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/dist/content/agents/modes/requirements-elicitation.md +1 -1
  33. package/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/dist/content/agents/shared/efficiency-patterns.md +32 -1
  38. package/dist/content/agents/shared/injection-patterns.md +18 -7
  39. package/dist/content/agents/shared/principles.md +60 -0
  40. package/dist/content/agents/shared/prompt-structure.md +7 -1
  41. package/dist/content/agents/shared/quality-charter.md +48 -12
  42. package/dist/content/agents/shared/quality-specialist-frame.md +141 -0
  43. package/dist/content/agents/shared/rigor-contract.md +151 -0
  44. package/dist/content/agents/shared/severity-mapping.md +92 -0
  45. package/dist/content/agents/shared/triage-vocabulary.md +46 -0
  46. package/dist/content/agents/shared/user-content-templates.md +34 -8
  47. package/dist/content/agents/shared/user-question-protocol.md +45 -3
  48. package/dist/content/checks/README.md +5 -0
  49. package/dist/content/checks/accessibility.md +14 -7
  50. package/dist/content/checks/code-quality.md +1 -1
  51. package/dist/content/checks/performance.md +7 -4
  52. package/dist/content/checks/security.md +6 -6
  53. package/dist/content/checks/testing.md +1 -1
  54. package/dist/content/commands/board/pickup-delegation-multi.md +37 -10
  55. package/dist/content/commands/board/pickup-delegation.md +7 -5
  56. package/dist/content/commands/board/pickup-modes.md +1 -0
  57. package/dist/content/commands/board/pickup-post-impl.md +1 -1
  58. package/dist/content/commands/hatch3r-api-spec.md +79 -2
  59. package/dist/content/commands/hatch3r-auth-scaffold.md +250 -0
  60. package/dist/content/commands/hatch3r-benchmark.md +90 -7
  61. package/dist/content/commands/hatch3r-board-fill.md +97 -11
  62. package/dist/content/commands/hatch3r-board-pickup.md +93 -9
  63. package/dist/content/commands/hatch3r-bug-pipeline.md +240 -0
  64. package/dist/content/commands/hatch3r-bug-plan.md +79 -3
  65. package/dist/content/commands/hatch3r-codebase-map.md +80 -4
  66. package/dist/content/commands/hatch3r-create.md +105 -7
  67. package/dist/content/commands/hatch3r-debug.md +102 -14
  68. package/dist/content/commands/hatch3r-diagnose.md +238 -0
  69. package/dist/content/commands/hatch3r-feature-plan.md +125 -5
  70. package/dist/content/commands/hatch3r-handoff.md +83 -3
  71. package/dist/content/commands/hatch3r-healthcheck.md +105 -5
  72. package/dist/content/commands/hatch3r-incident-response.md +228 -0
  73. package/dist/content/commands/hatch3r-migration-plan.md +79 -3
  74. package/dist/content/commands/hatch3r-onboard.md +94 -3
  75. package/dist/content/commands/hatch3r-pack-install.md +243 -0
  76. package/dist/content/commands/hatch3r-pr-resolve.md +106 -23
  77. package/dist/content/commands/hatch3r-project-spec.md +82 -6
  78. package/dist/content/commands/hatch3r-quick-change.md +108 -13
  79. package/dist/content/commands/hatch3r-refactor-plan.md +78 -2
  80. package/dist/content/commands/hatch3r-release.md +401 -0
  81. package/dist/content/commands/hatch3r-revision.md +98 -12
  82. package/dist/content/commands/hatch3r-roadmap.md +92 -10
  83. package/dist/content/commands/hatch3r-security-audit.md +105 -5
  84. package/dist/content/commands/hatch3r-slo-scaffold.md +246 -0
  85. package/dist/content/commands/hatch3r-spec.md +216 -0
  86. package/dist/content/commands/hatch3r-test-plan.md +85 -9
  87. package/dist/content/commands/hatch3r-workflow.md +165 -41
  88. package/dist/content/commands/revision/revision-delegation.md +6 -5
  89. package/dist/content/commands/revision/revision-modes.md +49 -4
  90. package/dist/content/commands/revision/revision-quality.md +10 -7
  91. package/dist/content/commands/shared/orchestration-frame.md +119 -0
  92. package/dist/content/github-agents/hatch3r-docs-agent.md +21 -1
  93. package/dist/content/github-agents/hatch3r-lint-agent.md +21 -1
  94. package/dist/content/github-agents/hatch3r-security-agent.md +21 -1
  95. package/dist/content/github-agents/hatch3r-test-agent.md +21 -1
  96. package/dist/content/hooks/hatch3r-file-save.md +1 -1
  97. package/dist/content/hooks/hatch3r-pre-push.md +4 -4
  98. package/dist/content/hooks/hatch3r-review-loop-cap.md +52 -0
  99. package/dist/content/mcp/mcp.json +7 -5
  100. package/dist/content/rules/hatch3r-accessibility-standards.md +14 -2
  101. package/dist/content/rules/hatch3r-accessibility-standards.mdc +12 -1
  102. package/dist/content/rules/hatch3r-agent-orchestration-detail.md +58 -19
  103. package/dist/content/rules/hatch3r-agent-orchestration-detail.mdc +58 -19
  104. package/dist/content/rules/hatch3r-agent-orchestration.md +87 -213
  105. package/dist/content/rules/hatch3r-agent-orchestration.mdc +87 -213
  106. package/dist/content/rules/hatch3r-ai-evals.md +5 -4
  107. package/dist/content/rules/hatch3r-ai-evals.mdc +3 -3
  108. package/dist/content/rules/hatch3r-ai-ux-patterns.md +6 -2
  109. package/dist/content/rules/hatch3r-ai-ux-patterns.mdc +4 -1
  110. package/dist/content/rules/hatch3r-android-patterns.md +107 -0
  111. package/dist/content/rules/hatch3r-android-patterns.mdc +102 -0
  112. package/dist/content/rules/hatch3r-anti-duplication.md +115 -0
  113. package/dist/content/rules/hatch3r-anti-duplication.mdc +115 -0
  114. package/dist/content/rules/hatch3r-api-design.md +5 -1
  115. package/dist/content/rules/hatch3r-api-design.mdc +3 -0
  116. package/dist/content/rules/hatch3r-api-versioning.md +2 -1
  117. package/dist/content/rules/hatch3r-auth-patterns.md +3 -1
  118. package/dist/content/rules/hatch3r-auth-patterns.mdc +1 -0
  119. package/dist/content/rules/hatch3r-browser-verification.md +2 -0
  120. package/dist/content/rules/hatch3r-browser-verification.mdc +2 -0
  121. package/dist/content/rules/hatch3r-capability-matrix.md +108 -0
  122. package/dist/content/rules/hatch3r-capability-matrix.mdc +108 -0
  123. package/dist/content/rules/hatch3r-ci-cd.md +8 -1
  124. package/dist/content/rules/hatch3r-ci-cd.mdc +6 -0
  125. package/dist/content/rules/hatch3r-clarification-default.md +73 -0
  126. package/dist/content/rules/hatch3r-clarification-default.mdc +73 -0
  127. package/dist/content/rules/hatch3r-code-standards.md +23 -47
  128. package/dist/content/rules/hatch3r-code-standards.mdc +22 -46
  129. package/dist/content/rules/hatch3r-component-conventions.md +3 -0
  130. package/dist/content/rules/hatch3r-component-conventions.mdc +3 -0
  131. package/dist/content/rules/hatch3r-container-hardening.md +11 -2
  132. package/dist/content/rules/hatch3r-container-hardening.mdc +9 -1
  133. package/dist/content/rules/hatch3r-contract-testing.md +2 -1
  134. package/dist/content/rules/hatch3r-cost-visibility.md +135 -0
  135. package/dist/content/rules/hatch3r-cost-visibility.mdc +135 -0
  136. package/dist/content/rules/hatch3r-cq-rule-frame.md +54 -0
  137. package/dist/content/rules/hatch3r-cq-rule-frame.mdc +49 -0
  138. package/dist/content/rules/hatch3r-data-classification.md +3 -1
  139. package/dist/content/rules/hatch3r-data-classification.mdc +2 -1
  140. package/dist/content/rules/hatch3r-deep-context.md +13 -13
  141. package/dist/content/rules/hatch3r-deep-context.mdc +13 -13
  142. package/dist/content/rules/hatch3r-dependency-management.md +16 -3
  143. package/dist/content/rules/hatch3r-dependency-management.mdc +15 -3
  144. package/dist/content/rules/hatch3r-design-system-detection.md +2 -1
  145. package/dist/content/rules/hatch3r-dotnet-patterns.md +104 -0
  146. package/dist/content/rules/hatch3r-dotnet-patterns.mdc +99 -0
  147. package/dist/content/rules/hatch3r-edge-case-discipline.md +65 -0
  148. package/dist/content/rules/hatch3r-edge-case-discipline.mdc +65 -0
  149. package/dist/content/rules/hatch3r-enhancability.md +147 -0
  150. package/dist/content/rules/hatch3r-enhancability.mdc +142 -0
  151. package/dist/content/rules/hatch3r-event-schema-evolution.md +2 -1
  152. package/dist/content/rules/hatch3r-fan-out-discipline.md +91 -0
  153. package/dist/content/rules/hatch3r-fan-out-discipline.mdc +91 -0
  154. package/dist/content/rules/hatch3r-feature-flags.md +2 -0
  155. package/dist/content/rules/hatch3r-feature-flags.mdc +2 -0
  156. package/dist/content/rules/hatch3r-flutter-patterns.md +88 -0
  157. package/dist/content/rules/hatch3r-flutter-patterns.mdc +83 -0
  158. package/dist/content/rules/hatch3r-git-conventions.md +4 -1
  159. package/dist/content/rules/hatch3r-git-conventions.mdc +2 -0
  160. package/dist/content/rules/hatch3r-go-patterns.md +98 -0
  161. package/dist/content/rules/hatch3r-go-patterns.mdc +93 -0
  162. package/dist/content/rules/hatch3r-handoff-readiness.md +10 -0
  163. package/dist/content/rules/hatch3r-handoff-readiness.mdc +10 -0
  164. package/dist/content/rules/hatch3r-i18n.md +2 -0
  165. package/dist/content/rules/hatch3r-i18n.mdc +2 -0
  166. package/dist/content/rules/hatch3r-iteration-summary.md +75 -57
  167. package/dist/content/rules/hatch3r-iteration-summary.mdc +77 -54
  168. package/dist/content/rules/hatch3r-learning-system.md +202 -0
  169. package/dist/content/rules/hatch3r-learning-system.mdc +202 -0
  170. package/dist/content/rules/hatch3r-maintainability.md +157 -0
  171. package/dist/content/rules/hatch3r-maintainability.mdc +152 -0
  172. package/dist/content/rules/hatch3r-migrations.md +2 -1
  173. package/dist/content/rules/hatch3r-observability-logging.md +1 -1
  174. package/dist/content/rules/hatch3r-observability-metrics.md +1 -1
  175. package/dist/content/rules/hatch3r-observability-tracing.md +45 -36
  176. package/dist/content/rules/hatch3r-observability-tracing.mdc +44 -35
  177. package/dist/content/rules/hatch3r-operability.md +2 -1
  178. package/dist/content/rules/hatch3r-passkey-server.md +2 -1
  179. package/dist/content/rules/hatch3r-performance-budgets.md +2 -0
  180. package/dist/content/rules/hatch3r-performance-budgets.mdc +2 -0
  181. package/dist/content/rules/hatch3r-php-laravel-patterns.md +109 -0
  182. package/dist/content/rules/hatch3r-php-laravel-patterns.mdc +104 -0
  183. package/dist/content/rules/hatch3r-progressive-delivery.md +5 -1
  184. package/dist/content/rules/hatch3r-progressive-delivery.mdc +3 -0
  185. package/dist/content/rules/hatch3r-proof-model.md +131 -0
  186. package/dist/content/rules/hatch3r-proof-model.mdc +131 -0
  187. package/dist/content/rules/hatch3r-python-patterns.md +70 -0
  188. package/dist/content/rules/hatch3r-python-patterns.mdc +65 -0
  189. package/dist/content/rules/hatch3r-react-native-patterns.md +83 -0
  190. package/dist/content/rules/hatch3r-react-native-patterns.mdc +78 -0
  191. package/dist/content/rules/hatch3r-resilience-patterns.md +2 -1
  192. package/dist/content/rules/hatch3r-reviewer-calibration.md +84 -0
  193. package/dist/content/rules/hatch3r-reviewer-calibration.mdc +84 -0
  194. package/dist/content/rules/hatch3r-right-sizing.md +68 -0
  195. package/dist/content/rules/hatch3r-right-sizing.mdc +66 -0
  196. package/dist/content/rules/hatch3r-ruby-rails-patterns.md +111 -0
  197. package/dist/content/rules/hatch3r-ruby-rails-patterns.mdc +106 -0
  198. package/dist/content/rules/hatch3r-rust-patterns.md +107 -0
  199. package/dist/content/rules/hatch3r-rust-patterns.mdc +102 -0
  200. package/dist/content/rules/hatch3r-scalability.md +137 -0
  201. package/dist/content/rules/hatch3r-scalability.mdc +132 -0
  202. package/dist/content/rules/hatch3r-secrets-management.md +10 -1
  203. package/dist/content/rules/hatch3r-secrets-management.mdc +8 -0
  204. package/dist/content/rules/hatch3r-security-patterns.md +36 -34
  205. package/dist/content/rules/hatch3r-security-patterns.mdc +35 -34
  206. package/dist/content/rules/hatch3r-security.md +97 -0
  207. package/dist/content/rules/hatch3r-security.mdc +92 -0
  208. package/dist/content/rules/hatch3r-swiftui-patterns.md +98 -0
  209. package/dist/content/rules/hatch3r-swiftui-patterns.mdc +93 -0
  210. package/dist/content/rules/hatch3r-testability.md +115 -0
  211. package/dist/content/rules/hatch3r-testability.mdc +110 -0
  212. package/dist/content/rules/hatch3r-testing.md +4 -1
  213. package/dist/content/rules/hatch3r-testing.mdc +2 -0
  214. package/dist/content/rules/hatch3r-theming.md +2 -0
  215. package/dist/content/rules/hatch3r-theming.mdc +2 -0
  216. package/dist/content/rules/hatch3r-tool-currency.md +91 -0
  217. package/dist/content/rules/hatch3r-tool-currency.mdc +86 -0
  218. package/dist/content/rules/hatch3r-tooling-hierarchy.md +29 -31
  219. package/dist/content/rules/hatch3r-tooling-hierarchy.mdc +27 -30
  220. package/dist/content/rules/hatch3r-typescript-patterns.md +58 -0
  221. package/dist/content/rules/hatch3r-typescript-patterns.mdc +53 -0
  222. package/dist/content/rules/hatch3r-ux-states-and-flows.md +11 -4
  223. package/dist/content/rules/hatch3r-ux-states-and-flows.mdc +9 -3
  224. package/dist/content/skills/hatch3r-a11y-audit/SKILL.md +10 -8
  225. package/dist/content/skills/hatch3r-a11y-audit/references/manual-audit-checklist.md +7 -5
  226. package/dist/content/skills/hatch3r-adhoc-orchestrate/SKILL.md +131 -0
  227. package/dist/content/skills/hatch3r-ai-feature/SKILL.md +4 -6
  228. package/dist/content/skills/hatch3r-api-spec/SKILL.md +27 -2
  229. package/dist/content/skills/hatch3r-architecture-review/SKILL.md +4 -7
  230. package/dist/content/skills/hatch3r-board-groom/SKILL.md +11 -0
  231. package/dist/content/skills/hatch3r-board-init/SKILL.md +17 -1
  232. package/dist/content/skills/hatch3r-board-refresh/SKILL.md +12 -1
  233. package/dist/content/skills/hatch3r-board-shared/SKILL.md +38 -1
  234. package/dist/content/skills/hatch3r-browser-verify/SKILL.md +307 -0
  235. package/dist/content/skills/hatch3r-bug-fix/SKILL.md +15 -2
  236. package/dist/content/skills/hatch3r-ci-pipeline/SKILL.md +17 -7
  237. package/dist/content/skills/hatch3r-cli-fd/SKILL.md +33 -1
  238. package/dist/content/skills/hatch3r-cli-fzf/SKILL.md +33 -1
  239. package/dist/content/skills/hatch3r-cli-gh/SKILL.md +50 -1
  240. package/dist/content/skills/hatch3r-cli-jq/SKILL.md +40 -6
  241. package/dist/content/skills/hatch3r-cli-ripgrep/SKILL.md +33 -1
  242. package/dist/content/skills/hatch3r-cli-toolbox/SKILL.md +130 -23
  243. package/dist/content/skills/hatch3r-containerize/SKILL.md +157 -0
  244. package/dist/content/skills/hatch3r-context-health/SKILL.md +9 -7
  245. package/dist/content/skills/hatch3r-cost-tracking/SKILL.md +37 -17
  246. package/dist/content/skills/hatch3r-customize/SKILL.md +5 -8
  247. package/dist/content/skills/hatch3r-dep-audit/SKILL.md +23 -7
  248. package/dist/content/skills/hatch3r-design-system-detect/SKILL.md +3 -7
  249. package/dist/content/skills/hatch3r-docs-writing/SKILL.md +159 -0
  250. package/dist/content/skills/hatch3r-enhancability-verify/SKILL.md +152 -0
  251. package/dist/content/skills/hatch3r-feature/SKILL.md +53 -3
  252. package/dist/content/skills/hatch3r-feedback/SKILL.md +103 -0
  253. package/dist/content/skills/hatch3r-gh-agentic-workflows/SKILL.md +10 -8
  254. package/dist/content/skills/hatch3r-handoff-prepare/SKILL.md +4 -7
  255. package/dist/content/skills/hatch3r-handoff-resume/SKILL.md +4 -7
  256. package/dist/content/{commands/hatch3r-hooks.md → skills/hatch3r-hooks/SKILL.md} +48 -137
  257. package/dist/content/skills/hatch3r-incident-response/SKILL.md +66 -7
  258. package/dist/content/skills/hatch3r-issue-workflow/SKILL.md +11 -0
  259. package/dist/content/skills/hatch3r-learn/SKILL.md +317 -0
  260. package/dist/content/skills/hatch3r-logical-refactor/SKILL.md +6 -7
  261. package/dist/content/skills/hatch3r-maintainability-verify/SKILL.md +146 -0
  262. package/dist/content/skills/hatch3r-migration/SKILL.md +8 -7
  263. package/dist/content/skills/hatch3r-observability-verify/SKILL.md +17 -12
  264. package/dist/content/skills/hatch3r-perf-audit/SKILL.md +13 -9
  265. package/dist/content/skills/hatch3r-pr-creation/SKILL.md +4 -7
  266. package/dist/content/skills/hatch3r-qa-validation/SKILL.md +6 -5
  267. package/dist/content/skills/hatch3r-recipe/SKILL.md +63 -60
  268. package/dist/content/skills/hatch3r-refactor/SKILL.md +6 -7
  269. package/dist/content/skills/hatch3r-release/SKILL.md +123 -11
  270. package/dist/content/skills/hatch3r-reliability-verify/SKILL.md +9 -5
  271. package/dist/content/{commands/hatch3r-report.md → skills/hatch3r-report/SKILL.md} +20 -17
  272. package/dist/content/skills/hatch3r-scalability-verify/SKILL.md +145 -0
  273. package/dist/content/skills/hatch3r-security-verify/SKILL.md +144 -0
  274. package/dist/content/skills/hatch3r-team-convention-author/SKILL.md +126 -0
  275. package/dist/content/skills/hatch3r-testability-verify/SKILL.md +147 -0
  276. package/dist/content/skills/hatch3r-ui-ux-verify/SKILL.md +19 -11
  277. package/dist/content/skills/hatch3r-visual-refactor/SKILL.md +11 -7
  278. package/package.json +50 -31
  279. package/dist/cli/index.d.ts +0 -2
  280. package/dist/cli/index.js.map +0 -1
  281. package/dist/content/agents/hatch3r-a11y-auditor.md +0 -159
  282. package/dist/content/agents/hatch3r-dependency-auditor.md +0 -219
  283. package/dist/content/agents/hatch3r-perf-profiler.md +0 -166
  284. package/dist/content/agents/hatch3r-security-auditor.md +0 -180
  285. package/dist/content/agents/hatch3r-test-writer.md +0 -171
  286. package/dist/content/commands/hatch3r-learn.md +0 -312
  287. package/dist/content/rules/hatch3r-learning-consult.md +0 -42
  288. package/dist/content/rules/hatch3r-learning-consult.mdc +0 -38
@@ -0,0 +1,84 @@
1
+ ---
2
+ id: hatch3r-reviewer-calibration
3
+ type: rule
4
+ description: "Reviewer runtime confidence-calibration contract: every Nth (default N=5) consecutive clean PASS triggers an out-of-band second-pass review before loop exit; divergence reverts to REQUEST CHANGES; each second pass logs to .hatch3r/calibration-log.jsonl. Canonical source of the N-default and the directive that agents/hatch3r-reviewer.md and calibration-protocol.md reference."
5
+ tags: [review, orchestration, floor:protocol]
6
+ scope: always
7
+ precedence: high
8
+ quality_charter: agents/shared/quality-charter.md
9
+ cache_friendly: true
10
+ ---
11
+ # hatch3r Reviewer Confidence Calibration
12
+
13
+ **Pillars:** P2 (Scientific & Practical Quality), P5 (Governance Self-Quality)
14
+
15
+ A reviewer's `confidence` rating is self-assigned by the same model that produced the verdict. Without an out-of-band check it is structurally over-trusted: LLM judges systematically overstate confidence — predicted confidence significantly exceeds realized correctness (Tian et al. 2025, arxiv:2508.06225) — so a self-reported clean PASS carries a non-zero, unmeasured miscalibration probability at runtime. This rule is the canonical, always-on source for the **runtime** (within-loop) bound that closes that gap before the review loop exits on a clean PASS. It owns the N-default and the directive that `agents/hatch3r-reviewer.md` §Runtime Confidence Calibration and the across-cycle calibration protocol cite.
16
+
17
+ Scope split (do not duplicate across the two artifacts):
18
+
19
+ - **Runtime, within-loop (this rule + `agents/hatch3r-reviewer.md`):** bounds an unbounded run of self-trusted clean verdicts inside one review-loop session. Fires before loop exit.
20
+ - **Across-cycle measurement (the across-cycle calibration protocol):** samples N=20 prior-cycle PASS findings at cycle close and scores realized over-claim rate. Fires at cycle archive time.
21
+
22
+ The two are complements, not substitutes — neither replaces the other.
23
+
24
+ ## Directive (verbatim)
25
+
26
+ > Every Nth consecutive clean PASS verdict on a review-loop exit triggers one out-of-band second-pass review of the same diff. If the second pass surfaces any Critical or Warning the first pass did not, the loop does NOT exit clean — it reverts to REQUEST CHANGES. Each second pass appends one record to `.hatch3r/calibration-log.jsonl`.
27
+
28
+ ## N-default (authoritative)
29
+
30
+ `N = 5` consecutive clean PASS verdicts for general diffs; `N = 1` for safety-class diffs (auth / security / migration — see the high-risk fast path in Trigger). These are the single source of truth for the defaults; `agents/hatch3r-reviewer.md` and the across-cycle calibration protocol cite these values rather than redeclaring them. The lowered safety-class default fires the second pass on the first clean PASS so an auth, security, or migration change never merges on a single self-trusted verdict (D23-2).
31
+
32
+ - **Counter owner — the orchestrator, NOT the reviewer.** The reviewer sub-agent is spawned stateless per iteration and the review loop exits on the first clean verdict, so a reviewer-owned counter can never exceed 1 and the second pass would never fire. The orchestrator owns `consecutive_clean_pass_count` and reads/writes it; the reviewer only reports its per-verdict outcome.
33
+ - **Counter scope — across top-level runs, persisted.** Count consecutive clean PASS verdicts across top-level pipeline runs, not within one loop and not per-iteration (the loop exits on the first clean verdict, so within a single loop the count advances by at most 1). The orchestrator persists the running count to project-local `.hatch3r/calibration-state.json` (`{ "consecutive_clean_pass_count": <int>, "updated_at": "<ISO-8601>" }`), written atomically via `src/merge/safeWrite.ts`. On each top-level run the orchestrator reads the prior count, increments on a would-be-clean exit, and resets to 0 on any REQUEST CHANGES or DESIGN_OBJECTION verdict. A missing/unparseable file is treated as count 0.
34
+ - **Project override:** a project may set a different cadence via its own config; the override widens or narrows the cadence but never disables the second pass while a second pass remains available (see Unavailability below).
35
+
36
+ ## Trigger
37
+
38
+ The orchestrator evaluates the trigger at the would-be-clean loop exit (the point where the loop would return a clean PASS — 0 Critical + 0 Warning — to Phase 4), using the cross-run counter it persisted per N-default above. Either branch fires the second pass:
39
+
40
+ - **Cadence branch (default):** the post-increment `consecutive_clean_pass_count` (prior persisted count + 1 for this run) is a multiple of `N`.
41
+ - **High-risk fast path (safety-class, N=1):** the reviewed diff touches any safety-class surface — a file tagged `floor:security`, auth/authn code (the `hatch3r-security` (CQ3) dispatch set in `agents/hatch3r-reviewer.md`: `src/auth/**`, OAuth/OIDC config, WebAuthn/passkey server, release-pipeline files, dependency manifest/lockfile), any change that triggers the CQ3 security specialist, OR a schema/event-schema migration (the `migration.review` surface — schema DDL, backfills, event-schema changes). For a safety-class diff, fire the second pass on the **first** clean PASS, independent of the cadence counter (do not wait for the Nth). The fast-path branch still increments and persists the cross-run counter; it only lowers the firing threshold to `N=1` for that run.
42
+
43
+ ## Action
44
+
45
+ Run one second-pass review of the same diff with an independent judge:
46
+
47
+ 1. **Documented setup recommendation — a different model class.** A same-model-family critique shares the generator's blind spot, so a same-family second pass cannot detect the error classes the family is systematically biased to produce (Huang et al., ICLR 2024, "Large Language Models Cannot Self-Correct Reasoning Yet"). Route the second pass to a different model class wherever the deployment can — this is the recommended project setup, not best-effort. The second pass renders its own independent verdict + confidence.
48
+ 2. **Fallback — same model class re-rolled at higher temperature,** used ONLY when no second model class is routable. Because this fallback does not break the shared-blind-spot, it is a weaker check: emit `calibration: degraded (same-family re-roll)` in the verdict for that run so the weakened independence is visible and never asserted as a clean cross-family check. Record the model class used in the log (`second_pass_model_class: re-roll`).
49
+
50
+ The second pass applies the same Review Checklist as the first (`agents/hatch3r-reviewer.md` → Review Checklist); it is a full re-review, not a spot check.
51
+
52
+ ## Divergence handling
53
+
54
+ - **Divergent** — the second pass surfaces any Critical or Warning the first pass did not: do NOT exit clean. Revert the loop verdict to REQUEST CHANGES, record both verdicts, and feed the divergence to the next fixer iteration.
55
+ - **Aligned** — both passes agree (both clean): exit clean and record alignment.
56
+
57
+ A divergent second pass is the failure mode of interest — it is the runtime signal that the first pass was over-confident.
58
+
59
+ ## Logging
60
+
61
+ Append exactly one record per second pass to `.hatch3r/calibration-log.jsonl` (project-local, JSON Lines) via the atomic append path in `src/merge/safeWrite.ts`. One JSON object per line:
62
+
63
+ ```json
64
+ {"timestamp":"<ISO-8601>","first_pass_verdict":"PASS","second_pass_verdict":"PASS|REQUEST CHANGES","divergent":false,"second_pass_model_class":"different|re-roll","consecutive_clean_count":5,"trigger":"cadence|high-risk"}
65
+ ```
66
+
67
+ `consecutive_clean_count` is the post-increment cross-run count at firing time; `trigger` records which Trigger branch fired (`high-risk` when the diff touched a safety-class surface and the second pass fired on the first clean PASS under the `N=1` fast path). `second_pass_model_class` is `different` for a cross-family second pass or `re-roll` for the same-family fallback; a `re-roll` record corresponds to a `calibration: degraded (same-family re-roll)` verdict annotation per Action. The project-local over-claim rate derived from this log feeds the iteration-summary `Confidence` field per `rules/hatch3r-iteration-summary.md`.
68
+
69
+ ## Unavailability (visible skip, never silent)
70
+
71
+ Skip the second pass ONLY when no second model class is available AND the orchestrator has disabled same-model re-roll. In that case emit `calibration: skipped (no second pass available)` in the verdict so the gap is visible rather than silent — a silent skip is a Silent-Failure-Contract violation. A skip does NOT reset the consecutive-clean-PASS counter; the next eligible exit re-attempts the second pass.
72
+
73
+ ## Pillar Service
74
+
75
+ - **P2 Scientific & Practical Quality (primary).** Adds an adversarial out-of-band check to a self-assigned confidence value; over-claimed clean verdicts become detectable at runtime, not just at cycle close.
76
+ - **P5 Governance Self-Quality (supporting).** Removes the "reviewer as sole judge of its own confidence" structural over-trust pattern from the within-loop path, mirroring the across-cycle loop that `calibration-protocol.md` adds at cycle scope.
77
+
78
+ ## References
79
+
80
+ - `agents/hatch3r-reviewer.md` §Runtime Confidence Calibration — the consuming agent body that invokes this contract (accessed 2026-05-28, trust tier: canonical).
81
+ - The across-cycle calibration protocol §Runtime complement (F13.2-F1) — the across-cycle measurement loop this runtime bound complements (accessed 2026-05-28, trust tier: canonical).
82
+ - `rules/hatch3r-iteration-summary.md` — consumes the project-local over-claim rate for the `Confidence` field (accessed 2026-05-28, trust tier: canonical).
83
+ - Tian, Z. et al. "Overconfidence in LLM-as-a-Judge: Diagnosis and Confidence-Driven Solution" (arxiv:2508.06225). `https://arxiv.org/abs/2508.06225` (accessed 2026-06-09, peer-reviewed-methodology). Evidence that an LLM judge's predicted confidence significantly overstates realized correctness (the Overconfidence Phenomenon), so a self-reported clean PASS is structurally over-trusted — motivating the out-of-band second pass.
84
+ - Huang, J. et al. "Large Language Models Cannot Self-Correct Reasoning Yet." ICLR 2024 (arxiv:2310.01798). `https://arxiv.org/abs/2310.01798` (accessed 2026-06-06, peer-reviewed-methodology). Evidence that same-model self-critique shares the generator's blind spot, motivating the different-model-class setup recommendation in Action and the lowered safety-class `N=1` second-pass cadence (D23-2).
@@ -0,0 +1,84 @@
1
+ ---
2
+ id: hatch3r-reviewer-calibration
3
+ type: rule
4
+ description: "Reviewer runtime confidence-calibration contract: every Nth (default N=5) consecutive clean PASS triggers an out-of-band second-pass review before loop exit; divergence reverts to REQUEST CHANGES; each second pass logs to .hatch3r/calibration-log.jsonl. Canonical source of the N-default and the directive that agents/hatch3r-reviewer.md and calibration-protocol.md reference."
5
+ tags: [review, orchestration, floor:protocol]
6
+ alwaysApply: true
7
+ precedence: high
8
+ quality_charter: agents/shared/quality-charter.md
9
+ cache_friendly: true
10
+ ---
11
+ # hatch3r Reviewer Confidence Calibration
12
+
13
+ **Pillars:** P2 (Scientific & Practical Quality), P5 (Governance Self-Quality)
14
+
15
+ A reviewer's `confidence` rating is self-assigned by the same model that produced the verdict. Without an out-of-band check it is structurally over-trusted: LLM judges systematically overstate confidence — predicted confidence significantly exceeds realized correctness (Tian et al. 2025, arxiv:2508.06225) — so a self-reported clean PASS carries a non-zero, unmeasured miscalibration probability at runtime. This rule is the canonical, always-on source for the **runtime** (within-loop) bound that closes that gap before the review loop exits on a clean PASS. It owns the N-default and the directive that `agents/hatch3r-reviewer.md` §Runtime Confidence Calibration and the across-cycle calibration protocol cite.
16
+
17
+ Scope split (do not duplicate across the two artifacts):
18
+
19
+ - **Runtime, within-loop (this rule + `agents/hatch3r-reviewer.md`):** bounds an unbounded run of self-trusted clean verdicts inside one review-loop session. Fires before loop exit.
20
+ - **Across-cycle measurement (the across-cycle calibration protocol):** samples N=20 prior-cycle PASS findings at cycle close and scores realized over-claim rate. Fires at cycle archive time.
21
+
22
+ The two are complements, not substitutes — neither replaces the other.
23
+
24
+ ## Directive (verbatim)
25
+
26
+ > Every Nth consecutive clean PASS verdict on a review-loop exit triggers one out-of-band second-pass review of the same diff. If the second pass surfaces any Critical or Warning the first pass did not, the loop does NOT exit clean — it reverts to REQUEST CHANGES. Each second pass appends one record to `.hatch3r/calibration-log.jsonl`.
27
+
28
+ ## N-default (authoritative)
29
+
30
+ `N = 5` consecutive clean PASS verdicts for general diffs; `N = 1` for safety-class diffs (auth / security / migration — see the high-risk fast path in Trigger). These are the single source of truth for the defaults; `agents/hatch3r-reviewer.md` and the across-cycle calibration protocol cite these values rather than redeclaring them. The lowered safety-class default fires the second pass on the first clean PASS so an auth, security, or migration change never merges on a single self-trusted verdict (D23-2).
31
+
32
+ - **Counter owner — the orchestrator, NOT the reviewer.** The reviewer sub-agent is spawned stateless per iteration and the review loop exits on the first clean verdict, so a reviewer-owned counter can never exceed 1 and the second pass would never fire. The orchestrator owns `consecutive_clean_pass_count` and reads/writes it; the reviewer only reports its per-verdict outcome.
33
+ - **Counter scope — across top-level runs, persisted.** Count consecutive clean PASS verdicts across top-level pipeline runs, not within one loop and not per-iteration (the loop exits on the first clean verdict, so within a single loop the count advances by at most 1). The orchestrator persists the running count to project-local `.hatch3r/calibration-state.json` (`{ "consecutive_clean_pass_count": <int>, "updated_at": "<ISO-8601>" }`), written atomically via `src/merge/safeWrite.ts`. On each top-level run the orchestrator reads the prior count, increments on a would-be-clean exit, and resets to 0 on any REQUEST CHANGES or DESIGN_OBJECTION verdict. A missing/unparseable file is treated as count 0.
34
+ - **Project override:** a project may set a different cadence via its own config; the override widens or narrows the cadence but never disables the second pass while a second pass remains available (see Unavailability below).
35
+
36
+ ## Trigger
37
+
38
+ The orchestrator evaluates the trigger at the would-be-clean loop exit (the point where the loop would return a clean PASS — 0 Critical + 0 Warning — to Phase 4), using the cross-run counter it persisted per N-default above. Either branch fires the second pass:
39
+
40
+ - **Cadence branch (default):** the post-increment `consecutive_clean_pass_count` (prior persisted count + 1 for this run) is a multiple of `N`.
41
+ - **High-risk fast path (safety-class, N=1):** the reviewed diff touches any safety-class surface — a file tagged `floor:security`, auth/authn code (the `hatch3r-security` (CQ3) dispatch set in `agents/hatch3r-reviewer.md`: `src/auth/**`, OAuth/OIDC config, WebAuthn/passkey server, release-pipeline files, dependency manifest/lockfile), any change that triggers the CQ3 security specialist, OR a schema/event-schema migration (the `migration.review` surface — schema DDL, backfills, event-schema changes). For a safety-class diff, fire the second pass on the **first** clean PASS, independent of the cadence counter (do not wait for the Nth). The fast-path branch still increments and persists the cross-run counter; it only lowers the firing threshold to `N=1` for that run.
42
+
43
+ ## Action
44
+
45
+ Run one second-pass review of the same diff with an independent judge:
46
+
47
+ 1. **Documented setup recommendation — a different model class.** A same-model-family critique shares the generator's blind spot, so a same-family second pass cannot detect the error classes the family is systematically biased to produce (Huang et al., ICLR 2024, "Large Language Models Cannot Self-Correct Reasoning Yet"). Route the second pass to a different model class wherever the deployment can — this is the recommended project setup, not best-effort. The second pass renders its own independent verdict + confidence.
48
+ 2. **Fallback — same model class re-rolled at higher temperature,** used ONLY when no second model class is routable. Because this fallback does not break the shared-blind-spot, it is a weaker check: emit `calibration: degraded (same-family re-roll)` in the verdict for that run so the weakened independence is visible and never asserted as a clean cross-family check. Record the model class used in the log (`second_pass_model_class: re-roll`).
49
+
50
+ The second pass applies the same Review Checklist as the first (`agents/hatch3r-reviewer.md` → Review Checklist); it is a full re-review, not a spot check.
51
+
52
+ ## Divergence handling
53
+
54
+ - **Divergent** — the second pass surfaces any Critical or Warning the first pass did not: do NOT exit clean. Revert the loop verdict to REQUEST CHANGES, record both verdicts, and feed the divergence to the next fixer iteration.
55
+ - **Aligned** — both passes agree (both clean): exit clean and record alignment.
56
+
57
+ A divergent second pass is the failure mode of interest — it is the runtime signal that the first pass was over-confident.
58
+
59
+ ## Logging
60
+
61
+ Append exactly one record per second pass to `.hatch3r/calibration-log.jsonl` (project-local, JSON Lines) via the atomic append path in `src/merge/safeWrite.ts`. One JSON object per line:
62
+
63
+ ```json
64
+ {"timestamp":"<ISO-8601>","first_pass_verdict":"PASS","second_pass_verdict":"PASS|REQUEST CHANGES","divergent":false,"second_pass_model_class":"different|re-roll","consecutive_clean_count":5,"trigger":"cadence|high-risk"}
65
+ ```
66
+
67
+ `consecutive_clean_count` is the post-increment cross-run count at firing time; `trigger` records which Trigger branch fired (`high-risk` when the diff touched a safety-class surface and the second pass fired on the first clean PASS under the `N=1` fast path). `second_pass_model_class` is `different` for a cross-family second pass or `re-roll` for the same-family fallback; a `re-roll` record corresponds to a `calibration: degraded (same-family re-roll)` verdict annotation per Action. The project-local over-claim rate derived from this log feeds the iteration-summary `Confidence` field per `rules/hatch3r-iteration-summary.md`.
68
+
69
+ ## Unavailability (visible skip, never silent)
70
+
71
+ Skip the second pass ONLY when no second model class is available AND the orchestrator has disabled same-model re-roll. In that case emit `calibration: skipped (no second pass available)` in the verdict so the gap is visible rather than silent — a silent skip is a Silent-Failure-Contract violation. A skip does NOT reset the consecutive-clean-PASS counter; the next eligible exit re-attempts the second pass.
72
+
73
+ ## Pillar Service
74
+
75
+ - **P2 Scientific & Practical Quality (primary).** Adds an adversarial out-of-band check to a self-assigned confidence value; over-claimed clean verdicts become detectable at runtime, not just at cycle close.
76
+ - **P5 Governance Self-Quality (supporting).** Removes the "reviewer as sole judge of its own confidence" structural over-trust pattern from the within-loop path, mirroring the across-cycle loop that `calibration-protocol.md` adds at cycle scope.
77
+
78
+ ## References
79
+
80
+ - `agents/hatch3r-reviewer.md` §Runtime Confidence Calibration — the consuming agent body that invokes this contract (accessed 2026-05-28, trust tier: canonical).
81
+ - The across-cycle calibration protocol §Runtime complement (F13.2-F1) — the across-cycle measurement loop this runtime bound complements (accessed 2026-05-28, trust tier: canonical).
82
+ - `rules/hatch3r-iteration-summary.md` — consumes the project-local over-claim rate for the `Confidence` field (accessed 2026-05-28, trust tier: canonical).
83
+ - Tian, Z. et al. "Overconfidence in LLM-as-a-Judge: Diagnosis and Confidence-Driven Solution" (arxiv:2508.06225). `https://arxiv.org/abs/2508.06225` (accessed 2026-06-09, peer-reviewed-methodology). Evidence that an LLM judge's predicted confidence significantly overstates realized correctness (the Overconfidence Phenomenon), so a self-reported clean PASS is structurally over-trusted — motivating the out-of-band second pass.
84
+ - Huang, J. et al. "Large Language Models Cannot Self-Correct Reasoning Yet." ICLR 2024 (arxiv:2310.01798). `https://arxiv.org/abs/2310.01798` (accessed 2026-06-06, peer-reviewed-methodology). Evidence that same-model self-critique shares the generator's blind spot, motivating the different-model-class setup recommendation in Action and the lowered safety-class `N=1` second-pass cadence (D23-2).
@@ -0,0 +1,68 @@
1
+ ---
2
+ id: hatch3r-right-sizing
3
+ type: rule
4
+ description: Right-size every investment in robustness, scalability, testing, and infra to the project's maturity tier — invest only as much complexity as it takes to reach the next stage, never default to enterprise-grade. The universal floor (security, correctness, accessibility basics, baseline tests on changed surfaces) never relaxes. Overengineering and premature bureaucracy are P4 violations.
5
+ tags: [right-sizing, code-quality, floor:content-quality]
6
+ precedence: high
7
+ scope: always
8
+ quality_charter: agents/shared/quality-charter.md
9
+ cache_friendly: true
10
+ ---
11
+ # hatch3r Right-Sizing
12
+
13
+ **Pillars:** P4 (Comprehensive Lean Coverage), CQ8 (Maintainability Quality)
14
+
15
+ ## North-Star Directive
16
+
17
+ Invest in robustness, scalability, testing, and infrastructure in proportion to the project's maturity — and no further. Use only as much complexity as it takes to reach the **next** stage. Never default to enterprise-grade.
18
+
19
+ Overengineering is a defect, not diligence. Building a generalized framework, a sharded data tier, or a mutation-testing harness for a single-author prototype is the same category of error as skipping a needed test — it spends scarce effort on the wrong axis. Premature bureaucracy (approval gates, ADRs on trivial choices, governance ceremony a two-person team cannot sustain) is the identical failure wearing a process costume.
20
+
21
+ The maturity tier is an **investment-calibration dial, not a content gate**. Every capability — every specialist agent, every rule, every check — ships at every tier. The tier sets how DEEP you build, never WHETHER the concern applies. A solo project still cares about reliability and testing; it gets right-sized versions, not withheld ones.
22
+
23
+ ## The Universal Floor (never relaxed, any tier including solo)
24
+
25
+ Four floors bind at every tier. No calibration choice may drop below them:
26
+
27
+ 1. **Security** — auth correctness on protected routes, no committed secrets, dependency hygiene (lockfile + install integrity), input validation. The `floor:security` controls in `agents/hatch3r-security.md` bind in full at solo; only supply-chain and governance DEPTH scales upward.
28
+ 2. **Correctness & data integrity** — logic is correct against its stated contract; schema migrations are reversible (expand-contract); no destructive single-deploy schema change; no silent data corruption.
29
+ 3. **Accessibility basics** — keyboard operability, semantic markup, axe-core serious+critical = 0 on shipped UI.
30
+ 4. **Baseline tests on changed surfaces** — a smoke / happy-path test on every changed surface; mocks justified; deterministic runs.
31
+
32
+ If a calibration choice would drop below any floor, the floor wins. State the conflict; do not silently relax.
33
+
34
+ ## The Tier → Depth Ladder
35
+
36
+ Each tier adds depth on top of the one below. The enterprise column is the deepest — it holds the historical absolute thresholds the CQ specialists enforce.
37
+
38
+ | Tier | Investment posture | Build for |
39
+ |------|--------------------|-----------|
40
+ | **solo** | Universal floor only. Ship the smallest thing that is correct, secure, accessible, and tested on its changed surfaces. No speculative abstraction, no infra a single author cannot operate. | `team` |
41
+ | **team** | + shared-codebase discipline: duplication control (jscpd ≤7%), design-system reuse, structured logging with correlation ids, ADRs on genuine architectural decisions (not trivia). | `scaleup` |
42
+ | **scaleup** | + production operations: SLOs defined, distributed tracing on the request path, performance budgets, statelessness / idempotency / back-pressure on mutating writes, an incident-response path. | `enterprise` |
43
+ | **enterprise** | + org governance: full mutation / property / contract testing, AI-eval coverage, extensibility governance, FinOps cost attribution, a published deprecation policy. The deepest column — today's absolute audit thresholds. | (steady state) |
44
+
45
+ ## Build for the NEXT Stage, Not the Final One
46
+
47
+ When the right depth is ambiguous, build one tier up — never enterprise by default. Leave a documented seam (an interface boundary, a config indirection, a noted extension point), not a built-out cathedral. "Make the next step cheap" replaces "build everything now": cheap-to-extend later beats expensive-and-speculative now, because most speculative depth is never exercised — the project pivots or the need never lands.
48
+
49
+ The right question is never "what would a mature system have here?" It is: **what does THIS project at THIS tier need to take its next step safely?** Answer that, leave the seam, ship.
50
+
51
+ ## Reading the Project's Maturity
52
+
53
+ Resolve the tier in this order:
54
+
55
+ 1. **Adapter header** — generated artifacts carry the tier on their first line. Cursor: `<!-- hatch3r: right-size to maturity=<tier>… -->`. Copilot / inlined surfaces: `> hatch3r: right-size to maturity=<tier>…`. This is the fastest and most authoritative signal at agent runtime.
56
+ 2. **Manifest** — `.hatch3r/hatch.json` → `maturity`. Absent → treat as `solo`.
57
+ 3. **Ask** — if the tier is undiscoverable from both AND the decision is consequential (it changes the artifact's shape or cost), ask via `agents/shared/user-question-protocol.md`. Default to `solo` when no answer arrives.
58
+
59
+ ## Overengineering Is a P4 Violation
60
+
61
+ Shipping depth the tier did not call for is over-fitting the solution to an imagined future — a P4 (Lean Coverage) violation, because the unused machinery earns no value against its complexity cost. The CQ specialist agents enforce right-sizing through their `## Tier calibration` ladders: the solo column equals the universal floor, the enterprise column equals the absolute threshold.
62
+
63
+ A reviewer who finds enterprise-grade machinery (sharding, a plugin system, multi-burn-rate SLO alerting, a mutation-testing gate) on a solo or team project files a right-sizing finding — Info when it is dormant and cheap to remove, escalating to Medium when the unused depth slows the change under review or blocks the next step. Under-investment relative to the tier (no SLO on a scaleup request path, no design-system on a team frontend) is the symmetric finding: the floor and the tier ladder cut both ways.
64
+
65
+ ## References
66
+
67
+ - "YAGNI (You Aren't Gonna Need It)." Laws of Software Engineering. URL: https://lawsofsoftwareengineering.com/laws/yagni/ — accessed 2026-06-03. Trust tier: established curated engineering-principles reference (named-law catalog). Synthesized: build only what is required now; YAGNI depends on cheap refactoring (test coverage + CI) so deferring is safe; iterate with real use-case data rather than speculative architecture.
68
+ - Fritzsche, R. "Avoiding Over-Engineering: Focus on Real Problems in Software Development." 2025. URL: https://ricofritzsche.me/avoiding-over-engineering-focus-on-real-problems-in-software-development/ — accessed 2026-06-03. Trust tier: practitioner long-form with named author, citing Knuth premature-optimization + startup-scaling research (70% of failed startups scaled too early). Synthesized: build the simplest version first then iterate on observed problems; scale progressively with real growth, not imagined traffic; premature abstraction hinders maintainability.
@@ -0,0 +1,66 @@
1
+ ---
2
+ id: hatch3r-right-sizing
3
+ type: rule
4
+ description: Right-size every investment in robustness, scalability, testing, and infra to the project's maturity tier — invest only as much complexity as it takes to reach the next stage, never default to enterprise-grade. The universal floor (security, correctness, accessibility basics, baseline tests on changed surfaces) never relaxes. Overengineering and premature bureaucracy are P4 violations.
5
+ tags: [right-sizing, code-quality, floor:content-quality]
6
+ precedence: high
7
+ alwaysApply: true
8
+ ---
9
+ # hatch3r Right-Sizing
10
+
11
+ **Pillars:** P4 (Comprehensive Lean Coverage), CQ8 (Maintainability Quality)
12
+
13
+ ## North-Star Directive
14
+
15
+ Invest in robustness, scalability, testing, and infrastructure in proportion to the project's maturity — and no further. Use only as much complexity as it takes to reach the **next** stage. Never default to enterprise-grade.
16
+
17
+ Overengineering is a defect, not diligence. Building a generalized framework, a sharded data tier, or a mutation-testing harness for a single-author prototype is the same category of error as skipping a needed test — it spends scarce effort on the wrong axis. Premature bureaucracy (approval gates, ADRs on trivial choices, governance ceremony a two-person team cannot sustain) is the identical failure wearing a process costume.
18
+
19
+ The maturity tier is an **investment-calibration dial, not a content gate**. Every capability — every specialist agent, every rule, every check — ships at every tier. The tier sets how DEEP you build, never WHETHER the concern applies. A solo project still cares about reliability and testing; it gets right-sized versions, not withheld ones.
20
+
21
+ ## The Universal Floor (never relaxed, any tier including solo)
22
+
23
+ Four floors bind at every tier. No calibration choice may drop below them:
24
+
25
+ 1. **Security** — auth correctness on protected routes, no committed secrets, dependency hygiene (lockfile + install integrity), input validation. The `floor:security` controls in `agents/hatch3r-security.md` bind in full at solo; only supply-chain and governance DEPTH scales upward.
26
+ 2. **Correctness & data integrity** — logic is correct against its stated contract; schema migrations are reversible (expand-contract); no destructive single-deploy schema change; no silent data corruption.
27
+ 3. **Accessibility basics** — keyboard operability, semantic markup, axe-core serious+critical = 0 on shipped UI.
28
+ 4. **Baseline tests on changed surfaces** — a smoke / happy-path test on every changed surface; mocks justified; deterministic runs.
29
+
30
+ If a calibration choice would drop below any floor, the floor wins. State the conflict; do not silently relax.
31
+
32
+ ## The Tier → Depth Ladder
33
+
34
+ Each tier adds depth on top of the one below. The enterprise column is the deepest — it holds the historical absolute thresholds the CQ specialists enforce.
35
+
36
+ | Tier | Investment posture | Build for |
37
+ |------|--------------------|-----------|
38
+ | **solo** | Universal floor only. Ship the smallest thing that is correct, secure, accessible, and tested on its changed surfaces. No speculative abstraction, no infra a single author cannot operate. | `team` |
39
+ | **team** | + shared-codebase discipline: duplication control (jscpd ≤7%), design-system reuse, structured logging with correlation ids, ADRs on genuine architectural decisions (not trivia). | `scaleup` |
40
+ | **scaleup** | + production operations: SLOs defined, distributed tracing on the request path, performance budgets, statelessness / idempotency / back-pressure on mutating writes, an incident-response path. | `enterprise` |
41
+ | **enterprise** | + org governance: full mutation / property / contract testing, AI-eval coverage, extensibility governance, FinOps cost attribution, a published deprecation policy. The deepest column — today's absolute audit thresholds. | (steady state) |
42
+
43
+ ## Build for the NEXT Stage, Not the Final One
44
+
45
+ When the right depth is ambiguous, build one tier up — never enterprise by default. Leave a documented seam (an interface boundary, a config indirection, a noted extension point), not a built-out cathedral. "Make the next step cheap" replaces "build everything now": cheap-to-extend later beats expensive-and-speculative now, because most speculative depth is never exercised — the project pivots or the need never lands.
46
+
47
+ The right question is never "what would a mature system have here?" It is: **what does THIS project at THIS tier need to take its next step safely?** Answer that, leave the seam, ship.
48
+
49
+ ## Reading the Project's Maturity
50
+
51
+ Resolve the tier in this order:
52
+
53
+ 1. **Adapter header** — generated artifacts carry the tier on their first line. Cursor: `<!-- hatch3r: right-size to maturity=<tier>… -->`. Copilot / inlined surfaces: `> hatch3r: right-size to maturity=<tier>…`. This is the fastest and most authoritative signal at agent runtime.
54
+ 2. **Manifest** — `.hatch3r/hatch.json` → `maturity`. Absent → treat as `solo`.
55
+ 3. **Ask** — if the tier is undiscoverable from both AND the decision is consequential (it changes the artifact's shape or cost), ask via `agents/shared/user-question-protocol.md`. Default to `solo` when no answer arrives.
56
+
57
+ ## Overengineering Is a P4 Violation
58
+
59
+ Shipping depth the tier did not call for is over-fitting the solution to an imagined future — a P4 (Lean Coverage) violation, because the unused machinery earns no value against its complexity cost. The CQ specialist agents enforce right-sizing through their `## Tier calibration` ladders: the solo column equals the universal floor, the enterprise column equals the absolute threshold.
60
+
61
+ A reviewer who finds enterprise-grade machinery (sharding, a plugin system, multi-burn-rate SLO alerting, a mutation-testing gate) on a solo or team project files a right-sizing finding — Info when it is dormant and cheap to remove, escalating to Medium when the unused depth slows the change under review or blocks the next step. Under-investment relative to the tier (no SLO on a scaleup request path, no design-system on a team frontend) is the symmetric finding: the floor and the tier ladder cut both ways.
62
+
63
+ ## References
64
+
65
+ - "YAGNI (You Aren't Gonna Need It)." Laws of Software Engineering. URL: https://lawsofsoftwareengineering.com/laws/yagni/ — accessed 2026-06-03. Trust tier: established curated engineering-principles reference (named-law catalog). Synthesized: build only what is required now; YAGNI depends on cheap refactoring (test coverage + CI) so deferring is safe; iterate with real use-case data rather than speculative architecture.
66
+ - Fritzsche, R. "Avoiding Over-Engineering: Focus on Real Problems in Software Development." 2025. URL: https://ricofritzsche.me/avoiding-over-engineering-focus-on-real-problems-in-software-development/ — accessed 2026-06-03. Trust tier: practitioner long-form with named author, citing Knuth premature-optimization + startup-scaling research (70% of failed startups scaled too early). Synthesized: build the simplest version first then iterate on observed problems; scale progressively with real growth, not imagined traffic; premature abstraction hinders maintainability.
@@ -0,0 +1,111 @@
1
+ ---
2
+ id: hatch3r-ruby-rails-patterns
3
+ type: rule
4
+ description: Ruby 3.3+ and Rails 8.x conventions covering Hotwire (Turbo + Stimulus), ActiveRecord patterns, Sidekiq jobs, RSpec testing, RuboCop / Standard, and YJIT performance
5
+ scope: conditional
6
+ globs: "**/*.rb,**/*.rake,**/Gemfile,**/Gemfile.lock,**/Rakefile,**/config.ru,**/.rubocop.yml,**/.rubocop.yaml,**/.standard.yml,**/app/**,**/config/**,**/db/migrate/**,**/lib/**,**/spec/**,**/test/**"
7
+ tags: [implementation, lang:ruby]
8
+ quality_charter: agents/shared/quality-charter.md
9
+ cache_friendly: true
10
+ ---
11
+ # Ruby / Rails Patterns
12
+
13
+ **Pillars:** P2 (Scientific & Practical Quality), CQ8 (Maintainability Quality)
14
+
15
+ > Applies when the project ships a Ruby application. Detection signals: `Gemfile` at repo root, `config/application.rb` (Rails), `.ruby-version`, or any `*.rb` file. Sinatra and Hanami projects share most of the Ruby-level guidance here.
16
+
17
+ ## Ruby Language Floor
18
+
19
+ - Target Ruby 3.3+ (3.4 recommended for new projects). Use pattern matching (`case/in`), rightward assignment (`x => y`), endless methods (`def square(x) = x * x`) when they improve readability — not as defaults.
20
+ - Enable YJIT in production (`--yjit` flag or `RUBY_YJIT_ENABLE=1`). YJIT delivers 15–25% throughput improvements on Rails workloads with no code changes.
21
+ - Sorbet (`sorbet-runtime`) or RBS (`steep`) for gradual typing. Type-check business logic and public API surfaces; skip view code and trivial helpers.
22
+ - Format with Standard Ruby (`standardrb`) or RuboCop with `rubocop-rails` + `rubocop-rspec`. Pin in CI; reformat-on-save in editors.
23
+
24
+ ## Project Layout (Rails)
25
+
26
+ - Default Rails structure:
27
+ - `app/models/` — ActiveRecord models and POROs.
28
+ - `app/controllers/` — controllers (HTTP only).
29
+ - `app/views/` — templates (ERB / Slim / HAML).
30
+ - `app/components/` — ViewComponent (`view_component` gem) for reusable UI components.
31
+ - `app/services/<Domain>/` — service objects (single public `call` method).
32
+ - `app/jobs/` — Active Job / Sidekiq workers.
33
+ - `app/policies/` — Pundit policies (or equivalent authorization).
34
+ - Service objects (`app/services/`) for multi-step business operations. Thin controllers → service object → return result struct. Never put complex logic in controllers or models.
35
+ - Keep models focused: validations, associations, scopes. Move complex queries to query objects (`app/queries/`) and complex callbacks to dedicated observers / commands.
36
+
37
+ ## Rails 8.x
38
+
39
+ - Rails 8.0 is the floor (Nov 2024 release). It bundles SolidQueue, SolidCache, and SolidCable — drop Redis-only deployments for new apps unless throughput requires it.
40
+ - Hotwire (Turbo + Stimulus) is the default for interactive UI — no separate SPA. Use `turbo_frame_tag` and `turbo_stream` responses for in-page updates without writing custom JavaScript.
41
+ - Authentication: built-in `bin/rails generate authentication` scaffold (Rails 8 default). Use `Devise` only if the project needs OAuth / SAML out of the box.
42
+ - Skip Webpacker — use the bundled `propshaft` asset pipeline + `importmap-rails` for ESM imports without a Node build step. Use `jsbundling-rails` (esbuild/rollup/vite) only when the project needs heavy JS tooling.
43
+
44
+ ## ActiveRecord
45
+
46
+ - Define explicit `strong_parameters` in controllers (`params.expect(user: [:name, :email])`). Mass-assignment vulnerabilities are real.
47
+ - N+1 query prevention: eager-load with `.includes(:association)` or `.preload(:association)`. Use the `bullet` gem in development + CI to detect N+1 patterns.
48
+ - Avoid `Model.all.each` over large tables — use `find_each(batch_size: 100)` for batched iteration with constant memory.
49
+ - Migrations are forward-only in production. Mark destructive migrations with `safety_assured` (`strong_migrations` gem) only after review. Run migrations in a separate deploy step from code rollout to maintain rollback ability.
50
+ - Use `optimize_for_inference_of_query` for complex scopes; avoid hand-written SQL strings (use Arel or query objects for parameterized custom SQL).
51
+
52
+ ## Hotwire & ViewComponent
53
+
54
+ - Turbo Frames (`turbo_frame_tag`) for in-page partial updates. Turbo Streams (`turbo_stream.replace`, `.append`, `.update`) for server-pushed UI updates over WebSocket / Server-Sent Events.
55
+ - Stimulus controllers for client-side interactivity (`app/javascript/controllers/`). Keep controllers small (≤100 lines). Use Stimulus values + classes for state; never reach into other controllers' DOM.
56
+ - ViewComponent (`view_component` gem) for testable, reusable UI components. Each component has a `*.rb` class and `*.html.erb` template with co-located preview (`spec/components/<name>_preview.rb`).
57
+ - Avoid jQuery and ad-hoc JavaScript files — Stimulus and Turbo cover 90% of interactivity needs in Rails apps.
58
+
59
+ ## Background Jobs
60
+
61
+ - Active Job with SolidQueue (Rails 8 default), Sidekiq (Redis-backed), or GoodJob (Postgres-backed). Pick one and document in `docs/architecture.md`.
62
+ - Configure retry policy explicitly: `retry_on StandardError, attempts: 3, wait: :exponentially_longer`. Default retry-forever is a footgun.
63
+ - Idempotency keys for jobs touching external APIs — pass the key as a job argument, persist on first execution, no-op on retry with same key.
64
+ - Set queue priorities: `queue_as :critical | :default | :low`. Critical for user-facing latency-sensitive work, low for background reporting.
65
+
66
+ ## Testing
67
+
68
+ - RSpec (`rspec-rails`) for new projects — `Capybara` for system tests. Minitest is acceptable for legacy / official-Rails-pattern projects.
69
+ - Test types under `spec/`:
70
+ - `spec/models/`, `spec/services/`, `spec/jobs/` — unit tests.
71
+ - `spec/requests/` — request specs (full middleware stack, faster than feature specs).
72
+ - `spec/system/` — system tests (Capybara + headless Chrome).
73
+ - Database cleanup: `database_cleaner-active_record` with `:truncation` for system tests, transactional fixtures for unit tests. Never use `DatabaseCleaner` against production-like data.
74
+ - Mock HTTP with `webmock` + VCR for cassette-based replay. Never hit real network in tests.
75
+ - Factory definitions in `spec/factories/` with `factory_bot_rails`. Avoid fixtures — they become stale and tightly coupled.
76
+ - Coverage: `simplecov` with floor 80% in `app/`; 90% in `app/services/` and `app/policies/`.
77
+
78
+ ## Security
79
+
80
+ - Brakeman in CI: `bundle exec brakeman --no-pager`. Block merge on high-confidence warnings.
81
+ - Strong parameters on every controller action that mutates state. Never `params.permit!` blindly.
82
+ - Authorization via Pundit policies (`app/policies/`). Controllers call `authorize @post` before mutations. Never authorize in views — too late.
83
+ - CSRF: Rails enables `protect_from_forgery` by default. Do not disable globally; disable per-action only for explicit API endpoints with token auth.
84
+ - Encrypted credentials: `bin/rails credentials:edit` for secrets at rest. Never commit `master.key` to VCS.
85
+
86
+ ## Bundler & Dependency Hygiene
87
+
88
+ - Pin gems in `Gemfile` with pessimistic version constraints (`~> 7.2`). Avoid `gem 'foo'` without a version pin.
89
+ - `Gemfile.lock` committed for applications. Library gems typically omit the lock.
90
+ - Vulnerability scanning: `bundle audit --update` against the rubysec/ruby-advisory-db. Block merge on advisories without acknowledged remediation.
91
+ - License compliance: `license_finder` with an allowlist. Block GPL contamination.
92
+
93
+ ## Performance
94
+
95
+ - YJIT enabled in production (`config/boot.rb`: `RubyVM::YJIT.enable`). Verify with `ruby --yjit --version`.
96
+ - Profile with `rack-mini-profiler` in dev / staging; `vernier` or `stackprof` for production captures.
97
+ - Use `Bullet` to catch N+1 queries in dev / CI. Treat N+1 violations as test failures.
98
+ - Cache layer: `Rails.cache.fetch` for read-heavy data with explicit TTL. Use Solid Cache (Rails 8 default), Memcached, or Redis — pin one per environment.
99
+
100
+ ## References
101
+
102
+ - Ruby 3.3 release notes: https://www.ruby-lang.org/en/news/2023/12/25/ruby-3-3-0-released/ (accessed 2026-05-27, official-docs)
103
+ - Rails 8 release notes: https://rubyonrails.org/2024/11/8/Rails-8-no-paas-required (accessed 2026-05-27, official-docs)
104
+ - Hotwire docs: https://hotwired.dev/ (accessed 2026-05-27, official-docs)
105
+ - ViewComponent: https://viewcomponent.org/ (accessed 2026-05-27, official-docs)
106
+
107
+ ## Cross-References
108
+
109
+ - `rules/hatch3r-api-design.md` — REST contract floors apply to Rails API endpoints.
110
+ - `rules/hatch3r-testing.md` — coverage thresholds carry over to `bundle exec rspec` + SimpleCov.
111
+ - `rules/hatch3r-secrets-management.md` — credentials and `.env` handling patterns.
@@ -0,0 +1,106 @@
1
+ ---
2
+ description: Ruby 3.3+ and Rails 8.x conventions covering Hotwire (Turbo + Stimulus), ActiveRecord patterns, Sidekiq jobs, RSpec testing, RuboCop / Standard, and YJIT performance
3
+ globs: ["**/*.rb", "**/*.rake", "**/Gemfile", "**/Gemfile.lock", "**/Rakefile", "**/config.ru", "**/.rubocop.yml", "**/.rubocop.yaml", "**/.standard.yml", "**/app/**", "**/config/**", "**/db/migrate/**", "**/lib/**", "**/spec/**", "**/test/**"]
4
+ alwaysApply: false
5
+ ---
6
+ # Ruby / Rails Patterns
7
+
8
+ **Pillars:** P2 (Scientific & Practical Quality), CQ8 (Maintainability Quality)
9
+
10
+ > Applies when the project ships a Ruby application. Detection signals: `Gemfile` at repo root, `config/application.rb` (Rails), `.ruby-version`, or any `*.rb` file. Sinatra and Hanami projects share most of the Ruby-level guidance here.
11
+
12
+ ## Ruby Language Floor
13
+
14
+ - Target Ruby 3.3+ (3.4 recommended for new projects). Use pattern matching (`case/in`), rightward assignment (`x => y`), endless methods (`def square(x) = x * x`) when they improve readability — not as defaults.
15
+ - Enable YJIT in production (`--yjit` flag or `RUBY_YJIT_ENABLE=1`). YJIT delivers 15–25% throughput improvements on Rails workloads with no code changes.
16
+ - Sorbet (`sorbet-runtime`) or RBS (`steep`) for gradual typing. Type-check business logic and public API surfaces; skip view code and trivial helpers.
17
+ - Format with Standard Ruby (`standardrb`) or RuboCop with `rubocop-rails` + `rubocop-rspec`. Pin in CI; reformat-on-save in editors.
18
+
19
+ ## Project Layout (Rails)
20
+
21
+ - Default Rails structure:
22
+ - `app/models/` — ActiveRecord models and POROs.
23
+ - `app/controllers/` — controllers (HTTP only).
24
+ - `app/views/` — templates (ERB / Slim / HAML).
25
+ - `app/components/` — ViewComponent (`view_component` gem) for reusable UI components.
26
+ - `app/services/<Domain>/` — service objects (single public `call` method).
27
+ - `app/jobs/` — Active Job / Sidekiq workers.
28
+ - `app/policies/` — Pundit policies (or equivalent authorization).
29
+ - Service objects (`app/services/`) for multi-step business operations. Thin controllers → service object → return result struct. Never put complex logic in controllers or models.
30
+ - Keep models focused: validations, associations, scopes. Move complex queries to query objects (`app/queries/`) and complex callbacks to dedicated observers / commands.
31
+
32
+ ## Rails 8.x
33
+
34
+ - Rails 8.0 is the floor (Nov 2024 release). It bundles SolidQueue, SolidCache, and SolidCable — drop Redis-only deployments for new apps unless throughput requires it.
35
+ - Hotwire (Turbo + Stimulus) is the default for interactive UI — no separate SPA. Use `turbo_frame_tag` and `turbo_stream` responses for in-page updates without writing custom JavaScript.
36
+ - Authentication: built-in `bin/rails generate authentication` scaffold (Rails 8 default). Use `Devise` only if the project needs OAuth / SAML out of the box.
37
+ - Skip Webpacker — use the bundled `propshaft` asset pipeline + `importmap-rails` for ESM imports without a Node build step. Use `jsbundling-rails` (esbuild/rollup/vite) only when the project needs heavy JS tooling.
38
+
39
+ ## ActiveRecord
40
+
41
+ - Define explicit `strong_parameters` in controllers (`params.expect(user: [:name, :email])`). Mass-assignment vulnerabilities are real.
42
+ - N+1 query prevention: eager-load with `.includes(:association)` or `.preload(:association)`. Use the `bullet` gem in development + CI to detect N+1 patterns.
43
+ - Avoid `Model.all.each` over large tables — use `find_each(batch_size: 100)` for batched iteration with constant memory.
44
+ - Migrations are forward-only in production. Mark destructive migrations with `safety_assured` (`strong_migrations` gem) only after review. Run migrations in a separate deploy step from code rollout to maintain rollback ability.
45
+ - Use `optimize_for_inference_of_query` for complex scopes; avoid hand-written SQL strings (use Arel or query objects for parameterized custom SQL).
46
+
47
+ ## Hotwire & ViewComponent
48
+
49
+ - Turbo Frames (`turbo_frame_tag`) for in-page partial updates. Turbo Streams (`turbo_stream.replace`, `.append`, `.update`) for server-pushed UI updates over WebSocket / Server-Sent Events.
50
+ - Stimulus controllers for client-side interactivity (`app/javascript/controllers/`). Keep controllers small (≤100 lines). Use Stimulus values + classes for state; never reach into other controllers' DOM.
51
+ - ViewComponent (`view_component` gem) for testable, reusable UI components. Each component has a `*.rb` class and `*.html.erb` template with co-located preview (`spec/components/<name>_preview.rb`).
52
+ - Avoid jQuery and ad-hoc JavaScript files — Stimulus and Turbo cover 90% of interactivity needs in Rails apps.
53
+
54
+ ## Background Jobs
55
+
56
+ - Active Job with SolidQueue (Rails 8 default), Sidekiq (Redis-backed), or GoodJob (Postgres-backed). Pick one and document in `docs/architecture.md`.
57
+ - Configure retry policy explicitly: `retry_on StandardError, attempts: 3, wait: :exponentially_longer`. Default retry-forever is a footgun.
58
+ - Idempotency keys for jobs touching external APIs — pass the key as a job argument, persist on first execution, no-op on retry with same key.
59
+ - Set queue priorities: `queue_as :critical | :default | :low`. Critical for user-facing latency-sensitive work, low for background reporting.
60
+
61
+ ## Testing
62
+
63
+ - RSpec (`rspec-rails`) for new projects — `Capybara` for system tests. Minitest is acceptable for legacy / official-Rails-pattern projects.
64
+ - Test types under `spec/`:
65
+ - `spec/models/`, `spec/services/`, `spec/jobs/` — unit tests.
66
+ - `spec/requests/` — request specs (full middleware stack, faster than feature specs).
67
+ - `spec/system/` — system tests (Capybara + headless Chrome).
68
+ - Database cleanup: `database_cleaner-active_record` with `:truncation` for system tests, transactional fixtures for unit tests. Never use `DatabaseCleaner` against production-like data.
69
+ - Mock HTTP with `webmock` + VCR for cassette-based replay. Never hit real network in tests.
70
+ - Factory definitions in `spec/factories/` with `factory_bot_rails`. Avoid fixtures — they become stale and tightly coupled.
71
+ - Coverage: `simplecov` with floor 80% in `app/`; 90% in `app/services/` and `app/policies/`.
72
+
73
+ ## Security
74
+
75
+ - Brakeman in CI: `bundle exec brakeman --no-pager`. Block merge on high-confidence warnings.
76
+ - Strong parameters on every controller action that mutates state. Never `params.permit!` blindly.
77
+ - Authorization via Pundit policies (`app/policies/`). Controllers call `authorize @post` before mutations. Never authorize in views — too late.
78
+ - CSRF: Rails enables `protect_from_forgery` by default. Do not disable globally; disable per-action only for explicit API endpoints with token auth.
79
+ - Encrypted credentials: `bin/rails credentials:edit` for secrets at rest. Never commit `master.key` to VCS.
80
+
81
+ ## Bundler & Dependency Hygiene
82
+
83
+ - Pin gems in `Gemfile` with pessimistic version constraints (`~> 7.2`). Avoid `gem 'foo'` without a version pin.
84
+ - `Gemfile.lock` committed for applications. Library gems typically omit the lock.
85
+ - Vulnerability scanning: `bundle audit --update` against the rubysec/ruby-advisory-db. Block merge on advisories without acknowledged remediation.
86
+ - License compliance: `license_finder` with an allowlist. Block GPL contamination.
87
+
88
+ ## Performance
89
+
90
+ - YJIT enabled in production (`config/boot.rb`: `RubyVM::YJIT.enable`). Verify with `ruby --yjit --version`.
91
+ - Profile with `rack-mini-profiler` in dev / staging; `vernier` or `stackprof` for production captures.
92
+ - Use `Bullet` to catch N+1 queries in dev / CI. Treat N+1 violations as test failures.
93
+ - Cache layer: `Rails.cache.fetch` for read-heavy data with explicit TTL. Use Solid Cache (Rails 8 default), Memcached, or Redis — pin one per environment.
94
+
95
+ ## References
96
+
97
+ - Ruby 3.3 release notes: https://www.ruby-lang.org/en/news/2023/12/25/ruby-3-3-0-released/ (accessed 2026-05-27, official-docs)
98
+ - Rails 8 release notes: https://rubyonrails.org/2024/11/8/Rails-8-no-paas-required (accessed 2026-05-27, official-docs)
99
+ - Hotwire docs: https://hotwired.dev/ (accessed 2026-05-27, official-docs)
100
+ - ViewComponent: https://viewcomponent.org/ (accessed 2026-05-27, official-docs)
101
+
102
+ ## Cross-References
103
+
104
+ - `rules/hatch3r-api-design.md` — REST contract floors apply to Rails API endpoints.
105
+ - `rules/hatch3r-testing.md` — coverage thresholds carry over to `bundle exec rspec` + SimpleCov.
106
+ - `rules/hatch3r-secrets-management.md` — credentials and `.env` handling patterns.