@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.
- package/.claude-plugin/plugin.json +43 -0
- package/agents/bulwark-fix-validator.md +633 -0
- package/agents/bulwark-implementer.md +391 -0
- package/agents/bulwark-issue-analyzer.md +308 -0
- package/agents/bulwark-standards-reviewer.md +221 -0
- package/agents/plan-creation-architect.md +323 -0
- package/agents/plan-creation-eng-lead.md +352 -0
- package/agents/plan-creation-po.md +300 -0
- package/agents/plan-creation-qa-critic.md +334 -0
- package/agents/product-ideation-competitive-analyzer.md +298 -0
- package/agents/product-ideation-idea-validator.md +268 -0
- package/agents/product-ideation-market-researcher.md +292 -0
- package/agents/product-ideation-pattern-documenter.md +308 -0
- package/agents/product-ideation-segment-analyzer.md +303 -0
- package/agents/product-ideation-strategist.md +259 -0
- package/agents/statusline-setup.md +97 -0
- package/hooks/hooks.json +59 -0
- package/package.json +45 -0
- package/scripts/hooks/cleanup-stale.sh +13 -0
- package/scripts/hooks/enforce-quality.sh +166 -0
- package/scripts/hooks/implementer-quality.sh +256 -0
- package/scripts/hooks/inject-protocol.sh +52 -0
- package/scripts/hooks/suggest-pipeline.sh +175 -0
- package/scripts/hooks/track-pipeline-start.sh +37 -0
- package/scripts/hooks/track-pipeline-stop.sh +52 -0
- package/scripts/init-rules.sh +35 -0
- package/scripts/init.sh +151 -0
- package/skills/anthropic-validator/SKILL.md +607 -0
- package/skills/anthropic-validator/references/agents-checklist.md +131 -0
- package/skills/anthropic-validator/references/commands-checklist.md +102 -0
- package/skills/anthropic-validator/references/hooks-checklist.md +151 -0
- package/skills/anthropic-validator/references/mcp-checklist.md +136 -0
- package/skills/anthropic-validator/references/plugins-checklist.md +148 -0
- package/skills/anthropic-validator/references/skills-checklist.md +85 -0
- package/skills/assertion-patterns/SKILL.md +296 -0
- package/skills/bug-magnet-data/SKILL.md +284 -0
- package/skills/bug-magnet-data/context/cli-args.md +91 -0
- package/skills/bug-magnet-data/context/db-query.md +104 -0
- package/skills/bug-magnet-data/context/file-contents.md +103 -0
- package/skills/bug-magnet-data/context/http-body.md +91 -0
- package/skills/bug-magnet-data/context/process-spawn.md +123 -0
- package/skills/bug-magnet-data/data/booleans/boundaries.yaml +143 -0
- package/skills/bug-magnet-data/data/collections/arrays.yaml +114 -0
- package/skills/bug-magnet-data/data/collections/objects.yaml +123 -0
- package/skills/bug-magnet-data/data/concurrency/race-conditions.yaml +118 -0
- package/skills/bug-magnet-data/data/concurrency/state-machines.yaml +115 -0
- package/skills/bug-magnet-data/data/dates/boundaries.yaml +137 -0
- package/skills/bug-magnet-data/data/dates/invalid.yaml +132 -0
- package/skills/bug-magnet-data/data/dates/timezone.yaml +118 -0
- package/skills/bug-magnet-data/data/encoding/charset.yaml +79 -0
- package/skills/bug-magnet-data/data/encoding/normalization.yaml +105 -0
- package/skills/bug-magnet-data/data/formats/email.yaml +154 -0
- package/skills/bug-magnet-data/data/formats/json.yaml +187 -0
- package/skills/bug-magnet-data/data/formats/url.yaml +165 -0
- package/skills/bug-magnet-data/data/language-specific/javascript.yaml +182 -0
- package/skills/bug-magnet-data/data/language-specific/python.yaml +174 -0
- package/skills/bug-magnet-data/data/language-specific/rust.yaml +148 -0
- package/skills/bug-magnet-data/data/numbers/boundaries.yaml +161 -0
- package/skills/bug-magnet-data/data/numbers/precision.yaml +89 -0
- package/skills/bug-magnet-data/data/numbers/special.yaml +69 -0
- package/skills/bug-magnet-data/data/strings/boundaries.yaml +109 -0
- package/skills/bug-magnet-data/data/strings/injection.yaml +208 -0
- package/skills/bug-magnet-data/data/strings/special-chars.yaml +190 -0
- package/skills/bug-magnet-data/data/strings/unicode.yaml +139 -0
- package/skills/bug-magnet-data/references/external-lists.md +115 -0
- package/skills/bulwark-brainstorm/SKILL.md +563 -0
- package/skills/bulwark-brainstorm/references/at-teammate-prompts.md +60 -0
- package/skills/bulwark-brainstorm/references/role-critical-analyst.md +78 -0
- package/skills/bulwark-brainstorm/references/role-development-lead.md +66 -0
- package/skills/bulwark-brainstorm/references/role-product-delivery-lead.md +79 -0
- package/skills/bulwark-brainstorm/references/role-product-manager.md +62 -0
- package/skills/bulwark-brainstorm/references/role-project-sme.md +59 -0
- package/skills/bulwark-brainstorm/references/role-technical-architect.md +66 -0
- package/skills/bulwark-research/SKILL.md +298 -0
- package/skills/bulwark-research/references/viewpoint-contrarian.md +63 -0
- package/skills/bulwark-research/references/viewpoint-direct-investigation.md +62 -0
- package/skills/bulwark-research/references/viewpoint-first-principles.md +65 -0
- package/skills/bulwark-research/references/viewpoint-practitioner.md +62 -0
- package/skills/bulwark-research/references/viewpoint-prior-art.md +66 -0
- package/skills/bulwark-scaffold/SKILL.md +330 -0
- package/skills/bulwark-statusline/SKILL.md +161 -0
- package/skills/bulwark-statusline/scripts/statusline.sh +144 -0
- package/skills/bulwark-verify/SKILL.md +519 -0
- package/skills/code-review/SKILL.md +428 -0
- package/skills/code-review/examples/anti-patterns/linting.ts +181 -0
- package/skills/code-review/examples/anti-patterns/security.ts +91 -0
- package/skills/code-review/examples/anti-patterns/standards.ts +195 -0
- package/skills/code-review/examples/anti-patterns/type-safety.ts +108 -0
- package/skills/code-review/examples/recommended/linting.ts +195 -0
- package/skills/code-review/examples/recommended/security.ts +154 -0
- package/skills/code-review/examples/recommended/standards.ts +231 -0
- package/skills/code-review/examples/recommended/type-safety.ts +181 -0
- package/skills/code-review/frameworks/angular.md +218 -0
- package/skills/code-review/frameworks/django.md +235 -0
- package/skills/code-review/frameworks/express.md +207 -0
- package/skills/code-review/frameworks/flask.md +298 -0
- package/skills/code-review/frameworks/generic.md +146 -0
- package/skills/code-review/frameworks/react.md +152 -0
- package/skills/code-review/frameworks/vue.md +244 -0
- package/skills/code-review/references/linting-patterns.md +221 -0
- package/skills/code-review/references/security-patterns.md +125 -0
- package/skills/code-review/references/standards-patterns.md +246 -0
- package/skills/code-review/references/type-safety-patterns.md +130 -0
- package/skills/component-patterns/SKILL.md +131 -0
- package/skills/component-patterns/references/pattern-cli-command.md +118 -0
- package/skills/component-patterns/references/pattern-database.md +166 -0
- package/skills/component-patterns/references/pattern-external-api.md +139 -0
- package/skills/component-patterns/references/pattern-file-parser.md +168 -0
- package/skills/component-patterns/references/pattern-http-server.md +162 -0
- package/skills/component-patterns/references/pattern-process-spawner.md +133 -0
- package/skills/continuous-feedback/SKILL.md +327 -0
- package/skills/continuous-feedback/references/collect-instructions.md +81 -0
- package/skills/continuous-feedback/references/specialize-code-review.md +82 -0
- package/skills/continuous-feedback/references/specialize-general.md +98 -0
- package/skills/continuous-feedback/references/specialize-test-audit.md +81 -0
- package/skills/create-skill/SKILL.md +359 -0
- package/skills/create-skill/references/agent-conventions.md +194 -0
- package/skills/create-skill/references/agent-template.md +195 -0
- package/skills/create-skill/references/content-guidance.md +291 -0
- package/skills/create-skill/references/decision-framework.md +124 -0
- package/skills/create-skill/references/template-pipeline.md +217 -0
- package/skills/create-skill/references/template-reference-heavy.md +111 -0
- package/skills/create-skill/references/template-research.md +210 -0
- package/skills/create-skill/references/template-script-driven.md +172 -0
- package/skills/create-skill/references/template-simple.md +80 -0
- package/skills/create-subagent/SKILL.md +353 -0
- package/skills/create-subagent/references/agent-conventions.md +268 -0
- package/skills/create-subagent/references/content-guidance.md +232 -0
- package/skills/create-subagent/references/decision-framework.md +134 -0
- package/skills/create-subagent/references/template-single-agent.md +192 -0
- package/skills/fix-bug/SKILL.md +241 -0
- package/skills/governance-protocol/SKILL.md +116 -0
- package/skills/init/SKILL.md +341 -0
- package/skills/issue-debugging/SKILL.md +385 -0
- package/skills/issue-debugging/references/anti-patterns.md +245 -0
- package/skills/issue-debugging/references/debug-report-schema.md +227 -0
- package/skills/mock-detection/SKILL.md +511 -0
- package/skills/mock-detection/references/false-positive-prevention.md +402 -0
- package/skills/mock-detection/references/stub-patterns.md +236 -0
- package/skills/pipeline-templates/SKILL.md +215 -0
- package/skills/pipeline-templates/references/code-change-workflow.md +277 -0
- package/skills/pipeline-templates/references/code-review.md +336 -0
- package/skills/pipeline-templates/references/fix-validation.md +421 -0
- package/skills/pipeline-templates/references/new-feature.md +335 -0
- package/skills/pipeline-templates/references/research-brainstorm.md +161 -0
- package/skills/pipeline-templates/references/research-planning.md +257 -0
- package/skills/pipeline-templates/references/test-audit.md +389 -0
- package/skills/pipeline-templates/references/test-execution-fix.md +238 -0
- package/skills/plan-creation/SKILL.md +497 -0
- package/skills/product-ideation/SKILL.md +372 -0
- package/skills/product-ideation/references/analysis-frameworks.md +161 -0
- package/skills/session-handoff/SKILL.md +139 -0
- package/skills/session-handoff/references/examples.md +223 -0
- package/skills/setup-lsp/SKILL.md +312 -0
- package/skills/setup-lsp/references/server-registry.md +85 -0
- package/skills/setup-lsp/references/troubleshooting.md +135 -0
- package/skills/subagent-output-templating/SKILL.md +415 -0
- package/skills/subagent-output-templating/references/examples.md +440 -0
- package/skills/subagent-prompting/SKILL.md +364 -0
- package/skills/subagent-prompting/references/examples.md +342 -0
- package/skills/test-audit/SKILL.md +531 -0
- package/skills/test-audit/references/known-limitations.md +41 -0
- package/skills/test-audit/references/priority-classification.md +30 -0
- package/skills/test-audit/references/prompts/deep-mode-detection.md +83 -0
- package/skills/test-audit/references/prompts/synthesis.md +57 -0
- package/skills/test-audit/references/rewrite-instructions.md +46 -0
- package/skills/test-audit/references/schemas/audit-output.yaml +100 -0
- package/skills/test-audit/references/schemas/diagnostic-output.yaml +49 -0
- package/skills/test-audit/scripts/data-flow-analyzer.ts +509 -0
- package/skills/test-audit/scripts/integration-mock-detector.ts +462 -0
- package/skills/test-audit/scripts/package.json +20 -0
- package/skills/test-audit/scripts/skip-detector.ts +211 -0
- package/skills/test-audit/scripts/verification-counter.ts +295 -0
- package/skills/test-classification/SKILL.md +310 -0
- package/skills/test-fixture-creation/SKILL.md +295 -0
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pipeline-templates
|
|
3
|
+
description: Pre-defined F# pipe workflows for multi-agent orchestration. Provides code review, fix validation, test audit, new feature, research & planning, and test execution pipelines. Triggered via PostToolUse hook after significant code changes.
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Pipeline Templates
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
This skill provides pre-defined F# pipe workflows for common multi-agent scenarios. Pipelines ensure:
|
|
12
|
+
|
|
13
|
+
- **Deterministic orchestration**: Consistent agent sequencing
|
|
14
|
+
- **Hard validation**: Block incorrect pipeline usage
|
|
15
|
+
- **Progress tracking**: Log all pipeline stages
|
|
16
|
+
- **Model optimization**: Right model for each stage
|
|
17
|
+
|
|
18
|
+
**When to use**: Multi-agent work requiring more than simple exploration.
|
|
19
|
+
|
|
20
|
+
**When NOT to use**: Single-agent tasks (explore, search, lookup) bypass pipeline validation automatically.
|
|
21
|
+
|
|
22
|
+
## Pipeline Selection Guide
|
|
23
|
+
|
|
24
|
+
Choose the appropriate pipeline based on your task:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
Is this a multi-agent task?
|
|
28
|
+
├─ No → No pipeline needed (single-agent bypass)
|
|
29
|
+
└─ Yes → What type of work?
|
|
30
|
+
├─ Reviewing existing code → Code Review Pipeline
|
|
31
|
+
├─ Fixing a bug/issue → Fix Validation Pipeline
|
|
32
|
+
├─ Auditing test quality → Test Audit Pipeline
|
|
33
|
+
├─ Implementing new functionality → New Feature Pipeline
|
|
34
|
+
├─ Research before implementation → Research & Planning Pipeline
|
|
35
|
+
└─ Running tests and fixing failures → Test Execution & Fix Pipeline
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Available Pipelines
|
|
39
|
+
|
|
40
|
+
| Pipeline | Use Case | Model Pattern | Reference |
|
|
41
|
+
|----------|----------|---------------|-----------|
|
|
42
|
+
| Code Review | PR review, code audit | Sonnet (role-based, 4 sections) | `references/code-review.md` |
|
|
43
|
+
| Fix Validation | Bug fixes, issue resolution | Sonnet (analyze) → Opus (fix) → Sonnet (validate) → Sonnet (review) | `references/fix-validation.md` |
|
|
44
|
+
| Test Audit | Test quality assessment | Haiku (classify) → Sonnet (detect) → Sonnet (audit) | `references/test-audit.md` |
|
|
45
|
+
| New Feature | Feature implementation | Haiku (research) → Opus (write) → Sonnet (review) | `references/new-feature.md` |
|
|
46
|
+
| Research & Planning | Pre-implementation research | Haiku (lookup) → Sonnet (review) → loop(min=3) | `references/research-planning.md` |
|
|
47
|
+
| Test Execution & Fix | Run tests, fix failures | Haiku (execute) → Sonnet (analyze) → Opus (fix) | `references/test-execution-fix.md` |
|
|
48
|
+
| **Code Change Workflow** | **Full automation after code edit** | **Composite: chains multiple pipelines** | `references/code-change-workflow.md` |
|
|
49
|
+
|
|
50
|
+
### Pipeline Architecture Notes
|
|
51
|
+
|
|
52
|
+
**Role-Based Agents**: Code Review pipeline uses general-purpose sub-agents with specific roles. Each agent loads the `code-review` skill and references a specific section (Security, Type Safety, Linting, Coding Standards).
|
|
53
|
+
|
|
54
|
+
**Custom Sub-Agents**: Fix Validation pipeline uses custom sub-agents (`bulwark-issue-analyzer`, `bulwark-fix-validator`) that encapsulate stage behavior and load relevant skills via frontmatter.
|
|
55
|
+
|
|
56
|
+
**Code-Writing Agent**: Fix Validation and New Feature pipelines use `bulwark-implementer` (custom sub-agent, Opus) for code-writing stages with built-in quality enforcement.
|
|
57
|
+
|
|
58
|
+
## Model Selection
|
|
59
|
+
|
|
60
|
+
Reference `subagent-prompting` skill for the task-type rubric:
|
|
61
|
+
|
|
62
|
+
| Task Type | Model | Examples |
|
|
63
|
+
|-----------|-------|----------|
|
|
64
|
+
| **Lookups & Execute** | Haiku | Web fetch, run tests, file search, lint |
|
|
65
|
+
| **Review & Analyze** | Sonnet | Code review, failure analysis, audits |
|
|
66
|
+
| **Write & Fix** | Opus | Write code, write tests, apply fixes |
|
|
67
|
+
|
|
68
|
+
**Override rule**: If a custom agent specifies `model:` in frontmatter, use that model instead.
|
|
69
|
+
|
|
70
|
+
## Validation Rules
|
|
71
|
+
|
|
72
|
+
### Valid Pipeline Invocation
|
|
73
|
+
|
|
74
|
+
A pipeline invocation is valid when:
|
|
75
|
+
|
|
76
|
+
1. Uses a defined pipeline template from this skill
|
|
77
|
+
2. Specifies model for each stage (or uses default from task-type rubric)
|
|
78
|
+
3. Includes 4-part prompt for each Task (GOAL/CONSTRAINTS/CONTEXT/OUTPUT)
|
|
79
|
+
4. Reads previous stage output before invoking next stage
|
|
80
|
+
|
|
81
|
+
### Invalid Invocation (Warning/Block)
|
|
82
|
+
|
|
83
|
+
The following patterns trigger validation warnings:
|
|
84
|
+
|
|
85
|
+
| Pattern | Issue | Resolution |
|
|
86
|
+
|---------|-------|------------|
|
|
87
|
+
| Ad-hoc multi-agent with no pipeline | Unpredictable orchestration | Choose appropriate pipeline |
|
|
88
|
+
| Missing model specification | May use wrong model | Specify model or use rubric |
|
|
89
|
+
| Skipping stages without justification | Incomplete workflow | Document skip reason |
|
|
90
|
+
| Using Opus for simple tasks | Wasteful | Use Haiku for lookups |
|
|
91
|
+
|
|
92
|
+
### Hook Behavior (PostToolUse)
|
|
93
|
+
|
|
94
|
+
The PostToolUse hook on Write|Edit:
|
|
95
|
+
- **Skips silently**: Small changes below threshold
|
|
96
|
+
- **Suggests pipeline**: Significant changes inject `additionalContext` with pipeline recommendation
|
|
97
|
+
- **Blocks**: Never (suggestion only, not blocking)
|
|
98
|
+
|
|
99
|
+
## File Type to Pipeline Mapping
|
|
100
|
+
|
|
101
|
+
When triggered by PostToolUse hook after Write/Edit, select pipeline based on file modified:
|
|
102
|
+
|
|
103
|
+
| File Pattern | Extension | Recommended Pipeline |
|
|
104
|
+
|--------------|-----------|---------------------|
|
|
105
|
+
| Code files | `.ts`, `.js`, `.py`, `.go`, `.rs`, `.java` | Code Review |
|
|
106
|
+
| Test files | `*.test.ts`, `*.spec.js`, `test_*.py` | Test Audit |
|
|
107
|
+
| Config files | `.json`, `.yaml`, `.toml`, `.env` | Code Review (security focus) |
|
|
108
|
+
| Script files | `.sh`, `.bash`, `.ps1` | Code Review (security focus) |
|
|
109
|
+
| Documentation | `.md`, `.txt`, `.rst` | Light review or skip |
|
|
110
|
+
| Data files | `.xlsx`, `.csv`, `.pdf` | Manual review suggested |
|
|
111
|
+
|
|
112
|
+
### Small Change Bypass
|
|
113
|
+
|
|
114
|
+
Skip pipeline for small changes (threshold by file type):
|
|
115
|
+
|
|
116
|
+
| File Type | Threshold | Rationale |
|
|
117
|
+
|-----------|-----------|-----------|
|
|
118
|
+
| Code | < 5 lines | Minor fixes don't need full review |
|
|
119
|
+
| Tests | < 10 lines | Single test additions are low risk |
|
|
120
|
+
| Config | < 3 lines | Single value changes are quick to verify |
|
|
121
|
+
| Documentation | <= 10 lines | Typo fixes and small updates |
|
|
122
|
+
| Scripts | < 3 lines | Security-sensitive, low threshold |
|
|
123
|
+
| Data | Any change | Always significant, suggest review |
|
|
124
|
+
|
|
125
|
+
Changes at or below threshold are skipped silently. Changes above threshold trigger pipeline suggestion.
|
|
126
|
+
|
|
127
|
+
## Pipeline Execution Pattern
|
|
128
|
+
|
|
129
|
+
All pipelines follow this execution pattern:
|
|
130
|
+
|
|
131
|
+
```fsharp
|
|
132
|
+
// F# pipe syntax for workflow orchestration
|
|
133
|
+
|
|
134
|
+
// Sequential execution (each stage reads previous stage's output)
|
|
135
|
+
Stage1 (task) // First agent runs
|
|
136
|
+
|> Stage2 (task) // Reads Stage1 output, runs
|
|
137
|
+
|> Stage3 (task) // Reads Stage2 output, runs
|
|
138
|
+
|> (if condition // Conditional branching
|
|
139
|
+
then StageA
|
|
140
|
+
else StageB)
|
|
141
|
+
|> LOOP(max=N) // Optional iteration
|
|
142
|
+
|
|
143
|
+
// Parallel execution (agents run concurrently, results merged)
|
|
144
|
+
[Stage1a, Stage1b, Stage1c] // Array notation = parallel
|
|
145
|
+
|> Stage2 (reads all Stage1 outputs)
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Key principles**:
|
|
149
|
+
- **Sequential** (`|>`): Each stage reads the previous stage's log output
|
|
150
|
+
- **Parallel** (`[]`): Stages in array notation run concurrently via multiple Task calls in a single message
|
|
151
|
+
- Conditional branches based on stage results
|
|
152
|
+
- Loops have explicit iteration limits
|
|
153
|
+
- All output logged to `logs/`
|
|
154
|
+
|
|
155
|
+
## Progress Tracking
|
|
156
|
+
|
|
157
|
+
Pipeline progress is tracked via hooks:
|
|
158
|
+
|
|
159
|
+
| Event | Hook | Log Entry |
|
|
160
|
+
|-------|------|-----------|
|
|
161
|
+
| Stage start | SubagentStart | `[timestamp] SubagentStart: agent_id (type)` |
|
|
162
|
+
| Stage end | SubagentStop | `[timestamp] SubagentStop: agent_id` |
|
|
163
|
+
|
|
164
|
+
Logs written to: `logs/pipeline-tracking.log`
|
|
165
|
+
|
|
166
|
+
## Related Skills
|
|
167
|
+
|
|
168
|
+
| Skill | Relationship |
|
|
169
|
+
|-------|--------------|
|
|
170
|
+
| `subagent-prompting` | 4-part template, model selection rubric |
|
|
171
|
+
| `subagent-output-templating` | Output format for pipeline stages |
|
|
172
|
+
|
|
173
|
+
## Quick Reference
|
|
174
|
+
|
|
175
|
+
```fsharp
|
|
176
|
+
// Code Review (role-based agents, parallel execution)
|
|
177
|
+
[SecurityReviewer (section: Security), // Sonnet - role-based
|
|
178
|
+
TypeSafetyReviewer (section: Type Safety), // Sonnet - role-based
|
|
179
|
+
LintReviewer (section: Linting), // Sonnet - role-based
|
|
180
|
+
StandardsReviewer (section: Coding Standards)] // Sonnet - role-based
|
|
181
|
+
|> ReviewSynthesizer (consolidates all findings)
|
|
182
|
+
|> (if critical_issues then FixWriter else Done)
|
|
183
|
+
|
|
184
|
+
// Fix Validation (custom sub-agents)
|
|
185
|
+
IssueAnalyzer (bulwark-issue-analyzer, produces debug_report)
|
|
186
|
+
|> FixWriter (bulwark-implementer, implements fix)
|
|
187
|
+
|> (if !tests_cover_scenario // Only if tests don't exist
|
|
188
|
+
then TestWriter |> TestAudit (mock-detection only) // Audit generated tests for T1-T4
|
|
189
|
+
else TestAudit (if FixWriter wrote tests)) // Audit implementer tests for T1-T4
|
|
190
|
+
|> FixValidator (bulwark-fix-validator, validates against debug_report)
|
|
191
|
+
|> CodeReviewer (reviews all, approves/rejects)
|
|
192
|
+
|> (if !approved then IssueAnalyzer else Done)
|
|
193
|
+
|> LOOP(max=3)
|
|
194
|
+
|
|
195
|
+
// Test Audit (Main Context Orchestration - skill-based)
|
|
196
|
+
TestClassifier |> MockDetector |> AuditSynthesizer
|
|
197
|
+
|> (if REWRITE_REQUIRED then TestRewriter else Done)
|
|
198
|
+
|> LOOP(max=2)
|
|
199
|
+
|
|
200
|
+
// New Feature
|
|
201
|
+
Researcher |> Architect |> Implementer (bulwark-implementer) |> TestWriter |> TestAudit |> CodeReviewer
|
|
202
|
+
|
|
203
|
+
// Research & Planning (min 3 iterations)
|
|
204
|
+
Researcher |> PlanDraft |> PlanReviewer |> LOOP(min=3)
|
|
205
|
+
|
|
206
|
+
// Test Execution & Fix (orchestrator fixes, PostToolUse hook enforces quality)
|
|
207
|
+
TestRunner |> (if failures then FailureAnalyzer |> FixWriter (orchestrator) |> LOOP else Done)
|
|
208
|
+
|
|
209
|
+
// CODE CHANGE WORKFLOW (Composite - chains pipelines after code edit)
|
|
210
|
+
// See references/code-change-workflow.md for full details
|
|
211
|
+
CodeReviewPipeline
|
|
212
|
+
|> TestAuditPipeline (Main Context Orchestration)
|
|
213
|
+
|> TestExecutionPipeline
|
|
214
|
+
|> (if code_bugs then FixValidationPipeline else Done)
|
|
215
|
+
```
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# Code Change Workflow (Composite Pipeline)
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Full automation after code file creation or edit. Chains multiple pipelines to ensure:
|
|
6
|
+
- Code quality (review)
|
|
7
|
+
- Test coverage and quality (audit)
|
|
8
|
+
- Test execution (verification)
|
|
9
|
+
- Issue resolution (fix validation loop)
|
|
10
|
+
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
- After creating or editing code files (`.ts`, `.js`, `.py`, `.go`, `.rs`, `.java`)
|
|
14
|
+
- PostToolUse hook suggests this workflow for significant code changes
|
|
15
|
+
- Manual invocation when comprehensive quality assurance needed
|
|
16
|
+
|
|
17
|
+
## Entry Points
|
|
18
|
+
|
|
19
|
+
| Trigger | How |
|
|
20
|
+
|---------|-----|
|
|
21
|
+
| PostToolUse hook | Automatic suggestion after Write/Edit on code files above threshold |
|
|
22
|
+
| Manual | "Run code change workflow on [files]" |
|
|
23
|
+
| After feature implementation | Chain from New Feature pipeline |
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Composite Pipeline Definition
|
|
28
|
+
|
|
29
|
+
```fsharp
|
|
30
|
+
// CODE CHANGE WORKFLOW
|
|
31
|
+
// Trigger: Code file created or significantly edited
|
|
32
|
+
// Output: Reviewed, tested, validated code
|
|
33
|
+
|
|
34
|
+
// PHASE 1: Code Review (if code-review skill available)
|
|
35
|
+
CodeReviewPipeline (optional, requires P4.1)
|
|
36
|
+
|> (if critical_issues then FixWriter else Continue)
|
|
37
|
+
|
|
38
|
+
// PHASE 2: Test Audit (Main Context Orchestration)
|
|
39
|
+
// Orchestrator loads test-audit skill, follows instructions
|
|
40
|
+
TestClassifier (Haiku, surface classification)
|
|
41
|
+
|> MockDetector (Sonnet, T1-T4 violations)
|
|
42
|
+
|> AuditSynthesizer (Sonnet, REWRITE_REQUIRED directive)
|
|
43
|
+
|> (if REWRITE_REQUIRED then TestRewriter(Opus) else Continue)
|
|
44
|
+
|> LOOP(max=2)
|
|
45
|
+
|
|
46
|
+
// PHASE 3: Test Execution
|
|
47
|
+
TestRunner (Haiku, execute tests)
|
|
48
|
+
|> (if failures > 0
|
|
49
|
+
then FailureAnalyzer (Sonnet)
|
|
50
|
+
|> (if test_issue then TestFixWriter(Opus) else CodeBugDetected)
|
|
51
|
+
else Continue)
|
|
52
|
+
|> LOOP(max=3)
|
|
53
|
+
|
|
54
|
+
// PHASE 4: Fix Validation (if code bugs detected)
|
|
55
|
+
(if CodeBugDetected
|
|
56
|
+
then IssueAnalyzer (bulwark-issue-analyzer)
|
|
57
|
+
|> FixWriter (Opus)
|
|
58
|
+
|> TestWriter (Opus)
|
|
59
|
+
|> FixValidator (bulwark-fix-validator)
|
|
60
|
+
|> CodeReviewer (Sonnet)
|
|
61
|
+
|> (if !approved then IssueAnalyzer else Done)
|
|
62
|
+
|> LOOP(max=3)
|
|
63
|
+
else Done)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Phase Details
|
|
69
|
+
|
|
70
|
+
### Phase 1: Code Review (Optional)
|
|
71
|
+
|
|
72
|
+
**Dependency**: Requires `code-review` skill (P4.1)
|
|
73
|
+
|
|
74
|
+
**Skip Condition**: If code-review skill not available, proceed to Phase 2
|
|
75
|
+
|
|
76
|
+
**Stages**:
|
|
77
|
+
1. SecurityReviewer (Sonnet) - OWASP patterns
|
|
78
|
+
2. TypeSafetyReviewer (Sonnet) - any, null, unsafe assertions
|
|
79
|
+
3. LintReviewer (Sonnet) - complexity, formatting
|
|
80
|
+
4. StandardsReviewer (Sonnet) - naming, patterns
|
|
81
|
+
5. ReviewSynthesizer (Sonnet) - consolidate findings
|
|
82
|
+
6. FixWriter (Opus) - fix critical/high issues if any
|
|
83
|
+
|
|
84
|
+
**Output**: Review findings, fixes applied if critical
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
### Phase 2: Test Audit (Main Context Orchestration)
|
|
89
|
+
|
|
90
|
+
**Pattern**: Orchestrator loads `test-audit` skill and follows its instructions directly. No wrapper agent needed.
|
|
91
|
+
|
|
92
|
+
**Why Main Context Orchestration?**
|
|
93
|
+
- Test audit requires 3-stage pipeline (classification → detection → synthesis)
|
|
94
|
+
- Sub-agents cannot spawn other sub-agents
|
|
95
|
+
- Orchestrator must stay in main context to spawn each stage
|
|
96
|
+
|
|
97
|
+
**Stages**:
|
|
98
|
+
1. Load `test-audit` skill
|
|
99
|
+
2. Follow skill instructions to spawn:
|
|
100
|
+
- TestClassifier (Haiku) → `logs/test-classification-{YYYYMMDD-HHMMSS}.yaml`
|
|
101
|
+
- MockDetector (Sonnet) → `logs/mock-detection-{YYYYMMDD-HHMMSS}.yaml`
|
|
102
|
+
- AuditSynthesizer (Sonnet) → `logs/test-audit-{YYYYMMDD-HHMMSS}.yaml`
|
|
103
|
+
3. Read `REWRITE_REQUIRED` directive from audit output
|
|
104
|
+
4. If true: Orchestrator (Opus) rewrites flagged tests
|
|
105
|
+
5. Loop up to 2 times to verify rewrites resolved issues
|
|
106
|
+
|
|
107
|
+
**Output**: Test audit report, tests rewritten if needed
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
### Phase 3: Test Execution
|
|
112
|
+
|
|
113
|
+
**Purpose**: Run tests and fix test-related failures
|
|
114
|
+
|
|
115
|
+
**Stages**:
|
|
116
|
+
1. TestRunner (Haiku) - Execute `just test` or equivalent
|
|
117
|
+
2. If failures:
|
|
118
|
+
- FailureAnalyzer (Sonnet) - Categorize failures
|
|
119
|
+
- Determine: Is this a test issue or code bug?
|
|
120
|
+
- If test issue: TestFixWriter (Opus) fixes test
|
|
121
|
+
- If code bug: Flag for Phase 4
|
|
122
|
+
3. Re-run tests to verify
|
|
123
|
+
4. Loop up to 3 times
|
|
124
|
+
|
|
125
|
+
**Failure Categories**:
|
|
126
|
+
| Category | Resolution |
|
|
127
|
+
|----------|------------|
|
|
128
|
+
| Environment | Fix test setup (ports, deps) |
|
|
129
|
+
| Assertion | Update test or fix test logic |
|
|
130
|
+
| Timeout | Increase timeout or optimize |
|
|
131
|
+
| Flaky | Fix race condition |
|
|
132
|
+
| **Code Bug** | Escalate to Phase 4 |
|
|
133
|
+
|
|
134
|
+
**Output**: Passing tests OR code bugs identified for Phase 4
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
### Phase 4: Fix Validation (Conditional)
|
|
139
|
+
|
|
140
|
+
**Trigger**: Only runs if Phase 3 detected code bugs (not test issues)
|
|
141
|
+
|
|
142
|
+
**Agents Required**:
|
|
143
|
+
- `bulwark-issue-analyzer` (P1.2) - Root cause analysis
|
|
144
|
+
- `bulwark-fix-validator` (P1.3) - Validation against debug report
|
|
145
|
+
|
|
146
|
+
**Stages**:
|
|
147
|
+
1. IssueAnalyzer (bulwark-issue-analyzer, Sonnet)
|
|
148
|
+
- Produces debug report at `logs/debug-reports/{issue-id}.yaml`
|
|
149
|
+
- Includes validation plan (P1/P2/P3 tiered tests)
|
|
150
|
+
2. FixWriter (Opus) - Implement fix per root cause
|
|
151
|
+
3. TestWriter (Opus) - Add tests per validation plan
|
|
152
|
+
4. FixValidator (bulwark-fix-validator, Sonnet)
|
|
153
|
+
- Execute validation plan
|
|
154
|
+
- Assess confidence (high/medium/low)
|
|
155
|
+
- Escalate to manual testing if needed
|
|
156
|
+
5. CodeReviewer (Sonnet) - Approve/reject fix
|
|
157
|
+
6. Loop if not approved (max 3 iterations)
|
|
158
|
+
|
|
159
|
+
**Output**: Verified fix with confidence assessment
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Orchestrator Execution Flow
|
|
164
|
+
|
|
165
|
+
```markdown
|
|
166
|
+
## Step 1: Determine Entry Point
|
|
167
|
+
- Hook-triggered: additionalContext suggests workflow
|
|
168
|
+
- Manual: User requests comprehensive review
|
|
169
|
+
|
|
170
|
+
## Step 2: Phase 1 - Code Review (if available)
|
|
171
|
+
IF code-review skill exists:
|
|
172
|
+
Load code-review skill
|
|
173
|
+
Execute Code Review Pipeline stages
|
|
174
|
+
Apply fixes for critical/high issues
|
|
175
|
+
ELSE:
|
|
176
|
+
Skip to Phase 2
|
|
177
|
+
|
|
178
|
+
## Step 3: Phase 2 - Test Audit
|
|
179
|
+
Load test-audit skill
|
|
180
|
+
Follow Main Context Orchestration instructions:
|
|
181
|
+
- Spawn TestClassifier (Haiku)
|
|
182
|
+
- Read classification, spawn MockDetector (Sonnet)
|
|
183
|
+
- Read violations, spawn AuditSynthesizer (Sonnet)
|
|
184
|
+
- Read REWRITE_REQUIRED directive
|
|
185
|
+
IF REWRITE_REQUIRED:
|
|
186
|
+
Rewrite flagged tests (Opus)
|
|
187
|
+
Loop (max 2)
|
|
188
|
+
|
|
189
|
+
## Step 4: Phase 3 - Test Execution
|
|
190
|
+
Spawn TestRunner (Haiku)
|
|
191
|
+
IF failures:
|
|
192
|
+
Spawn FailureAnalyzer (Sonnet)
|
|
193
|
+
IF test_issue:
|
|
194
|
+
Fix test (Opus)
|
|
195
|
+
Re-run (loop max 3)
|
|
196
|
+
ELSE:
|
|
197
|
+
Mark CodeBugDetected
|
|
198
|
+
|
|
199
|
+
## Step 5: Phase 4 - Fix Validation (if needed)
|
|
200
|
+
IF CodeBugDetected:
|
|
201
|
+
Spawn IssueAnalyzer (bulwark-issue-analyzer)
|
|
202
|
+
Read debug report
|
|
203
|
+
Implement fix (Opus)
|
|
204
|
+
Write tests (Opus)
|
|
205
|
+
Spawn FixValidator (bulwark-fix-validator)
|
|
206
|
+
Read validation results
|
|
207
|
+
Spawn CodeReviewer (Sonnet)
|
|
208
|
+
IF !approved: Loop (max 3)
|
|
209
|
+
|
|
210
|
+
## Step 6: Report Completion
|
|
211
|
+
Summarize all phases:
|
|
212
|
+
- Code review findings (if run)
|
|
213
|
+
- Test audit results
|
|
214
|
+
- Test execution status
|
|
215
|
+
- Fix validation outcome (if run)
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Dependency Status
|
|
221
|
+
|
|
222
|
+
| Phase | Dependencies | Status |
|
|
223
|
+
|-------|--------------|--------|
|
|
224
|
+
| Phase 1 | code-review skill (P4.1) | Not yet built |
|
|
225
|
+
| Phase 2 | test-audit skill (P0.8) | **Complete** |
|
|
226
|
+
| Phase 3 | Test Execution pipeline template | **Complete** |
|
|
227
|
+
| Phase 4 | bulwark-issue-analyzer (P1.2), bulwark-fix-validator (P1.3) | Not yet built |
|
|
228
|
+
|
|
229
|
+
**Current Capability**: Phases 2 and 3 can run today. Phases 1 and 4 require future work.
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## Termination Conditions
|
|
234
|
+
|
|
235
|
+
| Condition | Action |
|
|
236
|
+
|-----------|--------|
|
|
237
|
+
| All phases complete, no issues | Workflow done |
|
|
238
|
+
| Phase 2 loop exceeds max=2 | Report remaining audit issues, continue |
|
|
239
|
+
| Phase 3 loop exceeds max=3 | Report unfixable test failures, escalate |
|
|
240
|
+
| Phase 4 loop exceeds max=3 | Report unresolved code bug, escalate to manual |
|
|
241
|
+
| Manual testing required | Notify user, workflow pauses |
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## User Communication
|
|
246
|
+
|
|
247
|
+
At key points, the orchestrator should inform the user:
|
|
248
|
+
|
|
249
|
+
```markdown
|
|
250
|
+
## Code Change Workflow Progress
|
|
251
|
+
|
|
252
|
+
**Phase 1 (Code Review)**: [Skipped / Completed - N findings]
|
|
253
|
+
**Phase 2 (Test Audit)**: [Completed - REWRITE_REQUIRED: yes/no]
|
|
254
|
+
**Phase 3 (Test Execution)**: [Completed - N tests passed, M failed]
|
|
255
|
+
**Phase 4 (Fix Validation)**: [Not needed / Completed - confidence: high/medium/low]
|
|
256
|
+
|
|
257
|
+
Overall Status: [Success / Requires Attention]
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Related Pipelines
|
|
263
|
+
|
|
264
|
+
| Pipeline | Relationship |
|
|
265
|
+
|----------|--------------|
|
|
266
|
+
| Code Review | Phase 1 of this workflow |
|
|
267
|
+
| Test Audit | Phase 2 of this workflow (Main Context Orchestration) |
|
|
268
|
+
| Test Execution & Fix | Phase 3 of this workflow |
|
|
269
|
+
| Fix Validation | Phase 4 of this workflow |
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Future Enhancements
|
|
274
|
+
|
|
275
|
+
- **Parallel execution**: Run Code Review and Test Audit in parallel (Phase 1 || Phase 2)
|
|
276
|
+
- **Incremental mode**: Only audit/test files related to the change
|
|
277
|
+
- **CI integration**: Hook into CI/CD for automated workflow trigger
|