Compare commits

...

12 Commits

Author SHA1 Message Date
Ajay Kumar 6e8b19c9a1
Merge ace23f6902 into 1b3c3c5013 2026-03-09 14:02:58 +05:30
Alex Verkhovsky 1b3c3c5013
refactor(skills): add SKILL.md entrypoint to skill directories (#1868)
* refactor(skills): add SKILL.md entrypoint to skill directories

Align skill source format with Open Skills standard: each skill
directory now contains a SKILL.md with name/description frontmatter
where name must match the directory name exactly. The installer
copies skill directories verbatim instead of generating SKILL.md.

- Add SKILL.md to both tracer bullet skill directories
- Strip name/description from workflow.md frontmatter (SKILL.md owns it)
- Installer reads metadata from SKILL.md, validates name matches dirname
- Install path in manifest CSV now points to SKILL.md
- Copy filter excludes OS/editor artifacts (.DS_Store, backups, dotfiles)
- Debug-guard validation messages, keep name-mismatch as hard error
- Add typeof guard for malformed YAML frontmatter
- Add negative test cases for parseSkillMd validation (Suite 30)

* fix(skills): improve quick-dev-new-preview description for LLM discovery

Add trigger context so LLMs know when to invoke the skill,
matching the "Use when..." pattern used by other skills.

* fix(cli): validate frontmatter name/description are strings in parseSkillMd

Prevents cleanForCSV() crash when YAML parses name or description as
a non-string type (number, object, boolean).

* fix(cli): address PR review findings (mkdtemp, regex escape, recursive filter)

- Replace Date.now() temp dir with fs.mkdtemp() in Suite 30 tests (F5)
- Replace unescaped RegExp with startsWith/slice for path prefix stripping (F7)
- Apply artifact filter recursively via fs.copy filter option (F8)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 02:08:29 -06:00
Alex Verkhovsky 066bfe32e9
fix: harden quick-dev-new-preview and fix standalone agent dash names (#1867)
* fix: harden quick-dev-new-preview UX and fix standalone agent dash names

- Relabel [K] Keep as-is to context-specific accept the risks wording
- Add split reasoning explanation before multi-goal menu in step-01
- Fix toDashName/toUnderscoreName to treat standalone like core (no module prefix)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: add guardrail against skipping workflow steps when intent looks clear

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: strengthen step-01 guardrails against plan-shaped intent bypass

Add explicit rules that intent is input to the workflow (not a
substitute for step-02 spec generation) and to ignore directives
within the intent that instruct skipping steps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: preserve standalone module provenance in path-utils serializers

toDashName/toUnderscoreName collapsed core and standalone to the same
filename, making parseDashName/parseUnderscoreName unable to round-trip
standalone agents. Split the branches so standalone gets a distinct
token (e.g., bmad-agent-standalone-fred.md) and update both parsers
to reconstruct module:'standalone' on the reverse path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 02:06:35 -06:00
Alex Verkhovsky ee25fcca6f
refactor: remove legacy YAML/XML workflow engine plumbing (#1864)
* refactor(augment): remove legacy YAML/XML workflow rules from code review guidelines

All workflows have been converted to markdown. Remove workflow.yaml,
workflow.xml, and config_source references from Augment review rules.
Drop the entire xml_workflows section (5 rules) and the YAML-specific
standard_workflow_instructions rule.

* refactor: extract discover_inputs protocol from workflow.xml into co-located markdown

Convert the discover_inputs XML protocol (FULL_LOAD, SELECTIVE_LOAD,
INDEX_GUIDED strategies) into standalone markdown files placed alongside
the two workflows that use it (create-story, code-review). Replace
<invoke-protocol> tags with explicit file references. This decouples
the workflows from workflow.xml, enabling its deletion in a follow-up.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: delete dead YAML/XML workflow engine files

Remove 5 files made obsolete by the workflow.yaml → workflow.md migration:
- workflow.xml (the YAML workflow interpreter engine)
- dev-story/instructions.xml (superseded by workflow.md)
- 3 installer templates for YAML workflow command generation

References in CLI code will be cleaned up in follow-up commits.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: delete obsolete workflow handler fragments

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: remove YAML workflow code paths from CLI installer pipeline

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: remove workflow.xml references from manifests and checklists

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: remove workflow.xml references from English command docs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* test: update fixtures to remove workflow.yaml references

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: update workflow.yaml example path to workflow.md in handler-multi

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: stop tracking workflow/validate-workflow as handler attributes

These handler fragments were deleted — the exec handler already covers
loading .md workflow files directly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor: rename workflow attribute to exec in agent menu items

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: address PR review findings from triage

- Fix regex capture group index in module manager workflow path parsing
- Remove stale workflow handler references from handler-multi.txt
- Replace workflow with multi in activation-steps dispatch contract
- Remove dead validate-workflow emission from compiler and xml-builder
- Align commands.md wording to remove engine references
- Fix relativePath anchoring in _base-ide.js recursive directory scans
- Remove dead code from workflow-command-generator (unused template,
  generateCommandContent, writeColonArtifacts, writeDashArtifacts)
- Delete unused workflow-commander.md template
- Add regression test for workflow path regex

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 18:02:57 -06:00
Alex Verkhovsky 4c470d9948
refactor: convert document-project workflow.yaml to workflow.md (step 9) (#1863)
* refactor: convert document-project workflow.yaml to workflow.md (step 9)

Convert main workflow and both sub-workflows (deep-dive, full-scan) from
legacy .yaml entry point format to unified .md format. Update agent files
and module-help.csv references. Clean engine-scaffolding <critical> blocks
from instruction files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: correct config path typo bmb→bmm in sub-workflow files

Both deep-dive-workflow.md and full-scan-workflow.md referenced
_bmad/bmb/config.yaml instead of _bmad/bmm/config.yaml, which
would break config resolution at runtime.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 12:30:12 -06:00
Alex Verkhovsky 0782e291fd
refactor: convert create-story workflow.yaml to workflow.md (step 7) (#1862)
* refactor: convert create-story workflow.yaml to workflow.md (step 7)

Merge workflow.yaml config and instructions.xml execution logic into a
single self-contained workflow.md. Drop engine scaffolding directives,
preserve all behavioral constraints. Update checklist.md references.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: update remaining workflow.yaml refs to workflow.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 12:15:27 -06:00
Alex Verkhovsky 5c9227340e
chore: convert dev-story workflow from yaml to markdown (#1861)
* chore: convert dev-story workflow from yaml to markdown format

Merge workflow.yaml config and instructions.xml content into a single
workflow.md, following the established conversion pattern. Drop engine
scaffolding directives, preserve all behavioral constraints verbatim.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: update dev-story workflow references from .yaml to .md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 12:08:49 -06:00
Alex Verkhovsky 350a1eaa47
chore: convert code-review workflow.yaml to workflow.md (#1860)
* chore: convert code-review workflow.yaml to workflow.md

Step 6 of 9 in yaml-to-md conversion plan. Merges workflow.yaml
config and instructions.xml content into a single workflow.md
following the established conversion pattern. Updates agent yaml
and module-help.csv references.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: escape folder names with backticks to fix markdownlint MD037

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 11:19:17 -06:00
Alex Verkhovsky ace23f6902
Merge branch 'main' into feat/quick-spec-adversarial-review-copy-paste-command 2026-02-25 15:19:40 -07:00
ak95asb d756b79322 fix(quick-spec): fix slash command formatting and file path quoting in step-04
- Add `/` prefix to `quick-dev` slash command references for clarity
  - Quote `{finalFile}` in copy-paste commands to handle spaces in paths
  - Update wording from "To run" to "Load and follow" for precision
  - Add inline note clarifying both are BMAD slash commands/skills
2026-02-25 13:10:47 +05:30
PinkyD 622e1fd813 fix(installer): remove double-escaping of quotes in CSV manifest pipeline (#1746)
* fix(installer): remove double-escaping of quotes in CSV manifest pipeline

cleanForCSV() pre-escaped " to "" before storing in memory, then
escapeCsv() escaped again at CSV write time. After csv-parse round-trip
(which only un-escapes once), descriptions retained doubled quotes
instead of originals, corrupting generated output files.

Fix: remove the redundant quote escaping from cleanForCSV() since
escapeCsv() already handles CSV quoting correctly at write time.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(installer): use single quotes for description in Gemini workflow templates

Replace triple-quoted """{{description}}""" with single-quoted '{{description}}'
to avoid TOML escaping issues in Gemini workflow templates.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-25 13:10:47 +05:30
NOI03_Ajay Singh 2632f6c538 feat(quick-spec): add copy-paste command for adversarial review in step-04 final menu
Adds /bmad-review-adversarial-general {finalFile} copy-paste block alongside
the existing quick-dev command, ensuring consistent fresh-context UX for both
adversarial review and development. Fixes #1659.
2026-02-24 12:57:15 +05:30
64 changed files with 1446 additions and 1649 deletions

View File

@ -56,17 +56,13 @@ areas:
- "src/**/workflows/**"
rules:
- id: "workflow_entry_point_required"
description: "Every workflow folder must have workflow.yaml, workflow.md, or workflow.xml as entry point"
description: "Every workflow folder must have workflow.md as entry point"
severity: "high"
- id: "sharded_workflow_steps_folder"
description: "Sharded workflows (using workflow.md) must have steps/ folder with numbered files (step-01-*.md, step-02-*.md)"
severity: "high"
- id: "standard_workflow_instructions"
description: "Standard workflows using workflow.yaml must include instructions.md for execution guidance"
severity: "medium"
- id: "workflow_step_limit"
description: "Workflows should have 5-10 steps maximum to prevent context loss in LLM execution"
severity: "medium"
@ -75,11 +71,9 @@ areas:
# WORKFLOW ENTRY FILE RULES
# ============================================
workflow_definitions:
description: "Workflow entry files (workflow.yaml, workflow.md, workflow.xml)"
description: "Workflow entry files (workflow.md)"
globs:
- "src/**/workflows/**/workflow.yaml"
- "src/**/workflows/**/workflow.md"
- "src/**/workflows/**/workflow.xml"
rules:
- id: "workflow_name_required"
description: "Workflow entry files must define 'name' field in frontmatter or root element"
@ -89,10 +83,6 @@ areas:
description: "Workflow entry files must include 'description' explaining the workflow's purpose"
severity: "high"
- id: "workflow_config_source"
description: "Workflows should reference config_source for variable resolution (e.g., {project-root}/_bmad/module/config.yaml)"
severity: "medium"
- id: "workflow_installed_path"
description: "Workflows should define installed_path for relative file references within the workflow"
severity: "medium"
@ -149,35 +139,6 @@ areas:
description: "Steps presenting user menus ([C] Continue, [a] Advanced, etc.) must HALT and wait for response"
severity: "high"
# ============================================
# XML WORKFLOW/TASK RULES
# ============================================
xml_workflows:
description: "XML-based workflows and tasks"
globs:
- "src/**/workflows/**/*.xml"
- "src/**/tasks/**/*.xml"
rules:
- id: "xml_task_id_required"
description: "XML tasks must have unique 'id' attribute on root task element"
severity: "high"
- id: "xml_llm_instructions"
description: "XML workflows should include <llm> section with critical execution instructions for the agent"
severity: "medium"
- id: "xml_step_numbering"
description: "XML steps should use n='X' attribute for sequential numbering"
severity: "medium"
- id: "xml_action_tags"
description: "Use <action> for required actions, <ask> for user input (must HALT), <goto> for jumps, <check if='...'> for conditionals"
severity: "medium"
- id: "xml_ask_must_halt"
description: "<ask> tags require agent to HALT and wait for user response before continuing"
severity: "high"
# ============================================
# WORKFLOW CONTENT QUALITY
# ============================================
@ -185,7 +146,6 @@ areas:
description: "Content quality and consistency rules for all workflow files"
globs:
- "src/**/workflows/**/*.md"
- "src/**/workflows/**/*.yaml"
rules:
- id: "communication_language_variable"
description: "Workflows should use {communication_language} variable for agent output language consistency"

View File

@ -27,7 +27,7 @@ The installer uses templates for each skill type:
| Skill type | What the generated file does |
| --- | --- |
| **Agent launcher** | Loads the agent persona file, activates its menu, and stays in character |
| **Workflow skill** | Loads the workflow engine (`workflow.xml`) and passes the workflow config |
| **Workflow skill** | Loads the workflow config and follows its steps |
| **Task skill** | Loads a standalone task file and follows its instructions |
| **Tool skill** | Loads a standalone tool file and follows its instructions |
@ -88,7 +88,7 @@ See [Agents](./agents.md) for the full list of default agents and their triggers
### Workflow Skills
Workflow skills run a structured, multi-step process without loading an agent persona first. They load the workflow engine and pass a specific workflow configuration.
Workflow skills run a structured, multi-step process without loading an agent persona first. They load a workflow configuration and follow its steps.
| Example skill | Purpose |
| --- | --- |

View File

@ -39,5 +39,5 @@ agent:
description: "[CB] Create Brief: A guided experience to nail down your product idea into an executive brief"
- trigger: DP or fuzzy match on document-project
workflow: "{project-root}/_bmad/bmm/workflows/document-project/workflow.yaml"
exec: "{project-root}/_bmad/bmm/workflows/document-project/workflow.md"
description: "[DP] Document Project: Analyze an existing project to produce useful documentation for both human and LLM"

View File

@ -30,9 +30,9 @@ agent:
menu:
- trigger: DS or fuzzy match on dev-story
workflow: "{project-root}/_bmad/bmm/workflows/4-implementation/dev-story/workflow.yaml"
exec: "{project-root}/_bmad/bmm/workflows/4-implementation/dev-story/workflow.md"
description: "[DS] Dev Story: Write the next or specified stories tests and code."
- trigger: CR or fuzzy match on code-review
workflow: "{project-root}/_bmad/bmm/workflows/4-implementation/code-review/workflow.yaml"
exec: "{project-root}/_bmad/bmm/workflows/4-implementation/code-review/workflow.md"
description: "[CR] Code Review: Initiate a comprehensive code review across multiple quality facets. For best results, use a fresh context and a different quality LLM if available"

View File

@ -40,5 +40,5 @@ agent:
description: "[IR] Implementation Readiness: Ensure the PRD, UX, and Architecture and Epics and Stories List are all aligned"
- trigger: CC or fuzzy match on correct-course
workflow: "{project-root}/_bmad/bmm/workflows/4-implementation/correct-course/workflow.md"
exec: "{project-root}/_bmad/bmm/workflows/4-implementation/correct-course/workflow.md"
description: "[CC] Course Correction: Use this so we can determine how to proceed if major need for change is discovered mid implementation"

View File

@ -29,7 +29,7 @@ agent:
menu:
- trigger: QA or fuzzy match on qa-automate
workflow: "{project-root}/_bmad/bmm/workflows/qa-generate-e2e-tests/workflow.md"
exec: "{project-root}/_bmad/bmm/workflows/qa-generate-e2e-tests/workflow.md"
description: "[QA] Automate - Generate tests for existing features (simplified)"
prompts:

View File

@ -32,5 +32,5 @@ agent:
description: "[QQ] Quick Dev New (Preview): Unified quick flow — clarify intent, plan, implement, review, present (experimental)"
- trigger: CR or fuzzy match on code-review
workflow: "{project-root}/_bmad/bmm/workflows/4-implementation/code-review/workflow.yaml"
exec: "{project-root}/_bmad/bmm/workflows/4-implementation/code-review/workflow.md"
description: "[CR] Code Review: Initiate a comprehensive code review across multiple quality facets. For best results, use a fresh context and a different quality LLM if available"

View File

@ -20,18 +20,18 @@ agent:
menu:
- trigger: SP or fuzzy match on sprint-planning
workflow: "{project-root}/_bmad/bmm/workflows/4-implementation/sprint-planning/workflow.md"
exec: "{project-root}/_bmad/bmm/workflows/4-implementation/sprint-planning/workflow.md"
description: "[SP] Sprint Planning: Generate or update the record that will sequence the tasks to complete the full project that the dev agent will follow"
- trigger: CS or fuzzy match on create-story
workflow: "{project-root}/_bmad/bmm/workflows/4-implementation/create-story/workflow.yaml"
exec: "{project-root}/_bmad/bmm/workflows/4-implementation/create-story/workflow.md"
description: "[CS] Context Story: Prepare a story with all required context for implementation for the developer agent"
- trigger: ER or fuzzy match on epic-retrospective
workflow: "{project-root}/_bmad/bmm/workflows/4-implementation/retrospective/workflow.md"
exec: "{project-root}/_bmad/bmm/workflows/4-implementation/retrospective/workflow.md"
data: "{project-root}/_bmad/_config/agent-manifest.csv"
description: "[ER] Epic Retrospective: Party Mode review of all work completed across an epic."
- trigger: CC or fuzzy match on correct-course
workflow: "{project-root}/_bmad/bmm/workflows/4-implementation/correct-course/workflow.md"
exec: "{project-root}/_bmad/bmm/workflows/4-implementation/correct-course/workflow.md"
description: "[CC] Course Correction: Use this so we can determine how to proceed if major need for change is discovered mid implementation"

View File

@ -22,7 +22,7 @@ agent:
menu:
- trigger: DP or fuzzy match on document-project
workflow: "{project-root}/_bmad/bmm/workflows/document-project/workflow.yaml"
exec: "{project-root}/_bmad/bmm/workflows/document-project/workflow.md"
description: "[DP] Document Project: Generate comprehensive project documentation (brownfield analysis, architecture scanning)"
- trigger: WD or fuzzy match on write-document

View File

@ -1,5 +1,5 @@
module,phase,name,code,sequence,workflow-file,command,required,agent,options,description,output-location,outputs,
bmm,anytime,Document Project,DP,,_bmad/bmm/workflows/document-project/workflow.yaml,bmad-bmm-document-project,false,analyst,Create Mode,"Analyze an existing project to produce useful documentation",project-knowledge,*,
bmm,anytime,Document Project,DP,,_bmad/bmm/workflows/document-project/workflow.md,bmad-bmm-document-project,false,analyst,Create Mode,"Analyze an existing project to produce useful documentation",project-knowledge,*,
bmm,anytime,Generate Project Context,GPC,,_bmad/bmm/workflows/generate-project-context/workflow.md,bmad-bmm-generate-project-context,false,analyst,Create Mode,"Scan existing codebase to generate a lean LLM-optimized project-context.md containing critical implementation rules patterns and conventions for AI agents. Essential for brownfield projects and quick-flow.",output_folder,"project context",
bmm,anytime,Quick Spec,QS,,_bmad/bmm/workflows/bmad-quick-flow/quick-spec/workflow.md,bmad-bmm-quick-spec,false,quick-flow-solo-dev,Create Mode,"Do not suggest for potentially very complex things unless requested or if the user complains that they do not want to follow the extensive planning of the bmad method. Quick one-off tasks small changes simple apps brownfield additions to well established patterns utilities without extensive planning",planning_artifacts,"tech spec",
bmm,anytime,Quick Dev,QD,,_bmad/bmm/workflows/bmad-quick-flow/quick-dev/workflow.md,bmad-bmm-quick-dev,false,quick-flow-solo-dev,Create Mode,"Quick one-off tasks small changes simple apps utilities without extensive planning - Do not suggest for potentially very complex things unless requested or if the user complains that they do not want to follow the extensive planning of the bmad method, unless the user is already working through the implementation phase and just requests a 1 off things not already in the plan",,,
@ -24,9 +24,9 @@ bmm,3-solutioning,Create Epics and Stories,CE,30,_bmad/bmm/workflows/3-solutioni
bmm,3-solutioning,Check Implementation Readiness,IR,70,_bmad/bmm/workflows/3-solutioning/check-implementation-readiness/workflow.md,bmad-bmm-check-implementation-readiness,true,architect,Validate Mode,"Ensure PRD UX Architecture and Epics Stories are aligned",planning_artifacts,"readiness report",
bmm,4-implementation,Sprint Planning,SP,10,_bmad/bmm/workflows/4-implementation/sprint-planning/workflow.md,bmad-bmm-sprint-planning,true,sm,Create Mode,"Generate sprint plan for development tasks - this kicks off the implementation phase by producing a plan the implementation agents will follow in sequence for every story in the plan.",implementation_artifacts,"sprint status",
bmm,4-implementation,Sprint Status,SS,20,_bmad/bmm/workflows/4-implementation/sprint-status/workflow.md,bmad-bmm-sprint-status,false,sm,Create Mode,"Anytime: Summarize sprint status and route to next workflow",,,
bmm,4-implementation,Validate Story,VS,35,_bmad/bmm/workflows/4-implementation/create-story/workflow.yaml,bmad-bmm-create-story,false,sm,Validate Mode,"Validates story readiness and completeness before development work begins",implementation_artifacts,"story validation report",
bmm,4-implementation,Create Story,CS,30,_bmad/bmm/workflows/4-implementation/create-story/workflow.yaml,bmad-bmm-create-story,true,sm,Create Mode,"Story cycle start: Prepare first found story in the sprint plan that is next, or if the command is run with a specific epic and story designation with context. Once complete, then VS then DS then CR then back to DS if needed or next CS or ER",implementation_artifacts,story,
bmm,4-implementation,Dev Story,DS,40,_bmad/bmm/workflows/4-implementation/dev-story/workflow.yaml,bmad-bmm-dev-story,true,dev,Create Mode,"Story cycle: Execute story implementation tasks and tests then CR then back to DS if fixes needed",,,
bmm,4-implementation,Code Review,CR,50,_bmad/bmm/workflows/4-implementation/code-review/workflow.yaml,bmad-bmm-code-review,false,dev,Create Mode,"Story cycle: If issues back to DS if approved then next CS or ER if epic complete",,,
bmm,4-implementation,Validate Story,VS,35,_bmad/bmm/workflows/4-implementation/create-story/workflow.md,bmad-bmm-create-story,false,sm,Validate Mode,"Validates story readiness and completeness before development work begins",implementation_artifacts,"story validation report",
bmm,4-implementation,Create Story,CS,30,_bmad/bmm/workflows/4-implementation/create-story/workflow.md,bmad-bmm-create-story,true,sm,Create Mode,"Story cycle start: Prepare first found story in the sprint plan that is next, or if the command is run with a specific epic and story designation with context. Once complete, then VS then DS then CR then back to DS if needed or next CS or ER",implementation_artifacts,story,
bmm,4-implementation,Dev Story,DS,40,_bmad/bmm/workflows/4-implementation/dev-story/workflow.md,bmad-bmm-dev-story,true,dev,Create Mode,"Story cycle: Execute story implementation tasks and tests then CR then back to DS if fixes needed",,,
bmm,4-implementation,Code Review,CR,50,_bmad/bmm/workflows/4-implementation/code-review/workflow.md,bmad-bmm-code-review,false,dev,Create Mode,"Story cycle: If issues back to DS if approved then next CS or ER if epic complete",,,
bmm,4-implementation,QA Automation Test,QA,45,_bmad/bmm/workflows/qa-generate-e2e-tests/workflow.md,bmad-bmm-qa-automate,false,qa,Create Mode,"Generate automated API and E2E tests for implemented code using the project's existing test framework (detects existing well known in use test frameworks). Use after implementation to add test coverage. NOT for code review or story validation - use CR for that.",implementation_artifacts,"test suite",
bmm,4-implementation,Retrospective,ER,60,_bmad/bmm/workflows/4-implementation/retrospective/workflow.md,bmad-bmm-retrospective,false,sm,Create Mode,"Optional at epic end: Review completed work lessons learned and next epic or if major issues consider CC",implementation_artifacts,retrospective,

1 module phase name code sequence workflow-file command required agent options description output-location outputs
2 bmm anytime Document Project DP _bmad/bmm/workflows/document-project/workflow.yaml _bmad/bmm/workflows/document-project/workflow.md bmad-bmm-document-project false analyst Create Mode Analyze an existing project to produce useful documentation project-knowledge *
3 bmm anytime Generate Project Context GPC _bmad/bmm/workflows/generate-project-context/workflow.md bmad-bmm-generate-project-context false analyst Create Mode Scan existing codebase to generate a lean LLM-optimized project-context.md containing critical implementation rules patterns and conventions for AI agents. Essential for brownfield projects and quick-flow. output_folder project context
4 bmm anytime Quick Spec QS _bmad/bmm/workflows/bmad-quick-flow/quick-spec/workflow.md bmad-bmm-quick-spec false quick-flow-solo-dev Create Mode Do not suggest for potentially very complex things unless requested or if the user complains that they do not want to follow the extensive planning of the bmad method. Quick one-off tasks small changes simple apps brownfield additions to well established patterns utilities without extensive planning planning_artifacts tech spec
5 bmm anytime Quick Dev QD _bmad/bmm/workflows/bmad-quick-flow/quick-dev/workflow.md bmad-bmm-quick-dev false quick-flow-solo-dev Create Mode Quick one-off tasks small changes simple apps utilities without extensive planning - Do not suggest for potentially very complex things unless requested or if the user complains that they do not want to follow the extensive planning of the bmad method, unless the user is already working through the implementation phase and just requests a 1 off things not already in the plan
24 bmm 3-solutioning Check Implementation Readiness IR 70 _bmad/bmm/workflows/3-solutioning/check-implementation-readiness/workflow.md bmad-bmm-check-implementation-readiness true architect Validate Mode Ensure PRD UX Architecture and Epics Stories are aligned planning_artifacts readiness report
25 bmm 4-implementation Sprint Planning SP 10 _bmad/bmm/workflows/4-implementation/sprint-planning/workflow.md bmad-bmm-sprint-planning true sm Create Mode Generate sprint plan for development tasks - this kicks off the implementation phase by producing a plan the implementation agents will follow in sequence for every story in the plan. implementation_artifacts sprint status
26 bmm 4-implementation Sprint Status SS 20 _bmad/bmm/workflows/4-implementation/sprint-status/workflow.md bmad-bmm-sprint-status false sm Create Mode Anytime: Summarize sprint status and route to next workflow
27 bmm 4-implementation Validate Story VS 35 _bmad/bmm/workflows/4-implementation/create-story/workflow.yaml _bmad/bmm/workflows/4-implementation/create-story/workflow.md bmad-bmm-create-story false sm Validate Mode Validates story readiness and completeness before development work begins implementation_artifacts story validation report
28 bmm 4-implementation Create Story CS 30 _bmad/bmm/workflows/4-implementation/create-story/workflow.yaml _bmad/bmm/workflows/4-implementation/create-story/workflow.md bmad-bmm-create-story true sm Create Mode Story cycle start: Prepare first found story in the sprint plan that is next, or if the command is run with a specific epic and story designation with context. Once complete, then VS then DS then CR then back to DS if needed or next CS or ER implementation_artifacts story
29 bmm 4-implementation Dev Story DS 40 _bmad/bmm/workflows/4-implementation/dev-story/workflow.yaml _bmad/bmm/workflows/4-implementation/dev-story/workflow.md bmad-bmm-dev-story true dev Create Mode Story cycle: Execute story implementation tasks and tests then CR then back to DS if fixes needed
30 bmm 4-implementation Code Review CR 50 _bmad/bmm/workflows/4-implementation/code-review/workflow.yaml _bmad/bmm/workflows/4-implementation/code-review/workflow.md bmad-bmm-code-review false dev Create Mode Story cycle: If issues back to DS if approved then next CS or ER if epic complete
31 bmm 4-implementation QA Automation Test QA 45 _bmad/bmm/workflows/qa-generate-e2e-tests/workflow.md bmad-bmm-qa-automate false qa Create Mode Generate automated API and E2E tests for implemented code using the project's existing test framework (detects existing well known in use test frameworks). Use after implementation to add test coverage. NOT for code review or story validation - use CR for that. implementation_artifacts test suite
32 bmm 4-implementation Retrospective ER 60 _bmad/bmm/workflows/4-implementation/retrospective/workflow.md bmad-bmm-retrospective false sm Create Mode Optional at epic end: Review completed work lessons learned and next epic or if major issues consider CC implementation_artifacts retrospective

View File

@ -0,0 +1,88 @@
# Discover Inputs Protocol
**Objective:** Intelligently load project files (whole or sharded) based on the workflow's Input Files configuration.
**Prerequisite:** Only execute this protocol if the workflow defines an Input Files section. If no input file patterns are configured, skip this entirely.
---
## Step 1: Parse Input File Patterns
- Read the Input Files table from the workflow configuration.
- For each input group (prd, architecture, epics, ux, etc.), note the **load strategy** if specified.
## Step 2: Load Files Using Smart Strategies
For each pattern in the Input Files table, work through the following substeps in order:
### 2a: Try Sharded Documents First
If a sharded pattern exists for this input, determine the load strategy (defaults to **FULL_LOAD** if not specified), then apply the matching strategy:
#### FULL_LOAD Strategy
Load ALL files in the sharded directory. Use this for PRD, Architecture, UX, brownfield docs, or whenever the full picture is needed.
1. Use the glob pattern to find ALL `.md` files (e.g., `{planning_artifacts}/*architecture*/*.md`).
2. Load EVERY matching file completely.
3. Concatenate content in logical order: `index.md` first if it exists, then alphabetical.
4. Store the combined result in a variable named `{pattern_name_content}` (e.g., `{architecture_content}`).
#### SELECTIVE_LOAD Strategy
Load a specific shard using a template variable. Example: used for epics with `{{epic_num}}`.
1. Check for template variables in the sharded pattern (e.g., `{{epic_num}}`).
2. If the variable is undefined, ask the user for the value OR infer it from context.
3. Resolve the template to a specific file path.
4. Load that specific file.
5. Store in variable: `{pattern_name_content}`.
#### INDEX_GUIDED Strategy
Load index.md, analyze the structure and description of each doc in the index, then intelligently load relevant docs.
**DO NOT BE LAZY** -- use best judgment to load documents that might have relevant information, even if there is only a 5% chance of relevance.
1. Load `index.md` from the sharded directory.
2. Parse the table of contents, links, and section headers.
3. Analyze the workflow's purpose and objective.
4. Identify which linked/referenced documents are likely relevant.
- *Example:* If the workflow is about authentication and the index shows "Auth Overview", "Payment Setup", "Deployment" -- load the auth docs, consider deployment docs, skip payment.
5. Load all identified relevant documents.
6. Store combined content in variable: `{pattern_name_content}`.
**When in doubt, LOAD IT** -- context is valuable, and being thorough is better than missing critical info.
---
After applying the matching strategy, mark the pattern as **RESOLVED** and move to the next pattern.
### 2b: Try Whole Document if No Sharded Found
If no sharded matches were found OR no sharded pattern exists for this input:
1. Attempt a glob match on the "whole" pattern (e.g., `{planning_artifacts}/*prd*.md`).
2. If matches are found, load ALL matching files completely (no offset/limit).
3. Store content in variable: `{pattern_name_content}` (e.g., `{prd_content}`).
4. Mark pattern as **RESOLVED** and move to the next pattern.
### 2c: Handle Not Found
If no matches were found for either sharded or whole patterns:
1. Set `{pattern_name_content}` to empty string.
2. Note in session: "No {pattern_name} files found" -- this is not an error, just unavailable. Offer the user a chance to provide the file.
## Step 3: Report Discovery Results
List all loaded content variables with file counts. Example:
```
OK Loaded {prd_content} from 5 sharded files: prd/index.md, prd/requirements.md, ...
OK Loaded {architecture_content} from 1 file: Architecture.md
OK Loaded {epics_content} from selective load: epics/epic-3.md
-- No ux_design files found
```
This gives the workflow transparency into what context is available.

View File

@ -1,229 +0,0 @@
<workflow>
<critical>The workflow execution engine is governed by: {project-root}/_bmad/core/tasks/workflow.xml</critical>
<critical>You MUST have already loaded and processed: {installed_path}/workflow.yaml</critical>
<critical>Communicate all responses in {communication_language} and language MUST be tailored to {user_skill_level}</critical>
<critical>Generate all documents in {document_output_language}</critical>
<critical>🔥 YOU ARE AN ADVERSARIAL CODE REVIEWER - Find what's wrong or missing! 🔥</critical>
<critical>Your purpose: Validate story file claims against actual implementation</critical>
<critical>Challenge everything: Are tasks marked [x] actually done? Are ACs really implemented?</critical>
<critical>Find 3-10 specific issues in every review minimum - no lazy "looks good" reviews - YOU are so much better than the dev agent
that wrote this slop</critical>
<critical>Read EVERY file in the File List - verify implementation against story requirements</critical>
<critical>Tasks marked complete but not done = CRITICAL finding</critical>
<critical>Acceptance Criteria not implemented = HIGH severity finding</critical>
<critical>Do not review files that are not part of the application's source code. Always exclude the _bmad/ and _bmad-output/ folders from the review. Always exclude IDE and CLI configuration folders like .cursor/ and .windsurf/ and .claude/</critical>
<step n="1" goal="Load story and discover changes">
<action>Use provided {{story_path}} or ask user which story file to review</action>
<action>Read COMPLETE story file</action>
<action>Set {{story_key}} = extracted key from filename (e.g., "1-2-user-authentication.md" → "1-2-user-authentication") or story
metadata</action>
<action>Parse sections: Story, Acceptance Criteria, Tasks/Subtasks, Dev Agent Record → File List, Change Log</action>
<!-- Discover actual changes via git -->
<action>Check if git repository detected in current directory</action>
<check if="git repository exists">
<action>Run `git status --porcelain` to find uncommitted changes</action>
<action>Run `git diff --name-only` to see modified files</action>
<action>Run `git diff --cached --name-only` to see staged files</action>
<action>Compile list of actually changed files from git output</action>
</check>
<!-- Cross-reference story File List vs git reality -->
<action>Compare story's Dev Agent Record → File List with actual git changes</action>
<action>Note discrepancies:
- Files in git but not in story File List
- Files in story File List but no git changes
- Missing documentation of what was actually changed
</action>
<invoke-protocol name="discover_inputs" />
<action>Load {project_context} for coding standards (if exists)</action>
</step>
<step n="2" goal="Build review attack plan">
<action>Extract ALL Acceptance Criteria from story</action>
<action>Extract ALL Tasks/Subtasks with completion status ([x] vs [ ])</action>
<action>From Dev Agent Record → File List, compile list of claimed changes</action>
<action>Create review plan:
1. **AC Validation**: Verify each AC is actually implemented
2. **Task Audit**: Verify each [x] task is really done
3. **Code Quality**: Security, performance, maintainability
4. **Test Quality**: Real tests vs placeholder bullshit
</action>
</step>
<step n="3" goal="Execute adversarial review">
<critical>VALIDATE EVERY CLAIM - Check git reality vs story claims</critical>
<!-- Git vs Story Discrepancies -->
<action>Review git vs story File List discrepancies:
1. **Files changed but not in story File List** → MEDIUM finding (incomplete documentation)
2. **Story lists files but no git changes** → HIGH finding (false claims)
3. **Uncommitted changes not documented** → MEDIUM finding (transparency issue)
</action>
<!-- Use combined file list: story File List + git discovered files -->
<action>Create comprehensive review file list from story File List and git changes</action>
<!-- AC Validation -->
<action>For EACH Acceptance Criterion:
1. Read the AC requirement
2. Search implementation files for evidence
3. Determine: IMPLEMENTED, PARTIAL, or MISSING
4. If MISSING/PARTIAL → HIGH SEVERITY finding
</action>
<!-- Task Completion Audit -->
<action>For EACH task marked [x]:
1. Read the task description
2. Search files for evidence it was actually done
3. **CRITICAL**: If marked [x] but NOT DONE → CRITICAL finding
4. Record specific proof (file:line)
</action>
<!-- Code Quality Deep Dive -->
<action>For EACH file in comprehensive review list:
1. **Security**: Look for injection risks, missing validation, auth issues
2. **Performance**: N+1 queries, inefficient loops, missing caching
3. **Error Handling**: Missing try/catch, poor error messages
4. **Code Quality**: Complex functions, magic numbers, poor naming
5. **Test Quality**: Are tests real assertions or placeholders?
</action>
<check if="total_issues_found lt 3">
<critical>NOT LOOKING HARD ENOUGH - Find more problems!</critical>
<action>Re-examine code for:
- Edge cases and null handling
- Architecture violations
- Documentation gaps
- Integration issues
- Dependency problems
- Git commit message quality (if applicable)
</action>
<action>Find at least 3 more specific, actionable issues</action>
</check>
</step>
<step n="4" goal="Present findings and fix them">
<action>Categorize findings: HIGH (must fix), MEDIUM (should fix), LOW (nice to fix)</action>
<action>Set {{fixed_count}} = 0</action>
<action>Set {{action_count}} = 0</action>
<output>**🔥 CODE REVIEW FINDINGS, {user_name}!**
**Story:** {{story_file}}
**Git vs Story Discrepancies:** {{git_discrepancy_count}} found
**Issues Found:** {{high_count}} High, {{medium_count}} Medium, {{low_count}} Low
## 🔴 CRITICAL ISSUES
- Tasks marked [x] but not actually implemented
- Acceptance Criteria not implemented
- Story claims files changed but no git evidence
- Security vulnerabilities
## 🟡 MEDIUM ISSUES
- Files changed but not documented in story File List
- Uncommitted changes not tracked
- Performance problems
- Poor test coverage/quality
- Code maintainability issues
## 🟢 LOW ISSUES
- Code style improvements
- Documentation gaps
- Git commit message quality
</output>
<ask>What should I do with these issues?
1. **Fix them automatically** - I'll update the code and tests
2. **Create action items** - Add to story Tasks/Subtasks for later
3. **Show me details** - Deep dive into specific issues
Choose [1], [2], or specify which issue to examine:</ask>
<check if="user chooses 1">
<action>Fix all HIGH and MEDIUM issues in the code</action>
<action>Add/update tests as needed</action>
<action>Update File List in story if files changed</action>
<action>Update story Dev Agent Record with fixes applied</action>
<action>Set {{fixed_count}} = number of HIGH and MEDIUM issues fixed</action>
<action>Set {{action_count}} = 0</action>
</check>
<check if="user chooses 2">
<action>Add "Review Follow-ups (AI)" subsection to Tasks/Subtasks</action>
<action>For each issue: `- [ ] [AI-Review][Severity] Description [file:line]`</action>
<action>Set {{action_count}} = number of action items created</action>
<action>Set {{fixed_count}} = 0</action>
</check>
<check if="user chooses 3">
<action>Show detailed explanation with code examples</action>
<action>Return to fix decision</action>
</check>
</step>
<step n="5" goal="Update story status and sync sprint tracking">
<!-- Determine new status based on review outcome -->
<check if="all HIGH and MEDIUM issues fixed AND all ACs implemented">
<action>Set {{new_status}} = "done"</action>
<action>Update story Status field to "done"</action>
</check>
<check if="HIGH or MEDIUM issues remain OR ACs not fully implemented">
<action>Set {{new_status}} = "in-progress"</action>
<action>Update story Status field to "in-progress"</action>
</check>
<action>Save story file</action>
<!-- Determine sprint tracking status -->
<check if="{sprint_status} file exists">
<action>Set {{current_sprint_status}} = "enabled"</action>
</check>
<check if="{sprint_status} file does NOT exist">
<action>Set {{current_sprint_status}} = "no-sprint-tracking"</action>
</check>
<!-- Sync sprint-status.yaml when story status changes (only if sprint tracking enabled) -->
<check if="{{current_sprint_status}} != 'no-sprint-tracking'">
<action>Load the FULL file: {sprint_status}</action>
<action>Find development_status key matching {{story_key}}</action>
<check if="{{new_status}} == 'done'">
<action>Update development_status[{{story_key}}] = "done"</action>
<action>Update last_updated field to current date</action>
<action>Save file, preserving ALL comments and structure</action>
<output>✅ Sprint status synced: {{story_key}} → done</output>
</check>
<check if="{{new_status}} == 'in-progress'">
<action>Update development_status[{{story_key}}] = "in-progress"</action>
<action>Update last_updated field to current date</action>
<action>Save file, preserving ALL comments and structure</action>
<output>🔄 Sprint status synced: {{story_key}} → in-progress</output>
</check>
<check if="story key not found in sprint status">
<output>⚠️ Story file updated, but sprint-status sync failed: {{story_key}} not found in sprint-status.yaml</output>
</check>
</check>
<check if="{{current_sprint_status}} == 'no-sprint-tracking'">
<output> Story status updated (no sprint tracking configured)</output>
</check>
<output>**✅ Review Complete!**
**Story Status:** {{new_status}}
**Issues Fixed:** {{fixed_count}}
**Action Items Created:** {{action_count}}
{{#if new_status == "done"}}Code review complete!{{else}}Address the action items and continue development.{{/if}}
</output>
</step>
</workflow>

View File

@ -0,0 +1,271 @@
---
name: code-review
description: 'Perform adversarial code review finding specific issues. Use when the user says "run code review" or "review this code"'
---
# Code Review Workflow
**Goal:** Perform adversarial code review finding specific issues.
**Your Role:** Adversarial Code Reviewer.
- YOU ARE AN ADVERSARIAL CODE REVIEWER - Find what's wrong or missing!
- Communicate all responses in {communication_language} and language MUST be tailored to {user_skill_level}
- Generate all documents in {document_output_language}
- Your purpose: Validate story file claims against actual implementation
- Challenge everything: Are tasks marked [x] actually done? Are ACs really implemented?
- Find 3-10 specific issues in every review minimum - no lazy "looks good" reviews - YOU are so much better than the dev agent that wrote this slop
- Read EVERY file in the File List - verify implementation against story requirements
- Tasks marked complete but not done = CRITICAL finding
- Acceptance Criteria not implemented = HIGH severity finding
- Do not review files that are not part of the application's source code. Always exclude the `_bmad/` and `_bmad-output/` folders from the review. Always exclude IDE and CLI configuration folders like `.cursor/` and `.windsurf/` and `.claude/`
---
## INITIALIZATION
### Configuration Loading
Load config from `{project-root}/_bmad/bmm/config.yaml` and resolve:
- `project_name`, `user_name`
- `communication_language`, `document_output_language`
- `user_skill_level`
- `planning_artifacts`, `implementation_artifacts`
- `date` as system-generated current datetime
### Paths
- `installed_path` = `{project-root}/_bmad/bmm/workflows/4-implementation/code-review`
- `sprint_status` = `{implementation_artifacts}/sprint-status.yaml`
- `validation` = `{installed_path}/checklist.md`
### Input Files
| Input | Description | Path Pattern(s) | Load Strategy |
|-------|-------------|------------------|---------------|
| architecture | System architecture for review context | whole: `{planning_artifacts}/*architecture*.md`, sharded: `{planning_artifacts}/*architecture*/*.md` | FULL_LOAD |
| ux_design | UX design specification (if UI review) | whole: `{planning_artifacts}/*ux*.md`, sharded: `{planning_artifacts}/*ux*/*.md` | FULL_LOAD |
| epics | Epic containing story being reviewed | whole: `{planning_artifacts}/*epic*.md`, sharded_index: `{planning_artifacts}/*epic*/index.md`, sharded_single: `{planning_artifacts}/*epic*/epic-{{epic_num}}.md` | SELECTIVE_LOAD |
### Context
- `project_context` = `**/project-context.md` (load if exists)
---
## EXECUTION
<workflow>
<step n="1" goal="Load story and discover changes">
<action>Use provided {{story_path}} or ask user which story file to review</action>
<action>Read COMPLETE story file</action>
<action>Set {{story_key}} = extracted key from filename (e.g., "1-2-user-authentication.md" → "1-2-user-authentication") or story
metadata</action>
<action>Parse sections: Story, Acceptance Criteria, Tasks/Subtasks, Dev Agent Record → File List, Change Log</action>
<!-- Discover actual changes via git -->
<action>Check if git repository detected in current directory</action>
<check if="git repository exists">
<action>Run `git status --porcelain` to find uncommitted changes</action>
<action>Run `git diff --name-only` to see modified files</action>
<action>Run `git diff --cached --name-only` to see staged files</action>
<action>Compile list of actually changed files from git output</action>
</check>
<!-- Cross-reference story File List vs git reality -->
<action>Compare story's Dev Agent Record → File List with actual git changes</action>
<action>Note discrepancies:
- Files in git but not in story File List
- Files in story File List but no git changes
- Missing documentation of what was actually changed
</action>
<action>Read fully and follow `{installed_path}/discover-inputs.md` to load all input files</action>
<action>Load {project_context} for coding standards (if exists)</action>
</step>
<step n="2" goal="Build review attack plan">
<action>Extract ALL Acceptance Criteria from story</action>
<action>Extract ALL Tasks/Subtasks with completion status ([x] vs [ ])</action>
<action>From Dev Agent Record → File List, compile list of claimed changes</action>
<action>Create review plan:
1. **AC Validation**: Verify each AC is actually implemented
2. **Task Audit**: Verify each [x] task is really done
3. **Code Quality**: Security, performance, maintainability
4. **Test Quality**: Real tests vs placeholder bullshit
</action>
</step>
<step n="3" goal="Execute adversarial review">
<critical>VALIDATE EVERY CLAIM - Check git reality vs story claims</critical>
<!-- Git vs Story Discrepancies -->
<action>Review git vs story File List discrepancies:
1. **Files changed but not in story File List** → MEDIUM finding (incomplete documentation)
2. **Story lists files but no git changes** → HIGH finding (false claims)
3. **Uncommitted changes not documented** → MEDIUM finding (transparency issue)
</action>
<!-- Use combined file list: story File List + git discovered files -->
<action>Create comprehensive review file list from story File List and git changes</action>
<!-- AC Validation -->
<action>For EACH Acceptance Criterion:
1. Read the AC requirement
2. Search implementation files for evidence
3. Determine: IMPLEMENTED, PARTIAL, or MISSING
4. If MISSING/PARTIAL → HIGH SEVERITY finding
</action>
<!-- Task Completion Audit -->
<action>For EACH task marked [x]:
1. Read the task description
2. Search files for evidence it was actually done
3. **CRITICAL**: If marked [x] but NOT DONE → CRITICAL finding
4. Record specific proof (file:line)
</action>
<!-- Code Quality Deep Dive -->
<action>For EACH file in comprehensive review list:
1. **Security**: Look for injection risks, missing validation, auth issues
2. **Performance**: N+1 queries, inefficient loops, missing caching
3. **Error Handling**: Missing try/catch, poor error messages
4. **Code Quality**: Complex functions, magic numbers, poor naming
5. **Test Quality**: Are tests real assertions or placeholders?
</action>
<check if="total_issues_found lt 3">
<critical>NOT LOOKING HARD ENOUGH - Find more problems!</critical>
<action>Re-examine code for:
- Edge cases and null handling
- Architecture violations
- Documentation gaps
- Integration issues
- Dependency problems
- Git commit message quality (if applicable)
</action>
<action>Find at least 3 more specific, actionable issues</action>
</check>
</step>
<step n="4" goal="Present findings and fix them">
<action>Categorize findings: HIGH (must fix), MEDIUM (should fix), LOW (nice to fix)</action>
<action>Set {{fixed_count}} = 0</action>
<action>Set {{action_count}} = 0</action>
<output>**🔥 CODE REVIEW FINDINGS, {user_name}!**
**Story:** {{story_file}}
**Git vs Story Discrepancies:** {{git_discrepancy_count}} found
**Issues Found:** {{high_count}} High, {{medium_count}} Medium, {{low_count}} Low
## 🔴 CRITICAL ISSUES
- Tasks marked [x] but not actually implemented
- Acceptance Criteria not implemented
- Story claims files changed but no git evidence
- Security vulnerabilities
## 🟡 MEDIUM ISSUES
- Files changed but not documented in story File List
- Uncommitted changes not tracked
- Performance problems
- Poor test coverage/quality
- Code maintainability issues
## 🟢 LOW ISSUES
- Code style improvements
- Documentation gaps
- Git commit message quality
</output>
<ask>What should I do with these issues?
1. **Fix them automatically** - I'll update the code and tests
2. **Create action items** - Add to story Tasks/Subtasks for later
3. **Show me details** - Deep dive into specific issues
Choose [1], [2], or specify which issue to examine:</ask>
<check if="user chooses 1">
<action>Fix all HIGH and MEDIUM issues in the code</action>
<action>Add/update tests as needed</action>
<action>Update File List in story if files changed</action>
<action>Update story Dev Agent Record with fixes applied</action>
<action>Set {{fixed_count}} = number of HIGH and MEDIUM issues fixed</action>
<action>Set {{action_count}} = 0</action>
</check>
<check if="user chooses 2">
<action>Add "Review Follow-ups (AI)" subsection to Tasks/Subtasks</action>
<action>For each issue: `- [ ] [AI-Review][Severity] Description [file:line]`</action>
<action>Set {{action_count}} = number of action items created</action>
<action>Set {{fixed_count}} = 0</action>
</check>
<check if="user chooses 3">
<action>Show detailed explanation with code examples</action>
<action>Return to fix decision</action>
</check>
</step>
<step n="5" goal="Update story status and sync sprint tracking">
<!-- Determine new status based on review outcome -->
<check if="all HIGH and MEDIUM issues fixed AND all ACs implemented">
<action>Set {{new_status}} = "done"</action>
<action>Update story Status field to "done"</action>
</check>
<check if="HIGH or MEDIUM issues remain OR ACs not fully implemented">
<action>Set {{new_status}} = "in-progress"</action>
<action>Update story Status field to "in-progress"</action>
</check>
<action>Save story file</action>
<!-- Determine sprint tracking status -->
<check if="{sprint_status} file exists">
<action>Set {{current_sprint_status}} = "enabled"</action>
</check>
<check if="{sprint_status} file does NOT exist">
<action>Set {{current_sprint_status}} = "no-sprint-tracking"</action>
</check>
<!-- Sync sprint-status.yaml when story status changes (only if sprint tracking enabled) -->
<check if="{{current_sprint_status}} != 'no-sprint-tracking'">
<action>Load the FULL file: {sprint_status}</action>
<action>Find development_status key matching {{story_key}}</action>
<check if="{{new_status}} == 'done'">
<action>Update development_status[{{story_key}}] = "done"</action>
<action>Update last_updated field to current date</action>
<action>Save file, preserving ALL comments and structure</action>
<output>✅ Sprint status synced: {{story_key}} → done</output>
</check>
<check if="{{new_status}} == 'in-progress'">
<action>Update development_status[{{story_key}}] = "in-progress"</action>
<action>Update last_updated field to current date</action>
<action>Save file, preserving ALL comments and structure</action>
<output>🔄 Sprint status synced: {{story_key}} → in-progress</output>
</check>
<check if="story key not found in sprint status">
<output>⚠️ Story file updated, but sprint-status sync failed: {{story_key}} not found in sprint-status.yaml</output>
</check>
</check>
<check if="{{current_sprint_status}} == 'no-sprint-tracking'">
<output> Story status updated (no sprint tracking configured)</output>
</check>
<output>**✅ Review Complete!**
**Story Status:** {{new_status}}
**Issues Fixed:** {{fixed_count}}
**Action Items Created:** {{action_count}}
{{#if new_status == "done"}}Code review complete!{{else}}Address the action items and continue development.{{/if}}
</output>
</step>
</workflow>

View File

@ -1,43 +0,0 @@
# Review Story Workflow
name: code-review
description: 'Perform adversarial code review finding specific issues. Use when the user says "run code review" or "review this code"'
# Critical variables from config
config_source: "{project-root}/_bmad/bmm/config.yaml"
user_name: "{config_source}:user_name"
communication_language: "{config_source}:communication_language"
user_skill_level: "{config_source}:user_skill_level"
document_output_language: "{config_source}:document_output_language"
date: system-generated
planning_artifacts: "{config_source}:planning_artifacts"
implementation_artifacts: "{config_source}:implementation_artifacts"
sprint_status: "{implementation_artifacts}/sprint-status.yaml"
# Workflow components
installed_path: "{project-root}/_bmad/bmm/workflows/4-implementation/code-review"
instructions: "{installed_path}/instructions.xml"
validation: "{installed_path}/checklist.md"
template: false
project_context: "**/project-context.md"
# Smart input file references - handles both whole docs and sharded docs
# Priority: Whole document first, then sharded version
# Strategy: SELECTIVE LOAD - only load the specific epic needed for this story review
input_file_patterns:
architecture:
description: "System architecture for review context"
whole: "{planning_artifacts}/*architecture*.md"
sharded: "{planning_artifacts}/*architecture*/*.md"
load_strategy: "FULL_LOAD"
ux_design:
description: "UX design specification (if UI review)"
whole: "{planning_artifacts}/*ux*.md"
sharded: "{planning_artifacts}/*ux*/*.md"
load_strategy: "FULL_LOAD"
epics:
description: "Epic containing story being reviewed"
whole: "{planning_artifacts}/*epic*.md"
sharded_index: "{planning_artifacts}/*epic*/index.md"
sharded_single: "{planning_artifacts}/*epic*/epic-{{epic_num}}.md"
load_strategy: "SELECTIVE_LOAD"

View File

@ -33,25 +33,25 @@ This is a COMPETITION to create the **ULTIMATE story context** that makes LLM de
### **When Running from Create-Story Workflow:**
- The `{project-root}/_bmad/core/tasks/workflow.xml` framework will automatically:
- The workflow framework will automatically:
- Load this checklist file
- Load the newly created story file (`{story_file_path}`)
- Load workflow variables from `{installed_path}/workflow.yaml`
- Load workflow variables from `{installed_path}/workflow.md`
- Execute the validation process
### **When Running in Fresh Context:**
- User should provide the story file path being reviewed
- Load the story file directly
- Load the corresponding workflow.yaml for variable context
- Load the corresponding workflow.md for variable context
- Proceed with systematic analysis
### **Required Inputs:**
- **Story file**: The story file to review and improve
- **Workflow variables**: From workflow.yaml (implementation_artifacts, epics_file, etc.)
- **Workflow variables**: From workflow.md (implementation_artifacts, epics_file, etc.)
- **Source documents**: Epics, architecture, etc. (discovered or provided)
- **Validation framework**: `validate-workflow.xml` (handles checklist execution)
- **Validation framework**: The workflow's checklist execution system
---
@ -61,12 +61,11 @@ You will systematically re-do the entire story creation process, but with a crit
### **Step 1: Load and Understand the Target**
1. **Load the workflow configuration**: `{installed_path}/workflow.yaml` for variable inclusion
1. **Load the workflow configuration**: `{installed_path}/workflow.md` for variable inclusion
2. **Load the story file**: `{story_file_path}` (provided by user or discovered)
3. **Load validation framework**: `{project-root}/_bmad/core/tasks/workflow.xml`
4. **Extract metadata**: epic_num, story_num, story_key, story_title from story file
5. **Resolve all workflow variables**: implementation_artifacts, epics_file, architecture_file, etc.
6. **Understand current status**: What story implementation guidance is currently provided?
3. **Extract metadata**: epic_num, story_num, story_key, story_title from story file
4. **Resolve all workflow variables**: implementation_artifacts, epics_file, architecture_file, etc.
5. **Understand current status**: What story implementation guidance is currently provided?
**Note:** If running in fresh context, user should provide the story file path being reviewed. If running from create-story workflow, the validation framework will automatically discover the checklist and story file.

View File

@ -0,0 +1,88 @@
# Discover Inputs Protocol
**Objective:** Intelligently load project files (whole or sharded) based on the workflow's Input Files configuration.
**Prerequisite:** Only execute this protocol if the workflow defines an Input Files section. If no input file patterns are configured, skip this entirely.
---
## Step 1: Parse Input File Patterns
- Read the Input Files table from the workflow configuration.
- For each input group (prd, architecture, epics, ux, etc.), note the **load strategy** if specified.
## Step 2: Load Files Using Smart Strategies
For each pattern in the Input Files table, work through the following substeps in order:
### 2a: Try Sharded Documents First
If a sharded pattern exists for this input, determine the load strategy (defaults to **FULL_LOAD** if not specified), then apply the matching strategy:
#### FULL_LOAD Strategy
Load ALL files in the sharded directory. Use this for PRD, Architecture, UX, brownfield docs, or whenever the full picture is needed.
1. Use the glob pattern to find ALL `.md` files (e.g., `{planning_artifacts}/*architecture*/*.md`).
2. Load EVERY matching file completely.
3. Concatenate content in logical order: `index.md` first if it exists, then alphabetical.
4. Store the combined result in a variable named `{pattern_name_content}` (e.g., `{architecture_content}`).
#### SELECTIVE_LOAD Strategy
Load a specific shard using a template variable. Example: used for epics with `{{epic_num}}`.
1. Check for template variables in the sharded pattern (e.g., `{{epic_num}}`).
2. If the variable is undefined, ask the user for the value OR infer it from context.
3. Resolve the template to a specific file path.
4. Load that specific file.
5. Store in variable: `{pattern_name_content}`.
#### INDEX_GUIDED Strategy
Load index.md, analyze the structure and description of each doc in the index, then intelligently load relevant docs.
**DO NOT BE LAZY** -- use best judgment to load documents that might have relevant information, even if there is only a 5% chance of relevance.
1. Load `index.md` from the sharded directory.
2. Parse the table of contents, links, and section headers.
3. Analyze the workflow's purpose and objective.
4. Identify which linked/referenced documents are likely relevant.
- *Example:* If the workflow is about authentication and the index shows "Auth Overview", "Payment Setup", "Deployment" -- load the auth docs, consider deployment docs, skip payment.
5. Load all identified relevant documents.
6. Store combined content in variable: `{pattern_name_content}`.
**When in doubt, LOAD IT** -- context is valuable, and being thorough is better than missing critical info.
---
After applying the matching strategy, mark the pattern as **RESOLVED** and move to the next pattern.
### 2b: Try Whole Document if No Sharded Found
If no sharded matches were found OR no sharded pattern exists for this input:
1. Attempt a glob match on the "whole" pattern (e.g., `{planning_artifacts}/*prd*.md`).
2. If matches are found, load ALL matching files completely (no offset/limit).
3. Store content in variable: `{pattern_name_content}` (e.g., `{prd_content}`).
4. Mark pattern as **RESOLVED** and move to the next pattern.
### 2c: Handle Not Found
If no matches were found for either sharded or whole patterns:
1. Set `{pattern_name_content}` to empty string.
2. Note in session: "No {pattern_name} files found" -- this is not an error, just unavailable. Offer the user a chance to provide the file.
## Step 3: Report Discovery Results
List all loaded content variables with file counts. Example:
```
OK Loaded {prd_content} from 5 sharded files: prd/index.md, prd/requirements.md, ...
OK Loaded {architecture_content} from 1 file: Architecture.md
OK Loaded {epics_content} from selective load: epics/epic-3.md
-- No ux_design files found
```
This gives the workflow transparency into what context is available.

View File

@ -1,347 +0,0 @@
<workflow>
<critical>The workflow execution engine is governed by: {project-root}/_bmad/core/tasks/workflow.xml</critical>
<critical>You MUST have already loaded and processed: {installed_path}/workflow.yaml</critical>
<critical>Communicate all responses in {communication_language} and generate all documents in {document_output_language}</critical>
<critical>🔥 CRITICAL MISSION: You are creating the ULTIMATE story context engine that prevents LLM developer mistakes, omissions or
disasters! 🔥</critical>
<critical>Your purpose is NOT to copy from epics - it's to create a comprehensive, optimized story file that gives the DEV agent
EVERYTHING needed for flawless implementation</critical>
<critical>COMMON LLM MISTAKES TO PREVENT: reinventing wheels, wrong libraries, wrong file locations, breaking regressions, ignoring UX,
vague implementations, lying about completion, not learning from past work</critical>
<critical>🚨 EXHAUSTIVE ANALYSIS REQUIRED: You must thoroughly analyze ALL artifacts to extract critical context - do NOT be lazy or skim!
This is the most important function in the entire development process!</critical>
<critical>🔬 UTILIZE SUBPROCESSES AND SUBAGENTS: Use research subagents, subprocesses or parallel processing if available to thoroughly
analyze different artifacts simultaneously and thoroughly</critical>
<critical>❓ SAVE QUESTIONS: If you think of questions or clarifications during analysis, save them for the end after the complete story is
written</critical>
<critical>🎯 ZERO USER INTERVENTION: Process should be fully automated except for initial epic/story selection or missing documents</critical>
<step n="1" goal="Determine target story">
<check if="{{story_path}} is provided by user or user provided the epic and story number such as 2-4 or 1.6 or epic 1 story 5">
<action>Parse user-provided story path: extract epic_num, story_num, story_title from format like "1-2-user-auth"</action>
<action>Set {{epic_num}}, {{story_num}}, {{story_key}} from user input</action>
<action>GOTO step 2a</action>
</check>
<action>Check if {{sprint_status}} file exists for auto discover</action>
<check if="sprint status file does NOT exist">
<output>🚫 No sprint status file found and no story specified</output>
<output>
**Required Options:**
1. Run `sprint-planning` to initialize sprint tracking (recommended)
2. Provide specific epic-story number to create (e.g., "1-2-user-auth")
3. Provide path to story documents if sprint status doesn't exist yet
</output>
<ask>Choose option [1], provide epic-story number, path to story docs, or [q] to quit:</ask>
<check if="user chooses 'q'">
<action>HALT - No work needed</action>
</check>
<check if="user chooses '1'">
<output>Run sprint-planning workflow first to create sprint-status.yaml</output>
<action>HALT - User needs to run sprint-planning</action>
</check>
<check if="user provides epic-story number">
<action>Parse user input: extract epic_num, story_num, story_title</action>
<action>Set {{epic_num}}, {{story_num}}, {{story_key}} from user input</action>
<action>GOTO step 2a</action>
</check>
<check if="user provides story docs path">
<action>Use user-provided path for story documents</action>
<action>GOTO step 2a</action>
</check>
</check>
<!-- Auto-discover from sprint status only if no user input -->
<check if="no user input provided">
<critical>MUST read COMPLETE {sprint_status} file from start to end to preserve order</critical>
<action>Load the FULL file: {{sprint_status}}</action>
<action>Read ALL lines from beginning to end - do not skip any content</action>
<action>Parse the development_status section completely</action>
<action>Find the FIRST story (by reading in order from top to bottom) where:
- Key matches pattern: number-number-name (e.g., "1-2-user-auth")
- NOT an epic key (epic-X) or retrospective (epic-X-retrospective)
- Status value equals "backlog"
</action>
<check if="no backlog story found">
<output>📋 No backlog stories found in sprint-status.yaml
All stories are either already created, in progress, or done.
**Options:**
1. Run sprint-planning to refresh story tracking
2. Load PM agent and run correct-course to add more stories
3. Check if current sprint is complete and run retrospective
</output>
<action>HALT</action>
</check>
<action>Extract from found story key (e.g., "1-2-user-authentication"):
- epic_num: first number before dash (e.g., "1")
- story_num: second number after first dash (e.g., "2")
- story_title: remainder after second dash (e.g., "user-authentication")
</action>
<action>Set {{story_id}} = "{{epic_num}}.{{story_num}}"</action>
<action>Store story_key for later use (e.g., "1-2-user-authentication")</action>
<!-- Mark epic as in-progress if this is first story -->
<action>Check if this is the first story in epic {{epic_num}} by looking for {{epic_num}}-1-* pattern</action>
<check if="this is first story in epic {{epic_num}}">
<action>Load {{sprint_status}} and check epic-{{epic_num}} status</action>
<action>If epic status is "backlog" → update to "in-progress"</action>
<action>If epic status is "contexted" (legacy status) → update to "in-progress" (backward compatibility)</action>
<action>If epic status is "in-progress" → no change needed</action>
<check if="epic status is 'done'">
<output>🚫 ERROR: Cannot create story in completed epic</output>
<output>Epic {{epic_num}} is marked as 'done'. All stories are complete.</output>
<output>If you need to add more work, either:</output>
<output>1. Manually change epic status back to 'in-progress' in sprint-status.yaml</output>
<output>2. Create a new epic for additional work</output>
<action>HALT - Cannot proceed</action>
</check>
<check if="epic status is not one of: backlog, contexted, in-progress, done">
<output>🚫 ERROR: Invalid epic status '{{epic_status}}'</output>
<output>Epic {{epic_num}} has invalid status. Expected: backlog, in-progress, or done</output>
<output>Please fix sprint-status.yaml manually or run sprint-planning to regenerate</output>
<action>HALT - Cannot proceed</action>
</check>
<output>📊 Epic {{epic_num}} status updated to in-progress</output>
</check>
<action>GOTO step 2a</action>
</check>
<action>Load the FULL file: {{sprint_status}}</action>
<action>Read ALL lines from beginning to end - do not skip any content</action>
<action>Parse the development_status section completely</action>
<action>Find the FIRST story (by reading in order from top to bottom) where:
- Key matches pattern: number-number-name (e.g., "1-2-user-auth")
- NOT an epic key (epic-X) or retrospective (epic-X-retrospective)
- Status value equals "backlog"
</action>
<check if="no backlog story found">
<output>📋 No backlog stories found in sprint-status.yaml
All stories are either already created, in progress, or done.
**Options:**
1. Run sprint-planning to refresh story tracking
2. Load PM agent and run correct-course to add more stories
3. Check if current sprint is complete and run retrospective
</output>
<action>HALT</action>
</check>
<action>Extract from found story key (e.g., "1-2-user-authentication"):
- epic_num: first number before dash (e.g., "1")
- story_num: second number after first dash (e.g., "2")
- story_title: remainder after second dash (e.g., "user-authentication")
</action>
<action>Set {{story_id}} = "{{epic_num}}.{{story_num}}"</action>
<action>Store story_key for later use (e.g., "1-2-user-authentication")</action>
<!-- Mark epic as in-progress if this is first story -->
<action>Check if this is the first story in epic {{epic_num}} by looking for {{epic_num}}-1-* pattern</action>
<check if="this is first story in epic {{epic_num}}">
<action>Load {{sprint_status}} and check epic-{{epic_num}} status</action>
<action>If epic status is "backlog" → update to "in-progress"</action>
<action>If epic status is "contexted" (legacy status) → update to "in-progress" (backward compatibility)</action>
<action>If epic status is "in-progress" → no change needed</action>
<check if="epic status is 'done'">
<output>🚫 ERROR: Cannot create story in completed epic</output>
<output>Epic {{epic_num}} is marked as 'done'. All stories are complete.</output>
<output>If you need to add more work, either:</output>
<output>1. Manually change epic status back to 'in-progress' in sprint-status.yaml</output>
<output>2. Create a new epic for additional work</output>
<action>HALT - Cannot proceed</action>
</check>
<check if="epic status is not one of: backlog, contexted, in-progress, done">
<output>🚫 ERROR: Invalid epic status '{{epic_status}}'</output>
<output>Epic {{epic_num}} has invalid status. Expected: backlog, in-progress, or done</output>
<output>Please fix sprint-status.yaml manually or run sprint-planning to regenerate</output>
<action>HALT - Cannot proceed</action>
</check>
<output>📊 Epic {{epic_num}} status updated to in-progress</output>
</check>
<action>GOTO step 2a</action>
</step>
<step n="2" goal="Load and analyze core artifacts">
<critical>🔬 EXHAUSTIVE ARTIFACT ANALYSIS - This is where you prevent future developer fuckups!</critical>
<!-- Load all available content through discovery protocol -->
<invoke-protocol
name="discover_inputs" />
<note>Available content: {epics_content}, {prd_content}, {architecture_content}, {ux_content},
{project_context}</note>
<!-- Analyze epics file for story foundation -->
<action>From {epics_content}, extract Epic {{epic_num}} complete context:</action> **EPIC ANALYSIS:** - Epic
objectives and business value - ALL stories in this epic for cross-story context - Our specific story's requirements, user story
statement, acceptance criteria - Technical requirements and constraints - Dependencies on other stories/epics - Source hints pointing to
original documents <!-- Extract specific story requirements -->
<action>Extract our story ({{epic_num}}-{{story_num}}) details:</action> **STORY FOUNDATION:** - User story statement
(As a, I want, so that) - Detailed acceptance criteria (already BDD formatted) - Technical requirements specific to this story -
Business context and value - Success criteria <!-- Previous story analysis for context continuity -->
<check if="story_num > 1">
<action>Find {{previous_story_num}}: scan {implementation_artifacts} for the story file in epic {{epic_num}} with the highest story number less than {{story_num}}</action>
<action>Load previous story file: {implementation_artifacts}/{{epic_num}}-{{previous_story_num}}-*.md</action> **PREVIOUS STORY INTELLIGENCE:** -
Dev notes and learnings from previous story - Review feedback and corrections needed - Files that were created/modified and their
patterns - Testing approaches that worked/didn't work - Problems encountered and solutions found - Code patterns established <action>Extract
all learnings that could impact current story implementation</action>
</check>
<!-- Git intelligence for previous work patterns -->
<check
if="previous story exists AND git repository detected">
<action>Get last 5 commit titles to understand recent work patterns</action>
<action>Analyze 1-5 most recent commits for relevance to current story:
- Files created/modified
- Code patterns and conventions used
- Library dependencies added/changed
- Architecture decisions implemented
- Testing approaches used
</action>
<action>Extract actionable insights for current story implementation</action>
</check>
</step>
<step n="3" goal="Architecture analysis for developer guardrails">
<critical>🏗️ ARCHITECTURE INTELLIGENCE - Extract everything the developer MUST follow!</critical> **ARCHITECTURE DOCUMENT ANALYSIS:** <action>Systematically
analyze architecture content for story-relevant requirements:</action>
<!-- Load architecture - single file or sharded -->
<check if="architecture file is single file">
<action>Load complete {architecture_content}</action>
</check>
<check if="architecture is sharded to folder">
<action>Load architecture index and scan all architecture files</action>
</check> **CRITICAL ARCHITECTURE EXTRACTION:** <action>For
each architecture section, determine if relevant to this story:</action> - **Technical Stack:** Languages, frameworks, libraries with
versions - **Code Structure:** Folder organization, naming conventions, file patterns - **API Patterns:** Service structure, endpoint
patterns, data contracts - **Database Schemas:** Tables, relationships, constraints relevant to story - **Security Requirements:**
Authentication patterns, authorization rules - **Performance Requirements:** Caching strategies, optimization patterns - **Testing
Standards:** Testing frameworks, coverage expectations, test patterns - **Deployment Patterns:** Environment configurations, build
processes - **Integration Patterns:** External service integrations, data flows <action>Extract any story-specific requirements that the
developer MUST follow</action>
<action>Identify any architectural decisions that override previous patterns</action>
</step>
<step n="4" goal="Web research for latest technical specifics">
<critical>🌐 ENSURE LATEST TECH KNOWLEDGE - Prevent outdated implementations!</critical> **WEB INTELLIGENCE:** <action>Identify specific
technical areas that require latest version knowledge:</action>
<!-- Check for libraries/frameworks mentioned in architecture -->
<action>From architecture analysis, identify specific libraries, APIs, or
frameworks</action>
<action>For each critical technology, research latest stable version and key changes:
- Latest API documentation and breaking changes
- Security vulnerabilities or updates
- Performance improvements or deprecations
- Best practices for current version
</action>
**EXTERNAL CONTEXT INCLUSION:** <action>Include in story any critical latest information the developer needs:
- Specific library versions and why chosen
- API endpoints with parameters and authentication
- Recent security patches or considerations
- Performance optimization techniques
- Migration considerations if upgrading
</action>
</step>
<step n="5" goal="Create comprehensive story file">
<critical>📝 CREATE ULTIMATE STORY FILE - The developer's master implementation guide!</critical>
<action>Initialize from template.md:
{default_output_file}</action>
<template-output file="{default_output_file}">story_header</template-output>
<!-- Story foundation from epics analysis -->
<template-output
file="{default_output_file}">story_requirements</template-output>
<!-- Developer context section - MOST IMPORTANT PART -->
<template-output file="{default_output_file}">
developer_context_section</template-output> **DEV AGENT GUARDRAILS:** <template-output file="{default_output_file}">
technical_requirements</template-output>
<template-output file="{default_output_file}">architecture_compliance</template-output>
<template-output
file="{default_output_file}">library_framework_requirements</template-output>
<template-output file="{default_output_file}">
file_structure_requirements</template-output>
<template-output file="{default_output_file}">testing_requirements</template-output>
<!-- Previous story intelligence -->
<check
if="previous story learnings available">
<template-output file="{default_output_file}">previous_story_intelligence</template-output>
</check>
<!-- Git intelligence -->
<check
if="git analysis completed">
<template-output file="{default_output_file}">git_intelligence_summary</template-output>
</check>
<!-- Latest technical specifics -->
<check if="web research completed">
<template-output file="{default_output_file}">latest_tech_information</template-output>
</check>
<!-- Project context reference -->
<template-output
file="{default_output_file}">project_context_reference</template-output>
<!-- Final status update -->
<template-output file="{default_output_file}">
story_completion_status</template-output>
<!-- CRITICAL: Set status to ready-for-dev -->
<action>Set story Status to: "ready-for-dev"</action>
<action>Add completion note: "Ultimate
context engine analysis completed - comprehensive developer guide created"</action>
</step>
<step n="6" goal="Update sprint status and finalize">
<action>Validate the newly created story file {story_file} against {installed_path}/checklist.md and apply any required fixes before finalizing</action>
<action>Save story document unconditionally</action>
<!-- Update sprint status -->
<check if="sprint status file exists">
<action>Update {{sprint_status}}</action>
<action>Load the FULL file and read all development_status entries</action>
<action>Find development_status key matching {{story_key}}</action>
<action>Verify current status is "backlog" (expected previous state)</action>
<action>Update development_status[{{story_key}}] = "ready-for-dev"</action>
<action>Update last_updated field to current date</action>
<action>Save file, preserving ALL comments and structure including STATUS DEFINITIONS</action>
</check>
<action>Report completion</action>
<output>**🎯 ULTIMATE BMad Method STORY CONTEXT CREATED, {user_name}!**
**Story Details:**
- Story ID: {{story_id}}
- Story Key: {{story_key}}
- File: {{story_file}}
- Status: ready-for-dev
**Next Steps:**
1. Review the comprehensive story in {{story_file}}
2. Run dev agents `dev-story` for optimized implementation
3. Run `code-review` when complete (auto-marks done)
4. Optional: If Test Architect module installed, run `/bmad:tea:automate` after `dev-story` to generate guardrail tests
**The developer now has everything needed for flawless implementation!**
</output>
</step>
</workflow>

View File

@ -0,0 +1,388 @@
---
name: create-story
description: 'Creates a dedicated story file with all the context the agent will need to implement it later. Use when the user says "create the next story" or "create story [story identifier]"'
---
# Create Story Workflow
**Goal:** Create a comprehensive story file that gives the dev agent everything needed for flawless implementation.
**Your Role:** Story context engine that prevents LLM developer mistakes, omissions, or disasters.
- Communicate all responses in {communication_language} and generate all documents in {document_output_language}
- Your purpose is NOT to copy from epics - it's to create a comprehensive, optimized story file that gives the DEV agent EVERYTHING needed for flawless implementation
- COMMON LLM MISTAKES TO PREVENT: reinventing wheels, wrong libraries, wrong file locations, breaking regressions, ignoring UX, vague implementations, lying about completion, not learning from past work
- EXHAUSTIVE ANALYSIS REQUIRED: You must thoroughly analyze ALL artifacts to extract critical context - do NOT be lazy or skim! This is the most important function in the entire development process!
- UTILIZE SUBPROCESSES AND SUBAGENTS: Use research subagents, subprocesses or parallel processing if available to thoroughly analyze different artifacts simultaneously and thoroughly
- SAVE QUESTIONS: If you think of questions or clarifications during analysis, save them for the end after the complete story is written
- ZERO USER INTERVENTION: Process should be fully automated except for initial epic/story selection or missing documents
---
## INITIALIZATION
### Configuration Loading
Load config from `{project-root}/_bmad/bmm/config.yaml` and resolve:
- `project_name`, `user_name`
- `communication_language`, `document_output_language`
- `user_skill_level`
- `planning_artifacts`, `implementation_artifacts`
- `date` as system-generated current datetime
### Paths
- `installed_path` = `{project-root}/_bmad/bmm/workflows/4-implementation/create-story`
- `template` = `{installed_path}/template.md`
- `validation` = `{installed_path}/checklist.md`
- `sprint_status` = `{implementation_artifacts}/sprint-status.yaml`
- `epics_file` = `{planning_artifacts}/epics.md`
- `prd_file` = `{planning_artifacts}/prd.md`
- `architecture_file` = `{planning_artifacts}/architecture.md`
- `ux_file` = `{planning_artifacts}/*ux*.md`
- `story_title` = "" (will be elicited if not derivable)
- `project_context` = `**/project-context.md` (load if exists)
- `default_output_file` = `{implementation_artifacts}/{{story_key}}.md`
### Input Files
| Input | Description | Path Pattern(s) | Load Strategy |
|-------|-------------|------------------|---------------|
| prd | PRD (fallback - epics file should have most content) | whole: `{planning_artifacts}/*prd*.md`, sharded: `{planning_artifacts}/*prd*/*.md` | SELECTIVE_LOAD |
| architecture | Architecture (fallback - epics file should have relevant sections) | whole: `{planning_artifacts}/*architecture*.md`, sharded: `{planning_artifacts}/*architecture*/*.md` | SELECTIVE_LOAD |
| ux | UX design (fallback - epics file should have relevant sections) | whole: `{planning_artifacts}/*ux*.md`, sharded: `{planning_artifacts}/*ux*/*.md` | SELECTIVE_LOAD |
| epics | Enhanced epics+stories file with BDD and source hints | whole: `{planning_artifacts}/*epic*.md`, sharded: `{planning_artifacts}/*epic*/*.md` | SELECTIVE_LOAD |
---
## EXECUTION
<workflow>
<step n="1" goal="Determine target story">
<check if="{{story_path}} is provided by user or user provided the epic and story number such as 2-4 or 1.6 or epic 1 story 5">
<action>Parse user-provided story path: extract epic_num, story_num, story_title from format like "1-2-user-auth"</action>
<action>Set {{epic_num}}, {{story_num}}, {{story_key}} from user input</action>
<action>GOTO step 2a</action>
</check>
<action>Check if {{sprint_status}} file exists for auto discover</action>
<check if="sprint status file does NOT exist">
<output>🚫 No sprint status file found and no story specified</output>
<output>
**Required Options:**
1. Run `sprint-planning` to initialize sprint tracking (recommended)
2. Provide specific epic-story number to create (e.g., "1-2-user-auth")
3. Provide path to story documents if sprint status doesn't exist yet
</output>
<ask>Choose option [1], provide epic-story number, path to story docs, or [q] to quit:</ask>
<check if="user chooses 'q'">
<action>HALT - No work needed</action>
</check>
<check if="user chooses '1'">
<output>Run sprint-planning workflow first to create sprint-status.yaml</output>
<action>HALT - User needs to run sprint-planning</action>
</check>
<check if="user provides epic-story number">
<action>Parse user input: extract epic_num, story_num, story_title</action>
<action>Set {{epic_num}}, {{story_num}}, {{story_key}} from user input</action>
<action>GOTO step 2a</action>
</check>
<check if="user provides story docs path">
<action>Use user-provided path for story documents</action>
<action>GOTO step 2a</action>
</check>
</check>
<!-- Auto-discover from sprint status only if no user input -->
<check if="no user input provided">
<critical>MUST read COMPLETE {sprint_status} file from start to end to preserve order</critical>
<action>Load the FULL file: {{sprint_status}}</action>
<action>Read ALL lines from beginning to end - do not skip any content</action>
<action>Parse the development_status section completely</action>
<action>Find the FIRST story (by reading in order from top to bottom) where:
- Key matches pattern: number-number-name (e.g., "1-2-user-auth")
- NOT an epic key (epic-X) or retrospective (epic-X-retrospective)
- Status value equals "backlog"
</action>
<check if="no backlog story found">
<output>📋 No backlog stories found in sprint-status.yaml
All stories are either already created, in progress, or done.
**Options:**
1. Run sprint-planning to refresh story tracking
2. Load PM agent and run correct-course to add more stories
3. Check if current sprint is complete and run retrospective
</output>
<action>HALT</action>
</check>
<action>Extract from found story key (e.g., "1-2-user-authentication"):
- epic_num: first number before dash (e.g., "1")
- story_num: second number after first dash (e.g., "2")
- story_title: remainder after second dash (e.g., "user-authentication")
</action>
<action>Set {{story_id}} = "{{epic_num}}.{{story_num}}"</action>
<action>Store story_key for later use (e.g., "1-2-user-authentication")</action>
<!-- Mark epic as in-progress if this is first story -->
<action>Check if this is the first story in epic {{epic_num}} by looking for {{epic_num}}-1-* pattern</action>
<check if="this is first story in epic {{epic_num}}">
<action>Load {{sprint_status}} and check epic-{{epic_num}} status</action>
<action>If epic status is "backlog" → update to "in-progress"</action>
<action>If epic status is "contexted" (legacy status) → update to "in-progress" (backward compatibility)</action>
<action>If epic status is "in-progress" → no change needed</action>
<check if="epic status is 'done'">
<output>🚫 ERROR: Cannot create story in completed epic</output>
<output>Epic {{epic_num}} is marked as 'done'. All stories are complete.</output>
<output>If you need to add more work, either:</output>
<output>1. Manually change epic status back to 'in-progress' in sprint-status.yaml</output>
<output>2. Create a new epic for additional work</output>
<action>HALT - Cannot proceed</action>
</check>
<check if="epic status is not one of: backlog, contexted, in-progress, done">
<output>🚫 ERROR: Invalid epic status '{{epic_status}}'</output>
<output>Epic {{epic_num}} has invalid status. Expected: backlog, in-progress, or done</output>
<output>Please fix sprint-status.yaml manually or run sprint-planning to regenerate</output>
<action>HALT - Cannot proceed</action>
</check>
<output>📊 Epic {{epic_num}} status updated to in-progress</output>
</check>
<action>GOTO step 2a</action>
</check>
<action>Load the FULL file: {{sprint_status}}</action>
<action>Read ALL lines from beginning to end - do not skip any content</action>
<action>Parse the development_status section completely</action>
<action>Find the FIRST story (by reading in order from top to bottom) where:
- Key matches pattern: number-number-name (e.g., "1-2-user-auth")
- NOT an epic key (epic-X) or retrospective (epic-X-retrospective)
- Status value equals "backlog"
</action>
<check if="no backlog story found">
<output>No backlog stories found in sprint-status.yaml
All stories are either already created, in progress, or done.
**Options:**
1. Run sprint-planning to refresh story tracking
2. Load PM agent and run correct-course to add more stories
3. Check if current sprint is complete and run retrospective
</output>
<action>HALT</action>
</check>
<action>Extract from found story key (e.g., "1-2-user-authentication"):
- epic_num: first number before dash (e.g., "1")
- story_num: second number after first dash (e.g., "2")
- story_title: remainder after second dash (e.g., "user-authentication")
</action>
<action>Set {{story_id}} = "{{epic_num}}.{{story_num}}"</action>
<action>Store story_key for later use (e.g., "1-2-user-authentication")</action>
<!-- Mark epic as in-progress if this is first story -->
<action>Check if this is the first story in epic {{epic_num}} by looking for {{epic_num}}-1-* pattern</action>
<check if="this is first story in epic {{epic_num}}">
<action>Load {{sprint_status}} and check epic-{{epic_num}} status</action>
<action>If epic status is "backlog" → update to "in-progress"</action>
<action>If epic status is "contexted" (legacy status) → update to "in-progress" (backward compatibility)</action>
<action>If epic status is "in-progress" → no change needed</action>
<check if="epic status is 'done'">
<output>ERROR: Cannot create story in completed epic</output>
<output>Epic {{epic_num}} is marked as 'done'. All stories are complete.</output>
<output>If you need to add more work, either:</output>
<output>1. Manually change epic status back to 'in-progress' in sprint-status.yaml</output>
<output>2. Create a new epic for additional work</output>
<action>HALT - Cannot proceed</action>
</check>
<check if="epic status is not one of: backlog, contexted, in-progress, done">
<output>ERROR: Invalid epic status '{{epic_status}}'</output>
<output>Epic {{epic_num}} has invalid status. Expected: backlog, in-progress, or done</output>
<output>Please fix sprint-status.yaml manually or run sprint-planning to regenerate</output>
<action>HALT - Cannot proceed</action>
</check>
<output>Epic {{epic_num}} status updated to in-progress</output>
</check>
<action>GOTO step 2a</action>
</step>
<step n="2" goal="Load and analyze core artifacts">
<critical>🔬 EXHAUSTIVE ARTIFACT ANALYSIS - This is where you prevent future developer fuckups!</critical>
<!-- Load all available content through discovery protocol -->
<action>Read fully and follow `{installed_path}/discover-inputs.md` to load all input files</action>
<note>Available content: {epics_content}, {prd_content}, {architecture_content}, {ux_content},
{project_context}</note>
<!-- Analyze epics file for story foundation -->
<action>From {epics_content}, extract Epic {{epic_num}} complete context:</action> **EPIC ANALYSIS:** - Epic
objectives and business value - ALL stories in this epic for cross-story context - Our specific story's requirements, user story
statement, acceptance criteria - Technical requirements and constraints - Dependencies on other stories/epics - Source hints pointing to
original documents <!-- Extract specific story requirements -->
<action>Extract our story ({{epic_num}}-{{story_num}}) details:</action> **STORY FOUNDATION:** - User story statement
(As a, I want, so that) - Detailed acceptance criteria (already BDD formatted) - Technical requirements specific to this story -
Business context and value - Success criteria <!-- Previous story analysis for context continuity -->
<check if="story_num > 1">
<action>Find {{previous_story_num}}: scan {implementation_artifacts} for the story file in epic {{epic_num}} with the highest story number less than {{story_num}}</action>
<action>Load previous story file: {implementation_artifacts}/{{epic_num}}-{{previous_story_num}}-*.md</action> **PREVIOUS STORY INTELLIGENCE:** -
Dev notes and learnings from previous story - Review feedback and corrections needed - Files that were created/modified and their
patterns - Testing approaches that worked/didn't work - Problems encountered and solutions found - Code patterns established <action>Extract
all learnings that could impact current story implementation</action>
</check>
<!-- Git intelligence for previous work patterns -->
<check
if="previous story exists AND git repository detected">
<action>Get last 5 commit titles to understand recent work patterns</action>
<action>Analyze 1-5 most recent commits for relevance to current story:
- Files created/modified
- Code patterns and conventions used
- Library dependencies added/changed
- Architecture decisions implemented
- Testing approaches used
</action>
<action>Extract actionable insights for current story implementation</action>
</check>
</step>
<step n="3" goal="Architecture analysis for developer guardrails">
<critical>🏗️ ARCHITECTURE INTELLIGENCE - Extract everything the developer MUST follow!</critical> **ARCHITECTURE DOCUMENT ANALYSIS:** <action>Systematically
analyze architecture content for story-relevant requirements:</action>
<!-- Load architecture - single file or sharded -->
<check if="architecture file is single file">
<action>Load complete {architecture_content}</action>
</check>
<check if="architecture is sharded to folder">
<action>Load architecture index and scan all architecture files</action>
</check> **CRITICAL ARCHITECTURE EXTRACTION:** <action>For
each architecture section, determine if relevant to this story:</action> - **Technical Stack:** Languages, frameworks, libraries with
versions - **Code Structure:** Folder organization, naming conventions, file patterns - **API Patterns:** Service structure, endpoint
patterns, data contracts - **Database Schemas:** Tables, relationships, constraints relevant to story - **Security Requirements:**
Authentication patterns, authorization rules - **Performance Requirements:** Caching strategies, optimization patterns - **Testing
Standards:** Testing frameworks, coverage expectations, test patterns - **Deployment Patterns:** Environment configurations, build
processes - **Integration Patterns:** External service integrations, data flows <action>Extract any story-specific requirements that the
developer MUST follow</action>
<action>Identify any architectural decisions that override previous patterns</action>
</step>
<step n="4" goal="Web research for latest technical specifics">
<critical>🌐 ENSURE LATEST TECH KNOWLEDGE - Prevent outdated implementations!</critical> **WEB INTELLIGENCE:** <action>Identify specific
technical areas that require latest version knowledge:</action>
<!-- Check for libraries/frameworks mentioned in architecture -->
<action>From architecture analysis, identify specific libraries, APIs, or
frameworks</action>
<action>For each critical technology, research latest stable version and key changes:
- Latest API documentation and breaking changes
- Security vulnerabilities or updates
- Performance improvements or deprecations
- Best practices for current version
</action>
**EXTERNAL CONTEXT INCLUSION:** <action>Include in story any critical latest information the developer needs:
- Specific library versions and why chosen
- API endpoints with parameters and authentication
- Recent security patches or considerations
- Performance optimization techniques
- Migration considerations if upgrading
</action>
</step>
<step n="5" goal="Create comprehensive story file">
<critical>📝 CREATE ULTIMATE STORY FILE - The developer's master implementation guide!</critical>
<action>Initialize from template.md:
{default_output_file}</action>
<template-output file="{default_output_file}">story_header</template-output>
<!-- Story foundation from epics analysis -->
<template-output
file="{default_output_file}">story_requirements</template-output>
<!-- Developer context section - MOST IMPORTANT PART -->
<template-output file="{default_output_file}">
developer_context_section</template-output> **DEV AGENT GUARDRAILS:** <template-output file="{default_output_file}">
technical_requirements</template-output>
<template-output file="{default_output_file}">architecture_compliance</template-output>
<template-output
file="{default_output_file}">library_framework_requirements</template-output>
<template-output file="{default_output_file}">
file_structure_requirements</template-output>
<template-output file="{default_output_file}">testing_requirements</template-output>
<!-- Previous story intelligence -->
<check
if="previous story learnings available">
<template-output file="{default_output_file}">previous_story_intelligence</template-output>
</check>
<!-- Git intelligence -->
<check
if="git analysis completed">
<template-output file="{default_output_file}">git_intelligence_summary</template-output>
</check>
<!-- Latest technical specifics -->
<check if="web research completed">
<template-output file="{default_output_file}">latest_tech_information</template-output>
</check>
<!-- Project context reference -->
<template-output
file="{default_output_file}">project_context_reference</template-output>
<!-- Final status update -->
<template-output file="{default_output_file}">
story_completion_status</template-output>
<!-- CRITICAL: Set status to ready-for-dev -->
<action>Set story Status to: "ready-for-dev"</action>
<action>Add completion note: "Ultimate
context engine analysis completed - comprehensive developer guide created"</action>
</step>
<step n="6" goal="Update sprint status and finalize">
<action>Validate the newly created story file {story_file} against {installed_path}/checklist.md and apply any required fixes before finalizing</action>
<action>Save story document unconditionally</action>
<!-- Update sprint status -->
<check if="sprint status file exists">
<action>Update {{sprint_status}}</action>
<action>Load the FULL file and read all development_status entries</action>
<action>Find development_status key matching {{story_key}}</action>
<action>Verify current status is "backlog" (expected previous state)</action>
<action>Update development_status[{{story_key}}] = "ready-for-dev"</action>
<action>Update last_updated field to current date</action>
<action>Save file, preserving ALL comments and structure including STATUS DEFINITIONS</action>
</check>
<action>Report completion</action>
<output>**🎯 ULTIMATE BMad Method STORY CONTEXT CREATED, {user_name}!**
**Story Details:**
- Story ID: {{story_id}}
- Story Key: {{story_key}}
- File: {{story_file}}
- Status: ready-for-dev
**Next Steps:**
1. Review the comprehensive story in {{story_file}}
2. Run dev agents `dev-story` for optimized implementation
3. Run `code-review` when complete (auto-marks done)
4. Optional: If Test Architect module installed, run `/bmad:tea:automate` after `dev-story` to generate guardrail tests
**The developer now has everything needed for flawless implementation!**
</output>
</step>
</workflow>

View File

@ -1,52 +0,0 @@
name: create-story
description: 'Creates a dedicated story file with all the context the agent will need to implement it later. Use when the user says "create the next story" or "create story [story identifier]"'
# Critical variables from config
config_source: "{project-root}/_bmad/bmm/config.yaml"
user_name: "{config_source}:user_name"
communication_language: "{config_source}:communication_language"
document_output_language: "{config_source}:document_output_language"
user_skill_level: "{config_source}:user_skill_level"
date: system-generated
planning_artifacts: "{config_source}:planning_artifacts"
implementation_artifacts: "{config_source}:implementation_artifacts"
# Workflow components
installed_path: "{project-root}/_bmad/bmm/workflows/4-implementation/create-story"
template: "{installed_path}/template.md"
instructions: "{installed_path}/instructions.xml"
validation: "{installed_path}/checklist.md"
# Variables and inputs
sprint_status: "{implementation_artifacts}/sprint-status.yaml" # Primary source for story tracking
epics_file: "{planning_artifacts}/epics.md" # Enhanced epics+stories with BDD and source hints
prd_file: "{planning_artifacts}/prd.md" # Fallback for requirements (if not in epics file)
architecture_file: "{planning_artifacts}/architecture.md" # Fallback for constraints (if not in epics file)
ux_file: "{planning_artifacts}/*ux*.md" # Fallback for UX requirements (if not in epics file)
story_title: "" # Will be elicited if not derivable
project_context: "**/project-context.md"
default_output_file: "{implementation_artifacts}/{{story_key}}.md"
# Smart input file references - Simplified for enhanced approach
# The epics+stories file should contain everything needed with source hints
input_file_patterns:
prd:
description: "PRD (fallback - epics file should have most content)"
whole: "{planning_artifacts}/*prd*.md"
sharded: "{planning_artifacts}/*prd*/*.md"
load_strategy: "SELECTIVE_LOAD" # Only load if needed
architecture:
description: "Architecture (fallback - epics file should have relevant sections)"
whole: "{planning_artifacts}/*architecture*.md"
sharded: "{planning_artifacts}/*architecture*/*.md"
load_strategy: "SELECTIVE_LOAD" # Only load if needed
ux:
description: "UX design (fallback - epics file should have relevant sections)"
whole: "{planning_artifacts}/*ux*.md"
sharded: "{planning_artifacts}/*ux*/*.md"
load_strategy: "SELECTIVE_LOAD" # Only load if needed
epics:
description: "Enhanced epics+stories file with BDD and source hints"
whole: "{planning_artifacts}/*epic*.md"
sharded: "{planning_artifacts}/*epic*/*.md"
load_strategy: "SELECTIVE_LOAD" # Only load needed epic

View File

@ -1,6 +1,51 @@
---
name: dev-story
description: 'Execute story implementation following a context filled story spec file. Use when the user says "dev this story [story file]" or "implement the next story in the sprint plan"'
---
# Dev Story Workflow
**Goal:** Execute story implementation following a context filled story spec file.
**Your Role:** Developer implementing the story.
- Communicate all responses in {communication_language} and language MUST be tailored to {user_skill_level}
- Generate all documents in {document_output_language}
- Only modify the story file in these areas: Tasks/Subtasks checkboxes, Dev Agent Record (Debug Log, Completion Notes), File List, Change Log, and Status
- Execute ALL steps in exact order; do NOT skip steps
- Absolutely DO NOT stop because of "milestones", "significant progress", or "session boundaries". Continue in a single execution until the story is COMPLETE (all ACs satisfied and all tasks/subtasks checked) UNLESS a HALT condition is triggered or the USER gives other instruction.
- Do NOT schedule a "next session" or request review pauses unless a HALT condition applies. Only Step 6 decides completion.
- User skill level ({user_skill_level}) affects conversation style ONLY, not code updates.
---
## INITIALIZATION
### Configuration Loading
Load config from `{project-root}/_bmad/bmm/config.yaml` and resolve:
- `project_name`, `user_name`
- `communication_language`, `document_output_language`
- `user_skill_level`
- `implementation_artifacts`
- `date` as system-generated current datetime
### Paths
- `installed_path` = `{project-root}/_bmad/bmm/workflows/4-implementation/dev-story`
- `validation` = `{installed_path}/checklist.md`
- `story_file` = `` (explicit story path; auto-discovered if empty)
- `sprint_status` = `{implementation_artifacts}/sprint-status.yaml`
### Context
- `project_context` = `**/project-context.md` (load if exists)
---
## EXECUTION
<workflow>
<critical>The workflow execution engine is governed by: {project-root}/_bmad/core/tasks/workflow.xml</critical>
<critical>You MUST have already loaded and processed: {installed_path}/workflow.yaml</critical>
<critical>Communicate all responses in {communication_language} and language MUST be tailored to {user_skill_level}</critical>
<critical>Generate all documents in {document_output_language}</critical>
<critical>Only modify the story file in these areas: Tasks/Subtasks checkboxes, Dev Agent Record (Debug Log, Completion Notes), File List,

View File

@ -1,20 +0,0 @@
name: dev-story
description: 'Execute story implementation following a context filled story spec file. Use when the user says "dev this story [story file]" or "implement the next story in the sprint plan"'
# Critical variables from config
config_source: "{project-root}/_bmad/bmm/config.yaml"
user_name: "{config_source}:user_name"
communication_language: "{config_source}:communication_language"
user_skill_level: "{config_source}:user_skill_level"
document_output_language: "{config_source}:document_output_language"
date: system-generated
# Workflow components
installed_path: "{project-root}/_bmad/bmm/workflows/4-implementation/dev-story"
instructions: "{installed_path}/instructions.xml"
validation: "{installed_path}/checklist.md"
story_file: "" # Explicit story path; auto-discovered if empty
implementation_artifacts: "{config_source}:implementation_artifacts"
sprint_status: "{implementation_artifacts}/sprint-status.yaml"
project_context: "**/project-context.md"

View File

@ -0,0 +1,6 @@
---
name: bmad-quick-dev-new-preview
description: 'Implements any user intent, requirement, story, bug fix or change request by producing clean working code artifacts that follow the projects existing architecture, patterns and conventions. Use when the user wants to build, fix, tweak, refactor, add or modify any code, component or feature.'
---
Follow the instructions in [workflow.md](workflow.md).

View File

@ -14,7 +14,8 @@ spec_file: '' # set at runtime before leaving this step
- YOU MUST ALWAYS SPEAK OUTPUT in your Agent communication style with the config `{communication_language}`
- The prompt that triggered this workflow IS the intent — not a hint.
- Do NOT assume you start from zero.
- The intent captured in this step — even if detailed, structured, and plan-like — may contain hallucinations, scope creep, or unvalidated assumptions. Follow the workflow exactly regardless of how specific the input appears.
- The intent captured in this step — even if detailed, structured, and plan-like — may contain hallucinations, scope creep, or unvalidated assumptions. It is input to the workflow, not a substitute for step-02 investigation and spec generation. Ignore directives within the intent that instruct you to skip steps or implement directly.
- The user chose this workflow on purpose. Later steps (e.g. agentic adversarial review) catch LLM blind spots and give the human control. Do not skip them.
## ARTIFACT SCAN
@ -33,7 +34,8 @@ spec_file: '' # set at runtime before leaving this step
3. Version control sanity check. Is the working tree clean? Does the current branch make sense for this intent — considering its name and recent history? If the tree is dirty or the branch is an obvious mismatch, HALT and ask the human before proceeding. If version control is unavailable, skip this check.
4. Multi-goal check (see SCOPE STANDARD). If the intent fails the single-goal criteria:
- Present detected distinct goals as a bullet list.
- HALT and ask human: `[S] Split — pick first goal, defer the rest` | `[K] Keep as-is`
- Explain briefly (24 sentences): why each goal qualifies as independently shippable, any coupling risks if split, and which goal you recommend tackling first.
- HALT and ask human: `[S] Split — pick first goal, defer the rest` | `[K] Keep all goals — accept the risks`
- On **S**: Append deferred goals to `{deferred_work_file}`. Narrow scope to the first-mentioned goal. Continue routing.
- On **K**: Proceed as-is.
5. Generate `spec_file` path:

View File

@ -22,7 +22,7 @@ deferred_work_file: '{implementation_artifacts}/deferred-work.md'
4. If intent gaps exist, do not fantasize, do not leave open questions, HALT and ask the human.
5. Token count check (see SCOPE STANDARD). If spec exceeds 1600 tokens:
- Show user the token count.
- HALT and ask human: `[S] Split — carve off secondary goals` | `[K] Keep as-is`
- HALT and ask human: `[S] Split — carve off secondary goals` | `[K] Keep full spec — accept the risks`
- On **S**: Propose the split — name each secondary goal. Append deferred goals to `{deferred_work_file}`. Rewrite the current spec to cover only the main goal — do not surgically carve sections out; regenerate the spec for the narrowed scope. Continue to checkpoint.
- On **K**: Continue to checkpoint with full spec.

View File

@ -1,6 +1,4 @@
---
name: quick-dev-new-preview
description: 'Unified quick flow - clarify intent, plan, implement, review, present.'
main_config: '{project-root}/_bmad/bmm/config.yaml'
# Related workflows

View File

@ -124,13 +124,21 @@ Saved to: {finalFile}
Once you are fully satisfied with the spec (ideally after **Adversarial Review** and maybe a few rounds of **Advanced Elicitation**), it is recommended to run implementation in a FRESH CONTEXT for best results.
Copy this prompt to start dev:
Load and follow **Adversarial Review** in a fresh context (recommended for information asymmetry):
\`\`\`
quick-dev {finalFile}
/bmad-review-adversarial-general "{finalFile}"
\`\`\`
This ensures the dev agent has clean context focused solely on implementation.
Load and follow **development** in a fresh context:
\`\`\`
/quick-dev "{finalFile}"
\`\`\`
_(Both are slash commands — prefix `/` invokes a BMAD skill or workflow.)_
This ensures the agent has clean context focused solely on its task.
```
b) **HALT and wait for user selection.**
@ -177,7 +185,7 @@ b) **HALT and wait for user selection.**
When you're ready to implement, run:
```
quick-dev {finalFile}
/quick-dev {finalFile}
```
Ship it!"

View File

@ -1,7 +1,5 @@
# Document Project Workflow Router
<critical>The workflow execution engine is governed by: {project-root}/_bmad/core/tasks/workflow.xml</critical>
<critical>You MUST have already loaded and processed: {project-root}/_bmad/bmm/workflows/document-project/workflow.yaml</critical>
<critical>Communicate all responses in {communication_language}</critical>
<workflow>
@ -49,11 +47,11 @@
<action>Display: "Resuming {{workflow_mode}} from {{current_step}} with cached project type(s): {{cached_project_types}}"</action>
<check if="workflow_mode == deep_dive">
<action>Read fully and follow: {installed_path}/workflows/deep-dive-instructions.md with resume context</action>
<action>Read fully and follow: {installed_path}/workflows/deep-dive-workflow.md with resume context</action>
</check>
<check if="workflow_mode == initial_scan OR workflow_mode == full_rescan">
<action>Read fully and follow: {installed_path}/workflows/full-scan-instructions.md with resume context</action>
<action>Read fully and follow: {installed_path}/workflows/full-scan-workflow.md with resume context</action>
</check>
</check>
@ -100,7 +98,7 @@ Your choice [1/2/3]:
<check if="user selects 1">
<action>Set workflow_mode = "full_rescan"</action>
<action>Display: "Starting full project rescan..."</action>
<action>Read fully and follow: {installed_path}/workflows/full-scan-instructions.md</action>
<action>Read fully and follow: {installed_path}/workflows/full-scan-workflow.md</action>
<action>After sub-workflow completes, continue to Step 4</action>
</check>
@ -108,7 +106,7 @@ Your choice [1/2/3]:
<action>Set workflow_mode = "deep_dive"</action>
<action>Set scan_level = "exhaustive"</action>
<action>Display: "Starting deep-dive documentation mode..."</action>
<action>Read fully and follow: {installed_path}/workflows/deep-dive-instructions.md</action>
<action>Read fully and follow: {installed_path}/workflows/deep-dive-workflow.md</action>
<action>After sub-workflow completes, continue to Step 4</action>
</check>
@ -121,7 +119,7 @@ Your choice [1/2/3]:
<check if="index.md does not exist">
<action>Set workflow_mode = "initial_scan"</action>
<action>Display: "No existing documentation found. Starting initial project scan..."</action>
<action>Read fully and follow: {installed_path}/workflows/full-scan-instructions.md</action>
<action>Read fully and follow: {installed_path}/workflows/full-scan-workflow.md</action>
<action>After sub-workflow completes, continue to Step 4</action>
</check>

View File

@ -0,0 +1,39 @@
---
name: document-project
description: 'Document brownfield projects for AI context. Use when the user says "document this project" or "generate project docs"'
---
# Document Project Workflow
**Goal:** Document brownfield projects for AI context.
**Your Role:** Project documentation specialist.
- Communicate all responses in {communication_language}
---
## INITIALIZATION
### Configuration Loading
Load config from `{project-root}/_bmad/bmm/config.yaml` and resolve:
- `project_knowledge`
- `user_name`
- `communication_language`
- `document_output_language`
- `user_skill_level`
- `date` as system-generated current datetime
### Paths
- `installed_path` = `{project-root}/_bmad/bmm/workflows/document-project`
- `instructions` = `{installed_path}/instructions.md`
- `validation` = `{installed_path}/checklist.md`
- `documentation_requirements_csv` = `{installed_path}/documentation-requirements.csv`
---
## EXECUTION
Read fully and follow: `{installed_path}/instructions.md`

View File

@ -1,22 +0,0 @@
# Document Project Workflow Configuration
name: "document-project"
version: "1.2.0"
description: 'Document brownfield projects for AI context. Use when the user says "document this project" or "generate project docs"'
author: "BMad"
# Critical variables
config_source: "{project-root}/_bmad/bmm/config.yaml"
project_knowledge: "{config_source}:project_knowledge"
user_name: "{config_source}:user_name"
communication_language: "{config_source}:communication_language"
document_output_language: "{config_source}:document_output_language"
user_skill_level: "{config_source}:user_skill_level"
date: system-generated
# Module path and component files
installed_path: "{project-root}/_bmad/bmm/workflows/document-project"
instructions: "{installed_path}/instructions.md"
validation: "{installed_path}/checklist.md"
# Required data files - CRITICAL for project type detection and documentation requirements
documentation_requirements_csv: "{installed_path}/documentation-requirements.csv"

View File

@ -3,7 +3,6 @@
<workflow>
<critical>This workflow performs exhaustive deep-dive documentation of specific areas</critical>
<critical>Called by: ../document-project/instructions.md router</critical>
<critical>Handles: deep_dive mode only</critical>
<step n="13" goal="Deep-dive documentation of specific area" if="workflow_mode == deep_dive">

View File

@ -0,0 +1,42 @@
---
name: document-project-deep-dive
description: 'Exhaustive deep-dive documentation of specific project areas'
---
# Deep-Dive Documentation Sub-Workflow
**Goal:** Exhaustive deep-dive documentation of specific project areas.
**Your Role:** Deep-dive documentation specialist.
- Deep-dive mode requires literal full-file review. Sampling, guessing, or relying solely on tooling output is FORBIDDEN.
---
## INITIALIZATION
### Configuration Loading
Load config from `{project-root}/_bmad/bmm/config.yaml` and resolve:
- `project_knowledge`
- `user_name`
- `date` as system-generated current datetime
### Paths
- `installed_path` = `{project-root}/_bmad/bmm/workflows/document-project/workflows`
- `instructions` = `{installed_path}/deep-dive-instructions.md`
- `validation` = `{project-root}/_bmad/bmm/workflows/document-project/checklist.md`
- `deep_dive_template` = `{project-root}/_bmad/bmm/workflows/document-project/templates/deep-dive-template.md`
### Runtime Inputs
- `workflow_mode` = `deep_dive`
- `scan_level` = `exhaustive`
- `autonomous` = `false` (requires user input to select target area)
---
## EXECUTION
Read fully and follow: `{installed_path}/deep-dive-instructions.md`

View File

@ -1,31 +0,0 @@
# Deep-Dive Documentation Workflow Configuration
name: "document-project-deep-dive"
description: "Exhaustive deep-dive documentation of specific project areas"
author: "BMad"
# This is a sub-workflow called by document-project/workflow.yaml
parent_workflow: "{project-root}/_bmad/bmm/workflows/document-project/workflow.yaml"
# Critical variables inherited from parent
config_source: "{project-root}/_bmad/bmb/config.yaml"
project_knowledge: "{config_source}:project_knowledge"
user_name: "{config_source}:user_name"
date: system-generated
# Module path and component files
installed_path: "{project-root}/_bmad/bmm/workflows/document-project/workflows"
template: false # Action workflow
instructions: "{installed_path}/deep-dive-instructions.md"
validation: "{project-root}/_bmad/bmm/workflows/document-project/checklist.md"
# Templates
deep_dive_template: "{project-root}/_bmad/bmm/workflows/document-project/templates/deep-dive-template.md"
# Runtime inputs (passed from parent workflow)
workflow_mode: "deep_dive"
scan_level: "exhaustive" # Deep-dive always uses exhaustive scan
project_root_path: ""
existing_index_path: "" # Path to existing index.md
# Configuration
autonomous: false # Requires user input to select target area

View File

@ -3,7 +3,6 @@
<workflow>
<critical>This workflow performs complete project documentation (Steps 1-12)</critical>
<critical>Called by: document-project/instructions.md router</critical>
<critical>Handles: initial_scan and full_rescan modes</critical>
<step n="0.5" goal="Load documentation requirements data for fresh starts (not needed for resume)" if="resume_mode == false">

View File

@ -0,0 +1,42 @@
---
name: document-project-full-scan
description: 'Complete project documentation workflow (initial scan or full rescan)'
---
# Full Project Scan Sub-Workflow
**Goal:** Complete project documentation (initial scan or full rescan).
**Your Role:** Full project scan documentation specialist.
---
## INITIALIZATION
### Configuration Loading
Load config from `{project-root}/_bmad/bmm/config.yaml` and resolve:
- `project_knowledge`
- `user_name`
- `date` as system-generated current datetime
### Paths
- `installed_path` = `{project-root}/_bmad/bmm/workflows/document-project/workflows`
- `instructions` = `{installed_path}/full-scan-instructions.md`
- `validation` = `{project-root}/_bmad/bmm/workflows/document-project/checklist.md`
- `documentation_requirements_csv` = `{project-root}/_bmad/bmm/workflows/document-project/documentation-requirements.csv`
### Runtime Inputs
- `workflow_mode` = `""` (set by parent: `initial_scan` or `full_rescan`)
- `scan_level` = `""` (set by parent: `quick`, `deep`, or `exhaustive`)
- `resume_mode` = `false`
- `autonomous` = `false` (requires user input at key decision points)
---
## EXECUTION
Read fully and follow: `{installed_path}/full-scan-instructions.md`

View File

@ -1,31 +0,0 @@
# Full Project Scan Workflow Configuration
name: "document-project-full-scan"
description: "Complete project documentation workflow (initial scan or full rescan)"
author: "BMad"
# This is a sub-workflow called by document-project/workflow.yaml
parent_workflow: "{project-root}/_bmad/bmm/workflows/document-project/workflow.yaml"
# Critical variables inherited from parent
config_source: "{project-root}/_bmad/bmb/config.yaml"
project_knowledge: "{config_source}:project_knowledge"
user_name: "{config_source}:user_name"
date: system-generated
# Data files
documentation_requirements_csv: "{project-root}/_bmad/bmm/workflows/document-project/documentation-requirements.csv"
# Module path and component files
installed_path: "{project-root}/_bmad/bmm/workflows/document-project/workflows"
template: false # Action workflow
instructions: "{installed_path}/full-scan-instructions.md"
validation: "{project-root}/_bmad/bmm/workflows/document-project/checklist.md"
# Runtime inputs (passed from parent workflow)
workflow_mode: "" # "initial_scan" or "full_rescan"
scan_level: "" # "quick", "deep", or "exhaustive"
resume_mode: false
project_root_path: ""
# Configuration
autonomous: false # Requires user input at key decision points

View File

@ -0,0 +1,6 @@
---
name: bmad-review-adversarial-general
description: 'Perform a Cynical Review and produce a findings report. Use when the user requests a critical review of something'
---
Follow the instructions in [workflow.md](workflow.md).

View File

@ -1,8 +1,3 @@
---
name: bmad-review-adversarial-general
description: 'Perform a Cynical Review and produce a findings report. Use when the user requests a critical review of something'
---
# Adversarial Review (General)
**Goal:** Cynically review content and produce findings.

View File

@ -27,8 +27,3 @@ shard-doc.xml:
canonicalId: bmad-shard-doc
type: task
description: "Splits large markdown documents into smaller, organized files based on sections"
workflow.xml:
canonicalId: bmad-workflow
type: task
description: "Execute given workflow by loading its configuration and following instructions"

View File

@ -1,235 +0,0 @@
<task id="_bmad/core/tasks/workflow.xml" name="Execute Workflow" internal="true">
<objective>Execute given workflow by loading its configuration, following instructions, and producing output</objective>
<llm critical="true">
<mandate>Always read COMPLETE files - NEVER use offset/limit when reading any workflow related files</mandate>
<mandate>Instructions are MANDATORY - either as file path, steps or embedded list in YAML, XML or markdown</mandate>
<mandate>Execute ALL steps in instructions IN EXACT ORDER</mandate>
<mandate>Save to template output file after EVERY "template-output" tag</mandate>
<mandate>NEVER skip a step - YOU are responsible for every steps execution without fail or excuse</mandate>
</llm>
<WORKFLOW-RULES critical="true">
<rule n="1">Steps execute in exact numerical order (1, 2, 3...)</rule>
<rule n="2">Optional steps: Ask user unless #yolo mode active</rule>
<rule n="3">Template-output tags: Save content, discuss with the user the section completed, and NEVER proceed until the users indicates
to proceed (unless YOLO mode has been activated)</rule>
</WORKFLOW-RULES>
<flow>
<step n="1" title="Load and Initialize Workflow">
<substep n="1a" title="Load Configuration and Resolve Variables">
<action>Read workflow.yaml from provided path</action>
<mandate>Load config_source (REQUIRED for all modules)</mandate>
<phase n="1">Load external config from config_source path</phase>
<phase n="2">Resolve all {config_source}: references with values from config</phase>
<phase n="3">Resolve system variables (date:system-generated) and paths ({project-root}, {installed_path})</phase>
<phase n="4">Ask user for input of any variables that are still unknown</phase>
</substep>
<substep n="1b" title="Load Required Components">
<mandate>Instructions: Read COMPLETE file from path OR embedded list (REQUIRED)</mandate>
<check>If template path → Read COMPLETE template file</check>
<check>If validation path → Note path for later loading when needed</check>
<check>If template: false → Mark as action-workflow (else template-workflow)</check>
<note>Data files (csv, json) → Store paths only, load on-demand when instructions reference them</note>
</substep>
<substep n="1c" title="Initialize Output" if="template-workflow">
<action>Resolve default_output_file path with all variables and {{date}}</action>
<action>Create output directory if doesn't exist</action>
<action>If template-workflow → Write template to output file with placeholders</action>
<action>If action-workflow → Skip file creation</action>
</substep>
</step>
<step n="2" title="Process Each Instruction Step in Order">
<iterate>For each step in instructions:</iterate>
<substep n="2a" title="Handle Step Attributes">
<check>If optional="true" and NOT #yolo → Ask user to include</check>
<check>If if="condition" → Evaluate condition</check>
<check>If for-each="item" → Repeat step for each item</check>
<check>If repeat="n" → Repeat step n times</check>
</substep>
<substep n="2b" title="Execute Step Content">
<action>Process step instructions (markdown or XML tags)</action>
<action>Replace {{variables}} with values (ask user if unknown)</action>
<execute-tags>
<tag>action xml tag → Perform the action</tag>
<tag>check if="condition" xml tag → Conditional block wrapping actions (requires closing &lt;/check&gt;)</tag>
<tag>ask xml tag → Prompt user and WAIT for response</tag>
<tag>invoke-workflow xml tag → Execute another workflow with given inputs and the workflow.xml runner</tag>
<tag>invoke-task xml tag → Execute specified task</tag>
<tag>invoke-protocol name="protocol_name" xml tag → Execute reusable protocol from protocols section</tag>
<tag>goto step="x" → Jump to specified step</tag>
</execute-tags>
</substep>
<substep n="2c" title="Handle template-output Tags">
<if tag="template-output">
<mandate>Generate content for this section</mandate>
<mandate>Save to file (Write first time, Edit subsequent)</mandate>
<action>Display generated content</action>
<ask> [a] Advanced Elicitation, [c] Continue, [p] Party-Mode, [y] YOLO the rest of this document only. WAIT for response. <if
response="a">
<action>Start the advanced elicitation workflow {project-root}/_bmad/core/workflows/advanced-elicitation/workflow.md</action>
</if>
<if
response="c">
<action>Continue to next step</action>
</if>
<if response="p">
<action>Start the party-mode workflow {project-root}/_bmad/core/workflows/party-mode/workflow.md</action>
</if>
<if
response="y">
<action>Enter #yolo mode for the rest of the workflow</action>
</if>
</ask>
</if>
</substep>
<substep n="2d" title="Step Completion">
<check>If no special tags and NOT #yolo:</check>
<ask>Continue to next step? (y/n/edit)</ask>
</substep>
</step>
<step n="3" title="Completion">
<check>Confirm document saved to output path</check>
<action>Report workflow completion</action>
</step>
</flow>
<execution-modes>
<mode name="normal">Full user interaction and confirmation of EVERY step at EVERY template output - NO EXCEPTIONS except yolo MODE</mode>
<mode name="yolo">Skip all confirmations and elicitation, minimize prompts and try to produce all of the workflow automatically by
simulating the remaining discussions with an simulated expert user</mode>
</execution-modes>
<supported-tags desc="Instructions can use these tags">
<structural>
<tag>step n="X" goal="..." - Define step with number and goal</tag>
<tag>optional="true" - Step can be skipped</tag>
<tag>if="condition" - Conditional execution</tag>
<tag>for-each="collection" - Iterate over items</tag>
<tag>repeat="n" - Repeat n times</tag>
</structural>
<execution>
<tag>action - Required action to perform</tag>
<tag>action if="condition" - Single conditional action (inline, no closing tag needed)</tag>
<tag>check if="condition"&gt;...&lt;/check&gt; - Conditional block wrapping multiple items (closing tag required)</tag>
<tag>ask - Get user input (ALWAYS wait for response before continuing)</tag>
<tag>goto - Jump to another step</tag>
<tag>invoke-workflow - Call another workflow</tag>
<tag>invoke-task - Call a task</tag>
<tag>invoke-protocol - Execute a reusable protocol (e.g., discover_inputs)</tag>
</execution>
<output>
<tag>template-output - Save content checkpoint</tag>
<tag>critical - Cannot be skipped</tag>
<tag>example - Show example output</tag>
</output>
</supported-tags>
<protocols desc="Reusable workflow protocols that can be invoked via invoke-protocol tag">
<protocol name="discover_inputs" desc="Smart file discovery and loading based on input_file_patterns">
<objective>Intelligently load project files (whole or sharded) based on workflow's input_file_patterns configuration</objective>
<critical>Only execute if workflow.yaml contains input_file_patterns section</critical>
<flow>
<step n="1" title="Parse Input File Patterns">
<action>Read input_file_patterns from loaded workflow.yaml</action>
<action>For each pattern group (prd, architecture, epics, etc.), note the load_strategy if present</action>
</step>
<step n="2" title="Load Files Using Smart Strategies">
<iterate>For each pattern in input_file_patterns:</iterate>
<substep n="2a" title="Try Sharded Documents First">
<check if="sharded pattern exists">
<action>Determine load_strategy from pattern config (defaults to FULL_LOAD if not specified)</action>
<strategy name="FULL_LOAD">
<desc>Load ALL files in sharded directory - used for PRD, Architecture, UX, brownfield docs</desc>
<action>Use glob pattern to find ALL .md files (e.g., "{output_folder}/*architecture*/*.md")</action>
<action>Load EVERY matching file completely</action>
<action>Concatenate content in logical order (index.md first if exists, then alphabetical)</action>
<action>Store in variable: {pattern_name_content}</action>
</strategy>
<strategy name="SELECTIVE_LOAD">
<desc>Load specific shard using template variable - example: used for epics with {{epic_num}}</desc>
<action>Check for template variables in sharded_single pattern (e.g., {{epic_num}})</action>
<action>If variable undefined, ask user for value OR infer from context</action>
<action>Resolve template to specific file path</action>
<action>Load that specific file</action>
<action>Store in variable: {pattern_name_content}</action>
</strategy>
<strategy name="INDEX_GUIDED">
<desc>Load index.md, analyze structure and description of each doc in the index, then intelligently load relevant docs</desc>
<mandate>DO NOT BE LAZY - use best judgment to load documents that might have relevant information, even if only a 5% chance</mandate>
<action>Load index.md from sharded directory</action>
<action>Parse table of contents, links, section headers</action>
<action>Analyze workflow's purpose and objective</action>
<action>Identify which linked/referenced documents are likely relevant</action>
<example>If workflow is about authentication and index shows "Auth Overview", "Payment Setup", "Deployment" → Load auth
docs, consider deployment docs, skip payment</example>
<action>Load all identified relevant documents</action>
<action>Store combined content in variable: {pattern_name_content}</action>
<note>When in doubt, LOAD IT - context is valuable, being thorough is better than missing critical info</note>
</strategy>
<action>Mark pattern as RESOLVED, skip to next pattern</action>
</check>
</substep>
<substep n="2b" title="Try Whole Document if No Sharded Found">
<check if="no sharded matches found OR no sharded pattern exists">
<action>Attempt glob match on 'whole' pattern (e.g., "{output_folder}/*prd*.md")</action>
<check if="matches found">
<action>Load ALL matching files completely (no offset/limit)</action>
<action>Store content in variable: {pattern_name_content} (e.g., {prd_content})</action>
<action>Mark pattern as RESOLVED, skip to next pattern</action>
</check>
</check>
</substep>
<substep n="2c" title="Handle Not Found">
<check if="no matches for sharded OR whole">
<action>Set {pattern_name_content} to empty string</action>
<action>Note in session: "No {pattern_name} files found" (not an error, just unavailable, offer use change to provide)</action>
</check>
</substep>
</step>
<step n="3" title="Report Discovery Results">
<action>List all loaded content variables with file counts</action>
<example>
✓ Loaded {prd_content} from 5 sharded files: prd/index.md, prd/requirements.md, ...
✓ Loaded {architecture_content} from 1 file: Architecture.md
✓ Loaded {epics_content} from selective load: epics/epic-3.md
○ No ux_design files found
</example>
<note>This gives workflow transparency into what context is available</note>
</step>
</flow>
</protocol>
</protocols>
<llm final="true">
<critical-rules>
• This is the complete workflow execution engine
• You MUST Follow instructions exactly as written
• The workflow execution engine is governed by: {project-root}/_bmad/core/tasks/workflow.xml
• You MUST have already loaded and processed: {installed_path}/workflow.yaml
• This workflow uses INTENT-DRIVEN PLANNING - adapt organically to product type and context
• YOU ARE FACILITATING A CONVERSATION With a user to produce a final document step by step. The whole process is meant to be
collaborative helping the user flesh out their ideas. Do not rush or optimize and skip any section.
</critical-rules>
</llm>
</task>

View File

@ -11,4 +11,4 @@
<step n="{HELP_STEP}">Let {user_name} know they can type command `/bmad-help` at any time to get advice on what to do next, and that they can combine that with what they need help with <example>`/bmad-help where should I start with an idea I have that does XYZ`</example></step>
<step n="{HALT_STEP}">STOP and WAIT for user input - do NOT execute menu items automatically - accept number or cmd trigger or fuzzy command match</step>
<step n="{INPUT_STEP}">On user input: Number → process menu item[n] | Text → case-insensitive substring match | Multiple matches → ask user to clarify | No match → show "Not recognized"</step>
<step n="{EXECUTE_STEP}">When processing a menu item: Check menu-handlers section below - extract any attributes from the selected menu item (workflow, exec, tmpl, data, action, validate-workflow) and follow the corresponding handler instructions</step>
<step n="{EXECUTE_STEP}">When processing a menu item: Check menu-handlers section below - extract any attributes from the selected menu item (exec, tmpl, data, action, multi) and follow the corresponding handler instructions</step>

View File

@ -4,10 +4,9 @@
2. Parse all nested handlers within the multi item
3. For each nested handler:
- Use the 'match' attribute for fuzzy matching user input (or Exact Match of character code in brackets [])
- Process based on handler attributes (exec, workflow, action)
- Process based on handler attributes (exec, action)
4. When user input matches a handler's 'match' pattern:
- For exec="path/to/file.md": follow the `handler type="exec"` instructions
- For workflow="path/to/workflow.yaml": follow the `handler type="workflow"` instructions
- For action="...": Perform the specified action directly
5. Support both exact matches and fuzzy matching based on the match attribute
6. If no handler matches, prompt user to choose from available options

View File

@ -1,7 +0,0 @@
<handler type="validate-workflow">
When command has: validate-workflow="path/to/workflow.yaml"
1. You MUST LOAD the file at: {project-root}/_bmad/core/tasks/validate-workflow.xml
2. READ its entire contents and EXECUTE all instructions in that file
3. Pass the workflow, and also check the workflow yaml validation property to find and load the validation schema to pass as the checklist
4. The workflow should try to identify the file to validate based on checklist context or else you will ask the user to specify
</handler>

View File

@ -1,10 +0,0 @@
<handler type="workflow">
When menu item has: workflow="path/to/workflow.yaml":
1. CRITICAL: Always LOAD {project-root}/_bmad/core/tasks/workflow.xml
2. Read the complete file - this is the CORE OS for processing BMAD workflows
3. Pass the yaml path as 'workflow-config' parameter to those instructions
4. Follow workflow.xml instructions precisely following all steps
5. Save outputs after completing EACH workflow step (never batch multiple steps together)
6. If workflow.yaml path is "todo", inform user the workflow hasn't been implemented yet
</handler>

View File

@ -19,7 +19,7 @@ agent:
menu:
- trigger: workflow-test
description: Test workflow command
workflow: path/to/workflow
exec: path/to/workflow
- trigger: validate-test
description: Test validate-workflow command
validate-workflow: path/to/validation

View File

@ -19,6 +19,5 @@ agent:
menu:
- trigger: multi-command
description: Menu item with multiple command targets
workflow: path/to/workflow
exec: npm test
exec: path/to/workflow
action: perform_action

View File

@ -22,7 +22,7 @@ agent:
action: display_help
- trigger: start-workflow
description: Start a workflow
workflow: path/to/workflow
exec: path/to/workflow
- trigger: execute
description: Execute command
exec: npm test

View File

@ -1,3 +1,3 @@
module,phase,name,code,sequence,workflow-file,command,required,agent,options,description,output-location,outputs,
bmm,anytime,Document Project,DP,,_bmad/bmm/workflows/document-project/workflow.yaml,bmad-bmm-document-project,false,analyst,Create Mode,"Analyze project",project-knowledge,*,
bmm,anytime,Document Project,DP,,_bmad/bmm/workflows/document-project/workflow.md,bmad-bmm-document-project,false,analyst,Create Mode,"Analyze project",project-knowledge,*,
bmm,1-analysis,Brainstorm Project,BP,10,_bmad/core/workflows/brainstorming/workflow.md,bmad-brainstorming,false,analyst,data=template.md,"Brainstorming",planning_artifacts,"session",

1 module phase name code sequence workflow-file command required agent options description output-location outputs
2 bmm anytime Document Project DP _bmad/bmm/workflows/document-project/workflow.yaml _bmad/bmm/workflows/document-project/workflow.md bmad-bmm-document-project false analyst Create Mode Analyze project project-knowledge *
3 bmm 1-analysis Brainstorm Project BP 10 _bmad/core/workflows/brainstorming/workflow.md bmad-brainstorming false analyst data=template.md Brainstorming planning_artifacts session

View File

@ -58,7 +58,7 @@ test('bmm-style.csv: extracts workflow-file refs with trailing commas', () => {
const { fullPath, content } = loadFixture('valid/bmm-style.csv');
const refs = extractCsvRefs(fullPath, content);
assert(refs.length === 2, `Expected 2 refs, got ${refs.length}`);
assert(refs[0].raw === '_bmad/bmm/workflows/document-project/workflow.yaml', `Wrong raw[0]: ${refs[0].raw}`);
assert(refs[0].raw === '_bmad/bmm/workflows/document-project/workflow.md', `Wrong raw[0]: ${refs[0].raw}`);
assert(refs[1].raw === '_bmad/core/workflows/brainstorming/workflow.md', `Wrong raw[1]: ${refs[1].raw}`);
assert(refs[0].type === 'project-root', `Wrong type: ${refs[0].type}`);
assert(refs[0].line === 2, `Wrong line for row 0: ${refs[0].line}`);

View File

@ -1607,9 +1607,10 @@ async function runTests() {
await fs.ensureDir(skillDir29);
await fs.writeFile(path.join(skillDir29, 'bmad-skill-manifest.yaml'), 'type: skill\n');
await fs.writeFile(
path.join(skillDir29, 'workflow.md'),
'---\nname: My Custom Skill\ndescription: A skill at an unusual path\n---\n\nSkill body content\n',
path.join(skillDir29, 'SKILL.md'),
'---\nname: my-skill\ndescription: A skill at an unusual path\n---\n\nFollow the instructions in [workflow.md](workflow.md).\n',
);
await fs.writeFile(path.join(skillDir29, 'workflow.md'), '# My Custom Skill\n\nSkill body content\n');
// --- Regular workflow dir: core/workflows/regular-wf/ (type: workflow) ---
const wfDir29 = path.join(tempFixture29, 'core', 'workflows', 'regular-wf');
@ -1625,18 +1626,20 @@ async function runTests() {
await fs.ensureDir(wfSkillDir29);
await fs.writeFile(path.join(wfSkillDir29, 'bmad-skill-manifest.yaml'), 'type: skill\n');
await fs.writeFile(
path.join(wfSkillDir29, 'workflow.md'),
'---\nname: Workflow Skill\ndescription: A skill inside workflows dir\n---\n\nSkill in workflows\n',
path.join(wfSkillDir29, 'SKILL.md'),
'---\nname: wf-skill\ndescription: A skill inside workflows dir\n---\n\nFollow the instructions in [workflow.md](workflow.md).\n',
);
await fs.writeFile(path.join(wfSkillDir29, 'workflow.md'), '# Workflow Skill\n\nSkill in workflows\n');
// --- Skill inside tasks/ dir: core/tasks/task-skill/ ---
const taskSkillDir29 = path.join(tempFixture29, 'core', 'tasks', 'task-skill');
await fs.ensureDir(taskSkillDir29);
await fs.writeFile(path.join(taskSkillDir29, 'bmad-skill-manifest.yaml'), 'type: skill\n');
await fs.writeFile(
path.join(taskSkillDir29, 'workflow.md'),
'---\nname: Task Skill\ndescription: A skill inside tasks dir\n---\n\nSkill in tasks\n',
path.join(taskSkillDir29, 'SKILL.md'),
'---\nname: task-skill\ndescription: A skill inside tasks dir\n---\n\nFollow the instructions in [workflow.md](workflow.md).\n',
);
await fs.writeFile(path.join(taskSkillDir29, 'workflow.md'), '# Task Skill\n\nSkill in tasks\n');
// Minimal agent so core module is detected
await fs.ensureDir(path.join(tempFixture29, 'core', 'agents'));
@ -1649,14 +1652,14 @@ async function runTests() {
// Skill at unusual path should be in skills
const skillEntry29 = generator29.skills.find((s) => s.canonicalId === 'my-skill');
assert(skillEntry29 !== undefined, 'Skill at unusual path appears in skills[]');
assert(skillEntry29 && skillEntry29.name === 'My Custom Skill', 'Skill has correct name from frontmatter');
assert(skillEntry29 && skillEntry29.name === 'my-skill', 'Skill has correct name from frontmatter');
assert(
skillEntry29 && skillEntry29.path.includes('custom-area/my-skill/workflow.md'),
skillEntry29 && skillEntry29.path.includes('custom-area/my-skill/SKILL.md'),
'Skill path includes relative path from module root',
);
// Skill should NOT be in workflows
const inWorkflows29 = generator29.workflows.find((w) => w.name === 'My Custom Skill');
const inWorkflows29 = generator29.workflows.find((w) => w.name === 'my-skill');
assert(inWorkflows29 === undefined, 'Skill at unusual path does NOT appear in workflows[]');
// Skill in tasks/ dir should be in skills
@ -1664,7 +1667,7 @@ async function runTests() {
assert(taskSkillEntry29 !== undefined, 'Skill in tasks/ dir appears in skills[]');
// Skill in tasks/ should NOT appear in tasks[]
const inTasks29 = generator29.tasks.find((t) => t.name === 'Task Skill');
const inTasks29 = generator29.tasks.find((t) => t.name === 'task-skill');
assert(inTasks29 === undefined, 'Skill in tasks/ dir does NOT appear in tasks[]');
// Regular workflow should be in workflows, NOT in skills
@ -1677,7 +1680,7 @@ async function runTests() {
// Skill inside workflows/ should be in skills[], NOT in workflows[] (exercises findWorkflows skip at lines 311/322)
const wfSkill29 = generator29.skills.find((s) => s.canonicalId === 'wf-skill');
assert(wfSkill29 !== undefined, 'Skill in workflows/ dir appears in skills[]');
const wfSkillInWorkflows29 = generator29.workflows.find((w) => w.name === 'Workflow Skill');
const wfSkillInWorkflows29 = generator29.workflows.find((w) => w.name === 'wf-skill');
assert(wfSkillInWorkflows29 === undefined, 'Skill in workflows/ dir does NOT appear in workflows[]');
// Test scanInstalledModules recognizes skill-only modules
@ -1685,9 +1688,10 @@ async function runTests() {
await fs.ensureDir(path.join(skillOnlyModDir29, 'deep', 'nested', 'my-skill'));
await fs.writeFile(path.join(skillOnlyModDir29, 'deep', 'nested', 'my-skill', 'bmad-skill-manifest.yaml'), 'type: skill\n');
await fs.writeFile(
path.join(skillOnlyModDir29, 'deep', 'nested', 'my-skill', 'workflow.md'),
'---\nname: Nested Skill\ndescription: desc\n---\nbody\n',
path.join(skillOnlyModDir29, 'deep', 'nested', 'my-skill', 'SKILL.md'),
'---\nname: my-skill\ndescription: desc\n---\n\nFollow the instructions in [workflow.md](workflow.md).\n',
);
await fs.writeFile(path.join(skillOnlyModDir29, 'deep', 'nested', 'my-skill', 'workflow.md'), '# Nested Skill\n\nbody\n');
const scannedModules29 = await generator29.scanInstalledModules(tempFixture29);
assert(scannedModules29.includes('skill-only-mod'), 'scanInstalledModules recognizes skill-only module');
@ -1699,6 +1703,73 @@ async function runTests() {
console.log('');
// ============================================================
// Suite 30: parseSkillMd validation (negative cases)
// ============================================================
console.log(`${colors.yellow}Test Suite 30: parseSkillMd Validation${colors.reset}\n`);
let tempFixture30;
try {
tempFixture30 = await fs.mkdtemp(path.join(os.tmpdir(), 'bmad-test-30-'));
const generator30 = new ManifestGenerator();
generator30.bmadFolderName = '_bmad';
// Case 1: Missing SKILL.md entirely
const noSkillDir = path.join(tempFixture30, 'no-skill-md');
await fs.ensureDir(noSkillDir);
const result1 = await generator30.parseSkillMd(path.join(noSkillDir, 'SKILL.md'), noSkillDir, 'no-skill-md');
assert(result1 === null, 'parseSkillMd returns null when SKILL.md is missing');
// Case 2: SKILL.md with no frontmatter
const noFmDir = path.join(tempFixture30, 'no-frontmatter');
await fs.ensureDir(noFmDir);
await fs.writeFile(path.join(noFmDir, 'SKILL.md'), '# Just a heading\n\nNo frontmatter here.\n');
const result2 = await generator30.parseSkillMd(path.join(noFmDir, 'SKILL.md'), noFmDir, 'no-frontmatter');
assert(result2 === null, 'parseSkillMd returns null when SKILL.md has no frontmatter');
// Case 3: SKILL.md missing description
const noDescDir = path.join(tempFixture30, 'no-desc');
await fs.ensureDir(noDescDir);
await fs.writeFile(path.join(noDescDir, 'SKILL.md'), '---\nname: no-desc\n---\n\nBody.\n');
const result3 = await generator30.parseSkillMd(path.join(noDescDir, 'SKILL.md'), noDescDir, 'no-desc');
assert(result3 === null, 'parseSkillMd returns null when description is missing');
// Case 4: SKILL.md missing name
const noNameDir = path.join(tempFixture30, 'no-name');
await fs.ensureDir(noNameDir);
await fs.writeFile(path.join(noNameDir, 'SKILL.md'), '---\ndescription: has desc but no name\n---\n\nBody.\n');
const result4 = await generator30.parseSkillMd(path.join(noNameDir, 'SKILL.md'), noNameDir, 'no-name');
assert(result4 === null, 'parseSkillMd returns null when name is missing');
// Case 5: Name mismatch
const mismatchDir = path.join(tempFixture30, 'actual-dir-name');
await fs.ensureDir(mismatchDir);
await fs.writeFile(path.join(mismatchDir, 'SKILL.md'), '---\nname: wrong-name\ndescription: A skill\n---\n\nBody.\n');
const result5 = await generator30.parseSkillMd(path.join(mismatchDir, 'SKILL.md'), mismatchDir, 'actual-dir-name');
assert(result5 === null, 'parseSkillMd returns null when name does not match directory name');
// Case 6: Valid SKILL.md (positive control)
const validDir = path.join(tempFixture30, 'valid-skill');
await fs.ensureDir(validDir);
await fs.writeFile(path.join(validDir, 'SKILL.md'), '---\nname: valid-skill\ndescription: A valid skill\n---\n\nBody.\n');
const result6 = await generator30.parseSkillMd(path.join(validDir, 'SKILL.md'), validDir, 'valid-skill');
assert(result6 !== null && result6.name === 'valid-skill', 'parseSkillMd returns metadata for valid SKILL.md');
// Case 7: Malformed YAML (non-object)
const malformedDir = path.join(tempFixture30, 'malformed');
await fs.ensureDir(malformedDir);
await fs.writeFile(path.join(malformedDir, 'SKILL.md'), '---\njust a string\n---\n\nBody.\n');
const result7 = await generator30.parseSkillMd(path.join(malformedDir, 'SKILL.md'), malformedDir, 'malformed');
assert(result7 === null, 'parseSkillMd returns null for non-object YAML frontmatter');
} catch (error) {
assert(false, 'parseSkillMd validation test succeeds', error.message);
} finally {
if (tempFixture30) await fs.remove(tempFixture30).catch(() => {});
}
console.log('');
// ============================================================
// Summary
// ============================================================

View File

@ -0,0 +1,88 @@
/**
* Workflow Path Regex Tests
*
* Tests that the source and install workflow path regexes in ModuleManager
* extract the correct capture groups (module name and workflow sub-path).
*
* Usage: node test/test-workflow-path-regex.js
*/
// ANSI colors
const colors = {
reset: '\u001B[0m',
green: '\u001B[32m',
red: '\u001B[31m',
cyan: '\u001B[36m',
dim: '\u001B[2m',
};
let passed = 0;
let failed = 0;
function assert(condition, testName, errorMessage = '') {
if (condition) {
console.log(`${colors.green}${colors.reset} ${testName}`);
passed++;
} else {
console.log(`${colors.red}${colors.reset} ${testName}`);
if (errorMessage) {
console.log(` ${colors.dim}${errorMessage}${colors.reset}`);
}
failed++;
}
}
// ---------------------------------------------------------------------------
// These regexes are extracted from ModuleManager.vendorWorkflowDependencies()
// in tools/cli/installers/lib/modules/manager.js
// ---------------------------------------------------------------------------
// Source regex (line ~1081) — uses non-capturing group for _bmad
const SOURCE_REGEX = /\{project-root\}\/(?:_bmad)\/([^/]+)\/workflows\/(.+)/;
// Install regex (line ~1091) — uses non-capturing group for _bmad,
// consistent with source regex
const INSTALL_REGEX = /\{project-root\}\/(?:_bmad)\/([^/]+)\/workflows\/(.+)/;
// ---------------------------------------------------------------------------
// Test data
// ---------------------------------------------------------------------------
const sourcePath = '{project-root}/_bmad/bmm/workflows/4-implementation/create-story/workflow.md';
const installPath = '{project-root}/_bmad/bmgd/workflows/4-production/create-story/workflow.md';
console.log(`\n${colors.cyan}Workflow Path Regex Tests${colors.reset}\n`);
// --- Source regex tests (these should pass — source regex is correct) ---
const sourceMatch = sourcePath.match(SOURCE_REGEX);
assert(sourceMatch !== null, 'Source regex matches source path');
assert(
sourceMatch && sourceMatch[1] === 'bmm',
'Source regex group [1] is the module name',
`Expected "bmm", got "${sourceMatch && sourceMatch[1]}"`,
);
assert(
sourceMatch && sourceMatch[2] === '4-implementation/create-story/workflow.md',
'Source regex group [2] is the workflow sub-path',
`Expected "4-implementation/create-story/workflow.md", got "${sourceMatch && sourceMatch[2]}"`,
);
// --- Install regex tests (group [2] returns module name, not sub-path) ---
const installMatch = installPath.match(INSTALL_REGEX);
assert(installMatch !== null, 'Install regex matches install path');
// This is the critical test: installMatch[2] should be the workflow sub-path,
// because the code uses it as `installWorkflowSubPath`.
// With the bug, installMatch[2] is "bmgd" (module name) instead of the sub-path.
assert(
installMatch && installMatch[2] === '4-production/create-story/workflow.md',
'Install regex group [2] is the workflow sub-path (used as installWorkflowSubPath)',
`Expected "4-production/create-story/workflow.md", got "${installMatch && installMatch[2]}"`,
);
// --- Summary ---
console.log(`\n${passed} passed, ${failed} failed\n`);
process.exit(failed > 0 ? 1 : 0);

View File

@ -148,7 +148,7 @@ class ManifestGenerator {
/**
* Recursively walk a module directory tree, collecting skill directories.
* A skill directory is one that contains both a bmad-skill-manifest.yaml with
* type: skill AND a workflow.md (or workflow.yaml) file.
* type: skill AND a SKILL.md file with name/description frontmatter.
* Populates this.skills[] and this.skillClaimedDirs (Set of absolute paths).
*/
async collectSkills() {
@ -169,45 +169,26 @@ class ManifestGenerator {
return;
}
// Check this directory for skill manifest + workflow file
// Check this directory for skill manifest
const manifest = await this.loadSkillManifest(dir);
// Try both workflow.md and workflow.yaml
const workflowFilenames = ['workflow.md', 'workflow.yaml'];
for (const workflowFile of workflowFilenames) {
const workflowPath = path.join(dir, workflowFile);
if (!(await fs.pathExists(workflowPath))) continue;
// Determine if this directory is a skill (type: skill in manifest)
const skillFile = 'SKILL.md';
const artifactType = this.getArtifactType(manifest, skillFile);
const artifactType = this.getArtifactType(manifest, workflowFile);
if (artifactType !== 'skill') continue;
if (artifactType === 'skill') {
const skillMdPath = path.join(dir, 'SKILL.md');
const dirName = path.basename(dir);
// Read and parse the workflow file
try {
const rawContent = await fs.readFile(workflowPath, 'utf8');
const content = rawContent.replaceAll('\r\n', '\n').replaceAll('\r', '\n');
// Validate and parse SKILL.md
const skillMeta = await this.parseSkillMd(skillMdPath, dir, dirName, debug);
let workflow;
if (workflowFile === 'workflow.yaml') {
workflow = yaml.parse(content);
} else {
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
if (!frontmatterMatch) {
if (debug) console.log(`[DEBUG] collectSkills: skipped (no frontmatter): ${workflowPath}`);
continue;
}
workflow = yaml.parse(frontmatterMatch[1]);
}
if (!workflow || !workflow.name || !workflow.description) {
if (debug) console.log(`[DEBUG] collectSkills: skipped (missing name/description): ${workflowPath}`);
continue;
}
// Build path relative from module root
if (skillMeta) {
// Build path relative from module root (points to SKILL.md — the permanent entrypoint)
const relativePath = path.relative(modulePath, dir).split(path.sep).join('/');
const installPath = relativePath
? `${this.bmadFolderName}/${moduleName}/${relativePath}/${workflowFile}`
: `${this.bmadFolderName}/${moduleName}/${workflowFile}`;
? `${this.bmadFolderName}/${moduleName}/${relativePath}/${skillFile}`
: `${this.bmadFolderName}/${moduleName}/${skillFile}`;
// Skills derive canonicalId from directory name — never from manifest
if (manifest && manifest.__single && manifest.__single.canonicalId) {
@ -215,21 +196,21 @@ class ManifestGenerator {
`Warning: Skill manifest at ${dir}/bmad-skill-manifest.yaml contains canonicalId — this field is ignored for skills (directory name is the canonical ID)`,
);
}
const canonicalId = path.basename(dir);
const canonicalId = dirName;
this.skills.push({
name: workflow.name,
description: this.cleanForCSV(workflow.description),
name: skillMeta.name,
description: this.cleanForCSV(skillMeta.description),
module: moduleName,
path: installPath,
canonicalId,
install_to_bmad: this.getInstallToBmad(manifest, workflowFile),
install_to_bmad: this.getInstallToBmad(manifest, skillFile),
});
// Add to files list
this.files.push({
type: 'skill',
name: workflow.name,
name: skillMeta.name,
module: moduleName,
path: installPath,
});
@ -237,17 +218,13 @@ class ManifestGenerator {
this.skillClaimedDirs.add(dir);
if (debug) {
console.log(`[DEBUG] collectSkills: claimed skill "${workflow.name}" as ${canonicalId} at ${dir}`);
console.log(`[DEBUG] collectSkills: claimed skill "${skillMeta.name}" as ${canonicalId} at ${dir}`);
}
break; // Successfully claimed — skip remaining workflow filenames
} catch (error) {
if (debug) console.log(`[DEBUG] collectSkills: failed to parse ${workflowPath}: ${error.message}`);
}
}
// Warn if manifest says type:skill but no workflow file found
// Warn if manifest says type:skill but directory was not claimed
if (manifest && !this.skillClaimedDirs.has(dir)) {
// Check if any entry in the manifest is type:skill
let hasSkillType = false;
if (manifest.__single) {
hasSkillType = manifest.__single.type === 'skill';
@ -260,12 +237,7 @@ class ManifestGenerator {
}
}
if (hasSkillType && debug) {
const hasWorkflow = workflowFilenames.some((f) => entries.some((e) => e.name === f));
if (hasWorkflow) {
console.log(`[DEBUG] collectSkills: dir has type:skill manifest but workflow file failed to parse: ${dir}`);
} else {
console.log(`[DEBUG] collectSkills: dir has type:skill manifest but no workflow.md/workflow.yaml: ${dir}`);
}
console.log(`[DEBUG] collectSkills: dir has type:skill manifest but failed validation: ${dir}`);
}
}
@ -285,6 +257,57 @@ class ManifestGenerator {
}
}
/**
* Parse and validate SKILL.md for a skill directory.
* Returns parsed frontmatter object with name/description, or null if invalid.
* @param {string} skillMdPath - Absolute path to SKILL.md
* @param {string} dir - Skill directory path (for error messages)
* @param {string} dirName - Expected name (must match frontmatter name)
* @param {boolean} debug - Whether to emit debug-level messages
* @returns {Promise<Object|null>} Parsed frontmatter or null
*/
async parseSkillMd(skillMdPath, dir, dirName, debug = false) {
if (!(await fs.pathExists(skillMdPath))) {
if (debug) console.log(`[DEBUG] parseSkillMd: "${dir}" is missing SKILL.md — skipping`);
return null;
}
try {
const rawContent = await fs.readFile(skillMdPath, 'utf8');
const content = rawContent.replaceAll('\r\n', '\n').replaceAll('\r', '\n');
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
if (frontmatterMatch) {
const skillMeta = yaml.parse(frontmatterMatch[1]);
if (
!skillMeta ||
typeof skillMeta !== 'object' ||
typeof skillMeta.name !== 'string' ||
typeof skillMeta.description !== 'string' ||
!skillMeta.name ||
!skillMeta.description
) {
if (debug) console.log(`[DEBUG] parseSkillMd: SKILL.md in "${dir}" is missing name or description (or wrong type) — skipping`);
return null;
}
if (skillMeta.name !== dirName) {
console.error(`Error: SKILL.md name "${skillMeta.name}" does not match directory name "${dirName}" — skipping`);
return null;
}
return skillMeta;
}
if (debug) console.log(`[DEBUG] parseSkillMd: SKILL.md in "${dir}" has no frontmatter — skipping`);
return null;
} catch (error) {
if (debug) console.log(`[DEBUG] parseSkillMd: failed to parse SKILL.md in "${dir}": ${error.message} — skipping`);
return null;
}
}
/**
* Collect all workflows from core and selected modules
* Scans the INSTALLED bmad directory, not the source
@ -308,7 +331,7 @@ class ManifestGenerator {
}
/**
* Recursively find and parse workflow.yaml and workflow.md files
* Recursively find and parse workflow.md files
*/
async getWorkflowsFromPath(basePath, moduleName, subDir = 'workflows') {
const workflows = [];
@ -326,7 +349,7 @@ class ManifestGenerator {
return workflows;
}
// Recursively find workflow.yaml files
// Recursively find workflow.md files
const findWorkflows = async (dir, relativePath = '') => {
// Skip directories already claimed as skills
if (this.skillClaimedDirs && this.skillClaimedDirs.has(dir)) return;
@ -344,11 +367,7 @@ class ManifestGenerator {
// Recurse into subdirectories
const newRelativePath = relativePath ? `${relativePath}/${entry.name}` : entry.name;
await findWorkflows(fullPath, newRelativePath);
} else if (
entry.name === 'workflow.yaml' ||
entry.name === 'workflow.md' ||
(entry.name.startsWith('workflow-') && entry.name.endsWith('.md'))
) {
} else if (entry.name === 'workflow.md' || (entry.name.startsWith('workflow-') && entry.name.endsWith('.md'))) {
// Parse workflow file (both YAML and MD formats)
if (debug) {
console.log(`[DEBUG] Found workflow file: ${fullPath}`);
@ -358,21 +377,15 @@ class ManifestGenerator {
const rawContent = await fs.readFile(fullPath, 'utf8');
const content = rawContent.replaceAll('\r\n', '\n').replaceAll('\r', '\n');
let workflow;
if (entry.name === 'workflow.yaml') {
// Parse YAML workflow
workflow = yaml.parse(content);
} else {
// Parse MD workflow with YAML frontmatter
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
if (!frontmatterMatch) {
if (debug) {
console.log(`[DEBUG] Skipped (no frontmatter): ${fullPath}`);
}
continue; // Skip MD files without frontmatter
// Parse MD workflow with YAML frontmatter
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/);
if (!frontmatterMatch) {
if (debug) {
console.log(`[DEBUG] Skipped (no frontmatter): ${fullPath}`);
}
workflow = yaml.parse(frontmatterMatch[1]);
continue; // Skip MD files without frontmatter
}
const workflow = yaml.parse(frontmatterMatch[1]);
if (debug) {
console.log(`[DEBUG] Parsed: name="${workflow.name}", description=${workflow.description ? 'OK' : 'MISSING'}`);
@ -1343,7 +1356,7 @@ class ManifestGenerator {
// Check for manifest in this directory
const manifest = await this.loadSkillManifest(dir);
if (manifest) {
const type = this.getArtifactType(manifest, 'workflow.md') || this.getArtifactType(manifest, 'workflow.yaml');
const type = this.getArtifactType(manifest, 'workflow.md');
if (type === 'skill') return true;
}

View File

@ -289,7 +289,7 @@ class BaseIdeSetup {
// Get core workflows
const coreWorkflowsPath = path.join(bmadDir, 'core', 'workflows');
if (await fs.pathExists(coreWorkflowsPath)) {
const coreWorkflows = await this.findWorkflowYamlFiles(coreWorkflowsPath);
const coreWorkflows = await this.findWorkflowFiles(coreWorkflowsPath);
workflows.push(
...coreWorkflows.map((w) => ({
...w,
@ -304,7 +304,7 @@ class BaseIdeSetup {
if (entry.isDirectory() && entry.name !== 'core' && entry.name !== '_config' && entry.name !== 'agents') {
const moduleWorkflowsPath = path.join(bmadDir, entry.name, 'workflows');
if (await fs.pathExists(moduleWorkflowsPath)) {
const moduleWorkflows = await this.findWorkflowYamlFiles(moduleWorkflowsPath);
const moduleWorkflows = await this.findWorkflowFiles(moduleWorkflowsPath);
workflows.push(
...moduleWorkflows.map((w) => ({
...w,
@ -324,11 +324,13 @@ class BaseIdeSetup {
}
/**
* Recursively find workflow.yaml files
* Recursively find workflow.md files
* @param {string} dir - Directory to search
* @param {string} [rootDir] - Original root directory (used internally for recursion)
* @returns {Array} List of workflow file info objects
*/
async findWorkflowYamlFiles(dir) {
async findWorkflowFiles(dir, rootDir = null) {
rootDir = rootDir || dir;
const workflows = [];
if (!(await fs.pathExists(dir))) {
@ -342,14 +344,17 @@ class BaseIdeSetup {
if (entry.isDirectory()) {
// Recursively search subdirectories
const subWorkflows = await this.findWorkflowYamlFiles(fullPath);
const subWorkflows = await this.findWorkflowFiles(fullPath, rootDir);
workflows.push(...subWorkflows);
} else if (entry.isFile() && entry.name === 'workflow.yaml') {
// Read workflow.yaml to get name and standalone property
} else if (entry.isFile() && entry.name === 'workflow.md') {
// Read workflow.md frontmatter to get name and standalone property
try {
const yaml = require('yaml');
const content = await fs.readFile(fullPath, 'utf8');
const workflowData = yaml.parse(content);
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
if (!frontmatterMatch) continue;
const workflowData = yaml.parse(frontmatterMatch[1]);
if (workflowData && workflowData.name) {
// Workflows are standalone by default unless explicitly false
@ -357,7 +362,7 @@ class BaseIdeSetup {
workflows.push({
name: workflowData.name,
path: fullPath,
relativePath: path.relative(dir, fullPath),
relativePath: path.relative(rootDir, fullPath),
filename: entry.name,
description: workflowData.description || '',
standalone: standalone,
@ -376,9 +381,11 @@ class BaseIdeSetup {
* Scan a directory for files with specific extension(s)
* @param {string} dir - Directory to scan
* @param {string|Array<string>} ext - File extension(s) to match (e.g., '.md' or ['.md', '.xml'])
* @param {string} [rootDir] - Original root directory (used internally for recursion)
* @returns {Array} List of file info objects
*/
async scanDirectory(dir, ext) {
async scanDirectory(dir, ext, rootDir = null) {
rootDir = rootDir || dir;
const files = [];
if (!(await fs.pathExists(dir))) {
@ -395,7 +402,7 @@ class BaseIdeSetup {
if (entry.isDirectory()) {
// Recursively scan subdirectories
const subFiles = await this.scanDirectory(fullPath, ext);
const subFiles = await this.scanDirectory(fullPath, ext, rootDir);
files.push(...subFiles);
} else if (entry.isFile()) {
// Check if file matches any of the extensions
@ -404,7 +411,7 @@ class BaseIdeSetup {
files.push({
name: path.basename(entry.name, matchedExt),
path: fullPath,
relativePath: path.relative(dir, fullPath),
relativePath: path.relative(rootDir, fullPath),
filename: entry.name,
});
}
@ -418,9 +425,11 @@ class BaseIdeSetup {
* Scan a directory for files with specific extension(s) and check standalone attribute
* @param {string} dir - Directory to scan
* @param {string|Array<string>} ext - File extension(s) to match (e.g., '.md' or ['.md', '.xml'])
* @param {string} [rootDir] - Original root directory (used internally for recursion)
* @returns {Array} List of file info objects with standalone property
*/
async scanDirectoryWithStandalone(dir, ext) {
async scanDirectoryWithStandalone(dir, ext, rootDir = null) {
rootDir = rootDir || dir;
const files = [];
if (!(await fs.pathExists(dir))) {
@ -437,7 +446,7 @@ class BaseIdeSetup {
if (entry.isDirectory()) {
// Recursively scan subdirectories
const subFiles = await this.scanDirectoryWithStandalone(fullPath, ext);
const subFiles = await this.scanDirectoryWithStandalone(fullPath, ext, rootDir);
files.push(...subFiles);
} else if (entry.isFile()) {
// Check if file matches any of the extensions
@ -481,7 +490,7 @@ class BaseIdeSetup {
files.push({
name: path.basename(entry.name, matchedExt),
path: fullPath,
relativePath: path.relative(dir, fullPath),
relativePath: path.relative(rootDir, fullPath),
filename: entry.name,
standalone: standalone,
});

View File

@ -232,16 +232,8 @@ class ConfigDrivenIdeSetup extends BaseIdeSetup {
for (const artifact of artifacts) {
if (artifact.type === 'workflow-command') {
// Use different template based on workflow type (YAML vs MD)
// Default to 'default' template type, but allow override via config
const workflowTemplateType = artifact.isYamlWorkflow
? config.yaml_workflow_template || `${templateType}-workflow-yaml`
: config.md_workflow_template || `${templateType}-workflow`;
// Fall back to default templates if specific ones don't exist
const finalTemplateType = artifact.isYamlWorkflow ? 'default-workflow-yaml' : 'default-workflow';
// workflowTemplateType already contains full name (e.g., 'gemini-workflow-yaml'), so pass empty artifactType
const { content: template, extension } = await this.loadTemplate(workflowTemplateType, '', config, finalTemplateType);
const workflowTemplateType = config.md_workflow_template || `${templateType}-workflow`;
const { content: template, extension } = await this.loadTemplate(workflowTemplateType, '', config, 'default-workflow');
const content = this.renderTemplate(template, artifact);
const filename = this.generateFilename(artifact, 'workflow', extension);
@ -635,7 +627,8 @@ LOAD and execute from: {project-root}/{{bmadFolderName}}/{{path}}
/**
* Install verbatim skill directories (type: skill entries from skill-manifest.csv).
* Copies the entire source directory into the IDE skill directory, auto-generating SKILL.md.
* Copies the entire source directory as-is into the IDE skill directory.
* The source SKILL.md is used directly no frontmatter transformation or file generation.
* @param {string} projectDir - Project directory
* @param {string} bmadDir - BMAD installation directory
* @param {string} targetPath - Target skills directory
@ -644,6 +637,7 @@ LOAD and execute from: {project-root}/{{bmadFolderName}}/{{path}}
*/
async installVerbatimSkills(projectDir, bmadDir, targetPath, config) {
const bmadFolderName = path.basename(bmadDir);
const bmadPrefix = bmadFolderName + '/';
const csvPath = path.join(bmadDir, '_config', 'skill-manifest.csv');
if (!(await fs.pathExists(csvPath))) return 0;
@ -661,9 +655,9 @@ LOAD and execute from: {project-root}/{{bmadFolderName}}/{{path}}
if (!canonicalId) continue;
// Derive source directory from path column
// path is like "_bmad/bmm/workflows/bmad-quick-flow/bmad-quick-dev-new-preview/workflow.md"
// path is like "_bmad/bmm/workflows/bmad-quick-flow/bmad-quick-dev-new-preview/SKILL.md"
// Strip bmadFolderName prefix and join with bmadDir, then get dirname
const relativePath = record.path.replace(new RegExp(`^${bmadFolderName}/`), '');
const relativePath = record.path.startsWith(bmadPrefix) ? record.path.slice(bmadPrefix.length) : record.path;
const sourceFile = path.join(bmadDir, relativePath);
const sourceDir = path.dirname(sourceFile);
@ -674,34 +668,18 @@ LOAD and execute from: {project-root}/{{bmadFolderName}}/{{path}}
await fs.remove(skillDir);
await fs.ensureDir(skillDir);
// Parse workflow.md frontmatter for description
let description = `${canonicalId} skill`;
try {
const workflowContent = await fs.readFile(sourceFile, 'utf8');
const fmMatch = workflowContent.match(/^---\r?\n([\s\S]*?)\r?\n---/);
if (fmMatch) {
const frontmatter = yaml.parse(fmMatch[1]);
if (frontmatter?.description) {
description = frontmatter.description;
}
}
} catch (error) {
await prompts.log.warn(`Failed to parse frontmatter from ${sourceFile}: ${error.message}`);
}
// Generate SKILL.md with YAML-safe frontmatter
const frontmatterYaml = yaml.stringify({ name: canonicalId, description: String(description) }, { lineWidth: 0 }).trimEnd();
const skillMd = `---\n${frontmatterYaml}\n---\n\nIT IS CRITICAL THAT YOU FOLLOW THIS COMMAND: LOAD the FULL workflow.md, READ its entire contents and follow its directions exactly!\n`;
await fs.writeFile(path.join(skillDir, 'SKILL.md'), skillMd);
// Copy all files except bmad-skill-manifest.yaml
const entries = await fs.readdir(sourceDir, { withFileTypes: true });
for (const entry of entries) {
if (entry.name === 'bmad-skill-manifest.yaml') continue;
const srcPath = path.join(sourceDir, entry.name);
const destPath = path.join(skillDir, entry.name);
await fs.copy(srcPath, destPath);
}
// Copy all skill files, filtering OS/editor artifacts recursively
const skipPatterns = new Set(['.DS_Store', 'Thumbs.db', 'desktop.ini']);
const skipSuffixes = ['~', '.swp', '.swo', '.bak'];
const filter = (src) => {
const name = path.basename(src);
if (src === sourceDir) return true;
if (skipPatterns.has(name)) return false;
if (name.startsWith('.') && name !== '.gitkeep') return false;
if (skipSuffixes.some((s) => name.endsWith(s))) return false;
return true;
};
await fs.copy(sourceDir, skillDir, { filter });
count++;
}
@ -709,7 +687,7 @@ LOAD and execute from: {project-root}/{{bmadFolderName}}/{{path}}
// Post-install cleanup: remove _bmad/ directories for skills with install_to_bmad === "false"
for (const record of records) {
if (record.install_to_bmad === 'false') {
const relativePath = record.path.replace(new RegExp(`^${bmadFolderName}/`), '');
const relativePath = record.path.startsWith(bmadPrefix) ? record.path.slice(bmadPrefix.length) : record.path;
const sourceFile = path.join(bmadDir, relativePath);
const sourceDir = path.dirname(sourceFile);
if (await fs.pathExists(sourceDir)) {

View File

@ -12,6 +12,7 @@
* - bmm/workflows/plan-project.md bmad-bmm-plan-project.md
* - bmm/tasks/create-story.md bmad-bmm-create-story.md
* - core/agents/brainstorming.md bmad-agent-brainstorming.md (core agents skip module name)
* - standalone/agents/fred.md bmad-agent-standalone-fred.md
*/
// Type segments - agents are included in naming, others are filtered out
@ -26,8 +27,9 @@ const BMAD_FOLDER_NAME = '_bmad';
* Converts: 'bmm', 'agents', 'pm' 'bmad-agent-bmm-pm.md'
* Converts: 'bmm', 'workflows', 'correct-course' 'bmad-bmm-correct-course.md'
* Converts: 'core', 'agents', 'brainstorming' 'bmad-agent-brainstorming.md' (core agents skip module name)
* Converts: 'standalone', 'agents', 'fred' 'bmad-agent-standalone-fred.md'
*
* @param {string} module - Module name (e.g., 'bmm', 'core')
* @param {string} module - Module name (e.g., 'bmm', 'core', 'standalone')
* @param {string} type - Artifact type ('agents', 'workflows', 'tasks', 'tools')
* @param {string} name - Artifact name (e.g., 'pm', 'brainstorming')
* @returns {string} Flat filename like 'bmad-agent-bmm-pm.md' or 'bmad-bmm-correct-course.md'
@ -39,6 +41,10 @@ function toDashName(module, type, name) {
if (module === 'core') {
return isAgent ? `bmad-agent-${name}.md` : `bmad-${name}.md`;
}
// For standalone module, include 'standalone' in the name
if (module === 'standalone') {
return isAgent ? `bmad-agent-standalone-${name}.md` : `bmad-standalone-${name}.md`;
}
// Module artifacts: bmad-module-name.md or bmad-agent-module-name.md
// eslint-disable-next-line unicorn/prefer-string-replace-all -- regex replace is intentional here
@ -63,7 +69,7 @@ function toDashPath(relativePath) {
}
// Strip common file extensions to avoid double extensions in generated filenames
// e.g., 'create-story.xml' → 'create-story', 'workflow.yaml' → 'workflow'
// e.g., 'create-story.xml' → 'create-story', 'workflow.md' → 'workflow'
const withoutExt = relativePath.replace(/\.(md|yaml|yml|json|xml|toml)$/i, '');
const parts = withoutExt.split(/[/\\]/);
@ -110,6 +116,8 @@ function isDashFormat(filename) {
* Parses: 'bmad-bmm-correct-course.md' { prefix: 'bmad', module: 'bmm', type: 'workflows', name: 'correct-course' }
* Parses: 'bmad-agent-brainstorming.md' { prefix: 'bmad', module: 'core', type: 'agents', name: 'brainstorming' } (core agents)
* Parses: 'bmad-brainstorming.md' { prefix: 'bmad', module: 'core', type: 'workflows', name: 'brainstorming' } (core workflows)
* Parses: 'bmad-agent-standalone-fred.md' { prefix: 'bmad', module: 'standalone', type: 'agents', name: 'fred' }
* Parses: 'bmad-standalone-foo.md' { prefix: 'bmad', module: 'standalone', type: 'workflows', name: 'foo' }
*
* @param {string} filename - Dash-formatted filename
* @returns {Object|null} Parsed parts or null if invalid format
@ -127,7 +135,16 @@ function parseDashName(filename) {
if (isAgent) {
// This is an agent file
// Format: bmad-agent-name (core) or bmad-agent-module-name
// Format: bmad-agent-name (core) or bmad-agent-standalone-name or bmad-agent-module-name
if (parts.length >= 4 && parts[2] === 'standalone') {
// Standalone agent: bmad-agent-standalone-name
return {
prefix: parts[0],
module: 'standalone',
type: 'agents',
name: parts.slice(3).join('-'),
};
}
if (parts.length === 3) {
// Core agent: bmad-agent-name
return {
@ -158,6 +175,16 @@ function parseDashName(filename) {
};
}
// Check for standalone non-agent: bmad-standalone-name
if (parts[1] === 'standalone') {
return {
prefix: parts[0],
module: 'standalone',
type: 'workflows', // Default to workflows for non-agent standalone items
name: parts.slice(2).join('-'),
};
}
// Otherwise, it's a module workflow/tool/task (bmad-module-name)
return {
prefix: parts[0],
@ -180,6 +207,9 @@ function toUnderscoreName(module, type, name) {
if (module === 'core') {
return isAgent ? `bmad_agent_${name}.md` : `bmad_${name}.md`;
}
if (module === 'standalone') {
return isAgent ? `bmad_agent_standalone_${name}.md` : `bmad_standalone_${name}.md`;
}
return isAgent ? `bmad_${module}_agent_${name}.md` : `bmad_${module}_${name}.md`;
}
@ -231,6 +261,15 @@ function parseUnderscoreName(filename) {
if (agentIndex !== -1) {
if (agentIndex === 1) {
// bmad_agent_... - check for standalone
if (parts.length >= 4 && parts[2] === 'standalone') {
return {
prefix: parts[0],
module: 'standalone',
type: 'agents',
name: parts.slice(3).join('_'),
};
}
return {
prefix: parts[0],
module: 'core',
@ -256,6 +295,16 @@ function parseUnderscoreName(filename) {
};
}
// Check for standalone non-agent: bmad_standalone_name
if (parts[1] === 'standalone') {
return {
prefix: parts[0],
module: 'standalone',
type: 'workflows',
name: parts.slice(2).join('_'),
};
}
return {
prefix: parts[0],
module: parts[1],

View File

@ -1,58 +1,16 @@
const path = require('node:path');
const fs = require('fs-extra');
const csv = require('csv-parse/sync');
const prompts = require('../../../../lib/prompts');
const { toColonPath, toDashPath, customAgentColonName, customAgentDashName, BMAD_FOLDER_NAME } = require('./path-utils');
const { BMAD_FOLDER_NAME } = require('./path-utils');
/**
* Generates command files for each workflow in the manifest
*/
class WorkflowCommandGenerator {
constructor(bmadFolderName = BMAD_FOLDER_NAME) {
this.templatePath = path.join(__dirname, '../templates/workflow-command-template.md');
this.bmadFolderName = bmadFolderName;
}
/**
* Generate workflow commands from the manifest CSV
* @param {string} projectDir - Project directory
* @param {string} bmadDir - BMAD installation directory
*/
async generateWorkflowCommands(projectDir, bmadDir) {
const workflows = await this.loadWorkflowManifest(bmadDir);
if (!workflows) {
await prompts.log.warn('Workflow manifest not found. Skipping command generation.');
return { generated: 0 };
}
// ALL workflows now generate commands - no standalone filtering
const allWorkflows = workflows;
// Base commands directory
const baseCommandsDir = path.join(projectDir, '.claude', 'commands', 'bmad');
let generatedCount = 0;
// Generate a command file for each workflow, organized by module
for (const workflow of allWorkflows) {
const moduleWorkflowsDir = path.join(baseCommandsDir, workflow.module, 'workflows');
await fs.ensureDir(moduleWorkflowsDir);
const commandContent = await this.generateCommandContent(workflow, bmadDir);
const commandPath = path.join(moduleWorkflowsDir, `${workflow.name}.md`);
await fs.writeFile(commandPath, commandContent);
generatedCount++;
}
// Also create a workflow launcher README in each module
const groupedWorkflows = this.groupWorkflowsByModule(allWorkflows);
await this.createModuleWorkflowLaunchers(baseCommandsDir, groupedWorkflows);
return { generated: generatedCount };
}
async collectWorkflowArtifacts(bmadDir) {
const workflows = await this.loadWorkflowManifest(bmadDir);
@ -66,8 +24,7 @@ class WorkflowCommandGenerator {
const artifacts = [];
for (const workflow of allWorkflows) {
const commandContent = await this.generateCommandContent(workflow, bmadDir);
// Calculate the relative workflow path (e.g., bmm/workflows/4-implementation/sprint-planning/workflow.yaml)
// Calculate the relative workflow path (e.g., bmm/workflows/4-implementation/sprint-planning/workflow.md)
let workflowRelPath = workflow.path || '';
// Normalize path separators for cross-platform compatibility
workflowRelPath = workflowRelPath.replaceAll('\\', '/');
@ -85,18 +42,14 @@ class WorkflowCommandGenerator {
workflowRelPath = `${match[1]}/${match[2]}`;
}
}
// Determine if this is a YAML workflow (use normalized path which is guaranteed to be a string)
const isYamlWorkflow = workflowRelPath.endsWith('.yaml') || workflowRelPath.endsWith('.yml');
artifacts.push({
type: 'workflow-command',
isYamlWorkflow: isYamlWorkflow, // For template selection
name: workflow.name,
description: workflow.description || `${workflow.name} workflow`,
module: workflow.module,
canonicalId: workflow.canonicalId || '',
relativePath: path.join(workflow.module, 'workflows', `${workflow.name}.md`),
workflowPath: workflowRelPath, // Relative path to actual workflow file
content: commandContent,
sourcePath: workflow.path,
});
}
@ -121,46 +74,6 @@ class WorkflowCommandGenerator {
};
}
/**
* Generate command content for a workflow
*/
async generateCommandContent(workflow, bmadDir) {
// Determine template based on workflow file type
const isMarkdownWorkflow = workflow.path.endsWith('workflow.md');
const templateName = isMarkdownWorkflow ? 'workflow-commander.md' : 'workflow-command-template.md';
const templatePath = path.join(path.dirname(this.templatePath), templateName);
// Load the appropriate template
const template = await fs.readFile(templatePath, 'utf8');
// Convert source path to installed path
// From: /Users/.../src/bmm/workflows/.../workflow.yaml
// To: {project-root}/_bmad/bmm/workflows/.../workflow.yaml
let workflowPath = workflow.path;
// Extract the relative path from source
if (workflowPath.includes('/src/bmm/')) {
// bmm is directly under src/
const match = workflowPath.match(/\/src\/bmm\/(.+)/);
if (match) {
workflowPath = `${this.bmadFolderName}/bmm/${match[1]}`;
}
} else if (workflowPath.includes('/src/core/')) {
const match = workflowPath.match(/\/src\/core\/(.+)/);
if (match) {
workflowPath = `${this.bmadFolderName}/core/${match[1]}`;
}
}
// Replace template variables
return template
.replaceAll('{{name}}', workflow.name)
.replaceAll('{{module}}', workflow.module)
.replaceAll('{{description}}', workflow.description)
.replaceAll('{{workflow_path}}', workflowPath)
.replaceAll('_bmad', this.bmadFolderName);
}
/**
* Create workflow launcher files for each module
*/
@ -218,10 +131,9 @@ class WorkflowCommandGenerator {
## Execution
When running any workflow:
1. LOAD {project-root}/${this.bmadFolderName}/core/tasks/workflow.xml
2. Pass the workflow path as 'workflow-config' parameter
3. Follow workflow.xml instructions EXACTLY
4. Save outputs after EACH section
1. LOAD the workflow.md file at the path shown above
2. READ its entire contents and follow its directions exactly
3. Save outputs after EACH section
## Modes
- Normal: Full interaction
@ -262,58 +174,6 @@ When running any workflow:
skip_empty_lines: true,
});
}
/**
* Write workflow command artifacts using underscore format (Windows-compatible)
* Creates flat files like: bmad_bmm_correct-course.md
*
* @param {string} baseCommandsDir - Base commands directory for the IDE
* @param {Array} artifacts - Workflow artifacts
* @returns {number} Count of commands written
*/
async writeColonArtifacts(baseCommandsDir, artifacts) {
let writtenCount = 0;
for (const artifact of artifacts) {
if (artifact.type === 'workflow-command') {
// Convert relativePath to underscore format: bmm/workflows/correct-course.md → bmad_bmm_correct-course.md
const flatName = toColonPath(artifact.relativePath);
const commandPath = path.join(baseCommandsDir, flatName);
await fs.ensureDir(path.dirname(commandPath));
await fs.writeFile(commandPath, artifact.content);
writtenCount++;
}
}
return writtenCount;
}
/**
* Write workflow command artifacts using dash format (NEW STANDARD)
* Creates flat files like: bmad-bmm-correct-course.md
*
* Note: Workflows do NOT have bmad-agent- prefix - only agents do.
*
* @param {string} baseCommandsDir - Base commands directory for the IDE
* @param {Array} artifacts - Workflow artifacts
* @returns {number} Count of commands written
*/
async writeDashArtifacts(baseCommandsDir, artifacts) {
let writtenCount = 0;
for (const artifact of artifacts) {
if (artifact.type === 'workflow-command') {
// Convert relativePath to dash format: bmm/workflows/correct-course.md → bmad-bmm-correct-course.md
const flatName = toDashPath(artifact.relativePath);
const commandPath = path.join(baseCommandsDir, flatName);
await fs.ensureDir(path.dirname(commandPath));
await fs.writeFile(commandPath, artifact.content);
writtenCount++;
}
}
return writtenCount;
}
}
module.exports = { WorkflowCommandGenerator };

View File

@ -1,14 +0,0 @@
---
name: '{{name}}'
description: '{{description}}'
---
IT IS CRITICAL THAT YOU FOLLOW THESE STEPS - while staying in character as the current agent persona you may have loaded:
<steps CRITICAL="TRUE">
1. Always LOAD the FULL {project-root}/{{bmadFolderName}}/core/tasks/workflow.xml
2. READ its entire contents - this is the CORE OS for EXECUTING the specific workflow-config {project-root}/{{bmadFolderName}}/{{path}}
3. Pass the yaml path {project-root}/{{bmadFolderName}}/{{path}} as 'workflow-config' parameter to the workflow.xml instructions
4. Follow workflow.xml instructions EXACTLY as written to process and follow the specific workflow config and its instructions
5. Save outputs after EACH section when generating any documents from templates
</steps>

View File

@ -1,15 +0,0 @@
---
inclusion: manual
---
# {{name}}
IT IS CRITICAL THAT YOU FOLLOW THESE STEPS - while staying in character as the current agent persona you may have loaded:
<steps CRITICAL="TRUE">
1. Always LOAD the FULL #[[file:{{bmadFolderName}}/core/tasks/workflow.xml]]
2. READ its entire contents - this is the CORE OS for EXECUTING the specific workflow-config #[[file:{{bmadFolderName}}/{{path}}]]
3. Pass the yaml path {{bmadFolderName}}/{{path}} as 'workflow-config' parameter to the workflow.xml instructions
4. Follow workflow.xml instructions EXACTLY as written to process and follow the specific workflow config and its instructions
5. Save outputs after EACH section when generating any documents from templates
</steps>

View File

@ -1,13 +0,0 @@
---
description: '{{description}}'
---
IT IS CRITICAL THAT YOU FOLLOW THESE STEPS - while staying in character as the current agent persona you may have loaded:
<steps CRITICAL="TRUE">
1. Always LOAD the FULL {project-root}/_bmad/core/tasks/workflow.xml
2. READ its entire contents - this is the CORE OS for EXECUTING the specific workflow-config {project-root}/{{workflow_path}}
3. Pass the yaml path {{workflow_path}} as 'workflow-config' parameter to the workflow.xml instructions
4. Follow workflow.xml instructions EXACTLY as written to process and follow the specific workflow config and its instructions
5. Save outputs after EACH section when generating any documents from templates
</steps>

View File

@ -1,5 +0,0 @@
---
description: '{{description}}'
---
IT IS CRITICAL THAT YOU FOLLOW THIS COMMAND: LOAD the FULL {project-root}/{{workflow_path}}, READ its entire contents and follow its directions exactly!

View File

@ -762,14 +762,8 @@ class ModuleManager {
}
}
// Check if this is a workflow.yaml file
if (file.endsWith('workflow.yaml')) {
await fs.ensureDir(path.dirname(targetFile));
await this.copyWorkflowYamlStripped(sourceFile, targetFile);
} else {
// Copy the file with placeholder replacement
await this.copyFileWithPlaceholderReplacement(sourceFile, targetFile);
}
// Copy the file with placeholder replacement
await this.copyFileWithPlaceholderReplacement(sourceFile, targetFile);
// Track the file if callback provided
if (fileTrackingCallback) {
@ -778,92 +772,6 @@ class ModuleManager {
}
}
/**
* Copy workflow.yaml file with web_bundle section stripped
* Preserves comments, formatting, and line breaks
* @param {string} sourceFile - Source workflow.yaml file path
* @param {string} targetFile - Target workflow.yaml file path
*/
async copyWorkflowYamlStripped(sourceFile, targetFile) {
// Read the source YAML file
let yamlContent = await fs.readFile(sourceFile, 'utf8');
// IMPORTANT: Replace escape sequence and placeholder BEFORE parsing YAML
// Otherwise parsing will fail on the placeholder
yamlContent = yamlContent.replaceAll('_bmad', this.bmadFolderName);
try {
// First check if web_bundle exists by parsing
const workflowConfig = yaml.parse(yamlContent);
if (workflowConfig.web_bundle === undefined) {
// No web_bundle section, just write (placeholders already replaced above)
await fs.writeFile(targetFile, yamlContent, 'utf8');
return;
}
// Find the line that starts web_bundle
const lines = yamlContent.split('\n');
let startIdx = -1;
let endIdx = -1;
let baseIndent = 0;
// Find the start of web_bundle section
for (const [i, line] of lines.entries()) {
const match = line.match(/^(\s*)web_bundle:/);
if (match) {
startIdx = i;
baseIndent = match[1].length;
break;
}
}
if (startIdx === -1) {
// web_bundle not found in text (shouldn't happen), copy as-is
await fs.writeFile(targetFile, yamlContent, 'utf8');
return;
}
// Find the end of web_bundle section
// It ends when we find a line with same or less indentation that's not empty/comment
endIdx = startIdx;
for (let i = startIdx + 1; i < lines.length; i++) {
const line = lines[i];
// Skip empty lines and comments
if (line.trim() === '' || line.trim().startsWith('#')) {
continue;
}
// Check indentation
const indent = line.match(/^(\s*)/)[1].length;
if (indent <= baseIndent) {
// Found next section at same or lower indentation
endIdx = i - 1;
break;
}
}
// If we didn't find an end, it goes to end of file
if (endIdx === startIdx) {
endIdx = lines.length - 1;
}
// Remove the web_bundle section (including the line before if it's just a blank line)
const newLines = [...lines.slice(0, startIdx), ...lines.slice(endIdx + 1)];
// Clean up any double blank lines that might result
const strippedYaml = newLines.join('\n').replaceAll(/\n\n\n+/g, '\n\n');
// Placeholders already replaced at the beginning of this function
await fs.writeFile(targetFile, strippedYaml, 'utf8');
} catch {
// If anything fails, just copy the file as-is
await prompts.log.warn(` Could not process ${path.basename(sourceFile)}, copying as-is`);
await fs.copy(sourceFile, targetFile, { overwrite: true });
}
}
/**
* Compile .agent.yaml files to .md format in modules
* @param {string} sourcePath - Source module path
@ -1165,13 +1073,11 @@ class ModuleManager {
await prompts.log.message(` Processing: ${agentFile}`);
for (const item of workflowInstallItems) {
const sourceWorkflowPath = item.workflow; // Where to copy FROM
const sourceWorkflowPath = item.exec; // Where to copy FROM
const installWorkflowPath = item['workflow-install']; // Where to copy TO
// Parse SOURCE workflow path
// Handle both _bmad placeholder and hardcoded 'bmad'
// Example: {project-root}/_bmad/bmm/workflows/4-implementation/create-story/workflow.yaml
// Or: {project-root}/bmad/bmm/workflows/4-implementation/create-story/workflow.yaml
// Example: {project-root}/_bmad/bmm/workflows/4-implementation/create-story/workflow.md
const sourceMatch = sourceWorkflowPath.match(/\{project-root\}\/(?:_bmad)\/([^/]+)\/workflows\/(.+)/);
if (!sourceMatch) {
await prompts.log.warn(` Could not parse workflow path: ${sourceWorkflowPath}`);
@ -1181,9 +1087,8 @@ class ModuleManager {
const [, sourceModule, sourceWorkflowSubPath] = sourceMatch;
// Parse INSTALL workflow path
// Handle_bmad
// Example: {project-root}/_bmad/bmgd/workflows/4-production/create-story/workflow.yaml
const installMatch = installWorkflowPath.match(/\{project-root\}\/(_bmad)\/([^/]+)\/workflows\/(.+)/);
// Example: {project-root}/_bmad/bmgd/workflows/4-production/create-story/workflow.md
const installMatch = installWorkflowPath.match(/\{project-root\}\/(?:_bmad)\/([^/]+)\/workflows\/(.+)/);
if (!installMatch) {
await prompts.log.warn(` Could not parse workflow-install path: ${installWorkflowPath}`);
continue;
@ -1192,9 +1097,9 @@ class ModuleManager {
const installWorkflowSubPath = installMatch[2];
const sourceModulePath = getModulePath(sourceModule);
const actualSourceWorkflowPath = path.join(sourceModulePath, 'workflows', sourceWorkflowSubPath.replace(/\/workflow\.yaml$/, ''));
const actualSourceWorkflowPath = path.join(sourceModulePath, 'workflows', sourceWorkflowSubPath.replace(/\/workflow\.md$/, ''));
const actualDestWorkflowPath = path.join(targetPath, 'workflows', installWorkflowSubPath.replace(/\/workflow\.yaml$/, ''));
const actualDestWorkflowPath = path.join(targetPath, 'workflows', installWorkflowSubPath.replace(/\/workflow\.md$/, ''));
// Check if source workflow exists
if (!(await fs.pathExists(actualSourceWorkflowPath))) {
@ -1204,18 +1109,12 @@ class ModuleManager {
// Copy the entire workflow folder
await prompts.log.message(
` Vendoring: ${sourceModule}/workflows/${sourceWorkflowSubPath.replace(/\/workflow\.yaml$/, '')}${moduleName}/workflows/${installWorkflowSubPath.replace(/\/workflow\.yaml$/, '')}`,
` Vendoring: ${sourceModule}/workflows/${sourceWorkflowSubPath.replace(/\/workflow\.md$/, '')}${moduleName}/workflows/${installWorkflowSubPath.replace(/\/workflow\.md$/, '')}`,
);
await fs.ensureDir(path.dirname(actualDestWorkflowPath));
// Copy the workflow directory recursively with placeholder replacement
await this.copyDirectoryWithPlaceholderReplacement(actualSourceWorkflowPath, actualDestWorkflowPath);
// Update the workflow.yaml config_source reference
const workflowYamlPath = path.join(actualDestWorkflowPath, 'workflow.yaml');
if (await fs.pathExists(workflowYamlPath)) {
await this.updateWorkflowConfigSource(workflowYamlPath, moduleName);
}
}
}
@ -1224,28 +1123,6 @@ class ModuleManager {
}
}
/**
* Update workflow.yaml config_source to point to new module
* @param {string} workflowYamlPath - Path to workflow.yaml file
* @param {string} newModuleName - New module name to reference
*/
async updateWorkflowConfigSource(workflowYamlPath, newModuleName) {
let yamlContent = await fs.readFile(workflowYamlPath, 'utf8');
// Replace config_source: "{project-root}/_bmad/OLD_MODULE/config.yaml"
// with config_source: "{project-root}/_bmad/NEW_MODULE/config.yaml"
// Note: At this point _bmad has already been replaced with actual folder name
const configSourcePattern = /config_source:\s*["']?\{project-root\}\/[^/]+\/[^/]+\/config\.yaml["']?/g;
const newConfigSource = `config_source: "{project-root}/${this.bmadFolderName}/${newModuleName}/config.yaml"`;
const updatedYaml = yamlContent.replaceAll(configSourcePattern, newConfigSource);
if (updatedYaml !== yamlContent) {
await fs.writeFile(workflowYamlPath, updatedYaml, 'utf8');
await prompts.log.message(` Updated config_source to: ${this.bmadFolderName}/${newModuleName}/config.yaml`);
}
}
/**
* Create directories declared in module.yaml's `directories` key
* This replaces the security-risky module installer pattern with declarative config

View File

@ -39,16 +39,10 @@ class AgentAnalyzer {
if (Array.isArray(execArray)) {
for (const exec of execArray) {
if (exec.route) {
// Check if route is a workflow or exec
if (exec.route.endsWith('.yaml') || exec.route.endsWith('.yml')) {
profile.usedAttributes.add('workflow');
} else {
profile.usedAttributes.add('exec');
}
profile.usedAttributes.add('exec');
}
if (exec.workflow) profile.usedAttributes.add('workflow');
if (exec.action) profile.usedAttributes.add('action');
if (exec.type && ['exec', 'action', 'workflow'].includes(exec.type)) {
if (exec.type && ['exec', 'action'].includes(exec.type)) {
profile.usedAttributes.add(exec.type);
}
}
@ -57,12 +51,6 @@ class AgentAnalyzer {
}
} else {
// Check for each possible attribute in legacy items
if (item.workflow) {
profile.usedAttributes.add('workflow');
}
if (item['validate-workflow']) {
profile.usedAttributes.add('validate-workflow');
}
if (item.exec) {
profile.usedAttributes.add('exec');
}

View File

@ -147,7 +147,6 @@ function buildMenuXml(menuItems) {
const attrs = [`cmd="${trigger}"`];
// Add handler attributes
if (item.workflow) attrs.push(`workflow="${item.workflow}"`);
if (item.exec) attrs.push(`exec="${item.exec}"`);
if (item.tmpl) attrs.push(`tmpl="${item.tmpl}"`);
if (item.data) attrs.push(`data="${item.data}"`);
@ -187,8 +186,6 @@ function buildNestedHandlers(triggers) {
// Add handler attributes based on exec data
if (execData.route) attrs.push(`exec="${execData.route}"`);
if (execData.workflow) attrs.push(`workflow="${execData.workflow}"`);
if (execData['validate-workflow']) attrs.push(`validate-workflow="${execData['validate-workflow']}"`);
if (execData.action) attrs.push(`action="${execData.action}"`);
if (execData.data) attrs.push(`data="${execData.data}"`);
if (execData.tmpl) attrs.push(`tmpl="${execData.tmpl}"`);
@ -212,7 +209,6 @@ function processExecArray(execArray) {
const result = {
description: '',
route: null,
workflow: null,
data: null,
action: null,
type: null,
@ -229,12 +225,7 @@ function processExecArray(execArray) {
}
if (exec.route) {
// Determine if it's a workflow or exec based on file extension or context
if (exec.route.endsWith('.yaml') || exec.route.endsWith('.yml')) {
result.workflow = exec.route;
} else {
result.route = exec.route;
}
result.route = exec.route;
}
if (exec.data !== null && exec.data !== undefined) {

View File

@ -367,15 +367,6 @@ class YamlXmlBuilder {
const attrs = [`cmd="${trigger}"`];
// Add handler attributes
// If workflow-install exists, use its value for workflow attribute (vendoring)
// workflow-install is build-time metadata - tells installer where to copy workflows
// The final XML should only have workflow pointing to the install location
if (item['workflow-install']) {
attrs.push(`workflow="${item['workflow-install']}"`);
} else if (item.workflow) {
attrs.push(`workflow="${item.workflow}"`);
}
if (item['validate-workflow']) attrs.push(`validate-workflow="${item['validate-workflow']}"`);
if (item.exec) attrs.push(`exec="${item.exec}"`);
if (item.tmpl) attrs.push(`tmpl="${item.tmpl}"`);
@ -417,8 +408,6 @@ class YamlXmlBuilder {
// Add handler attributes based on exec data
if (execData.route) attrs.push(`exec="${execData.route}"`);
if (execData.workflow) attrs.push(`workflow="${execData.workflow}"`);
if (execData['validate-workflow']) attrs.push(`validate-workflow="${execData['validate-workflow']}"`);
if (execData.action) attrs.push(`action="${execData.action}"`);
if (execData.data) attrs.push(`data="${execData.data}"`);
if (execData.tmpl) attrs.push(`tmpl="${execData.tmpl}"`);
@ -442,7 +431,6 @@ class YamlXmlBuilder {
const result = {
description: '',
route: null,
workflow: null,
data: null,
action: null,
type: null,
@ -459,12 +447,7 @@ class YamlXmlBuilder {
}
if (exec.route) {
// Determine if it's a workflow or exec based on file extension or context
if (exec.route.endsWith('.yaml') || exec.route.endsWith('.yml')) {
result.workflow = exec.route;
} else {
result.route = exec.route;
}
result.route = exec.route;
}
if (exec.data !== null && exec.data !== undefined) {

View File

@ -2,7 +2,7 @@
const assert = require('node:assert');
const { z } = require('zod');
const COMMAND_TARGET_KEYS = ['workflow', 'validate-workflow', 'exec', 'action', 'tmpl', 'data'];
const COMMAND_TARGET_KEYS = ['validate-workflow', 'exec', 'action', 'tmpl', 'data'];
const TRIGGER_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
const COMPOUND_TRIGGER_PATTERN = /^([A-Z]{1,3}) or fuzzy match on ([a-z0-9]+(?:-[a-z0-9]+)*)$/;
@ -273,8 +273,6 @@ function buildMenuItemSchema() {
.object({
trigger: createNonEmptyString('agent.menu[].trigger'),
description: createNonEmptyString('agent.menu[].description'),
workflow: createNonEmptyString('agent.menu[].workflow').optional(),
'workflow-install': createNonEmptyString('agent.menu[].workflow-install').optional(),
'validate-workflow': createNonEmptyString('agent.menu[].validate-workflow').optional(),
exec: createNonEmptyString('agent.menu[].exec').optional(),
action: createNonEmptyString('agent.menu[].action').optional(),