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,119 @@
1
+ ---
2
+ id: hatch3r-orchestration-frame
3
+ type: shared-context
4
+ description: Single source of truth for cross-cutting orchestrator-command boilerplate — checkpoint contract, cost-estimate block, and Per-Turn Pipeline-State Header. Cited by long-running commands via a one-line pointer instead of restating the blocks.
5
+ tags: [orchestration, reference]
6
+ quality_charter: agents/shared/quality-charter.md
7
+ cache_friendly: true
8
+ ---
9
+
10
+ # Orchestration Frame (shared command boilerplate)
11
+
12
+ > Last updated: 2026-06-09
13
+ > Pillars: P4 (Lean Coverage, primary — kills the ~30-file restatement of these six blocks), P7 (Speed & Token Efficiency, supporting — static cacheable frame).
14
+
15
+ Six cross-cutting blocks recur near-verbatim across the `commands/hatch3r-*.md` orchestrators (§0 Detect Ambiguity ×30, Confidence Propagation Contract ×26, checkpoint contract ×28, Per-Turn Pipeline-State Header ×29, End-of-Turn Delegation Attestation ×30, `cost_estimate` block ×30 at the D22-4 measurement). This file is their single source of truth. A command cites the block it needs with a one-line pointer and supplies only its per-command slots (ambiguity triggers, workspace directory, step range, doc directories, phase mapping, mutated-file list). The authoritative rule for each block is named in its section; this frame is the command-facing restatement, not a competing definition.
16
+
17
+ Citation template (drop into the command where the block used to live):
18
+
19
+ ```
20
+ > Orchestration boilerplate: see `commands/shared/orchestration-frame.md` → {§0 Detect Ambiguity | Confidence Propagation Contract | Checkpoint Contract | Cost Estimate | Per-Turn Pipeline-State Header | End-of-Turn Delegation Attestation}. Per-command slot: <the one varying detail — trigger list, workspace dir, phase mapping, mutated-file list, …>.
21
+ ```
22
+
23
+ `<…>` slots below are the only text a command varies; everything outside them is invariant and lives here.
24
+
25
+ ---
26
+
27
+ ## §0 Detect Ambiguity (P8 B1)
28
+
29
+ Authoritative rule: `rules/hatch3r-clarification-default.md` (B1 directive); framework-dev mirror `.claude/rules/clarification-default.md`. This is the orchestrator-context body — commands run in the main conversation, so they invoke the platform-native question tool directly (unlike Task-tool sub-agents, which return `BLOCKED_AMBIGUITY` per `agents/shared/clarification-default-block.md`).
30
+
31
+ Before any action, scan the user's request and provided context for unresolved questions in scope, acceptance criteria, irreversibility, or constraint conflicts. If any are found, ask the user via the platform-native question tool per `agents/shared/user-question-protocol.md` — do not proceed under silent assumption. This is the default path, not an exception. Acceptable to proceed without asking ONLY when scope is single-target, single-concern, and the brief alone is testable. Any residual ambiguity discovered mid-workflow invokes the same protocol.
32
+
33
+ Per-command slot: an optional one-line trigger list naming the command's domain-specific ambiguities (e.g. for `hatch3r-auth-scaffold`: "which flow(s) to scaffold, the OIDC issuer, public vs confidential client"). The inline trigger line at the citation site is the single source of truth for that command's triggers; this frame keeps no parallel table.
34
+
35
+ ---
36
+
37
+ ## Confidence Propagation Contract
38
+
39
+ Authoritative rule: `agents/shared/quality-charter.md` §1 (confidence expression). Every sub-agent delegation prompt in a command MUST include the confidence expression requirement below verbatim. Sub-agents carry the `quality_charter` reference in frontmatter, but the orchestrator repeats the directive to override runtime prompt defaults per charter §1.
40
+
41
+ > Confidence expression requirement: rate every recommendation and finding as high/medium/low confidence per the quality charter (`agents/shared/quality-charter.md`). High = verified against current code. Medium = pattern-based, not fully verified. Low = best judgment, recommend human review.
42
+
43
+ Downstream propagation: every ASK checkpoint that reports verification quality, every gate that evaluates a sub-agent verdict, and every output block that surfaces `<readiness-kind>` readiness MUST carry a high/medium/low confidence rating sourced from the upstream sub-agent. Dropping the signal between stages is a gate failure.
44
+
45
+ Per-command slot: `<readiness-kind>` (e.g. plan / spec / merge / map / fix readiness) plus any command-specific propagation points (statistical-significance verdicts, severity classifications, market-research caveats) that carry the signal.
46
+
47
+ ---
48
+
49
+ ## Effort Override (Decision 17)
50
+
51
+ Authoritative contract: hatch3r's universal `--effort` override ("User overridable via `--effort` flag", CONSTITUTION §6 Decision 17). Auto-tiering can misclassify (a single-module change scored Deep, or a cross-cutting one scored Light); the override is the recovery path. The invariant body:
52
+
53
+ - `--effort=light|standard|deep` forces the named tier, bypassing the command's Step 0 auto-classification.
54
+ - The override wins over the auto-detected tier; record both the auto-detected tier and the override in the run context so the Cost Estimate block reports the budget delta.
55
+ - No override passed → the auto-classification stands.
56
+
57
+ Per-command slot: a one-line misclassification example in the command's own domain (e.g. "a single-endpoint doc tweak scored as Deep").
58
+
59
+ ---
60
+
61
+ ## Checkpoint Contract
62
+
63
+ Authoritative module: `src/pipeline/checkpoint.ts`. Restated here for long-running planning commands (feature-plan, bug-plan, test-plan, migration-plan, refactor-plan, and peers) so an interrupted run re-enters at the last completed step instead of re-running its full fan-out.
64
+
65
+ 1. **Workspace + file:** write `<workspace-dir>/checkpoint.json` via `writeCheckpoint()` (atomic temp+rename through `src/merge/safeWrite.ts`; a SIGKILL mid-write leaves the prior checkpoint or no file, never a partial record). Schema (`schemaVersion: 1`): `phase` (the `<step-range>` progression), `wave` (`<wave-semantics>`, e.g. researcher-batch index across the parallel modes), `status` (`in-progress` | `passed` | `failed`), and `meta` `{ baselineSha, lastPassedGateN, registrySha, timestamp, <slug-or-version-fields> }`.
66
+ 2. **Write points:** after each milestone the command declares — context lock, scope ASK, each fan-out batch return, each synthesis ASK confirmation, each file write under `<doc-dirs>`, and the optional chain-to-`hatch3r-board-fill` handoff — so already-generated artifacts survive a crash and are not regenerated on resume. Commands list their own ordered write points.
67
+ 3. **`--resume` invocation:** `<command-name> --resume` calls `readCheckpoint()` then `verifyResumability(workspace, currentSha)`. Baseline drift fails closed (the repo or any path under `<doc-dirs>` / `todo.md` changed since the checkpoint) — re-run from scratch or rebase to the checkpoint baseline. A `failed` status halts for operator triage before resuming.
68
+ 4. **Snapshot rollback:** pre-mutation snapshots of every path under `<doc-dirs>` and `todo.md` land in `.hatch3r/snapshots/<session-id>/`; `hatch3r rollback --session=<id>` reverts this run's writes. Diff preview precedes every file write per Decision 30.
69
+
70
+ If `--resume` is passed with no checkpoint, `verifyResumability` returns `drift: "no checkpoint found"` — treat as a cold start.
71
+
72
+ ---
73
+
74
+ ## Cost Estimate
75
+
76
+ Authoritative rule: `rules/hatch3r-cost-visibility.md`; primitives: `src/pipeline/observability.ts::buildCostBlock` (actuals) and `src/pipeline/costEstimator.ts` (estimate). CONSTITUTION §6 Decision 24/29.
77
+
78
+ **Pre-execution `cost_estimate`** — emit before the first sub-agent dispatch (5-field schema):
79
+
80
+ ```yaml
81
+ cost_estimate:
82
+ expected_sa_count: <int>
83
+ estimated_input_tokens_static_frame: <int>
84
+ estimated_web_research_queries: <int> # 0 when no research is needed
85
+ triage_tier: light | standard | deep
86
+ estimated_duration_min: <int>
87
+ ```
88
+
89
+ `expected_sa_count` is calibrated from the command's frontmatter `sub_agents_spawned.count` × the tier heuristic in `rules/hatch3r-cost-visibility.md` → Pre-Execution Estimate. Each command supplies its own per-tier numbers (e.g. `<tier1-count>` / `<tier2-count>` / `<tier3-count>`).
90
+
91
+ **Post-execution `cost_actuals` + `delta`** — call `buildCostBlock` again with actuals; both land in the iteration summary's Fan-out + Cost section per `rules/hatch3r-iteration-summary.md` §2. Deltas beyond 25% absolute value carry `flagged_for_review: true`. Field contract + delta semantics: `rules/hatch3r-cost-visibility.md`.
92
+
93
+ ---
94
+
95
+ ## Per-Turn Pipeline-State Header
96
+
97
+ Authoritative rule: `rules/hatch3r-agent-orchestration.md` → Per-Turn Pipeline-State Header. For Tier 2 and Tier 3 runs, emit the header at the start of every assistant turn that touches the task. Tier 1, read-only, and chat-only turns are exempt.
98
+
99
+ ```
100
+ [hatch3r-pipeline: phase {1|2|3|4} | last: {agent} → {SUCCESS|PARTIAL|FAILED|BLOCKED|n/a} | next: {agent or "user-confirmation" or "complete"}]
101
+ ```
102
+
103
+ Phase mapping is per-command — each command maps phases `1`–`4` onto its own steps (e.g. `<phase-mapping>`: intake/decomposition → sub-agent dispatch → synthesis → write + iteration-summary). A missing header on a tracked Tier ≥ 2 task is a self-detectable drift signal; the user may halt and re-ground.
104
+
105
+ ---
106
+
107
+ ## End-of-Turn Delegation Attestation
108
+
109
+ Authoritative rule: `rules/hatch3r-agent-orchestration.md` → End-of-Turn Delegation Attestation. Every turn that mutated files at Tier 2 or Tier 3 emits this block immediately before the Iteration Summary, quoting verbatim each spawned sub-agent's `delegation_proof_id`:
110
+
111
+ ```
112
+ [hatch3r-delegation-attestation]
113
+ files_mutated_this_turn:
114
+ - <relative path>: via <hatch3r-agent-name> (proof: <delegation_proof_id>)
115
+ mutating_subagent_invocations: <integer>
116
+ inline_edits_by_orchestrator: none
117
+ ```
118
+
119
+ Unattributable rows are a self-declared P8 B2 violation — halt and queue re-delegation next turn. The block sits beside the Iteration Summary, not inside it, preserving the iteration-summary contract verbatim.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: hatch3r-docs-agent
3
3
  type: github-agent
4
- description: Technical writer who maintains specs, ADRs, and documentation
4
+ description: 'Technical writer who maintains specs, ADRs, and documentation'
5
5
  # Simplified agent for GitHub Copilot/Codex
6
6
  tags: [devops, ctx:team-only]
7
7
  quality_charter: agents/shared/quality-charter.md
@@ -11,6 +11,26 @@ cache_friendly: true
11
11
 
12
12
  You are an expert technical writer for the project.
13
13
 
14
+ ## §0 Detect Ambiguity (P8 B1)
15
+
16
+ Before any action, scan the brief for unresolved questions in scope, acceptance criteria, irreversibility, or constraint conflicts (which docs, whether a spec section may be restructured, which stable IDs apply). If any are found, ask via the platform-native question surface per `agents/shared/user-question-protocol.md` — for GitHub Copilot/Codex cloud agents, that surface is a PR comment or issue clarification. Do not proceed under silent assumption. This is the default path, not an exception. Acceptable to proceed without asking ONLY when scope is single-file, single-concern, and the brief alone is testable.
17
+
18
+ ### Plain-Text Fallback Template (D5-M6)
19
+
20
+ When the runtime has no platform-native question tool (GitHub Copilot/Codex cloud agents post to a PR comment or issue body — plain Markdown), emit the question using this exact shape:
21
+
22
+ ```
23
+ **Question:** <one-sentence question stating the choice>
24
+
25
+ 1. <Option A> — <one-line rationale or trade-off>
26
+ 2. <Option B> — <one-line rationale or trade-off>
27
+ 3. <Option C> — <one-line rationale or trade-off>
28
+
29
+ Default if no response: <option number, e.g., 2>
30
+ ```
31
+
32
+ Rules: 2-4 numbered options, each with a one-line trade-off; the `Default if no response:` line is mandatory and names the safest reversible choice. Do not silent-pick — if no default was emitted with the question, return `BLOCKED_AMBIGUITY` in the structured result instead of guessing.
33
+
14
34
  ## Your Role
15
35
 
16
36
  - You read code from `src/` and backend directories and update documentation in `docs/`.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: hatch3r-lint-agent
3
3
  type: github-agent
4
- description: Code quality enforcer who fixes style, formatting, and type issues
4
+ description: 'Code quality enforcer who fixes style, formatting, and type issues'
5
5
  # Simplified agent for GitHub Copilot/Codex
6
6
  tags: [devops, ctx:team-only]
7
7
  quality_charter: agents/shared/quality-charter.md
@@ -11,6 +11,26 @@ cache_friendly: true
11
11
 
12
12
  You are a code quality engineer for the project.
13
13
 
14
+ ## §0 Detect Ambiguity (P8 B1)
15
+
16
+ Before any action, scan the brief for unresolved questions in scope, acceptance criteria, irreversibility, or constraint conflicts (which files or lint rulesets are in scope, whether an exported symbol may be renamed, whether a style fix risks altering behavior). If any are found, ask via the platform-native question surface per `agents/shared/user-question-protocol.md` — for GitHub Copilot/Codex cloud agents, that surface is a PR comment or issue clarification. Do not proceed under silent assumption. This is the default path, not an exception. Acceptable to proceed without asking ONLY when scope is single-file, single-concern, and the brief alone is testable.
17
+
18
+ ### Plain-Text Fallback Template (D5-M6)
19
+
20
+ When the runtime has no platform-native question tool (GitHub Copilot/Codex cloud agents post to a PR comment or issue body — plain Markdown), emit the question using this exact shape:
21
+
22
+ ```
23
+ **Question:** <one-sentence question stating the choice>
24
+
25
+ 1. <Option A> — <one-line rationale or trade-off>
26
+ 2. <Option B> — <one-line rationale or trade-off>
27
+ 3. <Option C> — <one-line rationale or trade-off>
28
+
29
+ Default if no response: <option number, e.g., 2>
30
+ ```
31
+
32
+ Rules: 2-4 numbered options, each with a one-line trade-off; the `Default if no response:` line is mandatory and names the safest reversible choice. Do not silent-pick — if no default was emitted with the question, return `BLOCKED_AMBIGUITY` in the structured result instead of guessing.
33
+
14
34
  ## Your Role
15
35
 
16
36
  - You fix ESLint errors, Prettier formatting, TypeScript strict mode violations, and naming convention issues.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: hatch3r-security-agent
3
3
  type: github-agent
4
- description: Security analyst who audits code, rules, and data flows
4
+ description: 'Security analyst who audits code, rules, and data flows'
5
5
  # Simplified agent for GitHub Copilot/Codex
6
6
  tags: [devops, floor:security, ctx:team-only]
7
7
  quality_charter: agents/shared/quality-charter.md
@@ -11,6 +11,26 @@ cache_friendly: true
11
11
 
12
12
  You are an expert security analyst for the project.
13
13
 
14
+ ## §0 Detect Ambiguity (P8 B1)
15
+
16
+ Before any action, scan the brief for unresolved questions in scope, acceptance criteria, irreversibility, or constraint conflicts (which threat model or trust boundary applies, whether a security rule may be loosened, which collections or endpoints are in scope). If any are found, ask via the platform-native question surface per `agents/shared/user-question-protocol.md` — for GitHub Copilot/Codex cloud agents, that surface is a PR comment or issue clarification. Do not proceed under silent assumption. This is the default path, not an exception. Acceptable to proceed without asking ONLY when scope is single-file, single-concern, and the brief alone is testable.
17
+
18
+ ### Plain-Text Fallback Template (D5-M6)
19
+
20
+ When the runtime has no platform-native question tool (GitHub Copilot/Codex cloud agents post to a PR comment or issue body — plain Markdown), emit the question using this exact shape:
21
+
22
+ ```
23
+ **Question:** <one-sentence question stating the choice>
24
+
25
+ 1. <Option A> — <one-line rationale or trade-off>
26
+ 2. <Option B> — <one-line rationale or trade-off>
27
+ 3. <Option C> — <one-line rationale or trade-off>
28
+
29
+ Default if no response: <option number, e.g., 2>
30
+ ```
31
+
32
+ Rules: 2-4 numbered options, each with a one-line trade-off; the `Default if no response:` line is mandatory and names the safest reversible choice. Do not silent-pick — if no default was emitted with the question, return `BLOCKED_AMBIGUITY` in the structured result instead of guessing.
33
+
14
34
  ## Your Role
15
35
 
16
36
  - You audit database security rules, API endpoints, event metadata, and data flows.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: hatch3r-test-agent
3
3
  type: github-agent
4
- description: QA engineer who writes and maintains tests
4
+ description: 'QA engineer who writes and maintains tests'
5
5
  # Simplified agent for GitHub Copilot/Codex
6
6
  tags: [review, ctx:team-only]
7
7
  quality_charter: agents/shared/quality-charter.md
@@ -11,6 +11,26 @@ cache_friendly: true
11
11
 
12
12
  You are an expert QA engineer for the project.
13
13
 
14
+ ## §0 Detect Ambiguity (P8 B1)
15
+
16
+ Before any action, scan the brief for unresolved questions in scope, acceptance criteria, irreversibility, or constraint conflicts (which behavior is under test, whether an existing test may be modified or deleted, which coverage target applies). If any are found, ask via the platform-native question surface per `agents/shared/user-question-protocol.md` — for GitHub Copilot/Codex cloud agents, that surface is a PR comment or issue clarification. Do not proceed under silent assumption. This is the default path, not an exception. Acceptable to proceed without asking ONLY when scope is single-file, single-concern, and the brief alone is testable.
17
+
18
+ ### Plain-Text Fallback Template (D5-M6)
19
+
20
+ When the runtime has no platform-native question tool (GitHub Copilot/Codex cloud agents post to a PR comment or issue body — plain Markdown), emit the question using this exact shape:
21
+
22
+ ```
23
+ **Question:** <one-sentence question stating the choice>
24
+
25
+ 1. <Option A> — <one-line rationale or trade-off>
26
+ 2. <Option B> — <one-line rationale or trade-off>
27
+ 3. <Option C> — <one-line rationale or trade-off>
28
+
29
+ Default if no response: <option number, e.g., 2>
30
+ ```
31
+
32
+ Rules: 2-4 numbered options, each with a one-line trade-off; the `Default if no response:` line is mandatory and names the safest reversible choice. Do not silent-pick — if no default was emitted with the question, return `BLOCKED_AMBIGUITY` in the structured result instead of guessing.
33
+
14
34
  ## Your Role
15
35
 
16
36
  - You write unit tests, integration tests, contract tests, and E2E tests.
@@ -32,4 +32,4 @@ When this hook fires, the assigned agent should:
32
32
 
33
33
  - **Globs**: Controlled by the `globs` frontmatter field. Adjust to match your project's source file extensions.
34
34
  - **Rule sources**: Reads from `rules/`. Rules with matching `globs` or `scope: always` are activated.
35
- - **Debounce**: To avoid excessive processing during rapid saves, the agent debounces with a 2-second window (configurable via `debounceMs`).
35
+ - **Debounce**: To avoid excessive processing during rapid saves, the agent debounces with a 2-second window (configurable via `debounceMs`). Coalescing is trailing-edge — within the debounce window the most-recent save wins and the hook fires once, `debounceMs` after the last save event; intermediate saves in the window do not fire.
@@ -1,16 +1,16 @@
1
1
  ---
2
- id: pre-push-security-auditor
2
+ id: pre-push-security
3
3
  type: hook
4
4
  event: pre-push
5
- agent: security-auditor
5
+ agent: security
6
6
  description: Scan for secrets and security issues before push
7
7
  tags: [floor:security]
8
8
  quality_charter: agents/shared/quality-charter.md
9
9
  cache_friendly: true
10
10
  ---
11
- # Hook: pre-push → security-auditor
11
+ # Hook: pre-push → security
12
12
 
13
- Activate the security-auditor agent before pushing to scan for accidentally committed secrets, API keys, credentials, and other security-sensitive content.
13
+ Activate the security agent before pushing to scan for accidentally committed secrets, API keys, credentials, and other security-sensitive content.
14
14
 
15
15
  ## Agent Behavior
16
16
 
@@ -0,0 +1,52 @@
1
+ ---
2
+ id: hatch3r-review-loop-cap
3
+ type: hook
4
+ event: review-loop-cap
5
+ agent: reviewer
6
+ description: Block fixer-spawn past the configured review-loop iteration ceiling via a `.review-loop.json` checkpoint
7
+ tags: [orchestration, floor:security]
8
+ quality_charter: agents/shared/quality-charter.md
9
+ cache_friendly: true
10
+ ---
11
+ # Hook: review-loop-cap → review-loop-cap-enforcer
12
+
13
+ Activate the review-loop-cap-enforcer when the orchestrator attempts to spawn `hatch3r-fixer` after `hatch3r-reviewer` returned non-clean. The hook reads, increments, and gates a per-issue iteration counter so the Phase 3 review-fix loop cannot run unbounded.
14
+
15
+ This hook closes the F15.2-H1 gap surfaced in cycle 10: the runtime `src/pipeline/reviewLoop.ts` carries `DEFAULT_MAX_REVIEW_ITERATIONS = 4` and `HARD_MAX_REVIEW_ITERATIONS = 10`, but no canonical hook artifact instructs adapters to materialize the cap as an enforced gate. Without this hook the bound exists in code but does not propagate into generated end-user agent setups.
16
+
17
+ ## Event Mapping
18
+
19
+ The neutral event name `review-loop-cap` is the canonical surface. Per-adapter mappings:
20
+
21
+ - **Claude Code:** `Stop` event, OR `PostToolUse` with `matcher: "Task"` filtered to fixer-spawn invocations.
22
+ - **Cursor:** no native runtime gate — advisory rule only (parity with GitHub Copilot below). The iteration-count gate needs the orchestrator's per-issue `.review-loop.json` counter context, which no Cursor hook payload carries; Cursor's real pre-tool event is `preToolUse` (NOT `pre-tool-call`), and its payload exposes no agent-identity field (cursor.com/docs/agent/hooks, accessed 2026-06-09), so it cannot bind to a fixer-spawn. Materialized as the `.cursor/rules/hatch3r-hook-hatch3r-review-loop-cap.mdc` advisory rule the Cursor adapter emits for every canonical hook.
23
+ - **GitHub Copilot:** no native equivalent — emitted as an advisory rule comment instead of a runtime gate.
24
+
25
+ ## Agent Behavior
26
+
27
+ When this hook fires, the assigned agent should:
28
+
29
+ 1. Identify the active issue or task ID from orchestrator context. If absent, derive a stable key from the current branch + first changed file path (deterministic hash).
30
+ 2. Read the per-issue checkpoint at `.hatch3r/review-loop/<issue-key>.review-loop.json`. If the file is absent, create it with `{ "iteration": 0, "createdAt": "<ISO 8601 UTC>", "maxIterations": <configured> }`.
31
+ 3. Increment `iteration` by 1. Persist via the safe-write temp+rename pattern (`src/merge/safeWrite.ts` semantics) so a crash mid-write leaves the prior counter intact.
32
+ 4. Compare incremented `iteration` against `maxIterations`:
33
+ - If `iteration <= maxIterations`: emit a structured pass-through with the new counter value and exit 0. Orchestrator proceeds with fixer-spawn.
34
+ - If `iteration > maxIterations`: emit a structured block. Exit 2 (non-zero halts the spawn). Include the issue key, the value of `maxIterations`, the iteration counter that triggered the block, and the next-step recommendation: "Reviewer findings remain after N iterations — escalate to maintainer review or accept current state. Reset via `rm .hatch3r/review-loop/<issue-key>.review-loop.json`."
35
+ 5. On block, write a one-line audit entry to `.hatch3r/review-loop/audit.log` with timestamp, issue key, hook outcome, and the reviewer's last non-clean verdict if available in context.
36
+
37
+ ## Expected Output
38
+
39
+ - **Pass-through:** `{ "outcome": "pass", "iteration": <N>, "maxIterations": <M>, "remaining": <M-N> }` written to stdout. Exit 0.
40
+ - **Block:** `{ "outcome": "block", "iteration": <N>, "maxIterations": <M>, "reason": "max_iterations_exceeded", "actionable_next_step": "<one sentence>" }` written to stdout. Exit 2.
41
+
42
+ ## Configuration
43
+
44
+ - **maxIterations:** Default 4 — held in lockstep with `src/pipeline/reviewLoop.ts::DEFAULT_MAX_REVIEW_ITERATIONS`. Override via `maxIterations` in hook config. Clamped to `[MIN_MAX_REVIEW_ITERATIONS, HARD_MAX_REVIEW_ITERATIONS]` = `[1, 10]` per the same module.
45
+ - **checkpointDir:** Default `.hatch3r/review-loop/`. Override via `checkpointDir` for projects that namespace `.hatch3r/` differently.
46
+ - **resetOnCleanVerdict:** Default `true`. When the reviewer returns a clean verdict, the orchestrator deletes the checkpoint so the next regression-fix run starts fresh. Set `false` to retain historical counters across reviewer passes.
47
+
48
+ ## Failure-Boundary Semantics
49
+
50
+ The hook itself is a circuit breaker scoped to the fixer-spawn boundary. It does not classify reviewer findings, terminate the review loop on its own authority, or invoke remediation. Its single contract: `iteration > maxIterations` MUST block fixer-spawn, no exception. Adapters that cannot emit a non-zero exit at the spawn site (Cursor and GitHub Copilot — see Event Mapping) render this hook as an advisory rule instead of a runtime gate; the README surface for those adapters declares the downgrade.
51
+
52
+ Cross-reference: `src/pipeline/reviewLoop.ts` (canonical state machine), `agents/hatch3r-implementer.md` → Review Loop Awareness (Phase 3 contract), `rules/hatch3r-agent-orchestration.md` (orchestrator delegation protocol).
@@ -2,10 +2,12 @@
2
2
  "mcpServers": {
3
3
  "github": {
4
4
  "_description": "GitHub repository management, code review, issues, PRs, and project boards",
5
+ "_trust_bypass": true,
6
+ "_trust_bypass_reason": "github-first-party",
5
7
  "url": "https://api.githubcopilot.com/mcp/",
6
8
  "headers": {
7
9
  "Authorization": "Bearer ${env:GITHUB_PAT}",
8
- "X-MCP-Toolsets": "all"
10
+ "X-MCP-Toolsets": "repos,issues,pull_requests"
9
11
  }
10
12
  },
11
13
  "context7": {
@@ -26,7 +28,7 @@
26
28
  "brave-search": {
27
29
  "_description": "Web research, fact-checking, and current information retrieval",
28
30
  "command": "npx",
29
- "args": ["-y", "@modelcontextprotocol/server-brave-search@0.6.2"],
31
+ "args": ["-y", "@brave/brave-search-mcp-server@2.0.83", "--transport", "stdio"],
30
32
  "env": {
31
33
  "BRAVE_API_KEY": "${env:BRAVE_API_KEY}"
32
34
  }
@@ -44,7 +46,7 @@
44
46
  "_disabled": true,
45
47
  "_description": "PostgreSQL database queries and schema inspection (enable and configure with your connection string)",
46
48
  "command": "npx",
47
- "args": ["-y", "@modelcontextprotocol/server-postgres@0.6.2"],
49
+ "args": ["-y", "@henkey/postgres-mcp-server@1.0.5"],
48
50
  "env": {
49
51
  "POSTGRES_URL": "${env:POSTGRES_URL}"
50
52
  }
@@ -71,8 +73,8 @@
71
73
  "gitlab": {
72
74
  "_disabled": true,
73
75
  "_description": "GitLab issues, merge requests, pipelines, and project management",
74
- "command": "npx",
75
- "args": ["-y", "glab", "mcp"],
76
+ "command": "glab",
77
+ "args": ["mcp", "serve"],
76
78
  "env": {
77
79
  "GITLAB_TOKEN": "${env:GITLAB_TOKEN}"
78
80
  }
@@ -2,7 +2,8 @@
2
2
  id: hatch3r-accessibility-standards
3
3
  type: rule
4
4
  description: Accessibility standards covering WCAG 2.2 AA compliance, keyboard navigation, screen readers, and ARIA patterns
5
- scope: "**/*.vue,**/*.jsx,**/*.tsx,**/*.svelte,**/components/**,**/*.html,**/*a11y*,**/*accessibility*"
5
+ scope: conditional
6
+ globs: "**/*.vue,**/*.jsx,**/*.tsx,**/*.svelte,**/components/**,**/*.html,**/*a11y*,**/*accessibility*"
6
7
  tags: [floor:ui-ux, a11y]
7
8
  precedence: high
8
9
  quality_charter: agents/shared/quality-charter.md
@@ -77,7 +78,7 @@ All user-facing features must meet WCAG 2.2 Level AA conformance. This is the ba
77
78
  - Test with a screen reader on every feature branch that modifies UI.
78
79
  - Minimum testing matrix: VoiceOver (macOS/iOS) + Chrome, NVDA + Firefox (Windows).
79
80
  - Run automated accessibility checks (axe-core, Lighthouse) in CI.
80
- - Automated tools catch ~30% of accessibility issues. Manual testing is required for keyboard flows, screen reader experience, and cognitive accessibility.
81
+ - Automated tools (axe-core) catch roughly 57% of WCAG issues by volume the remaining ~43% require a human keyboard trace, screen-reader pass, and cognitive-accessibility review (Deque Systems automated-coverage finding; https://www.deque.com/automated-accessibility-testing-coverage/ , accessed 2026-06-06). This figure matches `skills/hatch3r-browser-verify/SKILL.md` per-cycle reminder; the two artifacts state the same denominator.
81
82
  - Maintain an accessibility test checklist per component type (form, modal, navigation, data table).
82
83
 
83
84
  ## WCAG 2.2 New Success Criteria (Mandatory Audit Items)
@@ -100,3 +101,14 @@ Touch surfaces have stricter target and spacing requirements than pointer-only s
100
101
  - Apply `env(safe-area-inset-*)` padding on full-bleed surfaces so content clears notches, home indicators, and rounded corners on iOS and Android edge devices.
101
102
  - Support Dynamic Type (iOS) and rem-based font scaling — declare body text in `rem` or `em` units, never `px`, so OS-level font size settings cascade.
102
103
  - Zoom to 200% and 400% (per WCAG 1.4.4 and 1.4.10 Reflow) must remain functional with no horizontal scroll trap. Audit for `width: 100vw` and fixed pixel widths that break reflow.
104
+
105
+ ### Mobile-native verification path
106
+
107
+ The touch obligations above are mandated for native UI too, but native targets (React Native, Flutter, SwiftUI/UIKit, Android Compose/View) do not render to a DOM, so the browser gates (axe-core, Lighthouse) cannot run on them. The glob on this rule (`**/*.{tsx,jsx,vue,svelte}` plus `**/components/**`) matches React-Native `.tsx`/`.jsx` components, so a native surface can trigger this rule with no browser. Branch on the detected stack and run the framework-native accessibility check instead — a native obligation without one of these checks is unverified, not satisfied:
108
+
109
+ - **React Native:** run `eslint-plugin-react-native-a11y` for static touch-target, label, and role lint; assert touch-target size and `accessibilityLabel` presence in a `@testing-library/react-native` render test.
110
+ - **Flutter:** run the `flutter_test` semantics tester with `meets_guideline` matchers — `androidTapTargetGuideline()` (48dp), `iOSTapTargetGuideline()` (44pt), `labeledTapTargetGuideline()`, and `textContrastGuideline()` — which assert the same target and contrast bounds without a browser.
111
+ - **Android (Compose/View):** enable Espresso `AccessibilityChecks.enable()` in instrumented tests so every interaction is audited for target size and content labels; run Accessibility Scanner once per release on the built APK for spacing and contrast.
112
+ - **iOS (SwiftUI/UIKit):** run an XCUITest `app.performAccessibilityAudit()` (`for: [.dynamicType, .hitRegion, .contrast]`) so target size, Dynamic Type scaling, and contrast are checked on-device.
113
+
114
+ When no native a11y harness is wired for the detected stack, the gate is `BLOCKED_MISSING_TOOL` (per `agents/hatch3r-implementer.md` Step 5c) — it never becomes an unmeasured `PASS`; the orchestrator wires the harness or downgrades scope. Stack-specific patterns and the test-harness setup live in `rules/hatch3r-android-patterns.md`, `rules/hatch3r-swiftui-patterns.md`, and `rules/hatch3r-flutter-patterns.md`.
@@ -73,7 +73,7 @@ All user-facing features must meet WCAG 2.2 Level AA conformance. This is the ba
73
73
  - Test with a screen reader on every feature branch that modifies UI.
74
74
  - Minimum testing matrix: VoiceOver (macOS/iOS) + Chrome, NVDA + Firefox (Windows).
75
75
  - Run automated accessibility checks (axe-core, Lighthouse) in CI.
76
- - Automated tools catch ~30% of accessibility issues. Manual testing is required for keyboard flows, screen reader experience, and cognitive accessibility.
76
+ - Automated tools (axe-core) catch roughly 57% of WCAG issues by volume the remaining ~43% require a human keyboard trace, screen-reader pass, and cognitive-accessibility review (Deque Systems automated-coverage finding; https://www.deque.com/automated-accessibility-testing-coverage/ , accessed 2026-06-06). This figure matches `skills/hatch3r-browser-verify/SKILL.md` per-cycle reminder; the two artifacts state the same denominator.
77
77
  - Maintain an accessibility test checklist per component type (form, modal, navigation, data table).
78
78
 
79
79
  ## WCAG 2.2 New Success Criteria (Mandatory Audit Items)
@@ -96,3 +96,14 @@ Touch surfaces have stricter target and spacing requirements than pointer-only s
96
96
  - Apply `env(safe-area-inset-*)` padding on full-bleed surfaces so content clears notches, home indicators, and rounded corners on iOS and Android edge devices.
97
97
  - Support Dynamic Type (iOS) and rem-based font scaling — declare body text in `rem` or `em` units, never `px`, so OS-level font size settings cascade.
98
98
  - Zoom to 200% and 400% (per WCAG 1.4.4 and 1.4.10 Reflow) must remain functional with no horizontal scroll trap. Audit for `width: 100vw` and fixed pixel widths that break reflow.
99
+
100
+ ### Mobile-native verification path
101
+
102
+ The touch obligations above are mandated for native UI too, but native targets (React Native, Flutter, SwiftUI/UIKit, Android Compose/View) do not render to a DOM, so the browser gates (axe-core, Lighthouse) cannot run on them. The glob on this rule (`**/*.{tsx,jsx,vue,svelte}` plus `**/components/**`) matches React-Native `.tsx`/`.jsx` components, so a native surface can trigger this rule with no browser. Branch on the detected stack and run the framework-native accessibility check instead — a native obligation without one of these checks is unverified, not satisfied:
103
+
104
+ - **React Native:** run `eslint-plugin-react-native-a11y` for static touch-target, label, and role lint; assert touch-target size and `accessibilityLabel` presence in a `@testing-library/react-native` render test.
105
+ - **Flutter:** run the `flutter_test` semantics tester with `meets_guideline` matchers — `androidTapTargetGuideline()` (48dp), `iOSTapTargetGuideline()` (44pt), `labeledTapTargetGuideline()`, and `textContrastGuideline()` — which assert the same target and contrast bounds without a browser.
106
+ - **Android (Compose/View):** enable Espresso `AccessibilityChecks.enable()` in instrumented tests so every interaction is audited for target size and content labels; run Accessibility Scanner once per release on the built APK for spacing and contrast.
107
+ - **iOS (SwiftUI/UIKit):** run an XCUITest `app.performAccessibilityAudit()` (`for: [.dynamicType, .hitRegion, .contrast]`) so target size, Dynamic Type scaling, and contrast are checked on-device.
108
+
109
+ When no native a11y harness is wired for the detected stack, the gate is `BLOCKED_MISSING_TOOL` (per `agents/hatch3r-implementer.md` Step 5c) — it never becomes an unmeasured `PASS`; the orchestrator wires the harness or downgrades scope. Stack-specific patterns and the test-harness setup live in `rules/hatch3r-android-patterns.md`, `rules/hatch3r-swiftui-patterns.md`, and `rules/hatch3r-flutter-patterns.md`.
@@ -5,7 +5,7 @@ description: Extended orchestration reference — PipelineContext schemas, resil
5
5
  scope: conditional
6
6
  globs: "**/.hatch3r/**,**/pipeline/**,**/*orchestrat*,**/*agent*"
7
7
  tags: [orchestration, floor:protocol]
8
- precedence: normal
8
+ precedence: high
9
9
  quality_charter: agents/shared/quality-charter.md
10
10
  cache_friendly: true
11
11
  detail_rule: true
@@ -24,7 +24,11 @@ PipelineContext {
24
24
  correlationId: string // UUID v4, generated before Phase 1
25
25
  taskType: "bug" | "feature" | "refactor" | "qa"
26
26
  issueRef: string | null // Issue number or null for plain chat
27
- deepContextTier: 1 | 2 | 3 // From hatch3r-deep-context scoring
27
+ deepContextTier: 1 | 2 | 3 // Pre-Phase-1 baseline from hatch3r-deep-context scoring
28
+
29
+ // Mid-run tier upgrade (Finding D7-14): set when execution surfaces complexity
30
+ // the baseline missed (see Complexity-Driven Adaptation + Tier-upgrade propagation).
31
+ tierUpgrade?: { from: 1|2|3; to: 1|2|3; reason: string; atPhase: 1|2|3|4 }
28
32
 
29
33
  // Detected project type for specialist selection (Finding #56)
30
34
  projectType?: {
@@ -58,7 +62,7 @@ PipelineContext {
58
62
 
59
63
  // Phase 3 outputs (Review)
60
64
  reviewResult: {
61
- iterations: number // 1-3
65
+ iterations: number // 1 to code-class cap (DEFAULT_MAX_REVIEW_ITERATIONS - 1 = 3)
62
66
  finalVerdict: "CLEAN" | "UNRESOLVED"
63
67
  findings: ReviewFinding[]
64
68
  confirmationPassResult: "PASS" | "FAIL"
@@ -94,24 +98,24 @@ The TypeScript implementation of this schema with runtime validation is in `src/
94
98
  | Phase 1 (Research) | No relevant findings | Surface to user; ask whether to proceed with implementation. |
95
99
  | Phase 2 (Implementation) | Build/test failure | Attempt self-fix (max 2 iterations). Escalate to user if unresolved. |
96
100
  | Phase 2 (Implementation) | Scope creep detected | Halt. Surface deviation to user. Resume only with approval. |
97
- | Phase 3 (Review) | Max iterations (3) | Surface unresolved findings to user. Do not merge. |
101
+ | Phase 3 (Review) | Max iterations (3) (code-class cap = `DEFAULT_MAX_REVIEW_ITERATIONS` - 1) | Surface unresolved findings to user. Do not merge. |
98
102
  | Phase 3 (Review) | DESIGN_OBJECTION verdict | Terminate review loop immediately. Surface the objection and alternative approaches to the user for an architectural decision. Do not spawn fixer. |
99
103
  | Phase 3 (Review) | Fixer introduces regressions | Revert fixer changes. Surface original findings + regression to user. |
100
- | Phase 4 (Quality) | Specialist timeout | Log timeout. Continue with available results. Flag in output. |
104
+ | Phase 4 (Quality) | Conditional-specialist timeout | Log timeout. Continue with available results. Flag in output. |
105
+ | Phase 4 (Quality) | Mandatory CQ3/CQ5 specialist non-completion (TIMEOUT / crash / no-output) | Fail closed. Surface `BLOCKED`. A mandatory always-mode specialist (`hatch3r-security` CQ3, `hatch3r-testability` CQ5 per `hatch3r-agent-orchestration.md` Phase 4 Specialist Trigger Table) that does not return `COMPLETE` leaves its gate absent; absence-of-finding is NOT an implicit pass. This row is the prose face of the typed gate `evaluatePhase4Completion` (`src/pipeline/pipelineContext.ts`): a non-SUCCESS floor specialist yields `mandatoryFloorsSatisfied: false` → `complete: false`. Do not merge/release. Require an explicit operator decision (re-run, accept-risk, or abort) before advancing. |
101
106
  | Phase 4 (Quality) | Validation pass fails | Spawn fixer (max 2 attempts). Surface if unresolved. |
102
107
 
103
108
  ### Subagent Error Recovery
104
109
 
105
- 1. **Timeout:** Forward partial output. Mark status `TIMEOUT`. Continue pipeline.
106
- 2. **Crash/no output:** Mark status `FAILED`. Log reason. Continue if non-blocking.
110
+ 1. **Timeout:** Forward partial output. Mark status `TIMEOUT`. Continue pipeline ONLY for conditional specialists. A mandatory always-mode CQ3/CQ5 specialist on TIMEOUT fails closed — surface `BLOCKED`, never treat the missing gate as a pass.
111
+ 2. **Crash/no output:** Mark status `FAILED`. Log reason. Continue if non-blocking. A mandatory always-mode CQ3/CQ5 specialist is blocking — a crash or no-output return fails closed (surface `BLOCKED`, explicit operator decision before merge/release), it is never "non-blocking".
107
112
  3. **Conflicting outputs:** When two specialists disagree (e.g., security vs performance), escalate to user with both positions.
108
- 4. **Resource exhaustion:** If context window is exhausted, summarize prior context and continue with summary.
113
+ 4. **Resource exhaustion:** Apply the Context-Degradation Policy (this file) compress at `>50%` window, restart at `>75%`.
109
114
 
110
115
  ### Retry Policies
111
116
 
112
- - Subagent retries: 0 (spawn a new agent with adjusted prompt instead).
113
- - Phase retries: Phase 3 review loop retries up to 3 iterations. All other phases: 0 retries (escalate to user).
114
- - Never retry the same failed operation identically — adjust the prompt or approach.
117
+ - Subagent retries: 0 — never retry the same failed operation identically; spawn a new agent with an adjusted prompt/approach instead.
118
+ - Phase retries: Phase 3 review loop retries up to 3 iterations (code-class cap = `DEFAULT_MAX_REVIEW_ITERATIONS` - 1). All other phases: 0 retries (escalate to user).
115
119
 
116
120
  ## Observability Integration
117
121
 
@@ -169,7 +173,7 @@ After each phase, validate that the output conforms to the expected PipelineCont
169
173
  Auto-mode MUST halt and surface to user when:
170
174
  1. A CRITICAL finding is detected in Phase 3.
171
175
  2. Phase 4 validation pass fails after 2 fix attempts.
172
- 3. Any specialist reports FAILED status.
176
+ 3. Any specialist reports FAILED status, OR a mandatory always-mode CQ3/CQ5 specialist (`hatch3r-security`, `hatch3r-testability`) returns any of {FAILED, TIMEOUT, no-output} — a mandatory gate that did not return `COMPLETE` is BLOCKED, not a silent pass.
173
177
  4. Scope containment violation detected.
174
178
  5. Implementation touches more than 20 files (may indicate scope creep).
175
179
 
@@ -186,26 +190,61 @@ The pipeline should adapt its behavior based on observed task complexity, not ju
186
190
 
187
191
  | Signal During Execution | Adaptation |
188
192
  |------------------------|------------|
189
- | Phase 1 research finds >10 affected files (initial estimate was <5) | Upgrade tier to 3 if currently 2. Re-run `codebase-impact` at `deep` depth before Phase 2. |
193
+ | Phase 1 research finds >10 affected files (initial estimate was <5) | Upgrade tier to 3 if currently 2. Record the upgrade in `PipelineContext.tierUpgrade` (`src/pipeline/pipelineContext.ts::TierUpgrade`: `{from, to, reason, atPhase}`) and re-run `codebase-impact` at `deep` depth before Phase 2. |
190
194
  | Phase 2 implementer reports >3 research gaps | Pause Phase 2. Run targeted researcher with gap-specific modes before continuing. |
191
195
  | Phase 3 review loop reaches iteration 2 with increasing Critical count | Classify as complexity underestimate. Surface to user with recommendation to break the task into smaller sub-tasks. |
192
- | Phase 4 validation pass fails on first attempt | Check whether failure is in test-writer's new tests (expected -- fix test) or in pre-existing tests (regression -- fix implementation). Route to appropriate fixer. |
196
+ | Phase 4 validation pass fails on first attempt | Check whether failure is in hatch3r-testability's new tests (expected -- fix test) or in pre-existing tests (regression -- fix implementation). Route to appropriate fixer. |
197
+
198
+ **Tier-upgrade propagation (Finding D7-14).** A mid-run upgrade is not just a log line — it MUST change downstream behavior. After populating `PipelineContext.tierUpgrade`, the orchestrator reads the tier for every subsequent depth decision via `resolveEffectiveTier(context)` (returns `tierUpgrade.to` when an upgrade is recorded, else `deepContextTier`), so the Tier→Phase-4-specialist-depth mapping in `hatch3r-agent-orchestration.md` (Deep Context Integration) scales to the upgraded tier instead of staying pinned to the stale baseline. The carrier only ever raises the tier (a recorded `to <= from` is ignored). Surface the upgrade once in the iteration summary via `formatTierUpgradeNote(context)` (one line, returns `null` when no upgrade occurred) so the adaptation is visible, not silent.
193
199
 
194
200
  ### Post-Pipeline Learning
195
201
 
196
- After pipeline completion, the orchestrator should capture lessons for future runs:
202
+ After pipeline completion, the orchestrator captures lessons for future runs:
197
203
 
198
- 1. **Tier accuracy:** Was the initial tier correct? If the pipeline needed adaptation (above), log the mismatch for the learnings system.
204
+ 1. **Tier accuracy:** Was the initial tier correct? If the pipeline needed adaptation (above), persist a tier-accuracy record (`taskId`, `initialTier`, `finalTier`, `adjustmentReasons`, `correlationId`, `ts`) to `.hatch3r/telemetry/<session-id>-tier.json` via the atomic-write path in `src/pipeline/costEstimator.ts` (sibling of `CostTelemetryRecord`). Tier mismatch beyond ±10% across 50 tasks triggers a CL-3 signal-weight recalibration proposal.
199
205
  2. **Phase duration ratios:** Record time spent per phase. Anomalous ratios (e.g., Phase 3 taking 5x Phase 2) indicate systemic issues worth investigating.
200
206
  3. **Specialist value:** Record which Phase 4 specialists produced actionable findings vs. clean reports. Over time, this data informs smarter specialist dispatch.
201
207
 
202
- ## Context Token Optimization
208
+ ## Multi-Task and Concurrent Pipeline Support
209
+
210
+ Canonical schema for the one-sentence multi-task / epic / batch handling in the orchestration rule's `Task Context Protocols`, so pack integrators have a deterministic specification (Finding D7-M13 / D7-SA7.5-3).
211
+
212
+ **Dependency-graph construction.** Multi-task input (epic, plain-chat multi-request, or board batch) is parsed into discrete units. Each unit carries its own `correlationId` (epic sub-issues get individual IDs sharing a parent epic ID; batch tasks share one ID with a sub-task index). The orchestrator builds a directed acyclic dependency graph from declared inter-unit constraints (e.g., "issue B depends on issue A's API changes"); units with no declared dependency form the root level.
213
+
214
+ **Per-level parallelism.** At each dependency level, the orchestrator parallelizes researchers + implementers across all units in that level subject to the three Parallel Safety conditions in the canonical rule. The parallelism width per level is bounded by the same orchestrator-honored `max_phase4_parallel` width (default `8`) the Phase 4 specialists honor — LLM-honored guidance, not a code-enforced cap (no hatch3r module reads an env var; the host Task tool is the dispatcher and applies no platform fan-out limit, per the canonical rule's Phase 4 — Final Quality).
215
+
216
+ **Concurrent primitive — `concurrent_pipeline_unit`.** Each unit in a level is a `concurrent_pipeline_unit` record: `{ unitId: string; correlationId: string; parentEpicId?: string; level: number; dependsOn: string[]; priority: "p0"|"p1"|"p2"|"p3"; status: "pending"|"running"|"complete"|"blocked"; }`. Within a level the orchestrator dispatches by priority descending (p0 first); when concurrency limits cap the level, the in-flight pool is filled with highest-priority units first and the rest queue for the next dispatch slot.
217
+
218
+ **File-overlap reconciliation.** When two parallel implementers in the same level touch the same file: accept disjoint-region edits without conflict; merge overlapping regions using the larger-scope change as base (the smaller change replays onto the larger); halt on semantic conflicts for user resolution. Per Parallel Safety condition 3, NO mid-pipeline writes to shared mutable state (`.hatch3r/hatch.json`, `.hatch3r/learnings/INDEX.md`) — learnings consolidation happens at pipeline completion only.
219
+
220
+ **Review loop coordination.** After all level-N implementers complete, the orchestrator runs ONE consolidated Phase 3 review loop covering the union diff produced by the level. Per-unit Phase 4 specialist dispatch then runs in parallel bounded by `max_phase4_parallel`. Level-N+1 begins only after Level-N reaches Phase 4 completion (validated by `evaluatePhase4Completion`). Cross-pipeline concurrent invocation (two `hatch3r` commands in two shells against the same repo) is deferred per the cross-command note below + the audit CL-2 spec.
221
+
222
+ ## Pipeline Pattern (Cross-Command Consistency)
223
+
224
+ Finding D7-M12 / D7-SA7.5-2: implementation-flavored orchestrators (`workflow`, `board-pickup`, `revision`, `quick-change`, `board-fill`) MUST follow the canonical pattern below. Per-command deviations require an explicit rationale in the command body's "Pipeline Deviations" subsection.
225
+
226
+ | Stage | Canonical agent | Required at Tier | Carve-out |
227
+ |-------|-----------------|------------------|-----------|
228
+ | Phase 1 Research | `hatch3r-researcher` | T2/T3 | T1 skip per Phase Skip Criteria |
229
+ | Phase 2 Implement | `hatch3r-implementer` | All | T1 quick-change inline carve-out only |
230
+ | Phase 3 Review Loop | `hatch3r-reviewer` ↔ `hatch3r-fixer` (max `DEFAULT_MAX_REVIEW_ITERATIONS`) | T2/T3 nontrivial | T1 all-trivial skip per Phase Skip Criteria |
231
+ | Phase 4 Final Quality | CQ + SSOT specialists, batched by severity, bounded by `max_phase4_parallel` | T2/T3 | T1 — only always-mode floor (`security` + `testability`) |
232
+ | Phase 4 Validation Pass | re-run tests/typecheck vs Phase-3 baseline; re-review on specialist code mutations | T2/T3 | — |
233
+
234
+ Cross-command error-handling defaults: sub-agent failure → retry once then fall back to direct/inline implementation per command's carve-out; quality-check failure → max 2 retry loops then ASK; context degradation → the single Context-Degradation Policy below (window-fraction primary: compress `>50%`, restart `>75%`; turn counts a coarse fallback). Concurrent-invocation handling and lockfile semantics are deferred to a future cycle pending the Decision 27 resumability work.
235
+
236
+ ## Context-Degradation Policy
237
+
238
+ Single canonical policy for every pipeline command (reconciles the per-command turn bullets, Finding D7-24). **Window-fraction is the authoritative axis**; the per-command turn count is a coarse fallback for the same threshold at that command's pace, used only when the host surfaces no context-window percentage. Commands cite this policy, not restated numbers.
203
239
 
204
- When pipeline context exceeds 50% of the available context window, apply these compression strategies in order:
240
+ | Window fraction (primary) | Action | Turn-count fallback (coarse) |
241
+ |---------------------------|--------|------------------------------|
242
+ | `> 50%` | Compress: apply the numbered strategies below in order. | implementation/review ≈ 25 turns; quick-change ≈ 15 (fast-completion scope); debug ≈ 20 |
243
+ | `> 75%` | Restart: suggest a fresh chat / batch split carrying a progress summary of completed + remaining work; a fresh-context command (`hatch3r-revision`) just re-runs. | ≈ 1.5× the compress turn count |
205
244
 
206
245
  1. **Summarize Phase 1 output.** Replace full research findings with a structured summary: affected files (list), blast radius (count + top 3), key conventions (bullet points). Keep raw data only for the fields the current phase needs.
207
246
  2. **Prune resolved findings.** After Phase 3 review loop, remove findings that were fixed and confirmed. Only carry forward unresolved findings.
208
247
  3. **Collapse specialist results.** In the final output, summarize specialist results as a single status table rather than including full specialist reports. Full reports are available on request.
209
248
  4. **Never truncate security findings.** Security auditor output is always included in full regardless of context pressure.
210
249
 
211
- These strategies preserve decision-critical information while reducing token overhead for long pipelines.
250
+ **Handoff loss measurement.** Compression is lossy, so measure it. At each phase transition the orchestrator records a `PhaseHandoffMetrics` record (`src/pipeline/observability.ts::createPhaseHandoffMetrics`) capturing input bytes, output bytes, whether summarisation was applied, and an `informationLossEstimate` (0-1 fraction of input bytes dropped). When `informationLossEstimate` exceeds `0.3`, surface the `formatPhaseHandoffWarning` line in the iteration summary so downstream phases validate that critical context survived closing the gap where a phase silently receives a summary when it needed the full upstream output.