hatch3r 1.0.0 → 1.2.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 (144) hide show
  1. package/README.md +93 -322
  2. package/agents/hatch3r-a11y-auditor.md +24 -6
  3. package/agents/hatch3r-architect.md +20 -1
  4. package/agents/hatch3r-ci-watcher.md +31 -8
  5. package/agents/hatch3r-context-rules.md +14 -2
  6. package/agents/hatch3r-dependency-auditor.md +21 -5
  7. package/agents/hatch3r-devops.md +37 -6
  8. package/agents/hatch3r-docs-writer.md +19 -3
  9. package/agents/hatch3r-fixer.md +171 -0
  10. package/agents/hatch3r-implementer.md +84 -11
  11. package/agents/hatch3r-learnings-loader.md +69 -13
  12. package/agents/hatch3r-lint-fixer.md +19 -14
  13. package/agents/hatch3r-perf-profiler.md +18 -1
  14. package/agents/hatch3r-researcher.md +440 -5
  15. package/agents/hatch3r-reviewer.md +97 -5
  16. package/agents/hatch3r-security-auditor.md +23 -5
  17. package/agents/hatch3r-test-writer.md +21 -10
  18. package/checks/README.md +49 -0
  19. package/checks/code-quality.md +49 -0
  20. package/checks/performance.md +58 -0
  21. package/checks/security.md +58 -0
  22. package/checks/testing.md +53 -0
  23. package/commands/board/pickup-azure-devops.md +81 -0
  24. package/commands/board/pickup-delegation-multi.md +197 -0
  25. package/commands/board/pickup-delegation.md +100 -0
  26. package/commands/board/pickup-github.md +82 -0
  27. package/commands/board/pickup-gitlab.md +81 -0
  28. package/commands/board/pickup-modes.md +143 -0
  29. package/commands/board/pickup-post-impl.md +120 -0
  30. package/commands/board/shared-azure-devops.md +149 -0
  31. package/commands/board/shared-board-overview.md +215 -0
  32. package/commands/board/shared-github.md +169 -0
  33. package/commands/board/shared-gitlab.md +142 -0
  34. package/commands/hatch3r-agent-customize.md +40 -2
  35. package/commands/hatch3r-api-spec.md +294 -32
  36. package/commands/hatch3r-benchmark.md +386 -32
  37. package/commands/hatch3r-board-fill.md +161 -25
  38. package/commands/hatch3r-board-groom.md +595 -0
  39. package/commands/hatch3r-board-init.md +203 -46
  40. package/commands/hatch3r-board-pickup.md +79 -457
  41. package/commands/hatch3r-board-refresh.md +98 -27
  42. package/commands/hatch3r-board-shared.md +87 -238
  43. package/commands/hatch3r-bug-plan.md +16 -3
  44. package/commands/hatch3r-codebase-map.md +43 -10
  45. package/commands/hatch3r-command-customize.md +6 -0
  46. package/commands/hatch3r-context-health.md +5 -0
  47. package/commands/hatch3r-cost-tracking.md +5 -0
  48. package/commands/hatch3r-debug.md +426 -0
  49. package/commands/hatch3r-dep-audit.md +7 -1
  50. package/commands/hatch3r-feature-plan.md +74 -12
  51. package/commands/hatch3r-healthcheck.md +17 -1
  52. package/commands/hatch3r-hooks.md +16 -10
  53. package/commands/hatch3r-learn.md +15 -9
  54. package/commands/hatch3r-migration-plan.md +333 -33
  55. package/commands/hatch3r-onboard.md +327 -38
  56. package/commands/hatch3r-project-spec.md +46 -10
  57. package/commands/hatch3r-quick-change.md +336 -0
  58. package/commands/hatch3r-recipe.md +6 -0
  59. package/commands/hatch3r-refactor-plan.md +29 -13
  60. package/commands/hatch3r-release.md +13 -3
  61. package/commands/hatch3r-revision.md +395 -0
  62. package/commands/hatch3r-roadmap.md +18 -3
  63. package/commands/hatch3r-rule-customize.md +6 -0
  64. package/commands/hatch3r-security-audit.md +17 -1
  65. package/commands/hatch3r-skill-customize.md +6 -0
  66. package/commands/hatch3r-test-plan.md +532 -0
  67. package/commands/hatch3r-workflow.md +113 -38
  68. package/dist/cli/index.js +5184 -2593
  69. package/dist/cli/index.js.map +1 -0
  70. package/github-agents/hatch3r-docs-agent.md +1 -0
  71. package/github-agents/hatch3r-lint-agent.md +1 -0
  72. package/github-agents/hatch3r-security-agent.md +1 -0
  73. package/github-agents/hatch3r-test-agent.md +1 -0
  74. package/hooks/hatch3r-ci-failure.md +30 -0
  75. package/hooks/hatch3r-file-save.md +22 -0
  76. package/hooks/hatch3r-post-merge.md +23 -0
  77. package/hooks/hatch3r-pre-commit.md +23 -0
  78. package/hooks/hatch3r-pre-push.md +22 -0
  79. package/hooks/hatch3r-session-start.md +22 -0
  80. package/mcp/mcp.json +22 -3
  81. package/package.json +4 -7
  82. package/prompts/hatch3r-bug-triage.md +1 -0
  83. package/prompts/hatch3r-code-review.md +1 -0
  84. package/prompts/hatch3r-pr-description.md +1 -0
  85. package/rules/hatch3r-accessibility-standards.md +1 -0
  86. package/rules/hatch3r-agent-orchestration.md +326 -53
  87. package/rules/hatch3r-agent-orchestration.mdc +225 -0
  88. package/rules/hatch3r-api-design.md +4 -1
  89. package/rules/hatch3r-browser-verification.md +33 -1
  90. package/rules/hatch3r-browser-verification.mdc +29 -0
  91. package/rules/hatch3r-ci-cd.md +5 -1
  92. package/rules/hatch3r-ci-cd.mdc +4 -1
  93. package/rules/hatch3r-code-standards.md +18 -0
  94. package/rules/hatch3r-code-standards.mdc +10 -1
  95. package/rules/hatch3r-component-conventions.md +4 -1
  96. package/rules/hatch3r-data-classification.md +1 -0
  97. package/rules/hatch3r-deep-context.md +94 -0
  98. package/rules/hatch3r-deep-context.mdc +69 -0
  99. package/rules/hatch3r-dependency-management.md +13 -0
  100. package/rules/hatch3r-feature-flags.md +4 -1
  101. package/rules/hatch3r-git-conventions.md +1 -0
  102. package/rules/hatch3r-i18n.md +4 -1
  103. package/rules/hatch3r-learning-consult.md +4 -2
  104. package/rules/hatch3r-learning-consult.mdc +3 -2
  105. package/rules/hatch3r-migrations.md +12 -0
  106. package/rules/hatch3r-observability.md +293 -1
  107. package/rules/hatch3r-performance-budgets.md +5 -2
  108. package/rules/hatch3r-performance-budgets.mdc +1 -1
  109. package/rules/hatch3r-secrets-management.md +11 -3
  110. package/rules/hatch3r-secrets-management.mdc +10 -3
  111. package/rules/hatch3r-security-patterns.md +23 -3
  112. package/rules/hatch3r-security-patterns.mdc +8 -2
  113. package/rules/hatch3r-testing.md +1 -0
  114. package/rules/hatch3r-theming.md +4 -1
  115. package/rules/hatch3r-tooling-hierarchy.md +42 -15
  116. package/rules/hatch3r-tooling-hierarchy.mdc +27 -4
  117. package/skills/hatch3r-a11y-audit/SKILL.md +1 -0
  118. package/skills/hatch3r-agent-customize/SKILL.md +3 -0
  119. package/skills/hatch3r-api-spec/SKILL.md +1 -0
  120. package/skills/hatch3r-architecture-review/SKILL.md +6 -2
  121. package/skills/hatch3r-bug-fix/SKILL.md +4 -1
  122. package/skills/hatch3r-ci-pipeline/SKILL.md +1 -0
  123. package/skills/hatch3r-command-customize/SKILL.md +1 -0
  124. package/skills/hatch3r-context-health/SKILL.md +2 -1
  125. package/skills/hatch3r-cost-tracking/SKILL.md +1 -0
  126. package/skills/hatch3r-dep-audit/SKILL.md +6 -2
  127. package/skills/hatch3r-feature/SKILL.md +9 -2
  128. package/skills/hatch3r-gh-agentic-workflows/SKILL.md +130 -21
  129. package/skills/hatch3r-incident-response/SKILL.md +11 -5
  130. package/skills/hatch3r-issue-workflow/SKILL.md +12 -7
  131. package/skills/hatch3r-logical-refactor/SKILL.md +1 -0
  132. package/skills/hatch3r-migration/SKILL.md +1 -0
  133. package/skills/hatch3r-perf-audit/SKILL.md +2 -1
  134. package/skills/hatch3r-pr-creation/SKILL.md +20 -10
  135. package/skills/hatch3r-qa-validation/SKILL.md +2 -1
  136. package/skills/hatch3r-recipe/SKILL.md +1 -0
  137. package/skills/hatch3r-refactor/SKILL.md +7 -1
  138. package/skills/hatch3r-release/SKILL.md +15 -11
  139. package/skills/hatch3r-rule-customize/SKILL.md +1 -0
  140. package/skills/hatch3r-skill-customize/SKILL.md +1 -0
  141. package/skills/hatch3r-visual-refactor/SKILL.md +1 -0
  142. package/dist/cli/hooks-ZOTFDEA3.js +0 -59
  143. package/rules/hatch3r-error-handling.md +0 -17
  144. package/rules/hatch3r-error-handling.mdc +0 -15
@@ -0,0 +1,395 @@
1
+ ---
2
+ id: hatch3r-revision
3
+ type: command
4
+ description: User-guided revision of agent-implemented code in a fresh context window. Reconstructs what was done, interviews the user for feedback, fixes issues, cleans up leftovers, and drives toward merge readiness.
5
+ tags: [implementation, team]
6
+ ---
7
+
8
+ ## Agent Pipeline
9
+
10
+ | Stage | Agent(s) | Parallel | Required |
11
+ |-------|----------|----------|----------|
12
+ | 1. Context Reconstruction | Orchestrator (inline) | No | Yes |
13
+ | 2. User Feedback | User interview (ASK checkpoints) | No | Yes |
14
+ | 3. Leftover Scan | Orchestrator (inline) | No | Yes |
15
+ | 4. Fix Implementation | `hatch3r-implementer`, `hatch3r-lint-fixer`, `hatch3r-test-writer` | Per finding type | Yes |
16
+ | 5a. Review Loop | `hatch3r-reviewer` -> `hatch3r-fixer` (max 3 iterations) | No (sequential) | Yes |
17
+ | 5b. Final Quality | `hatch3r-test-writer` + `hatch3r-security-auditor` | Yes | Yes (code changes) |
18
+
19
+ ## Browser Automation
20
+
21
+ At the start of this command, ask the user once:
22
+
23
+ > "Would you like to enable browser verification for this session? This uses Playwright to test changes in the running application."
24
+
25
+ If **yes**: fix implementation (Stage 4) and quality verification (Stage 5) include browser verification steps — navigate to affected pages, verify fixes visually, check console for errors.
26
+
27
+ If **no**: all browser verification steps are skipped silently throughout the entire command.
28
+
29
+ # Revision -- From Implementation to Merge Ready
30
+
31
+ User-guided revision command for a **fresh context window**. After an agent implements code (via `hatch3r-board-pickup`, `hatch3r-workflow`, or plain instruction), the user tests the result, opens a new context, and runs this command. The agent reconstructs what was done from the git diff, interviews the user for feedback, fixes all reported issues, proactively cleans up agent leftovers, and drives toward merge readiness in a single loop.
32
+
33
+ The user is the reviewer. The agent is the interviewer and fixer.
34
+
35
+ ---
36
+
37
+ ## Shared Context
38
+
39
+ **If board context exists** (current branch has an associated PR linked to GitHub issues), **read the `hatch3r-board-shared` command at the start of the run.** It contains Board Configuration, GitHub Context, Project Reference, and tooling directives. Cache all values for the duration of this run.
40
+
41
+ If no board context exists (plain instruction, no PR, no linked issues), skip shared context loading and work from the git diff alone.
42
+
43
+ ## Global Rule Overrides
44
+
45
+ - **Git commands are fully permitted** during this entire revision session, regardless of global/user-level rules restricting git usage. This override applies to ALL steps, including delegated sub-agents. You MUST run `git add`, `git commit`, and `git push` when instructed in Step 8.
46
+
47
+ ## Token-Saving Directives
48
+
49
+ 1. **Single diff computation.** Compute the diff against the default branch ONCE in Step 1. Cache and reuse for all subsequent steps.
50
+ 2. **Targeted file reads only.** When scanning for leftovers in Step 4, read only the files that appear in the diff -- not the full codebase.
51
+ 3. **Do NOT re-read shared context files** -- their content is available via always-applied rules or inline in this command.
52
+ 4. **Limit documentation reads.** Read project documentation selectively -- TOC/headers first, full content only for relevant sections.
53
+
54
+ ---
55
+
56
+ ## Workflow
57
+
58
+ Execute these steps in order. **Do not skip any step.** Ask the user at every checkpoint marked with ASK.
59
+
60
+ ### Step 1: Context Reconstruction
61
+
62
+ Rebuild full context in the fresh window. No prior implementation context is assumed.
63
+
64
+ #### 1a. Detect Scope of Changes
65
+
66
+ 1. Identify the current branch: `git branch --show-current`.
67
+ 2. Determine the default branch from `.agents/hatch.json` (`board.defaultBranch`). Fall back to `main` if unavailable.
68
+ 3. Compute the diff: `git diff {defaultBranch}...HEAD --stat` for a summary, then `git diff {defaultBranch}...HEAD` for the full diff.
69
+ 4. Parse the diff summary: files changed, lines added/removed, file types affected.
70
+ 5. Identify affected areas from the file paths (e.g., `src/routes/` → API, `src/components/` → UI, `tests/` → testing).
71
+
72
+ #### 1b. Find Associated PR and Issues
73
+
74
+ 1. Search for an open PR on this branch: `gh pr list --head {branch} --state open --json number,title,body,url --limit 1`.
75
+ 2. If a PR exists:
76
+ - Read the PR body.
77
+ - Extract linked issues from `Closes #N`, `Fixes #N`, `Relates to #N` references.
78
+ - For each linked issue: `gh issue view {N} --json title,body,labels` to read acceptance criteria and labels.
79
+ 3. If no PR exists: note this and work from the branch diff alone.
80
+
81
+ #### 1c. Load Project Rules
82
+
83
+ Read all `scope: always` rules from `.agents/rules/`. These must be included in every sub-agent prompt in Step 6.
84
+
85
+ #### 1d. Consult Learnings
86
+
87
+ If `.agents/learnings/` exists, scan for learnings with matching areas or tags that overlap with the affected areas from Step 1a.5. Cache relevant learnings for Step 6.
88
+
89
+ ---
90
+
91
+ ### Step 2: Present Context and Validate
92
+
93
+ Present a reconstruction summary to the user:
94
+
95
+ ```
96
+ Revision Context:
97
+ Branch: {branch}
98
+ PR: #{N} — {title} ({url}) | No PR found
99
+ Linked issues: #{N} — {title} (×{count}) | None
100
+ Diff: {files_changed} files changed (+{additions} / -{deletions})
101
+ Areas: {area_list}
102
+ Acceptance criteria: {found / not found}
103
+ ```
104
+
105
+ **ASK:** "Is this the work you want to revise? Any additional context I should know about? (yes / provide context / wrong branch)"
106
+
107
+ If the user provides additional context (e.g., a different issue number, clarifications, or scope adjustments), incorporate it before proceeding.
108
+
109
+ ---
110
+
111
+ ### Step 3: User Feedback Interview
112
+
113
+ Structured dialog to collect all user feedback. This is the core of the revision command -- the user tested the implementation and the agent extracts their findings through targeted questions.
114
+
115
+ #### 3a. General Feedback
116
+
117
+ **ASK:** "What did you test and what did you find? Tell me everything -- bugs, missing features, visual issues, rough edges, or anything that needs attention. If the implementation is clean and you just want a general cleanup, say 'cleanup only'."
118
+
119
+ #### 3b. Follow-Up Questions (Adaptive)
120
+
121
+ Based on the user's initial response and the diff scope, ask targeted follow-up questions. Select from the relevant categories:
122
+
123
+ **If UI changes detected** (components, styles, templates in diff):
124
+ - "Any visual mismatches -- spacing, alignment, colors, typography?"
125
+ - "Does it behave correctly at different viewport sizes?"
126
+ - "Any interaction issues -- hover states, focus, transitions, animations?"
127
+
128
+ **If API/backend changes detected** (routes, services, middleware in diff):
129
+ - "Did you test error cases and edge inputs?"
130
+ - "Any issues with response format, status codes, or timing?"
131
+
132
+ **If data model changes detected** (schemas, migrations, types in diff):
133
+ - "Any data integrity or validation issues you noticed?"
134
+
135
+ **If test changes detected** (test files in diff):
136
+ - "Do the tests cover the scenarios you care about?"
137
+
138
+ **If the user said 'cleanup only':** Skip follow-ups and proceed directly to Step 4.
139
+
140
+ #### 3c. Consolidate User Feedback
141
+
142
+ Parse all user responses into a structured findings list. Each finding should include:
143
+ - A short description
144
+ - Severity as reported by the user (critical / important / minor)
145
+ - Affected area (file paths if mentioned, or inferred from context)
146
+
147
+ ---
148
+
149
+ ### Step 4: Proactive Leftover Scan
150
+
151
+ Scan the changed files for common agent-generated leftovers. This runs regardless of user feedback -- agents frequently leave behind artifacts that the user may not have noticed.
152
+
153
+ #### 4a. Code Quality Leftovers
154
+
155
+ Scan each file in the diff for:
156
+ - Dead code / unused imports introduced by the implementation
157
+ - `TODO`/`FIXME`/`HACK` comments without issue references
158
+ - `any` types or `@ts-ignore`/`@ts-expect-error` directives without justification
159
+ - Incomplete error handling (empty catch blocks, swallowed errors, generic error messages)
160
+ - Narrating or redundant comments that explain the obvious
161
+ - Hardcoded values that should be constants or configuration
162
+ - Console.log / debug statements left in production code
163
+ - Duplicated logic that could be extracted
164
+
165
+ #### 4b. Structural Leftovers
166
+
167
+ Check for:
168
+ - Lint errors in changed files (run lint on changed files only)
169
+ - Type errors in changed files (run typecheck if available)
170
+ - Missing or insufficient test coverage for new logic paths
171
+ - Missing exports or broken import chains
172
+ - Inconsistent naming conventions compared to surrounding code
173
+
174
+ #### 4c. Compile Scan Results
175
+
176
+ For each leftover found, record:
177
+ - File path and line number(s)
178
+ - Category (dead-code, todo, type-safety, error-handling, style, test-gap, lint)
179
+ - Severity (cleanup / cosmetic)
180
+
181
+ ---
182
+
183
+ ### Step 5: Findings Consolidation and Triage
184
+
185
+ Merge user feedback (Step 3) and proactive scan results (Step 4) into a single prioritized list:
186
+
187
+ - **Critical**: User-reported bugs, broken functionality, security issues, data corruption risks
188
+ - **Important**: User-reported UX issues, missing features, incomplete behavior, test gaps for critical paths
189
+ - **Cleanup**: Leftovers detected by scan -- dead code, TODOs, type issues, error handling gaps
190
+ - **Cosmetic**: Style improvements, naming, comment cleanup, minor readability enhancements
191
+
192
+ Present the consolidated findings:
193
+
194
+ ```
195
+ Revision Findings ({N} total):
196
+
197
+ Critical ({n}):
198
+ 1. {description} — {file:line}
199
+ 2. ...
200
+
201
+ Important ({n}):
202
+ 1. {description} — {file:line}
203
+ 2. ...
204
+
205
+ Cleanup ({n}):
206
+ 1. {description} — {file:line}
207
+ 2. ...
208
+
209
+ Cosmetic ({n}):
210
+ 1. {description} — {file:line}
211
+ 2. ...
212
+ ```
213
+
214
+ **ASK:** "Here are all findings. Adjust priorities? Remove any? Add anything I missed? Proceed with fixes? (proceed / adjust / add more)"
215
+
216
+ ---
217
+
218
+ ### Step 6: Fix Implementation (Sub-Agent Delegation)
219
+
220
+ Delegate fixes to specialist sub-agents via the Task tool. Group findings by specialist and parallelize where possible.
221
+
222
+ #### 6a. Group Findings by Specialist
223
+
224
+ | Finding Category | Sub-Agent | Protocol |
225
+ |-----------------|-----------|----------|
226
+ | Bugs, missing features, error handling, logic fixes | `hatch3r-implementer` | hatch3r-implementer agent protocol |
227
+ | Dead code, unused imports, type fixes, lint errors | `hatch3r-lint-fixer` | hatch3r-lint-fixer agent protocol |
228
+ | Missing tests, insufficient coverage | `hatch3r-test-writer` | hatch3r-test-writer agent protocol |
229
+
230
+ If findings span multiple independent areas, spawn one `hatch3r-implementer` per area to parallelize.
231
+
232
+ #### 6b. Spawn Sub-Agents
233
+
234
+ Use the Task tool with `subagent_type: "generalPurpose"`. Launch as many independent sub-agents in parallel as the platform supports.
235
+
236
+ Each sub-agent prompt MUST include:
237
+ - The specific findings to address (file paths, line numbers, descriptions, expected behavior).
238
+ - Instruction to follow the corresponding agent protocol (e.g., "Follow the hatch3r-implementer agent protocol").
239
+ - All `scope: always` rule directives from `.agents/rules/` -- sub-agents do not inherit rules automatically.
240
+ - Acceptance criteria from linked issues (if available from Step 1b).
241
+ - Relevant learnings from `.agents/learnings/` (if found in Step 1d).
242
+ - Explicit instruction: do NOT create branches, commits, or PRs.
243
+
244
+ #### 6c. Await and Integrate Results
245
+
246
+ 1. Await all sub-agents. Collect their structured results (files changed, tests written, issues encountered).
247
+ 2. If any sub-agent reports BLOCKED or PARTIAL, **ASK** the user how to proceed (skip, provide guidance, fix manually).
248
+ 3. If sub-agents modified overlapping files, review for conflicts and resolve.
249
+ 4. Apply all changes to the working tree.
250
+
251
+ ---
252
+
253
+ ### Step 7: Quality Verification
254
+
255
+ Run the project's quality checks. Refer to `package.json` scripts, `README.md`, or `AGENTS.md` for the appropriate commands.
256
+
257
+ #### 7a. Run Quality Gates
258
+
259
+ 1. Lint check (e.g., `npm run lint`)
260
+ 2. Type check (e.g., `npm run typecheck`)
261
+ 3. Test suite (e.g., `npm run test`)
262
+
263
+ #### 7b. Verify User-Reported Issues
264
+
265
+ Walk through each critical and important finding from Step 5. Verify it is addressed by the changes made in Step 6. If acceptance criteria exist from linked issues, verify each criterion.
266
+
267
+ #### 7c. Review Loop
268
+
269
+ Run an iterative review loop (max 3 iterations) until 0 Critical + 0 Warning findings remain:
270
+
271
+ 1. Spawn `hatch3r-reviewer` sub-agent via the Task tool (`subagent_type: "generalPurpose"`).
272
+
273
+ The reviewer prompt MUST include:
274
+ - The diff of all changes made (use `git diff` on the working tree).
275
+ - All `scope: always` rule directives from `.agents/rules/`.
276
+ - Iteration number and previous findings (if not the first iteration).
277
+
278
+ 2. Process reviewer output:
279
+ - If **0 Critical and 0 Warning** findings: review loop is clean. Proceed to Step 7d.
280
+ - If Critical or Warning findings remain: spawn `hatch3r-fixer` sub-agent to address them, then re-run the reviewer (next iteration).
281
+
282
+ 3. If 3 iterations complete and findings remain, **ASK** the user whether to proceed or fix manually.
283
+
284
+ 4. After any fixes, re-run quality gates (Step 7a) to verify nothing broke.
285
+
286
+ #### 7d. Final Quality
287
+
288
+ After the review loop is clean, spawn both agents in parallel via the Task tool:
289
+
290
+ 1. `hatch3r-test-writer` — write or update tests for code changes.
291
+ 2. `hatch3r-security-auditor` — security review of code changes.
292
+
293
+ Both prompts MUST include:
294
+ - The diff of all changes made.
295
+ - All `scope: always` rule directives from `.agents/rules/`.
296
+
297
+ Apply any resulting changes (new tests, security fixes). Re-run quality gates (Step 7a) if changes were made.
298
+
299
+ #### 7e. Handle Failures
300
+
301
+ - If quality checks fail: identify the specific failures, fix them directly (for simple issues) or loop back to Step 6 with specific failures.
302
+ - Max 2 retry loops on quality check failures. After 2 retries, **ASK** the user for guidance.
303
+ - If a user-reported issue was not fully addressed: **ASK** the user whether to attempt another fix or defer.
304
+
305
+ ---
306
+
307
+ ### Step 8: Commit and Push
308
+
309
+ Stage, commit, and push all revision changes.
310
+
311
+ ```bash
312
+ git add -A
313
+ git commit -m "revision: {short summary of fixes}"
314
+ git push
315
+ ```
316
+
317
+ **Commit message format:**
318
+ - Single category: `revision: fix {description}` (e.g., `revision: fix auth token refresh and clean up dead code`)
319
+ - Multiple categories: `revision: address {N} issues from user testing` with a body listing the categories
320
+ - Reference linked issue numbers when available: `revision: fix validation edge cases (#42)`
321
+
322
+ If `git push` fails (e.g., remote branch does not exist yet), use `git push -u origin {branch}`.
323
+
324
+ ---
325
+
326
+ ### Step 9: Merge Readiness Assessment
327
+
328
+ Evaluate whether the branch is ready to merge.
329
+
330
+ #### 9a. Readiness Checklist
331
+
332
+ ```
333
+ Merge Readiness:
334
+ [x/·] Quality checks passing (lint, types, tests)
335
+ [x/·] All critical findings addressed
336
+ [x/·] All important findings addressed
337
+ [x/·] Cleanup findings addressed
338
+ [x/·] Acceptance criteria met (if available)
339
+ [x/·] No unresolved TODOs in changed files
340
+ [x/·] No remaining lint/type errors in changed files
341
+
342
+ Verdict: READY / NOT READY ({remaining items})
343
+ ```
344
+
345
+ #### 9b. Present Assessment
346
+
347
+ **ASK:** "Revision complete. {verdict}. Options: (a) ready to merge, (b) run another revision cycle with new feedback, (c) done for now."
348
+
349
+ - **(a) Ready to merge**: Proceed to Step 10.
350
+ - **(b) Another cycle**: Loop back to Step 3 for a fresh feedback interview. The user may have tested the fixes and found additional issues.
351
+ - **(c) Done for now**: Proceed to Step 10. The user will return later.
352
+
353
+ ---
354
+
355
+ ### Step 10: Capture Learnings
356
+
357
+ Capture revision-specific learnings. Focus on patterns that inform future implementations.
358
+
359
+ 1. Reflect on the revision:
360
+ - What types of issues did the original implementation miss?
361
+ - Were there recurring leftover patterns (e.g., agents consistently leave TODO comments, miss error handling)?
362
+ - Did the user's feedback reveal gaps in the acceptance criteria or specs?
363
+ - Were there any integration issues between sub-agent outputs?
364
+
365
+ 2. If significant learnings are identified:
366
+ - Create learning files in `.agents/learnings/` following the `hatch3r-learn` command format.
367
+ - Use category `pitfall` for issues agents commonly miss.
368
+ - Use category `pattern` for revision approaches that worked well.
369
+ - Tag with relevant area labels.
370
+
371
+ 3. If no significant learnings: skip silently. Not every revision produces learnings.
372
+
373
+ ---
374
+
375
+ ## Error Handling
376
+
377
+ - **Git diff failure**: If `git diff` fails (e.g., no commits on branch, detached HEAD), **ASK** the user for the correct branch or base ref.
378
+ - **No changes detected**: If the diff is empty, inform the user and exit. There is nothing to revise.
379
+ - **PR/issue fetch failure**: Proceed without PR/issue context. Work from the diff alone. Warn the user that acceptance criteria are unavailable.
380
+ - **Sub-agent failure**: Retry once. If the retry fails, fall back to direct implementation for that finding.
381
+ - **Quality check failure after 2 retries**: Present the specific failures and **ASK** the user whether to proceed with a partial fix commit or continue debugging.
382
+ - **Push failure**: Present the error. Common fixes: `git push -u origin {branch}` for new branches, `git pull --rebase` for diverged branches.
383
+ - **Context degradation (>25 turns)**: Suggest starting a fresh chat with a progress summary. The revision command is designed for fresh contexts -- it can be re-run.
384
+
385
+ ## Guardrails
386
+
387
+ - **Never skip ASK checkpoints.** Every significant decision requires user confirmation.
388
+ - **Never skip the proactive scan (Step 4)** -- even if the user reports no issues. Agents leave leftovers.
389
+ - **Always run quality checks (Step 7)** before committing. Never commit code that fails lint, typecheck, or tests.
390
+ - **Stay within the revision scope.** Fix what was reported and what the scan found. Do not refactor unrelated code, add new features, or expand beyond the original implementation's intent.
391
+ - **Always commit and push** at the end of a revision cycle. The user invoked this command to get fixes merged -- do not exit without committing (unless the user explicitly abandons).
392
+ - **Respect the original implementation's architecture.** Revision fixes issues within the existing patterns. If the architecture itself is flawed, note it as a finding but do not restructure -- suggest a separate refactor instead.
393
+ - **One sub-agent per concern.** Delegate to specialist sub-agents based on finding type. Do not ask the implementer to also fix lint issues or write tests.
394
+ - **Git safety.** Never force-push. Never rewrite history. Always create new commits for revision changes.
395
+ - **This command composes existing hatch3r agents** -- it does not replace them. The reviewer, implementer, lint-fixer, and test-writer agents handle the actual work.
@@ -2,11 +2,20 @@
2
2
  id: hatch3r-roadmap
3
3
  type: command
4
4
  description: Generate a dual-lens phased roadmap (business milestones + technical milestones) from specs and vision using parallel researcher sub-agents, output to todo.md in the format that hatch3r-board-fill expects.
5
+ tags: [planning, greenfield]
5
6
  ---
6
7
  # Roadmap — Generate Phased Roadmap from Specs & Vision
7
8
 
8
9
  Generate a dependency-aware, priority-ordered roadmap with **two parallel dimensions**: business milestones and technical milestones. Spawns parallel researcher sub-agents (business priority, technical readiness) to inform prioritization with market timing, competitive pressure, revenue impact, and production readiness gaps. Outputs to `todo.md` in the exact format that `hatch3r-board-fill` expects, with items tagged as `[BIZ]`, `[TECH]`, or `[BOTH]`. Optionally generates a root-level `AGENTS.md`. Works for both greenfield projects (from `hatch3r-project-spec` output) and brownfield projects (from `hatch3r-codebase-map` output).
9
10
 
11
+ ## Agent Pipeline
12
+
13
+ | Stage | Agent(s) | Parallel | Required |
14
+ |-------|----------|----------|----------|
15
+ | 1. Research | `hatch3r-researcher` (2 parallel: Business Priority, Technical Readiness) | Yes | Yes |
16
+ | 2. Document Generation | `hatch3r-docs-writer` (todo.md generation) | No | Yes |
17
+ | 3. AGENTS.md | `hatch3r-docs-writer` (AGENTS.md generation/rework) | No | Yes |
18
+
10
19
  ---
11
20
 
12
21
  ## Shared Context
@@ -301,7 +310,7 @@ Map technically-driven milestones across the timeline:
301
310
  | Phase | Label | Business Criteria | Technical Criteria |
302
311
  | ----- | ---- | ----------------- | ------------------ |
303
312
  | P0 | Critical / Launch Blockers | Revenue-blocking features, regulatory deadlines, market timing windows | Security fixes, data integrity, core infrastructure dependencies |
304
- | P1 | Core Features | Primary value-delivering features, conversion-critical flows, first GTM channel enablement | Essential integrations, performance baselines, CI/CD |
313
+ | P1 | Core Features | Primary value-delivering features, conversion-critical flows, first GTM channel enablement | Essential integrations, performance baselines, CI/CD, compound system integrity checks |
305
314
  | P2 | Important | Secondary features, retention improvements, additional GTM channels | Quality improvements, significant refactors, testing gaps, monitoring |
306
315
  | P3 | Nice to Have | Polish, upsell features, market expansion preparation | Optimizations, non-critical enhancements, developer experience |
307
316
  | P4+ | Future Ideas | Long-term market plays, new segments, platform strategy | Long-term architecture evolution, experimental technology |
@@ -408,7 +417,7 @@ Write `todo.md` in the exact format that `hatch3r-board-fill` expects, with `[BI
408
417
 
409
418
  ### Step 6: Write & Summary
410
419
 
411
- 1. Write `todo.md` to the project root.
420
+ 1. Spawn a `hatch3r-docs-writer` sub-agent via the Task tool (`subagent_type: "generalPurpose"`) to write `todo.md` to the project root. The docs-writer receives the confirmed roadmap output from Step 4 and the format specification from Step 5, and follows the `hatch3r-docs-writer` agent protocol.
412
421
  2. Update `.hatch3r-session.json` with roadmap context (if company stage and business context were gathered fresh in this run):
413
422
 
414
423
  ```json
@@ -451,7 +460,7 @@ Technical Milestones:
451
460
 
452
461
  (a) Yes — generate it, (b) No — skip, (c) Let me review the content first."
453
462
 
454
- If yes or review-first: generate `AGENTS.md` at the project root containing:
463
+ If yes or review-first: spawn a `hatch3r-docs-writer` sub-agent via the Task tool (`subagent_type: "generalPurpose"`) to generate `AGENTS.md` at the project root following the `hatch3r-docs-writer` agent protocol. The docs-writer receives the roadmap context and spec references. The generated `AGENTS.md` should follow this structure:
455
464
 
456
465
  ```markdown
457
466
  # {Project Name} — Agent Instructions
@@ -523,6 +532,8 @@ If `AGENTS.md` already exists, **ASK** before overwriting: "Root `AGENTS.md` alr
523
532
 
524
533
  Which would you like to run next? (or none)"
525
534
 
535
+ **Future command:** `hatch3r-test-plan` — generates a test plan from the current task context (issue, spec references, acceptance criteria) covering unit, integration, and E2E test scenarios. Not yet implemented; tracked for a future release.
536
+
526
537
  ---
527
538
 
528
539
  ## Error Handling
@@ -537,6 +548,10 @@ Which would you like to run next? (or none)"
537
548
  - **Stage assessment unclear:** Default to "early-revenue" if the user is unsure. This provides balanced prioritization without over- or under-engineering the roadmap.
538
549
  - **No business specs found:** If only technical specs exist (legacy layout), generate a technical-only roadmap and recommend running `hatch3r-project-spec` or `hatch3r-codebase-map` to create business specs.
539
550
 
551
+ ## Adapter Breadth as Differentiation
552
+
553
+ Hatch3r's breadth across 13+ adapters (Claude, Cursor, Windsurf, Cline, Copilot, Codex, Gemini, Amp, Aider, Goose, Kiro, OpenCode, Zed) is a core differentiation strategy. To maintain this moat, recommend periodic adapter parity audits as part of any roadmap that includes hatch3r-internal work. The audit should verify that no adapter has fallen behind in feature support (e.g., missing MCP, hooks, or skills support that other adapters already handle). Adapter parity gaps should be tracked as `[TECH]` items at P2 priority or higher.
554
+
540
555
  ## Guardrails
541
556
 
542
557
  - **Never skip ASK checkpoints.** Every step with an ASK must pause for user confirmation.
@@ -2,7 +2,13 @@
2
2
  id: hatch3r-rule-customize
3
3
  type: command
4
4
  description: Configure per-rule customization including scope overrides, description changes, enable/disable control, and project-specific markdown instructions
5
+ tags: [customize]
5
6
  ---
7
+
8
+ ## Agent Pipeline
9
+
10
+ This command runs as a single orchestrator without sub-agent delegation. Customization file management is performed inline.
11
+
6
12
  # Rule Customization — Per-Rule Configuration
7
13
 
8
14
  Customize individual rule behavior for project-specific needs via `.hatch3r/rules/` configuration files. Supports structured YAML overrides (including scope changes) and free-form markdown instruction injection, all propagated to every adapter output on sync.
@@ -2,7 +2,21 @@
2
2
  id: hatch3r-security-audit
3
3
  type: command
4
4
  description: Create a full-product security audit epic with one sub-issue per project module
5
+ tags: [maintenance, security]
5
6
  ---
7
+
8
+ ## Agent Pipeline
9
+
10
+ This command creates audit issues and epics. It does not spawn implementation sub-agents.
11
+
12
+ | Stage | Agent(s) | Parallel | Required |
13
+ |-------|----------|----------|----------|
14
+ | 1. Context & Pre-flight | Orchestrator (inline) | No | Yes |
15
+ | 2. Issue Creation | Orchestrator (GitHub MCP) | No | Yes |
16
+ | 3. Board Sync | Orchestrator (Projects v2 sync) | No | Yes |
17
+
18
+ All issue operations MUST follow the Projects v2 Enforcement rules defined in `hatch3r-board-shared`.
19
+
6
20
  # Security Audit — Full Product Security Audit
7
21
 
8
22
  Create a security audit epic on **{owner}/{repo}** with one sub-issue per logical project module, plus cross-module trust boundary and OWASP alignment audits. Each sub-issue is a deep static-analysis security audit task that, when picked up by the board workflow, produces a findings epic with actionable sub-issues for hardening application security. The command only creates the initial audit epic — it does NOT execute any audits.
@@ -11,7 +25,7 @@ Create a security audit epic on **{owner}/{repo}** with one sub-issue per logica
11
25
 
12
26
  ## Shared Context
13
27
 
14
- **Read the project's shared board context at the start of the run** (e.g., `.cursor/commands/board-shared.md` or equivalent). It contains GitHub Context, Project Reference, Projects v2 sync procedure, and Board Overview template. Cache all values for the duration of this run.
28
+ **Read the project's shared board context at the start of the run** (e.g., `.agents/commands/hatch3r-board-shared.md` or equivalent). It contains GitHub Context, Project Reference, Projects v2 sync procedure, and Board Overview template. Cache all values for the duration of this run.
15
29
 
16
30
  ## Token-Saving Directives
17
31
 
@@ -342,6 +356,8 @@ Link to parent epic via `sub_issue_write`.
342
356
 
343
357
  ### Step 7: Board Integration
344
358
 
359
+ All issue and epic operations in this command MUST follow the Projects v2 Enforcement rules defined in `hatch3r-board-shared`.
360
+
345
361
  1. **Projects v2 Sync:** Follow the **Projects v2 Sync Procedure** from `hatch3r-board-shared` (gh CLI primary) for the security audit epic and ALL sub-issues. Set status to Ready using the project's status field option ID.
346
362
 
347
363
  2. **Board Overview Regeneration:** Regenerate the Board Overview using the **Board Overview Template** from the shared context. Use cached board data from Step 1, updated with the newly created security audit epic. Skip silently if no board overview issue exists.
@@ -2,7 +2,13 @@
2
2
  id: hatch3r-skill-customize
3
3
  type: command
4
4
  description: Configure per-skill customization including description overrides, enable/disable control, and project-specific markdown instructions
5
+ tags: [customize]
5
6
  ---
7
+
8
+ ## Agent Pipeline
9
+
10
+ This command runs as a single orchestrator without sub-agent delegation. Customization file management is performed inline.
11
+
6
12
  # Skill Customization — Per-Skill Configuration
7
13
 
8
14
  Customize individual skill behavior for project-specific needs via `.hatch3r/skills/` configuration files. Supports structured YAML overrides and free-form markdown instruction injection, all propagated to every adapter output on sync.