hatch3r 1.5.1 → 1.6.2

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 (129) hide show
  1. package/README.md +18 -2
  2. package/agents/hatch3r-a11y-auditor.md +2 -0
  3. package/agents/hatch3r-dependency-auditor.md +18 -0
  4. package/agents/hatch3r-devops.md +20 -0
  5. package/agents/hatch3r-fixer.md +28 -12
  6. package/agents/hatch3r-implementer.md +26 -12
  7. package/agents/hatch3r-learnings-loader.md +23 -1
  8. package/agents/hatch3r-researcher.md +101 -114
  9. package/agents/hatch3r-reviewer.md +27 -1
  10. package/agents/hatch3r-security-auditor.md +2 -0
  11. package/agents/modes/architecture.md +1 -0
  12. package/agents/modes/boundary-analysis.md +1 -0
  13. package/agents/modes/codebase-impact.md +1 -0
  14. package/agents/modes/complexity-risk.md +1 -0
  15. package/agents/modes/coverage-analysis.md +1 -0
  16. package/agents/modes/feature-design.md +1 -0
  17. package/agents/modes/impact-analysis.md +1 -0
  18. package/agents/modes/migration-path.md +1 -0
  19. package/agents/modes/refactoring-strategy.md +1 -0
  20. package/agents/modes/regression.md +1 -0
  21. package/agents/modes/requirements-elicitation.md +1 -0
  22. package/agents/modes/risk-assessment.md +1 -0
  23. package/agents/modes/risk-prioritization.md +1 -0
  24. package/agents/modes/root-cause.md +1 -0
  25. package/agents/modes/symptom-trace.md +1 -0
  26. package/agents/modes/test-pattern.md +1 -0
  27. package/agents/shared/external-knowledge.md +5 -5
  28. package/agents/shared/injection-patterns.md +78 -0
  29. package/agents/shared/prompt-structure.md +44 -0
  30. package/checks/accessibility.md +2 -0
  31. package/checks/code-quality.md +2 -0
  32. package/checks/performance.md +2 -0
  33. package/checks/security.md +2 -0
  34. package/checks/testing.md +2 -0
  35. package/commands/board/pickup-delegation-multi.md +2 -2
  36. package/commands/board/pickup-delegation.md +2 -2
  37. package/commands/board/pickup-post-impl.md +21 -0
  38. package/commands/board/shared-github.md +4 -2
  39. package/commands/hatch3r-agent-customize.md +2 -1
  40. package/commands/hatch3r-api-spec.md +2 -0
  41. package/commands/hatch3r-benchmark.md +2 -0
  42. package/commands/hatch3r-board-fill.md +96 -9
  43. package/commands/hatch3r-board-groom.md +1 -0
  44. package/commands/hatch3r-board-init.md +31 -1
  45. package/commands/hatch3r-board-pickup.md +10 -0
  46. package/commands/hatch3r-board-refresh.md +1 -0
  47. package/commands/hatch3r-board-shared.md +5 -1
  48. package/commands/hatch3r-bug-plan.md +3 -1
  49. package/commands/hatch3r-codebase-map.md +3 -1
  50. package/commands/hatch3r-command-customize.md +2 -1
  51. package/commands/hatch3r-context-health.md +1 -0
  52. package/commands/hatch3r-cost-tracking.md +1 -0
  53. package/commands/hatch3r-debug.md +2 -0
  54. package/commands/hatch3r-dep-audit.md +1 -0
  55. package/commands/hatch3r-feature-plan.md +3 -1
  56. package/commands/hatch3r-healthcheck.md +2 -1
  57. package/commands/hatch3r-hooks.md +1 -0
  58. package/commands/hatch3r-learn.md +8 -5
  59. package/commands/hatch3r-migration-plan.md +2 -0
  60. package/commands/hatch3r-onboard.md +2 -0
  61. package/commands/hatch3r-project-spec.md +3 -1
  62. package/commands/hatch3r-quick-change.md +14 -2
  63. package/commands/hatch3r-recipe.md +1 -0
  64. package/commands/hatch3r-refactor-plan.md +2 -0
  65. package/commands/hatch3r-release.md +1 -0
  66. package/commands/hatch3r-revision.md +10 -0
  67. package/commands/hatch3r-roadmap.md +3 -1
  68. package/commands/hatch3r-rule-customize.md +2 -1
  69. package/commands/hatch3r-security-audit.md +2 -1
  70. package/commands/hatch3r-skill-customize.md +2 -1
  71. package/commands/hatch3r-test-plan.md +2 -0
  72. package/commands/hatch3r-workflow.md +15 -3
  73. package/commands/revision/revision-quality.md +4 -3
  74. package/dist/cli/index.js +6235 -2613
  75. package/dist/cli/index.js.map +1 -1
  76. package/github-agents/hatch3r-docs-agent.md +1 -0
  77. package/github-agents/hatch3r-lint-agent.md +1 -0
  78. package/github-agents/hatch3r-security-agent.md +1 -0
  79. package/github-agents/hatch3r-test-agent.md +1 -0
  80. package/package.json +7 -1
  81. package/rules/hatch3r-accessibility-standards.mdc +1 -0
  82. package/rules/hatch3r-agent-orchestration-detail.mdc +1 -0
  83. package/rules/hatch3r-agent-orchestration.md +38 -5
  84. package/rules/hatch3r-agent-orchestration.mdc +39 -5
  85. package/rules/hatch3r-api-design.md +1 -1
  86. package/rules/hatch3r-api-design.mdc +2 -1
  87. package/rules/hatch3r-browser-verification.md +1 -1
  88. package/rules/hatch3r-browser-verification.mdc +3 -3
  89. package/rules/hatch3r-ci-cd.mdc +1 -0
  90. package/rules/hatch3r-code-standards.md +1 -1
  91. package/rules/hatch3r-code-standards.mdc +2 -2
  92. package/rules/hatch3r-component-conventions.md +3 -3
  93. package/rules/hatch3r-component-conventions.mdc +2 -2
  94. package/rules/hatch3r-data-classification.mdc +1 -0
  95. package/rules/hatch3r-dependency-management.md +1 -1
  96. package/rules/hatch3r-dependency-management.mdc +2 -1
  97. package/rules/hatch3r-feature-flags.md +1 -1
  98. package/rules/hatch3r-feature-flags.mdc +1 -1
  99. package/rules/hatch3r-git-conventions.md +1 -1
  100. package/rules/hatch3r-git-conventions.mdc +2 -2
  101. package/rules/hatch3r-i18n.md +2 -2
  102. package/rules/hatch3r-i18n.mdc +1 -1
  103. package/rules/hatch3r-learning-consult.md +1 -1
  104. package/rules/hatch3r-learning-consult.mdc +2 -2
  105. package/rules/hatch3r-migrations.mdc +1 -0
  106. package/rules/hatch3r-observability-tracing-detail.mdc +99 -6
  107. package/rules/hatch3r-observability-tracing.mdc +20 -15
  108. package/rules/hatch3r-performance-budgets.md +1 -1
  109. package/rules/hatch3r-performance-budgets.mdc +1 -1
  110. package/rules/hatch3r-secrets-management.mdc +1 -0
  111. package/rules/hatch3r-security-patterns.md +1 -1
  112. package/rules/hatch3r-security-patterns.mdc +3 -2
  113. package/rules/hatch3r-testing.md +1 -1
  114. package/rules/hatch3r-testing.mdc +3 -2
  115. package/rules/hatch3r-theming.md +2 -2
  116. package/rules/hatch3r-theming.mdc +2 -2
  117. package/rules/hatch3r-tooling-hierarchy.md +1 -1
  118. package/rules/hatch3r-tooling-hierarchy.mdc +3 -2
  119. package/skills/hatch3r-a11y-audit/SKILL.md +21 -55
  120. package/skills/hatch3r-a11y-audit/references/manual-audit-checklist.md +58 -0
  121. package/skills/hatch3r-agent-customize/SKILL.md +1 -1
  122. package/skills/hatch3r-command-customize/SKILL.md +1 -1
  123. package/skills/hatch3r-gh-agentic-workflows/SKILL.md +42 -136
  124. package/skills/hatch3r-gh-agentic-workflows/references/azure-devops.md +60 -0
  125. package/skills/hatch3r-gh-agentic-workflows/references/gitlab-ci.md +51 -0
  126. package/skills/hatch3r-issue-workflow/SKILL.md +8 -27
  127. package/skills/hatch3r-issue-workflow/references/delegation-patterns.md +51 -0
  128. package/skills/hatch3r-rule-customize/SKILL.md +1 -1
  129. package/skills/hatch3r-skill-customize/SKILL.md +1 -1
@@ -3,6 +3,7 @@ name: hatch3r-docs-agent
3
3
  description: Technical writer who maintains specs, ADRs, and documentation
4
4
  # Simplified agent for GitHub Copilot/Codex
5
5
  tags: [team, devops]
6
+ quality_charter: agents/shared/quality-charter.md
6
7
  ---
7
8
 
8
9
  You are an expert technical writer for the project.
@@ -3,6 +3,7 @@ name: hatch3r-lint-agent
3
3
  description: Code quality enforcer who fixes style, formatting, and type issues
4
4
  # Simplified agent for GitHub Copilot/Codex
5
5
  tags: [team, devops]
6
+ quality_charter: agents/shared/quality-charter.md
6
7
  ---
7
8
 
8
9
  You are a code quality engineer for the project.
@@ -3,6 +3,7 @@ name: hatch3r-security-agent
3
3
  description: Security analyst who audits code, rules, and data flows
4
4
  # Simplified agent for GitHub Copilot/Codex
5
5
  tags: [team, devops]
6
+ quality_charter: agents/shared/quality-charter.md
6
7
  ---
7
8
 
8
9
  You are an expert security analyst for the project.
@@ -3,6 +3,7 @@ name: hatch3r-test-agent
3
3
  description: QA engineer who writes and maintains tests
4
4
  # Simplified agent for GitHub Copilot/Codex
5
5
  tags: [team, devops]
6
+ quality_charter: agents/shared/quality-charter.md
6
7
  ---
7
8
 
8
9
  You are an expert QA engineer for the project.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hatch3r",
3
- "version": "1.5.1",
3
+ "version": "1.6.2",
4
4
  "description": "Battle-tested agentic coding setup framework. One command to hatch your agent stack -- agents, skills, rules, commands, and MCP for every major AI coding tool.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -20,6 +20,9 @@
20
20
  "prepublishOnly": "npm run build",
21
21
  "test": "vitest run",
22
22
  "test:watch": "vitest",
23
+ "inventory": "tsx scripts/inventory.ts",
24
+ "inventory:check-docs": "tsx scripts/inventory.ts --check-docs",
25
+ "validate:rule-parity": "tsx scripts/validate-rule-parity.ts",
23
26
  "lockfile:check": "lockfile-lint --path package-lock.json --type npm --allowed-hosts npm --validate-https"
24
27
  },
25
28
  "keywords": [
@@ -78,14 +81,17 @@
78
81
  "commander": "^14.0.3",
79
82
  "inquirer": "^13.3.2",
80
83
  "ora": "^9.3.0",
84
+ "proper-lockfile": "^4.1.2",
81
85
  "yaml": "^2.8.3"
82
86
  },
83
87
  "devDependencies": {
84
88
  "@types/node": "^25.5.0",
89
+ "@types/proper-lockfile": "^4.1.4",
85
90
  "@vitest/coverage-v8": "^4.1.2",
86
91
  "eslint": "^10.1.0",
87
92
  "lockfile-lint": "^5.0.0",
88
93
  "tsup": "^8.0.0",
94
+ "tsx": "^4.21.0",
89
95
  "typescript": "^6.0.2",
90
96
  "typescript-eslint": "^8.57.2",
91
97
  "vitest": "^4.1.2"
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  description: Accessibility standards covering WCAG 2.2 AA compliance, keyboard navigation, screen readers, and ARIA patterns
3
3
  globs: ["**/*.vue", "**/*.jsx", "**/*.tsx", "**/*.svelte", "**/components/**", "**/*.html", "**/*a11y*", "**/*accessibility*"]
4
+ alwaysApply: false
4
5
  ---
5
6
  # Accessibility Standards
6
7
 
@@ -87,6 +87,7 @@ The TypeScript implementation of this schema with runtime validation is in `src/
87
87
  | Phase 2 (Implementation) | Build/test failure | Attempt self-fix (max 2 iterations). Escalate to user if unresolved. |
88
88
  | Phase 2 (Implementation) | Scope creep detected | Halt. Surface deviation to user. Resume only with approval. |
89
89
  | Phase 3 (Review) | Max iterations (3) | Surface unresolved findings to user. Do not merge. |
90
+ | 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. |
90
91
  | Phase 3 (Review) | Fixer introduces regressions | Revert fixer changes. Surface original findings + regression to user. |
91
92
  | Phase 4 (Quality) | Specialist timeout | Log timeout. Continue with available results. Flag in output. |
92
93
  | Phase 4 (Quality) | Validation pass fails | Spawn fixer (max 2 attempts). Surface if unresolved. |
@@ -30,8 +30,8 @@ Every task MUST follow this four-phase pipeline: **Phase 1 — Research** (`hatc
30
30
  | `hatch3r-implementer` | Single-task implementation | Always — one per task |
31
31
  | `hatch3r-reviewer` | Code review | Always — Phase 3 review loop |
32
32
  | `hatch3r-fixer` | Fix reviewer findings | Phase 3 — Critical/Warning findings |
33
- | `hatch3r-test-writer` | Tests | Always — Phase 4 (every code change) |
34
- | `hatch3r-security-auditor` | Security review | Always — Phase 4 (every code change) |
33
+ | `hatch3r-test-writer` | Tests | Always — Phase 4 (every code change; skip per Phase Skip Criteria) |
34
+ | `hatch3r-security-auditor` | Security review | Always — Phase 4 (every code change; skip per Phase Skip Criteria) |
35
35
  | `hatch3r-docs-writer` | Documentation | Phase 4 — evaluate when APIs/architecture/UX affected |
36
36
  | `hatch3r-lint-fixer` | Lint/type fixes | Conditional — lint errors present |
37
37
  | `hatch3r-a11y-auditor` | WCAG AA checks | Conditional — UI/accessibility changes |
@@ -117,7 +117,7 @@ For multi-sub-task implementations, the implementer performs a lightweight mini-
117
117
 
118
118
  Launch parallel subagents -- no artificial concurrency limit.
119
119
 
120
- - **Always:** `hatch3r-test-writer`, `hatch3r-security-auditor`
120
+ - **Always** (except when Phase Skip Criteria applies — see below)**:** `hatch3r-test-writer`, `hatch3r-security-auditor`
121
121
  - **Evaluate:** `hatch3r-docs-writer` (when APIs/architecture/UX affected)
122
122
  - **Conditional:** `hatch3r-lint-fixer`, `hatch3r-a11y-auditor`, `hatch3r-perf-profiler`, `hatch3r-dependency-auditor`, `hatch3r-architect`, `hatch3r-devops`
123
123
 
@@ -130,8 +130,8 @@ Launch parallel subagents -- no artificial concurrency limit.
130
130
 
131
131
  | Specialist | Mode | Trigger Conditions |
132
132
  |-----------|------|--------------------|
133
- | `hatch3r-test-writer` | Always | Any code change |
134
- | `hatch3r-security-auditor` | Always | Any code change |
133
+ | `hatch3r-test-writer` | Always | Any code change; may skip per Phase Skip Criteria |
134
+ | `hatch3r-security-auditor` | Always | Any code change; may skip per Phase Skip Criteria |
135
135
  | `hatch3r-docs-writer` | Evaluate | Public API, architecture, or UX changes |
136
136
  | `hatch3r-lint-fixer` | Conditional | Lint/type errors present |
137
137
  | `hatch3r-a11y-auditor` | Conditional | UI/accessibility changes |
@@ -196,6 +196,39 @@ Skill-referenced agent delegations are mandatory.
196
196
  3. Launch independent subagents in parallel — maximum parallelism.
197
197
  4. Await and review results. Surface BLOCKED or PARTIAL to user.
198
198
 
199
+ ## Parallel Safety
200
+
201
+ This section documents when spawning multiple sub-agents concurrently is safe and when it must remain sequential.
202
+
203
+ ### Design Rationale
204
+
205
+ The pipeline's default is **linear per task** — Phase 1 → Phase 2 → Phase 3 → Phase 4, serially. `PipelineContext` captures a single logical handoff token that flows through sub-agents in sequence. LLM-driven orchestrators reason better with sequential, linearly-ordered context. Within Phase 4, parallel specialists are safe because they operate on read-only artifacts. Extending parallelism to Phases 1-3 requires explicit conditions.
206
+
207
+ ### Parallel-Safe Operations
208
+
209
+ 1. **Phase 4 Specialists** — test-writer, security-auditor, docs-writer, lint-fixer, etc. Read-only input from Phase 3 completion; independent outputs; no shared state mutation.
210
+ 2. **Intra-Phase-1 Researcher Modes** — multiple modes on the SAME task (symptom-trace + root-cause + codebase-impact) when the task is self-contained. Operate on read-only codebase; produce independent findings.
211
+ 3. **Per-Module Phase 2 Fan-Out (Disjoint `affectedFiles`)** — multi-module tasks with non-overlapping file sets; each implementer commits independently; merged post-Phase-2.
212
+ 4. **Tier 2/3 Elicitation Researchers** — parallel researchers on the same task to surface different perspectives; outputs tagged with confidence + perspective; orchestrator aggregates.
213
+
214
+ ### NOT Parallel-Safe
215
+
216
+ 1. **Cross-Phase Execution** — Phase 1 must complete before Phase 2 (Phase 2 depends on researchFindings). Phase 2 must complete before Phase 3 (review needs diff). Phase 3 must complete before Phase 4 (quality checks assume review-clean state).
217
+ 2. **Phase 3 Review Loop Iterations** — reviewer → fixer → re-reviewer must be serial.
218
+ 3. **Overlapping-File Implementers** — two Phase 2 implementers touching the same file must execute serially or use a merge-conflict detection gate.
219
+ 4. **Shared `PipelineContext` Field Writers** — if multiple agents mutate `state` / `featureFlags` / `metadata`, serialize them. Parallel agents must only READ context.
220
+ 5. **Phase 4 Validation Re-Review** — the confirmation pass after Phase 4 specialists must run serially; it checks fix-driven regressions.
221
+
222
+ ### Three Conditions to Parallelize
223
+
224
+ ALL three must hold:
225
+
226
+ 1. **Read-only or disjoint writes** — agents read-only from context OR write to disjoint files/fields (no conflict zone).
227
+ 2. **Deterministic aggregation** — outputs merge without orchestrator intervention (tests: pass if all pass; findings: union).
228
+ 3. **Overhead < savings** — coordination cost (merge, conflict detection) is less than latency savings (max-of-agents vs sum-of-agents).
229
+
230
+ **Default:** When in doubt, serialize. For typical hatch3r tasks (1–5 sub-tasks) the DAG-scheduling overhead often outweighs concurrency gain.
231
+
199
232
  ## Cross-Phase Error Propagation
200
233
 
201
234
  When a phase produces a non-SUCCESS status, the orchestrator must propagate error context to downstream phases rather than silently dropping it:
@@ -26,8 +26,8 @@ Every task MUST follow this four-phase pipeline: **Phase 1 — Research** (`hatc
26
26
  | `hatch3r-implementer` | Single-task implementation | Always — one per task |
27
27
  | `hatch3r-reviewer` | Code review | Always — Phase 3 review loop |
28
28
  | `hatch3r-fixer` | Fix reviewer findings | Phase 3 — Critical/Warning findings |
29
- | `hatch3r-test-writer` | Tests | Always — Phase 4 (every code change) |
30
- | `hatch3r-security-auditor` | Security review | Always — Phase 4 (every code change) |
29
+ | `hatch3r-test-writer` | Tests | Always — Phase 4 (every code change; skip per Phase Skip Criteria) |
30
+ | `hatch3r-security-auditor` | Security review | Always — Phase 4 (every code change; skip per Phase Skip Criteria) |
31
31
  | `hatch3r-docs-writer` | Documentation | Phase 4 — evaluate when APIs/architecture/UX affected |
32
32
  | `hatch3r-lint-fixer` | Lint/type fixes | Conditional — lint errors present |
33
33
  | `hatch3r-a11y-auditor` | WCAG AA checks | Conditional — UI/accessibility changes |
@@ -107,12 +107,13 @@ For multi-sub-task implementations, the implementer performs a lightweight mini-
107
107
  3. Re-review after fixes. Repeat until 0 Critical + 0 Warning, or max 3 iterations.
108
108
  4. **Confirmation pass** after clean review: lightweight re-review for fix-driven regressions and acceptance criteria completeness. The confirmation pass checks only: (a) no new test failures compared to Phase 2 baseline, (b) no type errors introduced, (c) acceptance criteria from the issue are still met. It does not re-run the full review checklist.
109
109
  5. Max iterations reached: surface to user with a structured summary: iteration count, remaining Critical findings (with file:line), remaining Warning findings, and a recommendation (fix manually vs. accept risk). Never present raw reviewer output without summarization.
110
+ 6. **Review gate confidence signal:** When the review loop exits with a clean verdict, record the iteration count in `PipelineContext.reviewResult.iterations`. Clean-on-first-pass (iteration 1) signals higher confidence than clean-after-multiple-iterations (iteration 2-3). Phase 4 specialists and the orchestrator should factor this into their risk assessment.
110
111
 
111
112
  **Phase 4 — Final Quality** (after review loop is clean):
112
113
 
113
114
  Launch parallel subagents -- no artificial concurrency limit.
114
115
 
115
- - **Always:** `hatch3r-test-writer`, `hatch3r-security-auditor`
116
+ - **Always** (except when Phase Skip Criteria applies — see below)**:** `hatch3r-test-writer`, `hatch3r-security-auditor`
116
117
  - **Evaluate:** `hatch3r-docs-writer` (when APIs/architecture/UX affected)
117
118
  - **Conditional:** `hatch3r-lint-fixer`, `hatch3r-a11y-auditor`, `hatch3r-perf-profiler`, `hatch3r-dependency-auditor`, `hatch3r-architect`, `hatch3r-devops`
118
119
 
@@ -125,8 +126,8 @@ Launch parallel subagents -- no artificial concurrency limit.
125
126
 
126
127
  | Specialist | Mode | Trigger Conditions |
127
128
  |-----------|------|--------------------|
128
- | `hatch3r-test-writer` | Always | Any code change |
129
- | `hatch3r-security-auditor` | Always | Any code change |
129
+ | `hatch3r-test-writer` | Always | Any code change; may skip per Phase Skip Criteria |
130
+ | `hatch3r-security-auditor` | Always | Any code change; may skip per Phase Skip Criteria |
130
131
  | `hatch3r-docs-writer` | Evaluate | Public API, architecture, or UX changes |
131
132
  | `hatch3r-lint-fixer` | Conditional | Lint/type errors present |
132
133
  | `hatch3r-a11y-auditor` | Conditional | UI/accessibility changes |
@@ -191,6 +192,39 @@ Skill-referenced agent delegations are mandatory.
191
192
  3. Launch independent subagents in parallel — maximum parallelism.
192
193
  4. Await and review results. Surface BLOCKED or PARTIAL to user.
193
194
 
195
+ ## Parallel Safety
196
+
197
+ This section documents when spawning multiple sub-agents concurrently is safe and when it must remain sequential.
198
+
199
+ ### Design Rationale
200
+
201
+ The pipeline's default is **linear per task** — Phase 1 → Phase 2 → Phase 3 → Phase 4, serially. `PipelineContext` captures a single logical handoff token that flows through sub-agents in sequence. LLM-driven orchestrators reason better with sequential, linearly-ordered context. Within Phase 4, parallel specialists are safe because they operate on read-only artifacts. Extending parallelism to Phases 1-3 requires explicit conditions.
202
+
203
+ ### Parallel-Safe Operations
204
+
205
+ 1. **Phase 4 Specialists** — test-writer, security-auditor, docs-writer, lint-fixer, etc. Read-only input from Phase 3 completion; independent outputs; no shared state mutation.
206
+ 2. **Intra-Phase-1 Researcher Modes** — multiple modes on the SAME task (symptom-trace + root-cause + codebase-impact) when the task is self-contained. Operate on read-only codebase; produce independent findings.
207
+ 3. **Per-Module Phase 2 Fan-Out (Disjoint `affectedFiles`)** — multi-module tasks with non-overlapping file sets; each implementer commits independently; merged post-Phase-2.
208
+ 4. **Tier 2/3 Elicitation Researchers** — parallel researchers on the same task to surface different perspectives; outputs tagged with confidence + perspective; orchestrator aggregates.
209
+
210
+ ### NOT Parallel-Safe
211
+
212
+ 1. **Cross-Phase Execution** — Phase 1 must complete before Phase 2 (Phase 2 depends on researchFindings). Phase 2 must complete before Phase 3 (review needs diff). Phase 3 must complete before Phase 4 (quality checks assume review-clean state).
213
+ 2. **Phase 3 Review Loop Iterations** — reviewer → fixer → re-reviewer must be serial.
214
+ 3. **Overlapping-File Implementers** — two Phase 2 implementers touching the same file must execute serially or use a merge-conflict detection gate.
215
+ 4. **Shared `PipelineContext` Field Writers** — if multiple agents mutate `state` / `featureFlags` / `metadata`, serialize them. Parallel agents must only READ context.
216
+ 5. **Phase 4 Validation Re-Review** — the confirmation pass after Phase 4 specialists must run serially; it checks fix-driven regressions.
217
+
218
+ ### Three Conditions to Parallelize
219
+
220
+ ALL three must hold:
221
+
222
+ 1. **Read-only or disjoint writes** — agents read-only from context OR write to disjoint files/fields (no conflict zone).
223
+ 2. **Deterministic aggregation** — outputs merge without orchestrator intervention (tests: pass if all pass; findings: union).
224
+ 3. **Overhead < savings** — coordination cost (merge, conflict detection) is less than latency savings (max-of-agents vs sum-of-agents).
225
+
226
+ **Default:** When in doubt, serialize. For typical hatch3r tasks (1–5 sub-tasks) the DAG-scheduling overhead often outweighs concurrency gain.
227
+
194
228
  ## Cross-Phase Error Propagation
195
229
 
196
230
  When a phase produces a non-SUCCESS status, the orchestrator must propagate error context to downstream phases rather than silently dropping it:
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  id: hatch3r-api-design
3
3
  type: rule
4
- description: API endpoint and contract design patterns for the project
4
+ description: REST, GraphQL, and gRPC contract patterns covering versioning, auth, CORS, pagination, webhooks, rate limiting, and security headers
5
5
  scope: "**/api/**,**/routes/**,**/controllers/**,**/endpoints/**,**/*route*,**/*controller*,**/*endpoint*,**/*handler*,**/graphql/**,**/trpc/**"
6
6
  tags: [planning]
7
7
  quality_charter: agents/shared/quality-charter.md
@@ -1,6 +1,7 @@
1
1
  ---
2
- description: API endpoint and contract design patterns for the project
2
+ description: REST, GraphQL, and gRPC contract patterns covering versioning, auth, CORS, pagination, webhooks, rate limiting, and security headers
3
3
  globs: ["**/api/**", "**/routes/**", "**/controllers/**", "**/endpoints/**", "**/*route*", "**/*controller*", "**/*endpoint*", "**/*handler*", "**/graphql/**", "**/trpc/**"]
4
+ alwaysApply: false
4
5
  ---
5
6
  # API Design
6
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  id: hatch3r-browser-verification
3
3
  type: rule
4
- description: Browser-based verification for UI and user-facing changes
4
+ description: Playwright browser verification protocol for UI changes covering visual regression, screenshot capture, console checks, and accessibility spot-checks
5
5
  scope: conditional
6
6
  globs: "**/*.vue,**/*.jsx,**/*.tsx,**/*.svelte,**/components/**,**/*.html,**/*.css,**/*.scss"
7
7
  tags: [review]
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Browser-based verification for UI and user-facing changes
2
+ description: Playwright browser verification protocol for UI changes covering visual regression, screenshot capture, console checks, and accessibility spot-checks
3
3
  globs: ["**/*.vue", "**/*.jsx", "**/*.tsx", "**/*.svelte", "**/components/**", "**/*.html", "**/*.css", "**/*.scss"]
4
4
  alwaysApply: false
5
5
  ---
@@ -58,7 +58,7 @@ Commands in the "Does NOT Support" column are documentation-only, planning-only,
58
58
 
59
59
  ## Verification Protocol
60
60
 
61
- ### 1. Ensure Dev Server is Running
61
+ ### 1. Confirm Dev Server is Running
62
62
 
63
63
  - Check if the project's dev server is already running (check terminal output or process list).
64
64
  - If not running, start it in the background using the project's dev command (e.g., `npm run dev`).
@@ -75,7 +75,7 @@ Commands in the "Does NOT Support" column are documentation-only, planning-only,
75
75
 
76
76
  ### 3. Capture Evidence
77
77
 
78
- - Take screenshots of the affected surfaces showing the change works correctly.
78
+ - Take screenshots of the affected surfaces showing the change produces the expected visual and interactive result.
79
79
  - For before/after changes (visual refactors, bug fixes), capture both states when possible.
80
80
  - Note any browser console errors or warnings in the verification summary.
81
81
  - Include screenshots in the PR description or attach to the issue.
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  description: CI/CD pipeline standards covering stage gates, deployment strategies, and rollback procedures
3
3
  globs: ["**/.github/workflows/**", "**/Dockerfile*", "**/docker-compose*", "**/.gitlab-ci*", "**/Jenkinsfile", "**/azure-pipelines*", "**/.circleci/**", "**/deploy/**", "**/*pipeline*"]
4
+ alwaysApply: false
4
5
  ---
5
6
  # CI/CD Standards
6
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  id: hatch3r-code-standards
3
3
  type: rule
4
- description: Code quality and file naming conventions for the project
4
+ description: TypeScript typing discipline, naming, file size caps, Result types, barrel exports, import ordering, and monorepo boundary rules
5
5
  scope: always
6
6
  tags: [core, lang:typescript]
7
7
  quality_charter: agents/shared/quality-charter.md
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Code quality and file naming conventions for the project
2
+ description: TypeScript typing discipline, naming, file size caps, Result types, barrel exports, import ordering, and monorepo boundary rules
3
3
  alwaysApply: true
4
4
  ---
5
5
  # Code Standards
@@ -26,7 +26,7 @@ alwaysApply: true
26
26
  ### Discriminated Unions
27
27
 
28
28
  - Model domain variants with discriminated unions over polymorphic classes or `type` string checks. Every variant must share a common literal discriminant field (e.g., `kind`, `type`, `status`).
29
- - Use exhaustive `switch` with a `never` default case to ensure all variants are handled. The compiler will error when a new variant is added but not handled.
29
+ - Use exhaustive `switch` with a `never` default case so the compiler errors when a new variant is added but not handled.
30
30
 
31
31
  ### Branded Types
32
32
 
@@ -1,10 +1,10 @@
1
1
  ---
2
2
  id: hatch3r-component-conventions
3
3
  type: rule
4
- description: Rules for component development in web applications
4
+ description: Component structure, styling tokens, loading/error/empty states, form validation timing, and accessible label patterns for Vue, React, and JSX
5
5
  scope: conditional
6
- globs: src/**/*.vue, src/**/*.tsx, src/**/*.jsx
7
- tags: [implementation]
6
+ globs: "src/**/*.vue,src/**/*.tsx,src/**/*.jsx"
7
+ tags: [implementation, lang:typescript]
8
8
  quality_charter: agents/shared/quality-charter.md
9
9
  ---
10
10
  # Component Conventions
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Rules for component development in web applications
2
+ description: Component structure, styling tokens, loading/error/empty states, form validation timing, and accessible label patterns for Vue, React, and JSX
3
3
  globs: ["src/**/*.vue", "src/**/*.tsx", "src/**/*.jsx"]
4
4
  alwaysApply: false
5
5
  ---
@@ -75,7 +75,7 @@ alwaysApply: false
75
75
  - Group related fields with `<fieldset>` and `<legend>` (e.g., "Shipping Address", "Payment Details").
76
76
  - Use progressive disclosure for complex forms: show advanced options behind an expandable section or a follow-up step.
77
77
  - Autofocus the first input field on form mount.
78
- - Ensure tab order follows the visual layout order — never use positive `tabindex` values.
78
+ - Verify tab order follows the visual layout order by tabbing through the form — never use positive `tabindex` values.
79
79
 
80
80
  ### Submit Behavior
81
81
  - Disable the submit button when the form has known validation errors (but keep it focusable for screen readers).
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  description: Data classification standards covering PII handling, encryption, retention policies, and regulatory compliance
3
3
  globs: ["**/models/**", "**/schemas/**", "**/schema*", "**/database/**", "**/db/**", "**/*model*", "**/*entity*", "**/prisma/**", "**/drizzle/**", "**/*migration*"]
4
+ alwaysApply: false
4
5
  ---
5
6
  # Data Classification Standards
6
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  id: hatch3r-dependency-management
3
3
  type: rule
4
- description: Rules for managing project dependencies
4
+ description: Lockfile discipline, CVE scanning, transitive dependency audits, major version upgrade protocol, and bundle-size impact gates for package manifests
5
5
  scope: "**/package.json,**/package-lock.json,**/yarn.lock,**/pnpm-lock.yaml,**/Cargo.toml,**/Cargo.lock,**/requirements*.txt,**/pyproject.toml,**/go.mod,**/go.sum,**/Gemfile*"
6
6
  tags: [maintenance]
7
7
  quality_charter: agents/shared/quality-charter.md
@@ -1,6 +1,7 @@
1
1
  ---
2
- description: Rules for managing project dependencies
2
+ description: Lockfile discipline, CVE scanning, transitive dependency audits, major version upgrade protocol, and bundle-size impact gates for package manifests
3
3
  globs: ["**/package.json", "**/package-lock.json", "**/yarn.lock", "**/pnpm-lock.yaml", "**/Cargo.toml", "**/Cargo.lock", "**/requirements*.txt", "**/pyproject.toml", "**/go.mod", "**/go.sum", "**/Gemfile*"]
4
+ alwaysApply: false
4
5
  ---
5
6
  # Dependency Management
6
7
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  id: hatch3r-feature-flags
3
3
  type: rule
4
- description: Feature flag patterns and lifecycle for the project
4
+ description: OpenFeature provider interface, percentage-based rollout, kill switches, stale-flag detection, audit logging, and evaluation context rules
5
5
  scope: conditional
6
6
  globs: "**/*feature-flag*,**/*featureFlag*,**/*feature_flag*,**/config/**"
7
7
  tags: [implementation]
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Feature flag patterns and lifecycle for the project
2
+ description: OpenFeature provider interface, percentage-based rollout, kill switches, stale-flag detection, audit logging, and evaluation context rules
3
3
  globs: ["**/*feature-flag*", "**/*featureFlag*", "**/*feature_flag*", "**/config/**"]
4
4
  alwaysApply: false
5
5
  ---
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  id: hatch3r-git-conventions
3
3
  type: rule
4
- description: Git commit message and branching conventions
4
+ description: Conventional Commits type list, subject line rules, breaking-change footer format, and branch naming template for type/short-description
5
5
  scope: "**/.git/**,**/.gitignore,**/.gitattributes,**/.gitmodules,**/COMMIT_EDITMSG"
6
6
  tags: [core]
7
7
  quality_charter: agents/shared/quality-charter.md
@@ -1,6 +1,6 @@
1
1
  ---
2
- description: Git commit message and branching conventions
3
- globs: "**/.git/**,**/.gitignore,**/.gitattributes,**/.gitmodules,**/COMMIT_EDITMSG"
2
+ description: Conventional Commits type list, subject line rules, breaking-change footer format, and branch naming template for type/short-description
3
+ globs: ["**/.git/**", "**/.gitignore", "**/.gitattributes", "**/.gitmodules", "**/COMMIT_EDITMSG"]
4
4
  alwaysApply: false
5
5
  ---
6
6
  # Git Conventions
@@ -3,8 +3,8 @@ id: hatch3r-i18n
3
3
  type: rule
4
4
  description: Internationalization, localization, and RTL support conventions for the project
5
5
  scope: conditional
6
- globs: src/**/*.vue, src/**/*.tsx, src/**/*.jsx, src/**/*.ts
7
- tags: [implementation]
6
+ globs: "src/**/*.vue,src/**/*.tsx,src/**/*.jsx,src/**/*.ts,**/locales/**,**/i18n/**,**/*i18n*,**/*locale*"
7
+ tags: [implementation, lang:typescript]
8
8
  quality_charter: agents/shared/quality-charter.md
9
9
  ---
10
10
  # Internationalization & RTL
@@ -40,7 +40,7 @@ alwaysApply: false
40
40
 
41
41
  - Allow 30–40% text expansion for German/Finnish translations relative to English; test UI with pseudo-localization that pads strings.
42
42
  - Use `min-height` instead of fixed `height` on text containers to accommodate CJK line-height requirements (1.6–1.8 recommended).
43
- - Define font stacks per script family: Latin, CJK, Arabic, Devanagari — ensure each stack includes a web-safe fallback and `system-ui`.
43
+ - Define font stacks per script family: Latin, CJK, Arabic, Devanagari — each stack must include a web-safe fallback and `system-ui`.
44
44
  - Truncate overflowing text with `text-overflow: ellipsis` plus `overflow: hidden` and `white-space: nowrap` only when semantically safe; provide title/tooltip with full text.
45
45
  - Avoid fixed-width containers for translatable text; prefer `min-width` / `max-width` with flex/grid layout.
46
46
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  id: hatch3r-learning-consult
3
3
  type: rule
4
- description: Auto-consult project learnings before implementation
4
+ description: Consult .agents/learnings/ for pitfalls, patterns, and past decisions before implementation with frontmatter-first scan and priority ordering
5
5
  scope: "**/.agents/learnings/**,**/learnings/**"
6
6
  tags: [core]
7
7
  quality_charter: agents/shared/quality-charter.md
@@ -1,6 +1,6 @@
1
1
  ---
2
- description: Auto-consult project learnings before implementation
3
- globs: "**/.agents/learnings/**,**/learnings/**"
2
+ description: Consult .agents/learnings/ for pitfalls, patterns, and past decisions before implementation with frontmatter-first scan and priority ordering
3
+ globs: ["**/.agents/learnings/**", "**/learnings/**"]
4
4
  alwaysApply: false
5
5
  ---
6
6
  # Learning Consultation
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  description: Database migration and schema change patterns for the project
3
3
  globs: ["**/migrations/**", "**/*migration*", "**/migrate/**", "**/seeds/**", "**/seeders/**", "**/prisma/migrations/**", "**/drizzle/**", "**/knex/**"]
4
+ alwaysApply: false
4
5
  ---
5
6
  # Migrations
6
7
 
@@ -34,6 +34,22 @@ Instrument the full lifecycle of an agent invocation with a dedicated span. This
34
34
  - **Required attributes:** `agent.id`, `agent.name`, `agent.parent_id`, `agent.task`, `agent.framework`
35
35
  - **Span events for state transitions:** `agent.planning`, `agent.tool_selection`, `agent.awaiting_human`, `agent.delegating`, `agent.completed`, `agent.error`
36
36
 
37
+ ```typescript
38
+ const agentSpan = tracer.startSpan('agent.code_reviewer.invoke', {
39
+ attributes: {
40
+ 'agent.id': invocationId,
41
+ 'agent.name': 'code_reviewer',
42
+ 'agent.parent_id': parentAgentId ?? '',
43
+ 'agent.task': `review PR #${prNumber}`,
44
+ 'agent.framework': 'custom',
45
+ },
46
+ });
47
+ agentSpan.addEvent('agent.planning');
48
+ // ... agent reasoning and tool calls happen as child spans ...
49
+ agentSpan.addEvent('agent.completed');
50
+ agentSpan.end();
51
+ ```
52
+
37
53
  ## Tool Call Spans
38
54
 
39
55
  Every tool invocation by an agent creates a child span of the agent invocation span.
@@ -41,23 +57,100 @@ Every tool invocation by an agent creates a child span of the agent invocation s
41
57
  - **Span name pattern:** `tool.{tool_name}.execute`
42
58
  - **Required attributes:** `tool.name`, `tool.input_hash` (SHA-256), `tool.output_status`, `tool.duration_ms`, `tool.parameters_count`
43
59
  - Tool spans must be children of the invoking agent span. Set span status to `ERROR` when `tool.output_status` is `error` or `timeout`.
60
+ - For tools performing I/O, create nested child spans using appropriate semantic conventions (`http.*`, `db.*`).
61
+
62
+ ```typescript
63
+ const toolSpan = tracer.startSpan(
64
+ 'tool.git_diff.execute',
65
+ { attributes: { 'tool.name': 'git_diff' } },
66
+ trace.setSpan(context.active(), agentSpan),
67
+ );
68
+ try {
69
+ const result = await tools.gitDiff(params);
70
+ toolSpan.setAttributes({
71
+ 'tool.output_status': 'success',
72
+ 'tool.duration_ms': performance.now() - startTime,
73
+ 'tool.input_hash': hashInput(params),
74
+ });
75
+ } catch (err) {
76
+ toolSpan.setAttributes({ 'tool.output_status': 'error' });
77
+ toolSpan.setStatus({ code: SpanStatusCode.ERROR, message: err.message });
78
+ toolSpan.recordException(err);
79
+ throw err;
80
+ } finally {
81
+ toolSpan.end();
82
+ }
83
+ ```
44
84
 
45
85
  ## LLM Request/Response Tracing
46
86
 
47
87
  - **Span name pattern:** `gen_ai.{operation}` (e.g., `gen_ai.chat`, `gen_ai.completion`)
48
- - **Token tracking:** Capture `gen_ai.usage.input_tokens` and `gen_ai.usage.output_tokens`. Aggregate in metrics.
88
+ - **Token tracking:** Capture `gen_ai.usage.input_tokens` and `gen_ai.usage.output_tokens`. Aggregate in metrics: Counter `gen_ai.tokens_total` with labels `{direction, model, agent_name}`, Histogram `gen_ai.request_duration_ms`.
49
89
  - **Model version tracking:** Record both `gen_ai.request.model` and `gen_ai.response.model` for drift detection.
50
- - **Retry spans:** Each retry attempt is a separate child span. Set `gen_ai.request.retries` on the final span.
51
- - Never log raw prompt content or full model responses as span attributes.
90
+ - **Retry spans:** Each retry attempt is a separate child span. Set `gen_ai.request.retries` on the final span. Record `http.response.status_code` on failed spans (429 vs 500+).
91
+ - Never log raw prompt content or full model responses as span attributes. Use token counts for cost tracking and correlated logs for prompt debugging in non-production environments.
92
+ - Sample GenAI spans at 50-100% in production (higher than general spans) because each call is expensive and low volume.
52
93
 
53
94
  ## Tool Call Audit Trail
54
95
 
55
- Maintain a structured audit log for every tool invocation in agentic workflows. Key fields: `tool.name`, `tool.input_hash`, `tool.output_status`, `tool.duration_ms`, `agent.id`, `agent.name`, `correlation.id`, `timestamp`, `session.id`. Retain for 90 days minimum.
96
+ Maintain a structured audit log for every tool invocation in agentic workflows, separate from tracing spans.
97
+
98
+ | Field | Type | Description |
99
+ |-------|------|-------------|
100
+ | `tool.name` | string | Name of the tool invoked |
101
+ | `tool.input_hash` | string | SHA-256 hash of tool input (never log raw input) |
102
+ | `tool.output_status` | string | `success`, `error`, `timeout`, or `denied` |
103
+ | `tool.duration_ms` | float | Execution time in milliseconds |
104
+ | `agent.id` | string | ID of the invoking agent |
105
+ | `agent.name` | string | Human-readable agent name |
106
+ | `correlation.id` | string | Trace correlation ID |
107
+ | `timestamp` | string | ISO 8601 timestamp |
108
+ | `session.id` | string | Session identifier |
109
+
110
+ - Log tool invocations at `info` level, failures at `error` level with `error.type` and `error.message`.
111
+ - Aggregate tool call counts per agent per session for anomaly detection.
112
+ - Retain audit logs for a minimum of 90 days.
56
113
 
57
114
  ## Correlation IDs for Agent Workflows
58
115
 
59
- - Use UUIDv4 with workflow-type prefix: `{workflow-type}-{uuid}`.
116
+ - Use UUIDv4 with workflow-type prefix: `{workflow-type}-{uuid}` (e.g., `agent-run-550e8400-...`).
60
117
  - Generate at the workflow entry point. Propagate to all sub-agents and tool calls.
61
118
  - Every log entry, span, and metric must include `correlation.id`.
62
119
  - Cross-process: propagate via `X-Correlation-ID` header alongside W3C Trace Context.
63
- - Use OpenTelemetry `SpanLink` for cross-workflow references.
120
+ - Use OpenTelemetry `SpanLink` for cross-workflow references (e.g., agent run triggered by CI event).
121
+
122
+ ```typescript
123
+ import { randomUUID } from 'node:crypto';
124
+ import { context, trace, SpanStatusCode } from '@opentelemetry/api';
125
+
126
+ function generateCorrelationId(workflowType: string): string {
127
+ return `${workflowType}-${randomUUID()}`;
128
+ }
129
+
130
+ async function runAgentWorkflow(task: string): Promise<void> {
131
+ const correlationId = generateCorrelationId('agent-run');
132
+ const tracer = trace.getTracer('agent-orchestrator');
133
+ const rootSpan = tracer.startSpan('agent.orchestrator.invoke', {
134
+ attributes: {
135
+ 'correlation.id': correlationId,
136
+ 'agent.name': 'orchestrator',
137
+ 'agent.task': task,
138
+ },
139
+ });
140
+ try {
141
+ await context.with(trace.setSpan(context.active(), rootSpan), async () => {
142
+ await delegateToSubAgent('code_reviewer', {
143
+ correlationId,
144
+ parentSpanId: rootSpan.spanContext().spanId,
145
+ task: 'review changes',
146
+ });
147
+ });
148
+ } catch (err) {
149
+ rootSpan.setStatus({ code: SpanStatusCode.ERROR, message: (err as Error).message });
150
+ rootSpan.recordException(err as Error);
151
+ throw err;
152
+ } finally {
153
+ rootSpan.end();
154
+ }
155
+ }
156
+ ```