ma-agents 2.20.3 → 2.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/.opencode/skills/.ma-agents.json +241 -0
  2. package/.opencode/skills/MANIFEST.yaml +254 -0
  3. package/.opencode/skills/ai-audit-trail/SKILL.md +23 -0
  4. package/.opencode/skills/auto-bug-detection/SKILL.md +169 -0
  5. package/.opencode/skills/cmake-best-practices/SKILL.md +64 -0
  6. package/.opencode/skills/cmake-best-practices/examples/cmake.md +59 -0
  7. package/.opencode/skills/code-documentation/SKILL.md +57 -0
  8. package/.opencode/skills/code-documentation/examples/cpp.md +29 -0
  9. package/.opencode/skills/code-documentation/examples/csharp.md +28 -0
  10. package/.opencode/skills/code-documentation/examples/javascript_typescript.md +28 -0
  11. package/.opencode/skills/code-documentation/examples/python.md +57 -0
  12. package/.opencode/skills/code-review/SKILL.md +43 -0
  13. package/.opencode/skills/commit-message/SKILL.md +79 -0
  14. package/.opencode/skills/cpp-best-practices/SKILL.md +234 -0
  15. package/.opencode/skills/cpp-best-practices/examples/modern-idioms.md +189 -0
  16. package/.opencode/skills/cpp-best-practices/examples/naming-and-organization.md +102 -0
  17. package/.opencode/skills/cpp-concurrency-safety/SKILL.md +60 -0
  18. package/.opencode/skills/cpp-concurrency-safety/examples/concurrency.md +73 -0
  19. package/.opencode/skills/cpp-const-correctness/SKILL.md +63 -0
  20. package/.opencode/skills/cpp-const-correctness/examples/const_correctness.md +54 -0
  21. package/.opencode/skills/cpp-memory-handling/SKILL.md +42 -0
  22. package/.opencode/skills/cpp-memory-handling/examples/modern-cpp.md +49 -0
  23. package/.opencode/skills/cpp-memory-handling/examples/smart-pointers.md +46 -0
  24. package/.opencode/skills/cpp-modern-composition/SKILL.md +64 -0
  25. package/.opencode/skills/cpp-modern-composition/examples/composition.md +51 -0
  26. package/.opencode/skills/cpp-robust-interfaces/SKILL.md +55 -0
  27. package/.opencode/skills/cpp-robust-interfaces/examples/interfaces.md +56 -0
  28. package/.opencode/skills/create-hardened-docker-skill/SKILL.md +637 -0
  29. package/.opencode/skills/create-hardened-docker-skill/scripts/create-all.sh +489 -0
  30. package/.opencode/skills/csharp-best-practices/SKILL.md +278 -0
  31. package/.opencode/skills/docker-hardening-verification/SKILL.md +28 -0
  32. package/.opencode/skills/docker-hardening-verification/scripts/verify-hardening.sh +39 -0
  33. package/.opencode/skills/docker-image-signing/SKILL.md +28 -0
  34. package/.opencode/skills/docker-image-signing/scripts/sign-image.sh +33 -0
  35. package/.opencode/skills/document-revision-history/SKILL.md +104 -0
  36. package/.opencode/skills/git-workflow-skill/SKILL.md +194 -0
  37. package/.opencode/skills/git-workflow-skill/hooks/commit-msg +61 -0
  38. package/.opencode/skills/git-workflow-skill/hooks/pre-commit +38 -0
  39. package/.opencode/skills/git-workflow-skill/hooks/prepare-commit-msg +56 -0
  40. package/.opencode/skills/git-workflow-skill/scripts/finish-feature.sh +192 -0
  41. package/.opencode/skills/git-workflow-skill/scripts/install-hooks.sh +55 -0
  42. package/.opencode/skills/git-workflow-skill/scripts/start-feature.sh +110 -0
  43. package/.opencode/skills/git-workflow-skill/scripts/validate-workflow.sh +229 -0
  44. package/.opencode/skills/js-ts-dependency-mgmt/SKILL.md +49 -0
  45. package/.opencode/skills/js-ts-dependency-mgmt/examples/dependency_mgmt.md +60 -0
  46. package/.opencode/skills/js-ts-security-skill/SKILL.md +64 -0
  47. package/.opencode/skills/js-ts-security-skill/scripts/verify-security.sh +136 -0
  48. package/.opencode/skills/logging-best-practices/SKILL.md +50 -0
  49. package/.opencode/skills/logging-best-practices/examples/cpp.md +36 -0
  50. package/.opencode/skills/logging-best-practices/examples/csharp.md +49 -0
  51. package/.opencode/skills/logging-best-practices/examples/javascript.md +77 -0
  52. package/.opencode/skills/logging-best-practices/examples/python.md +57 -0
  53. package/.opencode/skills/logging-best-practices/references/logging-standards.md +29 -0
  54. package/.opencode/skills/open-presentation/SKILL.md +35 -0
  55. package/.opencode/skills/opentelemetry-best-practices/SKILL.md +34 -0
  56. package/.opencode/skills/opentelemetry-best-practices/examples/go.md +32 -0
  57. package/.opencode/skills/opentelemetry-best-practices/examples/javascript.md +58 -0
  58. package/.opencode/skills/opentelemetry-best-practices/examples/python.md +37 -0
  59. package/.opencode/skills/opentelemetry-best-practices/references/otel-standards.md +37 -0
  60. package/.opencode/skills/python-best-practices/SKILL.md +385 -0
  61. package/.opencode/skills/python-dependency-mgmt/SKILL.md +42 -0
  62. package/.opencode/skills/python-dependency-mgmt/examples/dependency_mgmt.md +67 -0
  63. package/.opencode/skills/python-security-skill/SKILL.md +56 -0
  64. package/.opencode/skills/python-security-skill/examples/security.md +56 -0
  65. package/.opencode/skills/self-signed-cert/SKILL.md +42 -0
  66. package/.opencode/skills/self-signed-cert/scripts/generate-cert.ps1 +45 -0
  67. package/.opencode/skills/self-signed-cert/scripts/generate-cert.sh +43 -0
  68. package/.opencode/skills/skill-creator/SKILL.md +196 -0
  69. package/.opencode/skills/skill-creator/references/output-patterns.md +82 -0
  70. package/.opencode/skills/skill-creator/references/workflows.md +28 -0
  71. package/.opencode/skills/skill-creator/scripts/init_skill.py +208 -0
  72. package/.opencode/skills/skill-creator/scripts/package_skill.py +99 -0
  73. package/.opencode/skills/skill-creator/scripts/quick_validate.py +113 -0
  74. package/.opencode/skills/story-status-lookup/SKILL.md +78 -0
  75. package/.opencode/skills/test-accompanied-development/SKILL.md +50 -0
  76. package/.opencode/skills/test-generator/SKILL.md +65 -0
  77. package/.opencode/skills/vercel-react-best-practices/SKILL.md +109 -0
  78. package/.opencode/skills/verify-hardened-docker-skill/SKILL.md +442 -0
  79. package/.opencode/skills/verify-hardened-docker-skill/scripts/verify-docker-hardening.sh +439 -0
  80. package/AiAudit.md +5 -0
  81. package/QUICK_START.md +11 -5
  82. package/README.md +52 -1
  83. package/bin/cli.js +31 -4
  84. package/docs/BMAD_AI_Development_Training.pptx +0 -0
  85. package/docs/technical-notes/context-persistence-research.md +434 -0
  86. package/docs/technical-notes/enforcement-hooks-research.md +415 -0
  87. package/lib/agents.js +34 -0
  88. package/lib/bmad-extension/agents/bmm-architect.customize.yaml +5 -0
  89. package/lib/bmad-extension/agents/bmm-bmad-master.customize.yaml +5 -0
  90. package/lib/bmad-extension/agents/bmm-cyber.customize.yaml +30 -0
  91. package/lib/bmad-extension/agents/bmm-dev.customize.yaml +5 -0
  92. package/lib/bmad-extension/agents/bmm-devops.customize.yaml +30 -0
  93. package/lib/bmad-extension/agents/bmm-mil498.customize.yaml +42 -0
  94. package/lib/bmad-extension/agents/bmm-pm.customize.yaml +5 -0
  95. package/lib/bmad-extension/agents/bmm-qa.customize.yaml +5 -0
  96. package/lib/bmad-extension/agents/bmm-sm.customize.yaml +5 -0
  97. package/lib/bmad-extension/agents/bmm-sre.customize.yaml +30 -0
  98. package/lib/bmad-extension/agents/bmm-tech-writer.customize.yaml +5 -0
  99. package/lib/bmad-extension/agents/bmm-ux-designer.customize.yaml +5 -0
  100. package/lib/bmad-extension/module-help.csv +7 -0
  101. package/lib/bmad-extension/module.yaml +3 -0
  102. package/lib/bmad-extension/workflows/add-sprint/workflow.md +112 -0
  103. package/lib/bmad-extension/workflows/add-to-sprint/workflow.md +206 -0
  104. package/lib/bmad-extension/workflows/create-bug-story/workflow.md +186 -0
  105. package/lib/bmad-extension/workflows/modify-sprint/workflow.md +250 -0
  106. package/lib/bmad-extension/workflows/project-context-expansion/workflow.md +229 -0
  107. package/lib/bmad-extension/workflows/sprint-status-view/workflow.md +193 -0
  108. package/lib/bmad.js +168 -36
  109. package/lib/hooks/claude-code/verify-manifest.js +56 -0
  110. package/lib/installer.js +282 -1
  111. package/lib/methodology/BMAD_AI_Development_Training.pptx +0 -0
  112. package/lib/methodology/version.json +7 -0
  113. package/lib/skill-authoring.js +732 -0
  114. package/lib/templates/project-context.template.md +47 -0
  115. package/opencode.json +8 -0
  116. package/package.json +2 -2
  117. package/skills/auto-bug-detection/SKILL.md +165 -0
  118. package/skills/auto-bug-detection/skill.json +8 -0
  119. package/skills/code-review/SKILL.md +40 -0
  120. package/skills/cpp-best-practices/SKILL.md +230 -0
  121. package/skills/cpp-best-practices/examples/modern-idioms.md +189 -0
  122. package/skills/cpp-best-practices/examples/naming-and-organization.md +102 -0
  123. package/skills/cpp-best-practices/skill.json +25 -0
  124. package/skills/csharp-best-practices/SKILL.md +274 -0
  125. package/skills/csharp-best-practices/skill.json +23 -0
  126. package/skills/git-workflow-skill/skill.json +1 -1
  127. package/skills/open-presentation/SKILL.md +31 -0
  128. package/skills/open-presentation/skill.json +11 -0
  129. package/skills/python-best-practices/SKILL.md +381 -0
  130. package/skills/python-best-practices/skill.json +26 -0
  131. package/skills/story-status-lookup/SKILL.md +74 -0
  132. package/skills/story-status-lookup/skill.json +8 -0
  133. package/test/agent-injection-strategy.test.js +13 -7
  134. package/test/bmad-extension.test.js +237 -0
  135. package/test/bmad-output-policy.test.js +119 -0
  136. package/test/build-bmad-args.test.js +361 -0
  137. package/test/create-agent.test.js +232 -0
  138. package/test/enforcement-hooks.test.js +324 -0
  139. package/test/generate-project-context.test.js +337 -0
  140. package/test/integration-verification.test.js +402 -0
  141. package/test/opencode-agent.test.js +150 -0
  142. package/test/opencode-json-error.test.js +260 -0
  143. package/test/opencode-json-injection.test.js +256 -0
  144. package/test/opencode-json-merge.test.js +299 -0
  145. package/test/skill-authoring.test.js +272 -0
  146. package/test/skill-customize-agent.test.js +253 -0
  147. package/test/skill-mandatory.test.js +235 -0
  148. package/test/skill-validation.test.js +378 -0
  149. package/test/yes-flag.test.js +1 -1
@@ -0,0 +1,30 @@
1
+ # sre.customize.yaml
2
+ agent:
3
+ metadata:
4
+ name: "Alex"
5
+
6
+ persona:
7
+ role: "Site Reliability Engineer"
8
+ identity: "Expert in system availability, reliability, and Kubernetes operations (incident response, SLO/SLA management)."
9
+ communication_style: "Calm, data-driven, and systematic. Focuses on stability."
10
+ principles:
11
+ - "Automation over manual effort."
12
+ - "Monitor everything that matters."
13
+ - "Blame-free post-mortems."
14
+
15
+ menu:
16
+ - trigger: bmad-sre-health-check
17
+ workflow: "bmm/workflows/sre/health-check.md"
18
+ description: "Run Cluster Health Check"
19
+ - trigger: bmad-sre-fix-deployments
20
+ workflow: "bmm/workflows/sre/fix-deployments.md"
21
+ description: "Troubleshoot & Fix Deployments"
22
+ - trigger: bmad-sre-performance-opt
23
+ workflow: "bmm/workflows/sre/performance-opt.md"
24
+ description: "Performance Optimization Analysis"
25
+
26
+ critical_actions:
27
+ 1: "Read the skills MANIFEST at {project-root}/_bmad/skills/sre/MANIFEST.yaml"
28
+ 2: "For each skill marked always_load: true, read the skill file completely"
29
+ 3: "If _bmad-output/project-context.md exists, read it completely"
30
+ 4: "Follow all skill directives and project-context rules during this session"
@@ -0,0 +1,5 @@
1
+ critical_actions:
2
+ 1: "Read the skills MANIFEST at {project-root}/_bmad/skills/MANIFEST.yaml"
3
+ 2: "For each skill marked always_load: true, read the skill file completely"
4
+ 3: "If _bmad-output/project-context.md exists, read it completely"
5
+ 4: "Follow all skill directives and project-context rules during this session"
@@ -0,0 +1,5 @@
1
+ critical_actions:
2
+ 1: "Read the skills MANIFEST at {project-root}/_bmad/skills/MANIFEST.yaml"
3
+ 2: "For each skill marked always_load: true, read the skill file completely"
4
+ 3: "If _bmad-output/project-context.md exists, read it completely"
5
+ 4: "Follow all skill directives and project-context rules during this session"
@@ -0,0 +1,7 @@
1
+ module,phase,name,code,agent,file,command,yolo,tag,group,description,output_folder,output_type,notes
2
+ ma-agents-skills,4-implementation,add-sprint,add-sprint,bmm-sm,lib/bmad-extension/workflows/add-sprint/workflow.md,/add-sprint,false,sprint,sprint-management,Create a new sprint with capacity limits and optional start/end context,_bmad-output/implementation-artifacts,yaml,Creates sprint-plan-{number}.yaml artifact
3
+ ma-agents-skills,4-implementation,add-to-sprint,add-to-sprint,bmm-sm,lib/bmad-extension/workflows/add-to-sprint/workflow.md,/add-to-sprint,false,sprint,sprint-management,Assign backlog items (stories + bugs) to a sprint using multi-criteria prioritization,_bmad-output/implementation-artifacts,yaml,Updates sprint-plan-{number}.yaml assigned_items
4
+ ma-agents-skills,4-implementation,modify-sprint,modify-sprint,bmm-sm,lib/bmad-extension/workflows/modify-sprint/workflow.md,/modify-sprint,false,sprint,sprint-management,Modify existing sprint — add/remove items, change capacity, update metadata with concurrency guard,_bmad-output/implementation-artifacts,yaml,Updates sprint-plan-{number}.yaml in place
5
+ ma-agents-skills,4-implementation,sprint-status-view,sprint-status-view,bmm-sm,lib/bmad-extension/workflows/sprint-status-view/workflow.md,/sprint-status-view,false,sprint,sprint-management,View sprint progress with all assigned items (stories + bugs) and remaining capacity,_bmad-output/implementation-artifacts,display,Reads sprint-plan-*.yaml and sprint-status.yaml
6
+ ma-agents-skills,4-implementation,create-bug-story,create-bug-story,bmm-dev,lib/bmad-extension/workflows/create-bug-story/workflow.md,/create-bug-story,false,bug,bug-management,Create a structured bug story from a detected defect and add to backlog as standalone item,_bmad-output/implementation-artifacts,markdown,Creates bug-{slug}.md artifact with YAML frontmatter (type/severity/title)
7
+ ma-agents-skills,4-implementation,project-context-expansion,project-context-expansion,bmm-sm,lib/bmad-extension/workflows/project-context-expansion/workflow.md,/project-context-expansion,false,context,project-context,Post-retrospective companion: propose and confirm additions to Project-Specific Rules in project-context.md,_bmad-output,markdown,Appends approved rules to ## Project-Specific Rules section only — never overwrites other sections; run after /bmad-retrospective
@@ -0,0 +1,3 @@
1
+ extends-module: bmm
2
+ name: ma-agents-skills
3
+ description: MA-Agents skill enforcement extension for BMM agents
@@ -0,0 +1,112 @@
1
+ # Add Sprint Workflow
2
+
3
+ Guided workflow to create a new sprint with capacity limits for realistic sprint planning.
4
+
5
+ <workflow>
6
+
7
+ <step n="1" goal="Gather sprint number and name">
8
+ <action>Ask the user for the sprint number (e.g., 1, 2, 3)</action>
9
+ <ask>What is the sprint number? (e.g., 1)</ask>
10
+ <action>Store as {{sprint_number}}</action>
11
+ <ask>What is the sprint name? (e.g., "Sprint 1 — Foundation") — press Enter to use "Sprint {{sprint_number}}"</ask>
12
+ <action>If user presses Enter or leaves blank, default to "Sprint {{sprint_number}}"</action>
13
+ <action>Store as {{sprint_name}}</action>
14
+ </step>
15
+
16
+ <step n="2" goal="Gather capacity as positive integer">
17
+ <action>Explain capacity: the maximum number of items (stories + bugs) that can be assigned to this sprint</action>
18
+ <ask>What is the sprint capacity? (Enter a positive integer — the maximum number of stories/bugs for this sprint)</ask>
19
+ <action>Store input as {{capacity_input}}</action>
20
+ <action>Validate {{capacity_input}} is a positive integer (greater than zero, no decimals, no non-numeric characters)</action>
21
+ <check if="{{capacity_input}} is NOT a positive integer">
22
+ <output>❌ Invalid capacity: "{{capacity_input}}". Capacity must be a positive integer (e.g., 5, 10, 20). Zero and negative values are not allowed.</output>
23
+ <goto step="2" />
24
+ </check>
25
+ <action>Store as {{capacity}} (integer)</action>
26
+ </step>
27
+
28
+ <step n="3" goal="Gather optional start and end context">
29
+ <action>Explain: start/end context can be dates (e.g., "2026-03-18") or milestone descriptions (e.g., "Q1 Planning Complete")</action>
30
+ <ask>Optional — Sprint start context (date or milestone, press Enter to skip):</ask>
31
+ <action>Store as {{start_context}} (empty string if skipped)</action>
32
+ <ask>Optional — Sprint end context (date or milestone, press Enter to skip):</ask>
33
+ <action>Store as {{end_context}} (empty string if skipped)</action>
34
+ </step>
35
+
36
+ <step n="4" goal="Confirm and validate all inputs">
37
+ <output>
38
+ ## Sprint Summary — Please Confirm
39
+
40
+ - **Sprint Number:** {{sprint_number}}
41
+ - **Sprint Name:** {{sprint_name}}
42
+ - **Capacity (max items):** {{capacity}}
43
+ - **Start Context:** {{start_context}} *(empty if skipped)*
44
+ - **End Context:** {{end_context}} *(empty if skipped)*
45
+ - **Output File:** `_bmad-output/implementation-artifacts/sprint-plan-{{sprint_number}}.yaml`
46
+ </output>
47
+ <ask>Confirm creation? [y] Yes / [n] Cancel / [e] Edit a field:</ask>
48
+ <check if="user selects 'e'">
49
+ <ask>Which field to edit? (number / name / capacity / start / end)</ask>
50
+ <check if="field == 'number'">
51
+ <ask>New sprint number:</ask>
52
+ <action>Store as {{sprint_number}}</action>
53
+ <action>If sprint name was auto-defaulted to the old "Sprint {n}", update it to "Sprint {{sprint_number}}"</action>
54
+ <goto step="4" />
55
+ </check>
56
+ <check if="field == 'name'">
57
+ <ask>New sprint name (or press Enter to use "Sprint {{sprint_number}}"):</ask>
58
+ <action>If blank, set {{sprint_name}} = "Sprint {{sprint_number}}"; else store user input as {{sprint_name}}</action>
59
+ <goto step="4" />
60
+ </check>
61
+ <check if="field == 'capacity'"><goto step="2" /></check>
62
+ <check if="field == 'start'"><goto step="3" /></check>
63
+ <check if="field == 'end'"><goto step="3" /></check>
64
+ </check>
65
+ <check if="user selects 'n'">
66
+ <output>❌ Sprint creation cancelled.</output>
67
+ <action>Exit workflow</action>
68
+ </check>
69
+ </step>
70
+
71
+ <step n="5" goal="Generate sprint artifact file">
72
+ <action>Determine output path: `_bmad-output/implementation-artifacts/sprint-plan-{{sprint_number}}.yaml`</action>
73
+ <action>Check if file already exists at output path</action>
74
+ <check if="file already exists">
75
+ <output>⚠️ A sprint plan already exists at `_bmad-output/implementation-artifacts/sprint-plan-{{sprint_number}}.yaml`.</output>
76
+ <ask>Overwrite existing sprint plan? [y] Yes / [n] Cancel:</ask>
77
+ <check if="user selects 'n'">
78
+ <output>❌ Sprint creation cancelled to preserve existing sprint plan.</output>
79
+ <action>Exit workflow</action>
80
+ </check>
81
+ </check>
82
+ <action>Get current ISO timestamp for created_date and last_modified</action>
83
+ <action>Write sprint artifact YAML to `_bmad-output/implementation-artifacts/sprint-plan-{{sprint_number}}.yaml` with this structure:
84
+
85
+ ```yaml
86
+ sprint_number: {{sprint_number}}
87
+ sprint_name: "{{sprint_name}}"
88
+ capacity: {{capacity}}
89
+ assigned_items: []
90
+ status: planning
91
+ start_context: "{{start_context}}"
92
+ end_context: "{{end_context}}"
93
+ created_date: "{{current_iso_timestamp}}"
94
+ last_modified: "{{current_iso_timestamp}}"
95
+ ```
96
+ </action>
97
+ <output>
98
+ ✅ **Sprint created successfully!**
99
+
100
+ - **File:** `_bmad-output/implementation-artifacts/sprint-plan-{{sprint_number}}.yaml`
101
+ - **Sprint:** {{sprint_name}}
102
+ - **Capacity:** {{capacity}} items
103
+ - **Status:** planning
104
+
105
+ **Next Steps:**
106
+ - Use `/add-to-sprint` to assign backlog items to this sprint
107
+ - Use `/modify-sprint` to update sprint details later
108
+ - Use `/sprint-status-view` to view sprint progress
109
+ </output>
110
+ </step>
111
+
112
+ </workflow>
@@ -0,0 +1,206 @@
1
+ # Add-to-Sprint Workflow
2
+
3
+ Guided workflow to assign backlog items (stories + bugs) to a sprint using multi-criteria prioritization.
4
+
5
+ <workflow>
6
+
7
+ <step n="1a" goal="Discover user story backlog items from sprint-status.yaml">
8
+ <action>Read `_bmad-output/implementation-artifacts/sprint-status.yaml` — authoritative source for user story execution status</action>
9
+ <action>Parse the development_status section. For each entry:
10
+ - Skip epic keys (keys matching `epic-*`)
11
+ - Skip retrospective keys (keys ending with `-retrospective`)
12
+ - Collect story keys and their current status (backlog, ready-for-dev, in-progress, review, done)
13
+ </action>
14
+ <action>Store as {{user_stories}} — list of objects with: key, status</action>
15
+ <action>Infer story title from key (e.g., `12-1-add-sprint-workflow` → "Add Sprint Workflow")</action>
16
+ </step>
17
+
18
+ <step n="1b" goal="Discover bug story backlog items">
19
+ <action>Glob `_bmad-output/implementation-artifacts/bug-*.md` to discover all bug story files</action>
20
+ <check if="no bug files found">
21
+ <action>Set {{bug_stories}} = [] (empty list)</action>
22
+ </check>
23
+ <check if="bug files found">
24
+ <action>For each bug file, parse YAML frontmatter to extract: `type`, `severity`, `title`</action>
25
+ <action>Store as {{bug_stories}} — list of objects with: file, type (bug), severity, title</action>
26
+ </check>
27
+ </step>
28
+
29
+ <step n="1c" goal="Filter out items already assigned to any sprint">
30
+ <action>Glob `_bmad-output/implementation-artifacts/sprint-plan-*.yaml` to discover all existing sprint artifact files</action>
31
+ <action>For each sprint file found, read its assigned_items list</action>
32
+ <action>Build {{all_assigned_items}} = flat set of every item identifier (story keys and bug basenames) across ALL sprint plans</action>
33
+ <action>Filter {{user_stories}}: remove any story whose key is present in {{all_assigned_items}}</action>
34
+ <action>Filter {{bug_stories}}: remove any bug whose file basename is present in {{all_assigned_items}}</action>
35
+ <action>Items already assigned to any sprint will NOT appear in the backlog — this prevents duplicate assignment</action>
36
+ <check if="no sprint files found">
37
+ <action>Set {{all_assigned_items}} = [] — no filtering needed when no sprints exist yet</action>
38
+ </check>
39
+ </step>
40
+
41
+ <step n="2" goal="Present flat backlog combining stories and bugs">
42
+ <action>Combine {{user_stories}} and {{bug_stories}} into a flat backlog list</action>
43
+ <action>Stories and bugs are peers — no epic grouping (FR65)</action>
44
+ <output>
45
+ ## 📋 Backlog Items
46
+
47
+ | # | ID / File | Title | Type | Status/Severity |
48
+ |---|---|---|---|---|
49
+ {{#each backlog_items}}
50
+ | {{@index+1}} | {{id}} | {{title}} | {{type}} | {{status_or_severity}} |
51
+ {{/each}}
52
+
53
+ *Total: {{story_count}} stories, {{bug_count}} bugs*
54
+ </output>
55
+ </step>
56
+
57
+ <step n="3" goal="List available sprints and select target sprint">
58
+ <action>Glob `_bmad-output/implementation-artifacts/sprint-plan-*.yaml` to discover all sprint artifact files</action>
59
+ <check if="no sprint files found">
60
+ <output>❌ No sprint plans found. Run `/add-sprint` first to create a sprint before assigning items.</output>
61
+ <action>Exit workflow</action>
62
+ </check>
63
+ <action>For each sprint file found, read and extract: sprint_number, sprint_name, capacity, assigned_items count, status</action>
64
+ <output>
65
+ ## 🏃 Available Sprints
66
+
67
+ | # | Sprint | Status | Capacity | Assigned | Remaining |
68
+ |---|---|---|---|---|---|
69
+ {{#each sprints}}
70
+ | {{@index+1}} | {{sprint_name}} | {{status}} | {{capacity}} | {{assigned_count}} | {{remaining}} |
71
+ {{/each}}
72
+ </output>
73
+ <ask>Select target sprint (enter number):</ask>
74
+ <action>Store selected sprint data as {{target_sprint}}</action>
75
+ </step>
76
+
77
+ <step n="4" goal="Display current sprint capacity usage">
78
+ <action>Calculate: {{assigned_count}} = length of {{target_sprint.assigned_items}}</action>
79
+ <action>Calculate: {{remaining_capacity}} = {{target_sprint.capacity}} - {{assigned_count}}</action>
80
+ <output>
81
+ ## Sprint Capacity: {{target_sprint.sprint_name}}
82
+
83
+ - **Capacity:** {{target_sprint.capacity}} items
84
+ - **Assigned:** {{assigned_count}} items
85
+ - **Remaining:** {{remaining_capacity}} slots
86
+
87
+ {{#if remaining_capacity <= 0}}
88
+ ⚠️ This sprint is **at or over capacity**. Adding items will exceed the limit.
89
+ {{/if}}
90
+ </output>
91
+ </step>
92
+
93
+ <step n="5" goal="Select candidate items for this sprint">
94
+ <ask>Which backlog items do you want to consider for this sprint? Enter item numbers (comma-separated), or "all" to evaluate the full backlog:</ask>
95
+ <check if="user enters 'all'">
96
+ <action>Set {{candidate_items}} = all items in {{backlog_items}} (the full filtered backlog list from step 2)</action>
97
+ </check>
98
+ <check if="user enters item numbers">
99
+ <action>Resolve the entered numbers against the backlog table from step 2 and set {{candidate_items}} = those specific items</action>
100
+ </check>
101
+ </step>
102
+
103
+ <step n="6" goal="Multi-criteria prioritization guidance">
104
+ <action>For each item in {{candidate_items}}, evaluate and score across criteria:
105
+ - **Business value:** High (H) / Medium (M) / Low (L) — impact on users or project goals
106
+ - **Dependency status:** Blocked (blocked by another item) / Blocking (blocks other items) / Independent
107
+ - **Severity** (bugs only): Critical / High / Medium / Low — N/A for stories
108
+ - **Effort estimation:** Small (S ≤ 1 day) / Medium (M 2–3 days) / Large (L 4+ days)
109
+ </action>
110
+ <action>Generate a ranked ordering recommendation, factoring in:
111
+ 1. Blocking dependencies first (items that unlock others)
112
+ 2. High business value + low/medium effort (quick wins)
113
+ 3. Critical/High bugs ahead of Medium/Low bugs
114
+ 4. Avoid blocked items unless capacity allows waiting
115
+ </action>
116
+ <output>
117
+ ## 🎯 Prioritization Analysis
118
+
119
+ | Rank | ID / File | Title | Type | Business Value | Dependencies | Severity | Effort | Rationale |
120
+ |---|---|---|---|---|---|---|---|---|
121
+ {{#each ranked_items}}
122
+ | {{rank}} | {{id}} | {{title}} | {{type}} | {{business_value}} | {{dependency_status}} | {{severity}} | {{effort}} | {{rationale}} |
123
+ {{/each}}
124
+
125
+ **Recommended selection** (up to {{remaining_capacity}} items to stay within capacity): {{recommended_selection}}
126
+ </output>
127
+ </step>
128
+
129
+ <step n="7" goal="User confirms or adjusts ranking">
130
+ <ask>Review the ranking above. Options:
131
+ - [c] Confirm recommended selection as-is
132
+ - [m] Modify selection (specify item numbers to include)
133
+ - [r] Re-rank items (provide new priority order)
134
+ - [x] Cancel without assigning
135
+
136
+ Choice:</ask>
137
+ <check if="user selects 'x'">
138
+ <output>❌ Assignment cancelled — no changes made.</output>
139
+ <action>Exit workflow</action>
140
+ </check>
141
+ <check if="user selects 'm'">
142
+ <ask>Enter item numbers to assign (comma-separated):</ask>
143
+ <action>Update {{confirmed_items}} with user selection</action>
144
+ </check>
145
+ <check if="user selects 'r'">
146
+ <ask>Enter item numbers in your preferred priority order (comma-separated). Only items you include will be assigned — items not listed will be excluded from this session and remain in the unassigned backlog:</ask>
147
+ <action>Set {{confirmed_items}} = only the items matching the user-provided numbers, in the order provided. Items from {{candidate_items}} NOT mentioned are excluded from assignment in this session (they remain available in the backlog for future sprints).</action>
148
+ </check>
149
+ <check if="user selects 'c'">
150
+ <action>Set {{confirmed_items}} = recommended selection</action>
151
+ </check>
152
+ <action>Store confirmed ranking in {{confirmed_ranking}} for auditability (included in workflow output)</action>
153
+ </step>
154
+
155
+ <step n="8" goal="Assign selected items to sprint with capacity enforcement">
156
+ <action>For each item in {{confirmed_items}}, in confirmed ranking order:</action>
157
+ <action>Re-calculate current assigned count (in case multiple items are being added)</action>
158
+ <check if="assigning this item would exceed capacity">
159
+ <output>⚠️ **Capacity Warning:** Adding "{{item.title}}" would bring assigned items to {{new_count}}/{{target_sprint.capacity}} — exceeding sprint capacity by {{overage}}.</output>
160
+ <ask>Options:
161
+ - [a] Add anyway (over-capacity acknowledged)
162
+ - [s] Skip this item
163
+ - [m] Modify sprint capacity first via `/modify-sprint`
164
+
165
+ Choice:</ask>
166
+ <check if="user selects 's'">
167
+ <action>Skip this item — do not add to sprint. Continue to next item in the {{confirmed_items}} loop.</action>
168
+ </check>
169
+ <check if="user selects 'm'">
170
+ <output>💡 Run `/modify-sprint` to increase capacity for {{target_sprint.sprint_name}}, then re-run `/add-to-sprint`.</output>
171
+ <action>Exit workflow</action>
172
+ </check>
173
+ </check>
174
+ <action>Add item identifier to {{target_sprint.assigned_items}} list in the sprint-plan-{{target_sprint.sprint_number}}.yaml artifact</action>
175
+ <action>Item identifier format: story key for user stories (e.g., `12-1-add-sprint-workflow`), file basename for bugs (e.g., `bug-login-crash`)</action>
176
+ </step>
177
+
178
+ <step n="9" goal="Persist changes and display confirmed ranking for auditability">
179
+ <action>Update `_bmad-output/implementation-artifacts/sprint-plan-{{target_sprint.sprint_number}}.yaml`:
180
+ - Update `assigned_items` list with all newly assigned item identifiers
181
+ - Update `last_modified` to current ISO timestamp
182
+ </action>
183
+ <action>**Do NOT modify sprint-status.yaml** — sprint membership is exclusively tracked in sprint-plan-{n}.yaml</action>
184
+ <output>
185
+ ## ✅ Assignment Complete
186
+
187
+ **Sprint:** {{target_sprint.sprint_name}}
188
+ **Items assigned this session:** {{assigned_this_session}}
189
+
190
+ ### Confirmed Ranking (Audit Record)
191
+
192
+ | Rank | ID | Title | Type | Business Value | Dependencies | Severity | Effort |
193
+ |---|---|---|---|---|---|---|---|
194
+ {{#each confirmed_ranking}}
195
+ | {{rank}} | {{id}} | {{title}} | {{type}} | {{business_value}} | {{dependency_status}} | {{severity}} | {{effort}} |
196
+ {{/each}}
197
+
198
+ **Updated Capacity:** {{new_assigned_count}}/{{target_sprint.capacity}} items used ({{new_remaining}} remaining)
199
+
200
+ **Next Steps:**
201
+ - Use `/modify-sprint` to adjust capacity or remove items
202
+ - Use `/sprint-status-view` to view the full sprint with all assigned items
203
+ </output>
204
+ </step>
205
+
206
+ </workflow>
@@ -0,0 +1,186 @@
1
+ # Create Bug Story Workflow
2
+
3
+ Guided workflow to create a structured bug story from a detected defect and add it to the backlog as a standalone item.
4
+
5
+ <workflow>
6
+
7
+ <step n="1" goal="Gather bug title and severity">
8
+ <action>Explain: This workflow creates a structured bug story file that enters the backlog alongside user stories.</action>
9
+ <ask>What is the bug title? (short, descriptive — e.g., "Login fails with empty password field")</ask>
10
+ <action>Store as {{bug_title}}</action>
11
+ <action>Validate {{bug_title}} is not empty</action>
12
+ <check if="{{bug_title}} is empty">
13
+ <output>❌ Bug title cannot be empty.</output>
14
+ <goto step="1" />
15
+ </check>
16
+
17
+ <output>
18
+ **Severity levels:**
19
+ - `critical` — Data loss, security breach, or system crash in normal usage
20
+ - `high` — Core feature broken or serious security risk; blocks users
21
+ - `medium` — Feature partially broken or degraded; workaround exists
22
+ - `low` — Minor issue, cosmetic defect, or edge case with minimal user impact
23
+ </output>
24
+ <ask>What is the severity? [critical / high / medium / low]</ask>
25
+ <action>Store as {{severity}}</action>
26
+ <action>Normalize to lowercase</action>
27
+ <check if="{{severity}} is not one of: critical, high, medium, low">
28
+ <output>❌ Severity must be one of: critical, high, medium, low.</output>
29
+ <goto step="1" />
30
+ </check>
31
+ </step>
32
+
33
+ <step n="2" goal="Gather affected component and reproduction steps">
34
+ <ask>What is the affected component? (e.g., "auth module", "login page", "installer pipeline")</ask>
35
+ <action>Store as {{affected_component}}</action>
36
+
37
+ <ask>What are the reproduction steps? (numbered steps to reproduce the bug — describe them one at a time or as a list)</ask>
38
+ <action>Store as {{reproduction_steps}}</action>
39
+ </step>
40
+
41
+ <step n="3" goal="Gather expected vs actual behavior">
42
+ <ask>What is the expected behavior? (what should happen when working correctly)</ask>
43
+ <action>Store as {{expected_behavior}}</action>
44
+
45
+ <ask>What is the actual behavior? (what actually happens — the defect)</ask>
46
+ <action>Store as {{actual_behavior}}</action>
47
+ </step>
48
+
49
+ <step n="4" goal="Gather root cause hypothesis and affected files">
50
+ <ask>What is your root cause hypothesis? (optional — press Enter to skip; e.g., "Null check missing in validateUser()")</ask>
51
+ <action>Store as {{root_cause}} (empty string if skipped)</action>
52
+
53
+ <ask>What files are affected? (optional — comma-separated paths relative to repo root, press Enter to skip)</ask>
54
+ <action>Store as {{affected_files}} (empty string if skipped)</action>
55
+ <action>If provided, split by comma and trim whitespace to form a list of file paths</action>
56
+
57
+ <ask>Is there a suggested fix? (optional — brief description or press Enter to skip)</ask>
58
+ <action>Store as {{suggested_fix}} (empty string if skipped)</action>
59
+ </step>
60
+
61
+ <step n="5" goal="Confirm all bug details before writing">
62
+ <action>Derive {{title_slug}} by converting {{bug_title}} to lowercase kebab-case:
63
+ - Convert to lowercase
64
+ - Replace spaces and underscores with hyphens
65
+ - Remove characters that are not alphanumeric or hyphens
66
+ - Collapse consecutive hyphens into one
67
+ - Trim leading/trailing hyphens
68
+ </action>
69
+ <action>Set {{output_file}} = `_bmad-output/implementation-artifacts/bug-{{title_slug}}.md`</action>
70
+
71
+ <output>
72
+ ## Bug Story Summary — Please Confirm
73
+
74
+ - **Title:** {{bug_title}}
75
+ - **Severity:** {{severity}}
76
+ - **Affected Component:** {{affected_component}}
77
+ - **Reproduction Steps:** {{reproduction_steps}}
78
+ - **Expected Behavior:** {{expected_behavior}}
79
+ - **Actual Behavior:** {{actual_behavior}}
80
+ - **Root Cause Hypothesis:** {{root_cause}} *(empty if skipped)*
81
+ - **Affected Files:** {{affected_files}} *(empty if skipped)*
82
+ - **Suggested Fix:** {{suggested_fix}} *(empty if skipped)*
83
+ - **Output File:** `{{output_file}}`
84
+ </output>
85
+ <ask>Confirm creation? [y] Yes / [n] Cancel / [e] Edit a field:</ask>
86
+ <check if="user selects 'e'">
87
+ <ask>Which field to edit? (title / severity / component / steps / expected / actual / root-cause / files / fix)</ask>
88
+ <check if="field == 'title' OR field == 'severity'"><goto step="1" /></check>
89
+ <check if="field == 'component' OR field == 'steps'"><goto step="2" /></check>
90
+ <check if="field == 'expected' OR field == 'actual'"><goto step="3" /></check>
91
+ <check if="field == 'root-cause' OR field == 'files' OR field == 'fix'"><goto step="4" /></check>
92
+ <check if="none of the above matched">
93
+ <output>❌ Unrecognized field. Valid options: title / severity / component / steps / expected / actual / root-cause / files / fix</output>
94
+ <goto step="5" />
95
+ </check>
96
+ </check>
97
+ <check if="user selects 'n'">
98
+ <output>❌ Bug story creation cancelled.</output>
99
+ <action>Exit workflow</action>
100
+ </check>
101
+ </step>
102
+
103
+ <step n="6" goal="Write bug story file">
104
+ <action>Check if {{output_file}} already exists</action>
105
+ <check if="file already exists">
106
+ <output>⚠️ A bug story already exists at `{{output_file}}`.</output>
107
+ <ask>Overwrite? [y] Yes — overwrite existing / [n] Cancel / [s] Save with unique suffix (e.g. bug-{{title_slug}}-2.md):</ask>
108
+ <check if="user selects 's'">
109
+ <action>Find the next available suffix: try bug-{{title_slug}}-2.md, -3.md, etc. until a filename that does not exist is found. Set {{output_file}} to that path.</action>
110
+ </check>
111
+ <check if="user selects 'n'">
112
+ <output>❌ Bug story creation cancelled to preserve existing file.</output>
113
+ <action>Exit workflow</action>
114
+ </check>
115
+ </check>
116
+
117
+ <action>Write bug story to {{output_file}} using the template below.
118
+ CRITICAL: The YAML frontmatter block MUST be the very first content in the file — no blank lines, no title, nothing before the opening `---`.
119
+ Format optional fields (root_cause, affected_files, suggested_fix) as follows:
120
+ - If {{root_cause}} is empty, write: `_Not identified_`
121
+ - If {{affected_files}} is empty, write: `_Unknown_`; otherwise list each file as a `- path/to/file` bullet
122
+ - If {{suggested_fix}} is empty, omit the Suggested Fix section entirely
123
+ </action>
124
+
125
+ <action>Write file with this exact structure:
126
+
127
+ ```
128
+ ---
129
+ type: bug
130
+ severity: {{severity}}
131
+ title: {{bug_title}}
132
+ ---
133
+
134
+ # Bug: {{bug_title}}
135
+
136
+ **Severity:** {{severity}}
137
+ **Affected Component:** {{affected_component}}
138
+
139
+ ## Reproduction Steps
140
+
141
+ {{reproduction_steps}}
142
+
143
+ ## Expected Behavior
144
+
145
+ {{expected_behavior}}
146
+
147
+ ## Actual Behavior
148
+
149
+ {{actual_behavior}}
150
+
151
+ ## Root Cause Hypothesis
152
+
153
+ {{root_cause or "_Not identified_"}}
154
+
155
+ ## Affected Files
156
+
157
+ {{affected_files list or "_Unknown_"}}
158
+
159
+ ## Suggested Fix
160
+
161
+ {{suggested_fix — omit section if empty}}
162
+
163
+ ## Notes
164
+
165
+ - Created via `create-bug-story` workflow
166
+ - Discoverable by sprint workflows via glob: `_bmad-output/implementation-artifacts/bug-*.md`
167
+ - To add to a sprint, run `/add-to-sprint`
168
+ ```
169
+ </action>
170
+
171
+ <output>
172
+ ✅ **Bug story created successfully!**
173
+
174
+ - **File:** `{{output_file}}`
175
+ - **Title:** {{bug_title}}
176
+ - **Severity:** {{severity}}
177
+ - **Component:** {{affected_component}}
178
+
179
+ **Next Steps:**
180
+ - Use `/add-to-sprint` to assign this bug to the current sprint
181
+ - Use `/sprint-status-view` to see all sprint items including this bug
182
+ - To detect more bugs, ensure the `auto-bug-detection` skill is loaded in your session
183
+ </output>
184
+ </step>
185
+
186
+ </workflow>