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
@@ -11,8 +11,8 @@ tags: [implementation, team]
11
11
  |-------|----------|----------|----------|
12
12
  | 1. Context Reconstruction | Orchestrator (inline) | No | Yes |
13
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 |
14
+ | 3. Leftover Scan + Triage Routing | Orchestrator (inline) | No | Yes |
15
+ | 4. Fix Implementation | `hatch3r-implementer`, `hatch3r-lint-fixer`, `hatch3r-test-writer` | Per finding type | [FIX NOW] items only |
16
16
  | 5a. Review Loop | `hatch3r-reviewer` -> `hatch3r-fixer` (max 3 iterations) | No (sequential) | Yes |
17
17
  | 5b. Final Quality | `hatch3r-test-writer` + `hatch3r-security-auditor` | Yes | Yes (code changes) |
18
18
 
@@ -180,7 +180,7 @@ For each leftover found, record:
180
180
 
181
181
  ---
182
182
 
183
- ### Step 5: Findings Consolidation and Triage
183
+ ### Step 5: Findings Consolidation and Triage Routing
184
184
 
185
185
  Merge user feedback (Step 3) and proactive scan results (Step 4) into a single prioritized list:
186
186
 
@@ -189,35 +189,126 @@ Merge user feedback (Step 3) and proactive scan results (Step 4) into a single p
189
189
  - **Cleanup**: Leftovers detected by scan -- dead code, TODOs, type issues, error handling gaps
190
190
  - **Cosmetic**: Style improvements, naming, comment cleanup, minor readability enhancements
191
191
 
192
- Present the consolidated findings:
192
+ #### 5a. Suggest Routing
193
+
194
+ For each finding, suggest whether it should be fixed in this revision session or deferred to the board for later implementation via `board-fill`.
195
+
196
+ **Routing heuristics:**
197
+
198
+ | Severity | Condition | Default Route |
199
+ |----------|-----------|---------------|
200
+ | Critical | Any | FIX NOW (warn if user overrides) |
201
+ | Important | Affects files already in the diff + matches acceptance criteria | FIX NOW |
202
+ | Important | Outside PR scope / requires new files / architectural change | DEFER |
203
+ | Cleanup | Quick fix in diff files (single line, import cleanup, typo) | FIX NOW |
204
+ | Cleanup | Substantial scope / new files needed / cross-cutting | DEFER |
205
+ | Cosmetic | Any | DEFER |
206
+
207
+ Present the consolidated findings with routing markers:
193
208
 
194
209
  ```
195
210
  Revision Findings ({N} total):
196
211
 
197
212
  Critical ({n}):
198
- 1. {description} — {file:line}
213
+ 1. {description} — {file:line} → [FIX NOW]
199
214
  2. ...
200
215
 
201
216
  Important ({n}):
202
- 1. {description} — {file:line}
203
- 2. ...
217
+ 1. {description} — {file:line} → [FIX NOW]
218
+ (in diff files, matches acceptance criteria)
219
+ 2. {description} — {file:line} → [DEFER]
220
+ (outside PR scope, requires new files)
221
+ ...
204
222
 
205
223
  Cleanup ({n}):
206
- 1. {description} — {file:line}
207
- 2. ...
224
+ 1. {description} — {file:line} → [FIX NOW]
225
+ (quick fix, file already in diff)
226
+ 2. {description} — {file:line} → [DEFER]
227
+ (substantial scope, cross-cutting)
228
+ ...
208
229
 
209
230
  Cosmetic ({n}):
210
- 1. {description} — {file:line}
211
- 2. ...
231
+ 1. {description} — {file:line} → [DEFER]
232
+ ...
212
233
  ```
213
234
 
214
- **ASK:** "Here are all findings. Adjust priorities? Remove any? Add anything I missed? Proceed with fixes? (proceed / adjust / add more)"
235
+ #### 5b. Routing ASK
236
+
237
+ **ASK:** "Here are all findings with suggested routing. Review:
238
+ - Change routing by number (e.g., 'defer Important.2', 'fix Cosmetic.3')
239
+ - 'accept' to proceed with suggested routing
240
+ - 'fix all' to implement everything now (skip board deferral)
241
+ - Adjust priorities, remove, or add findings as before
242
+
243
+ (accept / fix all / adjust / add more)"
244
+
245
+ If the user attempts to defer a Critical finding, execute the Critical Deferral Protocol:
246
+
247
+ 1. **Structured warning.** Present the specific risk:
248
+
249
+ ```
250
+ Critical Deferral Warning:
251
+ Finding: {description}
252
+ Risk: {specific consequence of deferral — e.g., "unvalidated auth tokens may allow unauthorized access"}
253
+ Policy: Critical findings should resolve before merge (CONSTITUTION.md, quality philosophy).
254
+ ```
255
+
256
+ 2. **Require rationale.** Do not accept a bare "yes" or "defer" — the user must provide a written reason explaining why deferral is acceptable in this context.
257
+
258
+ **ASK:** "To defer this Critical finding, please provide a written rationale explaining why it is safe to merge without resolving it. This will be recorded in todo.md for board-fill triage."
259
+
260
+ 3. **Record rationale.** When recording the deferred Critical finding in todo.md (Step 5c), include the user's rationale and a `Critical-deferred` tag:
261
+
262
+ ```markdown
263
+ - {finding description} (severity: Critical, file: {file:line}) [Critical-deferred]
264
+ Deferral rationale: {user's stated rationale}
265
+ ```
266
+
267
+ 4. **Flag for triage.** The `Critical-deferred` tag ensures board-fill surfaces this item with elevated visibility during the next triage cycle. Board-fill should treat `Critical-deferred` items as priority:p0 candidates regardless of other signals.
268
+
269
+ The user is never blocked — this protocol adds accountability, not a veto.
270
+
271
+ "fix all" preserves backward compatibility -- zero additional friction for simple revisions where everything should just be fixed.
272
+
273
+ #### 5c. File Deferred Findings to todo.md
274
+
275
+ If any findings are routed to [DEFER]:
276
+
277
+ 1. **Append to `todo.md`** as a single epic context block. All deferred findings from this revision session are grouped together regardless of count -- board-fill will create one epic from them.
278
+
279
+ **If a PR exists** (from Step 1b):
280
+
281
+ ```markdown
282
+ # Follow-ups from PR #{pr_number} revision ({date})
283
+ # Epic: group all items below into one epic during board-fill
284
+ - {finding description} (severity: {severity}, file: {file:line})
285
+ - {finding description} (severity: {severity}, file: {file:line})
286
+ - ...
287
+ ```
288
+
289
+ **If no PR exists** (working outside board pipeline):
290
+
291
+ ```markdown
292
+ # Follow-ups from {branch} revision ({date})
293
+ # Epic: group all items below into one epic during board-fill
294
+ - {finding description} (severity: {severity}, file: {file:line})
295
+ - ...
296
+ ```
297
+
298
+ 2. Present summary:
299
+ `"Deferred {N} findings to todo.md. Run /hatch3r-board-fill to triage them into an epic with full dependency analysis."`
300
+
301
+ 3. Cache the deferred findings list for use in Steps 8 and 9.
302
+
303
+ If no findings are routed to [DEFER] (including the "fix all" shortcut), skip this sub-step entirely.
215
304
 
216
305
  ---
217
306
 
218
307
  ### Step 6: Fix Implementation (Sub-Agent Delegation)
219
308
 
220
- Delegate fixes to specialist sub-agents via the Task tool. Group findings by specialist and parallelize where possible.
309
+ Delegate [FIX NOW] findings to specialist sub-agents via the Task tool. Group findings by specialist and parallelize where possible. [DEFER] findings have been appended to `todo.md` in Step 5c and are excluded from this step.
310
+
311
+ If all findings were deferred (no [FIX NOW] items), skip Step 6 entirely and proceed to Step 7.
221
312
 
222
313
  #### 6a. Group Findings by Specialist
223
314
 
@@ -240,6 +331,7 @@ Each sub-agent prompt MUST include:
240
331
  - Acceptance criteria from linked issues (if available from Step 1b).
241
332
  - Relevant learnings from `.agents/learnings/` (if found in Step 1d).
242
333
  - Explicit instruction: do NOT create branches, commits, or PRs.
334
+ - Confidence expression requirement: rate every recommendation and finding as high/medium/low confidence per the quality charter (`agents/shared/quality-charter.md`). High = verified against current code. Medium = pattern-based, not fully verified. Low = best judgment, recommend human review.
243
335
 
244
336
  #### 6c. Await and Integrate Results
245
337
 
@@ -264,6 +356,8 @@ Run the project's quality checks. Refer to `package.json` scripts, `README.md`,
264
356
 
265
357
  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
358
 
359
+ For each verified finding and acceptance criterion, rate verification confidence: high (fix confirmed via tests or direct observation), medium (code change addresses the issue but edge cases not independently tested), low (fix applied but uncertain of completeness).
360
+
267
361
  #### 7c. Review Loop
268
362
 
269
363
  Run an iterative review loop (max 3 iterations) until 0 Critical + 0 Warning findings remain:
@@ -274,6 +368,7 @@ The reviewer prompt MUST include:
274
368
  - The diff of all changes made (use `git diff` on the working tree).
275
369
  - All `scope: always` rule directives from `.agents/rules/`.
276
370
  - Iteration number and previous findings (if not the first iteration).
371
+ - Confidence expression requirement: rate every recommendation and finding as high/medium/low confidence per the quality charter (`agents/shared/quality-charter.md`). High = verified against current code. Medium = pattern-based, not fully verified. Low = best judgment, recommend human review.
277
372
 
278
373
  2. Process reviewer output:
279
374
  - If **0 Critical and 0 Warning** findings: review loop is clean. Proceed to Step 7d.
@@ -281,6 +376,8 @@ The reviewer prompt MUST include:
281
376
 
282
377
  3. If 3 iterations complete and findings remain, **ASK** the user whether to proceed or fix manually.
283
378
 
379
+ After each reviewer iteration, assess the reviewer's findings confidence: if the reviewer rates any finding as low-confidence, flag it separately in the ASK prompt so the user can prioritize human review of uncertain findings.
380
+
284
381
  4. After any fixes, re-run quality gates (Step 7a) to verify nothing broke.
285
382
 
286
383
  #### 7d. Final Quality
@@ -293,13 +390,14 @@ After the review loop is clean, spawn both agents in parallel via the Task tool:
293
390
  Both prompts MUST include:
294
391
  - The diff of all changes made.
295
392
  - All `scope: always` rule directives from `.agents/rules/`.
393
+ - Confidence expression requirement: rate every recommendation and finding as high/medium/low confidence per the quality charter (`agents/shared/quality-charter.md`). High = verified against current code. Medium = pattern-based, not fully verified. Low = best judgment, recommend human review.
296
394
 
297
395
  Apply any resulting changes (new tests, security fixes). Re-run quality gates (Step 7a) if changes were made.
298
396
 
299
397
  #### 7e. Handle Failures
300
398
 
301
399
  - 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.
400
+ - Max 2 retry loops on quality check failures. After 2 retries, **ASK** the user for guidance: "Quality checks still failing. Fix confidence: {high/medium/low — based on whether root cause is identified}."
303
401
  - If a user-reported issue was not fully addressed: **ASK** the user whether to attempt another fix or defer.
304
402
 
305
403
  ---
@@ -318,6 +416,16 @@ git push
318
416
  - Single category: `revision: fix {description}` (e.g., `revision: fix auth token refresh and clean up dead code`)
319
417
  - Multiple categories: `revision: address {N} issues from user testing` with a body listing the categories
320
418
  - Reference linked issue numbers when available: `revision: fix validation edge cases (#42)`
419
+ - When deferred findings exist, include them in the commit message body:
420
+ ```
421
+ revision: address {N} findings, defer {M} to board
422
+
423
+ Fixed:
424
+ - {fixed finding summaries}
425
+
426
+ Deferred to todo.md for board-fill:
427
+ - {deferred finding summaries}
428
+ ```
321
429
 
322
430
  If `git push` fails (e.g., remote branch does not exist yet), use `git push -u origin {branch}`.
323
431
 
@@ -333,15 +441,24 @@ Evaluate whether the branch is ready to merge.
333
441
  Merge Readiness:
334
442
  [x/·] Quality checks passing (lint, types, tests)
335
443
  [x/·] All critical findings addressed
336
- [x/·] All important findings addressed
337
- [x/·] Cleanup findings addressed
444
+ [x/·] All important findings addressed or tracked ({N} fixed, {M} deferred)
445
+ [x/·] Cleanup findings addressed or tracked ({N} fixed, {M} deferred)
338
446
  [x/·] Acceptance criteria met (if available)
339
447
  [x/·] No unresolved TODOs in changed files
340
448
  [x/·] No remaining lint/type errors in changed files
341
449
 
450
+ Deferred to Board ({M} items — in todo.md, pending board-fill):
451
+ - {description} (severity: {severity})
452
+ - ...
453
+
454
+ Overall Revision Confidence: {high/medium/low}
455
+ Highest-risk remaining area: {description or "none"}
456
+
342
457
  Verdict: READY / NOT READY ({remaining items})
343
458
  ```
344
459
 
460
+ A deferred finding counts as "tracked" not "unaddressed" -- it does not block merge readiness.
461
+
345
462
  #### 9b. Present Assessment
346
463
 
347
464
  **ASK:** "Revision complete. {verdict}. Options: (a) ready to merge, (b) run another revision cycle with new feedback, (c) done for now."
@@ -393,3 +510,6 @@ Capture revision-specific learnings. Focus on patterns that inform future implem
393
510
  - **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
511
  - **Git safety.** Never force-push. Never rewrite history. Always create new commits for revision changes.
395
512
  - **This command composes existing hatch3r agents** -- it does not replace them. The reviewer, implementer, lint-fixer, and test-writer agents handle the actual work.
513
+ - **Critical findings default to FIX NOW.** If the user overrides this, execute the Critical Deferral Protocol (Step 5b): structured warning with specific risk, require written rationale, record in todo.md with `Critical-deferred` tag, and flag for elevated triage in board-fill. The user is never blocked — rationale adds accountability, not a veto.
514
+ - **Deferred findings go to `todo.md`, not directly to GitHub issues.** The board-fill pipeline handles triage, epic creation, dependency analysis, and readiness assessment. Revision does not shortcut this process.
515
+ - **Always format deferred items as a single epic block** in `todo.md`, regardless of count. This ensures board-fill groups them together during the next run.
@@ -113,6 +113,10 @@ The rule's canonical definition remains in `.agents/rules/` but no adapter outpu
113
113
  - Invalid YAML produces warnings but does not prevent rule application (graceful degradation)
114
114
  - Customization files should be committed to the repository
115
115
 
116
+ ## Unified Skill
117
+
118
+ This command's workflow is handled by the `hatch3r-customize` skill with `type: rule`. The skill provides root-cause analysis, multi-stakeholder review, and quality gate steps that extend the workflow above.
119
+
116
120
  ## Related
117
121
 
118
122
  - Agent customization: `hatch3r-agent-customize` command
@@ -92,6 +92,10 @@ enabled: false
92
92
  - Invalid YAML produces warnings but does not prevent skill execution (graceful degradation)
93
93
  - Customization files should be committed to the repository
94
94
 
95
+ ## Unified Skill
96
+
97
+ This command's workflow is handled by the `hatch3r-customize` skill with `type: skill`. The skill provides root-cause analysis, multi-stakeholder review, and quality gate steps that extend the workflow above.
98
+
95
99
  ## Related
96
100
 
97
101
  - Agent customization: `hatch3r-agent-customize` command
@@ -230,6 +230,7 @@ The implementer sub-agent prompt MUST include:
230
230
  - **Reference conventions** from `similar-implementation` output (Tier 2/3) — triggers the implementer's Convention Lock step.
231
231
  - **Resolved requirements** from `requirements-elicitation` answers (Tier 2/3) — explicit decisions on ambiguities.
232
232
  - **Blast radius data** from enhanced `codebase-impact` (Tier 3) — transitive dependency trace and API consumer map.
233
+ - Confidence expression requirement: rate every recommendation and finding as high/medium/low confidence per the quality charter (`agents/shared/quality-charter.md`). High = verified against current code. Medium = pattern-based, not fully verified. Low = best judgment, recommend human review.
233
234
 
234
235
  Await the implementer sub-agent. Collect its structured result.
235
236
 
@@ -248,7 +249,7 @@ npm run lint && npm run typecheck && npm run test
248
249
 
249
250
  Fix any issues before proceeding. If quality checks fail, loop back and resolve before advancing to Phase 4.
250
251
 
251
- **ASK:** "Implementation complete. All quality checks pass. Proceed to Review? (yes / fix issues first)"
252
+ **ASK:** "Implementation complete. All quality checks pass. Confidence in implementation quality: {high/medium/low — based on test coverage depth, edge case handling, and researcher coverage}. Proceed to Review? (yes / fix issues first)"
252
253
 
253
254
  ---
254
255
 
@@ -266,11 +267,14 @@ Spawn a `hatch3r-reviewer` sub-agent via the Task tool (`subagent_type: "general
266
267
  4. **Re-review:** After the fixer completes, spawn `hatch3r-reviewer` again to verify fixes.
267
268
  5. **Repeat** steps 2-4 for a maximum of **3 iterations**. If still not clean after 3 iterations, **ASK** the user how to proceed (force continue / manual fix / abort).
268
269
 
270
+ After each reviewer iteration, assess the reviewer's findings confidence: if the reviewer rates any finding as low-confidence, flag it separately in the ASK prompt so the user can prioritize human review of uncertain findings.
271
+
269
272
  Each reviewer/fixer sub-agent prompt MUST include:
270
273
  - The agent protocol to follow.
271
274
  - All `scope: always` rule directives from `.agents/rules/`.
272
275
  - The diff or file changes to review/fix.
273
276
  - The task's acceptance criteria.
277
+ - Confidence expression requirement: rate every recommendation and finding as high/medium/low confidence per the quality charter (`agents/shared/quality-charter.md`). High = verified against current code. Medium = pattern-based, not fully verified. Low = best judgment, recommend human review.
274
278
 
275
279
  #### 4b. Final Quality (Parallel Specialists)
276
280
 
@@ -296,6 +300,7 @@ Each specialist sub-agent prompt MUST include:
296
300
  - All `scope: always` rule directives from `.agents/rules/`.
297
301
  - The diff or file changes to review.
298
302
  - The task's acceptance criteria.
303
+ - Confidence expression requirement: rate every recommendation and finding as high/medium/low confidence per the quality charter (`agents/shared/quality-charter.md`). High = verified against current code. Medium = pattern-based, not fully verified. Low = best judgment, recommend human review.
299
304
 
300
305
  Await all specialist sub-agents. Apply their feedback (fixes, additional tests, documentation updates).
301
306
 
@@ -303,6 +308,8 @@ Await all specialist sub-agents. Apply their feedback (fixes, additional tests,
303
308
 
304
309
  Check each acceptance criterion from the original task or issue. Mark as met or not-met with evidence.
305
310
 
311
+ For each criterion, rate verification confidence: high (tested and confirmed via code, tests, or browser), medium (logically satisfied but not independently verified), low (uncertain, recommend human testing).
312
+
306
313
  #### 4d. Present Review
307
314
 
308
315
  ```
@@ -313,6 +320,8 @@ Review Results:
313
320
  Test Coverage: {test-writer results}
314
321
  Documentation: {docs-writer results / not applicable}
315
322
  Performance: {pass/issues}
323
+ Overall Confidence: {high/medium/low}
324
+ Lowest-confidence area: {description or "none"}
316
325
  ```
317
326
 
318
327
  **ASK:** "Review complete. {summary}. Ready to finalize? (yes / address review issues / request human review)"