hatch3r 1.0.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 (132) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +437 -0
  3. package/agents/hatch3r-a11y-auditor.md +126 -0
  4. package/agents/hatch3r-architect.md +160 -0
  5. package/agents/hatch3r-ci-watcher.md +123 -0
  6. package/agents/hatch3r-context-rules.md +97 -0
  7. package/agents/hatch3r-dependency-auditor.md +164 -0
  8. package/agents/hatch3r-devops.md +138 -0
  9. package/agents/hatch3r-docs-writer.md +97 -0
  10. package/agents/hatch3r-implementer.md +162 -0
  11. package/agents/hatch3r-learnings-loader.md +108 -0
  12. package/agents/hatch3r-lint-fixer.md +104 -0
  13. package/agents/hatch3r-perf-profiler.md +123 -0
  14. package/agents/hatch3r-researcher.md +642 -0
  15. package/agents/hatch3r-reviewer.md +81 -0
  16. package/agents/hatch3r-security-auditor.md +119 -0
  17. package/agents/hatch3r-test-writer.md +134 -0
  18. package/commands/hatch3r-agent-customize.md +146 -0
  19. package/commands/hatch3r-api-spec.md +49 -0
  20. package/commands/hatch3r-benchmark.md +50 -0
  21. package/commands/hatch3r-board-fill.md +504 -0
  22. package/commands/hatch3r-board-init.md +315 -0
  23. package/commands/hatch3r-board-pickup.md +672 -0
  24. package/commands/hatch3r-board-refresh.md +198 -0
  25. package/commands/hatch3r-board-shared.md +369 -0
  26. package/commands/hatch3r-bug-plan.md +410 -0
  27. package/commands/hatch3r-codebase-map.md +1182 -0
  28. package/commands/hatch3r-command-customize.md +94 -0
  29. package/commands/hatch3r-context-health.md +112 -0
  30. package/commands/hatch3r-cost-tracking.md +139 -0
  31. package/commands/hatch3r-dep-audit.md +171 -0
  32. package/commands/hatch3r-feature-plan.md +379 -0
  33. package/commands/hatch3r-healthcheck.md +307 -0
  34. package/commands/hatch3r-hooks.md +282 -0
  35. package/commands/hatch3r-learn.md +217 -0
  36. package/commands/hatch3r-migration-plan.md +51 -0
  37. package/commands/hatch3r-onboard.md +56 -0
  38. package/commands/hatch3r-project-spec.md +1153 -0
  39. package/commands/hatch3r-recipe.md +179 -0
  40. package/commands/hatch3r-refactor-plan.md +426 -0
  41. package/commands/hatch3r-release.md +328 -0
  42. package/commands/hatch3r-roadmap.md +556 -0
  43. package/commands/hatch3r-rule-customize.md +114 -0
  44. package/commands/hatch3r-security-audit.md +370 -0
  45. package/commands/hatch3r-skill-customize.md +93 -0
  46. package/commands/hatch3r-workflow.md +377 -0
  47. package/dist/cli/hooks-ZOTFDEA3.js +59 -0
  48. package/dist/cli/index.d.ts +2 -0
  49. package/dist/cli/index.js +3584 -0
  50. package/github-agents/hatch3r-docs-agent.md +46 -0
  51. package/github-agents/hatch3r-lint-agent.md +41 -0
  52. package/github-agents/hatch3r-security-agent.md +54 -0
  53. package/github-agents/hatch3r-test-agent.md +66 -0
  54. package/hooks/hatch3r-ci-failure.md +10 -0
  55. package/hooks/hatch3r-file-save.md +11 -0
  56. package/hooks/hatch3r-post-merge.md +10 -0
  57. package/hooks/hatch3r-pre-commit.md +11 -0
  58. package/hooks/hatch3r-pre-push.md +10 -0
  59. package/hooks/hatch3r-session-start.md +10 -0
  60. package/mcp/mcp.json +62 -0
  61. package/package.json +84 -0
  62. package/prompts/hatch3r-bug-triage.md +155 -0
  63. package/prompts/hatch3r-code-review.md +131 -0
  64. package/prompts/hatch3r-pr-description.md +173 -0
  65. package/rules/hatch3r-accessibility-standards.md +77 -0
  66. package/rules/hatch3r-accessibility-standards.mdc +75 -0
  67. package/rules/hatch3r-agent-orchestration.md +160 -0
  68. package/rules/hatch3r-api-design.md +176 -0
  69. package/rules/hatch3r-api-design.mdc +176 -0
  70. package/rules/hatch3r-browser-verification.md +73 -0
  71. package/rules/hatch3r-browser-verification.mdc +73 -0
  72. package/rules/hatch3r-ci-cd.md +70 -0
  73. package/rules/hatch3r-ci-cd.mdc +68 -0
  74. package/rules/hatch3r-code-standards.md +102 -0
  75. package/rules/hatch3r-code-standards.mdc +100 -0
  76. package/rules/hatch3r-component-conventions.md +102 -0
  77. package/rules/hatch3r-component-conventions.mdc +102 -0
  78. package/rules/hatch3r-data-classification.md +85 -0
  79. package/rules/hatch3r-data-classification.mdc +83 -0
  80. package/rules/hatch3r-dependency-management.md +17 -0
  81. package/rules/hatch3r-dependency-management.mdc +15 -0
  82. package/rules/hatch3r-error-handling.md +17 -0
  83. package/rules/hatch3r-error-handling.mdc +15 -0
  84. package/rules/hatch3r-feature-flags.md +112 -0
  85. package/rules/hatch3r-feature-flags.mdc +112 -0
  86. package/rules/hatch3r-git-conventions.md +47 -0
  87. package/rules/hatch3r-git-conventions.mdc +45 -0
  88. package/rules/hatch3r-i18n.md +90 -0
  89. package/rules/hatch3r-i18n.mdc +90 -0
  90. package/rules/hatch3r-learning-consult.md +29 -0
  91. package/rules/hatch3r-learning-consult.mdc +27 -0
  92. package/rules/hatch3r-migrations.md +17 -0
  93. package/rules/hatch3r-migrations.mdc +15 -0
  94. package/rules/hatch3r-observability.md +165 -0
  95. package/rules/hatch3r-observability.mdc +165 -0
  96. package/rules/hatch3r-performance-budgets.md +109 -0
  97. package/rules/hatch3r-performance-budgets.mdc +109 -0
  98. package/rules/hatch3r-secrets-management.md +76 -0
  99. package/rules/hatch3r-secrets-management.mdc +74 -0
  100. package/rules/hatch3r-security-patterns.md +211 -0
  101. package/rules/hatch3r-security-patterns.mdc +211 -0
  102. package/rules/hatch3r-testing.md +89 -0
  103. package/rules/hatch3r-testing.mdc +87 -0
  104. package/rules/hatch3r-theming.md +51 -0
  105. package/rules/hatch3r-theming.mdc +51 -0
  106. package/rules/hatch3r-tooling-hierarchy.md +92 -0
  107. package/rules/hatch3r-tooling-hierarchy.mdc +79 -0
  108. package/skills/hatch3r-a11y-audit/SKILL.md +131 -0
  109. package/skills/hatch3r-agent-customize/SKILL.md +75 -0
  110. package/skills/hatch3r-api-spec/SKILL.md +66 -0
  111. package/skills/hatch3r-architecture-review/SKILL.md +96 -0
  112. package/skills/hatch3r-bug-fix/SKILL.md +129 -0
  113. package/skills/hatch3r-ci-pipeline/SKILL.md +76 -0
  114. package/skills/hatch3r-command-customize/SKILL.md +67 -0
  115. package/skills/hatch3r-context-health/SKILL.md +76 -0
  116. package/skills/hatch3r-cost-tracking/SKILL.md +65 -0
  117. package/skills/hatch3r-dep-audit/SKILL.md +82 -0
  118. package/skills/hatch3r-feature/SKILL.md +129 -0
  119. package/skills/hatch3r-gh-agentic-workflows/SKILL.md +150 -0
  120. package/skills/hatch3r-incident-response/SKILL.md +86 -0
  121. package/skills/hatch3r-issue-workflow/SKILL.md +139 -0
  122. package/skills/hatch3r-logical-refactor/SKILL.md +73 -0
  123. package/skills/hatch3r-migration/SKILL.md +76 -0
  124. package/skills/hatch3r-perf-audit/SKILL.md +114 -0
  125. package/skills/hatch3r-pr-creation/SKILL.md +85 -0
  126. package/skills/hatch3r-qa-validation/SKILL.md +86 -0
  127. package/skills/hatch3r-recipe/SKILL.md +67 -0
  128. package/skills/hatch3r-refactor/SKILL.md +86 -0
  129. package/skills/hatch3r-release/SKILL.md +93 -0
  130. package/skills/hatch3r-rule-customize/SKILL.md +70 -0
  131. package/skills/hatch3r-skill-customize/SKILL.md +67 -0
  132. package/skills/hatch3r-visual-refactor/SKILL.md +89 -0
@@ -0,0 +1,198 @@
1
+ ---
2
+ id: hatch3r-board-refresh
3
+ type: command
4
+ description: Regenerate the living board overview dashboard from current board state. Scans all open issues, computes health metrics, and updates the meta:board-overview issue.
5
+ ---
6
+ # Board Refresh -- Regenerate the Board Overview Dashboard
7
+
8
+ Scan all open issues on **{owner}/{repo}** (read from `/.agents/hatch.json` board config), compute board health metrics, build implementation lanes from dependency analysis, and regenerate the `meta:board-overview` dashboard issue with current data, model recommendations, and health diagnostics. This is a lightweight, read-heavy command -- the only mutation is updating (or creating) the single board overview issue.
9
+
10
+ ---
11
+
12
+ ## Integration with GitHub Agentic Workflows
13
+
14
+ hatch3r's board commands operate as the **implementation orchestration layer** above GitHub Agentic Workflows. While GitHub's agentic workflows handle continuous automation (triage, testing, documentation), hatch3r's board commands orchestrate the full delivery pipeline:
15
+
16
+ - **board-init** sets up the project management structure that agentic workflows operate within
17
+ - **board-fill** creates the work items that agentic workflows can triage and label
18
+ - **board-pickup** orchestrates the implementation -> review -> merge pipeline that goes beyond what generic agentic workflows provide
19
+ - **board-refresh** regenerates the living dashboard on demand without running a full board command
20
+
21
+ GitHub Agentic Workflows and hatch3r are complementary: use agentic workflows for continuous background automation, use hatch3r board commands for structured delivery orchestration.
22
+
23
+ ---
24
+
25
+ ## Shared Context
26
+
27
+ **Read the `hatch3r-board-shared` command at the start of the run.** It contains Board Configuration, GitHub Context, Project Reference, Projects v2 sync procedure, and tooling directives. Cache all values for the duration of this run.
28
+
29
+ ## Token-Saving Directives
30
+
31
+ Follow the **Token-Saving Directives** in `hatch3r-board-shared`.
32
+
33
+ ---
34
+
35
+ ## Workflow
36
+
37
+ Execute these steps in order. **Do not skip any step.**
38
+
39
+ ### Step 1: Read Configuration
40
+
41
+ 1. Read `/.agents/hatch.json` and cache the full config (top-level `owner`/`repo` and `board` section).
42
+ 2. Resolve owner/repo per `hatch3r-board-shared`: use top-level `owner`/`repo` first, fall back to `board.owner`/`board.repo` if top-level values are empty.
43
+ 3. If both are missing, abort with: "Cannot refresh board -- owner and repo are not configured in `/.agents/hatch.json`. Run `board-init` first."
44
+ 4. Note `board.projectNumber` -- if null, Projects v2 sync will be skipped later.
45
+
46
+ ---
47
+
48
+ ### Step 2: Full Board Scan
49
+
50
+ Perform ONE comprehensive scan and cache everything for subsequent steps.
51
+
52
+ #### 2a. Fetch Open Issues
53
+
54
+ 1. Fetch ALL open issues: `gh issue list -R {owner}/{repo} --state open --limit 500 --json number,title,labels,state,createdAt,updatedAt,body`. Paginate if necessary. Fall back to `list_issues` MCP if gh CLI fails.
55
+ 2. For each issue, extract labels from the JSON response.
56
+ 3. Check for sub-issues: `issue_read` with `method: get_sub_issues` for any issue that appears to be an epic (has sub-issues or is referenced as a parent). Cache parent-child relationships.
57
+ 4. Parse `## Dependencies` sections from issue bodies for dependency references. Recognize both hard (`Blocked by #N`, `Depends on #N`) and soft (`Recommended after #N`) dependency types. Track the type for each edge in the dependency graph -- only hard dependencies block pickup and exclude issues from Implementation Lanes.
58
+ 5. **Exclude** any issue labeled `meta:board-overview` from all analysis and listings.
59
+
60
+ #### 2b. Categorize Issues
61
+
62
+ Classify every open issue (excluding `meta:board-overview`):
63
+
64
+ - **Epic** -- has sub-issues
65
+ - **Sub-issue** -- is a child of an epic
66
+ - **Standalone** -- neither parent nor child
67
+
68
+ ---
69
+
70
+ ### Step 3: Compute Board Health & Metrics
71
+
72
+ Analyze cached data to produce board health diagnostics.
73
+
74
+ #### 3a. Status Distribution
75
+
76
+ Count issues per status label:
77
+
78
+ | Status | Source |
79
+ | --- | --- |
80
+ | Backlog / Triage | Issues with `status:triage` |
81
+ | Ready | Issues with `status:ready` |
82
+ | In Progress | Issues with `status:in-progress` |
83
+ | In Review | Issues with `status:in-review` |
84
+ | Externally Blocked | Issues with `status:blocked` |
85
+
86
+ #### 3b. Missing Metadata Detection
87
+
88
+ For each open issue, check for required labels. Flag issues missing any of:
89
+
90
+ - `type:*` (at least one type label)
91
+ - `priority:*` (at least one priority label)
92
+ - `executor:*` (at least one executor label)
93
+
94
+ Optional but noted: missing `area:*`, missing `risk:*`.
95
+
96
+ #### 3c. Dependency Health
97
+
98
+ 1. Build a dependency graph from parsed `## Dependencies` sections.
99
+ 2. Identify **blocked chains**: issues with unsatisfied blockers (blocker is still open).
100
+ 3. Count issues with `has-dependencies` label.
101
+ 4. **Epic ordering consistency**: For each epic, compare its `## Implementation Order` levels against the DAG derived from its sub-issues' `## Dependencies` sections. Flag epics where the two diverge (e.g., a sub-issue's `## Dependencies` lists a blocker not reflected in the epic's level ordering, or the epic lists a level order that contradicts the dependency DAG). Report discrepancies in Board Health.
102
+ 5. **Cross-epic dependencies**: Scan hard dependencies (`Blocked by #N`) where the blocking issue and the dependent issue belong to different epics. Aggregate these into epic-level relationships: "Epic A blocks Epic B via sub-issue #X blocking sub-issue #Y." Collect for the Cross-Epic Dependencies section of the overview.
103
+
104
+ #### 3d. Stale Issue Detection
105
+
106
+ Flag open issues that are potentially stale:
107
+
108
+ - `status:triage` with no update in 14+ days (based on `updatedAt`).
109
+ - `status:in-progress` with no update in 7+ days (may be abandoned).
110
+
111
+ #### 3e. Lane Computation & Dependency-Waiting Partition
112
+
113
+ Compute Implementation Lanes and the Waiting on Dependencies list for all `status:ready` issues using the **Lane Computation Algorithm** from `hatch3r-board-shared`. Use the dependency graph built in Step 3c as input. The algorithm partitions ready issues into available (all blockers satisfied) and dependency-waiting (unsatisfied blockers), then computes lanes only from available issues.
114
+
115
+ ---
116
+
117
+ ### Step 4: Regenerate Board Overview
118
+
119
+ Build the dashboard body following the **Board Overview Issue Format** and **Model Selection Heuristic** from `hatch3r-board-shared`.
120
+
121
+ #### 4a. Model Assignment
122
+
123
+ For each open issue, assign a recommended model using the **Model Selection Heuristic (Quality-First)** from `hatch3r-board-shared`. Apply that heuristic as the single source of truth; do not duplicate it here.
124
+
125
+ #### 4b. Compose Dashboard Body
126
+
127
+ Assemble the dashboard using the **Board Overview Issue Format** template from `hatch3r-board-shared`. Populate it with:
128
+
129
+ 1. **Status Summary** from Step 3a counts.
130
+ 2. **In Progress** and **In Review** from cached issues with the corresponding status labels.
131
+ 3. **Implementation Lanes** from Step 3e lane computation results (available issues only).
132
+ 4. **Cross-Epic Dependencies** from Step 3c cross-epic dependency scan (omit if none).
133
+ 5. **Waiting on Dependencies** from Step 3e partition results (dependency-waiting issues: `status:ready` with unsatisfied hard blockers).
134
+ 6. **Externally Blocked** from cached issues with `status:blocked`.
135
+ 7. **Backlog / Triage** from cached issues with `status:triage`.
136
+ 8. **Board Health** from Steps 3b (missing metadata), 3d (stale issues), 3c (blocked chains, epic ordering discrepancies).
137
+
138
+ ---
139
+
140
+ ### Step 5: Update Overview Issue
141
+
142
+ #### 5a. Find Existing Overview Issue
143
+
144
+ Search the cached board inventory for an open issue labeled `meta:board-overview`.
145
+
146
+ **If multiple found:** Use the one with the lowest issue number (oldest). Warn: "Multiple board overview issues found (#{N}, #{M}). Updating #{lowest}. Consider closing duplicates."
147
+
148
+ #### 5b. Update or Create
149
+
150
+ **If found:** Update the issue body:
151
+
152
+ ```bash
153
+ gh issue edit {number} -R {owner}/{repo} --body "{generated dashboard body}"
154
+ ```
155
+
156
+ Fall back to `issue_write` MCP with `method: update` if gh CLI fails.
157
+
158
+ **If not found:** Create a new board overview issue:
159
+
160
+ ```bash
161
+ gh issue create -R {owner}/{repo} --title "[Board Overview] {repo} Project Board" --label "meta:board-overview" --body "{generated dashboard body}"
162
+ ```
163
+
164
+ Fall back to `issue_write` MCP with `method: create` if gh CLI fails.
165
+
166
+ Then add the new issue to the project board and set its status to **Backlog** using the **Projects v2 Sync Procedure** from `hatch3r-board-shared`.
167
+
168
+ #### 5c. Summary
169
+
170
+ Present a confirmation:
171
+
172
+ ```
173
+ Board Refresh Complete:
174
+ Project: {owner}/{repo}
175
+ Overview issue: #{number} (updated / created)
176
+ Open issues: {total} ({epics} epics, {sub} sub-issues, {standalone} standalone)
177
+ Status: {ready} ready ({available} available, {depWaiting} waiting on deps), {inProgress} in progress, {inReview} in review, {blocked} ext. blocked, {triage} triage
178
+ Lanes: {laneCount} parallel lanes ({available} available issues)
179
+ Health: {N} issues missing metadata, {M} stale, {K} blocked chains
180
+ ```
181
+
182
+ ---
183
+
184
+ ## Error Handling
185
+
186
+ - **`gh issue list` failure:** Retry once, then fall back to `list_issues` MCP. If both fail, abort with: "Cannot scan board -- check `gh auth login` status and repository access."
187
+ - **`gh issue edit` / `gh issue create` failure:** Retry once, then fall back to `issue_write` MCP. If both fail, present the generated dashboard body to the user so they can update the issue manually.
188
+ - **`issue_read` (sub-issues) failure:** Warn and continue. Epic/sub-issue relationships will be incomplete; note in the summary.
189
+ - **Projects v2 sync failure (new overview issue only):** Warn and continue. The issue is created but not added to the project board.
190
+
191
+ ## Guardrails
192
+
193
+ - **Never modify any issue other than the `meta:board-overview` issue.** This command is read-only for all other issues.
194
+ - **Exclude the board overview issue from its own listings.** It must never appear in any status table.
195
+ - **One board overview issue at a time.** If multiple are found, update the oldest and warn about duplicates.
196
+ - **Follow the GitHub CLI-first approach** from `hatch3r-board-shared`. Use `gh` CLI as primary; MCP as fallback.
197
+ - **No ASK checkpoints.** This command performs a single, non-destructive mutation (updating the dashboard). It runs to completion without user prompts.
198
+ - **Respect the Model Selection Heuristic.** Always include the `Model` column using the quality-first heuristic from `hatch3r-board-shared`.
@@ -0,0 +1,369 @@
1
+ ---
2
+ id: hatch3r-board-shared
3
+ type: command
4
+ description: Shared context and procedures for all board commands. Provides GitHub context from hatch.json, Projects v2 sync, and tooling directives.
5
+ ---
6
+ # Board Shared Reference
7
+
8
+ Shared context for `hatch3r-board-fill`, `hatch3r-board-pickup`, `hatch3r-board-refresh`, and related board commands. Read once per run and cache.
9
+
10
+ ---
11
+
12
+ ## Board Configuration
13
+
14
+ All board commands read project-specific configuration from `/.agents/hatch.json`. The GitHub owner and repo are defined at the top level (`owner`, `repo`). Board-specific configuration (Projects v2 IDs, label taxonomy, branch conventions, area labels) lives under the `board` key. **Read `/.agents/hatch.json` at the start of every run and cache both top-level and `board` config for the duration.**
15
+
16
+ **Owner/repo resolution:** Use top-level `owner`/`repo`. Fall back to `board.owner`/`board.repo` if top-level values are empty (backward compatibility).
17
+
18
+ ```json
19
+ {
20
+ "owner": "{github-org-or-user}",
21
+ "repo": "{repository-name}",
22
+ "board": {
23
+ "owner": "{github-org-or-user}",
24
+ "repo": "{repository-name}",
25
+ "defaultBranch": "main",
26
+ "projectNumber": null,
27
+ "statusFieldId": null,
28
+ "statusOptions": {
29
+ "backlog": null,
30
+ "ready": null,
31
+ "inProgress": null,
32
+ "inReview": null,
33
+ "done": null
34
+ },
35
+ "labels": {
36
+ "types": ["type:bug", "type:feature", "type:refactor", "type:qa", "type:docs", "type:infra"],
37
+ "executors": ["executor:agent", "executor:human", "executor:hybrid"],
38
+ "statuses": ["status:triage", "status:ready", "status:in-progress", "status:in-review", "status:blocked"],
39
+ "meta": ["meta:board-overview"]
40
+ },
41
+ "branchConvention": "{type}/{short-description}",
42
+ "areas": []
43
+ },
44
+ "models": {
45
+ "default": "opus",
46
+ "agents": {
47
+ "hatch3r-lint-fixer": "sonnet"
48
+ }
49
+ }
50
+ }
51
+ ```
52
+
53
+ **`board.defaultBranch`** — Branch used for checkout before creating feature branches, PR base branch, and release operations. Default: `"main"`. Set to `"master"` or another branch name for repositories that use a different default.
54
+
55
+ If any field is `null` or missing, the corresponding feature is disabled (e.g., null `projectNumber` → skip Projects v2 sync).
56
+
57
+ **`models`** — Optional. Preferred AI models for agents. `models.default` applies to all agents; `models.agents` overrides per agent. Use aliases (`opus`, `sonnet`, `codex`, `gemini-pro`) or full model IDs. Resolution order: `.hatch3r/agents/{id}.customize.yaml` > manifest per-agent > agent frontmatter > manifest default. See [docs/model-selection.md](../docs/model-selection.md) and [docs/adapter-capability-matrix.md](../docs/adapter-capability-matrix.md#agent-model-customization).
58
+
59
+ ---
60
+
61
+ ## GitHub Context
62
+
63
+ Derived from `/.agents/hatch.json` board config:
64
+
65
+ - **Owner:** top-level `owner` (fallback: `board.owner`)
66
+ - **Repository:** top-level `repo` (fallback: `board.repo`)
67
+ - **Default branch:** `board.defaultBranch` (fallback: `"main"`)
68
+ - **Type labels:** `board.labels.types`
69
+ - **Executor labels:** `board.labels.executors`
70
+ - **Status labels:** `board.labels.statuses`
71
+ - **Dependency label:** `has-dependencies`
72
+ - **Meta labels:** `board.labels.meta`
73
+ - **Branch convention:** `board.branchConvention`
74
+ - **Issue templates:** Check `.github/ISSUE_TEMPLATE/` if present in the repository.
75
+ - **PR template:** Check `.github/PULL_REQUEST_TEMPLATE.md` if present.
76
+
77
+ ### Project Reference (cache for the full run)
78
+
79
+ If `board.projectNumber` is not null, verify via `gh project view {board.projectNumber} --owner {board.owner}` or `gh project field-list {board.projectNumber} --owner {board.owner}` on first use.
80
+
81
+ - **Owner:** `board.owner`, **owner type:** infer from context (`org` or `user`)
82
+ - **Project number:** `board.projectNumber`
83
+ - **Status field ID:** `board.statusFieldId`
84
+ - **Status option IDs:** Read from `board.statusOptions` (keys: `backlog`, `ready`, `inProgress`, `inReview`, `done`)
85
+
86
+ ---
87
+
88
+ ## Projects v2 Sync Procedure
89
+
90
+ > **Skip entirely if `board.projectNumber` is null.**
91
+
92
+ Use this procedure whenever a status label is set or changes and the board needs to reflect it. Labels are the source of truth; Projects v2 sync keeps the board view consistent. This includes newly created issues -- sync their initial status immediately after adding them to the board.
93
+
94
+ **Prerequisites:** `gh auth refresh -s project` (Projects v2 via gh requires the `project` scope). gh CLI 2.40+ recommended.
95
+
96
+ **Status label → Projects v2 option mapping:**
97
+
98
+ Read the mapping from `board.statusOptions` in `/.agents/hatch.json`:
99
+
100
+ | Label | Option ID from hatch.json |
101
+ | -------------------- | ---------------------------------- |
102
+ | `status:triage` | `board.statusOptions.backlog` |
103
+ | `status:ready` | `board.statusOptions.ready` |
104
+ | `status:in-progress` | `board.statusOptions.inProgress` |
105
+ | `status:in-review` | `board.statusOptions.inReview` |
106
+ | `status:blocked` | `board.statusOptions.backlog` |
107
+
108
+ **Steps for each issue to sync (gh CLI primary):**
109
+
110
+ 1. **Resolve project node ID** (once per run, cache for the run): `gh project view {board.projectNumber} --owner {board.owner} --format json -q '.id'`. Required for step 3.
111
+ 2. **Add to board + capture item ID:** `gh project item-add {board.projectNumber} --owner {board.owner} --url https://github.com/{board.owner}/{board.repo}/issues/{N} --format json -q '.id'`. **Capture the item ID from the output.** This call is idempotent -- if the item already exists on the board it returns the existing item with its ID.
112
+ 3. **Update status:** `gh project item-edit --id {item_id} --project-id {project_node_id} --field-id {board.statusFieldId} --single-select-option-id {option_id}` using the label→option mapping from the table above.
113
+ 4. **Verify (first sync per run only):** After step 3, optionally confirm via `gh project item-list {board.projectNumber} --owner {board.owner} --format json` that the item's status matches. If it does not, retry step 3 once.
114
+
115
+ **For PRs:** Use `--url https://github.com/{board.owner}/{board.repo}/pull/{N}` in step 2.
116
+
117
+ **Fallback (rare):** If item-add does not return an item ID, use `gh project item-list {board.projectNumber} --owner {board.owner} --format json` and match by issue/PR content to obtain the item ID. Then proceed with step 3.
118
+
119
+ **MCP fallback:** If gh CLI fails, `project` scope is unavailable, or gh version is too old, fall back to `projects_write` / `projects_get` / `projects_list` with `method: add_project_item`, `method: update_project_item`, `method: get_project_item`, `method: list_project_items` as in the legacy procedure.
120
+
121
+ **Resilience:** If any call fails, retry once. If it still fails, surface a warning to the user and continue with the next item. If gh CLI and MCP are both unavailable, skip sync silently and warn: "Projects v2 sync skipped -- run `gh auth refresh -s project` or enable the `projects` toolset in your MCP configuration."
122
+
123
+ ---
124
+
125
+ ## Board Overview
126
+
127
+ If `meta:board-overview` is included in `board.labels.meta`, board commands will look for an open issue with that label to use as a live dashboard. This dashboard is auto-maintained and MUST be regenerated at the end of every board command run that mutates issues. For on-demand regeneration without running a full board command, use `hatch3r-board-refresh`.
128
+
129
+ Teams can extend the dashboard with project-specific sections, but the following structure and model recommendations are required.
130
+
131
+ ### Frontier Model Pool
132
+
133
+ When populating the board overview, assign a recommended model to each issue. The pool uses aliases that map to the project's configured model versions in `hatch.json`. Specific model IDs are intentionally omitted here to avoid staleness as model versions change — configure actual model IDs in `hatch.json` under `models`.
134
+
135
+ | Alias | Strength | Use When |
136
+ | ----- | -------- | -------- |
137
+ | `opus` | Code quality, multi-file refactoring, security, deep reasoning | Complex refactors, security-critical, architectural changes, `risk:high` |
138
+ | `codex` | Agentic coding, long-running tasks, tool orchestration | Multi-step implementations, polyglot codebases, complex tool integrations |
139
+ | `gemini-pro` | Large context windows, multimodal, web development | Massive context needs (large epics), web/frontend work |
140
+ | `sonnet` | Balance of quality and speed | Standard features, bugs, docs, QA — when the top-tier model is overkill |
141
+
142
+ ### Model Selection Heuristic (Quality-First)
143
+
144
+ 1. **Default:** `opus` — highest code quality baseline.
145
+ 2. **Override to `codex`** if the issue involves heavy agentic coding, long-running multi-step tasks, or multi-language requirements.
146
+ 3. **Override to `gemini-pro`** if the issue requires processing very large context (large epic with many sub-issues spanning many files) or is primarily web/frontend work.
147
+ 4. **Downgrade to `sonnet`** ONLY for straightforward issues: simple bugs (`risk:low`), documentation (`type:docs`), QA validation (`type:qa`), or issues with clear bounded scope and no architectural impact.
148
+
149
+ ### Board Overview Issue Format
150
+
151
+ Issue listings in the board overview MUST include a `Model` column. All board commands that regenerate the dashboard MUST use this canonical template. Omit any status section that has zero issues (except Status Summary, which always appears). Omit Board Health sub-sections that have no findings. Sort issues within each status group by priority (`P0` first), then by issue number.
152
+
153
+ ```markdown
154
+ ## Board Overview
155
+
156
+ **Project:** {owner}/{repo}
157
+ **Last refreshed:** {ISO date}
158
+
159
+ ---
160
+
161
+ ## Status Summary
162
+
163
+ | Status | Count |
164
+ |--------|-------|
165
+ | Backlog / Triage | {count} |
166
+ | Ready | {count} |
167
+ | In Progress | {count} |
168
+ | In Review | {count} |
169
+ | Externally Blocked | {count} |
170
+ | **Total Open** | **{count}** |
171
+
172
+ ---
173
+
174
+ ## In Progress
175
+
176
+ | # | Title | Type | Pri | Executor | Model |
177
+ |---|-------|------|-----|----------|-------|
178
+ | #{N} | {title} | {type} | {pri} | {executor} | {model} |
179
+
180
+ ## In Review
181
+
182
+ | # | Title | Type | Pri | Executor | Model |
183
+ |---|-------|------|-----|----------|-------|
184
+ | #{N} | {title} | {type} | {pri} | {executor} | {model} |
185
+
186
+ ## Implementation Lanes
187
+
188
+ Issues grouped into independent parallel work streams.
189
+ Different lanes can be worked concurrently; within a lane, follow the listed order.
190
+
191
+ ### Lane 1: {area/theme}
192
+
193
+ | Order | # | Title | Type | Pri | Executor | Model |
194
+ |-------|---|-------|------|-----|----------|-------|
195
+ | 1 | #{N} | {title} | {type} | {pri} | {executor} | {model} |
196
+ | 2 | #{M} | {title} | {type} | {pri} | {executor} | {model} |
197
+
198
+ ### Lane 2: {area/theme}
199
+
200
+ | Order | # | Title | Type | Pri | Executor | Model |
201
+ |-------|---|-------|------|-----|----------|-------|
202
+ | 1 | #{N} | {title} | {type} | {pri} | {executor} | {model} |
203
+
204
+ ## Cross-Epic Dependencies
205
+
206
+ Dependency relationships between epics. Omit if no cross-epic dependencies exist.
207
+
208
+ | Upstream Epic | Downstream Epic | Via |
209
+ |---------------|-----------------|-----|
210
+ | #{epicA} {title} | #{epicB} {title} | #{subX} blocks #{subY} |
211
+
212
+ ## Waiting on Dependencies
213
+
214
+ `status:ready` issues with one or more unsatisfied blockers. Not yet available for pickup.
215
+
216
+ | # | Title | Type | Waiting On | Model |
217
+ |---|-------|------|------------|-------|
218
+ | #{N} | {title} | {type} | #{blocker} ({blocker status}) | {model} |
219
+
220
+ ## Externally Blocked
221
+
222
+ Issues with `status:blocked` -- waiting on external factors (approvals, environments, third-party services).
223
+
224
+ | # | Title | Type | Reason | Model |
225
+ |---|-------|------|--------|-------|
226
+ | #{N} | {title} | {type} | {blocker reason} | {model} |
227
+
228
+ ## Backlog / Triage
229
+
230
+ | # | Title | Type | Pri | Executor | Model |
231
+ |---|-------|------|-----|----------|-------|
232
+ | #{N} | {title} | {type} | {pri} | {executor} | {model} |
233
+
234
+ ---
235
+
236
+ ## Board Health
237
+
238
+ **Missing metadata:**
239
+ - {list or "None -- all issues have required labels."}
240
+
241
+ **Stale issues:**
242
+ - {list or "None -- all issues are active."}
243
+
244
+ **Blocked chains:**
245
+ - {list or "None -- no blocked dependencies."}
246
+
247
+ **Epic ordering discrepancies:**
248
+ - {list or "None -- all epic Implementation Order sections match sub-issue Dependencies."}
249
+
250
+ ---
251
+
252
+ *This issue is auto-maintained by hatch3r board commands. Do not close.*
253
+ ```
254
+
255
+ ### Dependency Data Model
256
+
257
+ `## Dependencies` sections in individual issue bodies are the **single authoritative source** of dependency data. Every issue (epic, sub-issue, standalone) tracks its own blockers in its `## Dependencies` section using two reference types:
258
+
259
+ - **Hard:** `Blocked by #N` -- this issue cannot start until #N is closed. Used for true producer/consumer relationships (A creates what B consumes) and explicit sequencing requirements.
260
+ - **Soft:** `Recommended after #N` -- this issue can proceed in parallel with #N, but sequential execution is recommended (e.g., shared area overlap, reduced merge conflict risk). Soft dependencies are advisory; they do not block pickup or exclude issues from Implementation Lanes.
261
+
262
+ When no dependencies exist, the section contains `None`.
263
+
264
+ `## Implementation Order` sections in epic bodies are a **derived convenience view** -- they visualize the dependency DAG among an epic's sub-issues as numbered levels. Board commands that create or update epics MUST regenerate `## Implementation Order` from the sub-issues' `## Dependencies` sections, not the other way around. When the two diverge, `## Dependencies` wins.
265
+
266
+ ### Lane Computation Algorithm
267
+
268
+ Used by both `board-refresh` and `board-fill` when generating the Implementation Lanes and Waiting on Dependencies sections. Input: all `status:ready` issues and their dependency data (from `## Dependencies` sections).
269
+
270
+ 1. **Collect** all `status:ready` issues.
271
+ 2. **Partition by hard-blocker satisfaction** -- for each collected issue, check all **hard** dependency references (`Blocked by #N`) in its `## Dependencies` section against the full board. An issue is **dependency-waiting** if any hard blocker is still open (regardless of the blocker's status). Soft dependencies (`Recommended after #N`) do not affect this partition. Separate into two sets:
272
+ - **Available** -- all hard blockers satisfied (closed) or no hard blockers. These proceed to lane computation (step 3+).
273
+ - **Dependency-waiting** -- one or more hard blockers still open. These are excluded from Implementation Lanes and listed in the **Waiting on Dependencies** section of the overview instead.
274
+ 3. **Build the available sub-graph** -- extract only the inter-dependencies among available issues (from parsed `## Dependencies` sections).
275
+ 4. **Group by dependency chains** -- issues with sequential dependencies go in the same lane, ordered topologically within the chain.
276
+ 5. **Group by area overlap** -- independent issues (no inter-dependencies) that share `area:*` labels go in the same lane. This avoids merge conflicts on the same files when multiple agents work in parallel.
277
+ 6. **General lane** -- issues with no dependencies and no area overlap form their own single-issue lanes. If three or more such issues exist, group them into a single "General" lane.
278
+ 7. **Name lanes** by the dominant `area:*` label or shared theme of the issues in the lane. Use "General" for the catch-all lane.
279
+ 8. **Sort lanes** by the highest-priority issue in each lane (`P0`-lane first, then `P1`, etc.). Break ties by lowest issue number.
280
+ 9. **Sort within lanes** by dependency order (blockers before dependents), then by priority, then by issue number.
281
+
282
+ Example output:
283
+
284
+ ```
285
+ ## Implementation Lanes
286
+
287
+ Issues grouped into independent parallel work streams.
288
+ Different lanes can be worked concurrently; within a lane, follow the listed order.
289
+
290
+ ### Lane 1: API
291
+
292
+ | Order | # | Title | Type | Pri | Executor | Model |
293
+ |-------|---|-------|------|-----|----------|-------|
294
+ | 1 | #15 | Fix rate limiter | bug | P0 | agent | opus |
295
+
296
+ ### Lane 2: Auth
297
+
298
+ | Order | # | Title | Type | Pri | Executor | Model |
299
+ |-------|---|-------|------|-----|----------|-------|
300
+ | 1 | #12 | OAuth2 PKCE flow | feature | P1 | agent | opus |
301
+ | 2 | #14 | Token refresh edge cases | bug | P2 | agent | sonnet |
302
+
303
+ ### Lane 3: General
304
+
305
+ | Order | # | Title | Type | Pri | Executor | Model |
306
+ |-------|---|-------|------|-----|----------|-------|
307
+ | 1 | #18 | Migrate to ESM | refactor | P2 | agent | opus |
308
+ | 2 | #21 | Update CI matrix | infra | P3 | agent | sonnet |
309
+ ```
310
+
311
+ ---
312
+
313
+ ## Cross-Cutting Tooling Directives
314
+
315
+ These directives apply to ALL board commands. They supplement the project's tooling hierarchy.
316
+
317
+ ### GitHub CLI-First
318
+
319
+ All board commands MUST use `gh` CLI as the primary interface for GitHub operations. CLI tools have lower token cost and faster execution than MCP equivalents.
320
+
321
+ **Prerequisites:** `gh auth login` must be completed, or `GITHUB_TOKEN` environment variable set. For Projects v2: `gh auth refresh -s project`.
322
+
323
+ | Operation | Primary (`gh` CLI) | Fallback (MCP) |
324
+ | -------------------- | ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------- |
325
+ | List issues | `gh issue list` | `list_issues` |
326
+ | Read issue details | `gh issue view` | `issue_read` |
327
+ | Create/update issues | `gh issue create` / `gh issue edit` | `issue_write` |
328
+ | Search issues | `gh search issues` | `search_issues` / `semantic_issues_search` |
329
+ | Manage sub-issues | `sub_issue_write` (MCP only — no CLI equivalent) | `sub_issue_write` |
330
+ | Add comments | `gh issue comment` | `add_issue_comment` |
331
+ | Create PRs | `gh pr create` | `create_pull_request` |
332
+ | Read PR details | `gh pr view` | `pull_request_read` |
333
+ | Manage labels | `gh label create` / `gh label list` | `issue_write` (with labels) |
334
+ | Projects v2 | `gh project item-add`, `gh project item-edit`, `gh project item-list`, `gh project field-list`, `gh project view` | `projects_write` / `projects_get` / `projects_list` |
335
+ | CI/Actions | `gh run list` / `gh run view` | N/A |
336
+ | Releases | `gh release create` | N/A |
337
+
338
+ Fallback to MCP only for operations the `gh` CLI cannot handle: sub-issue management (`sub_issue_write`).
339
+
340
+ ### Context7 MCP + Web Research
341
+
342
+ During **board-fill Step 4c** (external research) and **board-pickup Step 6** (implementation):
343
+
344
+ 1. Use **Context7 MCP** (`resolve-library-id` then `query-docs`) whenever an issue references an external library, framework, or SDK. This retrieves current, version-specific documentation to inform issue scoping and implementation.
345
+ 2. Use **web research** for novel technical challenges, current best practices, security advisories, or breaking changes not covered by Context7 or local docs.
346
+ 3. Follow the project's tooling hierarchy for knowledge augmentation priority.
347
+
348
+ ---
349
+
350
+ ## Formatting Rules
351
+
352
+ - Task list: `- [ ] #{number} {short title} *({type tag, }{priority})*`
353
+ - Type tag: `Epic` for epics, omitted for standalone.
354
+ - Short title: max ~50 chars, strip `[Type]:` prefix.
355
+ - Priority: `P0`-`P3` or `--`.
356
+ - The board overview issue itself is never listed.
357
+
358
+ ---
359
+
360
+ ## Token-Saving Directives
361
+
362
+ These apply to all board commands. Follow them to minimize token consumption.
363
+
364
+ 1. **Single board scan.** Perform ONE full board scan per run. Cache all issue data. Reuse for all subsequent steps. Only re-fetch an issue if you mutated it.
365
+ 2. **Do NOT re-read shared context files** -- their content is available via always-applied rules, this shared context file, or inline in the command.
366
+ 3. **Mandatory board dashboard regeneration.** If a `meta:board-overview` issue exists, board commands MUST regenerate it ONCE at the end of the run. Do not regenerate after intermediate status changes, and do not skip the final regeneration.
367
+ 4. **Limit documentation reads.** Read project documentation selectively -- TOC/headers first, full content only for relevant sections.
368
+ 5. **Do NOT read issue templates.** Required structure is provided inline in the command.
369
+ 6. **Follow the project's tooling hierarchy** for knowledge augmentation (Context7 MCP, web research).