@qball-inc/the-bulwark 1.0.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 (175) hide show
  1. package/.claude-plugin/plugin.json +43 -0
  2. package/agents/bulwark-fix-validator.md +633 -0
  3. package/agents/bulwark-implementer.md +391 -0
  4. package/agents/bulwark-issue-analyzer.md +308 -0
  5. package/agents/bulwark-standards-reviewer.md +221 -0
  6. package/agents/plan-creation-architect.md +323 -0
  7. package/agents/plan-creation-eng-lead.md +352 -0
  8. package/agents/plan-creation-po.md +300 -0
  9. package/agents/plan-creation-qa-critic.md +334 -0
  10. package/agents/product-ideation-competitive-analyzer.md +298 -0
  11. package/agents/product-ideation-idea-validator.md +268 -0
  12. package/agents/product-ideation-market-researcher.md +292 -0
  13. package/agents/product-ideation-pattern-documenter.md +308 -0
  14. package/agents/product-ideation-segment-analyzer.md +303 -0
  15. package/agents/product-ideation-strategist.md +259 -0
  16. package/agents/statusline-setup.md +97 -0
  17. package/hooks/hooks.json +59 -0
  18. package/package.json +45 -0
  19. package/scripts/hooks/cleanup-stale.sh +13 -0
  20. package/scripts/hooks/enforce-quality.sh +166 -0
  21. package/scripts/hooks/implementer-quality.sh +256 -0
  22. package/scripts/hooks/inject-protocol.sh +52 -0
  23. package/scripts/hooks/suggest-pipeline.sh +175 -0
  24. package/scripts/hooks/track-pipeline-start.sh +37 -0
  25. package/scripts/hooks/track-pipeline-stop.sh +52 -0
  26. package/scripts/init-rules.sh +35 -0
  27. package/scripts/init.sh +151 -0
  28. package/skills/anthropic-validator/SKILL.md +607 -0
  29. package/skills/anthropic-validator/references/agents-checklist.md +131 -0
  30. package/skills/anthropic-validator/references/commands-checklist.md +102 -0
  31. package/skills/anthropic-validator/references/hooks-checklist.md +151 -0
  32. package/skills/anthropic-validator/references/mcp-checklist.md +136 -0
  33. package/skills/anthropic-validator/references/plugins-checklist.md +148 -0
  34. package/skills/anthropic-validator/references/skills-checklist.md +85 -0
  35. package/skills/assertion-patterns/SKILL.md +296 -0
  36. package/skills/bug-magnet-data/SKILL.md +284 -0
  37. package/skills/bug-magnet-data/context/cli-args.md +91 -0
  38. package/skills/bug-magnet-data/context/db-query.md +104 -0
  39. package/skills/bug-magnet-data/context/file-contents.md +103 -0
  40. package/skills/bug-magnet-data/context/http-body.md +91 -0
  41. package/skills/bug-magnet-data/context/process-spawn.md +123 -0
  42. package/skills/bug-magnet-data/data/booleans/boundaries.yaml +143 -0
  43. package/skills/bug-magnet-data/data/collections/arrays.yaml +114 -0
  44. package/skills/bug-magnet-data/data/collections/objects.yaml +123 -0
  45. package/skills/bug-magnet-data/data/concurrency/race-conditions.yaml +118 -0
  46. package/skills/bug-magnet-data/data/concurrency/state-machines.yaml +115 -0
  47. package/skills/bug-magnet-data/data/dates/boundaries.yaml +137 -0
  48. package/skills/bug-magnet-data/data/dates/invalid.yaml +132 -0
  49. package/skills/bug-magnet-data/data/dates/timezone.yaml +118 -0
  50. package/skills/bug-magnet-data/data/encoding/charset.yaml +79 -0
  51. package/skills/bug-magnet-data/data/encoding/normalization.yaml +105 -0
  52. package/skills/bug-magnet-data/data/formats/email.yaml +154 -0
  53. package/skills/bug-magnet-data/data/formats/json.yaml +187 -0
  54. package/skills/bug-magnet-data/data/formats/url.yaml +165 -0
  55. package/skills/bug-magnet-data/data/language-specific/javascript.yaml +182 -0
  56. package/skills/bug-magnet-data/data/language-specific/python.yaml +174 -0
  57. package/skills/bug-magnet-data/data/language-specific/rust.yaml +148 -0
  58. package/skills/bug-magnet-data/data/numbers/boundaries.yaml +161 -0
  59. package/skills/bug-magnet-data/data/numbers/precision.yaml +89 -0
  60. package/skills/bug-magnet-data/data/numbers/special.yaml +69 -0
  61. package/skills/bug-magnet-data/data/strings/boundaries.yaml +109 -0
  62. package/skills/bug-magnet-data/data/strings/injection.yaml +208 -0
  63. package/skills/bug-magnet-data/data/strings/special-chars.yaml +190 -0
  64. package/skills/bug-magnet-data/data/strings/unicode.yaml +139 -0
  65. package/skills/bug-magnet-data/references/external-lists.md +115 -0
  66. package/skills/bulwark-brainstorm/SKILL.md +563 -0
  67. package/skills/bulwark-brainstorm/references/at-teammate-prompts.md +60 -0
  68. package/skills/bulwark-brainstorm/references/role-critical-analyst.md +78 -0
  69. package/skills/bulwark-brainstorm/references/role-development-lead.md +66 -0
  70. package/skills/bulwark-brainstorm/references/role-product-delivery-lead.md +79 -0
  71. package/skills/bulwark-brainstorm/references/role-product-manager.md +62 -0
  72. package/skills/bulwark-brainstorm/references/role-project-sme.md +59 -0
  73. package/skills/bulwark-brainstorm/references/role-technical-architect.md +66 -0
  74. package/skills/bulwark-research/SKILL.md +298 -0
  75. package/skills/bulwark-research/references/viewpoint-contrarian.md +63 -0
  76. package/skills/bulwark-research/references/viewpoint-direct-investigation.md +62 -0
  77. package/skills/bulwark-research/references/viewpoint-first-principles.md +65 -0
  78. package/skills/bulwark-research/references/viewpoint-practitioner.md +62 -0
  79. package/skills/bulwark-research/references/viewpoint-prior-art.md +66 -0
  80. package/skills/bulwark-scaffold/SKILL.md +330 -0
  81. package/skills/bulwark-statusline/SKILL.md +161 -0
  82. package/skills/bulwark-statusline/scripts/statusline.sh +144 -0
  83. package/skills/bulwark-verify/SKILL.md +519 -0
  84. package/skills/code-review/SKILL.md +428 -0
  85. package/skills/code-review/examples/anti-patterns/linting.ts +181 -0
  86. package/skills/code-review/examples/anti-patterns/security.ts +91 -0
  87. package/skills/code-review/examples/anti-patterns/standards.ts +195 -0
  88. package/skills/code-review/examples/anti-patterns/type-safety.ts +108 -0
  89. package/skills/code-review/examples/recommended/linting.ts +195 -0
  90. package/skills/code-review/examples/recommended/security.ts +154 -0
  91. package/skills/code-review/examples/recommended/standards.ts +231 -0
  92. package/skills/code-review/examples/recommended/type-safety.ts +181 -0
  93. package/skills/code-review/frameworks/angular.md +218 -0
  94. package/skills/code-review/frameworks/django.md +235 -0
  95. package/skills/code-review/frameworks/express.md +207 -0
  96. package/skills/code-review/frameworks/flask.md +298 -0
  97. package/skills/code-review/frameworks/generic.md +146 -0
  98. package/skills/code-review/frameworks/react.md +152 -0
  99. package/skills/code-review/frameworks/vue.md +244 -0
  100. package/skills/code-review/references/linting-patterns.md +221 -0
  101. package/skills/code-review/references/security-patterns.md +125 -0
  102. package/skills/code-review/references/standards-patterns.md +246 -0
  103. package/skills/code-review/references/type-safety-patterns.md +130 -0
  104. package/skills/component-patterns/SKILL.md +131 -0
  105. package/skills/component-patterns/references/pattern-cli-command.md +118 -0
  106. package/skills/component-patterns/references/pattern-database.md +166 -0
  107. package/skills/component-patterns/references/pattern-external-api.md +139 -0
  108. package/skills/component-patterns/references/pattern-file-parser.md +168 -0
  109. package/skills/component-patterns/references/pattern-http-server.md +162 -0
  110. package/skills/component-patterns/references/pattern-process-spawner.md +133 -0
  111. package/skills/continuous-feedback/SKILL.md +327 -0
  112. package/skills/continuous-feedback/references/collect-instructions.md +81 -0
  113. package/skills/continuous-feedback/references/specialize-code-review.md +82 -0
  114. package/skills/continuous-feedback/references/specialize-general.md +98 -0
  115. package/skills/continuous-feedback/references/specialize-test-audit.md +81 -0
  116. package/skills/create-skill/SKILL.md +359 -0
  117. package/skills/create-skill/references/agent-conventions.md +194 -0
  118. package/skills/create-skill/references/agent-template.md +195 -0
  119. package/skills/create-skill/references/content-guidance.md +291 -0
  120. package/skills/create-skill/references/decision-framework.md +124 -0
  121. package/skills/create-skill/references/template-pipeline.md +217 -0
  122. package/skills/create-skill/references/template-reference-heavy.md +111 -0
  123. package/skills/create-skill/references/template-research.md +210 -0
  124. package/skills/create-skill/references/template-script-driven.md +172 -0
  125. package/skills/create-skill/references/template-simple.md +80 -0
  126. package/skills/create-subagent/SKILL.md +353 -0
  127. package/skills/create-subagent/references/agent-conventions.md +268 -0
  128. package/skills/create-subagent/references/content-guidance.md +232 -0
  129. package/skills/create-subagent/references/decision-framework.md +134 -0
  130. package/skills/create-subagent/references/template-single-agent.md +192 -0
  131. package/skills/fix-bug/SKILL.md +241 -0
  132. package/skills/governance-protocol/SKILL.md +116 -0
  133. package/skills/init/SKILL.md +341 -0
  134. package/skills/issue-debugging/SKILL.md +385 -0
  135. package/skills/issue-debugging/references/anti-patterns.md +245 -0
  136. package/skills/issue-debugging/references/debug-report-schema.md +227 -0
  137. package/skills/mock-detection/SKILL.md +511 -0
  138. package/skills/mock-detection/references/false-positive-prevention.md +402 -0
  139. package/skills/mock-detection/references/stub-patterns.md +236 -0
  140. package/skills/pipeline-templates/SKILL.md +215 -0
  141. package/skills/pipeline-templates/references/code-change-workflow.md +277 -0
  142. package/skills/pipeline-templates/references/code-review.md +336 -0
  143. package/skills/pipeline-templates/references/fix-validation.md +421 -0
  144. package/skills/pipeline-templates/references/new-feature.md +335 -0
  145. package/skills/pipeline-templates/references/research-brainstorm.md +161 -0
  146. package/skills/pipeline-templates/references/research-planning.md +257 -0
  147. package/skills/pipeline-templates/references/test-audit.md +389 -0
  148. package/skills/pipeline-templates/references/test-execution-fix.md +238 -0
  149. package/skills/plan-creation/SKILL.md +497 -0
  150. package/skills/product-ideation/SKILL.md +372 -0
  151. package/skills/product-ideation/references/analysis-frameworks.md +161 -0
  152. package/skills/session-handoff/SKILL.md +139 -0
  153. package/skills/session-handoff/references/examples.md +223 -0
  154. package/skills/setup-lsp/SKILL.md +312 -0
  155. package/skills/setup-lsp/references/server-registry.md +85 -0
  156. package/skills/setup-lsp/references/troubleshooting.md +135 -0
  157. package/skills/subagent-output-templating/SKILL.md +415 -0
  158. package/skills/subagent-output-templating/references/examples.md +440 -0
  159. package/skills/subagent-prompting/SKILL.md +364 -0
  160. package/skills/subagent-prompting/references/examples.md +342 -0
  161. package/skills/test-audit/SKILL.md +531 -0
  162. package/skills/test-audit/references/known-limitations.md +41 -0
  163. package/skills/test-audit/references/priority-classification.md +30 -0
  164. package/skills/test-audit/references/prompts/deep-mode-detection.md +83 -0
  165. package/skills/test-audit/references/prompts/synthesis.md +57 -0
  166. package/skills/test-audit/references/rewrite-instructions.md +46 -0
  167. package/skills/test-audit/references/schemas/audit-output.yaml +100 -0
  168. package/skills/test-audit/references/schemas/diagnostic-output.yaml +49 -0
  169. package/skills/test-audit/scripts/data-flow-analyzer.ts +509 -0
  170. package/skills/test-audit/scripts/integration-mock-detector.ts +462 -0
  171. package/skills/test-audit/scripts/package.json +20 -0
  172. package/skills/test-audit/scripts/skip-detector.ts +211 -0
  173. package/skills/test-audit/scripts/verification-counter.ts +295 -0
  174. package/skills/test-classification/SKILL.md +310 -0
  175. package/skills/test-fixture-creation/SKILL.md +295 -0
@@ -0,0 +1,335 @@
1
+ # New Feature Pipeline
2
+
3
+ ## Purpose
4
+
5
+ Implement new functionality with proper research, implementation, testing, and review.
6
+
7
+ ## When to Use
8
+
9
+ - Adding new features
10
+ - Implementing new modules
11
+ - Creating new components
12
+ - Building new integrations
13
+
14
+ ## Pipeline Definition
15
+
16
+ ```fsharp
17
+ // New Feature Pipeline
18
+ // Trigger: Feature request, new capability needed
19
+ // Output: Implemented feature with tests and review
20
+
21
+ Researcher (gather requirements & patterns) // Haiku - lookups
22
+ |> Architect (design approach) // Sonnet - analysis
23
+ |> Implementer (write code) // Opus - bulwark-implementer
24
+ |> TestWriter (write tests) // Opus - write tests
25
+ |> TestAudit (mock-detection only) // Audit any new/modified tests for T1-T4
26
+ |> CodeReviewer (review implementation) // Sonnet - review
27
+ |> (if !approved
28
+ then Implementer // Loop back
29
+ else Done)
30
+ |> LOOP(max=2) // Max 2 revision rounds
31
+ ```
32
+
33
+ ## Stage Details
34
+
35
+ ### Stage 1: Researcher
36
+
37
+ **Model**: Haiku (lookup task)
38
+
39
+ **GOAL**: Gather information needed for implementation.
40
+
41
+ **CONSTRAINTS**:
42
+ - Do NOT modify any files
43
+ - Focus on relevant patterns only
44
+ - Document sources
45
+
46
+ **CONTEXT**:
47
+ - Feature requirements
48
+ - Project structure
49
+ - Related existing code
50
+
51
+ **OUTPUT**: Research findings
52
+ ```yaml
53
+ research:
54
+ requirements:
55
+ - "User can export data to CSV"
56
+ - "Export includes all visible columns"
57
+ - "Large exports should stream"
58
+ existing_patterns:
59
+ - file: src/utils/export.ts
60
+ pattern: "Existing PDF export can be extended"
61
+ - file: src/components/DataTable.tsx
62
+ pattern: "Column visibility tracked in state"
63
+ dependencies:
64
+ - "csv-stringify for CSV generation"
65
+ - "Existing streaming infrastructure"
66
+ considerations:
67
+ - "Memory usage for large datasets"
68
+ - "Progress indication for user"
69
+ ```
70
+
71
+ ### Stage 2: Architect
72
+
73
+ **Model**: Sonnet (design/analysis task)
74
+
75
+ **GOAL**: Design implementation approach.
76
+
77
+ **CONSTRAINTS**:
78
+ - Do NOT modify any files
79
+ - Consider existing patterns
80
+ - Identify risks and trade-offs
81
+
82
+ **CONTEXT**:
83
+ - Research findings from Stage 1
84
+ - Project architecture
85
+ - Performance requirements
86
+
87
+ **OUTPUT**: Design document
88
+ ```yaml
89
+ design:
90
+ approach: "Extend existing export utility with CSV support"
91
+ components:
92
+ - name: CSVExporter
93
+ location: src/utils/csv-export.ts
94
+ responsibility: "Convert data to CSV format"
95
+ - name: ExportButton
96
+ location: src/components/ExportButton.tsx
97
+ responsibility: "UI for triggering export"
98
+ data_flow:
99
+ - "User clicks export button"
100
+ - "DataTable provides visible columns and data"
101
+ - "CSVExporter streams data to download"
102
+ trade_offs:
103
+ - pro: "Reuses existing export infrastructure"
104
+ - con: "Adds dependency on csv-stringify"
105
+ risks:
106
+ - "Memory pressure on large exports"
107
+ - mitigation: "Use streaming with chunk size limit"
108
+ ```
109
+
110
+ ### Stage 3: Implementer
111
+
112
+ **Agent**: `bulwark-implementer` (custom sub-agent)
113
+
114
+ **Model**: Opus (code writing with quality enforcement)
115
+
116
+ **GOAL**: Implement the feature per design.
117
+
118
+ **CONSTRAINTS**:
119
+ - Follow the design from Stage 2
120
+ - Use existing patterns
121
+ - Do NOT over-engineer
122
+ - Keep changes minimal
123
+ - Max 3 quality gate retries before escalation
124
+
125
+ **CONTEXT** (must include for `context: fork`):
126
+ - Design document from Stage 2 (include full design output or path)
127
+ - Requirements from Stage 1 research
128
+ - Existing patterns to follow
129
+ - Project coding standards
130
+
131
+ **Invocation**:
132
+ ```
133
+ Task: subagent_type=bulwark-implementer
134
+ Prompt:
135
+ GOAL: Implement the feature based on the design document.
136
+ CONSTRAINTS: Follow the design. Write tests. Max 3 quality gate retries.
137
+ CONTEXT:
138
+ mode: feature
139
+ design_document: {Stage 2 design output or path}
140
+ requirements: {from Stage 1 research}
141
+ existing_patterns: {relevant pattern files}
142
+ OUTPUT: Implementation report at logs/implementer-{id}-{timestamp}.yaml
143
+ ```
144
+
145
+ **OUTPUT**: Implementation report at `logs/implementer-{id}-{timestamp}.yaml`
146
+ ```yaml
147
+ implementation_report:
148
+ changes:
149
+ files_created:
150
+ - path: src/utils/csv-export.ts
151
+ purpose: "CSV export utility"
152
+ lines: 45
153
+ files_modified:
154
+ - path: src/components/DataTable.tsx
155
+ changes: "Added export button integration"
156
+ dependencies_added:
157
+ - name: csv-stringify
158
+ version: "^6.0.0"
159
+ reason: "CSV generation"
160
+ tests:
161
+ files_created:
162
+ - path: tests/utils/csv-export.test.ts
163
+ cases: ["exports simple data", "handles special characters", "streams large datasets"]
164
+ quality_gates:
165
+ typecheck: passed
166
+ lint: passed
167
+ retries: 0
168
+ pipeline_suggestions:
169
+ - pipeline: "Code Review"
170
+ target_files: [src/utils/csv-export.ts, src/components/DataTable.tsx]
171
+ reason: "New feature implementation, 2 files"
172
+ ```
173
+
174
+ **SA6 Note**: The implementer returns pipeline suggestions with MANDATORY language in its summary. The orchestrator MUST evaluate each suggestion per SA6.
175
+
176
+ ### Stage 4: TestWriter
177
+
178
+ **Model**: Opus (test writing required)
179
+
180
+ **GOAL**: Write tests for the new feature.
181
+
182
+ **CONSTRAINTS**:
183
+ - Tests verify real behavior (T1)
184
+ - No mocking system under test (T2)
185
+ - Cover happy path and edge cases
186
+ - Integration tests for component interaction
187
+
188
+ **CONTEXT**:
189
+ - Implementation from Stage 3
190
+ - Project test patterns
191
+ - Feature requirements
192
+
193
+ **OUTPUT**: Tests
194
+ ```yaml
195
+ tests:
196
+ unit_tests:
197
+ - file: tests/utils/csv-export.test.ts
198
+ cases:
199
+ - "exports simple data correctly"
200
+ - "handles special characters"
201
+ - "streams large datasets"
202
+ integration_tests:
203
+ - file: tests/components/DataTable.export.test.ts
204
+ cases:
205
+ - "export button triggers download"
206
+ - "respects column visibility"
207
+ ```
208
+
209
+ ### Stage 4b: TestAudit (Conditional)
210
+
211
+ **Trigger**: Runs if **any** test files were created or modified in Stage 3 (Implementer) OR Stage 4 (TestWriter). This ensures implementer-written tests receive T1-T4 audit even when TestWriter adds no new tests.
212
+
213
+ **Model**: Haiku (classification) → Sonnet (detection)
214
+
215
+ **Skills**: `mock-detection` (lighter weight than full test-audit)
216
+
217
+ **GOAL**: Verify new/modified tests don't have T1-T4 violations before proceeding to review.
218
+
219
+ **CONSTRAINTS**:
220
+ - Audit test files touched by Implementer (Stage 3) and/or TestWriter (Stage 4)
221
+ - Block pipeline if T1 violation found (mocking system under test)
222
+ - Warn on T2-T4 violations but allow proceed
223
+ - Do NOT audit existing tests (only new/modified in this pipeline run)
224
+
225
+ **CONTEXT**:
226
+ - List of test files created/modified by Implementer and/or TestWriter
227
+ - Design document for understanding what's being tested
228
+
229
+ **OUTPUT**: Audit result
230
+ ```yaml
231
+ test_audit:
232
+ files_audited:
233
+ - path: tests/utils/csv-export.test.ts
234
+ status: passed | failed
235
+ violations: []
236
+
237
+ t1_violations: 0 # Critical - blocks pipeline
238
+ t2_violations: 0 # High - warning only
239
+ t3_violations: 0 # Medium - warning only
240
+ t4_violations: 0 # Low - warning only
241
+
242
+ proceed: true | false
243
+ notes: "All generated tests follow T1-T4 rules"
244
+ ```
245
+
246
+ **Failure Handling**:
247
+ - If T1 violation: Return to TestWriter with feedback, request rewrite
248
+ - If T2-T4 violations: Log warning, proceed to CodeReviewer
249
+ - Max 2 audit iterations before escalating to user
250
+
251
+ ### Stage 5: CodeReviewer
252
+
253
+ **Model**: Sonnet (review task)
254
+
255
+ **GOAL**: Review implementation quality and completeness.
256
+
257
+ **CONSTRAINTS**:
258
+ - Do NOT modify any files
259
+ - Check against requirements
260
+ - Verify tests are adequate
261
+ - Check for security issues
262
+
263
+ **CONTEXT**:
264
+ - Original requirements
265
+ - Design document
266
+ - Implementation
267
+ - Tests
268
+
269
+ **OUTPUT**: Review decision
270
+ ```yaml
271
+ review:
272
+ approved: true | false
273
+ checklist:
274
+ requirements_met: true
275
+ tests_adequate: true
276
+ security_checked: true
277
+ performance_acceptable: true
278
+ concerns: []
279
+ recommendations:
280
+ - "Consider adding rate limiting for exports"
281
+ ```
282
+
283
+ ### Loop Condition
284
+
285
+ If `approved: false`, loop back to Stage 3 (`bulwark-implementer`) with:
286
+ - Review feedback
287
+ - Specific concerns to address
288
+ - Previous implementation report path
289
+
290
+ **Max iterations**: 2 (prevent scope creep)
291
+
292
+ ## Example Invocation
293
+
294
+ ```markdown
295
+ ## Pipeline: New Feature
296
+
297
+ ### Stage 1: Researcher
298
+ Task: subagent_type=general-purpose, model=haiku
299
+ Prompt: [4-part prompt with feature requirements]
300
+
301
+ ### Stage 2: Architect
302
+ Task: subagent_type=general-purpose, model=sonnet
303
+ Prompt: [4-part prompt, reads research]
304
+
305
+ ### Stage 3: Implementer
306
+ Task: subagent_type=bulwark-implementer
307
+ Prompt: [4-part prompt with design doc, requirements, existing patterns]
308
+ Output: Implementation report at logs/implementer-{id}-{timestamp}.yaml
309
+
310
+ ### Stage 4: TestWriter
311
+ Task: subagent_type=general-purpose, model=opus
312
+ Prompt: [4-part prompt, tests implementation]
313
+
314
+ ### Stage 5: CodeReviewer
315
+ Task: subagent_type=general-purpose, model=sonnet
316
+ Prompt: [4-part prompt, reviews all]
317
+
318
+ ### Loop Check
319
+ If not approved and iterations < 2:
320
+ Go to Stage 3 (bulwark-implementer) with feedback + previous implementation report
321
+ ```
322
+
323
+ ## Success Criteria
324
+
325
+ - Requirements researched and understood
326
+ - Design documented before implementation
327
+ - Implementation follows design
328
+ - Tests verify real behavior
329
+ - Review approves or revisions complete
330
+
331
+ ## Related Pipelines
332
+
333
+ - **Research & Planning**: For more extensive research phase
334
+ - **Code Review**: For reviewing without implementation
335
+ - **Fix Validation**: For fixing issues found in review
@@ -0,0 +1,161 @@
1
+ # Research & Brainstorm Pipeline
2
+
3
+ ## Purpose
4
+
5
+ Deep multi-viewpoint research followed by role-based brainstorming to produce authoritative analysis for task brief creation. Uses two independent skills — `bulwark-research` and `bulwark-brainstorm` — across multiple sessions.
6
+
7
+ ## When to Use
8
+
9
+ - Complex topics requiring structured research before implementation
10
+ - Multi-topic analysis with cross-topic synthesis
11
+ - Technology evaluations, architecture decisions, methodology design
12
+ - Any task where "should we build this?" precedes "how do we build this?"
13
+
14
+ ## Pipeline Definition
15
+
16
+ ```fsharp
17
+ // Research & Brainstorm Pipeline (multi-session)
18
+ // Each box is a separate session due to token budget constraints
19
+
20
+ // === Single Topic ===
21
+
22
+ BulwarkResearch(topic) // Session N: 5 Sonnet parallel + synthesis
23
+ |> BulwarkBrainstorm(topic) // Session N+1: 5 Opus sequenced + synthesis
24
+
25
+ // === Multi-Topic ===
26
+
27
+ // Phase 1: Research (one session per topic)
28
+ [BulwarkResearch(topic1),
29
+ BulwarkResearch(topic2),
30
+ BulwarkResearch(topic3)] // N sessions (1 per topic)
31
+
32
+ // Phase 1 Gate: Cross-topic synthesis (orchestrator-only, no sub-agents)
33
+ |> CrossTopicResearchSynthesis // 1 session: identify interactions, gate decision
34
+
35
+ // Phase 2: Brainstorm (one session per surviving topic)
36
+ |> [BulwarkBrainstorm(topic1'),
37
+ BulwarkBrainstorm(topic2')] // N' sessions (topics may be merged/dropped)
38
+
39
+ // Phase 2 Final: Authoritative document (orchestrator-only, no sub-agents)
40
+ |> CrossTopicBrainstormSynthesis // 1 session: authoritative document
41
+
42
+ // Task brief creation from authoritative document
43
+ |> TaskBriefCreation // 1 session
44
+ ```
45
+
46
+ ## Session Budget
47
+
48
+ | Scenario | Formula | Example (3 topics) |
49
+ |----------|---------|---------------------|
50
+ | Single topic | 2 sessions | 2 sessions |
51
+ | Multi-topic | (N + 1) x 2 + 1 | (3+1) x 2 + 1 = 9 sessions |
52
+
53
+ ## Stage Details
54
+
55
+ ### BulwarkResearch (Per-Topic)
56
+
57
+ **Skill**: `/bulwark-research`
58
+ **Model**: Orchestrator = Opus (main), Agents = 5 Sonnet (parallel)
59
+ **Input**: Topic description, optional context file
60
+ **Output**: `logs/research/{topic-slug}/synthesis.md`
61
+
62
+ Spawns 5 parallel Sonnet viewpoint agents:
63
+ 1. Direct Investigation
64
+ 2. Practitioner Perspective
65
+ 3. Contrarian Angle
66
+ 4. First Principles
67
+ 5. Prior Art / Historical
68
+
69
+ ### BulwarkBrainstorm (Per-Topic)
70
+
71
+ **Skill**: `/bulwark-brainstorm`
72
+ **Model**: Orchestrator = Opus (main), Agents = 5 Opus (sequenced)
73
+ **Input**: Topic description, research synthesis from Phase 1
74
+ **Output**: `logs/brainstorm/{topic-slug}/synthesis.md`
75
+
76
+ Spawns 5 sequenced Opus role agents:
77
+ 1. Project SME (solo, first — autonomous codebase exploration)
78
+ 2. Senior Product Manager (parallel with 3, 4)
79
+ 3. Senior Technical Architect (parallel with 2, 4)
80
+ 4. Senior Development Lead (parallel with 2, 3)
81
+ 5. Critical Analyst (solo, last — reads all prior outputs)
82
+
83
+ ### CrossTopicResearchSynthesis (Gate Session)
84
+
85
+ **Model**: Orchestrator only (no sub-agents)
86
+ **Input**: All per-topic research synthesis documents
87
+ **Output**: Cross-topic synthesis with gate decision
88
+
89
+ Orchestrator reads all per-topic syntheses and identifies:
90
+ - **Interactions**: How findings from one topic affect another
91
+ - **Redundancies**: Where topics overlap
92
+ - **Subsumptions**: Where one topic makes another irrelevant
93
+ - **Conflicts**: Where topics lead to contradictory recommendations
94
+
95
+ **Gate decision** (via AskUserQuestion): Which topics proceed to Phase 2?
96
+ Options per topic: Proceed / Modify / Merge / Drop
97
+
98
+ ### CrossTopicBrainstormSynthesis (Final Session)
99
+
100
+ **Model**: Orchestrator only (no sub-agents)
101
+ **Input**: All per-topic brainstorm synthesis documents
102
+ **Output**: Authoritative document for task brief creation
103
+
104
+ Produces the definitive document with:
105
+ - Executive summary
106
+ - Per-topic summaries
107
+ - Implementation recommendations
108
+ - Scope definition (v1 vs. deferred)
109
+ - Architecture overview
110
+ - Build plan with ordering
111
+ - Risks and mitigations
112
+ - Decisions still required
113
+
114
+ ### TaskBriefCreation
115
+
116
+ **Model**: Orchestrator only
117
+ **Input**: Authoritative document
118
+ **Output**: `plans/task-briefs/P{X}.{Y}-{name}.md`
119
+
120
+ Standard task brief creation from the authoritative document. No sub-agents needed — the research and brainstorming are complete.
121
+
122
+ ## Output Structure
123
+
124
+ ```
125
+ logs/
126
+ research/
127
+ {topic-slug}/
128
+ 01-direct-investigation.md
129
+ 02-practitioner.md
130
+ 03-contrarian.md
131
+ 04-first-principles.md
132
+ 05-prior-art.md
133
+ synthesis.md
134
+ brainstorm/
135
+ {topic-slug}/
136
+ 01-project-sme.md
137
+ 02-product-manager.md
138
+ 03-technical-architect.md
139
+ 04-development-lead.md
140
+ 05-critical-analyst.md
141
+ synthesis.md
142
+ diagnostics/
143
+ bulwark-research-{timestamp}.yaml
144
+ bulwark-brainstorm-{timestamp}.yaml
145
+ ```
146
+
147
+ ## Success Criteria
148
+
149
+ - All viewpoint agents produced output (research phase)
150
+ - All role agents produced output in correct sequence (brainstorm phase)
151
+ - Synthesis documents follow templates
152
+ - AskUserQuestion used at each checkpoint
153
+ - Gate decision approved by user (multi-topic)
154
+ - Authoritative document produced (multi-topic)
155
+ - Task brief created from authoritative document
156
+
157
+ ## Related Pipelines
158
+
159
+ - **Research & Planning**: Simpler research + iterative planning (no role-based brainstorming)
160
+ - **New Feature**: For implementation after task brief creation
161
+ - **Code Review**: For reviewing completed implementation