agent and workflow doc

This commit is contained in:
Brian Madison
2026-01-07 10:28:36 +08:00
parent 51aa3dda2f
commit f838486caa
2 changed files with 181 additions and 87 deletions

View File

@@ -1,89 +1,190 @@
# Workflows
Workflows are structured processes that guide agents through complex tasks. Think of them as recipes that ensure consistent, high-quality outcomes.
Workflows are like prompts on steroids. They harness the untapped power and control of LLMs through progressive disclosure—breaking complex tasks into focused steps that execute sequentially. Instead of random AI slop where you hope for the best, workflows give you repeatable, reliable, high-quality outputs.
## What is a Workflow?
This guide explains what workflows are, why they're powerful, and how to think about designing them.
A workflow is a step-by-step process that agents follow to accomplish specific objectives. A workflow can be a single file if small enough, but more than likely is comprized of a very small workflow or skill definition file with multiple steps and data files that are loaded as needed on demand. Each step file:
---
- Defines a clear goal
- Provides instructions for the agent
- May include decision points or user interactions
- Produces specific outputs
- Progressively at a specific point can load the next proper step.
## What Is a Workflow?
A workflow is a structured process where the AI executes steps sequentially to accomplish a task. Each step has a specific purpose, and the AI moves through them methodically—whether that involves extensive collaboration or minimal user interaction.
Think of it this way: instead of asking "help me build a nutrition plan" and getting a generic response, a workflow guides you (or runs automatically) through discovery, assessment, strategy, shopping lists, and prep schedules—each step building on the last, nothing missed, no shortcuts taken.
### The Power of Progressive Disclosure
Here's why workflows work so well: the AI only sees the current step. It doesn't know about step 5 when it's on step 2. It can't get ahead of itself, skip steps, or lose focus. Each step gets the AI's full attention, completing fully before the next step loads.
This is the opposite of a giant prompt that tries to handle everything at once and inevitably misses details or loses coherence.
Workflows exist on a spectrum:
- **Interactive workflows** guide users through complex decisions via collaboration
- **Automated workflows** run with minimal user input, processing documents or executing tasks
- **Hybrid workflows** combine both—some steps need user input, others run automatically
### Real-World Workflow Examples
**Tax Organizer Workflow**
A tax preparation workflow that helps users organize financial documents for tax filing. Runs in a single session, follows prescriptive IRS categories, produces a checklist of required documents with missing-item alerts. Sequential and compliance-focused.
**Meal Planning Workflow**
Creates personalized weekly meal plans through collaborative nutrition planning. Users can stop mid-session and return later because the workflow tracks progress. Intent-based conversation helps discover preferences rather than following a script. Multi-session, creative, and highly interactive.
**Course Creator Workflow**
Helps instructors design course syllabi. Branches based on course type—academic courses need accreditation sections, vocational courses need certification prep, self-paced courses need different structures entirely.
**Therapy Intake Workflow**
Guides mental health professionals through structured client intake sessions. Highly sensitive and confidential, uses intent-based questioning to build rapport while ensuring all required clinical information is collected. Continuable across multiple sessions.
**Software Architecture Workflow** (BMM Module)
Part of a larger software development pipeline. Runs after product requirements and UX design are complete, takes those documents as input, then collaboratively walks through technical decisions: system components, data flows, technology choices, architectural patterns. Produces an architecture document that implementation teams use to build consistently.
**Shard Document Workflow**
Nearly hands-off automated workflow. Takes a large document as input, uses a custom npx tool to split it into smaller files, deletes the original, then augments an index with content details so the LLM can efficiently find and reference specific sections later. Minimal user interaction—just specify the input document.
These examples show the range: from collaborative creative processes to automated batch jobs, workflows ensure completeness and consistency whether the work involves deep collaboration or minimal human oversight.
### The Facilitative Philosophy
When workflows involve users, they should be **facilitative, not directive**. The AI treats users as partners and domain experts, not as passive recipients of generated content.
**Collaborative dialogue, not command-response**: The AI and user work together throughout. The AI brings structured thinking, methodology, and technical knowledge. The user brings domain expertise, context, and judgment. Together they produce something better than either could alone.
**The user is the expert in their domain**: A nutrition planning workflow doesn't dictate meal plans—it guides users through discovering what works for their lifestyle. An architecture workflow doesn't tell architects what to build—it facilitates systematic decision-making so choices are explicit and consistent.
**Intent-based facilitation**: Workflows should describe goals and approaches, not scripts. Instead of "Ask: What is your age? Then ask: What is your goal weight?" use "Guide the user through understanding their health profile. Ask 1-2 questions at a time. Think about their responses before asking follow-ups. Probe to understand their actual needs."
The AI figures out exact wording and question order based on conversation context. This makes interactions feel natural and responsive rather than robotic and interrogative.
**When to be prescriptive**: Some workflows require exact scripts—medical intake, legal compliance, safety-critical procedures. But these are the exception, not the rule. Default to facilitative intent-based approaches unless compliance or regulation demands otherwise.
---
## Why Workflows Matter
Workflows solve three fundamental problems with AI interactions:
**Focus**: Each step contains only instructions for that phase. The AI sees one step at a time, preventing it from getting ahead of itself or losing focus.
**Continuity**: Workflows can span multiple sessions. Stop mid-workflow and return later without losing progress—something free-form prompts can't do.
**Quality**: Sequential enforcement prevents shortcuts. The AI must complete each step fully before moving on, ensuring thorough, complete outputs instead of rushed, half-baked results.
---
## How Workflows Work
### The Basic Structure
Workflows consist of multiple markdown files, each representing one step:
```
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ Step 1 │ → │ Step 2 │ → Step 3 │ → │ Complete │
│ Discover Define │ Build │ │ Output │
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
my-workflow/
├── workflow.md # Entry point and configuration
├── steps/ # Step files (steps-c/ for create, steps-e/ for edit, steps-v/ for validate)
│ ├── step-01-init.md
│ ├── step-02-profile.md
│ └── step-N-final.md
├── data/ # Reference materials, CSVs, examples
└── templates/ # Output document templates
```
**Key characteristics:**
- **Progressive** - Each step builds on the previous
- **Interactive** - Workflows can pause for user input
- **Reusable** - The same workflow produces consistent results
- **Composable** - Workflow steps can call other workflow steps, or whole other workflows!
- **LLM Reinforcement** - Some rules or info is repeated in each step file ensuring certain rules are always top of agent mind, even during context heavy processes or very long workflows!
The `workflow.md` file is minimal—it contains the workflow name, description, goal, the AI's role, and how to start. Importantly, it does not list all steps or detail what each does. This is progressive disclosure in action.
## Workflow Types
### Sequential Execution
### Planning Workflows
Workflows execute in strict sequence: `step-01 → step-02 → step-03 → ... → step-N`
Generate project artifacts like requirements, architecture, and task breakdowns.
The AI cannot skip steps or optimize the sequence. It must complete each step fully before loading the next. This ensures thoroughness and prevents shortcuts that compromise quality.
**Examples:** Brief creation, PRD authoring, architecture design, sprint planning
### Continuable Workflows
### Execution Workflows
Some workflows are complex enough that users might need multiple sessions. These "continuable workflows" track which steps are complete in the output document's frontmatter, so users can stop and resume later without losing progress.
Guide implementation of specific tasks or features.
Use continuable workflows when:
- The workflow produces large documents
- Multiple sessions are likely
- Complex decisions benefit from reflection
- The workflow has many steps (8+)
**Examples:** Code implementation, code review, testing, deployment
Keep it simple (single-session) when tasks are quick, focused, and can be completed in one sitting.
### Support Workflows
### Workflow Chaining
Handle cross-cutting concerns and creative processes.
Workflows can be chained together where outputs become inputs. The BMM module pipeline is a perfect example:
**Examples:** Brainstorming, retrospectives, root cause analysis
## Progressive Disclosure
BMAD workflows use **progressive disclosure** - each step only knows about its immediate next step and what it is currently meant to do. This:
- Reduces cognitive load on the AI
- Ensures each step gets full attention
- Allows for conditional routing based on previous outcomes
- Makes workflows easier to debug and modify
## Menu-Driven Interaction
Most workflows use interactive menus with standard options:
| Option | Purpose |
| ---------------- | -------------------------------------------------- |
| **[A] Advanced** | Invoke deeper reasoning techniques |
| **[P] Party** | Get multiple agent perspectives |
| **[C] Continue** | Proceed to next step after all writes are complete |
## Workflow Files
Workflows are markdown files with structured frontmatter - this front matter also allows them to easily work as skills and also slash command loaded:
```yaml
---
name: 'my-workflow'
description: 'What this workflow does and when it should be used or loaded automatically (or call out if it should be requested to run explicitly by the user)'
---
```
brainstorming → research → brief → PRD → UX → architecture → epics → sprint-planning
implement-story → review → repeat
```
The content in the workflow file is very minimal, sets up the reinforcement of the agent persona and reminder that it is a facilitator working with a user, lays out rules of processing steps only when told to do a specific step, loads all config file variables needed by the workflow, and then routes to step 1. No other info about other steps should be in this workflow file. Keeping it as small and lean as possible help in compilation as a skill, as overall size of the skill main file (workflow.md) is critical to keep small.
## Creating Custom Workflows
The **BMAD Builder (BMB)** module includes workflows for creating custom workflows. See [BMB Documentation](../modules/bmb-bmad-builder/) for details.
Each workflow checks for required inputs from prior workflows, validates they're complete, and produces output for the next workflow. This creates powerful end-to-end pipelines for complex processes.
---
**Next:** Learn about [Modules](./modules.md) to see how agents and workflows are organized.
## Design Decisions
Before building a workflow, answer these questions:
**Module affiliation**: Is this standalone or part of a module? Module-based workflows can access module-specific variables and reference other workflow outputs.
**Continuable or single-session?**: Will users need multiple sessions, or can this be completed in one sitting?
**Edit/Validate support?**: Do you need Create/Edit/Validate modes (tri-modal structure)? Use tri-modal for complex, critical workflows requiring quality assurance. Use create-only for simple, one-off workflows.
**Document output?**: Does this produce a persistent file, or perform actions without output?
**Intent or prescriptive?**: Is this intent-based facilitation (most workflows) or prescriptive compliance (medical, legal, regulated)?
---
## Learning from Examples
The best way to understand workflows is to study real examples. Look at the official BMAD modules:
- **BMB (Module Builder)**: Workflow and agent creation workflows
- **BMM (Business Method Module)**: Complete software development pipeline from brainstorming through sprint planning
- **BMGD (Game Development Module)**: Game design briefs, narratives, architecture
- **CIS (Creativity, Innovation, Strategy)**: Brainstorming, design thinking, storytelling, innovation strategy
Study the workflow.md files to understand how each workflow starts. Examine step files to see how instructions are structured. Notice the frontmatter variables, menu handling, and how steps chain together.
Copy patterns that work. Adapt them to your domain. The structure is consistent across all workflows—the content and steps change, but the architecture stays the same.
---
## When to Use Workflows
Use workflows when:
- **Tasks are multi-step and complex**: Break down complexity into manageable pieces
- **Quality and completeness matter**: Sequential enforcement ensures nothing gets missed
- **Repeatability is important**: Get consistent results every time
- **Tasks span multiple sessions**: Continuable workflows preserve progress
- **You need to chain processes**: Output of one workflow becomes input of another
- **Compliance or standards matter**: Enforce required steps and documentation
Don't use workflows when:
- **Tasks are simple and one-off**: A single prompt works fine for quick questions
- **Flexibility trumps structure**: Free-form conversation is better for exploration
- **Tasks are truly one-step**: If there's only one thing to do, a workflow is overkill
---
## The Bottom Line
Workflows transform AI from a tool that gives variable, unpredictable results into a reliable system for complex, multi-step processes. Through progressive disclosure, sequential execution, and thoughtful design, workflows give you control and repeatability that prompts alone can't match.
They're not just for software development. You can create workflows for meal planning, course design, therapy intake, tax preparation, document processing, creative writing, event planning—any complex task that benefits from structure and thoroughness.
Start simple. Study examples. Build workflows for your own domain. You'll wonder how you ever got by with just prompts.

View File

@@ -11,7 +11,6 @@ The BMAD Builder (BMB) module provides an interactive workflow that guides you t
**Prerequisites:**
- BMAD installed with the BMB module
- An idea for what you want your agent to do
- About 15-30 minutes for your first agent
**Know Before You Go:**
- What problem should your agent solve?
@@ -22,28 +21,22 @@ The BMAD Builder (BMB) module provides an interactive workflow that guides you t
### 1. Start the Workflow
In your IDE (Claude Code, Cursor, etc.), invoke the create-agent workflow:
```
"Run the BMAD Builder create-agent workflow"
```
Or trigger it via the BMAD Master menu.
In your IDE (Claude Code, Cursor, etc.), invoke the create-agent workflow with the agent-builder agent.
### 2. Follow the Steps
The workflow guides you through:
| Step | What You'll Do |
|------|----------------|
| **Brainstorm** (optional) | Explore ideas with creative techniques |
| **Discovery** | Define the agent's purpose and goals |
| **Type & Metadata** | Choose Simple or Expert, name your agent |
| **Persona** | Craft the agent's personality and principles |
| **Commands** | Define what the agent can do |
| **Activation** | Set up autonomous behaviors (optional) |
| **Build** | Generate the agent file |
| **Validation** | Review and verify everything works |
| Step | What You'll Do |
| ------------------------- | -------------------------------------------- |
| **Brainstorm** (optional) | Explore ideas with creative techniques |
| **Discovery** | Define the agent's purpose and goals |
| **Type & Metadata** | Choose Simple or Expert, name your agent |
| **Persona** | Craft the agent's personality and principles |
| **Commands** | Define what the agent can do |
| **Activation** | Set up autonomous behaviors (optional) |
| **Build** | Generate the agent file |
| **Validation** | Review and verify everything works |
### 3. Install Your Agent
@@ -96,12 +89,12 @@ The workflow will help you decide, but here's the quick reference:
Your agent's personality is defined by four fields:
| Field | Purpose | Example |
|-------|---------|---------|
| **Role** | What they do | "Senior code reviewer who catches bugs and suggests improvements" |
| **Identity** | Who they are | "Friendly but exacting, believes clean code is a craft" |
| **Communication Style** | How they speak | "Direct, constructive, explains the 'why' behind suggestions" |
| **Principles** | Why they act | "Security first, clarity over cleverness, test what you fix" |
| Field | Purpose | Example |
| ----------------------- | -------------- | ----------------------------------------------------------------- |
| **Role** | What they do | "Senior code reviewer who catches bugs and suggests improvements" |
| **Identity** | Who they are | "Friendly but exacting, believes clean code is a craft" |
| **Communication Style** | How they speak | "Direct, constructive, explains the 'why' behind suggestions" |
| **Principles** | Why they act | "Security first, clarity over cleverness, test what you fix" |
**Key:** Keep each field focused on its purpose. The role isn't personality; the identity isn't job description.