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.
- package/LICENSE +21 -0
- package/README.md +437 -0
- package/agents/hatch3r-a11y-auditor.md +126 -0
- package/agents/hatch3r-architect.md +160 -0
- package/agents/hatch3r-ci-watcher.md +123 -0
- package/agents/hatch3r-context-rules.md +97 -0
- package/agents/hatch3r-dependency-auditor.md +164 -0
- package/agents/hatch3r-devops.md +138 -0
- package/agents/hatch3r-docs-writer.md +97 -0
- package/agents/hatch3r-implementer.md +162 -0
- package/agents/hatch3r-learnings-loader.md +108 -0
- package/agents/hatch3r-lint-fixer.md +104 -0
- package/agents/hatch3r-perf-profiler.md +123 -0
- package/agents/hatch3r-researcher.md +642 -0
- package/agents/hatch3r-reviewer.md +81 -0
- package/agents/hatch3r-security-auditor.md +119 -0
- package/agents/hatch3r-test-writer.md +134 -0
- package/commands/hatch3r-agent-customize.md +146 -0
- package/commands/hatch3r-api-spec.md +49 -0
- package/commands/hatch3r-benchmark.md +50 -0
- package/commands/hatch3r-board-fill.md +504 -0
- package/commands/hatch3r-board-init.md +315 -0
- package/commands/hatch3r-board-pickup.md +672 -0
- package/commands/hatch3r-board-refresh.md +198 -0
- package/commands/hatch3r-board-shared.md +369 -0
- package/commands/hatch3r-bug-plan.md +410 -0
- package/commands/hatch3r-codebase-map.md +1182 -0
- package/commands/hatch3r-command-customize.md +94 -0
- package/commands/hatch3r-context-health.md +112 -0
- package/commands/hatch3r-cost-tracking.md +139 -0
- package/commands/hatch3r-dep-audit.md +171 -0
- package/commands/hatch3r-feature-plan.md +379 -0
- package/commands/hatch3r-healthcheck.md +307 -0
- package/commands/hatch3r-hooks.md +282 -0
- package/commands/hatch3r-learn.md +217 -0
- package/commands/hatch3r-migration-plan.md +51 -0
- package/commands/hatch3r-onboard.md +56 -0
- package/commands/hatch3r-project-spec.md +1153 -0
- package/commands/hatch3r-recipe.md +179 -0
- package/commands/hatch3r-refactor-plan.md +426 -0
- package/commands/hatch3r-release.md +328 -0
- package/commands/hatch3r-roadmap.md +556 -0
- package/commands/hatch3r-rule-customize.md +114 -0
- package/commands/hatch3r-security-audit.md +370 -0
- package/commands/hatch3r-skill-customize.md +93 -0
- package/commands/hatch3r-workflow.md +377 -0
- package/dist/cli/hooks-ZOTFDEA3.js +59 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +3584 -0
- package/github-agents/hatch3r-docs-agent.md +46 -0
- package/github-agents/hatch3r-lint-agent.md +41 -0
- package/github-agents/hatch3r-security-agent.md +54 -0
- package/github-agents/hatch3r-test-agent.md +66 -0
- package/hooks/hatch3r-ci-failure.md +10 -0
- package/hooks/hatch3r-file-save.md +11 -0
- package/hooks/hatch3r-post-merge.md +10 -0
- package/hooks/hatch3r-pre-commit.md +11 -0
- package/hooks/hatch3r-pre-push.md +10 -0
- package/hooks/hatch3r-session-start.md +10 -0
- package/mcp/mcp.json +62 -0
- package/package.json +84 -0
- package/prompts/hatch3r-bug-triage.md +155 -0
- package/prompts/hatch3r-code-review.md +131 -0
- package/prompts/hatch3r-pr-description.md +173 -0
- package/rules/hatch3r-accessibility-standards.md +77 -0
- package/rules/hatch3r-accessibility-standards.mdc +75 -0
- package/rules/hatch3r-agent-orchestration.md +160 -0
- package/rules/hatch3r-api-design.md +176 -0
- package/rules/hatch3r-api-design.mdc +176 -0
- package/rules/hatch3r-browser-verification.md +73 -0
- package/rules/hatch3r-browser-verification.mdc +73 -0
- package/rules/hatch3r-ci-cd.md +70 -0
- package/rules/hatch3r-ci-cd.mdc +68 -0
- package/rules/hatch3r-code-standards.md +102 -0
- package/rules/hatch3r-code-standards.mdc +100 -0
- package/rules/hatch3r-component-conventions.md +102 -0
- package/rules/hatch3r-component-conventions.mdc +102 -0
- package/rules/hatch3r-data-classification.md +85 -0
- package/rules/hatch3r-data-classification.mdc +83 -0
- package/rules/hatch3r-dependency-management.md +17 -0
- package/rules/hatch3r-dependency-management.mdc +15 -0
- package/rules/hatch3r-error-handling.md +17 -0
- package/rules/hatch3r-error-handling.mdc +15 -0
- package/rules/hatch3r-feature-flags.md +112 -0
- package/rules/hatch3r-feature-flags.mdc +112 -0
- package/rules/hatch3r-git-conventions.md +47 -0
- package/rules/hatch3r-git-conventions.mdc +45 -0
- package/rules/hatch3r-i18n.md +90 -0
- package/rules/hatch3r-i18n.mdc +90 -0
- package/rules/hatch3r-learning-consult.md +29 -0
- package/rules/hatch3r-learning-consult.mdc +27 -0
- package/rules/hatch3r-migrations.md +17 -0
- package/rules/hatch3r-migrations.mdc +15 -0
- package/rules/hatch3r-observability.md +165 -0
- package/rules/hatch3r-observability.mdc +165 -0
- package/rules/hatch3r-performance-budgets.md +109 -0
- package/rules/hatch3r-performance-budgets.mdc +109 -0
- package/rules/hatch3r-secrets-management.md +76 -0
- package/rules/hatch3r-secrets-management.mdc +74 -0
- package/rules/hatch3r-security-patterns.md +211 -0
- package/rules/hatch3r-security-patterns.mdc +211 -0
- package/rules/hatch3r-testing.md +89 -0
- package/rules/hatch3r-testing.mdc +87 -0
- package/rules/hatch3r-theming.md +51 -0
- package/rules/hatch3r-theming.mdc +51 -0
- package/rules/hatch3r-tooling-hierarchy.md +92 -0
- package/rules/hatch3r-tooling-hierarchy.mdc +79 -0
- package/skills/hatch3r-a11y-audit/SKILL.md +131 -0
- package/skills/hatch3r-agent-customize/SKILL.md +75 -0
- package/skills/hatch3r-api-spec/SKILL.md +66 -0
- package/skills/hatch3r-architecture-review/SKILL.md +96 -0
- package/skills/hatch3r-bug-fix/SKILL.md +129 -0
- package/skills/hatch3r-ci-pipeline/SKILL.md +76 -0
- package/skills/hatch3r-command-customize/SKILL.md +67 -0
- package/skills/hatch3r-context-health/SKILL.md +76 -0
- package/skills/hatch3r-cost-tracking/SKILL.md +65 -0
- package/skills/hatch3r-dep-audit/SKILL.md +82 -0
- package/skills/hatch3r-feature/SKILL.md +129 -0
- package/skills/hatch3r-gh-agentic-workflows/SKILL.md +150 -0
- package/skills/hatch3r-incident-response/SKILL.md +86 -0
- package/skills/hatch3r-issue-workflow/SKILL.md +139 -0
- package/skills/hatch3r-logical-refactor/SKILL.md +73 -0
- package/skills/hatch3r-migration/SKILL.md +76 -0
- package/skills/hatch3r-perf-audit/SKILL.md +114 -0
- package/skills/hatch3r-pr-creation/SKILL.md +85 -0
- package/skills/hatch3r-qa-validation/SKILL.md +86 -0
- package/skills/hatch3r-recipe/SKILL.md +67 -0
- package/skills/hatch3r-refactor/SKILL.md +86 -0
- package/skills/hatch3r-release/SKILL.md +93 -0
- package/skills/hatch3r-rule-customize/SKILL.md +70 -0
- package/skills/hatch3r-skill-customize/SKILL.md +67 -0
- package/skills/hatch3r-visual-refactor/SKILL.md +89 -0
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: hatch3r-bug-plan
|
|
3
|
+
type: command
|
|
4
|
+
description: Plan a complex bug investigation -- spawn parallel researchers, produce diagnosis report with ranked hypotheses and structured todo.md entries for board-fill.
|
|
5
|
+
---
|
|
6
|
+
# Bug Plan — Complex Bug Investigation from Symptom to Board-Ready Fix Items
|
|
7
|
+
|
|
8
|
+
Take a complex or ambiguous bug report and produce a structured investigation report (`docs/investigations/`), architectural decision records (`docs/adr/`) when the fix requires significant design choices, and structured `todo.md` entries (scoped fix items) ready for `hatch3r-board-fill`. Spawns parallel researcher sub-agents (symptom tracing, root cause investigation, impact assessment, regression research) to diagnose the bug from multiple angles before generating artifacts. AI proposes all outputs; user confirms before any files are written. Optionally chains into `hatch3r-board-fill` to create GitHub issues immediately.
|
|
9
|
+
|
|
10
|
+
**When to use this command vs. the `hatch3r-bug-fix` skill:**
|
|
11
|
+
|
|
12
|
+
- Use `hatch3r-bug-plan` when: root cause is unknown, multiple modules might be involved, reproducing is non-trivial, the bug has been lingering, or the fix may require phased work across multiple PRs.
|
|
13
|
+
- Use `hatch3r-bug-fix` skill directly when: root cause is clear, fix is localized, reproduction steps exist.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Shared Context
|
|
18
|
+
|
|
19
|
+
**Read the `hatch3r-board-shared` command at the start of the run** if it exists. While this command does not perform board operations directly, it establishes patterns and context (GitHub owner/repo, tooling directives) that downstream commands like `hatch3r-board-fill` rely on. Cache any values found.
|
|
20
|
+
|
|
21
|
+
## Token-Saving Directives
|
|
22
|
+
|
|
23
|
+
1. **Do not re-read files already cached.** Once researcher outputs are collected, reference them in memory — do not re-invoke sub-agents.
|
|
24
|
+
2. **Limit documentation reads.** When reading existing project files for context, read TOC/headers first (~30 lines), expand only relevant sections.
|
|
25
|
+
3. **Structured output only.** All sub-agent prompts require structured markdown output — no prose dumps.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Workflow
|
|
30
|
+
|
|
31
|
+
Execute these steps in order. **Do not skip any step.** Ask the user at every checkpoint marked with ASK.
|
|
32
|
+
|
|
33
|
+
### Step 1: Gather Bug Report
|
|
34
|
+
|
|
35
|
+
1. **ASK:** "Tell me about the bug you want to investigate. I need:
|
|
36
|
+
- **Bug title** (short descriptive name)
|
|
37
|
+
- **Symptoms** (what is the user experiencing? what goes wrong?)
|
|
38
|
+
- **Expected behavior** (what should happen instead?)
|
|
39
|
+
- **Reproduction context** (when does it happen? intermittent or consistent? environment-specific?)
|
|
40
|
+
- **Severity / urgency** (how bad is this? who is affected? data loss risk?)
|
|
41
|
+
- **What has been tried** (any prior debugging attempts, hypotheses, or partial fixes?)
|
|
42
|
+
|
|
43
|
+
You can also point me to an existing GitHub issue, error log, or incident report and I'll extract these from it."
|
|
44
|
+
|
|
45
|
+
2. If the user provides a document reference, issue, or error log, read it and extract the six fields above.
|
|
46
|
+
3. Present a structured summary:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
Bug Brief:
|
|
50
|
+
Title: {title}
|
|
51
|
+
Symptoms: {what goes wrong, from the user's perspective}
|
|
52
|
+
Expected: {what should happen}
|
|
53
|
+
Reproduction: {when, how often, environment details}
|
|
54
|
+
Severity: {Critical/High/Med/Low — with impact description}
|
|
55
|
+
Prior attempts: {what has been tried, or "none"}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
**ASK:** "Does this capture the bug correctly? Adjust anything before I send this to the research phase."
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
### Step 2: Load Project Context
|
|
63
|
+
|
|
64
|
+
1. Check for existing documentation:
|
|
65
|
+
- `docs/specs/` — project specifications (read TOC/headers first, expand relevant sections only)
|
|
66
|
+
- `docs/adr/` — architectural decision records (scan for decisions relevant to the affected area)
|
|
67
|
+
- `docs/investigations/` — prior investigation reports (check for related or recurring bugs)
|
|
68
|
+
- `README.md` — project overview
|
|
69
|
+
- `/.agents/hatch.json` — board configuration
|
|
70
|
+
- Existing `todo.md` — current backlog (check for overlap or related items)
|
|
71
|
+
2. Scan GitHub issues via `search_issues` for existing work related to the bug. Note duplicates, related bugs, or prior investigations.
|
|
72
|
+
3. If `/.agents/learnings/` exists, scan for learnings relevant to the affected area. Match by area and tags against the bug brief.
|
|
73
|
+
4. Present a context summary:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
Context Loaded:
|
|
77
|
+
Specs: {N} files in docs/specs/ ({relevant ones listed})
|
|
78
|
+
ADRs: {N} files in docs/adr/ ({relevant ones listed})
|
|
79
|
+
Prior investigations: {N} in docs/investigations/ ({related ones listed})
|
|
80
|
+
Existing todo.md: {found with N items / not found}
|
|
81
|
+
Related issues: {N} open issues with overlap ({list issue numbers})
|
|
82
|
+
Learnings: {N} relevant learnings ({areas})
|
|
83
|
+
Gaps: {list any missing context}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**ASK:** "Here is the context I loaded. Provide additional context — error logs, stack traces, affected versions, environment details? (or confirm to proceed)"
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### Step 3: Spawn Parallel Researcher Sub-Agents
|
|
91
|
+
|
|
92
|
+
Spawn one sub-agent per research domain below concurrently, each following the **hatch3r-researcher agent protocol**. Each receives the confirmed bug brief from Step 1 and the context summary from Step 2.
|
|
93
|
+
|
|
94
|
+
**Each sub-agent prompt must include:**
|
|
95
|
+
- The full confirmed bug brief
|
|
96
|
+
- The project context summary from Step 2
|
|
97
|
+
- Instruction to follow the **hatch3r-researcher agent protocol**
|
|
98
|
+
- The assigned mode (one per sub-agent) and depth level `deep`
|
|
99
|
+
|
|
100
|
+
| Sub-Agent | Researcher Mode | Focus |
|
|
101
|
+
|-----------|----------------|-------|
|
|
102
|
+
| 1 | `symptom-trace` | Trace execution path from user action to failure, identify divergence point |
|
|
103
|
+
| 2 | `root-cause` | Rank hypotheses by likelihood, identify code smells, analyze dependencies |
|
|
104
|
+
| 3 | `impact-analysis` | Map blast radius, affected flows/modules, data integrity risk, related symptoms |
|
|
105
|
+
| 4 | `regression` | Analyze git history, dependency changes, identify introduction window |
|
|
106
|
+
|
|
107
|
+
Each sub-agent produces the structured output defined by its mode in the hatch3r-researcher agent specification.
|
|
108
|
+
|
|
109
|
+
Wait for all sub-agents to complete before proceeding.
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
### Step 4: Synthesize & Review Research
|
|
114
|
+
|
|
115
|
+
1. Present a **merged summary** combining key findings from all researchers:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
Investigation Summary:
|
|
119
|
+
|
|
120
|
+
Bug: {title}
|
|
121
|
+
Top hypothesis: {rank 1 from root cause investigator}
|
|
122
|
+
Confidence: {High/Med/Low}
|
|
123
|
+
Affected flows: {N} flows across {M} modules
|
|
124
|
+
Data integrity risk: {Yes — details / No}
|
|
125
|
+
Related issues: {N} potentially related ({list issue numbers})
|
|
126
|
+
Likely introduced: {time window from regression researcher}
|
|
127
|
+
Fix complexity: {S/M/L/XL — based on scope of changes needed}
|
|
128
|
+
Severity: {Critical/High/Med/Low}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
2. **Highlight conflicts** between researchers. Common conflict types:
|
|
132
|
+
- Symptom tracer points to module A, but root cause investigator's top hypothesis is in module B
|
|
133
|
+
- Impact assessor flags critical data risk, but regression researcher finds no recent changes in that area
|
|
134
|
+
- Multiple hypotheses with similar likelihood — no clear winner
|
|
135
|
+
|
|
136
|
+
3. For each conflict, present both sides and a recommended resolution.
|
|
137
|
+
|
|
138
|
+
4. Present the **ranked hypothesis list** from the root cause investigator with supporting/contradicting evidence from other researchers.
|
|
139
|
+
|
|
140
|
+
**ASK:** "Here is the merged investigation summary. Conflicts (if any) are highlighted above. Options:
|
|
141
|
+
- **Confirm** to proceed with investigation report and todo generation
|
|
142
|
+
- **Adjust** specific findings (tell me what to change)
|
|
143
|
+
- **Re-run** a specific researcher with updated parameters
|
|
144
|
+
- **Narrow scope** to focus on the top hypothesis only"
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
### Step 5: Generate Investigation Report
|
|
149
|
+
|
|
150
|
+
From the merged researcher outputs, generate an investigation report. Present all content for review before writing any files.
|
|
151
|
+
|
|
152
|
+
#### Investigation Report — `docs/investigations/{NN}_{bug-slug}.md`
|
|
153
|
+
|
|
154
|
+
Determine the next sequential number by scanning existing files in `docs/investigations/`. Use slugified bug title (lowercase, hyphens). Create the `docs/investigations/` directory if it does not exist.
|
|
155
|
+
|
|
156
|
+
```markdown
|
|
157
|
+
# Investigation: {Bug Title}
|
|
158
|
+
|
|
159
|
+
## Status
|
|
160
|
+
|
|
161
|
+
Open
|
|
162
|
+
|
|
163
|
+
## Date
|
|
164
|
+
|
|
165
|
+
{today's date}
|
|
166
|
+
|
|
167
|
+
## Bug Brief
|
|
168
|
+
|
|
169
|
+
| Field | Value |
|
|
170
|
+
|-------|-------|
|
|
171
|
+
| Title | {title} |
|
|
172
|
+
| Severity | {level} |
|
|
173
|
+
| Symptoms | {description} |
|
|
174
|
+
| Expected behavior | {description} |
|
|
175
|
+
| Reproduction | {context} |
|
|
176
|
+
| Likely introduced | {time window} |
|
|
177
|
+
|
|
178
|
+
## Executive Summary
|
|
179
|
+
|
|
180
|
+
{2-3 sentences summarizing the investigation findings, top hypothesis, and recommended fix approach}
|
|
181
|
+
|
|
182
|
+
## Symptom Trace
|
|
183
|
+
|
|
184
|
+
{From symptom tracer — execution path, divergence point, error propagation}
|
|
185
|
+
|
|
186
|
+
## Root Cause Analysis
|
|
187
|
+
|
|
188
|
+
### Hypotheses
|
|
189
|
+
|
|
190
|
+
| Rank | Hypothesis | Likelihood | Evidence | Verification |
|
|
191
|
+
|------|-----------|-----------|----------|-------------|
|
|
192
|
+
| 1 | {hypothesis} | {level} | {evidence} | {strategy} |
|
|
193
|
+
|
|
194
|
+
### Recommended Investigation Order
|
|
195
|
+
{From root cause investigator — ordered list of what to verify first}
|
|
196
|
+
|
|
197
|
+
## Impact Assessment
|
|
198
|
+
|
|
199
|
+
### Blast Radius
|
|
200
|
+
| Area | Impact | Severity |
|
|
201
|
+
|------|--------|----------|
|
|
202
|
+
| {area} | {how affected} | {level} |
|
|
203
|
+
|
|
204
|
+
### Data Integrity Risk
|
|
205
|
+
{From impact assessor — risk assessment and recovery strategies}
|
|
206
|
+
|
|
207
|
+
### Related Issues
|
|
208
|
+
{From impact assessor — related symptoms and shared root causes}
|
|
209
|
+
|
|
210
|
+
## Regression Analysis
|
|
211
|
+
|
|
212
|
+
### Most Likely Introduction Window
|
|
213
|
+
{From regression researcher — when, what changed, confidence level}
|
|
214
|
+
|
|
215
|
+
### Key Changes
|
|
216
|
+
{From regression researcher — timeline of suspicious changes}
|
|
217
|
+
|
|
218
|
+
## Reproduction Strategy
|
|
219
|
+
|
|
220
|
+
{Synthesized from all researchers — step-by-step approach to reproduce the bug in a test or development environment}
|
|
221
|
+
|
|
222
|
+
1. {step}
|
|
223
|
+
2. {step}
|
|
224
|
+
3. {expected failure point}
|
|
225
|
+
|
|
226
|
+
## Recommended Fix Approach
|
|
227
|
+
|
|
228
|
+
{Synthesized recommendation — which hypothesis to pursue, what to fix, in what order}
|
|
229
|
+
|
|
230
|
+
### Fix Phases
|
|
231
|
+
| Phase | What to Fix | Files | Hypothesis Addressed | Risk |
|
|
232
|
+
|-------|-----------|-------|---------------------|------|
|
|
233
|
+
| 1 | {immediate fix} | {files} | #{rank} | {risk} |
|
|
234
|
+
| 2 | {follow-up hardening} | {files} | #{rank} | {risk} |
|
|
235
|
+
|
|
236
|
+
### Safeguards
|
|
237
|
+
- {regression test to add}
|
|
238
|
+
- {monitoring or alerting to add}
|
|
239
|
+
- {defensive code patterns to apply}
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
**Investigated by:** AI researcher sub-agents
|
|
244
|
+
**Last updated:** {today's date}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
**ASK:** "Here is the generated investigation report. Review the content before I write the file:
|
|
248
|
+
- `{NN}_{bug-slug}.md` — {hypothesis count} hypotheses, severity {level}, {affected area count} areas affected
|
|
249
|
+
|
|
250
|
+
Confirm, or tell me what to adjust."
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
### Step 6: Generate ADR(s) (If Applicable)
|
|
255
|
+
|
|
256
|
+
Only proceed if the fix requires significant architectural decisions — for example, replacing an error-prone pattern across the codebase, introducing a new resilience mechanism, or changing a data model to prevent recurrence. Most bug investigations will NOT need ADRs.
|
|
257
|
+
|
|
258
|
+
If ADRs are needed, generate them following the same format as `hatch3r-feature-plan` Step 6.
|
|
259
|
+
|
|
260
|
+
#### ADR Format — `docs/adr/{NNNN}_{decision-slug}.md`
|
|
261
|
+
|
|
262
|
+
Determine the next sequential number by scanning existing files in `docs/adr/`. Use slugified decision titles.
|
|
263
|
+
|
|
264
|
+
```markdown
|
|
265
|
+
# ADR-{NNNN}: {Decision Title}
|
|
266
|
+
|
|
267
|
+
## Status
|
|
268
|
+
|
|
269
|
+
Proposed
|
|
270
|
+
|
|
271
|
+
## Date
|
|
272
|
+
|
|
273
|
+
{today's date}
|
|
274
|
+
|
|
275
|
+
## Context
|
|
276
|
+
|
|
277
|
+
{Why this decision is needed — the bug revealed a systemic issue that requires an architectural response, not just a point fix}
|
|
278
|
+
|
|
279
|
+
## Decision
|
|
280
|
+
|
|
281
|
+
{What was decided and why}
|
|
282
|
+
|
|
283
|
+
## Alternatives Considered
|
|
284
|
+
|
|
285
|
+
| Alternative | Pros | Cons | Why Not |
|
|
286
|
+
|-------------|------|------|---------|
|
|
287
|
+
| {option} | {pros} | {cons} | {reason} |
|
|
288
|
+
|
|
289
|
+
## Consequences
|
|
290
|
+
|
|
291
|
+
### Positive
|
|
292
|
+
- {consequence}
|
|
293
|
+
|
|
294
|
+
### Negative
|
|
295
|
+
- {consequence}
|
|
296
|
+
|
|
297
|
+
### Risks
|
|
298
|
+
- {risk}: {mitigation}
|
|
299
|
+
|
|
300
|
+
## Related
|
|
301
|
+
|
|
302
|
+
- Investigation report: `docs/investigations/{NN}_{bug-slug}.md`
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
If no ADRs are needed, state so and skip to Step 7.
|
|
306
|
+
|
|
307
|
+
**ASK** (only if ADRs generated): "Here are {N} ADR(s) generated from the investigation. Review before I write the files:
|
|
308
|
+
{list with titles}
|
|
309
|
+
|
|
310
|
+
Confirm, or tell me what to adjust."
|
|
311
|
+
|
|
312
|
+
---
|
|
313
|
+
|
|
314
|
+
### Step 7: Generate todo.md Entries
|
|
315
|
+
|
|
316
|
+
From the investigation report's fix phases and the synthesized research, generate structured `todo.md` entries in the format that `hatch3r-board-fill` expects.
|
|
317
|
+
|
|
318
|
+
#### Entry Structure
|
|
319
|
+
|
|
320
|
+
For multi-phase fixes, one **investigation-level entry** followed by **individual fix phase entries**:
|
|
321
|
+
|
|
322
|
+
```markdown
|
|
323
|
+
- [ ] **{Bug title} investigation & fix epic**: {Summary of bug, top hypothesis, fix phases}. Ref: docs/investigations/{NN}_{bug-slug}.md.
|
|
324
|
+
- [ ] **{Fix phase 1 title}**: {Description — what to fix, which hypothesis it addresses, acceptance criteria}. Ref: docs/investigations/{NN}_{bug-slug}.md.
|
|
325
|
+
- [ ] **{Fix phase 2 title}**: {Description — follow-up hardening, regression tests, monitoring}. Ref: docs/investigations/{NN}_{bug-slug}.md.
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
For simple bugs where the investigation revealed a single clear fix, produce a single standalone entry:
|
|
329
|
+
|
|
330
|
+
```markdown
|
|
331
|
+
- [ ] **Fix: {Bug title}**: {Root cause, fix approach, acceptance criteria}. Ref: docs/investigations/{NN}_{bug-slug}.md.
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
#### Placement
|
|
335
|
+
|
|
336
|
+
Use severity to determine priority: Critical/High bugs → P1, Medium → P2, Low → P3. Place entries under the matching `## P{N} — {Label}` header.
|
|
337
|
+
|
|
338
|
+
#### If `todo.md` Already Exists
|
|
339
|
+
|
|
340
|
+
**ASK:** "todo.md already exists with {N} items. How should I add the new entries?
|
|
341
|
+
- **(a) Append** under the appropriate priority header
|
|
342
|
+
- **(b) Merge** — deduplicate against existing items and reorganize
|
|
343
|
+
- **(c) Show me the entries** and I'll place them manually"
|
|
344
|
+
|
|
345
|
+
#### If `todo.md` Does Not Exist
|
|
346
|
+
|
|
347
|
+
Create a new `todo.md` with the appropriate priority header and the new entries.
|
|
348
|
+
|
|
349
|
+
Present the drafted entries for review.
|
|
350
|
+
|
|
351
|
+
**ASK:** "Here are the todo.md entries for this bug ({N} items). Review before I write:
|
|
352
|
+
|
|
353
|
+
{entries}
|
|
354
|
+
|
|
355
|
+
Confirm, or tell me what to adjust."
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
### Step 8: Write All Files
|
|
360
|
+
|
|
361
|
+
After all content is confirmed:
|
|
362
|
+
|
|
363
|
+
1. Write the investigation report to `docs/investigations/{NN}_{bug-slug}.md`. Create the `docs/investigations/` directory if it does not exist.
|
|
364
|
+
2. Write ADR(s) to `docs/adr/{NNNN}_{decision-slug}.md` (if any). Create the `docs/adr/` directory if it does not exist.
|
|
365
|
+
3. Write or update `todo.md` at the project root.
|
|
366
|
+
4. Present a summary of all files created or modified:
|
|
367
|
+
|
|
368
|
+
```
|
|
369
|
+
Files Created/Updated:
|
|
370
|
+
docs/investigations/
|
|
371
|
+
{NN}_{bug-slug}.md — {hypothesis count} hypotheses, severity {level}
|
|
372
|
+
docs/adr/
|
|
373
|
+
{NNNN}_{decision}.md — {decision title} (if applicable)
|
|
374
|
+
todo.md — {N} entries added ({1} epic + {M} fix phases)
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
### Step 9 (Optional): Chain into Board-Fill
|
|
380
|
+
|
|
381
|
+
**ASK:** "All files written. Run `hatch3r-board-fill` to create GitHub issues from the new todo.md entries? (yes / not now)"
|
|
382
|
+
|
|
383
|
+
If yes, instruct the user to invoke the `hatch3r-board-fill` command. Note that board-fill will perform its own deduplication, grouping, dependency analysis, and readiness assessment on the entries.
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## Error Handling
|
|
388
|
+
|
|
389
|
+
- **Sub-agent failure:** Retry the failed sub-agent once. If it fails again, present partial results from the remaining sub-agents and ask the user how to proceed (continue without that researcher's input / provide the missing information manually / abort).
|
|
390
|
+
- **Conflicting researcher outputs:** Present both options side by side with trade-offs. Ask the user to decide. Do not silently pick one.
|
|
391
|
+
- **File write failure:** Report the error and provide the full file content so the user can create the file manually.
|
|
392
|
+
- **Missing project context:** If no `hatch3r-board-shared` or `/.agents/hatch.json` exists, proceed without board context — this command does not require board configuration.
|
|
393
|
+
- **No existing specs or docs:** Proceed without spec references. Warn that the investigation will be less contextualized without existing project documentation. Recommend running `hatch3r-project-spec` or `hatch3r-codebase-map` first for best results.
|
|
394
|
+
- **Duplicate detection:** If the bug overlaps significantly with existing todo.md items, GitHub issues, or prior investigation reports found in Step 2, present the overlap and ASK whether to proceed (augment existing / replace / abort).
|
|
395
|
+
- **No clear root cause:** If all hypotheses are low-confidence, state this clearly. Recommend a focused debugging session (using `hatch3r-bug-fix` skill with the top hypothesis) rather than generating speculative fix items. ASK the user how to proceed.
|
|
396
|
+
|
|
397
|
+
## Guardrails
|
|
398
|
+
|
|
399
|
+
- **Never skip ASK checkpoints.** Every step with an ASK must pause for user confirmation.
|
|
400
|
+
- **Never write files without user review and confirmation.** All generated content is presented first.
|
|
401
|
+
- **Always delegate research to the hatch3r-researcher agent protocol.** Researcher sub-agents handle Context7 MCP, web research, and the tooling hierarchy internally.
|
|
402
|
+
- **Stay within the bug scope** defined by the user in Step 1. Do not expand the investigation into general code quality issues unless they are directly related to the bug. Flag tangential findings but do not act on them without explicit approval.
|
|
403
|
+
- **todo.md must be compatible with board-fill format** — markdown checklist with bold titles, grouped by priority, referencing source investigation reports.
|
|
404
|
+
- **ADRs use the same format as `hatch3r-project-spec`** — Status, Date, Context, Decision, Alternatives, Consequences.
|
|
405
|
+
- **Hypotheses must be evidence-based.** Every hypothesis must cite specific code, patterns, or conditions as evidence. Do not generate speculative hypotheses without codebase support.
|
|
406
|
+
- **Do not over-scope fixes.** Each todo.md entry should target a specific hypothesis or fix phase. Avoid bundling unrelated improvements into bug fix items.
|
|
407
|
+
- **All 4 researchers must complete before proceeding to Step 4.** Do not generate reports from partial research.
|
|
408
|
+
- **Respect the project's tooling hierarchy** for knowledge augmentation: project docs first, then codebase exploration, then Context7 MCP, then web research.
|
|
409
|
+
- **Preserve existing todo.md content.** Never overwrite or reorganize existing items without explicit user approval.
|
|
410
|
+
- **Distinguish fixes from improvements.** If the investigation reveals that the "bug" is actually expected behavior or a missing feature, flag this to the user and recommend using `hatch3r-feature-plan` instead.
|