hatch3r 1.3.0 → 1.4.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 (62) hide show
  1. package/README.md +2 -1
  2. package/agents/hatch3r-a11y-auditor.md +7 -11
  3. package/agents/hatch3r-architect.md +7 -11
  4. package/agents/hatch3r-ci-watcher.md +7 -10
  5. package/agents/hatch3r-context-rules.md +5 -7
  6. package/agents/hatch3r-dependency-auditor.md +7 -13
  7. package/agents/hatch3r-devops.md +7 -13
  8. package/agents/hatch3r-docs-writer.md +7 -11
  9. package/agents/hatch3r-fixer.md +2 -8
  10. package/agents/hatch3r-implementer.md +2 -8
  11. package/agents/hatch3r-learnings-loader.md +5 -7
  12. package/agents/hatch3r-lint-fixer.md +7 -9
  13. package/agents/hatch3r-perf-profiler.md +7 -11
  14. package/agents/hatch3r-researcher.md +6 -8
  15. package/agents/hatch3r-reviewer.md +7 -10
  16. package/agents/hatch3r-security-auditor.md +7 -12
  17. package/agents/hatch3r-test-writer.md +7 -11
  18. package/agents/shared/external-knowledge.md +21 -0
  19. package/agents/shared/quality-charter.md +78 -0
  20. package/commands/board/pickup-azure-devops.md +4 -0
  21. package/commands/board/pickup-delegation-multi.md +3 -0
  22. package/commands/board/pickup-delegation.md +3 -0
  23. package/commands/board/pickup-github.md +4 -0
  24. package/commands/board/pickup-gitlab.md +4 -0
  25. package/commands/board/pickup-post-impl.md +8 -1
  26. package/commands/board/shared-azure-devops.md +13 -3
  27. package/commands/board/shared-github.md +1 -0
  28. package/commands/board/shared-gitlab.md +9 -2
  29. package/commands/hatch3r-agent-customize.md +5 -1
  30. package/commands/hatch3r-board-groom.md +55 -2
  31. package/commands/hatch3r-board-init.md +5 -2
  32. package/commands/hatch3r-board-shared.md +37 -2
  33. package/commands/hatch3r-command-customize.md +4 -0
  34. package/commands/hatch3r-hooks.md +1 -1
  35. package/commands/hatch3r-quick-change.md +29 -3
  36. package/commands/hatch3r-revision.md +136 -16
  37. package/commands/hatch3r-rule-customize.md +4 -0
  38. package/commands/hatch3r-skill-customize.md +4 -0
  39. package/commands/hatch3r-workflow.md +10 -1
  40. package/dist/cli/index.js +522 -360
  41. package/dist/cli/index.js.map +1 -1
  42. package/package.json +12 -9
  43. package/rules/hatch3r-agent-orchestration-detail.md +159 -0
  44. package/rules/hatch3r-agent-orchestration-detail.mdc +156 -0
  45. package/rules/hatch3r-agent-orchestration.md +91 -330
  46. package/rules/hatch3r-agent-orchestration.mdc +127 -149
  47. package/rules/hatch3r-code-standards.mdc +10 -2
  48. package/rules/hatch3r-component-conventions.mdc +0 -1
  49. package/rules/hatch3r-deep-context.mdc +30 -8
  50. package/rules/hatch3r-dependency-management.mdc +17 -5
  51. package/rules/hatch3r-i18n.mdc +0 -1
  52. package/rules/hatch3r-migrations.mdc +12 -1
  53. package/rules/hatch3r-observability.mdc +289 -0
  54. package/rules/hatch3r-security-patterns.mdc +11 -0
  55. package/rules/hatch3r-testing.mdc +1 -1
  56. package/rules/hatch3r-theming.mdc +0 -1
  57. package/rules/hatch3r-tooling-hierarchy.mdc +18 -4
  58. package/skills/hatch3r-agent-customize/SKILL.md +4 -72
  59. package/skills/hatch3r-command-customize/SKILL.md +4 -62
  60. package/skills/hatch3r-customize/SKILL.md +117 -0
  61. package/skills/hatch3r-rule-customize/SKILL.md +4 -65
  62. package/skills/hatch3r-skill-customize/SKILL.md +4 -62
@@ -4,222 +4,200 @@ alwaysApply: true
4
4
  ---
5
5
  # Agent Orchestration
6
6
 
7
- This rule governs when and how to delegate work to hatch3r agents, load skills, and spawn subagents. These directives are mandatory — not suggestions.
7
+ This rule governs when and how to delegate work to hatch3r agents, load skills, and spawn subagents. These directives are mandatory — not suggestions. For extended reference on pipeline context schemas, resilience/failure handling, and observability, see `hatch3r-agent-orchestration-detail`.
8
8
 
9
- ## Universal Applicability
9
+ ## Orchestration Differentiation
10
10
 
11
- This rule applies to EVERY context without exception:
11
+ Hatch3r's orchestration uses a **phase-gated pipeline** (Research, Implement, Review, Quality) with **structured handoffs** via `PipelineContext` and a **mandatory review gate** before the quality phase. This is not free-form agent chat.
12
12
 
13
- - **Board-pickup** (epic, sub-issue, standalone, batch)
14
- - **Workflow command** (full mode and quick mode)
15
- - **Plain chat** (single task or multiple tasks)
16
- - **Issue references** (e.g., "implement #5")
17
- - **Natural language requests** (e.g., "add a dark mode toggle")
13
+ ## Universal Applicability
18
14
 
19
- Whether the user invokes a command or simply asks for a task in conversation, the full sub-agent pipeline defined below is mandatory. There is no context where implementing code inline (without sub-agents) is acceptable.
15
+ This rule applies to EVERY context without exception: board-pickup (epic, sub-issue, standalone, batch), workflow command (full/quick), plain chat, issue references, and natural language requests. The full sub-agent pipeline is mandatory never implement code inline without sub-agents.
20
16
 
21
17
  ## Universal Sub-Agent Pipeline
22
18
 
23
- Every task MUST follow this four-phase pipeline:
24
-
25
- **Phase 1 — Research:** Spawn `hatch3r-researcher` for context gathering. Skip only for trivial single-line edits (typos, comment fixes, single-value config changes). All other tasks require researcher context. **Before spawning researchers, score the task's complexity per the `hatch3r-deep-context` rule** and add the tier-appropriate researcher modes alongside the standard task-type modes (see Deep Context Integration below).
26
-
27
- **Phase 2 — Implement:** Spawn `hatch3r-implementer` for ALL code changes. One dedicated implementer per task. Never implement inline — always delegate via the Task tool. **Include reference conventions, resolved requirements, and blast radius data** from Phase 1 in the implementer prompt when available (see Deep Context Integration below).
28
-
29
- **Phase 3 — Review Loop:**
30
-
31
- - 3a. Spawn `hatch3r-reviewer` to review the implementation.
32
- - 3b. If Critical or Warning findings exist: spawn `hatch3r-fixer` with the reviewer output. When fixes touch shared or public interfaces, also include blast radius data and reference conventions from Phase 1 (if available).
33
- - 3c. Re-review: spawn `hatch3r-reviewer` on the fixed code.
34
- - 3d. Repeat 3b–3c until the reviewer reports 0 Critical + 0 Warning, or max 3 iterations reached.
35
- - 3e. If max iterations reached with remaining findings: surface to user for manual resolution.
36
-
37
- **Phase 4 — Final Quality** (runs ONLY after the review loop is clean):
38
-
39
- Spawn all applicable specialists in parallel:
40
-
41
- | Specialist | When | Mandatory? |
42
- |-----------|------|------------|
43
- | `hatch3r-test-writer` | After every code change | YES — always for code changes |
44
- | `hatch3r-security-auditor` | After every code change | YES — always for code changes |
45
- | `hatch3r-docs-writer` | After every implementation | EVALUATE — spawn when changes affect APIs, architecture, user-facing behavior, or when specs/ADRs need updating |
46
- | `hatch3r-lint-fixer` | When lint errors present | Conditional |
47
- | `hatch3r-a11y-auditor` | When UI/accessibility changes | Conditional |
48
- | `hatch3r-perf-profiler` | When performance-sensitive changes | Conditional |
49
- | `hatch3r-dependency-auditor` | When dependencies change | Conditional |
50
- | `hatch3r-ci-watcher` | When CI fails | Conditional |
51
- | `hatch3r-architect` | When architectural decisions are needed or system design review is requested | Conditional |
52
- | `hatch3r-devops` | When CI/CD, deployment, or infrastructure tasks are involved | Conditional |
19
+ Every task MUST follow this four-phase pipeline: **Phase 1 — Research** (`hatch3r-researcher`), **Phase 2 — Implement** (`hatch3r-implementer`), **Phase 3 — Review Loop** (`hatch3r-reviewer` + `hatch3r-fixer`), **Phase 4 — Final Quality** (parallel specialists). See Mandatory Delegation Directives below.
53
20
 
54
21
  ## Agent Roster
55
22
 
56
23
  | Agent | Purpose | Invoke When |
57
24
  |-------|---------|-------------|
58
- | `hatch3r-researcher` | Context gathering across 15 research modes | ALWAYS before implementation. Skip only for trivial single-line edits. Select modes by task type + tier-appropriate deep context modes. |
59
- | `hatch3r-implementer` | Focused single-task implementation | ALWAYS. One dedicated implementer per task — standalone issues, epic sub-issues, batched issues, and plain chat tasks all get dedicated implementers. |
60
- | `hatch3r-reviewer` | Code review for quality, security, performance | ALWAYS in review loop (Phase 3). Reviews implementation, then re-reviews after fixes. |
61
- | `hatch3r-fixer` | Targeted fixes for reviewer findings | When `hatch3r-reviewer` reports Critical or Warning findings during the review loop (Phase 3). |
62
- | `hatch3r-test-writer` | Regression and coverage tests | ALWAYS for code changes in final quality (Phase 4). Not just bugs — every code change gets tests. |
63
- | `hatch3r-security-auditor` | Security rules, data flows, access control | ALWAYS for code changes in final quality (Phase 4). Not just `area:security` — every code change gets a security review. |
64
- | `hatch3r-docs-writer` | Specs, ADRs, documentation maintenance | ALWAYS evaluate in final quality (Phase 4). Spawn when changes affect APIs, architecture, or user-facing behavior. |
65
- | `hatch3r-lint-fixer` | Style, formatting, type error cleanup | After implementation when lint errors are present. |
66
- | `hatch3r-a11y-auditor` | WCAG AA compliance checks | When UI/accessibility changes are made. |
67
- | `hatch3r-perf-profiler` | Performance profiling and optimization | When performance-sensitive changes are made. |
68
- | `hatch3r-dependency-auditor` | Supply chain security, CVE scanning | When dependencies change or new packages are added. |
69
- | `hatch3r-ci-watcher` | CI/CD failure diagnosis and fix suggestions | When CI fails during or after implementation. |
70
- | `hatch3r-architect` | Architecture design, system design review, technical decision documentation | When architectural decisions are needed or system design review is requested. |
71
- | `hatch3r-devops` | CI/CD pipeline operations, deployment configuration, infrastructure setup | When CI/CD, deployment, or infrastructure tasks are involved. |
25
+ | `hatch3r-researcher` | Context gathering (15 modes) | Always before implementation (skip trivial edits) |
26
+ | `hatch3r-implementer` | Single-task implementation | Always one per task |
27
+ | `hatch3r-reviewer` | Code review | Always Phase 3 review loop |
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) |
31
+ | `hatch3r-docs-writer` | Documentation | Phase 4 evaluate when APIs/architecture/UX affected |
32
+ | `hatch3r-lint-fixer` | Lint/type fixes | Conditional lint errors present |
33
+ | `hatch3r-a11y-auditor` | WCAG AA checks | Conditional UI/accessibility changes |
34
+ | `hatch3r-perf-profiler` | Performance profiling | Conditional performance-sensitive changes |
35
+ | `hatch3r-dependency-auditor` | CVE/supply chain | Conditional dependencies change |
36
+ | `hatch3r-ci-watcher` | CI failure diagnosis | Conditional CI fails |
37
+ | `hatch3r-architect` | Architecture design | Conditional architectural decisions needed |
38
+ | `hatch3r-devops` | CI/CD and deployment | Conditional infrastructure tasks |
72
39
 
73
40
  ## Deep Context Integration
74
41
 
75
- Before spawning researchers in Phase 1, score the task's complexity using the `hatch3r-deep-context` rule criteria. The resulting tier determines which additional researcher modes to include alongside the standard task-type modes.
76
-
77
- ### Tier-Adjusted Research Modes
42
+ Score task complexity per the `hatch3r-deep-context` rule before Phase 1. Apply the resulting tier:
78
43
 
79
- **Tier 1 (Light — score 0–2):** Use only the standard task-type modes below. No additional modes.
44
+ - **Tier 2 (Standard):** Present elicitation questions inline. Await answers before Phase 2.
45
+ - **Tier 3 (Deep):** Present Pre-Implementation Summary and ASK for confirmation. Do NOT proceed until all unresolved questions are answered.
80
46
 
81
- **Tier 2 (Standard — score 3–5):** Add these modes at `quick` depth alongside the task-type modes:
82
- - `requirements-elicitation` — scan for top ambiguities, ask 3–5 clarifying questions
83
- - `similar-implementation` — find 1 reference implementation, extract top-level patterns
47
+ ## Mandatory Delegation Directives
84
48
 
85
- Present the elicitation questions to the user inline. Await answers before proceeding to Phase 2.
49
+ ### Context Gathering (Before Implementation)
86
50
 
87
- **Tier 3 (Deep score 6+):** Add these modes at `deep` depth alongside the task-type modes:
88
- - `requirements-elicitation` — full 10-dimension ambiguity scan, dependency questions, cross-cutting concern checklist
89
- - `similar-implementation` — find 2–3 references, full convention extraction, divergence analysis
90
- - `codebase-impact` at `deep` depth (with transitive tracing, API consumer map, blast radius)
51
+ Spawn `hatch3r-researcher` before implementing any task. Skip only for trivial single-line edits. Select modes by task type, then add tier-appropriate modes per Deep Context Integration:
91
52
 
92
- **Mandatory Tier 3 checkpoint:** Present a consolidated Pre-Implementation Summary to the user and ASK for confirmation. Do NOT proceed to Phase 2 until all unresolved questions are answered.
53
+ - **`type:bug`**: `symptom-trace`, `root-cause`, `codebase-impact` + tier modes
54
+ - **`type:feature`**: `codebase-impact`, `feature-design`, `architecture` + tier modes
55
+ - **`type:refactor`**: `current-state`, `refactoring-strategy`, `migration-path` + tier modes
56
+ - **`type:qa`**: `codebase-impact` + tier modes
93
57
 
94
- ### Implementer Prompt Enrichment
58
+ Use depth `quick` for low-risk, `standard` for medium-risk, `deep` for high-risk. Tier 3 always uses `deep` depth.
95
59
 
96
- When spawning `hatch3r-implementer` in Phase 2, include the following from Phase 1 results when available:
97
- - **Reference Conventions**: `similar-implementation` output — the implementer uses this in its Convention Lock step (Step 1b)
98
- - **Resolved Requirements**: User's answers to `requirements-elicitation` questions — explicit decisions the implementer should follow instead of guessing
99
- - **Blast Radius**: Enhanced `codebase-impact` output with transitive traces and API consumer maps — informs which consumers and contracts must be preserved
60
+ ### Research Completeness Checklist
100
61
 
101
- ## Mandatory Delegation Directives
62
+ Before Phase 1 to Phase 2 handoff, verify:
102
63
 
103
- ### Context Gathering (Before Implementation)
64
+ - [ ] **All affected files identified** — files to be created, modified, or deleted are listed.
65
+ - [ ] **Blast radius assessed** — downstream consumers and integration points documented.
66
+ - [ ] **Existing tests located** — test files covering affected code identified (or absence noted).
67
+ - [ ] **Dependencies mapped** — internal and external dependencies enumerated.
104
68
 
105
- You MUST spawn a `hatch3r-researcher` subagent before implementing any task. Skip only for trivial single-line edits (typos, comment fixes, single-value config changes). Select research modes by task type, then add tier-appropriate modes per the Deep Context Integration section above:
69
+ If any item is unconfirmed, re-run researcher with additional modes or surface to user.
106
70
 
107
- - **`type:bug`**: modes `symptom-trace`, `root-cause`, `codebase-impact` + tier modes
108
- - **`type:feature`**: modes `codebase-impact`, `feature-design`, `architecture` + tier modes
109
- - **`type:refactor`**: modes `current-state`, `refactoring-strategy`, `migration-path` + tier modes
110
- - **`type:qa`**: modes `codebase-impact` + tier modes
71
+ ### Implementation Delegation
111
72
 
112
- Use depth `quick` for low-risk tasks, `standard` for medium-risk, `deep` for high-risk. The `hatch3r-deep-context` tier may override depth upward (e.g., a Tier 3 task always uses `deep` depth for the additional modes, even if the task-type modes use `standard`).
73
+ Spawn `hatch3r-implementer` via Task tool for ALL code changes. Never implement inline.
113
74
 
114
- ### Implementation Delegation
75
+ - **Single issue**: One implementer. Orchestrator owns git/PR/board.
76
+ - **Plain chat task**: One implementer. Create synthetic issue context first.
77
+ - **Epics**: One implementer per sub-issue, level-by-level respecting dependency order.
78
+ - **Batch**: Group by dependency level, one implementer per issue, shared branch + combined PR.
115
79
 
116
- You MUST spawn a `hatch3r-implementer` subagent via the Task tool for ALL code changes. Never implement inline.
80
+ **Implementer prompt enrichment (Tier 2+):** Include `similar-implementation` findings as "Reference Conventions", resolved `requirements-elicitation` answers as "Resolved Requirements", and blast radius data (Tier 3 only).
117
81
 
118
- - **Single standalone issue**: Spawn one `hatch3r-implementer`. The orchestrator coordinates git, PR, and board operations.
119
- - **Plain chat single task**: Spawn one `hatch3r-implementer`. Create synthetic issue context first (title, acceptance criteria, type).
120
- - **Epics with sub-issues**: Spawn one `hatch3r-implementer` per sub-issue. Execute level-by-level respecting dependency order.
121
- - **Multiple standalone issues (batch)**: Treat as a batch. Group by dependency level, spawn one `hatch3r-implementer` per issue, execute level-by-level. Shared branch, combined PR.
82
+ ### Per-Task Mini-Review
122
83
 
123
- **Implementer prompt enrichment:** For Tier 2 and Tier 3 tasks, include the deep context outputs in the implementer prompt:
124
- - `similar-implementation` findings as "Reference Conventions" (triggers the implementer's Convention Lock step)
125
- - Resolved `requirements-elicitation` answers as "Resolved Requirements"
126
- - Enhanced `codebase-impact` blast radius data (Tier 3 only)
84
+ For multi-sub-task implementations, the implementer performs a lightweight mini-review after each sub-task: verify correctness, check interface contracts, validate no regressions, gate progression. Mini-reviews are internal (no separate reviewer agent).
127
85
 
128
86
  ### Post-Implementation Quality Pipeline
129
87
 
130
- You MUST run the review loop and final quality phases after implementation completes.
131
-
132
88
  **Phase 3 — Review Loop:**
133
89
 
134
- 1. Spawn `hatch3r-reviewer` code review. Include the diff and acceptance criteria in the prompt.
135
- 2. If the reviewer reports Critical or Warning findings: spawn `hatch3r-fixer` with the full reviewer output (findings, file paths, line references, suggested fixes).
136
- 3. After fixes: spawn `hatch3r-reviewer` again to re-review the fixed code.
137
- 4. Repeat steps 2–3 until the reviewer reports 0 Critical + 0 Warning, or max 3 iterations reached.
138
- 5. If max iterations reached with remaining findings: surface to user for manual resolution. Do not proceed to Phase 4 until the user acknowledges.
90
+ 1. Spawn `hatch3r-reviewer` with diff and acceptance criteria. Reviewer includes blast radius summary.
91
+ 2. Critical/Warning findings: spawn `hatch3r-fixer` with full reviewer output.
92
+ 3. Re-review after fixes. Repeat until 0 Critical + 0 Warning, or max 3 iterations.
93
+ 4. **Confirmation pass** after clean review: lightweight re-review for fix-driven regressions and acceptance criteria completeness.
94
+ 5. Max iterations reached: surface to user for manual resolution.
139
95
 
140
- **Phase 4 — Final Quality** (runs ONLY after the review loop is clean):
96
+ **Phase 4 — Final Quality** (after review loop is clean):
141
97
 
142
- Launch as many independent subagents in parallel as the platform supports — no artificial concurrency limit.
98
+ Launch parallel subagents — no artificial concurrency limit.
143
99
 
144
- **Always spawn (mandatory for every code change):**
100
+ - **Always:** `hatch3r-test-writer`, `hatch3r-security-auditor`
101
+ - **Evaluate:** `hatch3r-docs-writer` (when APIs/architecture/UX affected)
102
+ - **Conditional:** `hatch3r-lint-fixer`, `hatch3r-a11y-auditor`, `hatch3r-perf-profiler`, `hatch3r-dependency-auditor`, `hatch3r-architect`, `hatch3r-devops`
145
103
 
146
- 1. `hatch3r-test-writer` tests for all code changes. Unit tests for new logic, regression tests for bug fixes, integration tests for cross-module changes.
147
- 2. `hatch3r-security-auditor` — security review of all code changes. Audit data flows, access control, input validation, and secret management.
104
+ ### Phase 4 Validation Pass
148
105
 
149
- **Always evaluate (spawn when applicable):**
106
+ After all Phase 4 specialists complete, run a validation pass to catch regressions:
150
107
 
151
- 3. `hatch3r-docs-writer` spawn when changes affect public APIs, architectural patterns, user-facing behavior, or when specs/ADRs need updating. If no documentation impact exists, skip silently.
108
+ 1. Run test suite and type checker. Compare against Phase 3 baseline cached in `PipelineContext`.
109
+ 2. No new failures: proceed to completion.
110
+ 3. New failures: identify causing specialist, spawn `hatch3r-fixer`, re-validate (max 2 iterations).
111
+ 4. Persistent regressions: surface to user. Do not silently accept.
152
112
 
153
- **Conditional specialists (spawn when triggered):**
113
+ ### Specialist Success Criteria
154
114
 
155
- 4. `hatch3r-lint-fixer` when lint or type errors are present after implementation.
156
- 5. `hatch3r-a11y-auditor` — when UI or accessibility changes are made.
157
- 6. `hatch3r-perf-profiler` when performance-sensitive changes are made.
158
- 7. `hatch3r-dependency-auditor` when dependencies change or new packages are added.
159
- 8. `hatch3r-architect` when architectural decisions are needed or system design review is requested.
160
- 9. `hatch3r-devops` when CI/CD, deployment, or infrastructure tasks are involved.
115
+ | Specialist | Success Criterion |
116
+ |-----------|-------------------|
117
+ | `hatch3r-test-writer` | All new/modified code paths have tests; no untested branches in changed files. |
118
+ | `hatch3r-security-auditor` | No HIGH/CRITICAL findings unresolved; MEDIUM findings documented with plan. |
119
+ | `hatch3r-docs-writer` | Affected APIs, architecture, and UX changes reflected in docs. |
120
+ | `hatch3r-lint-fixer` | Zero lint/type errors in changed files. |
121
+ | `hatch3r-a11y-auditor` | WCAG AA compliance; no new a11y violations. |
122
+ | `hatch3r-perf-profiler` | No performance regressions; new hot paths benchmarked. |
123
+ | `hatch3r-dependency-auditor` | No known CVEs; license compatibility verified. |
124
+ | `hatch3r-architect` | ADRs documented; design aligns with patterns or divergence justified. |
125
+ | `hatch3r-devops` | CI/CD passes end-to-end; deployment config validated. |
161
126
 
162
127
  ## Skill Loading Directives
163
128
 
164
- Before implementing any task, you MUST read and follow the matching hatch3r skill:
129
+ Load the matching skill before implementation:
165
130
 
166
131
  | Task Type | Skill |
167
132
  |-----------|-------|
168
133
  | `type:bug` | `hatch3r-bug-fix` |
169
- | `type:feature` | `hatch3r-feature` (aka `hatch3r-feature-implementation`) |
134
+ | `type:feature` | `hatch3r-feature` |
170
135
  | `type:refactor` + `area:ui` | `hatch3r-visual-refactor` |
171
136
  | `type:refactor` + behavior change | `hatch3r-logical-refactor` |
172
- | `type:refactor` (other) | `hatch3r-refactor` (aka `hatch3r-code-refactor`) |
137
+ | `type:refactor` (other) | `hatch3r-refactor` |
173
138
  | `type:qa` | `hatch3r-qa-validation` |
174
139
 
175
- When a skill references agents under "Required Agent Delegation", those delegations are mandatory — you MUST spawn the listed agents via the Task tool.
140
+ Skill-referenced agent delegations are mandatory.
176
141
 
177
142
  ## Subagent Spawning Protocol
178
143
 
179
- When spawning any subagent via the Task tool:
144
+ 1. Use `subagent_type: "generalPurpose"` for all delegations.
145
+ 2. Include: agent protocol, applicable `scope: always` rules, tooling hierarchy, relevant learnings.
146
+ 3. Launch independent subagents in parallel — maximum parallelism.
147
+ 4. Await and review results. Surface BLOCKED or PARTIAL to user.
148
+
149
+ ## Correlation ID
150
+
151
+ Generate a UUID v4 per top-level task before Phase 1. Include in every subagent prompt as `correlation_id`. All subagents include it in logs, outputs, and status reports. Epic sub-issues get individual IDs; batch tasks share one ID with a sub-task index.
180
152
 
181
- 1. **Use `subagent_type: "generalPurpose"`** for all hatch3r agent delegations.
182
- 2. **Include in every subagent prompt**:
183
- - The agent protocol to follow (e.g., "Follow the hatch3r-implementer agent protocol").
184
- - All `scope: always` rules from `.agents/rules/` that apply.
185
- - The project's tooling hierarchy (Context7 MCP for library docs, web research for current context).
186
- - Relevant learnings from `.agents/learnings/` if the directory exists.
187
- 3. **Launch as many independent subagents in parallel as the platform supports.** Do not impose an artificial concurrency limit. Use maximum parallelism for independent work.
188
- 4. **Await and review results** before proceeding. If a subagent reports BLOCKED or PARTIAL, surface to the user.
153
+ ## Severity Scale
189
154
 
190
- ## Single-Task Plain Chat Protocol
155
+ | Severity | Definition | Pipeline Action |
156
+ |----------|-----------|-----------------|
157
+ | **CRITICAL** | Blocks merge. Security vulnerabilities, data loss, broken core functionality. | Must resolve before Phase 3 exit. |
158
+ | **HIGH** | Should fix before merge. Significant bugs, performance regressions. | Fix or escalate to user. |
159
+ | **MEDIUM** | Fix in same sprint. Code quality, minor bugs. | Document with remediation plan. |
160
+ | **LOW** | Track for future. Style nits, minor improvements. | Log only. No merge gate. |
161
+ | **INFO** | Informational. Observations, suggestions. | Awareness only. |
191
162
 
192
- When the user provides a single task in plain chat (no command invoked, no issue reference), the full sub-agent pipeline still applies:
163
+ All subagents MUST map findings to this scale.
193
164
 
194
- 1. **Classify** the task by type (bug/feature/refactor/QA/other) based on context.
195
- 2. **Create synthetic issue context** — title, acceptance criteria, and type — from the user's instruction.
196
- 3. **Run the Universal Sub-Agent Pipeline**: Phase 1 (Research) → Phase 2 (Implement) → Phase 3 (Review Loop) → Phase 4 (Final Quality).
197
- 4. For issue references in chat (e.g., "fix #5"), fetch issue details using the platform CLI (check `platform` in `.agents/hatch.json`) and use them as the task context instead of creating synthetic context:
198
- - **GitHub:** `gh issue view`
199
- - **Azure DevOps:** `az boards work-item show --id`
200
- - **GitLab:** `glab issue view`
165
+ ## Status Codes
201
166
 
202
- This ensures consistent quality regardless of how the task was initiated.
167
+ | Status | Meaning |
168
+ |--------|---------|
169
+ | **SUCCESS** | Fully completed, all criteria met. |
170
+ | **PARTIAL** | Partially completed; include `reason` field. |
171
+ | **FAILED** | No usable output; include `reason` field. |
172
+ | **SKIPPED** | Intentionally not executed. |
173
+ | **TIMEOUT** | Time budget exceeded; forward partial output. |
203
174
 
204
- ## Multi-Task Detection (Plain Chat)
175
+ ## Task Context Protocols
205
176
 
206
- When the user provides multiple tasks in a single message numbered lists, comma-separated instructions, multiple issue references (e.g., "implement #1, #3, #7"), or multiple distinct requests — you MUST parallelize them:
177
+ **Single-task plain chat:** Classify task type, create synthetic issue context, run full pipeline. For issue references, fetch details via platform CLI.
207
178
 
208
- 1. **Parse** the message into individual discrete tasks. Each distinct implementation request is one task.
209
- 2. **Classify** each task by type (bug/feature/refactor/QA/other) based on context or explicit labels.
210
- 3. **Build a dependency graph** among the tasks. Independent tasks share the same level and run in parallel.
211
- 4. **Spawn one `hatch3r-researcher` subagent per task** (skip for trivial single-line edits only). Launch in parallel.
212
- 5. **Spawn one `hatch3r-implementer` subagent per task** per dependency level.
213
- 6. **For issue references**: fetch issue details using the platform CLI (check `platform` in `.agents/hatch.json`):
214
- - **GitHub:** `gh issue view`
215
- - **Azure DevOps:** `az boards work-item show --id`
216
- - **GitLab:** `glab issue view`
217
- 7. **For natural language tasks**: create synthetic issue context (title, acceptance criteria, type) from the instruction. Pass this context to the implementer subagent.
218
- 8. **Run the review loop** (Phase 3) after all implementations complete: spawn reviewer, then fixer for Critical/Warning findings, re-review, repeat until clean (max 3 iterations).
219
- 9. **Spawn final quality subagents** (Phase 4, after review loop is clean): test-writer + security-auditor (always), plus docs-writer, auditors as applicable.
179
+ **Multi-task plain chat:** Parse into discrete tasks, classify each, build dependency graph, parallelize researchers and implementers per dependency level, run review loop after all implementations, then Phase 4 specialists.
220
180
 
221
- This directive applies regardless of whether board-pickup was invoked. Any context where implementation tasks are identified MUST use one subagent per task with maximum parallelism.
181
+ **Auto-mode guardrails:** In unattended execution, verify scope containment, no unapproved destructive operations, and output schema compliance after each phase. Halt on violation. See `hatch3r-agent-orchestration-detail` for full guardrail specifications.
222
182
 
223
183
  ## Rule Application
224
184
 
225
- All hatch3r rules with `scope: always` apply to every implementation task, including work delegated to subagents. When constructing subagent prompts, include the rule directives subagents do not automatically inherit the parent's rule context.
185
+ All `scope: always` rules apply to every task including subagent work. Include rule directives in subagent prompts.
186
+
187
+ ### Tiered Rule Inclusion
188
+
189
+ **Tier 1 -- Always include (every subagent):**
190
+ - `hatch3r-security-patterns` -- security invariants
191
+ - `hatch3r-code-standards` -- code quality
192
+
193
+ **Tier 2 -- Include by phase:**
194
+ - `hatch3r-testing` -- test-writer, implementer, reviewer
195
+ - `hatch3r-accessibility-standards` -- a11y-auditor, reviewer (UI)
196
+ - `hatch3r-git-conventions` -- orchestrator git ops
197
+ - `hatch3r-ci-cd` -- ci-watcher, devops
198
+ - `hatch3r-dependency-management` -- dependency-auditor
199
+
200
+ **Tier 3 -- On-demand:**
201
+ - `hatch3r-api-design`, `hatch3r-secrets-management`, `hatch3r-data-classification`, `hatch3r-performance-budgets`, `hatch3r-browser-verification`, `hatch3r-component-conventions`, `hatch3r-i18n`, `hatch3r-theming`, `hatch3r-migrations`, `hatch3r-feature-flags`, `hatch3r-observability`
202
+
203
+ For limited context windows, Tier 1 is mandatory. Tier 2/3 included selectively by agent role and task scope.
@@ -6,9 +6,9 @@ alwaysApply: true
6
6
 
7
7
  ## Core Conventions
8
8
 
9
- - TypeScript strict mode. No `any`. No `@ts-ignore` without a linked issue.
9
+ - Enable strict type checking. No type escape hatches (e.g., `any`, `@ts-ignore`, or equivalent) without a linked issue.
10
10
  - Functions: `camelCase`. Types/Interfaces: `PascalCase`. Constants: `SCREAMING_SNAKE`.
11
- - Component files: `PascalCase` (match framework convention). Logic files: `camelCase.ts`.
11
+ - Component files: `PascalCase` (match framework convention). Logic files: `camelCase` (or language convention).
12
12
  - Max function length: 50 lines. Max file: 400 lines. Cyclomatic complexity: 10.
13
13
  - Use framework-recommended component patterns (e.g., typed props and emits).
14
14
  - Use stores or equivalent for shared state. Prefer composables/hooks over mixins.
@@ -100,6 +100,14 @@ Enforce consistent import ordering via linter rules (e.g., `eslint-plugin-import
100
100
 
101
101
  Separate each group with a blank line. Sort alphabetically within each group.
102
102
 
103
+ ## Monorepo Conventions
104
+
105
+ When working in a monorepo (multiple packages or apps in a single repository):
106
+
107
+ - **Scope changes to a single package at a time.** A PR should touch one package unless the change requires a coordinated cross-package update (e.g., a shared type change and its consumers). Coordinated changes must be documented in the PR description.
108
+ - **Run tests only for affected packages.** Use the monorepo tool's filtering (e.g., `--filter`, `--scope`, `--since`) to run tests, lint, and builds only for packages affected by the current change.
109
+ - **Respect package boundaries — do not import across packages without explicit dependency.** If package A needs something from package B, B must be declared as a dependency in A's `package.json` (or equivalent manifest). Direct file-path imports across package boundaries are forbidden.
110
+
103
111
  ## Dead Code Prevention
104
112
 
105
113
  - Remove unused imports, variables, functions, and type definitions immediately. Do not comment them out "for later."
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  description: Rules for component development in web applications
3
- globs: src/**/*.vue, src/**/*.tsx, src/**/*.jsx
4
3
  alwaysApply: false
5
4
  ---
6
5
  # Component Conventions
@@ -33,7 +33,9 @@ Score every task against these signals before implementation. Each signal adds w
33
33
 
34
34
  ### Tier 1 — Light
35
35
 
36
- Single-file changes, config tweaks, typo fixes, comment edits, constant value changes. No additional analysis required beyond existing researcher modes. Skip deep context analysis entirely.
36
+ Single-file changes, config tweaks, typo fixes, comment edits, constant value changes. No additional analysis required beyond existing researcher modes.
37
+
38
+ Skip deep context analysis entirely. Proceed with the standard pipeline.
37
39
 
38
40
  ### Tier 2 — Standard
39
41
 
@@ -42,7 +44,7 @@ Multi-file changes with clear scope. Run these researcher modes at `quick` depth
42
44
  1. **`requirements-elicitation`** at `quick` — scan for top ambiguities and ask 3–5 clarifying questions.
43
45
  2. **`similar-implementation`** at `quick` — find 1 reference implementation and extract top-level patterns.
44
46
 
45
- Present findings to the user inline. Proceed after answers are received.
47
+ Present findings to the user inline. Proceed after answers are received — no separate confirmation checkpoint required.
46
48
 
47
49
  ### Tier 3 — Deep
48
50
 
@@ -52,18 +54,38 @@ Cross-module features, architectural changes, multi-layer implementations, or ta
52
54
  2. **`similar-implementation`** at `deep` — find 2–3 reference implementations, full convention extraction, divergence analysis.
53
55
  3. **`codebase-impact`** at `deep` — full transitive dependency tracing, API consumer map, blast radius summary.
54
56
 
55
- **Mandatory checkpoint:** Present a consolidated "Pre-Implementation Summary" to the user and ASK for confirmation before proceeding. Do NOT proceed until all unresolved questions are answered.
57
+ **Mandatory checkpoint:** Present a consolidated "Pre-Implementation Summary" to the user and ASK for confirmation before proceeding to implementation:
58
+
59
+ ```
60
+ Pre-Implementation Summary:
61
+ Complexity: Tier 3 (Deep) — score {N}
62
+ Resolved requirements: {N}/{M} dimensions addressed
63
+ Unresolved questions: {list — these MUST be answered before proceeding}
64
+ Reference implementation: {name} — conventions locked
65
+ Blast radius: {N} files directly affected, {M} transitively at risk
66
+ Cross-cutting concerns: {list with status}
67
+ ```
68
+
69
+ Do NOT proceed to implementation until all unresolved questions are answered by the user.
56
70
 
57
71
  ## Passing Context to Implementer
58
72
 
59
- When the `similar-implementation` mode produces reference implementations, include them in the implementer sub-agent prompt as **"Reference Conventions"**. When the `requirements-elicitation` mode produces resolved requirements, include the user's answers as **"Resolved Requirements"**. When `codebase-impact` produces a blast radius summary, include it so the implementer knows which consumers and contracts must be preserved.
73
+ When the `similar-implementation` mode produces reference implementations, include them in the implementer sub-agent prompt as **"Reference Conventions"**. The implementer's Convention Lock step (Step 1b) uses these to align its architectural decisions with established codebase patterns.
74
+
75
+ When the `requirements-elicitation` mode produces resolved requirements, include the user's answers in the implementer sub-agent prompt as **"Resolved Requirements"** so the implementer has explicit answers to all ambiguities rather than guessing.
76
+
77
+ When the enhanced `codebase-impact` mode produces a blast radius summary, include it in the implementer sub-agent prompt so the implementer knows which consumers and contracts must be preserved.
60
78
 
61
79
  ## Integration with Existing Pipeline
62
80
 
63
- This rule augments the existing Universal Sub-Agent Pipeline from `hatch3r-agent-orchestration`. The complexity scoring happens at the start of Phase 1 (Research), and the additional researcher modes run alongside the existing task-type modes.
81
+ This rule augments — not replaces — the existing Universal Sub-Agent Pipeline from `hatch3r-agent-orchestration`. The complexity scoring happens at the start of Phase 1 (Research), and the additional researcher modes run alongside the existing task-type modes:
82
+
83
+ - **`type:feature`**: existing modes `codebase-impact`, `feature-design`, `architecture` + new modes per tier
84
+ - **`type:bug`**: existing modes `symptom-trace`, `root-cause`, `codebase-impact` + `requirements-elicitation` per tier (bugs often have underspecified reproduction steps)
85
+ - **`type:refactor`**: existing modes `current-state`, `refactoring-strategy`, `migration-path` + `similar-implementation` per tier (refactors benefit most from convention alignment)
64
86
 
65
87
  ## Exceptions
66
88
 
67
- - **`hatch3r-quick-change`**: Tier 1 items proceed without research. Tier 2 items get lightweight `similar-implementation` at `quick` depth. Tier 3 items must be routed to `hatch3r-workflow` (hard block).
68
- - **Trivial single-line edits**: Always Tier 1 regardless of scoring. This is the only valid basis for skipping research — label-based shortcuts (e.g., `risk:low AND priority:p3`) are not sufficient alone.
69
- - **`hatch3r-revision`**: Operates on already-implemented code; deep context analysis applies to the original implementation.
89
+ - **`hatch3r-quick-change` command**: Tier 1 items proceed without research. Tier 2 items get lightweight `similar-implementation` at `quick` depth. Tier 3 items must be routed to `hatch3r-workflow` (hard block).
90
+ - **Trivial single-line edits**: Always Tier 1 regardless of scoring signals. This is the only valid basis for skipping research — label-based shortcuts (e.g., `risk:low AND priority:p3`) are not sufficient alone.
91
+ - **`hatch3r-revision` command**: Operates on already-implemented code. Deep context analysis applies to the original implementation, not the revision pass.
@@ -1,15 +1,27 @@
1
1
  ---
2
- description: Rules for managing npm dependencies in the project
3
- alwaysApply: false
2
+ description: Rules for managing project dependencies
3
+ alwaysApply: true
4
4
  ---
5
5
  # Dependency Management
6
6
 
7
- - Always commit `package-lock.json`. Never use `npm install --no-save`.
7
+ - Always commit the lockfile. Never install without saving.
8
8
  - Justify new dependencies in PR description: what it does, why needed, alternatives considered, bundle size impact.
9
9
  - Prefer well-maintained packages: recent commits, active issues, no known CVEs.
10
- - Pin exact versions for production deps. Use `npm ci` in CI.
11
- - Run `npm audit` before merging dependency changes. Fix high/critical before merge.
10
+ - Pin exact versions for production deps. Use clean install (e.g., `npm ci`, `pip install -r`, `cargo build`) in CI.
11
+ - Run a dependency security scanner (e.g., `npm audit`, `pip-audit`, `cargo audit`) before merging dependency changes. Fix high/critical before merge.
12
12
  - No duplicate packages serving the same purpose. Consolidate on one.
13
13
  - Remove unused dependencies on every cleanup pass.
14
14
  - Security patches (CVEs) are P0/P1 priority. Patch within 48h for critical.
15
15
  - Check bundle size impact against budget. Reject deps that exceed.
16
+
17
+ ## Transitive Dependency Hygiene
18
+
19
+ - Audit transitive dependencies, not just direct ones. A direct dependency with a compromised transitive dep is still a vulnerability. Use `npm ls`, `pip show`, or `cargo tree` to inspect the full dependency graph.
20
+ - When a transitive dependency has a known CVE, determine whether the vulnerable code path is reachable from your project. If reachable, override or patch the transitive dep. If unreachable, document the finding with justification for deferral.
21
+ - Avoid dependencies that pull in excessively large transitive trees for minimal functionality. If a package adds 50+ transitive deps for a single utility function, write the utility inline or find a lighter alternative.
22
+
23
+ ## Version Upgrade Strategy
24
+
25
+ - Review changelogs and migration guides before upgrading major versions. Never blindly bump major versions and assume backward compatibility.
26
+ - Run the full test suite after any dependency upgrade, including integration tests. A passing unit test suite does not guarantee compatibility with upgraded peer dependencies.
27
+ - When upgrading a shared dependency used across multiple modules, upgrade all consumers in the same PR to avoid version skew within the monorepo or project.
@@ -1,6 +1,5 @@
1
1
  ---
2
2
  description: Internationalization, localization, and RTL support conventions for the project
3
- globs: src/**/*.vue, src/**/*.tsx, src/**/*.jsx, src/**/*.ts
4
3
  alwaysApply: false
5
4
  ---
6
5
  # Internationalization & RTL
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  description: Database migration and schema change patterns for the project
3
- alwaysApply: false
3
+ alwaysApply: true
4
4
  ---
5
5
  # Migrations
6
6
 
@@ -13,3 +13,14 @@ alwaysApply: false
13
13
  - Document schema changes in project data model spec.
14
14
  - Rollback plan required for every migration. Never run destructive migrations without backup verification.
15
15
  - Hot documents must stay within size limits after migration.
16
+
17
+ ## Data Validation During Migration
18
+
19
+ - Validate data integrity after each migration step, not just at the end. Check that migrated records match the expected schema, required fields are populated, and no data was silently dropped.
20
+ - Include count checks: the number of records processed should match the number of records in the source collection. Log discrepancies as errors, not warnings.
21
+ - For large datasets, migrate in batches with progress checkpoints. If a batch fails, resume from the last checkpoint rather than restarting the entire migration.
22
+
23
+ ## Migration Coordination in Multi-Service Environments
24
+
25
+ - When a migration affects shared data (e.g., a schema used by multiple services), coordinate the migration order across services. The consuming services must be deployed with backward-compatible readers before the migration runs.
26
+ - Never assume that all service instances will be running the same code version during a migration window. Design migrations to tolerate mixed-version reads and writes during the rollout period.