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
@@ -58,6 +58,7 @@ The implementer sub-agent prompt MUST include:
58
58
  - All `scope: always` rule directives from `.agents/rules/` — subagents do not inherit rules automatically.
59
59
  - Relevant learnings from `.agents/learnings/` (from Step 6.pre).
60
60
  - Explicit instruction: do NOT create branches, commits, or PRs.
61
+ - 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.
61
62
 
62
63
  Await the implementer sub-agent. Collect its structured result (files changed, tests written, issues encountered).
63
64
 
@@ -73,6 +74,7 @@ After implementation completes, run the two-stage quality pipeline. Use the Task
73
74
  - **Reference conventions** from Step 6a.1 (if available) — so the fixer maintains established patterns when applying fixes.
74
75
  3. Re-spawn **`hatch3r-reviewer`** to verify fixes.
75
76
  4. Repeat steps 2-3 for a maximum of **3 iterations** until the reviewer reports 0 Critical + 0 Warning findings.
77
+ 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.
76
78
  5. If still not clean after 3 iterations, **ASK** the user how to proceed.
77
79
 
78
80
  **Stage 2 — Final Quality (parallel, after review loop is clean):**
@@ -96,5 +98,6 @@ Each specialist sub-agent prompt MUST include:
96
98
  - All `scope: always` rule directives from `.agents/rules/` (subagents do not inherit rules automatically).
97
99
  - The diff or file changes to review.
98
100
  - The issue's acceptance criteria.
101
+ - 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.
99
102
 
100
103
  Await all specialist sub-agents. Apply their feedback (fixes, additional tests, documentation updates) before proceeding to Step 7.
@@ -31,6 +31,10 @@ Platform-specific procedures for GitHub. Referenced from `hatch3r-board-pickup`.
31
31
  **Open PRs:**
32
32
  - `gh pr list -R {owner}/{repo} --state open` (fall back to `search_pull_requests` MCP).
33
33
 
34
+ **Closed PRs for selected issue (abandoned work detection):**
35
+ - `gh pr list -R {owner}/{repo} --state closed --search "closes #{N}"` — check if any recently closed (not merged) PRs reference this issue.
36
+ - If found: Surface to the user: "Note: PR #{M} was closed without merge for issue #{N}. The previous work may be partially relevant. Options: (a) review the closed PR branch, (b) start fresh, (c) pick a different issue."
37
+
34
38
  ---
35
39
 
36
40
  ## Step 4: Update Issue Status — GitHub
@@ -31,6 +31,10 @@ Platform-specific procedures for GitLab. Referenced from `hatch3r-board-pickup`.
31
31
  **Open MRs:**
32
32
  - `glab mr list -R {namespace}/{project} --state opened`.
33
33
 
34
+ **Closed MRs for selected issue (abandoned work detection):**
35
+ - `glab mr list -R {namespace}/{project} --state closed` — check if any recently closed (not merged) MRs reference `Closes #{N}`.
36
+ - If found: Surface to the user: "Note: MR !{M} was closed without merge for issue #{N}. The previous work may be partially relevant. Options: (a) review the closed MR branch, (b) start fresh, (c) pick a different issue."
37
+
34
38
  ---
35
39
 
36
40
  ## Step 4: Update Issue Status — GitLab
@@ -16,6 +16,8 @@ Run the project's quality checks (linting, type checking, tests). Refer to the p
16
16
 
17
17
  Verify: all AC met, tests passing, no lint errors, dead code removed, project-specific invariants respected.
18
18
 
19
+ Rate confidence in quality verification: high (all checks pass with comprehensive coverage), medium (checks pass but coverage gaps exist), low (checks pass minimally, recommend additional human review).
20
+
19
21
  ---
20
22
 
21
23
  ## Step 7a: Commit & Push
@@ -83,7 +85,12 @@ Follow the project's PR/MR creation skill or conventions:
83
85
 
84
86
  1. If all sub-issues addressed, confirm the PR body uses `Closes #<epic-number>` so the epic will auto-close on merge and transition to Done.
85
87
  2. Remind user `Closes #N` auto-closes on merge.
86
- 3. If partial:
88
+ 3. **Post-merge board state advisory:** After merge, `Closes #N` will auto-close the issue, but label and board status updates to `status:done` / "Done" depend on platform automation:
89
+ - **GitHub:** Automatic IF the Projects V2 "Item closed" workflow is enabled (verify in Project > Workflows). Labels are NOT auto-updated — `status:in-review` remains on the closed issue.
90
+ - **Azure DevOps:** Ensure the "Complete linked work items after merging" checkbox is checked during PR completion. State transitions to "Closed" only when this option is selected.
91
+ - **GitLab:** Labels are NOT updated on auto-close. `status::in-review` remains. Consider setting up a CI pipeline trigger on issue close events for automated cleanup.
92
+ - If automation is not configured, `board-groom` with the `health-fix` action will detect and fix the drift during the next grooming session.
93
+ 4. If partial:
87
94
 
88
95
  **ASK:** "PR created. N remaining sub-issues on epic #X. Continue with next sub-issue or stop?"
89
96
 
@@ -86,7 +86,11 @@ Azure Boards syncs via Work Item State changes. There is no separate "add to boa
86
86
  | `status:in-progress` | `Active` |
87
87
  | `status:in-review` | `Resolved` |
88
88
  | `status:blocked` | `New` |
89
- | (done) | `Closed` |
89
+ | `status:done` | `Closed` |
90
+
91
+ **Known limitation — Ready vs. In Progress granularity:** Both `status:ready` and `status:in-progress` map to the `Active` Work Item State because Azure DevOps built-in process templates (Agile, Scrum, CMMI) do not include a "Ready" state. The distinction is preserved in Work Item Tags (e.g., tag `status:ready` vs. `status:in-progress`), which hatch3r board commands always set alongside the State update. For projects that need board-level distinction:
92
+ - **Custom process template:** Add a "Ready" state to the work item type in your Azure DevOps process template. Update the mapping above accordingly.
93
+ - **Board column mapping:** Configure Azure Boards to use tag-based swim lanes or column splits to distinguish "Ready" from "In Progress" within the "Active" column.
90
94
 
91
95
  **Steps for each work item to sync:**
92
96
 
@@ -110,8 +114,14 @@ Azure Boards syncs via Work Item State changes. There is no separate "add to boa
110
114
  `az boards work-item relation add --id {child_id} --relation-type "System.LinkTypes.Hierarchy-Reverse" --target-id {parent_id}`.
111
115
  Record link status as `native`.
112
116
 
113
- 2. **Fallback 1 — Comment trace:**
114
- If relation add fails:
117
+ 2. **Fallback 1 — Advisory body-reference:**
118
+ If relation add fails, establish an advisory link via work item descriptions:
119
+ - Read the parent work item description. Append a sub-issue checklist entry: `- [ ] #{child} {title}` to the parent's description via `az boards work-item update --id {epic} --description "..."`.
120
+ - Read the child work item description. Prepend `> Parent: #{epic}` to the child's description via `az boards work-item update --id {child} --description "..."`.
121
+ - Record link status as `advisory`.
122
+
123
+ 3. **Fallback 2 — Comment trace:**
124
+ If both primary and Fallback 1 fail:
115
125
  `az boards work-item update --id {epic} --discussion "Sub-issue: #{child} — {title} (linking failed)"`.
116
126
  Record link status as `comment-only`.
117
127
 
@@ -95,6 +95,7 @@ Read the mapping from `board.statusOptions` in `.agents/hatch.json`:
95
95
  | `status:ready` | `board.statusOptions.ready` |
96
96
  | `status:in-progress` | `board.statusOptions.inProgress` |
97
97
  | `status:in-review` | `board.statusOptions.inReview` |
98
+ | `status:done` | `board.statusOptions.done` |
98
99
  | `status:blocked` | `board.statusOptions.backlog` |
99
100
 
100
101
  **Steps for each issue to sync (gh CLI primary):**
@@ -83,6 +83,7 @@ GitLab board lists are label-based. Each status corresponds to a scoped label:
83
83
  | `status:ready` | `status::ready` |
84
84
  | `status:in-progress` | `status::in-progress` |
85
85
  | `status:in-review` | `status::in-review` |
86
+ | `status:done` | `status::done` |
86
87
  | `status:blocked` | `status::blocked` |
87
88
 
88
89
  **Steps for each issue to sync:**
@@ -104,8 +105,14 @@ GitLab board lists are label-based. Each status corresponds to a scoped label:
104
105
  `glab api projects/{project_id}/issues/{parent_iid}/links --method POST --field target_project_id={project_id} --field target_issue_iid={child_iid}`.
105
106
  Record link status as `native`.
106
107
 
107
- 2. **Fallback 1 — Comment trace:**
108
- If API linking fails:
108
+ 2. **Fallback 1 — Advisory body-reference:**
109
+ If API linking fails, establish an advisory link via issue descriptions:
110
+ - Read the parent epic body. Add a sub-issue checklist entry: `- [ ] #{child} {title}` to the epic's body via `glab issue update {epic} -R {namespace}/{project} --description "..."`.
111
+ - Read the child issue body. Prepend `> Parent: #{epic}` to the child's body via `glab issue update {child} -R {namespace}/{project} --description "..."`.
112
+ - Record link status as `advisory`.
113
+
114
+ 3. **Fallback 2 — Comment trace:**
115
+ If both primary and Fallback 1 fail:
109
116
  `glab issue note {epic} -R {namespace}/{project} --message "Sub-issue: #{child} — {title} (linking failed)"`.
110
117
  Record link status as `comment-only`.
111
118
 
@@ -153,7 +153,7 @@ Some agents have `protected: true` in their canonical frontmatter. This field ma
153
153
 
154
154
  ```yaml
155
155
  ---
156
- id: hatch3r-reviewer
156
+ id: hatch3r-example-agent
157
157
  description: Expert code reviewer for the project...
158
158
  protected: true
159
159
  model: standard
@@ -175,6 +175,10 @@ The `protected` field is set in the canonical agent definition and cannot be ove
175
175
  - Invalid YAML produces warnings but does not prevent agent execution (graceful degradation)
176
176
  - Customization files should be committed to the repository
177
177
 
178
+ ## Unified Skill
179
+
180
+ This command's workflow is handled by the `hatch3r-customize` skill with `type: agent`. The skill provides root-cause analysis, multi-stakeholder review, and quality gate steps that extend the workflow above. Invoke the skill directly or use this command for the agent-specific reference documentation (model resolution, protected agents, per-agent examples).
181
+
178
182
  ## Related
179
183
 
180
184
  - Skill customization: `hatch3r-skill-customize` command
@@ -173,7 +173,23 @@ For each epic, compare the sub-issue references in the epic body (checklist item
173
173
 
174
174
  If `board.projectNumber` is configured, compare label-based status (`status:*` labels) against board column status via `gh project item-list {board.projectNumber} --owner {board.owner} --format json` (GitHub) or equivalent platform call. Flag issues where the label status and board column status diverge.
175
175
 
176
- #### 3l. Present Refinement Summary
176
+ #### 3l. Orphaned In-Review Detection
177
+
178
+ For each open issue with `status:in-review`:
179
+
180
+ 1. **GitHub:** Check if any open PR body references `Closes #N` for this issue: `gh pr list -R {owner}/{repo} --state open --json number,body` — parse for `Closes #{N}`.
181
+ 2. **Azure DevOps:** Check if any active PR is linked to this work item: `az repos pr list --org https://dev.azure.com/{namespace} --project {project} --status active` — check work item relations.
182
+ 3. **GitLab:** Check if any open MR description references `Closes #N` for this issue: `glab mr list -R {namespace}/{project} --state opened` — parse descriptions for `Closes #{N}`.
183
+
184
+ Also check for closed issues with `status:in-review` (or any non-`status:done` status label) — these are issues that were auto-closed on PR merge but whose labels and board status were not updated to "Done" (see Post-Merge Terminal State in `hatch3r-board-shared`).
185
+
186
+ Flag two categories:
187
+ - **Orphaned in-review (open):** Open issues with `status:in-review` but no associated open PR/MR — likely caused by PR closure without merge.
188
+ - **Stale in-review (closed):** Closed issues still labeled `status:in-review` — should be `status:done` with board status "Done".
189
+
190
+ ---
191
+
192
+ #### 3m. Present Refinement Summary
177
193
 
178
194
  Present findings grouped by category:
179
195
 
@@ -189,6 +205,7 @@ Board Health:
189
205
  Epic ordering discrepancies: E epics
190
206
  Unlinked sub-issues: U issues (non-native links)
191
207
  Board sync drift: V issues (label/board status mismatch)
208
+ Orphaned in-review: O issues (open with no PR/MR), S issues (closed but not status:done)
192
209
 
193
210
  Grooming Opportunities:
194
211
  Re-prioritize candidates: R issues (priority/risk misalignment, priority inflation)
@@ -448,7 +465,7 @@ Link Fix Candidates:
448
465
 
449
466
  #### 4i. Health Fix (Board Health Remediation)
450
467
 
451
- Fix structural gaps detected in Step 3b (missing metadata).
468
+ Fix structural gaps detected in Step 3b (missing metadata), board sync drift detected in Step 3k, and orphaned in-review issues detected in Step 3l.
452
469
 
453
470
  1. For each issue with missing required labels, infer the missing labels from issue content using the same classification tables as `board-fill` Step 3:
454
471
  - Missing `type:*` → infer from title/body keywords.
@@ -475,6 +492,42 @@ Health Fix — Missing Metadata:
475
492
  - **Azure DevOps:** `az boards work-item update --id N --fields "System.Tags=..."`.
476
493
  - **GitLab:** `glab issue update N --label "..."`.
477
494
 
495
+ 4. **Board sync drift remediation:** For each issue flagged in Step 3k where label status and board column status diverge:
496
+
497
+ - **Labels are source of truth.** Update the board to match the label.
498
+ - Use the platform-specific Board Sync Procedure to set the board status to the value corresponding to the issue's current status label.
499
+ - **Special case — closed issue with `status:in-review`:** If the issue is closed (state = closed) but the label is `status:in-review` and the board shows "In Review":
500
+ 1. Replace `status:in-review` with `status:done` on the issue.
501
+ 2. Sync board status to "Done" using `board.statusOptions.done`.
502
+ - Present drift fixes in the batch:
503
+
504
+ ```
505
+ Board Sync Drift Remediation:
506
+
507
+ | # | Title | Label Status | Board Status | Action |
508
+ |---|-------|-------------|--------------|--------|
509
+ | #N | {title} | status:ready | In Progress | Sync board -> Ready |
510
+ | #M | {title} | status:in-review (closed) | In Review | Label -> status:done, board -> Done |
511
+ ```
512
+
513
+ No separate ASK — drift fixes are presented alongside the metadata fixes in the same Health Fix confirmation prompt.
514
+
515
+ 5. **Orphaned in-review remediation:** For each issue flagged in Step 3l:
516
+
517
+ a. **Closed issue with `status:in-review`** (stale in-review): Suggest replacing `status:in-review` with `status:done` and syncing board to "Done". This is the post-merge terminal state that was not reached (see Post-Merge Terminal State in `hatch3r-board-shared`).
518
+ b. **Open issue with `status:in-review` but no open PR/MR** (orphaned in-review): Present the issue with context (last PR if any, time since last update). Suggest `status:ready` (if work appears abandoned) or `status:in-progress` (if rework is likely).
519
+
520
+ ```
521
+ Orphaned In-Review Remediation:
522
+
523
+ | # | Title | State | Last PR | Suggested Status | Reason |
524
+ |---|-------|-------|---------|------------------|--------|
525
+ | #N | {title} | closed | PR #M (merged) | status:done | Closed issue still labeled in-review |
526
+ | #K | {title} | open | PR #J (closed, not merged) | status:ready | PR closed 14 days ago, no replacement |
527
+ ```
528
+
529
+ **ASK:** "Confirm or adjust status changes for in-review issues. Enter per-issue decisions (e.g., '#N -> done, #K -> in-progress'), or 'confirm all' / 'skip'."
530
+
478
531
  ---
479
532
 
480
533
  ### Step 5: Readiness Re-evaluation
@@ -252,6 +252,7 @@ Execute all planned mutations in sequence. No further questions unless a mutatio
252
252
  4. Ensure these status options exist on the field: **Backlog**, **Ready**, **In Progress**, **In Review**, **Done**.
253
253
  - For missing options, use the `updateProjectV2Field` mutation (or the appropriate mutation for adding options to a single-select field) to add them.
254
254
  5. Capture the field ID and each option's ID.
255
+ 6. **Verify built-in "Done on close" automation:** After board creation, check the Projects V2 built-in workflows. Navigate to Project settings > Workflows > "Item closed" and verify it is enabled with Status mapped to "Done". Also verify "Pull request merged" maps Status to "Done". These workflows are on by default for UI-created projects but may not be enabled for API-created projects. Without these workflows, the board status will remain "In Review" after PR merge until `board-groom` detects the drift.
255
256
 
256
257
  **If platform is `azure-devops`:**
257
258
 
@@ -262,6 +263,7 @@ Execute all planned mutations in sequence. No further questions unless a mutatio
262
263
  2. Map hatch3r statuses to Work Item States: **Backlog** → `New`, **Ready** → `Active`, **In Progress** → `Active`, **In Review** → `Resolved`, **Done** → `Closed`.
263
264
  3. If using a custom process, verify these states exist. Azure DevOps built-in processes (Agile, Scrum, CMMI) include these states by default.
264
265
  4. Store the state mapping in `board.statusOptions` for use by other board commands.
266
+ 5. **Note — Ready vs. In Progress:** Azure DevOps built-in processes map both "Ready" and "In Progress" to the `Active` state. The distinction is maintained via hatch3r tags on work items. For board-level visibility, consider configuring Azure Boards column splits: in the Board Settings, split the "Active" column into "Active - Ready" and "Active - In Progress" using tag-based rules. Projects with custom Azure DevOps process templates can alternatively add a "Ready" state to the work item type.
265
267
 
266
268
  **If platform is `gitlab`:**
267
269
 
@@ -270,8 +272,9 @@ Execute all planned mutations in sequence. No further questions unless a mutatio
270
272
  glab api projects/{project_id}/boards/{board_id}/lists --method POST --field label_id={label_id}
271
273
  ```
272
274
  2. Create scoped labels for each status first (see Step 2.3), then create board lists referencing those labels.
273
- 3. Required board lists: **Backlog** (`status::triage`), **Ready** (`status::ready`), **In Progress** (`status::in-progress`), **In Review** (`status::in-review`).
275
+ 3. Required board lists: **Backlog** (`status::triage`), **Ready** (`status::ready`), **In Progress** (`status::in-progress`), **In Review** (`status::in-review`), **Done** (`status::done`).
274
276
  4. Store the board list IDs in `board.statusOptions`.
277
+ 5. **Note — Labels not auto-updated on close:** GitLab does not update labels when an issue is auto-closed via `Closes #N`. The `status::in-review` scoped label will remain on closed issues. This drift is detected and fixed by `board-groom` during the `health-fix` action. For automated cleanup, consider setting up a GitLab CI pipeline trigger on issue close events to apply `status::done`. Note: scoped labels require GitLab **Premium or Ultimate** tier.
275
278
 
276
279
  #### 2.3: Create Label Taxonomy
277
280
 
@@ -282,7 +285,7 @@ Execute all planned mutations in sequence. No further questions unless a mutatio
282
285
  |-----------|--------|
283
286
  | Type | `type:bug`, `type:feature`, `type:refactor`, `type:qa`, `type:docs`, `type:infra` |
284
287
  | Executor | `executor:agent`, `executor:human`, `executor:hybrid` |
285
- | Status | `status:triage`, `status:ready`, `status:in-progress`, `status:in-review`, `status:blocked` |
288
+ | Status | `status:triage`, `status:ready`, `status:in-progress`, `status:in-review`, `status:done`, `status:blocked` |
286
289
  | Priority | `priority:p0`, `priority:p1`, `priority:p2`, `priority:p3` |
287
290
  | Risk | `risk:low`, `risk:med`, `risk:high` |
288
291
  | Meta | `meta:board-overview`, `has-dependencies` |
@@ -65,7 +65,7 @@ All board commands read project-specific configuration from `.agents/hatch.json`
65
65
  "labels": {
66
66
  "types": ["type:bug", "type:feature", "type:refactor", "type:qa", "type:docs", "type:infra"],
67
67
  "executors": ["executor:agent", "executor:human", "executor:hybrid"],
68
- "statuses": ["status:triage", "status:ready", "status:in-progress", "status:in-review", "status:blocked"],
68
+ "statuses": ["status:triage", "status:ready", "status:in-progress", "status:in-review", "status:done", "status:blocked"],
69
69
  "meta": ["meta:board-overview"]
70
70
  },
71
71
  "branchConvention": "{type}/{short-description}",
@@ -129,7 +129,7 @@ Cache link status per child (`native` / `advisory` / `comment-only`) in the run
129
129
  Board sync is **MANDATORY**, not optional. The following rules override any "skip if null" or "skip silently" language elsewhere when the board is configured (GitHub: `board.projectNumber` set; Azure DevOps: project configured; GitLab: board configured).
130
130
 
131
131
  1. **Every issue/work item created or updated by a board command MUST be synced to the board — no exceptions.** This includes newly created issues, status changes, label updates, and any mutation that affects board state. Skipping sync for any item is a violation of this policy.
132
- 2. **Status MUST be updated after every status-changing operation.** The four canonical statuses — Ready, In Progress, In Review, Done — must be reflected on the board immediately after the corresponding label change. Do not batch status updates to "later" or defer them. See the platform sub-files for platform-specific status update commands.
132
+ 2. **Status MUST be updated after every status-changing operation.** The five canonical statuses — Ready, In Progress, In Review, Done, Blocked — must be reflected on the board immediately after the corresponding label change. Do not batch status updates to "later" or defer them. See the platform sub-files for platform-specific status update commands.
133
133
  3. **All available board fields (priority, sprint, area, iteration) MUST be populated when the data is available.** Never leave a board field empty if the information exists in the issue's labels, body, or metadata.
134
134
  4. **Board overview dashboard MUST be regenerated after any batch of issue operations.** This is in addition to the per-run regeneration rule — if a board command performs multiple batches of mutations, the dashboard must reflect the final state.
135
135
  5. **Fallback: never silently skip sync.** See platform sub-files for escalation paths. Silent skipping is prohibited.
@@ -138,6 +138,35 @@ Board sync is **MANDATORY**, not optional. The following rules override any "ski
138
138
 
139
139
  ---
140
140
 
141
+ ## Post-Merge Terminal State
142
+
143
+ When a PR/MR merges and `Closes #N` auto-closes the referenced issues, the board item lifecycle must reach its terminal state. The `status:in-review` label should be replaced with `status:done`, and the board status should be set to "Done" using `board.statusOptions.done`.
144
+
145
+ **Platform-specific behavior and recommendations:**
146
+
147
+ - **GitHub:** The built-in Projects V2 "Item closed" workflow sets the Status field to "Done" when an issue is closed. This workflow is enabled by default for projects created via the GitHub UI, but projects created via API (as `board-init` does) may not have it enabled. **Verify** the workflow is active: Project settings > Workflows > "Item closed" > confirm Status maps to "Done". If disabled, enable it. Without this workflow, the board status will remain "In Review" until `board-groom` detects and fixes the drift. GitHub does NOT auto-update labels on close — the `status:in-review` label remains on the closed issue.
148
+ - **Azure DevOps:** Work item auto-transition to "Closed" requires the **"Complete linked work items after merging"** checkbox during PR completion. This is opt-in per PR (not automatic by default). ADO also supports `Fixes #N` / `Resolves #N` syntax in PR descriptions for state transitions. **Recommend** checking this option consistently, or configuring it as the user's default.
149
+ - **GitLab:** Labels are NOT updated on auto-close. The `status::in-review` scoped label remains on the closed issue. GitLab does not have a built-in "set label on close" automation. The `status::done` label must be applied manually, via a CI pipeline trigger on issue close events, or will be caught and fixed during `board-groom` drift remediation. Note: scoped labels (`status::done`) require GitLab **Premium or Ultimate** tier.
150
+
151
+ Board commands that detect closed issues with `status:in-review` (or any non-`status:done` status label) should treat this as drift and remediate per the platform-specific sync procedure.
152
+
153
+ ---
154
+
155
+ ## PR Closed Without Merge
156
+
157
+ When a PR/MR is closed without merging, the referenced issues remain open with `status:in-review`. This is drift that must be resolved:
158
+
159
+ 1. **Expected behavior:** Issues should revert to:
160
+ - `status:in-progress` — if the developer intends to continue work on a different branch or rework the changes.
161
+ - `status:ready` — if the work is abandoned and the issue should return to the backlog for future pickup.
162
+ 2. **Board sync:** The board status should be updated to match the new label ("In Progress" or "Ready").
163
+ 3. **Detection:** `board-groom` Step 3l detects orphaned `status:in-review` issues (those with no open PR/MR referencing them). The user decides the target state during grooming.
164
+ 4. **Collision detection:** During `board-pickup` Step 3, if collision detection finds a closed-without-merge PR for the selected issue, surface this context to the user so they can decide whether to reuse the branch, start fresh, or pick a different issue.
165
+
166
+ This situation is NOT automatically remediated because the correct target state depends on developer intent. Board commands surface it as a diagnostic for user decision.
167
+
168
+ ---
169
+
141
170
  ## End-of-Run Reconciliation Procedure
142
171
 
143
172
  Every mutating board command (`board-fill`, `board-groom`, `board-pickup`) runs this procedure as its final step before the summary output. It catches silent failures and drift accumulated during the run.
@@ -146,6 +175,11 @@ Every mutating board command (`board-fill`, `board-groom`, `board-pickup`) runs
146
175
  2. **Sub-issue link verification:** Review `link_results` in the run cache. For links recorded as `advisory`, retry the platform-specific primary link method once to upgrade to `native`. Report all non-native links (`advisory` / `comment-only`) in the reconciliation output.
147
176
  3. **Label consistency:** Verify all created/updated issues have required labels (`type:*`, `priority:*`, `executor:*`) and correct `has-dependencies` state per rule 7 of Board Sync Enforcement. Fix any gaps.
148
177
  4. **PR linkage:** For issues transitioned to `status:in-progress` or `status:in-review`, verify any associated open PR body contains `Closes #N` for the addressed issues. Auto-fix if missing by updating the PR body.
178
+ 5. **Orphaned in-review detection:** For all cached issues with `status:in-review` (not just those transitioned during this run), verify an open PR/MR exists that references `Closes #N`:
179
+ - **GitHub:** `gh pr list -R {owner}/{repo} --state open --json number,body` — parse for `Closes #{N}`.
180
+ - **Azure DevOps:** `az repos pr list --status active` — check work item links.
181
+ - **GitLab:** `glab mr list -R {namespace}/{project} --state opened` — parse descriptions for `Closes #{N}`.
182
+ Flag orphaned in-review issues (those with no associated open PR/MR) in the reconciliation report. This catches issues that drifted to `status:in-review` in previous runs but lost their PR (closed without merge, PR deleted, etc.). Also flag closed issues still labeled `status:in-review` that should be `status:done`.
149
183
 
150
184
  ### Reconciliation Report
151
185
 
@@ -157,6 +191,7 @@ Reconciliation:
157
191
  Sub-issue links: {N} native, {M} advisory, {K} comment-only
158
192
  Label gaps: {N} fixed, {M} remaining (list)
159
193
  PR linkage: {N} verified, {M} missing `Closes` (list)
194
+ Orphaned in-review: {N} open issues with no PR/MR, {M} closed issues not status:done (list)
160
195
  Errors: {list or "None"}
161
196
  ```
162
197
 
@@ -93,6 +93,10 @@ enabled: false
93
93
  - Invalid YAML produces warnings but does not prevent command execution (graceful degradation)
94
94
  - Customization files should be committed to the repository
95
95
 
96
+ ## Unified Skill
97
+
98
+ This command's workflow is handled by the `hatch3r-customize` skill with `type: command`. The skill provides root-cause analysis, multi-stakeholder review, and quality gate steps that extend the workflow above.
99
+
96
100
  ## Related
97
101
 
98
102
  - Agent customization: `hatch3r-agent-customize` command
@@ -251,7 +251,7 @@ Add `priority` and `timeout` to hook frontmatter:
251
251
 
252
252
  ```markdown
253
253
  ---
254
- id: pre-commit-lint-fixer
254
+ id: my-pre-commit-lint-fixer
255
255
  type: hook
256
256
  event: pre-commit
257
257
  agent: lint-fixer
@@ -40,7 +40,7 @@ This command intentionally skips:
40
40
  - GitHub issues and PRs
41
41
  - Researcher sub-agent
42
42
  - Full review pipeline (security-auditor, test-writer, docs-writer)
43
- - Learnings capture
43
+ - Learnings capture (consultation of existing learnings retained — see Step 2c)
44
44
 
45
45
  It retains:
46
46
  - Quality checks (lint, typecheck, test) -- always mandatory
@@ -48,6 +48,7 @@ It retains:
48
48
  - Light code review (reviewer for nontrivial items only)
49
49
  - `scope: always` rules from `.agents/rules/`
50
50
  - Soft scope guards to prevent misuse
51
+ - Lightweight learnings consultation (file-path scan, 150-token budget)
51
52
 
52
53
  ---
53
54
 
@@ -60,7 +61,7 @@ It retains:
60
61
  1. **No shared context loading.** Do NOT read `hatch3r-board-shared`. Do NOT fetch GitHub issues or PRs.
61
62
  2. **Minimal researcher usage.** No researcher for Tier 1 items. For Tier 2 items that proceed through quick-change, only `similar-implementation` at `quick` depth. Tier 3 items must be routed to `hatch3r-workflow`.
62
63
  3. **Targeted file reads only.** Read only files directly relevant to the described change(s).
63
- 4. **No learnings capture.** Quick changes are too small to produce meaningful learnings.
64
+ 4. **No learnings capture.** Quick changes are too small to produce meaningful learnings. Existing learnings are consulted via a lightweight file-path scan (Step 2c) with a 150-token budget — no new learnings are written.
64
65
  5. **Minimal rule loading.** Load `scope: always` rules only when spawning sub-agents in Steps 4b or 6.
65
66
 
66
67
  ---
@@ -124,6 +125,26 @@ Quick Change Scope:
124
125
  Estimated scope: {N} files, ~{N} lines
125
126
  ```
126
127
 
128
+ #### 2c. Lightweight Learnings Scan (Optional)
129
+
130
+ If `.agents/learnings/` exists:
131
+
132
+ 1. Collect the file paths from the affected areas identified in Step 1.
133
+ 2. Scan learning file frontmatter for `area` or `tags` that match the affected file paths or directories.
134
+ 3. If matches found (max 3 learnings, highest confidence first), surface them as a brief heads-up:
135
+
136
+ ```
137
+ Heads up — relevant learnings:
138
+ - [{category}] {one-line learning summary} (from: {learning filename})
139
+ - ...
140
+ ```
141
+
142
+ 4. If no matches found: continue silently. Do not mention learnings.
143
+
144
+ **Token budget:** Max 150 tokens for this entire step. Read frontmatter only — do not read learning bodies unless the frontmatter matches. Limit to 3 surfaced learnings. If more than 3 match, show the 3 with highest confidence.
145
+
146
+ If `.agents/learnings/` does not exist, skip this step silently.
147
+
127
148
  **ASK:** "Proceed with these changes? (yes / adjust)"
128
149
 
129
150
  ---
@@ -189,6 +210,7 @@ The implementer prompt MUST include:
189
210
  - Explicit instruction: do NOT create branches, commits, or PRs.
190
211
  - **Reference conventions** from `similar-implementation` output (if step 2 ran) — triggers the implementer's Convention Lock step.
191
212
  - If no researcher ran: explicit instruction that no researcher context is available; work from the change description and codebase alone.
213
+ - 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.
192
214
 
193
215
  If multiple nontrivial items affect **independent areas** (no shared files), spawn one implementer per area and run them in parallel.
194
216
 
@@ -216,7 +238,7 @@ Run the project's quality gates. Refer to `package.json` scripts, `README.md`, o
216
238
 
217
239
  Max 2 retry loops on quality check failures. After 2 retries:
218
240
 
219
- **ASK:** "Quality checks still failing after 2 fix attempts: {specific failures}. Options: (a) I'll fix manually, commit what we have, (b) keep trying, (c) abort changes."
241
+ **ASK:** "Quality checks still failing after 2 fix attempts: {specific failures}. Fix confidence: {high/medium/low — based on whether root cause is identified}. Options: (a) I'll fix manually, commit what we have, (b) keep trying, (c) abort changes."
220
242
 
221
243
  ---
222
244
 
@@ -235,6 +257,7 @@ The reviewer prompt MUST include:
235
257
  - Focus areas: **correctness and code quality only**. Skip security deep-dive, performance profiling, and documentation review.
236
258
  - All `scope: always` rule directives from `.agents/rules/`.
237
259
  - Iteration number and previous findings (if not the first iteration).
260
+ - 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.
238
261
 
239
262
  2. Process reviewer output:
240
263
  - If **0 Critical and 0 Warning** findings: review loop is clean. Proceed to Step 6b.
@@ -242,6 +265,7 @@ The reviewer prompt MUST include:
242
265
  - **Suggestions**: skip. The point of quick-change is speed.
243
266
 
244
267
  3. If 3 iterations complete and findings remain, **ASK** the user whether to proceed or fix manually.
268
+ 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.
245
269
 
246
270
  4. After any fixes, re-run quality checks (Step 5a) to verify nothing broke.
247
271
 
@@ -255,6 +279,7 @@ After the review loop is clean, spawn both agents in parallel via the Task tool:
255
279
  Both prompts MUST include:
256
280
  - The diff of all changes made.
257
281
  - All `scope: always` rule directives from `.agents/rules/`.
282
+ - 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.
258
283
 
259
284
  Apply any resulting changes (new tests, security fixes). Re-run quality checks (Step 5a) if changes were made.
260
285
 
@@ -310,6 +335,7 @@ Quick Change Complete:
310
335
  Quality: lint {pass/fail}, types {pass/fail}, tests {pass/fail}
311
336
  Review: {skipped / N findings applied}
312
337
  Git: {committed on {branch} / committed and pushed / skipped}
338
+ Confidence: {high/medium/low — overall assessment of change correctness}
313
339
  ```
314
340
 
315
341
  ---