Subchapter 12.21
issue-lifecycle.mdMarkdown11 KBView on GitHub
Reference for connecting Squad to a repository and managing the issue→branch→PR→merge lifecycle.
When connecting Squad to an issue tracker, store the connection in .squad/team.md:
## Issue Source
**Repository:** {owner}/{repo}
**Connected:** {date}
**Platform:** {GitHub | Azure DevOps | Planner}
**Filters:**
- Labels: `{label-filter}`
- Project: `{project-name}` (ADO/Planner only)
- Plan: `{plan-id}` (Planner only)Detection triggers:
Each platform tracks issue lifecycle differently. Squad normalizes these into a common board state.
| GitHub State | GitHub API Fields | Squad Board State |
|---|---|---|
| Open, no assignee | state: open, assignee: null | untriaged |
| Open, assigned, no branch | state: open, assignee: @user, no linked PR | assigned |
| Open, branch exists | state: open, linked branch exists | inProgress |
| Open, PR opened | state: open, PR exists, reviewDecision: null | needsReview |
| Open, PR approved | state: open, PR reviewDecision: APPROVED | readyToMerge |
| Open, changes requested | state: open, PR reviewDecision: CHANGES_REQUESTED | changesRequested |
| Open, CI failure | state: open, PR statusCheckRollup: FAILURE | ciFailure |
| Closed | state: closed | done |
Issue labels used by Squad:
squad — Issue is in Squad backlogsquad:{member} — Assigned to specific agentsquad:untriaged — Needs triagego:needs-research — Needs investigation before implementationpriority:p{N} — Priority level (0=critical, 1=high, 2=medium, 3=low)next-up — Queued for next agent pickupBranch naming convention:
squad/{issue-number}-{kebab-case-slug}Example: squad/42-fix-login-validation
| ADO State | Squad Board State |
|---|---|
| New | untriaged |
| Active, no branch | assigned |
| Active, branch exists | inProgress |
| Active, PR opened | needsReview |
| Active, PR approved | readyToMerge |
| Resolved | done |
| Closed | done |
Work item tags used by Squad:
squad — Work item is in Squad backlogsquad:{member} — Assigned to specific agentBranch naming convention:
squad/{work-item-id}-{kebab-case-slug}Example: squad/1234-add-auth-module
Planner does not have native Git integration. Squad uses Planner for task tracking and GitHub/ADO for code management.
| Planner Status | Squad Board State |
|---|---|
| Not Started | untriaged |
| In Progress, no PR | inProgress |
| In Progress, PR opened | needsReview |
| Completed | done |
Planner→Git workflow:
Trigger: Ralph detects an untriaged issue or user manually assigns work.
Actions:
.squad/routing.md to determine which agent should handle the issuesquad:{member} label (GitHub) or tag (ADO)assigned stateIssue read command:
# GitHub
gh issue view {number} --json number,title,body,labels,assignees
# Azure DevOps
az boards work-item show --id {id} --output jsonTrigger: Agent accepts issue assignment and begins work.
Actions:
main or dev)inProgress stateBranch creation commands:
Standard (single-agent, no parallelism):
git checkout main && git pull && git checkout -b squad/{issue-number}-{slug}Worktree (parallel multi-agent):
git worktree add ../worktrees/{issue-number} -b squad/{issue-number}-{slug}
cd ../worktrees/{issue-number}Note: Worktree support is in progress (#525). Current implementation uses standard checkout.
Actions:
Commit message format:
{type}({scope}): {description} (#{issue-number})
{detailed explanation if needed}
{breaking change notice if applicable}
Closes #{issue-number}
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>Commit types: feat, fix, docs, refactor, test, chore, perf, style, build, ci
Push command:
git push -u origin squad/{issue-number}-{slug}Trigger: Agent completes implementation and is ready for review.
Actions:
needsReview statePR creation commands:
GitHub:
gh pr create --title "{title}" \
--body "Closes #{issue-number}\n\n{description}" \
--head squad/{issue-number}-{slug} \
--base mainAzure DevOps:
az repos pr create --title "{title}" \
--description "Closes #{work-item-id}\n\n{description}" \
--source-branch squad/{work-item-id}-{slug} \
--target-branch mainPR description template:
Closes #{issue-number}
## Summary
{what changed}
## Changes
- {change 1}
- {change 2}
## Testing
{how this was tested}
{If working as a squad member:}
Working as {member} ({role})
{If needs human review:}
⚠️ This task was flagged as "needs review" — please have a squad member review before merging.Review states:
readyToMergechangesRequestedciFailureWhen changes are requested:
Update workflow:
# Make changes
# ⚠️ NEVER use `git add .` or `git add -A` — only stage files you intentionally changed
git add -- {specific files you modified}
git commit -m "fix: address review feedback"
git pushRe-request review (GitHub):
gh pr ready {pr-number}Trigger: PR is approved and CI passes.
Merge strategies:
GitHub (merge commit):
gh pr merge {pr-number} --merge --delete-branchGitHub (squash):
gh pr merge {pr-number} --squash --delete-branchAzure DevOps:
az repos pr update --id {pr-id} --status completed --delete-source-branch truePost-merge actions:
doneStandard workflow cleanup:
git checkout main
git pull
git branch -d squad/{issue-number}-{slug}Worktree cleanup (future, #525):
cd {original-cwd}
git worktree remove ../worktrees/{issue-number}When spawning an agent to work on an issue, include this context block:
## ISSUE CONTEXT
**Issue:** #{number} — {title}
**Platform:** {GitHub | Azure DevOps | Planner}
**Repository:** {owner}/{repo}
**Assigned to:** {member}
**Description:**
{issue body}
**Labels/Tags:**
{labels}
**Acceptance Criteria:**
{criteria if present in issue}
**Branch:** `squad/{issue-number}-{slug}`
**Your task:**
{specific directive to the agent}
**After completing work:**
1. Commit with message referencing issue number
2. Push branch
3. Open PR using:gh pr create --title “{title}” --body “Closes #{number}\n\n{description}” --head squad/{issue-number}-{slug} --base {base-branch}
4. Report PR URL to coordinatorRalph (the work monitor) continuously checks issue and PR state:
squad:{member} labelsRalph’s work-check cycle:
Scan → Categorize → Dispatch → Watch → Report → LoopSee .squad/templates/ralph-reference.md for Ralph’s full lifecycle.
If the project has no human reviewers configured:
If the project requires human approval:
If the issue was assigned to a squad member and they authored the PR:
Issue created → Assigned to agent → Branch created → Code fixed →
PR opened → CI passes → Auto-merged → Issue closedIssue created → Assigned to agent → Branch created → Feature implemented →
PR opened → Human reviews → Changes requested → Agent fixes →
Re-reviewed → Approved → Merged → Issue closedIssue created → Labeled `go:needs-research` → Research agent spawned →
Research documented → Research PR merged → Implementation issue created →
Implementation agent spawned → Feature built → PR mergedEpic issue created → Decomposed into sub-issues → Each sub-issue assigned →
Multiple agents work in parallel worktrees → PRs opened concurrently →
All PRs reviewed → All PRs merged → Epic closedcheckout -b when parallel agents are active (causes working directory conflicts)v0.8.x → v0.9.x (Worktree Support):
checkout -b → git worktree add for parallel agentsTEAM_ROOT passing to agents to support worktree-aware state resolutionThis template will be updated as worktree lifecycle support lands in #525.