@bradygaster/squad-sdk 0.9.0 → 0.9.1

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 (76) hide show
  1. package/README.md +296 -296
  2. package/dist/agents/history-shadow.js +30 -30
  3. package/dist/build/github-dist.js +42 -42
  4. package/dist/config/init.js +173 -173
  5. package/dist/sharing/consult.js +78 -78
  6. package/package.json +1 -1
  7. package/templates/casting/Futurama.json +9 -9
  8. package/templates/casting-history.json +4 -4
  9. package/templates/casting-policy.json +37 -37
  10. package/templates/casting-reference.md +104 -104
  11. package/templates/casting-registry.json +3 -3
  12. package/templates/ceremonies.md +41 -41
  13. package/templates/charter.md +53 -53
  14. package/templates/constraint-tracking.md +38 -38
  15. package/templates/cooperative-rate-limiting.md +229 -229
  16. package/templates/copilot-instructions.md +46 -46
  17. package/templates/history.md +10 -10
  18. package/templates/identity/now.md +9 -9
  19. package/templates/identity/wisdom.md +15 -15
  20. package/templates/issue-lifecycle.md +412 -412
  21. package/templates/keda-scaler.md +164 -164
  22. package/templates/machine-capabilities.md +74 -74
  23. package/templates/mcp-config.md +90 -90
  24. package/templates/multi-agent-format.md +28 -28
  25. package/templates/plugin-marketplace.md +49 -49
  26. package/templates/ralph-circuit-breaker.md +313 -313
  27. package/templates/raw-agent-output.md +37 -37
  28. package/templates/roster.md +60 -60
  29. package/templates/routing.md +39 -39
  30. package/templates/run-output.md +50 -50
  31. package/templates/schedule.json +19 -19
  32. package/templates/scribe-charter.md +119 -119
  33. package/templates/skill.md +24 -24
  34. package/templates/skills/agent-collaboration/SKILL.md +42 -42
  35. package/templates/skills/agent-conduct/SKILL.md +24 -24
  36. package/templates/skills/architectural-proposals/SKILL.md +151 -151
  37. package/templates/skills/ci-validation-gates/SKILL.md +84 -84
  38. package/templates/skills/cli-wiring/SKILL.md +47 -47
  39. package/templates/skills/client-compatibility/SKILL.md +89 -89
  40. package/templates/skills/cross-squad/SKILL.md +114 -114
  41. package/templates/skills/distributed-mesh/SKILL.md +287 -287
  42. package/templates/skills/distributed-mesh/mesh.json.example +30 -30
  43. package/templates/skills/distributed-mesh/sync-mesh.ps1 +111 -111
  44. package/templates/skills/distributed-mesh/sync-mesh.sh +104 -104
  45. package/templates/skills/docs-standards/SKILL.md +71 -71
  46. package/templates/skills/economy-mode/SKILL.md +114 -114
  47. package/templates/skills/external-comms/SKILL.md +329 -329
  48. package/templates/skills/gh-auth-isolation/SKILL.md +183 -183
  49. package/templates/skills/git-workflow/SKILL.md +204 -204
  50. package/templates/skills/github-multi-account/SKILL.md +95 -95
  51. package/templates/skills/history-hygiene/SKILL.md +36 -36
  52. package/templates/skills/humanizer/SKILL.md +105 -105
  53. package/templates/skills/init-mode/SKILL.md +102 -102
  54. package/templates/skills/model-selection/SKILL.md +117 -117
  55. package/templates/skills/nap/SKILL.md +24 -24
  56. package/templates/skills/personal-squad/SKILL.md +57 -57
  57. package/templates/skills/project-conventions/SKILL.md +56 -56
  58. package/templates/skills/release-process/SKILL.md +423 -423
  59. package/templates/skills/reskill/SKILL.md +92 -92
  60. package/templates/skills/reviewer-protocol/SKILL.md +79 -79
  61. package/templates/skills/secret-handling/SKILL.md +200 -200
  62. package/templates/skills/session-recovery/SKILL.md +155 -155
  63. package/templates/skills/squad-conventions/SKILL.md +69 -69
  64. package/templates/skills/test-discipline/SKILL.md +37 -37
  65. package/templates/skills/windows-compatibility/SKILL.md +74 -74
  66. package/templates/workflows/squad-ci.yml +24 -24
  67. package/templates/workflows/squad-docs.yml +54 -54
  68. package/templates/workflows/squad-heartbeat.yml +171 -171
  69. package/templates/workflows/squad-insider-release.yml +61 -61
  70. package/templates/workflows/squad-issue-assign.yml +161 -161
  71. package/templates/workflows/squad-label-enforce.yml +181 -181
  72. package/templates/workflows/squad-preview.yml +55 -55
  73. package/templates/workflows/squad-promote.yml +120 -120
  74. package/templates/workflows/squad-release.yml +77 -77
  75. package/templates/workflows/squad-triage.yml +260 -260
  76. package/templates/workflows/sync-squad-labels.yml +169 -169
@@ -1,412 +1,412 @@
1
- # Issue Lifecycle — Repo Connection & PR Flow
2
-
3
- Reference for connecting Squad to a repository and managing the issue→branch→PR→merge lifecycle.
4
-
5
- ## Repo Connection Format
6
-
7
- When connecting Squad to an issue tracker, store the connection in `.squad/team.md`:
8
-
9
- ```markdown
10
- ## Issue Source
11
-
12
- **Repository:** {owner}/{repo}
13
- **Connected:** {date}
14
- **Platform:** {GitHub | Azure DevOps | Planner}
15
- **Filters:**
16
- - Labels: `{label-filter}`
17
- - Project: `{project-name}` (ADO/Planner only)
18
- - Plan: `{plan-id}` (Planner only)
19
- ```
20
-
21
- **Detection triggers:**
22
- - User says "connect to {repo}"
23
- - User says "monitor {repo} for issues"
24
- - Ralph is activated without an issue source
25
-
26
- ## Platform-Specific Issue States
27
-
28
- Each platform tracks issue lifecycle differently. Squad normalizes these into a common board state.
29
-
30
- ### GitHub
31
-
32
- | GitHub State | GitHub API Fields | Squad Board State |
33
- |--------------|-------------------|-------------------|
34
- | Open, no assignee | `state: open`, `assignee: null` | `untriaged` |
35
- | Open, assigned, no branch | `state: open`, `assignee: @user`, no linked PR | `assigned` |
36
- | Open, branch exists | `state: open`, linked branch exists | `inProgress` |
37
- | Open, PR opened | `state: open`, PR exists, `reviewDecision: null` | `needsReview` |
38
- | Open, PR approved | `state: open`, PR `reviewDecision: APPROVED` | `readyToMerge` |
39
- | Open, changes requested | `state: open`, PR `reviewDecision: CHANGES_REQUESTED` | `changesRequested` |
40
- | Open, CI failure | `state: open`, PR `statusCheckRollup: FAILURE` | `ciFailure` |
41
- | Closed | `state: closed` | `done` |
42
-
43
- **Issue labels used by Squad:**
44
- - `squad` — Issue is in Squad backlog
45
- - `squad:{member}` — Assigned to specific agent
46
- - `squad:untriaged` — Needs triage
47
- - `go:needs-research` — Needs investigation before implementation
48
- - `priority:p{N}` — Priority level (0=critical, 1=high, 2=medium, 3=low)
49
- - `next-up` — Queued for next agent pickup
50
-
51
- **Branch naming convention:**
52
- ```
53
- squad/{issue-number}-{kebab-case-slug}
54
- ```
55
- Example: `squad/42-fix-login-validation`
56
-
57
- ### Azure DevOps
58
-
59
- | ADO State | Squad Board State |
60
- |-----------|-------------------|
61
- | New | `untriaged` |
62
- | Active, no branch | `assigned` |
63
- | Active, branch exists | `inProgress` |
64
- | Active, PR opened | `needsReview` |
65
- | Active, PR approved | `readyToMerge` |
66
- | Resolved | `done` |
67
- | Closed | `done` |
68
-
69
- **Work item tags used by Squad:**
70
- - `squad` — Work item is in Squad backlog
71
- - `squad:{member}` — Assigned to specific agent
72
-
73
- **Branch naming convention:**
74
- ```
75
- squad/{work-item-id}-{kebab-case-slug}
76
- ```
77
- Example: `squad/1234-add-auth-module`
78
-
79
- ### Microsoft Planner
80
-
81
- Planner does not have native Git integration. Squad uses Planner for task tracking and GitHub/ADO for code management.
82
-
83
- | Planner Status | Squad Board State |
84
- |----------------|-------------------|
85
- | Not Started | `untriaged` |
86
- | In Progress, no PR | `inProgress` |
87
- | In Progress, PR opened | `needsReview` |
88
- | Completed | `done` |
89
-
90
- **Planner→Git workflow:**
91
- 1. Task created in Planner bucket
92
- 2. Agent reads task from Planner
93
- 3. Agent creates branch in GitHub/ADO repo
94
- 4. Agent opens PR referencing Planner task ID in description
95
- 5. Agent marks task as "Completed" when PR merges
96
-
97
- ## Issue → Branch → PR → Merge Lifecycle
98
-
99
- ### 1. Issue Assignment (Triage)
100
-
101
- **Trigger:** Ralph detects an untriaged issue or user manually assigns work.
102
-
103
- **Actions:**
104
- 1. Read `.squad/routing.md` to determine which agent should handle the issue
105
- 2. Apply `squad:{member}` label (GitHub) or tag (ADO)
106
- 3. Transition issue to `assigned` state
107
- 4. Optionally spawn agent immediately if issue is high-priority
108
-
109
- **Issue read command:**
110
- ```bash
111
- # GitHub
112
- gh issue view {number} --json number,title,body,labels,assignees
113
-
114
- # Azure DevOps
115
- az boards work-item show --id {id} --output json
116
- ```
117
-
118
- ### 2. Branch Creation (Start Work)
119
-
120
- **Trigger:** Agent accepts issue assignment and begins work.
121
-
122
- **Actions:**
123
- 1. Ensure working on latest base branch (usually `main` or `dev`)
124
- 2. Create feature branch using Squad naming convention
125
- 3. Transition issue to `inProgress` state
126
-
127
- **Branch creation commands:**
128
-
129
- **Standard (single-agent, no parallelism):**
130
- ```bash
131
- git checkout main && git pull && git checkout -b squad/{issue-number}-{slug}
132
- ```
133
-
134
- **Worktree (parallel multi-agent):**
135
- ```bash
136
- git worktree add ../worktrees/{issue-number} -b squad/{issue-number}-{slug}
137
- cd ../worktrees/{issue-number}
138
- ```
139
-
140
- > **Note:** Worktree support is in progress (#525). Current implementation uses standard checkout.
141
-
142
- ### 3. Implementation & Commit
143
-
144
- **Actions:**
145
- 1. Agent makes code changes
146
- 2. Commits reference the issue number
147
- 3. Pushes branch to remote
148
-
149
- **Commit message format:**
150
- ```
151
- {type}({scope}): {description} (#{issue-number})
152
-
153
- {detailed explanation if needed}
154
-
155
- {breaking change notice if applicable}
156
-
157
- Closes #{issue-number}
158
-
159
- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
160
- ```
161
-
162
- **Commit types:** `feat`, `fix`, `docs`, `refactor`, `test`, `chore`, `perf`, `style`, `build`, `ci`
163
-
164
- **Push command:**
165
- ```bash
166
- git push -u origin squad/{issue-number}-{slug}
167
- ```
168
-
169
- ### 4. PR Creation
170
-
171
- **Trigger:** Agent completes implementation and is ready for review.
172
-
173
- **Actions:**
174
- 1. Open PR from feature branch to base branch
175
- 2. Reference issue in PR description
176
- 3. Apply labels if needed
177
- 4. Transition issue to `needsReview` state
178
-
179
- **PR creation commands:**
180
-
181
- **GitHub:**
182
- ```bash
183
- gh pr create --title "{title}" \
184
- --body "Closes #{issue-number}\n\n{description}" \
185
- --head squad/{issue-number}-{slug} \
186
- --base main
187
- ```
188
-
189
- **Azure DevOps:**
190
- ```bash
191
- az repos pr create --title "{title}" \
192
- --description "Closes #{work-item-id}\n\n{description}" \
193
- --source-branch squad/{work-item-id}-{slug} \
194
- --target-branch main
195
- ```
196
-
197
- **PR description template:**
198
- ```markdown
199
- Closes #{issue-number}
200
-
201
- ## Summary
202
- {what changed}
203
-
204
- ## Changes
205
- - {change 1}
206
- - {change 2}
207
-
208
- ## Testing
209
- {how this was tested}
210
-
211
- {If working as a squad member:}
212
- Working as {member} ({role})
213
-
214
- {If needs human review:}
215
- ⚠️ This task was flagged as "needs review" — please have a squad member review before merging.
216
- ```
217
-
218
- ### 5. PR Review & Updates
219
-
220
- **Review states:**
221
- - **Approved** → `readyToMerge`
222
- - **Changes requested** → `changesRequested`
223
- - **CI failure** → `ciFailure`
224
-
225
- **When changes are requested:**
226
- 1. Agent addresses feedback
227
- 2. Commits fixes to the same branch
228
- 3. Pushes updates
229
- 4. Requests re-review
230
-
231
- **Update workflow:**
232
- ```bash
233
- # Make changes
234
- git add .
235
- git commit -m "fix: address review feedback"
236
- git push
237
- ```
238
-
239
- **Re-request review (GitHub):**
240
- ```bash
241
- gh pr ready {pr-number}
242
- ```
243
-
244
- ### 6. PR Merge
245
-
246
- **Trigger:** PR is approved and CI passes.
247
-
248
- **Merge strategies:**
249
-
250
- **GitHub (merge commit):**
251
- ```bash
252
- gh pr merge {pr-number} --merge --delete-branch
253
- ```
254
-
255
- **GitHub (squash):**
256
- ```bash
257
- gh pr merge {pr-number} --squash --delete-branch
258
- ```
259
-
260
- **Azure DevOps:**
261
- ```bash
262
- az repos pr update --id {pr-id} --status completed --delete-source-branch true
263
- ```
264
-
265
- **Post-merge actions:**
266
- 1. Issue automatically closes (if "Closes #{number}" is in PR description)
267
- 2. Feature branch is deleted
268
- 3. Squad board state transitions to `done`
269
- 4. Worktree cleanup (if worktree was used — #525)
270
-
271
- ### 7. Cleanup
272
-
273
- **Standard workflow cleanup:**
274
- ```bash
275
- git checkout main
276
- git pull
277
- git branch -d squad/{issue-number}-{slug}
278
- ```
279
-
280
- **Worktree cleanup (future, #525):**
281
- ```bash
282
- cd {original-cwd}
283
- git worktree remove ../worktrees/{issue-number}
284
- ```
285
-
286
- ## Spawn Prompt Additions for Issue Work
287
-
288
- When spawning an agent to work on an issue, include this context block:
289
-
290
- ```markdown
291
- ## ISSUE CONTEXT
292
-
293
- **Issue:** #{number} — {title}
294
- **Platform:** {GitHub | Azure DevOps | Planner}
295
- **Repository:** {owner}/{repo}
296
- **Assigned to:** {member}
297
-
298
- **Description:**
299
- {issue body}
300
-
301
- **Labels/Tags:**
302
- {labels}
303
-
304
- **Acceptance Criteria:**
305
- {criteria if present in issue}
306
-
307
- **Branch:** `squad/{issue-number}-{slug}`
308
-
309
- **Your task:**
310
- {specific directive to the agent}
311
-
312
- **After completing work:**
313
- 1. Commit with message referencing issue number
314
- 2. Push branch
315
- 3. Open PR using:
316
- ```
317
- gh pr create --title "{title}" --body "Closes #{number}\n\n{description}" --head squad/{issue-number}-{slug} --base {base-branch}
318
- ```
319
- 4. Report PR URL to coordinator
320
- ```
321
-
322
- ## Ralph's Role in Issue Lifecycle
323
-
324
- Ralph (the work monitor) continuously checks issue and PR state:
325
-
326
- 1. **Triage:** Detects untriaged issues, assigns `squad:{member}` labels
327
- 2. **Spawn:** Launches agents for assigned issues
328
- 3. **Monitor:** Tracks PR state transitions (needsReview → changesRequested → readyToMerge)
329
- 4. **Merge:** Automatically merges approved PRs
330
- 5. **Cleanup:** Marks issues as done when PRs merge
331
-
332
- **Ralph's work-check cycle:**
333
- ```
334
- Scan → Categorize → Dispatch → Watch → Report → Loop
335
- ```
336
-
337
- See `.squad/templates/ralph-reference.md` for Ralph's full lifecycle.
338
-
339
- ## PR Review Handling
340
-
341
- ### Automated Approval (CI-only projects)
342
-
343
- If the project has no human reviewers configured:
344
- 1. PR opens
345
- 2. CI runs
346
- 3. If CI passes, Ralph auto-merges
347
- 4. Issue closes
348
-
349
- ### Human Review Required
350
-
351
- If the project requires human approval:
352
- 1. PR opens
353
- 2. Human reviewer is notified (GitHub/ADO notifications)
354
- 3. Reviewer approves or requests changes
355
- 4. If approved + CI passes, Ralph merges
356
- 5. If changes requested, agent addresses feedback
357
-
358
- ### Squad Member Review
359
-
360
- If the issue was assigned to a squad member and they authored the PR:
361
- 1. Another squad member reviews (conflict of interest avoidance)
362
- 2. Original author is locked out from re-working rejected code (rejection lockout)
363
- 3. Reviewer can approve edits or reject outright
364
-
365
- ## Common Issue Lifecycle Patterns
366
-
367
- ### Pattern 1: Quick Fix (Single Agent, No Review)
368
- ```
369
- Issue created → Assigned to agent → Branch created → Code fixed →
370
- PR opened → CI passes → Auto-merged → Issue closed
371
- ```
372
-
373
- ### Pattern 2: Feature Development (Human Review)
374
- ```
375
- Issue created → Assigned to agent → Branch created → Feature implemented →
376
- PR opened → Human reviews → Changes requested → Agent fixes →
377
- Re-reviewed → Approved → Merged → Issue closed
378
- ```
379
-
380
- ### Pattern 3: Research-Then-Implement
381
- ```
382
- Issue created → Labeled `go:needs-research` → Research agent spawned →
383
- Research documented → Research PR merged → Implementation issue created →
384
- Implementation agent spawned → Feature built → PR merged
385
- ```
386
-
387
- ### Pattern 4: Parallel Multi-Agent (Future, #525)
388
- ```
389
- Epic issue created → Decomposed into sub-issues → Each sub-issue assigned →
390
- Multiple agents work in parallel worktrees → PRs opened concurrently →
391
- All PRs reviewed → All PRs merged → Epic closed
392
- ```
393
-
394
- ## Anti-Patterns
395
-
396
- - ❌ Creating branches without linking to an issue
397
- - ❌ Committing without issue reference in message
398
- - ❌ Opening PRs without "Closes #{number}" in description
399
- - ❌ Merging PRs before CI passes
400
- - ❌ Leaving feature branches undeleted after merge
401
- - ❌ Using `checkout -b` when parallel agents are active (causes working directory conflicts)
402
- - ❌ Manually transitioning issue states — let the platform and Squad automation handle it
403
- - ❌ Skipping the branch naming convention — breaks Ralph's tracking logic
404
-
405
- ## Migration Notes
406
-
407
- **v0.8.x → v0.9.x (Worktree Support):**
408
- - `checkout -b` → `git worktree add` for parallel agents
409
- - Worktree cleanup added to post-merge flow
410
- - `TEAM_ROOT` passing to agents to support worktree-aware state resolution
411
-
412
- This template will be updated as worktree lifecycle support lands in #525.
1
+ # Issue Lifecycle — Repo Connection & PR Flow
2
+
3
+ Reference for connecting Squad to a repository and managing the issue→branch→PR→merge lifecycle.
4
+
5
+ ## Repo Connection Format
6
+
7
+ When connecting Squad to an issue tracker, store the connection in `.squad/team.md`:
8
+
9
+ ```markdown
10
+ ## Issue Source
11
+
12
+ **Repository:** {owner}/{repo}
13
+ **Connected:** {date}
14
+ **Platform:** {GitHub | Azure DevOps | Planner}
15
+ **Filters:**
16
+ - Labels: `{label-filter}`
17
+ - Project: `{project-name}` (ADO/Planner only)
18
+ - Plan: `{plan-id}` (Planner only)
19
+ ```
20
+
21
+ **Detection triggers:**
22
+ - User says "connect to {repo}"
23
+ - User says "monitor {repo} for issues"
24
+ - Ralph is activated without an issue source
25
+
26
+ ## Platform-Specific Issue States
27
+
28
+ Each platform tracks issue lifecycle differently. Squad normalizes these into a common board state.
29
+
30
+ ### GitHub
31
+
32
+ | GitHub State | GitHub API Fields | Squad Board State |
33
+ |--------------|-------------------|-------------------|
34
+ | Open, no assignee | `state: open`, `assignee: null` | `untriaged` |
35
+ | Open, assigned, no branch | `state: open`, `assignee: @user`, no linked PR | `assigned` |
36
+ | Open, branch exists | `state: open`, linked branch exists | `inProgress` |
37
+ | Open, PR opened | `state: open`, PR exists, `reviewDecision: null` | `needsReview` |
38
+ | Open, PR approved | `state: open`, PR `reviewDecision: APPROVED` | `readyToMerge` |
39
+ | Open, changes requested | `state: open`, PR `reviewDecision: CHANGES_REQUESTED` | `changesRequested` |
40
+ | Open, CI failure | `state: open`, PR `statusCheckRollup: FAILURE` | `ciFailure` |
41
+ | Closed | `state: closed` | `done` |
42
+
43
+ **Issue labels used by Squad:**
44
+ - `squad` — Issue is in Squad backlog
45
+ - `squad:{member}` — Assigned to specific agent
46
+ - `squad:untriaged` — Needs triage
47
+ - `go:needs-research` — Needs investigation before implementation
48
+ - `priority:p{N}` — Priority level (0=critical, 1=high, 2=medium, 3=low)
49
+ - `next-up` — Queued for next agent pickup
50
+
51
+ **Branch naming convention:**
52
+ ```
53
+ squad/{issue-number}-{kebab-case-slug}
54
+ ```
55
+ Example: `squad/42-fix-login-validation`
56
+
57
+ ### Azure DevOps
58
+
59
+ | ADO State | Squad Board State |
60
+ |-----------|-------------------|
61
+ | New | `untriaged` |
62
+ | Active, no branch | `assigned` |
63
+ | Active, branch exists | `inProgress` |
64
+ | Active, PR opened | `needsReview` |
65
+ | Active, PR approved | `readyToMerge` |
66
+ | Resolved | `done` |
67
+ | Closed | `done` |
68
+
69
+ **Work item tags used by Squad:**
70
+ - `squad` — Work item is in Squad backlog
71
+ - `squad:{member}` — Assigned to specific agent
72
+
73
+ **Branch naming convention:**
74
+ ```
75
+ squad/{work-item-id}-{kebab-case-slug}
76
+ ```
77
+ Example: `squad/1234-add-auth-module`
78
+
79
+ ### Microsoft Planner
80
+
81
+ Planner does not have native Git integration. Squad uses Planner for task tracking and GitHub/ADO for code management.
82
+
83
+ | Planner Status | Squad Board State |
84
+ |----------------|-------------------|
85
+ | Not Started | `untriaged` |
86
+ | In Progress, no PR | `inProgress` |
87
+ | In Progress, PR opened | `needsReview` |
88
+ | Completed | `done` |
89
+
90
+ **Planner→Git workflow:**
91
+ 1. Task created in Planner bucket
92
+ 2. Agent reads task from Planner
93
+ 3. Agent creates branch in GitHub/ADO repo
94
+ 4. Agent opens PR referencing Planner task ID in description
95
+ 5. Agent marks task as "Completed" when PR merges
96
+
97
+ ## Issue → Branch → PR → Merge Lifecycle
98
+
99
+ ### 1. Issue Assignment (Triage)
100
+
101
+ **Trigger:** Ralph detects an untriaged issue or user manually assigns work.
102
+
103
+ **Actions:**
104
+ 1. Read `.squad/routing.md` to determine which agent should handle the issue
105
+ 2. Apply `squad:{member}` label (GitHub) or tag (ADO)
106
+ 3. Transition issue to `assigned` state
107
+ 4. Optionally spawn agent immediately if issue is high-priority
108
+
109
+ **Issue read command:**
110
+ ```bash
111
+ # GitHub
112
+ gh issue view {number} --json number,title,body,labels,assignees
113
+
114
+ # Azure DevOps
115
+ az boards work-item show --id {id} --output json
116
+ ```
117
+
118
+ ### 2. Branch Creation (Start Work)
119
+
120
+ **Trigger:** Agent accepts issue assignment and begins work.
121
+
122
+ **Actions:**
123
+ 1. Ensure working on latest base branch (usually `main` or `dev`)
124
+ 2. Create feature branch using Squad naming convention
125
+ 3. Transition issue to `inProgress` state
126
+
127
+ **Branch creation commands:**
128
+
129
+ **Standard (single-agent, no parallelism):**
130
+ ```bash
131
+ git checkout main && git pull && git checkout -b squad/{issue-number}-{slug}
132
+ ```
133
+
134
+ **Worktree (parallel multi-agent):**
135
+ ```bash
136
+ git worktree add ../worktrees/{issue-number} -b squad/{issue-number}-{slug}
137
+ cd ../worktrees/{issue-number}
138
+ ```
139
+
140
+ > **Note:** Worktree support is in progress (#525). Current implementation uses standard checkout.
141
+
142
+ ### 3. Implementation & Commit
143
+
144
+ **Actions:**
145
+ 1. Agent makes code changes
146
+ 2. Commits reference the issue number
147
+ 3. Pushes branch to remote
148
+
149
+ **Commit message format:**
150
+ ```
151
+ {type}({scope}): {description} (#{issue-number})
152
+
153
+ {detailed explanation if needed}
154
+
155
+ {breaking change notice if applicable}
156
+
157
+ Closes #{issue-number}
158
+
159
+ Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
160
+ ```
161
+
162
+ **Commit types:** `feat`, `fix`, `docs`, `refactor`, `test`, `chore`, `perf`, `style`, `build`, `ci`
163
+
164
+ **Push command:**
165
+ ```bash
166
+ git push -u origin squad/{issue-number}-{slug}
167
+ ```
168
+
169
+ ### 4. PR Creation
170
+
171
+ **Trigger:** Agent completes implementation and is ready for review.
172
+
173
+ **Actions:**
174
+ 1. Open PR from feature branch to base branch
175
+ 2. Reference issue in PR description
176
+ 3. Apply labels if needed
177
+ 4. Transition issue to `needsReview` state
178
+
179
+ **PR creation commands:**
180
+
181
+ **GitHub:**
182
+ ```bash
183
+ gh pr create --title "{title}" \
184
+ --body "Closes #{issue-number}\n\n{description}" \
185
+ --head squad/{issue-number}-{slug} \
186
+ --base main
187
+ ```
188
+
189
+ **Azure DevOps:**
190
+ ```bash
191
+ az repos pr create --title "{title}" \
192
+ --description "Closes #{work-item-id}\n\n{description}" \
193
+ --source-branch squad/{work-item-id}-{slug} \
194
+ --target-branch main
195
+ ```
196
+
197
+ **PR description template:**
198
+ ```markdown
199
+ Closes #{issue-number}
200
+
201
+ ## Summary
202
+ {what changed}
203
+
204
+ ## Changes
205
+ - {change 1}
206
+ - {change 2}
207
+
208
+ ## Testing
209
+ {how this was tested}
210
+
211
+ {If working as a squad member:}
212
+ Working as {member} ({role})
213
+
214
+ {If needs human review:}
215
+ ⚠️ This task was flagged as "needs review" — please have a squad member review before merging.
216
+ ```
217
+
218
+ ### 5. PR Review & Updates
219
+
220
+ **Review states:**
221
+ - **Approved** → `readyToMerge`
222
+ - **Changes requested** → `changesRequested`
223
+ - **CI failure** → `ciFailure`
224
+
225
+ **When changes are requested:**
226
+ 1. Agent addresses feedback
227
+ 2. Commits fixes to the same branch
228
+ 3. Pushes updates
229
+ 4. Requests re-review
230
+
231
+ **Update workflow:**
232
+ ```bash
233
+ # Make changes
234
+ git add .
235
+ git commit -m "fix: address review feedback"
236
+ git push
237
+ ```
238
+
239
+ **Re-request review (GitHub):**
240
+ ```bash
241
+ gh pr ready {pr-number}
242
+ ```
243
+
244
+ ### 6. PR Merge
245
+
246
+ **Trigger:** PR is approved and CI passes.
247
+
248
+ **Merge strategies:**
249
+
250
+ **GitHub (merge commit):**
251
+ ```bash
252
+ gh pr merge {pr-number} --merge --delete-branch
253
+ ```
254
+
255
+ **GitHub (squash):**
256
+ ```bash
257
+ gh pr merge {pr-number} --squash --delete-branch
258
+ ```
259
+
260
+ **Azure DevOps:**
261
+ ```bash
262
+ az repos pr update --id {pr-id} --status completed --delete-source-branch true
263
+ ```
264
+
265
+ **Post-merge actions:**
266
+ 1. Issue automatically closes (if "Closes #{number}" is in PR description)
267
+ 2. Feature branch is deleted
268
+ 3. Squad board state transitions to `done`
269
+ 4. Worktree cleanup (if worktree was used — #525)
270
+
271
+ ### 7. Cleanup
272
+
273
+ **Standard workflow cleanup:**
274
+ ```bash
275
+ git checkout main
276
+ git pull
277
+ git branch -d squad/{issue-number}-{slug}
278
+ ```
279
+
280
+ **Worktree cleanup (future, #525):**
281
+ ```bash
282
+ cd {original-cwd}
283
+ git worktree remove ../worktrees/{issue-number}
284
+ ```
285
+
286
+ ## Spawn Prompt Additions for Issue Work
287
+
288
+ When spawning an agent to work on an issue, include this context block:
289
+
290
+ ```markdown
291
+ ## ISSUE CONTEXT
292
+
293
+ **Issue:** #{number} — {title}
294
+ **Platform:** {GitHub | Azure DevOps | Planner}
295
+ **Repository:** {owner}/{repo}
296
+ **Assigned to:** {member}
297
+
298
+ **Description:**
299
+ {issue body}
300
+
301
+ **Labels/Tags:**
302
+ {labels}
303
+
304
+ **Acceptance Criteria:**
305
+ {criteria if present in issue}
306
+
307
+ **Branch:** `squad/{issue-number}-{slug}`
308
+
309
+ **Your task:**
310
+ {specific directive to the agent}
311
+
312
+ **After completing work:**
313
+ 1. Commit with message referencing issue number
314
+ 2. Push branch
315
+ 3. Open PR using:
316
+ ```
317
+ gh pr create --title "{title}" --body "Closes #{number}\n\n{description}" --head squad/{issue-number}-{slug} --base {base-branch}
318
+ ```
319
+ 4. Report PR URL to coordinator
320
+ ```
321
+
322
+ ## Ralph's Role in Issue Lifecycle
323
+
324
+ Ralph (the work monitor) continuously checks issue and PR state:
325
+
326
+ 1. **Triage:** Detects untriaged issues, assigns `squad:{member}` labels
327
+ 2. **Spawn:** Launches agents for assigned issues
328
+ 3. **Monitor:** Tracks PR state transitions (needsReview → changesRequested → readyToMerge)
329
+ 4. **Merge:** Automatically merges approved PRs
330
+ 5. **Cleanup:** Marks issues as done when PRs merge
331
+
332
+ **Ralph's work-check cycle:**
333
+ ```
334
+ Scan → Categorize → Dispatch → Watch → Report → Loop
335
+ ```
336
+
337
+ See `.squad/templates/ralph-reference.md` for Ralph's full lifecycle.
338
+
339
+ ## PR Review Handling
340
+
341
+ ### Automated Approval (CI-only projects)
342
+
343
+ If the project has no human reviewers configured:
344
+ 1. PR opens
345
+ 2. CI runs
346
+ 3. If CI passes, Ralph auto-merges
347
+ 4. Issue closes
348
+
349
+ ### Human Review Required
350
+
351
+ If the project requires human approval:
352
+ 1. PR opens
353
+ 2. Human reviewer is notified (GitHub/ADO notifications)
354
+ 3. Reviewer approves or requests changes
355
+ 4. If approved + CI passes, Ralph merges
356
+ 5. If changes requested, agent addresses feedback
357
+
358
+ ### Squad Member Review
359
+
360
+ If the issue was assigned to a squad member and they authored the PR:
361
+ 1. Another squad member reviews (conflict of interest avoidance)
362
+ 2. Original author is locked out from re-working rejected code (rejection lockout)
363
+ 3. Reviewer can approve edits or reject outright
364
+
365
+ ## Common Issue Lifecycle Patterns
366
+
367
+ ### Pattern 1: Quick Fix (Single Agent, No Review)
368
+ ```
369
+ Issue created → Assigned to agent → Branch created → Code fixed →
370
+ PR opened → CI passes → Auto-merged → Issue closed
371
+ ```
372
+
373
+ ### Pattern 2: Feature Development (Human Review)
374
+ ```
375
+ Issue created → Assigned to agent → Branch created → Feature implemented →
376
+ PR opened → Human reviews → Changes requested → Agent fixes →
377
+ Re-reviewed → Approved → Merged → Issue closed
378
+ ```
379
+
380
+ ### Pattern 3: Research-Then-Implement
381
+ ```
382
+ Issue created → Labeled `go:needs-research` → Research agent spawned →
383
+ Research documented → Research PR merged → Implementation issue created →
384
+ Implementation agent spawned → Feature built → PR merged
385
+ ```
386
+
387
+ ### Pattern 4: Parallel Multi-Agent (Future, #525)
388
+ ```
389
+ Epic issue created → Decomposed into sub-issues → Each sub-issue assigned →
390
+ Multiple agents work in parallel worktrees → PRs opened concurrently →
391
+ All PRs reviewed → All PRs merged → Epic closed
392
+ ```
393
+
394
+ ## Anti-Patterns
395
+
396
+ - ❌ Creating branches without linking to an issue
397
+ - ❌ Committing without issue reference in message
398
+ - ❌ Opening PRs without "Closes #{number}" in description
399
+ - ❌ Merging PRs before CI passes
400
+ - ❌ Leaving feature branches undeleted after merge
401
+ - ❌ Using `checkout -b` when parallel agents are active (causes working directory conflicts)
402
+ - ❌ Manually transitioning issue states — let the platform and Squad automation handle it
403
+ - ❌ Skipping the branch naming convention — breaks Ralph's tracking logic
404
+
405
+ ## Migration Notes
406
+
407
+ **v0.8.x → v0.9.x (Worktree Support):**
408
+ - `checkout -b` → `git worktree add` for parallel agents
409
+ - Worktree cleanup added to post-merge flow
410
+ - `TEAM_ROOT` passing to agents to support worktree-aware state resolution
411
+
412
+ This template will be updated as worktree lifecycle support lands in #525.