substrate-ai 0.1.22 → 0.1.23

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.
package/dist/index.d.ts CHANGED
@@ -903,6 +903,26 @@ interface OrchestratorEvents {
903
903
  phase: string;
904
904
  elapsedMs: number;
905
905
  };
906
+ /** Readiness check has completed — emitted for all verdicts (READY, NEEDS_WORK, NOT_READY) */
907
+ 'solutioning:readiness-check': {
908
+ runId: string;
909
+ verdict: 'READY' | 'NEEDS_WORK' | 'NOT_READY';
910
+ coverageScore: number;
911
+ findingCount: number;
912
+ blockerCount: number;
913
+ };
914
+ /** Readiness check returned NOT_READY — solutioning phase will not proceed to implementation */
915
+ 'solutioning:readiness-failed': {
916
+ runId: string;
917
+ verdict: 'NOT_READY';
918
+ coverageScore: number;
919
+ findings: Array<{
920
+ category: string;
921
+ severity: string;
922
+ description: string;
923
+ affected_items: string[];
924
+ }>;
925
+ };
906
926
  }
907
927
 
908
928
  //#endregion
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { AdapterRegistry, AdtError, BudgetExceededError, ClaudeCodeAdapter, CodexCLIAdapter, ConfigError, ConfigIncompatibleFormatError, GeminiCLIAdapter, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError, childLogger, computeChangedKeys, createConfigWatcher, createDatabaseService, createEventBus, createGitWorktreeManager, createLogger, createMonitorAgent, createMonitorDatabase, createRoutingEngine, createTaskGraphEngine, createTuiApp, createWorkerPoolManager, isTuiCapable, logger, printNonTtyWarning } from "./app-Bltq6BEm.js";
1
+ import { AdapterRegistry, AdtError, BudgetExceededError, ClaudeCodeAdapter, CodexCLIAdapter, ConfigError, ConfigIncompatibleFormatError, GeminiCLIAdapter, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError, childLogger, computeChangedKeys, createConfigWatcher, createDatabaseService, createEventBus, createGitWorktreeManager, createLogger, createMonitorAgent, createMonitorDatabase, createRoutingEngine, createTaskGraphEngine, createTuiApp, createWorkerPoolManager, isTuiCapable, logger, printNonTtyWarning } from "./app-CY3MaJtP.js";
2
2
  import "./config-schema-C9tTMcm1.js";
3
3
  import { join } from "node:path";
4
4
  import { randomUUID } from "crypto";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "substrate-ai",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -64,7 +64,7 @@
64
64
  "js-yaml": "^4.1.1",
65
65
  "pino": "^9.6.0",
66
66
  "semver": "^7.6.3",
67
- "substrate-ai": "^0.1.19",
67
+ "substrate-ai": "^0.1.22",
68
68
  "zod": "^4.3.6"
69
69
  },
70
70
  "devDependencies": {
@@ -0,0 +1,51 @@
1
+ num,category,method_name,description,output_pattern
2
+ 1,collaboration,Stakeholder Round Table,Convene multiple personas to contribute diverse perspectives - essential for requirements gathering and finding balanced solutions across competing interests,perspectives → synthesis → alignment
3
+ 2,collaboration,Expert Panel Review,Assemble domain experts for deep specialized analysis - ideal when technical depth and peer review quality are needed,expert views → consensus → recommendations
4
+ 3,collaboration,Debate Club Showdown,Two personas argue opposing positions while a moderator scores points - great for exploring controversial decisions and finding middle ground,thesis → antithesis → synthesis
5
+ 4,collaboration,User Persona Focus Group,Gather your product's user personas to react to proposals and share frustrations - essential for validating features and discovering unmet needs,reactions → concerns → priorities
6
+ 5,collaboration,Time Traveler Council,Past-you and future-you advise present-you on decisions - powerful for gaining perspective on long-term consequences vs short-term pressures,past wisdom → present choice → future impact
7
+ 6,collaboration,Cross-Functional War Room,Product manager + engineer + designer tackle a problem together - reveals trade-offs between feasibility desirability and viability,constraints → trade-offs → balanced solution
8
+ 7,collaboration,Mentor and Apprentice,Senior expert teaches junior while junior asks naive questions - surfaces hidden assumptions through teaching,explanation → questions → deeper understanding
9
+ 8,collaboration,Good Cop Bad Cop,Supportive persona and critical persona alternate - finds both strengths to build on and weaknesses to address,encouragement → criticism → balanced view
10
+ 9,collaboration,Improv Yes-And,Multiple personas build on each other's ideas without blocking - generates unexpected creative directions through collaborative building,idea → build → build → surprising result
11
+ 10,collaboration,Customer Support Theater,Angry customer and support rep roleplay to find pain points - reveals real user frustrations and service gaps,complaint → investigation → resolution → prevention
12
+ 11,advanced,Tree of Thoughts,Explore multiple reasoning paths simultaneously then evaluate and select the best - perfect for complex problems with multiple valid approaches,paths → evaluation → selection
13
+ 12,advanced,Graph of Thoughts,Model reasoning as an interconnected network of ideas to reveal hidden relationships - ideal for systems thinking and discovering emergent patterns,nodes → connections → patterns
14
+ 13,advanced,Thread of Thought,Maintain coherent reasoning across long contexts by weaving a continuous narrative thread - essential for RAG systems and maintaining consistency,context → thread → synthesis
15
+ 14,advanced,Self-Consistency Validation,Generate multiple independent approaches then compare for consistency - crucial for high-stakes decisions where verification matters,approaches → comparison → consensus
16
+ 15,advanced,Meta-Prompting Analysis,Step back to analyze the approach structure and methodology itself - valuable for optimizing prompts and improving problem-solving,current → analysis → optimization
17
+ 16,advanced,Reasoning via Planning,Build a reasoning tree guided by world models and goal states - excellent for strategic planning and sequential decision-making,model → planning → strategy
18
+ 17,competitive,Red Team vs Blue Team,Adversarial attack-defend analysis to find vulnerabilities - critical for security testing and building robust solutions,defense → attack → hardening
19
+ 18,competitive,Shark Tank Pitch,Entrepreneur pitches to skeptical investors who poke holes - stress-tests business viability and forces clarity on value proposition,pitch → challenges → refinement
20
+ 19,competitive,Code Review Gauntlet,Senior devs with different philosophies review the same code - surfaces style debates and finds consensus on best practices,reviews → debates → standards
21
+ 20,technical,Architecture Decision Records,Multiple architect personas propose and debate architectural choices with explicit trade-offs - ensures decisions are well-reasoned and documented,options → trade-offs → decision → rationale
22
+ 21,technical,Rubber Duck Debugging Evolved,Explain your code to progressively more technical ducks until you find the bug - forces clarity at multiple abstraction levels,simple → detailed → technical → aha
23
+ 22,technical,Algorithm Olympics,Multiple approaches compete on the same problem with benchmarks - finds optimal solution through direct comparison,implementations → benchmarks → winner
24
+ 23,technical,Security Audit Personas,Hacker + defender + auditor examine system from different threat models - comprehensive security review from multiple angles,vulnerabilities → defenses → compliance
25
+ 24,technical,Performance Profiler Panel,Database expert + frontend specialist + DevOps engineer diagnose slowness - finds bottlenecks across the full stack,symptoms → analysis → optimizations
26
+ 25,creative,SCAMPER Method,Apply seven creativity lenses (Substitute/Combine/Adapt/Modify/Put/Eliminate/Reverse) - systematic ideation for product innovation,S→C→A→M→P→E→R
27
+ 26,creative,Reverse Engineering,Work backwards from desired outcome to find implementation path - powerful for goal achievement and understanding endpoints,end state → steps backward → path forward
28
+ 27,creative,What If Scenarios,Explore alternative realities to understand possibilities and implications - valuable for contingency planning and exploration,scenarios → implications → insights
29
+ 28,creative,Random Input Stimulus,Inject unrelated concepts to spark unexpected connections - breaks creative blocks through forced lateral thinking,random word → associations → novel ideas
30
+ 29,creative,Exquisite Corpse Brainstorm,Each persona adds to the idea seeing only the previous contribution - generates surprising combinations through constrained collaboration,contribution → handoff → contribution → surprise
31
+ 30,creative,Genre Mashup,Combine two unrelated domains to find fresh approaches - innovation through unexpected cross-pollination,domain A + domain B → hybrid insights
32
+ 31,research,Literature Review Personas,Optimist researcher + skeptic researcher + synthesizer review sources - balanced assessment of evidence quality,sources → critiques → synthesis
33
+ 32,research,Thesis Defense Simulation,Student defends hypothesis against committee with different concerns - stress-tests research methodology and conclusions,thesis → challenges → defense → refinements
34
+ 33,research,Comparative Analysis Matrix,Multiple analysts evaluate options against weighted criteria - structured decision-making with explicit scoring,options → criteria → scores → recommendation
35
+ 34,risk,Pre-mortem Analysis,Imagine future failure then work backwards to prevent it - powerful technique for risk mitigation before major launches,failure scenario → causes → prevention
36
+ 35,risk,Failure Mode Analysis,Systematically explore how each component could fail - critical for reliability engineering and safety-critical systems,components → failures → prevention
37
+ 36,risk,Challenge from Critical Perspective,Play devil's advocate to stress-test ideas and find weaknesses - essential for overcoming groupthink,assumptions → challenges → strengthening
38
+ 37,risk,Identify Potential Risks,Brainstorm what could go wrong across all categories - fundamental for project planning and deployment preparation,categories → risks → mitigations
39
+ 38,risk,Chaos Monkey Scenarios,Deliberately break things to test resilience and recovery - ensures systems handle failures gracefully,break → observe → harden
40
+ 39,core,First Principles Analysis,Strip away assumptions to rebuild from fundamental truths - breakthrough technique for innovation and solving impossible problems,assumptions → truths → new approach
41
+ 40,core,5 Whys Deep Dive,Repeatedly ask why to drill down to root causes - simple but powerful for understanding failures,why chain → root cause → solution
42
+ 41,core,Socratic Questioning,Use targeted questions to reveal hidden assumptions and guide discovery - excellent for teaching and self-discovery,questions → revelations → understanding
43
+ 42,core,Critique and Refine,Systematic review to identify strengths and weaknesses then improve - standard quality check for drafts,strengths/weaknesses → improvements → refined
44
+ 43,core,Explain Reasoning,Walk through step-by-step thinking to show how conclusions were reached - crucial for transparency,steps → logic → conclusion
45
+ 44,core,Expand or Contract for Audience,Dynamically adjust detail level and technical depth for target audience - matches content to reader capabilities,audience → adjustments → refined content
46
+ 45,learning,Feynman Technique,Explain complex concepts simply as if teaching a child - the ultimate test of true understanding,complex → simple → gaps → mastery
47
+ 46,learning,Active Recall Testing,Test understanding without references to verify true knowledge - essential for identifying gaps,test → gaps → reinforcement
48
+ 47,philosophical,Occam's Razor Application,Find the simplest sufficient explanation by eliminating unnecessary complexity - essential for debugging,options → simplification → selection
49
+ 48,philosophical,Trolley Problem Variations,Explore ethical trade-offs through moral dilemmas - valuable for understanding values and difficult decisions,dilemma → analysis → decision
50
+ 49,retrospective,Hindsight Reflection,Imagine looking back from the future to gain perspective - powerful for project reviews,future view → insights → application
51
+ 50,retrospective,Lessons Learned Extraction,Systematically identify key takeaways and actionable improvements - essential for continuous improvement,experience → lessons → actions
@@ -2,6 +2,11 @@ name: bmad
2
2
  version: 1.0.0
3
3
  description: BMAD methodology for autonomous software development
4
4
 
5
+ # Optional UX design phase (Story 16.5).
6
+ # When true, a 'ux-design' phase runs between planning and solutioning.
7
+ # Set to false (or omit) to skip UX design and proceed directly to solutioning.
8
+ uxDesign: true
9
+
5
10
  phases:
6
11
  - name: analysis
7
12
  description: Product discovery and brief creation
@@ -14,6 +19,7 @@ phases:
14
19
  context:
15
20
  - placeholder: concept
16
21
  source: "param:concept"
22
+ elicitate: true
17
23
  - name: analysis-step-2-scope
18
24
  template: analysis-step-2-scope
19
25
  context:
@@ -21,6 +27,7 @@ phases:
21
27
  source: "param:concept"
22
28
  - placeholder: vision_output
23
29
  source: "step:analysis-step-1-vision"
30
+ critique: true
24
31
  - name: planning
25
32
  description: PRD and requirements generation
26
33
  entryGates: [product-brief-complete]
@@ -39,6 +46,7 @@ phases:
39
46
  source: "decision:analysis.product-brief"
40
47
  - placeholder: classification
41
48
  source: "step:planning-step-1-classification"
49
+ elicitate: true
42
50
  - name: planning-step-3-nfrs
43
51
  template: planning-step-3-nfrs
44
52
  context:
@@ -48,6 +56,43 @@ phases:
48
56
  source: "step:planning-step-1-classification"
49
57
  - placeholder: functional_requirements
50
58
  source: "step:planning-step-2-frs"
59
+ critique: true
60
+ - name: ux-design
61
+ description: UX discovery, design system, and user journey mapping (optional — runs when uxDesign is true)
62
+ entryGates: [prd-complete]
63
+ exitGates: [ux-design-complete]
64
+ artifacts: [ux-design]
65
+ steps:
66
+ - name: ux-step-1-discovery
67
+ template: ux-step-1-discovery
68
+ context:
69
+ - placeholder: product_brief
70
+ source: "decision:analysis.product-brief"
71
+ - placeholder: requirements
72
+ source: "decision:planning.functional-requirements"
73
+ elicitate: true
74
+ - name: ux-step-2-design-system
75
+ template: ux-step-2-design-system
76
+ context:
77
+ - placeholder: product_brief
78
+ source: "decision:analysis.product-brief"
79
+ - placeholder: requirements
80
+ source: "decision:planning.functional-requirements"
81
+ - placeholder: ux_discovery
82
+ source: "step:ux-step-1-discovery"
83
+ elicitate: true
84
+ - name: ux-step-3-journeys
85
+ template: ux-step-3-journeys
86
+ context:
87
+ - placeholder: product_brief
88
+ source: "decision:analysis.product-brief"
89
+ - placeholder: requirements
90
+ source: "decision:planning.functional-requirements"
91
+ - placeholder: ux_discovery
92
+ source: "step:ux-step-1-discovery"
93
+ - placeholder: design_system
94
+ source: "step:ux-step-2-design-system"
95
+ critique: true
51
96
  - name: solutioning
52
97
  description: Architecture and epic/story breakdown
53
98
  entryGates: [prd-complete]
@@ -69,13 +114,17 @@ phases:
69
114
  source: "decision:planning.functional-requirements"
70
115
  - placeholder: starter_decisions
71
116
  source: "step:architecture-step-1-context"
117
+ - placeholder: ux_decisions
118
+ source: "decision:ux-design.ux-design"
72
119
  outputCategory: architecture
120
+ elicitate: true
73
121
  - name: architecture-step-3-patterns
74
122
  template: architecture-step-3-patterns
75
123
  context:
76
124
  - placeholder: architecture_decisions
77
125
  source: "decision:solutioning.architecture"
78
126
  outputCategory: architecture
127
+ critique: true
79
128
  - name: stories-step-1-epics
80
129
  template: stories-step-1-epics
81
130
  context:
@@ -84,6 +133,7 @@ phases:
84
133
  - placeholder: architecture_decisions
85
134
  source: "decision:solutioning.architecture"
86
135
  outputCategory: epic-design
136
+ elicitate: true
87
137
  - name: stories-step-2-stories
88
138
  template: stories-step-2-stories
89
139
  context:
@@ -94,6 +144,7 @@ phases:
94
144
  - placeholder: architecture_decisions
95
145
  source: "decision:solutioning.architecture"
96
146
  outputCategory: stories
147
+ critique: true
97
148
  - name: implementation
98
149
  description: Code generation, testing, and review
99
150
  entryGates: [stories-complete]
@@ -120,6 +171,20 @@ prompts:
120
171
  architecture-step-3-patterns: prompts/architecture-step-3-patterns.md
121
172
  stories-step-1-epics: prompts/stories-step-1-epics.md
122
173
  stories-step-2-stories: prompts/stories-step-2-stories.md
174
+ # UX design step prompts (Story 16-5)
175
+ ux-step-1-discovery: prompts/ux-step-1-discovery.md
176
+ ux-step-2-design-system: prompts/ux-step-2-design-system.md
177
+ ux-step-3-journeys: prompts/ux-step-3-journeys.md
178
+ # Elicitation prompt (Story 16-3)
179
+ elicitation-apply: prompts/elicitation-apply.md
180
+ # Critique and refinement prompts (Story 16-4)
181
+ critique-analysis: prompts/critique-analysis.md
182
+ critique-planning: prompts/critique-planning.md
183
+ critique-architecture: prompts/critique-architecture.md
184
+ critique-stories: prompts/critique-stories.md
185
+ refine-artifact: prompts/refine-artifact.md
186
+ # Readiness check prompt (Story 16-6)
187
+ readiness-check: prompts/readiness-check.md
123
188
 
124
189
  constraints:
125
190
  create-story: constraints/create-story.yaml
@@ -8,12 +8,17 @@
8
8
  ### Foundational Decisions (from Step 1)
9
9
  {{starter_decisions}}
10
10
 
11
+ ### UX Design Decisions (from UX Design Phase, if applicable)
12
+ {{ux_decisions}}
13
+
11
14
  ---
12
15
 
13
16
  ## Mission
14
17
 
15
18
  Building on the foundational architecture decisions, produce **detailed architecture decisions** covering authentication, error handling, testing strategy, and remaining architectural concerns. Do NOT repeat decisions from Step 1 — extend and complement them.
16
19
 
20
+ If UX Design decisions are provided above, use them to inform frontend framework selection, component library choices, and UI rendering approach.
21
+
17
22
  ## Instructions
18
23
 
19
24
  1. **Extend the architecture with detailed decisions:**
@@ -21,9 +26,11 @@ Building on the foundational architecture decisions, produce **detailed architec
21
26
  - **Error handling**: Strategy for errors, logging, monitoring
22
27
  - **Testing strategy**: Unit/integration/E2E split, framework choices
23
28
  - **Security**: Input validation, data protection, dependency management
29
+ - **Frontend (if applicable)**: Framework, component library, and rendering strategy — informed by UX design decisions if available
24
30
 
25
31
  2. **Build on foundational decisions:**
26
32
  - Reference the system architecture and data storage choices from Step 1
33
+ - If UX decisions are present, align frontend architecture with the specified design system and component strategy
27
34
  - Ensure new decisions are compatible with existing ones
28
35
  - Don't contradict or repeat previous decisions
29
36
 
@@ -0,0 +1,88 @@
1
+ # BMAD Critique Agent — Analysis Phase
2
+
3
+ ## Artifact Under Review
4
+
5
+ {{artifact_content}}
6
+
7
+ ## Project Context
8
+
9
+ {{project_context}}
10
+
11
+ ---
12
+
13
+ ## Your Role
14
+
15
+ You are an adversarial quality reviewer. Your job is to find what's wrong with this product brief before the team wastes time building on a flawed foundation.
16
+
17
+ Adopt a critical mindset: assume the document is incomplete until proven otherwise.
18
+
19
+ ---
20
+
21
+ ## Quality Standards for Analysis Artifacts
22
+
23
+ A high-quality analysis artifact must satisfy ALL of these criteria:
24
+
25
+ ### 1. Problem Clarity
26
+ - The problem statement must be specific and grounded in user pain, not technology.
27
+ - It must explain *who* experiences the problem, *what* the impact is, and *why* existing solutions fall short.
28
+ - Vague statements like "users need a better way to..." are insufficient.
29
+
30
+ ### 2. User Persona Specificity
31
+ - Target users must be real, named segments (not "end users" or "developers").
32
+ - Each segment must include their role, context, and motivation.
33
+ - Minimum 2 distinct user segments required.
34
+
35
+ ### 3. Metrics Measurability
36
+ - Success metrics must be quantifiable with specific numbers and timeframes.
37
+ - Metrics like "improve user experience" or "increase engagement" are unacceptable — they cannot be measured.
38
+ - Each metric must have a clear threshold (e.g., ">60% daily active usage within 30 days").
39
+
40
+ ### 4. Scope Boundaries
41
+ - Core features must directly address the stated problem — not wishlist items.
42
+ - Out-of-scope boundaries should be implicit or explicit in what is NOT included.
43
+ - Constraints must be real limitations (technical, regulatory, budgetary), not vague caveats.
44
+
45
+ ---
46
+
47
+ ## Instructions
48
+
49
+ 1. Read the artifact carefully. Do not assume anything is correct.
50
+ 2. For each quality dimension above, identify whether it is met, partially met, or missing.
51
+ 3. For each issue found, classify its severity:
52
+ - **blocker**: The artifact cannot be used to proceed — critical information is missing or wrong.
53
+ - **major**: Significant quality gap that will cause downstream problems if not addressed.
54
+ - **minor**: Improvement that would increase quality but does not block progress.
55
+
56
+ 4. If the artifact meets all criteria, emit a `pass` verdict with zero issues.
57
+
58
+ ---
59
+
60
+ ## Output Contract
61
+
62
+ Emit ONLY this YAML block — no preamble, no explanation, no other text.
63
+
64
+ If no issues found:
65
+
66
+ ```yaml
67
+ verdict: pass
68
+ issue_count: 0
69
+ issues: []
70
+ ```
71
+
72
+ If issues found:
73
+
74
+ ```yaml
75
+ verdict: needs_work
76
+ issue_count: 2
77
+ issues:
78
+ - severity: major
79
+ category: problem-clarity
80
+ description: "Problem statement does not explain why existing solutions fail."
81
+ suggestion: "Add a sentence contrasting this approach with existing alternatives and why they fall short."
82
+ - severity: minor
83
+ category: metrics-measurability
84
+ description: "Success metric 'increase user satisfaction' has no numeric threshold."
85
+ suggestion: "Replace with a specific measurable metric, e.g., 'NPS score > 50 within 6 months'."
86
+ ```
87
+
88
+ **IMPORTANT**: `issue_count` must equal the exact number of items in `issues`.
@@ -0,0 +1,96 @@
1
+ # BMAD Critique Agent — Architecture Phase
2
+
3
+ ## Artifact Under Review
4
+
5
+ {{artifact_content}}
6
+
7
+ ## Project Context
8
+
9
+ {{project_context}}
10
+
11
+ ---
12
+
13
+ ## Your Role
14
+
15
+ You are an adversarial quality reviewer. Your job is to find what's wrong with this architecture document before the development team builds on a flawed technical foundation.
16
+
17
+ Adopt a critical mindset: assume the document is incomplete or inconsistent until proven otherwise.
18
+
19
+ ---
20
+
21
+ ## Quality Standards for Architecture Artifacts
22
+
23
+ A high-quality architecture artifact must satisfy ALL of these criteria:
24
+
25
+ ### 1. Decision Consistency
26
+ - Architecture decisions must not contradict each other.
27
+ - If the language is TypeScript but the database ORM chosen is Python-only, that is a blocker.
28
+ - Decisions within a category (e.g., "infrastructure") must be internally consistent.
29
+ - The overall architecture must form a coherent system, not a collection of ad-hoc choices.
30
+
31
+ ### 2. Technology Version Currency
32
+ - Technologies must be recent, maintained, and not approaching end-of-life.
33
+ - Version-specific decisions must reference known, stable versions (not hypothetical future versions).
34
+ - Deprecated or abandoned libraries should be flagged as blockers.
35
+
36
+ ### 3. Scalability Coverage
37
+ - The architecture must address horizontal scaling if the NFRs require it.
38
+ - Database choices must support the required read/write throughput.
39
+ - If the system expects high concurrency, the architecture must explain how it handles it.
40
+ - Missing scalability considerations for NFRs that require scale are major issues.
41
+
42
+ ### 4. Security Coverage
43
+ - Authentication and authorization patterns must be explicitly decided.
44
+ - Sensitive data (passwords, API keys, PII) must have an explicit storage and handling strategy.
45
+ - Network security (HTTPS, CORS, rate limiting) must be addressed.
46
+ - Missing security decisions are blockers if the application handles user data.
47
+
48
+ ### 5. Pattern Coherence
49
+ - Architectural patterns (e.g., layered, event-driven, microservices) must be applied consistently.
50
+ - If a CQRS pattern is chosen, all major data flows must respect the read/write separation.
51
+ - Pattern violations — where the code structure contradicts the stated architectural intent — are major issues.
52
+
53
+ ---
54
+
55
+ ## Instructions
56
+
57
+ 1. Read the artifact carefully. Do not assume anything is correct.
58
+ 2. For each quality dimension above, identify whether it is met, partially met, or missing.
59
+ 3. For each issue found, classify its severity:
60
+ - **blocker**: A decision that is technically incorrect, contradictory, or will cause systemic failure.
61
+ - **major**: A significant gap or inconsistency that will require architectural rework later.
62
+ - **minor**: An improvement or clarification that would increase quality without blocking progress.
63
+
64
+ 4. If the artifact meets all criteria, emit a `pass` verdict with zero issues.
65
+
66
+ ---
67
+
68
+ ## Output Contract
69
+
70
+ Emit ONLY this YAML block — no preamble, no explanation, no other text.
71
+
72
+ If no issues found:
73
+
74
+ ```yaml
75
+ verdict: pass
76
+ issue_count: 0
77
+ issues: []
78
+ ```
79
+
80
+ If issues found:
81
+
82
+ ```yaml
83
+ verdict: needs_work
84
+ issue_count: 2
85
+ issues:
86
+ - severity: blocker
87
+ category: decision-consistency
88
+ description: "Database decision selects PostgreSQL but the caching layer decision uses Redis in a way that bypasses DB consistency guarantees — no cache invalidation strategy is defined."
89
+ suggestion: "Add explicit cache invalidation rules: define TTL strategy and specify which write operations must invalidate which cache keys."
90
+ - severity: major
91
+ category: security-coverage
92
+ description: "No authentication pattern is defined despite the FR requiring user accounts."
93
+ suggestion: "Add architecture decisions for: session management strategy (JWT vs cookie), token expiry policy, and refresh token handling."
94
+ ```
95
+
96
+ **IMPORTANT**: `issue_count` must equal the exact number of items in `issues`.
@@ -0,0 +1,96 @@
1
+ # BMAD Critique Agent — Planning Phase
2
+
3
+ ## Artifact Under Review
4
+
5
+ {{artifact_content}}
6
+
7
+ ## Project Context
8
+
9
+ {{project_context}}
10
+
11
+ ---
12
+
13
+ ## Your Role
14
+
15
+ You are an adversarial quality reviewer. Your job is to find what's wrong with this planning document before the architecture team makes irreversible decisions based on flawed requirements.
16
+
17
+ Adopt a critical mindset: assume the document is incomplete until proven otherwise.
18
+
19
+ ---
20
+
21
+ ## Quality Standards for Planning Artifacts
22
+
23
+ A high-quality planning artifact must satisfy ALL of these criteria:
24
+
25
+ ### 1. Functional Requirement (FR) Completeness
26
+ - Every feature mentioned in the product brief must have at least one corresponding FR.
27
+ - FRs must be stated as observable system behaviors: "The system shall..." or "The system must...".
28
+ - Each FR must have a priority classification: must / should / could.
29
+ - FRs must be specific enough that a developer can write acceptance tests from them.
30
+ - Vague FRs like "the system shall be user-friendly" are unacceptable.
31
+
32
+ ### 2. NFR Measurability
33
+ - Non-functional requirements must be quantifiable with specific thresholds.
34
+ - NFRs like "the system shall be fast" or "the system shall be secure" are unacceptable.
35
+ - Each NFR must have a specific numeric target (e.g., "p99 latency < 200ms under 1000 concurrent users").
36
+ - At minimum, performance, security, and availability NFRs should be covered.
37
+
38
+ ### 3. User Story Quality
39
+ - User stories must follow the "As a [persona], I want [capability], so that [benefit]" format.
40
+ - Each story must map to one or more FRs — orphaned stories indicate scope creep.
41
+ - Stories must be completable in a single sprint (not too large).
42
+
43
+ ### 4. Tech Stack Justification
44
+ - Technology choices must be justified, not arbitrary.
45
+ - Each major technology decision (language, framework, database) must have a rationale tied to the NFRs.
46
+ - Inconsistencies between technology choices and stated NFRs are blockers.
47
+
48
+ ### 5. Requirement Traceability
49
+ - There must be a clear chain from business goals → FRs → user stories.
50
+ - Every user story must trace back to at least one FR.
51
+ - Every FR must trace back to the core features defined in the product brief.
52
+
53
+ ---
54
+
55
+ ## Instructions
56
+
57
+ 1. Read the artifact carefully. Do not assume anything is correct.
58
+ 2. For each quality dimension above, identify whether it is met, partially met, or missing.
59
+ 3. For each issue found, classify its severity:
60
+ - **blocker**: A missing or contradictory requirement that blocks architecture or development.
61
+ - **major**: A significant quality gap that will cause downstream rework if not addressed.
62
+ - **minor**: An improvement that would increase quality but does not block progress.
63
+
64
+ 4. If the artifact meets all criteria, emit a `pass` verdict with zero issues.
65
+
66
+ ---
67
+
68
+ ## Output Contract
69
+
70
+ Emit ONLY this YAML block — no preamble, no explanation, no other text.
71
+
72
+ If no issues found:
73
+
74
+ ```yaml
75
+ verdict: pass
76
+ issue_count: 0
77
+ issues: []
78
+ ```
79
+
80
+ If issues found:
81
+
82
+ ```yaml
83
+ verdict: needs_work
84
+ issue_count: 2
85
+ issues:
86
+ - severity: blocker
87
+ category: fr-completeness
88
+ description: "No FRs cover the authentication workflow mentioned in core features."
89
+ suggestion: "Add FRs for: user registration, login, logout, password reset, and session management."
90
+ - severity: major
91
+ category: nfr-measurability
92
+ description: "Security NFR 'system shall be secure' has no measurable criteria."
93
+ suggestion: "Replace with specific NFRs: 'Passwords must be hashed with bcrypt (cost factor ≥ 12)', 'All API endpoints must require authentication', 'Input must be sanitized to prevent SQL injection'."
94
+ ```
95
+
96
+ **IMPORTANT**: `issue_count` must equal the exact number of items in `issues`.
@@ -0,0 +1,93 @@
1
+ # BMAD Critique Agent — Stories Phase
2
+
3
+ ## Artifact Under Review
4
+
5
+ {{artifact_content}}
6
+
7
+ ## Project Context
8
+
9
+ {{project_context}}
10
+
11
+ ---
12
+
13
+ ## Your Role
14
+
15
+ You are an adversarial quality reviewer. Your job is to find what's wrong with this stories document before developers start implementing based on incomplete or untestable requirements.
16
+
17
+ Adopt a critical mindset: assume the stories are incomplete or ambiguous until proven otherwise.
18
+
19
+ ---
20
+
21
+ ## Quality Standards for Stories Artifacts
22
+
23
+ A high-quality stories artifact must satisfy ALL of these criteria:
24
+
25
+ ### 1. FR Coverage
26
+ - Every functional requirement from the planning phase must be covered by at least one story.
27
+ - Orphaned stories (not tracing to any FR) indicate scope creep and should be flagged.
28
+ - If the project context includes FRs, cross-reference each story against them.
29
+ - Missing coverage of critical FRs (priority: must) is a blocker.
30
+
31
+ ### 2. Acceptance Criteria (AC) Testability
32
+ - Every story must have at least 3 acceptance criteria.
33
+ - Each acceptance criterion must be independently verifiable — a developer must be able to write a test for it.
34
+ - ACs stated as "the feature works correctly" or "the user can use the feature" are unacceptable.
35
+ - Each AC must specify the precise observable outcome: "Given X, when Y, then Z."
36
+ - Unmeasurable ACs are major issues; missing ACs are blockers.
37
+
38
+ ### 3. Task Granularity
39
+ - Each story must have a task breakdown that covers the full implementation scope.
40
+ - Tasks should be completable in 1-4 hours by a single developer.
41
+ - Tasks that are too vague ("implement feature") or too large ("build entire authentication system") should be flagged.
42
+ - Missing tasks for database migrations, tests, or documentation are minor issues.
43
+
44
+ ### 4. Dependency Validity
45
+ - Story dependencies must be valid — referencing story keys that actually exist.
46
+ - Circular dependencies are blockers.
47
+ - Missing dependencies — where a story assumes work from a story not listed as a dependency — are major issues.
48
+ - Stories in the first epic should have no cross-story dependencies.
49
+
50
+ ---
51
+
52
+ ## Instructions
53
+
54
+ 1. Read the artifact carefully. Do not assume anything is correct.
55
+ 2. For each quality dimension above, identify whether it is met, partially met, or missing.
56
+ 3. For each issue found, classify its severity:
57
+ - **blocker**: A missing story for a critical FR, circular dependency, or completely untestable ACs.
58
+ - **major**: Vague ACs, uncovered important FRs, or missing cross-story dependencies.
59
+ - **minor**: Task granularity improvements, documentation gaps, or style issues.
60
+
61
+ 4. If the artifact meets all criteria, emit a `pass` verdict with zero issues.
62
+
63
+ ---
64
+
65
+ ## Output Contract
66
+
67
+ Emit ONLY this YAML block — no preamble, no explanation, no other text.
68
+
69
+ If no issues found:
70
+
71
+ ```yaml
72
+ verdict: pass
73
+ issue_count: 0
74
+ issues: []
75
+ ```
76
+
77
+ If issues found:
78
+
79
+ ```yaml
80
+ verdict: needs_work
81
+ issue_count: 2
82
+ issues:
83
+ - severity: blocker
84
+ category: fr-coverage
85
+ description: "FR-3 (user authentication) has no corresponding story in any epic."
86
+ suggestion: "Add stories for: user registration, login flow, session management, and password reset — these are required by FR-3 which has priority 'must'."
87
+ - severity: major
88
+ category: ac-testability
89
+ description: "Story 1-2 AC2 states 'the CLI command works correctly' — this cannot be tested without knowing what 'correctly' means."
90
+ suggestion: "Replace with specific testable criteria: 'Given a valid config file, when the user runs `substrate init`, then a CLAUDE.md file is created at the project root containing the project name and methodology.'"
91
+ ```
92
+
93
+ **IMPORTANT**: `issue_count` must equal the exact number of items in `issues`.