The workflow
The dev loop runs in two macro steps: ingest (validate the input) and execute (drive each story through the pipeline).
Step 1 — Ingest input
File: skills/bmad-dev-loop/steps/step-01-ingest-input.md
What it does
- Parses the invocation prompt for story keys (e.g.
4-1 4-2 4-3). - Expands
epic-Nreferences by looking upready-for-devstories insprint-status.yaml. - For each key, validates against sprint status (
ready-for-devonly) and against file existence ({implementation_artifacts}/{key}.md). - Displays the plan.
- Asks the user once for confirmation.
- Writes the initial
loop-status.yaml.
Output
A validated list of stories, each with:
- key: "4-1"
path: "_bmad-output/implementation-artifacts/4-1-dry-run-mode.md"
title: dry-run-mode
status: ready-for-devIf the list is empty after filtering, the skill HALTs with blocked and no ready-for-dev stories in input list.
Resume point
The current_index field in loop-status.yaml's frontmatter is the authoritative pointer. Re-running the skill reads it and picks up at the first story that is not merged.
Step 2 — Execute loop
File: skills/bmad-dev-loop/steps/step-02-execute-loop.md
For each story, six phases.
Phase 1 — DEV
Dispatches a synchronous subagent running bmad-dev-story against the story file. Stores the dev result (summary, files changed, commit hash, warnings) in loop-status.yaml.
sequenceDiagram
participant L as Loop
participant D as Dev Subagent
participant R as Repo
L->>D: prompt + story.path
D->>R: implement, test, fix
R-->>D: tests pass
D-->>L: { summary, files_changed, commit }If the dev subagent returns an error, the loop HALTs with blocked and story dev failed: {key} — {details}. Stories are not skipped on dev failure — the loop is paused, not resumed past them.
Phase 2 — REVIEW
Dispatches a synchronous subagent running bmad-code-review. If workflow.review_model_override is set, the prompt includes a routing instruction.
If the review finds high-severity issues, a fix subagent is dispatched and the loop continues. Medium and low issues are recorded but do not block.
Phase 3 — BRANCH / PR
The skill:
- Determines the branch name:
{workflow.branch_prefix}{key}-{title}(defaultstory/4-1-dry-run-mode). - Force-recreates the branch locally if it already exists.
- Commits the dev changes (and review-fix changes, if any) with a
feat(...)orfix(...)message. - Pushes to origin.
- Creates a PR via
gh pr createwith a body assembled from dev + review output.
Phase 4 — CI
Polls gh pr checks {pr_number} every workflow.ci_poll_interval_seconds (default 30). On failure:
- If
ci_attempts < ci_max_retries: dispatch a CI-fix subagent, commit, push, re-poll. - If
ci_attempts >= ci_max_retries: HALT withCI failures persisted after {n} retries. - If polling exceeds
workflow.ci_timeout_minutes: HALT withCI timeout for story {key}.
Phase 5 — MERGE
Runs gh pr merge {pr_number} --{workflow.merge_strategy} --delete-branch. Strategy is one of squash, merge, or rebase. Default squash.
If merge fails (conflicts, branch protection), the loop HALTs with merge failed for story {key}.
Phase 6 — ADVANCE
git checkout main && git pull origin main. Increment current_index. Move to the next story.
State transitions
Per-story status flows through:
pending
→ dev-in-progress
→ dev-done
→ review-in-progress
→ review-done
→ pr-in-progress
→ pr-created
→ ci-in-progress
→ ci-passed
→ merge-in-progress
→ mergedAny of these can be replaced with a terminal blocked status if a phase fails. The full taxonomy is in Safety & HALT.
Subagent preconditions
Each subagent prompt instructs the agent to verify before starting:
git rev-parse --abbrev-ref HEAD # current branch (sanity)
gh auth status # CLI authenticated
git status --porcelain # working tree cleanThese are advisory — the skill does not enforce them itself. The agent is responsible for surfacing issues if they fail.
Concurrency model
- No parallelism between stories. Stories are processed in strict input order. PRs are reviewed and merged one at a time.
- No parallelism within a story. Dev then review then branch then PR then CI then merge — serial by design.
- One subagent at a time. Backgrounded subagents stall the loop. Always synchronous.