The Why and the How Loop: BMAD Method + Ralph Loop
Every software project lives inside two fundamental questions: Why are we building this? and How do we build it well? Answering "why" without a clear "how" leads to beautiful ideas that never ship. Answering "how" without a clear "why" leads to polished code solving the wrong problem.
The loop I want to share in this article closes both gaps. It combines the BMAD method — which shines in the thinking phases — with the Ralph loop — which shines in the doing phases — into a single, continuous cycle.
Part 1 — The Why: BMAD Method for Analysis, Planning, and Solutioning
What is the BMAD Method?
BMAD ("Build More Architect Dreams") is an open-source, AI-driven agile development framework built around specialized AI agents and guided skill-based workflows. It is scale-domain-adaptive: the same methodology works for a quick bug fix and for an enterprise-scale platform, adjusting planning depth automatically based on project complexity.
BMAD organizes development into four phases. Each phase is driven by a specific agent invoked via a skill — a named command (e.g., bmad-create-prd) that your AI IDE recognizes and executes as a structured workflow. The key agents are:
- Analyst (
bmad-agent-analyst): Leads brainstorming, research, and early discovery. - Product Manager (
bmad-agent-pm): Translates business needs into a structured PRD and later breaks it into epics. - UX Designer (
bmad-agent-ux-designer): Designs user experience and interaction flows for projects with a UI. - Architect (
bmad-agent-architect): Designs the technical solution and validates implementation readiness. - Developer (
bmad-agent-dev): Implements stories, runs code reviews, and manages sprint tracking.
At any moment you can run bmad-help — an intelligent guide that inspects your project, detects what has been completed, and recommends exactly what to do next.
Phase 1 — Analysis (Optional)
The analysis phase is about understanding the problem deeply before proposing any solution. All workflows in this phase are optional — use them when your idea needs shaping before committing to a plan.
Available skills in this phase:
| Skill | Agent | Purpose |
|---|---|---|
bmad-brainstorming |
Analyst | Guided ideation to explore and refine the idea |
bmad-market-research |
Analyst | Market landscape and competitive analysis |
bmad-domain-research |
Analyst | Deep dive into the problem domain |
bmad-technical-research |
Analyst | Technical feasibility and stack evaluation |
bmad-product-brief |
Analyst | Recommended foundation document when the concept is clear |
bmad-prfaq |
Analyst | Working Backwards challenge to stress-test the product concept |
A typical question set the Analyst agent works through:
- What problem are we solving, and for whom?
- What are the constraints — time, budget, regulation, existing systems?
- What does "done" look like from the business perspective?
- What are the risks if we do nothing?
Phase 2 — Planning (Required)
Once the concept is clear, the PM agent transforms the analysis into a structured Product Requirements Document (PRD):
| Skill | Agent | Output |
|---|---|---|
bmad-create-prd |
PM | PRD.md — requirements, features, acceptance criteria |
The PRD is the single most important document in the BMAD workflow. It defines scope, user stories at a high level, success metrics, and the boundaries of what will and will not be built.
UX Design (Optional)
If the project has a user interface, this is the moment to run the UX design workflow before moving to architecture. The UX Designer agent works from the PRD to define interaction patterns, user flows, and interface specifications:
| Skill | Agent | Output |
|---|---|---|
bmad-create-ux-design |
UX Designer | ux-design-specification.md — user flows, wireframe specs, interaction design |
This step is considered optional by BMAD itself, but skipping it for projects with complex UIs almost always leads to rework during implementation.
Phase 3 — Solutioning (BMAD Method / Enterprise)
With a clear plan and optional UX spec in hand, the Architect agent designs the technical solution:
| Skill | Agent | Output |
|---|---|---|
bmad-create-architecture |
Architect | architecture.md — tech stack, component design, data flows, ADRs |
bmad-create-epics-and-stories |
PM | epics/ — individual story files derived from PRD + architecture |
bmad-check-implementation-readiness |
Architect | Validation report checking cohesion across all planning documents |
A key insight in BMAD v6 is that epics and stories are created after architecture, not before. This matters because architecture decisions — database choices, API patterns, deployment topology — directly affect how work should be broken down. Stories created before architecture tend to be vague; stories created after are concrete and implementable.
Why BMAD Works for These Three Phases
The first three phases are fundamentally about structured thinking and communication. AI agents are exceptional at:
- Asking clarifying questions you might skip under time pressure.
- Surfacing edge cases and risks you have not considered.
- Maintaining consistency across large documents.
- Generating alternatives and trade-off analyses quickly.
BMAD turns what is often an informal, rushed, and error-prone process into a disciplined dialogue. The result is not perfect plans — plans always change — but a shared foundation that makes every downstream decision faster and more confident.
Output Files Created by BMAD
After completing the three planning phases, your project has a well-structured set of artifacts:
your-project/
├── _bmad/ # BMAD agents, workflows, and configuration
└── _bmad-output/
├── planning-artifacts/
│ ├── PRD.md # Product Requirements Document
│ ├── ux-design-specification.md # UX design (if applicable)
│ ├── architecture.md # Architecture decisions and technical design
│ └── epics/ # Individual story files (epic-XX-story-YY.md)
├── implementation-artifacts/
│ └── sprint-status.yaml # Sprint tracking across all epics and stories
└── project-context.md # Implementation rules and conventions (optional)
These files are not throw-away documents. They serve as the living specification that all AI agents reference throughout implementation, ensuring that every story stays aligned with the original requirements and architecture.
Part 2 — The How: Ralph Loop for Implementation, Code Review, and Quality Assurance
What is the Ralph Loop?
The Ralph loop is a tight, iterative cycle that governs the implementation phase of a project. It is named after the principle of continuous feedback and refinement: write, review, improve, repeat. The loop has three steps:
- Implementation: Write the code based on the stories and acceptance criteria from BMAD.
- Code Review: Review the code for correctness, maintainability, security, and alignment with the architecture.
- Quality Assurance: Validate the implementation against acceptance criteria through automated tests, manual testing, and performance checks.
What makes the Ralph loop powerful is that it is designed to run fast and frequently. Each iteration is small — a single story, a single feature, sometimes a single function. Feedback loops are short, defects are caught early, and the cost of change stays low.
Step 1 — Implementation
Implementation in the Ralph loop is not about writing all the code for a feature at once. It is about making the smallest meaningful change that can be verified and reviewed:
- Start from the acceptance criteria defined in the BMAD solutioning phase.
- Write just enough code to satisfy those criteria.
- Commit early and often.
- Use AI coding assistants (like GitHub Copilot) to accelerate the mechanical parts of coding while keeping human judgment on the design decisions.
Step 2 — Code Review
Code review in the Ralph loop is a quality gate, not a formality. Every change goes through review before it is merged. The review checks:
- Correctness: Does the code do what the story says it should?
- Consistency: Does the code follow established patterns and conventions?
- Security: Are there any vulnerabilities introduced by the change?
- Maintainability: Will the next developer (or AI agent) be able to understand and modify this code?
AI tools are increasingly useful here — automated code review agents can catch common issues instantly, leaving human reviewers to focus on higher-level concerns.
Step 3 — Quality Assurance
QA in the Ralph loop is continuous, not a final gate. Instead of a separate QA phase at the end of the project, quality is validated incrementally:
- Unit tests verify individual functions and components.
- Integration tests verify that components work together correctly.
- End-to-end tests verify that the system behaves correctly from the user's perspective.
- Performance and security scans run automatically on every pull request.
When a defect is found, it re-enters the loop at the implementation step — the loop tightens, the fix is small, and the cost remains low.
Combining the Two: The Full Why-and-How Loop
The real power emerges when BMAD and the Ralph loop are treated as a single connected workflow rather than separate methodologies:
BMAD Analysis
↓
BMAD Planning
↓
BMAD Solutioning
↓
Ralph Implementation → Ralph Code Review → Ralph QA
↑_____________________________________________|
The arrow at the bottom represents the iterative nature of the Ralph loop. But notice something important: learnings from the Ralph loop feed back into the BMAD phases. If implementation reveals that the architecture needs adjustment, you update the ADR. If QA reveals that a feature does not actually solve the user problem, you revisit the analysis. The loop is not just technical — it is the full cycle of understanding and building.
Practical Tips for Running the Combined Loop
- Never skip the BMAD phases under time pressure. The time you save by skipping analysis is borrowed — you will pay it back with interest during implementation.
- Keep Ralph loop iterations small. Aim for pull requests that can be reviewed in under 30 minutes. Large pull requests are a sign that a story was too big.
- Automate ruthlessly in the Ralph loop. Every manual quality check that can be automated should be automated. Your attention is a scarce resource — save it for the decisions that require judgment.
- Use AI agents for both loops. BMAD agents help you think clearly. Coding assistants and review agents help you build quickly. They are complements, not competitors.
- Document decisions, not just code. The ADRs from BMAD solutioning are living documents. Update them when the architecture changes. Future team members — and future AI agents — will thank you.
Conclusion
The "why and the how" loop is not a new methodology invented from scratch. It is a recognition that good software development has always required disciplined thinking before disciplined building. BMAD makes the thinking phases rigorous and AI-augmented. The Ralph loop makes the building phases fast and quality-controlled.
Together, they close the gap between "we understand the problem" and "we have shipped the solution" — and they do it in a way that keeps the team aligned, the codebase healthy, and the feedback loops tight.
If you are building complex software and you are not yet combining structured upfront thinking with iterative, quality-gated implementation, the why-and-how loop is worth trying on your next project.
Interested in going deeper? Check out my articles on GitHub Copilot instructions and QA automation for more on the tools that power this workflow.