hatch3r 1.7.0 → 1.7.5

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 (160) hide show
  1. package/README.md +38 -12
  2. package/agents/hatch3r-a11y-auditor.md +4 -0
  3. package/agents/hatch3r-architect.md +5 -1
  4. package/agents/hatch3r-ci-watcher.md +4 -0
  5. package/agents/hatch3r-context-rules.md +4 -0
  6. package/agents/hatch3r-creator.md +4 -0
  7. package/agents/hatch3r-dependency-auditor.md +4 -0
  8. package/agents/hatch3r-devops.md +4 -0
  9. package/agents/hatch3r-docs-writer.md +4 -0
  10. package/agents/hatch3r-fixer.md +5 -1
  11. package/agents/hatch3r-handoff-loader.md +243 -0
  12. package/agents/hatch3r-handoff-preparer.md +134 -0
  13. package/agents/hatch3r-implementer.md +5 -1
  14. package/agents/hatch3r-learnings-loader.md +4 -0
  15. package/agents/hatch3r-lint-fixer.md +4 -0
  16. package/agents/hatch3r-perf-profiler.md +8 -0
  17. package/agents/hatch3r-researcher.md +5 -1
  18. package/agents/hatch3r-reviewer.md +92 -0
  19. package/agents/hatch3r-security-auditor.md +24 -0
  20. package/agents/hatch3r-test-writer.md +4 -0
  21. package/agents/modes/requirements-elicitation.md +5 -1
  22. package/agents/modes/similar-implementation.md +6 -0
  23. package/agents/modes/user-flows.md +76 -0
  24. package/agents/shared/quality-charter.md +129 -0
  25. package/agents/shared/user-question-protocol.md +95 -0
  26. package/commands/board/shared-azure-devops.md +2 -0
  27. package/commands/board/shared-github.md +17 -0
  28. package/commands/board/shared-gitlab.md +4 -0
  29. package/commands/hatch3r-board-fill.md +2 -1
  30. package/commands/hatch3r-board-pickup.md +1 -1
  31. package/commands/hatch3r-board-shared.md +21 -0
  32. package/commands/hatch3r-create.md +2 -0
  33. package/commands/hatch3r-handoff.md +126 -0
  34. package/commands/hatch3r-pr-resolve.md +672 -0
  35. package/commands/hatch3r-quick-change.md +5 -3
  36. package/commands/hatch3r-report.md +167 -0
  37. package/commands/hatch3r-revision.md +1 -1
  38. package/commands/hatch3r-workflow.md +3 -1
  39. package/dist/cli/index.js +3144 -979
  40. package/dist/cli/index.js.map +1 -1
  41. package/package.json +4 -2
  42. package/rules/hatch3r-accessibility-standards.md +21 -0
  43. package/rules/hatch3r-accessibility-standards.mdc +21 -0
  44. package/rules/hatch3r-agent-orchestration.md +32 -1
  45. package/rules/hatch3r-agent-orchestration.mdc +32 -1
  46. package/rules/hatch3r-ai-evals.md +158 -0
  47. package/rules/hatch3r-ai-evals.mdc +154 -0
  48. package/rules/hatch3r-ai-ux-patterns.md +131 -0
  49. package/rules/hatch3r-ai-ux-patterns.mdc +127 -0
  50. package/rules/hatch3r-api-design.md +67 -9
  51. package/rules/hatch3r-api-design.mdc +67 -9
  52. package/rules/hatch3r-api-versioning.md +119 -0
  53. package/rules/hatch3r-api-versioning.mdc +115 -0
  54. package/rules/hatch3r-auth-patterns.md +170 -0
  55. package/rules/hatch3r-auth-patterns.mdc +166 -0
  56. package/rules/hatch3r-component-conventions.md +30 -0
  57. package/rules/hatch3r-component-conventions.mdc +30 -0
  58. package/rules/hatch3r-container-hardening.md +131 -0
  59. package/rules/hatch3r-container-hardening.mdc +127 -0
  60. package/rules/hatch3r-contract-testing.md +117 -0
  61. package/rules/hatch3r-contract-testing.mdc +113 -0
  62. package/rules/hatch3r-deep-context.md +3 -1
  63. package/rules/hatch3r-deep-context.mdc +3 -1
  64. package/rules/hatch3r-dependency-management.md +73 -1
  65. package/rules/hatch3r-dependency-management.mdc +72 -0
  66. package/rules/hatch3r-design-system-detection.md +142 -0
  67. package/rules/hatch3r-design-system-detection.mdc +138 -0
  68. package/rules/hatch3r-event-schema-evolution.md +90 -0
  69. package/rules/hatch3r-event-schema-evolution.mdc +86 -0
  70. package/rules/hatch3r-handoff-readiness.md +45 -0
  71. package/rules/hatch3r-handoff-readiness.mdc +40 -0
  72. package/rules/hatch3r-i18n.md +13 -0
  73. package/rules/hatch3r-i18n.mdc +13 -0
  74. package/rules/hatch3r-iteration-summary.md +2 -0
  75. package/rules/hatch3r-iteration-summary.mdc +2 -0
  76. package/rules/hatch3r-migrations.md +61 -16
  77. package/rules/hatch3r-migrations.mdc +61 -16
  78. package/rules/hatch3r-observability-logging.md +1 -1
  79. package/rules/hatch3r-observability-logging.mdc +1 -1
  80. package/rules/hatch3r-observability-metrics.md +1 -1
  81. package/rules/hatch3r-observability-metrics.mdc +1 -1
  82. package/rules/hatch3r-observability-tracing-detail.md +1 -1
  83. package/rules/hatch3r-observability-tracing-detail.mdc +1 -1
  84. package/rules/hatch3r-observability-tracing.md +1 -1
  85. package/rules/hatch3r-observability-tracing.mdc +1 -1
  86. package/rules/hatch3r-observability.md +1 -0
  87. package/rules/hatch3r-observability.mdc +1 -0
  88. package/rules/hatch3r-operability.md +149 -0
  89. package/rules/hatch3r-operability.mdc +145 -0
  90. package/rules/hatch3r-passkey-server.md +181 -0
  91. package/rules/hatch3r-passkey-server.mdc +177 -0
  92. package/rules/hatch3r-progressive-delivery.md +120 -0
  93. package/rules/hatch3r-progressive-delivery.mdc +116 -0
  94. package/rules/hatch3r-resilience-patterns.md +154 -0
  95. package/rules/hatch3r-resilience-patterns.mdc +150 -0
  96. package/rules/hatch3r-secrets-management.md +29 -0
  97. package/rules/hatch3r-secrets-management.mdc +29 -0
  98. package/rules/hatch3r-testing.md +139 -43
  99. package/rules/hatch3r-testing.mdc +139 -43
  100. package/rules/hatch3r-ux-states-and-flows.md +149 -0
  101. package/rules/hatch3r-ux-states-and-flows.mdc +145 -0
  102. package/skills/hatch3r-a11y-audit/SKILL.md +14 -0
  103. package/skills/hatch3r-ai-feature/SKILL.md +134 -0
  104. package/skills/hatch3r-api-spec/SKILL.md +5 -0
  105. package/skills/hatch3r-architecture-review/SKILL.md +14 -0
  106. package/skills/hatch3r-bug-fix/SKILL.md +5 -0
  107. package/skills/hatch3r-ci-pipeline/SKILL.md +14 -0
  108. package/skills/hatch3r-cli-aichat/SKILL.md +84 -0
  109. package/skills/hatch3r-cli-ast-grep/SKILL.md +85 -0
  110. package/skills/hatch3r-cli-az-devops/SKILL.md +89 -0
  111. package/skills/hatch3r-cli-bat/SKILL.md +85 -0
  112. package/skills/hatch3r-cli-comby/SKILL.md +85 -0
  113. package/skills/hatch3r-cli-csvkit/SKILL.md +84 -0
  114. package/skills/hatch3r-cli-delta/SKILL.md +86 -0
  115. package/skills/hatch3r-cli-difftastic/SKILL.md +84 -0
  116. package/skills/hatch3r-cli-docker/SKILL.md +89 -0
  117. package/skills/hatch3r-cli-duckdb/SKILL.md +84 -0
  118. package/skills/hatch3r-cli-fd/SKILL.md +85 -0
  119. package/skills/hatch3r-cli-fzf/SKILL.md +84 -0
  120. package/skills/hatch3r-cli-gh/SKILL.md +90 -0
  121. package/skills/hatch3r-cli-glab/SKILL.md +89 -0
  122. package/skills/hatch3r-cli-jq/SKILL.md +85 -0
  123. package/skills/hatch3r-cli-lazygit/SKILL.md +78 -0
  124. package/skills/hatch3r-cli-llm/SKILL.md +84 -0
  125. package/skills/hatch3r-cli-miller/SKILL.md +84 -0
  126. package/skills/hatch3r-cli-mods/SKILL.md +84 -0
  127. package/skills/hatch3r-cli-overview/SKILL.md +60 -0
  128. package/skills/hatch3r-cli-playwright/SKILL.md +89 -0
  129. package/skills/hatch3r-cli-podman/SKILL.md +84 -0
  130. package/skills/hatch3r-cli-ripgrep/SKILL.md +85 -0
  131. package/skills/hatch3r-cli-rtk/SKILL.md +91 -0
  132. package/skills/hatch3r-cli-sd/SKILL.md +85 -0
  133. package/skills/hatch3r-cli-stagehand/SKILL.md +79 -0
  134. package/skills/hatch3r-cli-taplo/SKILL.md +84 -0
  135. package/skills/hatch3r-cli-xsv/SKILL.md +89 -0
  136. package/skills/hatch3r-cli-yq/SKILL.md +85 -0
  137. package/skills/hatch3r-cli-zstd/SKILL.md +85 -0
  138. package/skills/hatch3r-context-health/SKILL.md +14 -0
  139. package/skills/hatch3r-cost-tracking/SKILL.md +14 -0
  140. package/skills/hatch3r-customize/SKILL.md +14 -0
  141. package/skills/hatch3r-dep-audit/SKILL.md +14 -0
  142. package/skills/hatch3r-design-system-detect/SKILL.md +162 -0
  143. package/skills/hatch3r-feature/SKILL.md +2 -0
  144. package/skills/hatch3r-gh-agentic-workflows/SKILL.md +13 -0
  145. package/skills/hatch3r-handoff-prepare/SKILL.md +160 -0
  146. package/skills/hatch3r-handoff-resume/SKILL.md +171 -0
  147. package/skills/hatch3r-incident-response/SKILL.md +14 -0
  148. package/skills/hatch3r-issue-workflow/SKILL.md +5 -0
  149. package/skills/hatch3r-logical-refactor/SKILL.md +14 -0
  150. package/skills/hatch3r-migration/SKILL.md +14 -0
  151. package/skills/hatch3r-observability-verify/SKILL.md +133 -0
  152. package/skills/hatch3r-perf-audit/SKILL.md +14 -0
  153. package/skills/hatch3r-pr-creation/SKILL.md +14 -0
  154. package/skills/hatch3r-qa-validation/SKILL.md +18 -0
  155. package/skills/hatch3r-recipe/SKILL.md +14 -0
  156. package/skills/hatch3r-refactor/SKILL.md +14 -0
  157. package/skills/hatch3r-release/SKILL.md +14 -0
  158. package/skills/hatch3r-reliability-verify/SKILL.md +144 -0
  159. package/skills/hatch3r-ui-ux-verify/SKILL.md +136 -0
  160. package/skills/hatch3r-visual-refactor/SKILL.md +15 -1
@@ -0,0 +1,95 @@
1
+ ---
2
+ id: shared-user-question-protocol
3
+ type: reference
4
+ description: Protocol for how hatch3r agents and commands ask the user clarifying questions — when to ask, native-tool preference, and a plain-text fallback shape.
5
+ tags: [shared, ux, p1, p4]
6
+ cache_friendly: true
7
+ ---
8
+
9
+ ## Purpose
10
+
11
+ This protocol defines how hatch3r agents and commands surface clarifying or triage questions to the user across the 15 supported AI coding platforms. It is the single source of truth for the *how* of asking; the *whether* is governed by [quality-charter §3 "Question Unclear Requirements"](./quality-charter.md) and §8 "Escalate Ambiguity Early". Files that reference this protocol: the requirements-elicitation mode (`agents/modes/requirements-elicitation.md`), the five ASK-checkpoint commands, and the four ask-prone agents — researcher, fixer, architect, implementer.
12
+
13
+ ## When To Ask
14
+
15
+ - **Ambiguous requirement** — the request maps to two or more reasonable interpretations that produce different code.
16
+ - **Irreversible decision** — deleting data, renaming a public API, dropping a column, force-pushing a branch.
17
+ - **Branching path** — two or more viable approaches with materially different cost, scope, or risk.
18
+ - **Conflicting constraints** — requirements that cannot all hold (e.g., "no new dependencies" and "use library X").
19
+ - **Missing acceptance criteria** — no testable definition of done for the requested change.
20
+
21
+ ## When NOT To Ask
22
+
23
+ - The user already decided scope in this turn or an earlier turn of the same session.
24
+ - You are in free-text discussion, planning, or a status update — questions belong inside actionable workflows.
25
+ - The answer is verifiable by reading code, running a test, or grepping the repo — verify first, ask only if verification fails.
26
+ - The choice is reversible, low-stakes, and the safer default is obvious — pick the default and note it.
27
+
28
+ ## How To Ask
29
+
30
+ 1. Check whether your target platform exposes a native question or triage tool (see Platform-Native Tool below).
31
+ 2. If yes, use the native tool — it produces better UX than free-text replies and is structured for the host runtime.
32
+ 3. If no native tool exists on this platform, use the Plain-Text Fallback Template.
33
+ 4. Ask at most one question per turn. Bundle related sub-questions into a single multiple-choice prompt rather than firing multiple turns.
34
+
35
+ ## Platform-Native Tool
36
+
37
+ The marker below is replaced at canonical-write time with the enumeration table generated from `src/pipeline/adapterToolTranslator.ts::ASK_USER_TOOLS`. Look up your runtime platform and follow its row. If your platform's row reads "No documented native tool", use the Plain-Text Fallback Template defined in the next section.
38
+
39
+ <!-- HATCH3R:PLATFORM-TOOL -->
40
+
41
+ When viewing this file in the source repo (pre-generation), the marker is unsubstituted — refer to the adapter map in `src/pipeline/adapterToolTranslator.ts` for the same mappings.
42
+
43
+ ## Plain-Text Fallback Template
44
+
45
+ Use this exact shape when no native tool is available:
46
+
47
+ ```
48
+ **Question:** <one-sentence question stating the choice>
49
+
50
+ 1. <Option A> — <one-line rationale or trade-off>
51
+ 2. <Option B> — <one-line rationale or trade-off>
52
+ 3. <Option C> — <one-line rationale or trade-off>
53
+
54
+ Default if no response: <option number, e.g., 2>
55
+ ```
56
+
57
+ Rules for the template:
58
+
59
+ - Two to four numbered options. One option is too few; five or more signals you have not narrowed the design.
60
+ - Each option carries a one-line trade-off so the user can pick without re-deriving the problem.
61
+ - The default-if-no-response line is mandatory — it removes the deadlock when the user is away or replies "you decide".
62
+ - The default option is the safest reversible choice, not the most ambitious one.
63
+
64
+ ## Examples
65
+
66
+ **Example 1 — Ambiguous requirement.** Request: "Add caching to the user profile endpoint."
67
+
68
+ ```
69
+ **Question:** Which cache scope matches your needs for the profile endpoint?
70
+
71
+ 1. Per-user, 60s TTL — fastest response, stale data tolerated up to 60s.
72
+ 2. Per-user, write-through invalidation — fresh data, +1 cache write per profile update.
73
+ 3. Edge cache only — no app changes, but TTL is fixed by the CDN config.
74
+
75
+ Default if no response: 2
76
+ ```
77
+
78
+ **Example 2 — Branching path.** Request: "Migrate the build to Vite."
79
+
80
+ ```
81
+ **Question:** Should the Vite migration land in one PR or staged behind a feature flag?
82
+
83
+ 1. Single PR — shorter total time, larger blast radius if a regression ships.
84
+ 2. Staged with VITE_BUILD flag — two PRs, lets you A/B locally before flipping.
85
+
86
+ Default if no response: 2
87
+ ```
88
+
89
+ ## Anti-Patterns
90
+
91
+ - **Multi-question barrage** — asking five questions in one turn. Ask the highest-leverage one first; the answer often collapses the rest.
92
+ - **Options-free questions** — "What should I do?" forces the user to design the prompt. Always supply 2–4 candidate options with trade-offs.
93
+ - **Silent assumption** — proceeding when ambiguity is real. Apply quality-charter §8: log the ambiguity in structured output even if you decide to proceed under a default.
94
+ - **Echo-as-question** — restating the user's request back as a question ("So you want me to add caching?"). Confirm only when you have a specific decision point with options to offer.
95
+ - **Inflated default** — choosing the most disruptive option as the no-response default. Defaults must be the reversible, lowest-blast-radius choice.
@@ -156,6 +156,8 @@ After linking, verify via `az boards work-item relation list --id {epic}` and ch
156
156
  | Add comments | `az boards work-item update --id N --discussion "..."` | N/A |
157
157
  | Create PRs | `az repos pr create --title "..." --source-branch "..." --target-branch "..."` | `create_pull_request` |
158
158
  | Read PR details | `az repos pr show --id N` | N/A |
159
+ | Read PR comment threads | `az rest -m GET --url 'https://dev.azure.com/{org}/{project}/_apis/git/repositories/{repo}/pullRequests/{N}/threads?api-version=7.1-preview.1'` | N/A |
160
+ | Reply to PR thread | `az rest -m POST --url '.../pullRequests/{N}/threads/{threadId}/comments?api-version=7.1-preview.1' --body '{"parentCommentId":1,"content":"...","commentType":"text"}'` | N/A |
159
161
  | Manage tags | `az boards work-item update --id N --fields "System.Tags=tag1; tag2"` | N/A |
160
162
  | Board sync | Work Item State updates (automatic board placement) | N/A |
161
163
  | CI/Pipelines | `az pipelines run list` / `az pipelines run show` | N/A |
@@ -166,9 +166,26 @@ After linking, verify via `issue_read` with `method: get_sub_issues` on the pare
166
166
  | Add comments | `gh issue comment` | `add_issue_comment` |
167
167
  | Create PRs | `gh pr create` | `create_pull_request` |
168
168
  | Read PR details | `gh pr view` | `pull_request_read` |
169
+ | Read PR inline comments | `gh api repos/{owner}/{repo}/pulls/{N}/comments --paginate` | `pull_request_read` |
170
+ | Read PR review summaries | `gh api repos/{owner}/{repo}/pulls/{N}/reviews --paginate` | `pull_request_read` |
171
+ | Read PR discussion | `gh api repos/{owner}/{repo}/issues/{N}/comments --paginate` | `pull_request_read` |
172
+ | Read PR thread resolution | `gh api graphql -f query='{repository(owner:"o",name:"r"){pullRequest(number:N){reviewThreads(first:100){nodes{id,isResolved}}}}}'` | N/A |
173
+ | Reply to inline comment | `gh api repos/{owner}/{repo}/pulls/{N}/comments -X POST -F in_reply_to={comment_id} -f body=@{file}` | N/A |
174
+ | Comment on PR thread | `gh api repos/{owner}/{repo}/issues/{N}/comments -X POST -f body=@{file}` | `add_issue_comment` |
169
175
  | Manage labels | `gh label create` / `gh label list` | `issue_write` (with labels) |
170
176
  | 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` |
171
177
  | CI/Actions | `gh run list` / `gh run view` | N/A |
172
178
  | Releases | `gh release create` | N/A |
173
179
 
174
180
  Fallback to MCP only for operations the `gh` CLI cannot handle: sub-issue management (`sub_issue_write`).
181
+
182
+ ### GitHub CLI Field-Typing Notes
183
+
184
+ `gh api` field flags differ by type. Pass the wrong one and the GitHub REST API returns `HTTP 422: not of type {integer|boolean}`.
185
+
186
+ | Flag | Type sent | Use for |
187
+ |------|-----------|---------|
188
+ | `-f key=value` | string (URL-encoded form) | `body`, `title`, `commit_message`, `query`, `state`, `event` |
189
+ | `-F key=value` | integer / boolean (auto-typed) — also `@file` for file contents | numeric IDs: `sub_issue_id`, `in_reply_to`, `parent_issue_id`, `issue_number`, `pull_number`, `team_id`, `user_id`, `milestone_number`; booleans: `draft`, `merged`, `auto_merge` |
190
+
191
+ Sub-issue linking via `POST /repos/{owner}/{repo}/issues/{N}/sub_issues` requires `-F sub_issue_id={child_numeric_id}` — `-f` returns 422. When the `sub_issue_write` MCP is unavailable, write the hand-rolled `gh api` call with `-F`, never `-f`. The same rule applies to PR review-reply (`in_reply_to`), milestone assignment (`milestone_number`), and team membership (`team_id` / `user_id`).
@@ -146,6 +146,10 @@ After linking, verify via `glab api projects/{project_id}/issues/{epic_iid}/link
146
146
  | Add comments | `glab issue note N -R {namespace}/{project}` | N/A |
147
147
  | Create MRs | `glab mr create -R {namespace}/{project}` | N/A |
148
148
  | Read MR details | `glab mr view N -R {namespace}/{project}` | N/A |
149
+ | Read MR discussions | `glab api '/projects/{project_id}/merge_requests/{iid}/discussions?per_page=100' --paginate` | N/A |
150
+ | Read MR notes | `glab api '/projects/{project_id}/merge_requests/{iid}/notes?per_page=100' --paginate` | N/A |
151
+ | Reply to discussion | `glab api '/projects/{project_id}/merge_requests/{iid}/discussions/{discussion_id}/notes' -X POST -f body=@{file}` | N/A |
152
+ | Add MR note | `glab api '/projects/{project_id}/merge_requests/{iid}/notes' -X POST -f body=@{file}` | N/A |
149
153
  | Manage labels | `glab label create` / `glab label list` | N/A |
150
154
  | Board sync | Label updates (automatic board list placement) | N/A |
151
155
  | CI/Pipelines | `glab ci list` / `glab ci view` | N/A |
@@ -55,7 +55,7 @@ Follow the **Token-Saving Directives** in `hatch3r-board-shared`.
55
55
 
56
56
  ## Workflow
57
57
 
58
- Execute these steps in order. **Do not skip any step.** Ask the user at every checkpoint marked with ASK.
58
+ Execute these steps in order. **Do not skip any step.** Ask the user at every checkpoint marked with ASK. For every ASK checkpoint, use the platform-native question tool per `agents/shared/user-question-protocol.md`.
59
59
 
60
60
  ## Step 0: Triage
61
61
 
@@ -165,6 +165,7 @@ If a product vision was loaded in Step 1a, apply these modifications to the tria
165
165
  2. **Reduce questioning.** Only ask triage questions for dimensions that the vision does not clearly address. If the vision states the target user, value proposition, and scope boundaries for an item's domain, mark those dimensions as "Clear (from vision)" and skip the corresponding questions.
166
166
  3. **Reference vision goals explicitly.** When classifying items or asking remaining triage questions, cite the specific vision goal or statement that informs the classification (e.g., "Per the product vision goal 'Zero-config onboarding', this item aligns with...").
167
167
  4. **Greenfield streamlining.** For greenfield projects where the vision covers all major work areas, batch all items into a single triage pass. Present the vision-derived context for each item and ask the user to confirm or override in one prompt rather than per-item questioning.
168
+ 5. **Tier-3 greenfield gate (P8 B2).** Vision-aware triage skips a readiness dimension ONLY when the product vision explicitly addresses it; otherwise mark the dimension `unresolved — needs user input` and ask via the platform-native question tool. If readiness gate (Step 5.6) reports unresolved external blockers, re-run triage per dimension.
168
169
 
169
170
  If no product vision is available, proceed with the full triage process below.
170
171
 
@@ -73,7 +73,7 @@ Downstream propagation: every ASK checkpoint that reports verification quality,
73
73
 
74
74
  ## Workflow
75
75
 
76
- Execute these steps in order. **Do not skip any step.** Ask the user at every checkpoint marked with ASK.
76
+ Execute these steps in order. **Do not skip any step.** Ask the user at every checkpoint marked with ASK. When asking the user how to proceed, use the platform-native question tool per `agents/shared/user-question-protocol.md`.
77
77
 
78
78
  ## Step 0: Triage
79
79
 
@@ -273,6 +273,27 @@ During **board-fill Step 4c** (external research) and **board-pickup Step 6** (i
273
273
  2. Use **web research** for novel technical challenges, current best practices, security advisories, or breaking changes not covered by Context7 or local docs.
274
274
  3. Follow the project's tooling hierarchy for knowledge augmentation priority.
275
275
 
276
+ ### Agent-Synthesized Wrapper Scripts
277
+
278
+ Board commands instruct the agent to invoke individual CLI / MCP calls; the agent harness already batches them. If the agent synthesises a wrapper shell script anyway, the script MUST be portable across the user's installed shells. macOS ships `bash 3.2` as `/bin/bash` and many users default to `zsh` — bash-4-only features fail loudly on both.
279
+
280
+ 1. **Default to individual tool calls.** Do not wrap `gh issue create`, `gh issue edit`, `gh project item-add`, `az boards work-item create`, or `glab issue create` loops in a synthesised bash script unless the user explicitly asks for a script artifact. The harness's parallel tool dispatch is cheaper than spawning a sub-shell and avoids the portability problem entirely.
281
+ 2. **If a wrapper is required, target `bash 3.2` (macOS system default).** Banned constructs: `declare -A` (associative arrays), `${!ARR[@]}` (associative-array key expansion), `mapfile`, `readarray`. Use parallel indexed arrays (`KEYS=()`, `VALUES=()`) with integer indices, or rewrite the batching logic in Python / Node. `zsh` is not a drop-in substitute — `${!ARR[@]}` semantics differ; `bad substitution` is the symptom.
282
+ 3. **Pin the shell explicitly.** Start every synthesised script with `#!/usr/bin/env bash` and guard any bash-4+ feature behind `[[ ${BASH_VERSINFO[0]} -ge 4 ]] || { echo "bash 4+ required, found ${BASH_VERSION}"; exit 64; }` so the failure mode is loud, not silent.
283
+
284
+ ### Pager-Bypass Directive
285
+
286
+ Every `gh api`, `gh pr view`, `gh issue view`, `gh project item-list`, `az pipelines run`, and `glab api` invocation from an agent-driven terminal MUST run with `GH_PAGER=cat` and `PAGER=cat` set. The default GitHub CLI pager (`less`) opens the alternate screen buffer, which returns empty captured output in non-TTY contexts — the call appears to succeed but its `--jq` output is lost. Piping to `| cat` does not bypass the alternate-buffer behaviour; the environment variables are the only reliable workaround.
287
+
288
+ Set once at the start of every board / PR command run, before the first CLI invocation:
289
+
290
+ ```bash
291
+ export GH_PAGER=cat
292
+ export PAGER=cat
293
+ ```
294
+
295
+ The export is idempotent and safe to re-set. `GH_PAGER` is scoped to `gh`; `PAGER` covers downstream `git`, `az`, or `glab` invocations. This directive applies to every command in this directory tree.
296
+
276
297
  ---
277
298
 
278
299
  ## Formatting Rules
@@ -106,6 +106,8 @@ Branch on the cached `type`:
106
106
 
107
107
  Render the proposed file path, full frontmatter block, and body-skeleton outline. For an agent plan, the summary lists `Path`, `Type`, `Name`, `Description` (first 80 chars), `Tags`, `Adapters` (or "all enabled"), `Model`; then the frontmatter block; then the body-skeleton outline (`<task>`, `<context>`, Implementation Protocol numbered steps, `<rules>`). For other types, swap the type-specific slots from Step 1.6.
108
108
 
109
+ **Scope-boundary check (P8 B2).** Confirm proposed scope and tool-allowlist before Phase 2 delegation. Artifact scope cannot be broadened via markdown injection post-creation. Reject any user-supplied edit that expands the tool allowlist, target file globs, or pipeline references beyond what was confirmed here; route such expansions through a fresh `/h4tcher-create` invocation.
110
+
109
111
  **ASK:** "Confirm to delegate authoring to `hatch3r-creator`, or specify changes (e.g., 'change model to fast', 'add tag: review')."
110
112
 
111
113
  Loop until the user confirms.
@@ -0,0 +1,126 @@
1
+ ---
2
+ id: hatch3r-handoff
3
+ type: command
4
+ orchestrator: true
5
+ agentPipeline: [hatch3r-handoff-preparer]
6
+ description: Prepare, resume, list, complete, and prune cross-session handoff documents.
7
+ tags: [core, maintenance]
8
+ quality_charter: agents/shared/quality-charter.md
9
+ efficiency_patterns: agents/shared/efficiency-patterns.md
10
+ cache_friendly: true
11
+ parallel_tool_default: true
12
+ triage_tiers: [1, 2]
13
+ ---
14
+
15
+ ## Agent Pipeline
16
+
17
+ The `prepare` subcommand delegates to `hatch3r-handoff-preparer` via the Task tool. The other four subcommands (`resume`, `list`, `complete`, `prune`) run inline within this command — they read, list, transition status, or archive files and do not require a sub-agent.
18
+
19
+ ## Learnings Consultation
20
+
21
+ Before starting, scan `.agents/learnings/` for entries tagged `handoff`, `context-switch`, `resume`, or `session-state`. Apply the protocol in `rules/hatch3r-learning-consult.md` (frontmatter-first scan; surface top 5 by confidence). Skip if the directory has fewer than 3 files.
22
+
23
+ # Handoff Management — Cross-Session Work Continuity
24
+
25
+ Manage canonical handoff documents at `.agents/handoffs/active/` for mid-work state capture and resumption across sessions, tools, or developers.
26
+
27
+ ---
28
+
29
+ ## Step 0: Triage
30
+
31
+ Classify the handoff request by subcommand and operation size before routing:
32
+
33
+ - **Tier 1 (trivial)**: `list`, `complete`, `prune --dry-run`. Filesystem-read or single-file rename; no body composition, no validation gate, no sub-agent. Run inline.
34
+ - **Tier 2 (standard)**: `prepare`, `resume`, `prune` (non-dry-run). Body composition with readiness gate (`prepare`), drift check + status transition (`resume`), or batch archival (`prune`). `prepare` delegates to `hatch3r-handoff-preparer` via the Task tool; the others run inline.
35
+
36
+ There is no Tier 3 for this command — multi-issue or epic-scale handoffs are out of scope; the caller decomposes into per-work-item handoffs upstream.
37
+
38
+ ## Workflow
39
+
40
+ Execute these steps in order. **Do not skip any step.** Ask the user at every checkpoint marked with **ASK**.
41
+
42
+ ### Step 1: Detect Subcommand
43
+
44
+ Read the first positional argument and route to the matching subcommand. If absent or unrecognized:
45
+
46
+ **ASK:** "Which handoff action? `prepare | resume | list | complete | prune`."
47
+
48
+ ### Step 2: Route
49
+
50
+ | Subcommand | Semantics |
51
+ |------------|-----------|
52
+ | `prepare` | Capture current session state into a new handoff document |
53
+ | `resume` | Load and surface a previously-prepared handoff for continuation |
54
+ | `list` | Show active (and optionally archived) handoffs in a table |
55
+ | `complete`| Transition a handoff to `completed` and move to `archived/` |
56
+ | `prune` | Archive expired actives and prune archives older than 90 days |
57
+
58
+ ---
59
+
60
+ ## Subcommand: prepare
61
+
62
+ 1. Parse optional flags: `--work-item <ref>` (e.g. `gh:owner/repo#42`, `ado:org/project:work-item/123`, `gl:owner/repo!42`), `--summary "<text>"`.
63
+ 2. Invoke `hatch3r-handoff-preparer` via the Task tool. Pass `work_item` and `summary` if provided.
64
+ 3. The preparer returns the written path plus an Iteration Summary block. Surface both to the user.
65
+
66
+ **ASK** (before invocation): "Capturing handoff for {current branch}. Confirm or specify `--work-item` / `--summary`."
67
+
68
+ ## Subcommand: resume
69
+
70
+ 1. Parse optional `<id>` positional. If provided, route directly to `skills/hatch3r-handoff-resume` with that id.
71
+ 2. If `<id>` absent, call `listHandoffs({ status: ["open","in-progress","blocked","handed-off"] })` from `src/content/handoffs/index.ts` and present a numbered table (id, status, branch, summary, updated).
72
+
73
+ **ASK:** "Which handoff to resume? (number, or `cancel`)"
74
+
75
+ 3. Invoke `skills/hatch3r-handoff-resume` with the chosen id. The skill performs validation, drift check, and status transition.
76
+
77
+ ## Subcommand: list
78
+
79
+ 1. Parse flags: `--status <status>`, `--work-item <ref>`, `--include-archived`.
80
+ 2. Call `listHandoffs(filter)` and render:
81
+
82
+ ```
83
+ ID STATUS BRANCH SUMMARY UPDATED
84
+ 2026-05-17_T1430_a3f2c_issue-42-cache-refactor in-progress feat/cache-refactor Token caching for board-fill researcher 2026-05-17 14:30
85
+ ```
86
+
87
+ 3. If empty, display: `No active handoffs. Run 'hatch3r-handoff prepare' to capture one.`
88
+
89
+ ## Subcommand: complete
90
+
91
+ 1. Parse positional `<id>` (required). If absent, **ASK** the user to pick from `list`.
92
+ 2. Read the handoff via `readHandoff(id)`. Display the `summary` and `Work Remaining` section.
93
+ 3. Parse optional `--reason "<text>"` for the archival notice.
94
+
95
+ **ASK:** "Mark `{id}` completed and archive? (y/N). Reason will be recorded: `{reason or 'no reason given'}`."
96
+
97
+ 4. On confirm: transition `status` to `completed`, stamp `updated` to now, prepend the archival notice (mirrors learnings archival format), then atomic-rename to `.agents/handoffs/archived/<id>.md`.
98
+
99
+ ## Subcommand: prune
100
+
101
+ 1. Parse `--dry-run` flag.
102
+ 2. Scan `.agents/handoffs/active/`: collect entries whose `expires_after` ISO-8601 timestamp is at-or-before now (preparer default stamps `created + 30 days`).
103
+ 3. Scan `.agents/handoffs/archived/`: collect entries where `updated` is older than 90 days.
104
+ 4. Present a two-section preview (Active expirations to archive, Archives to delete).
105
+ 5. If `--dry-run`: print the preview and exit.
106
+
107
+ **ASK:** "Proceed with prune? Will archive {n} active and delete {m} archived. (y/N)"
108
+
109
+ 6. On confirm: archive each expired active (prepend `Expired on {date}` notice, move to `archived/`); delete each over-90-day archive.
110
+
111
+ ---
112
+
113
+ ## Error Handling
114
+
115
+ - `.agents/handoffs/active/` missing or empty: emit `No active handoffs. Run 'hatch3r-handoff prepare' to capture one.` and exit 0.
116
+ - Ambiguous `<id>` (multiple partial matches): list the matches and **ASK** the user to pick one.
117
+ - Write conflict (concurrent prepare for same `work_item`): surface the existing handoff path and **ASK** whether to overwrite (only if existing handoff is older than 24 hours per `writeHandoff` policy).
118
+ - `complete` or `prune` requested on a missing id: report the path that was looked up and suggest `hatch3r-handoff list`.
119
+
120
+ ## Guardrails
121
+
122
+ - **Never delete** a handoff without explicit user confirmation. Prune deletes only archives older than 90 days, and only after the confirm prompt.
123
+ - **Never modify** a file already in `.agents/handoffs/archived/`. Archived entries are immutable history.
124
+ - **Never include secrets** (API keys, tokens, credentials) in any handoff body. The preparer scans for credential-shaped strings; reject the write if any are detected.
125
+ - **Never write** outside `.agents/handoffs/active/` for new handoffs. Archival is the only path into `archived/`.
126
+ - **Always emit the Iteration Summary block** at the end of the iteration per `rules/hatch3r-iteration-summary.md`.