Skip to content
🤖 Consolidated, AI-optimized BMAD docs: llms-full.txt. Fetch this plain text file for complete context.
🚀 Build your own BMad modules and share them with the community! Get started or submit to the marketplace.

TEA Step-File and Orchestration Architecture

TEA Step-File and Orchestration Architecture

Section titled “TEA Step-File and Orchestration Architecture”

TEA workflows are not one long instruction file. They are a chain of small step files, and some of those steps fan out into isolated workers whose outputs are merged back into a single artifact. This page covers both halves: the step-file format, and the orchestration that runs it.

A single 5000-word instruction file produces a predictable set of failures. The model skims it, improvises past the vague parts (“analyze codebase then generate tests” specifies nothing), keeps going because nothing told it where to stop, and returns a different result on the next run.

Step files break the workflow into self-contained units that each do one thing:

  • One step, one action. Each file contains exactly one task.
  • Explicit exit conditions. The step states what “finished” means.
  • Context injection. Each step restates what it needs, assuming nothing about what the model still remembers.
  • Strict boundaries. Each step lists what it must not do, so out-of-scope work has an explicit prohibition rather than an implicit one.
  • Just-in-time loading. The agent reads one step file, executes it, then loads the next. It never loads them all at once.

The result is consistent output for the same input, which is what makes the rest of the architecture possible: you cannot parallelize work whose boundaries are undefined.

Layout in the repository, per workflow skill:

bmad-testarch-automate/
├── workflow.yaml # Metadata, config source, variables, output paths
├── instructions.md # Entry point
├── checklist.md # Validation checklist
├── resources/ # tea-index.csv + knowledge/ fragments
├── steps-c/ # Create mode, one file per step
├── steps-e/ # Edit mode
└── steps-v/ # Validate mode
# Step N: [Action Name]
## Context (from previous steps)
- What was accomplished in Steps 1 through N-1
- Key information the model needs
- Current state of the workflow
## Your Task (Step N Only)
[One explicit task]
## Requirements
- ✅ Requirement 1, 2, 3
## What You MUST Do
- Action 1, 2, 3
## What You MUST NOT Do
- ❌ Don't do X (that's Step N+1)
- ❌ Don't do Y (out of scope)
## Exit Condition
You may proceed to Step N+1 when:
- ✅ Condition 1, 2, 3 met
Do NOT proceed until all conditions met.
## Next Step
Load `steps-c/step-[N+1]-[action].md` and execute.

A worker step is the same shape with two differences: its exit condition ends the worker rather than advancing the chain, and it writes structured JSON to a temp file for the aggregation step to read:

{
"success": true,
"tests": [
{
"file": "tests/api/auth.spec.ts",
"content": "[full test file content]",
"description": "API tests for Auth feature"
}
],
"fixtures": ["authData", "userData"],
"summary": "Generated 5 API test cases for 3 features"
}

Step frontmatter declares knowledgeIndex: './resources/tea-index.csv', resolved from the skill root, and the step body names the fragments it wants:

Use `{knowledgeIndex}` to load:
1. **fixture-architecture** - composable fixture patterns
2. **api-request** - API test patterns
3. **network-first** - network handling patterns
Generated tests MUST follow these patterns:
✅ Fixture composition (fixture-architecture)
`await apiRequest()` (api-request)
✅ Intercept before navigate (network-first)
❌ Do NOT substitute custom patterns

See Knowledge Base System for how fragments are selected and maintained.

Four workflows ship dedicated worker step files. Four resolve execution mode inside a step but run their work in order. teach-me-testing does neither; it is a sequential, session-based learning flow.

WorkflowShapeWorkersAggregation
automateParallel generationAPI, backend, E2E, mobile test generationMerges tests, fixtures, and summary stats
atddParallel generationFailing API tests, failing E2E testsValidates red-phase output, merges artifacts
test-reviewParallel validationDeterminism, isolation, maintainability, performanceComputes the combined quality score and report
nfr-assessParallel validationSecurity, performance, reliability, maintainabilityComputes overall risk, compliance summary, priority actions
frameworkSequential + probeScaffold work units (structure/config, fixtures, samples)Consolidates the generated framework setup
ciSequential + probePipeline generationOne deterministic pipeline artifact
test-designSequential + probeOutput generationOne deterministic design artifact
traceTwo-phase, orderedPhase 1 builds the coverage matrix; Phase 2 reads it and decides the gateMerges gap analysis with coverage and gate data

Workers are isolated. They exchange nothing directly and communicate only through the structured outputs that the aggregation step validates.

tea_execution_mode picks the orchestration strategy. Default auto.

ModeBehavior
autoProbe capabilities and pick the best supported mode (recommended)
agent-teamPrefer team/delegation orchestration when the runtime supports it
subagentPrefer isolated worker orchestration when the runtime supports it
sequentialRun worker steps one at a time

With tea_capability_probe: true (the default), TEA falls back safely: auto tries agent-team, then subagent, then sequential; an explicitly requested agent-team or subagent falls back to the next supported mode; sequential always stays sequential. With tea_capability_probe: false, TEA honors the requested mode strictly and fails if the runtime cannot execute it.

In agent-team and subagent modes, the runtime decides concurrency and timing. TEA imposes no parallel worker limit of its own.

Recommended configuration:

tea_execution_mode: 'auto'
tea_capability_probe: true

Choose sequential when you need strict single-threaded execution or debugging clarity. Choose agent-team or subagent explicitly only when you want that mode specifically and know your runtime supports it.

Explicit phrasing during a run overrides config for that run only. Normalized terms:

  • agent team, agent teams, agentteamagent-team
  • subagent, subagents, sub agent, sub agentssubagent
  • sequentialsequential
  • autoauto

Precedence: explicit run-level request, then tea_execution_mode in config, then runtime fallback when probing is enabled.

Across every mode TEA holds the same guarantees: the same output schema per workflow, the same validation and aggregation rules, the same deterministic fallback semantics, and the same failure behavior when a worker output is missing or invalid. Mode selection changes orchestration, never artifact contracts.

Parallel dispatch is the reason worker splits exist. The figures below are rough development-run estimates, not a published benchmark; treat them as the shape of the effect rather than as measurements.

WorkflowSequentialParallel workersApprox. change
automate~10 min~5 min~50% faster
test-review~5 min~2 min~60% faster
nfr-assess~12 min~4 min~67% faster

Users do not need to know any of this to run a workflow. What they see is consistent output for the same input, faster runs where parallelism applies, and progress reporting per step:

✓ Step 1: Setup complete
✓ Step 2: Knowledge fragments loaded
⟳ Step 3: Generating tests (2 subagents running)
├── Subagent A: API tests... ✓
└── Subagent B: E2E tests... ✓
✓ Step 4: Aggregating results
✓ Step 5: Validation complete

Every workflow is validated with BMad Builder, which checks for granular instructions, explicit exit conditions, context injection in every step, strict action boundaries, and subagent support where the workflow supports it. Validation runs against the working tree at the time it is invoked, so its output is a point-in-time reading rather than a durable artifact; the reports are not committed. Re-run BMad Builder validation after editing a step file, and read the result from that run.

All nine workflows have been exercised against real projects: teach-me-testing across a multi-session flow with persisted progress, test-design against a real story and epic, automate against real codebases, atdd for the red phase with failing tests confirmed, test-review against known good and bad suites, nfr-assess against a complex system, trace for both the coverage matrix and the gate decision, framework for Playwright and Cypress scaffolds, and ci for GitHub Actions and GitLab CI generation.

Update a step file when knowledge fragments change, a new pattern needs enforcing, the model improvises past an existing boundary, a step is slow enough to warrant splitting or parallelizing, or user feedback says an instruction is ambiguous.

Practices that hold: keep each step to 200-500 words; restate context rather than assuming recall; be explicit (“generate 3-5 test cases”, not “generate some tests”); list forbidden actions rather than implying them; re-run BMad Builder validation after every edit.

Anti-patterns: steps over 1000 words defeat the purpose; vague verbs like “analyze codebase” specify nothing; a missing exit condition leaves no stopping point; assumed knowledge across steps breaks under context pressure; more than one task in a step reintroduces everything step files were built to prevent.

SymptomLikely causeFix
Model still improvisingStep instructions too vagueAdd explicit requirements and forbidden actions
Worker output not aggregatingTemp file path mismatch or malformed JSONCheck the temp file naming convention and validate the JSON shape
Knowledge fragments not appliedFragment loading instructions unclearName the fragments and state the patterns they must produce
Slow despite subagentsNot enough parallelizationIdentify further independent steps to split into workers
Workflow ran in an unexpected modeRun-level override took precedence over configCheck the resolved mode in the workflow execution report
Requested mode did not runRuntime lacked support and fallback changed the modeCheck the resolved mode; disable probing only if you want a hard failure
Workflow failed instead of falling backtea_capability_probe: false with an unsupported modeSet the probe to true, or pick a mode the runtime supports