@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,192 @@
|
|
|
1
|
+
# Template: Single-Purpose Agent
|
|
2
|
+
|
|
3
|
+
Use this template when the agent performs a single focused task without sub-agent orchestration. Typical for reviewers, analyzers, classifiers, and specialized workers.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## File Output
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
.claude/agents/{agent-name}.md
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Single file — no supporting directories needed.
|
|
14
|
+
|
|
15
|
+
## Generated Agent Structure
|
|
16
|
+
|
|
17
|
+
```markdown
|
|
18
|
+
---
|
|
19
|
+
name: {agent-name}
|
|
20
|
+
description: {single-line, role-based, trigger-specific}
|
|
21
|
+
model: {haiku|sonnet|opus}
|
|
22
|
+
tools:
|
|
23
|
+
- {tool-1}
|
|
24
|
+
- {tool-N}
|
|
25
|
+
skills:
|
|
26
|
+
- subagent-output-templating
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
# {Agent Title}
|
|
30
|
+
|
|
31
|
+
You are a {role description}. Your expertise covers {domain areas}.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Pre-Flight Gate
|
|
36
|
+
|
|
37
|
+
**MANDATORY: Read this section FIRST. These instructions are BINDING, not advisory.**
|
|
38
|
+
|
|
39
|
+
Before doing ANY work, confirm you understand these REQUIRED obligations:
|
|
40
|
+
|
|
41
|
+
1. **REQUIRED**: {obligation 1}
|
|
42
|
+
2. **REQUIRED**: {obligation 2}
|
|
43
|
+
3. **REQUIRED**: Write output to the exact paths specified in Output section
|
|
44
|
+
|
|
45
|
+
Failure to follow these obligations produces non-compliant output.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Your Mission
|
|
50
|
+
|
|
51
|
+
**DO**:
|
|
52
|
+
- {concrete action 1}
|
|
53
|
+
- {concrete action 2}
|
|
54
|
+
- {concrete action 3}
|
|
55
|
+
- Follow existing patterns and conventions in the target codebase
|
|
56
|
+
|
|
57
|
+
**DO NOT**:
|
|
58
|
+
- {specific prohibition 1}
|
|
59
|
+
- {specific prohibition 2}
|
|
60
|
+
- Write files outside the scope of the task
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Invocation
|
|
65
|
+
|
|
66
|
+
This agent is invoked via the **Task tool**:
|
|
67
|
+
|
|
68
|
+
| Method | How to Use |
|
|
69
|
+
|--------|-----------|
|
|
70
|
+
| **Direct** | `Task(subagent_type="{agent-name}", prompt="...")` |
|
|
71
|
+
| **User request** | Ask Claude to "run the {agent-name}" |
|
|
72
|
+
|
|
73
|
+
**Input handling**:
|
|
74
|
+
1. Read task details from the prompt
|
|
75
|
+
2. Parse input for required fields
|
|
76
|
+
3. Validate inputs exist before proceeding
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Protocol
|
|
81
|
+
|
|
82
|
+
### Step 1: Parse Input
|
|
83
|
+
|
|
84
|
+
{What to extract from the invoking prompt.}
|
|
85
|
+
|
|
86
|
+
### Step 2: Read Context
|
|
87
|
+
|
|
88
|
+
{What files/data to read before doing work.}
|
|
89
|
+
|
|
90
|
+
### Step 3: Execute
|
|
91
|
+
|
|
92
|
+
{Core work the agent performs. Describe behavioral approach, not mechanical steps.}
|
|
93
|
+
|
|
94
|
+
### Step 4: Write Output
|
|
95
|
+
|
|
96
|
+
1. Write main report to `$PROJECT_DIR/logs/{agent-name}-{timestamp}.{ext}`
|
|
97
|
+
2. Write diagnostics to `$PROJECT_DIR/logs/diagnostics/{agent-name}-{timestamp}.yaml`
|
|
98
|
+
|
|
99
|
+
### Step 5: Return Summary
|
|
100
|
+
|
|
101
|
+
Return a summary to the invoker (100-300 tokens). Include:
|
|
102
|
+
- What was done
|
|
103
|
+
- Key findings or results
|
|
104
|
+
- Report path
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Tool Usage Constraints
|
|
109
|
+
|
|
110
|
+
### {Tool 1}
|
|
111
|
+
- **Allowed**: {specific allowed uses}
|
|
112
|
+
- **Forbidden**: {specific forbidden uses}
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Output
|
|
117
|
+
|
|
118
|
+
### Main Report
|
|
119
|
+
|
|
120
|
+
**Location**: `$PROJECT_DIR/logs/{agent-name}-{timestamp}.{ext}`
|
|
121
|
+
|
|
122
|
+
{Report format specification.}
|
|
123
|
+
|
|
124
|
+
### Diagnostics
|
|
125
|
+
|
|
126
|
+
**Location**: `$PROJECT_DIR/logs/diagnostics/{agent-name}-{timestamp}.yaml`
|
|
127
|
+
|
|
128
|
+
\`\`\`yaml
|
|
129
|
+
diagnostic:
|
|
130
|
+
agent: {agent-name}
|
|
131
|
+
timestamp: "{ISO-8601}"
|
|
132
|
+
|
|
133
|
+
task:
|
|
134
|
+
description: "{what was requested}"
|
|
135
|
+
input: "{input provided}"
|
|
136
|
+
|
|
137
|
+
execution:
|
|
138
|
+
steps_completed: 0
|
|
139
|
+
findings: 0
|
|
140
|
+
errors: 0
|
|
141
|
+
|
|
142
|
+
output:
|
|
143
|
+
report_path: "$PROJECT_DIR/logs/{agent-name}-{timestamp}.{ext}"
|
|
144
|
+
verdict: "{pass/fail/complete/partial}"
|
|
145
|
+
\`\`\`
|
|
146
|
+
|
|
147
|
+
### Summary (Return to Invoker)
|
|
148
|
+
|
|
149
|
+
**Token budget**: 100-300 tokens
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Permissions Setup
|
|
154
|
+
|
|
155
|
+
This agent requires the following configuration:
|
|
156
|
+
|
|
157
|
+
### Tool Permissions
|
|
158
|
+
|
|
159
|
+
Add to `.claude/settings.json` or `.claude/settings.local.json`:
|
|
160
|
+
|
|
161
|
+
\`\`\`json
|
|
162
|
+
{
|
|
163
|
+
"permissions": {
|
|
164
|
+
"allow": [
|
|
165
|
+
"{tool-1}",
|
|
166
|
+
"{tool-N}"
|
|
167
|
+
]
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
\`\`\`
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Completion Checklist
|
|
175
|
+
|
|
176
|
+
- [ ] All steps executed
|
|
177
|
+
- [ ] Main report written to `$PROJECT_DIR/logs/`
|
|
178
|
+
- [ ] Diagnostic YAML written
|
|
179
|
+
- [ ] Summary returned to invoker
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Guidance for Generator
|
|
183
|
+
|
|
184
|
+
- Write in system-prompt register (WHO the agent IS, not WHAT to do)
|
|
185
|
+
- Open with identity statement: "You are a..."
|
|
186
|
+
- Include Pre-Flight Gate with MUST/MUST NOT (binding language, DEF-P4-005)
|
|
187
|
+
- Include DO/DO NOT mission section
|
|
188
|
+
- Include tool usage constraints for every tool listed in frontmatter
|
|
189
|
+
- Include Permissions Setup section (tool permissions unsolved per #10093)
|
|
190
|
+
- Include diagnostic output section with YAML schema
|
|
191
|
+
- Single-purpose agents are typically 150-250 lines
|
|
192
|
+
- Default model: Sonnet (unless task needs Haiku speed or Opus depth)
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fix-bug
|
|
3
|
+
description: Run the Fix Validation pipeline to investigate, fix, and validate a bug. Ensures deterministic pipeline execution with IssueAnalyzer, FixWriter, TestWriter (conditional), TestAudit (conditional), and FixValidator stages.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Fix Bug Pipeline
|
|
8
|
+
|
|
9
|
+
This skill triggers the **Fix Validation pipeline** to systematically investigate, fix, and validate a bug.
|
|
10
|
+
|
|
11
|
+
## When to Use This Skill
|
|
12
|
+
|
|
13
|
+
**Load this skill when the user request matches ANY of these patterns:**
|
|
14
|
+
|
|
15
|
+
| Trigger Pattern | Example User Request |
|
|
16
|
+
|-----------------|---------------------|
|
|
17
|
+
| Bug fix requests | "Fix this bug", "Something is broken in X" |
|
|
18
|
+
| Error investigation | "Users report errors in X", "This feature isn't working" |
|
|
19
|
+
| Regression fixes | "This used to work", "Breaking after recent changes" |
|
|
20
|
+
| Production issues | "Login fails for new accounts", "API returns 500" |
|
|
21
|
+
| Flaky behavior | "Tests pass sometimes", "Intermittent failures" |
|
|
22
|
+
|
|
23
|
+
**DO NOT use this skill for:**
|
|
24
|
+
|
|
25
|
+
| Anti-Pattern | Use Instead |
|
|
26
|
+
|--------------|-------------|
|
|
27
|
+
| Ad-hoc fixes without investigation | Direct fix (skip pipeline) |
|
|
28
|
+
| Simple typo corrections | Direct edit |
|
|
29
|
+
| Refactoring without reported issues | Code Review pipeline |
|
|
30
|
+
| Adding new features | New Feature pipeline |
|
|
31
|
+
| Performance optimization | Research & Planning pipeline |
|
|
32
|
+
|
|
33
|
+
## Why This Skill Exists
|
|
34
|
+
|
|
35
|
+
Without this skill, conversational prompts like "please investigate and fix this bug" may cause Claude to skip pipeline stages and fix directly. This skill ensures **deterministic execution** of all Fix Validation pipeline stages.
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
/fix-bug <path> [description]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Arguments**:
|
|
44
|
+
- `$1` (required): Path to code with the bug
|
|
45
|
+
- `$2` and beyond (optional): Description of the issue - recommended for better analysis
|
|
46
|
+
|
|
47
|
+
**Examples**:
|
|
48
|
+
```
|
|
49
|
+
/fix-bug src/auth/login.ts "Users report login fails for new accounts"
|
|
50
|
+
/fix-bug tests/fixtures/fix-validator/simple-fix/ "Cannot read property displayName of undefined"
|
|
51
|
+
/fix-bug src/api/routes.ts
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Pipeline Stages
|
|
55
|
+
|
|
56
|
+
When invoked, follow the Fix Validation pipeline exactly:
|
|
57
|
+
|
|
58
|
+
```fsharp
|
|
59
|
+
IssueAnalyzer (bulwark-issue-analyzer) // Sonnet - root cause analysis
|
|
60
|
+
|> FixWriter (bulwark-implementer) // Opus - implement fix
|
|
61
|
+
|> (if !tests_cover_scenario // Conditional: only if tests don't already exist
|
|
62
|
+
then TestWriter |> TestAudit // Opus writes, then audit for T1-T4
|
|
63
|
+
else Skip)
|
|
64
|
+
|> FixValidator (bulwark-fix-validator) // Sonnet - validate against debug report
|
|
65
|
+
|> CodeReviewer (general-purpose) // Sonnet - review fix
|
|
66
|
+
|> (if !approved
|
|
67
|
+
then IssueAnalyzer // Loop back
|
|
68
|
+
else Done)
|
|
69
|
+
|> LOOP(max=3) // Max 3 iterations
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Execution Instructions
|
|
73
|
+
|
|
74
|
+
### Stage 1: IssueAnalyzer
|
|
75
|
+
|
|
76
|
+
**MUST** spawn `bulwark-issue-analyzer` agent via Task tool:
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
Task(
|
|
80
|
+
subagent_type="bulwark-issue-analyzer",
|
|
81
|
+
model="sonnet",
|
|
82
|
+
prompt="GOAL: Analyze the bug and produce a debug report..."
|
|
83
|
+
)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Input**: Path from `$1`, description from `$2` onward
|
|
87
|
+
|
|
88
|
+
**Output**: Debug report at `logs/debug-reports/{issue-id}-{timestamp}.yaml`
|
|
89
|
+
|
|
90
|
+
**Do NOT** skip this stage. The debug report is required for subsequent stages.
|
|
91
|
+
|
|
92
|
+
### Stage 2: FixWriter
|
|
93
|
+
|
|
94
|
+
**MUST** spawn `bulwark-implementer` agent via Task tool:
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
Task(
|
|
98
|
+
subagent_type="bulwark-implementer",
|
|
99
|
+
prompt="GOAL: Fix the identified issue based on the debug report.
|
|
100
|
+
CONSTRAINTS: Only fix the identified issue. Write tests for the fix. Max 3 quality gate retries.
|
|
101
|
+
CONTEXT:
|
|
102
|
+
mode: fix
|
|
103
|
+
debug_report_path: logs/debug-reports/{issue-id}-{timestamp}.yaml
|
|
104
|
+
root_cause: {from Stage 1}
|
|
105
|
+
affected_files: {from Stage 1}
|
|
106
|
+
fix_approach: {from Stage 1}
|
|
107
|
+
OUTPUT: Implementation report at logs/implementer-{id}-{timestamp}.yaml"
|
|
108
|
+
)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Input**: Debug report from Stage 1
|
|
112
|
+
|
|
113
|
+
**Output**: Implementation report at `logs/implementer-{id}-{timestamp}.yaml`
|
|
114
|
+
|
|
115
|
+
**SA6 Note**: The implementer returns pipeline suggestions with MANDATORY language in its summary. Evaluate each suggestion per SA6.
|
|
116
|
+
|
|
117
|
+
**Do NOT** implement the fix yourself. The implementer agent handles quality gates and structured output.
|
|
118
|
+
|
|
119
|
+
### Stage 3: TestWriter (Conditional)
|
|
120
|
+
|
|
121
|
+
**Condition**: Check debug report's `validation_plan.recommendation.new_tests_needed`
|
|
122
|
+
|
|
123
|
+
**If tests needed**:
|
|
124
|
+
1. Write tests that verify the fix
|
|
125
|
+
2. Cover the specific bug scenario
|
|
126
|
+
3. Follow T1-T4 rules (no mocking system under test)
|
|
127
|
+
|
|
128
|
+
**If tests exist**: Skip to Stage 3b or Stage 4
|
|
129
|
+
|
|
130
|
+
### Stage 3b: TestAudit (Conditional)
|
|
131
|
+
|
|
132
|
+
**Condition**: Run if **any** test files were created or modified in Stage 2 (FixWriter) OR Stage 3 (TestWriter). This ensures implementer-written tests receive T1-T4 audit even when TestWriter is skipped.
|
|
133
|
+
|
|
134
|
+
**Action**: Run mock-detection on new/modified tests to verify T1-T4 compliance
|
|
135
|
+
|
|
136
|
+
**If T1 violation**: Return to TestWriter (or FixWriter if TestWriter was skipped), request rewrite
|
|
137
|
+
|
|
138
|
+
**If T2-T4 violations**: Log warning, proceed
|
|
139
|
+
|
|
140
|
+
### Stage 4: FixValidator
|
|
141
|
+
|
|
142
|
+
**MUST** spawn `bulwark-fix-validator` agent via Task tool:
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
Task(
|
|
146
|
+
subagent_type="bulwark-fix-validator",
|
|
147
|
+
model="sonnet",
|
|
148
|
+
prompt="GOAL: Validate the fix against the debug report...
|
|
149
|
+
|
|
150
|
+
CONTEXT:
|
|
151
|
+
Debug Report: logs/debug-reports/{issue-id}-{timestamp}.yaml
|
|
152
|
+
Fix Applied: {description of changes}
|
|
153
|
+
Tests Added: {if any}
|
|
154
|
+
..."
|
|
155
|
+
)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Input**: Debug report path, fix details, test details
|
|
159
|
+
|
|
160
|
+
**Output**: Validation report at `logs/validations/fix-validation-{issue-id}-{timestamp}.yaml`
|
|
161
|
+
|
|
162
|
+
### Stage 5: CodeReviewer
|
|
163
|
+
|
|
164
|
+
**MUST** spawn `general-purpose` agent via Task tool:
|
|
165
|
+
|
|
166
|
+
```
|
|
167
|
+
Task(
|
|
168
|
+
subagent_type="general-purpose",
|
|
169
|
+
model="sonnet",
|
|
170
|
+
prompt="GOAL: Review the fix for correctness, completeness, and safety.
|
|
171
|
+
CONSTRAINTS: Do NOT modify any files. Review only.
|
|
172
|
+
CONTEXT:
|
|
173
|
+
debug_report: logs/debug-reports/{issue-id}-{timestamp}.yaml
|
|
174
|
+
fix_applied: {description of changes from Stage 2}
|
|
175
|
+
tests_added: {from Stage 3, if any}
|
|
176
|
+
validation_results: {from Stage 4}
|
|
177
|
+
OUTPUT: Approval decision (approved: true/false) with concerns and recommendations."
|
|
178
|
+
)
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Approval Criteria**:
|
|
182
|
+
- Fix addresses root cause from debug report
|
|
183
|
+
- Tests verify the specific bug scenario
|
|
184
|
+
- No new issues introduced
|
|
185
|
+
- Validation confidence is acceptable (high or medium with justification)
|
|
186
|
+
|
|
187
|
+
### Loop Handling
|
|
188
|
+
|
|
189
|
+
If rejected and iterations < 3:
|
|
190
|
+
- Return to Stage 1 with feedback
|
|
191
|
+
- Include previous validation results
|
|
192
|
+
|
|
193
|
+
If rejected and iterations >= 3:
|
|
194
|
+
- Escalate to user
|
|
195
|
+
- Summarize all attempts
|
|
196
|
+
|
|
197
|
+
## Progress Reporting
|
|
198
|
+
|
|
199
|
+
After each stage, report progress to user:
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
Stage 1 (IssueAnalyzer): Complete
|
|
203
|
+
- Debug report: logs/debug-reports/AUTH-001-20260120.yaml
|
|
204
|
+
- Root cause: {summary}
|
|
205
|
+
- Complexity: {low|medium|high}
|
|
206
|
+
|
|
207
|
+
Stage 2 (FixWriter): Complete
|
|
208
|
+
- Files modified: {list}
|
|
209
|
+
- Fix: {brief description}
|
|
210
|
+
|
|
211
|
+
Stage 3 (TestWriter): {Complete|Skipped}
|
|
212
|
+
- Tests added: {count or "existing tests sufficient"}
|
|
213
|
+
|
|
214
|
+
Stage 4 (FixValidator): Complete
|
|
215
|
+
- Confidence: {HIGH|MEDIUM|LOW}
|
|
216
|
+
- Recommendation: {proceed|revise}
|
|
217
|
+
|
|
218
|
+
Stage 5 (CodeReviewer): Complete
|
|
219
|
+
- Decision: {Approved|Rejected}
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## Error Handling
|
|
223
|
+
|
|
224
|
+
| Error | Action |
|
|
225
|
+
|-------|--------|
|
|
226
|
+
| IssueAnalyzer fails to identify root cause | Report to user, ask for more context |
|
|
227
|
+
| Tests cannot be executed | FixValidator uses manual validation strategy |
|
|
228
|
+
| FixValidator confidence is LOW | Escalate to user with details |
|
|
229
|
+
| Max iterations reached | Summarize attempts, ask user for guidance |
|
|
230
|
+
|
|
231
|
+
## Related Resources
|
|
232
|
+
|
|
233
|
+
| Resource | Location |
|
|
234
|
+
|----------|----------|
|
|
235
|
+
| Pipeline definition | `pipeline-templates/references/fix-validation.md` |
|
|
236
|
+
| IssueAnalyzer agent | `agents/bulwark-issue-analyzer.md` |
|
|
237
|
+
| Implementer agent | `agents/bulwark-implementer.md` |
|
|
238
|
+
| FixValidator agent | `agents/bulwark-fix-validator.md` |
|
|
239
|
+
| Issue debugging skill | `issue-debugging/SKILL.md` |
|
|
240
|
+
|
|
241
|
+
**Note**: Paths are relative to your skills/agents directory (either `skills/` or `.claude/skills/`).
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: governance-protocol
|
|
3
|
+
description: Session governance protocol injected at startup via SessionStart hook
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**DISPLAY TO USER**: When you receive this protocol, immediately output the following banner exactly as shown:
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
═══════════════════════════════════════════════════════════════
|
|
11
|
+
BULWARK GOVERNANCE PROTOCOL - ACTIVATED
|
|
12
|
+
Quality enforcement enabled for this session
|
|
13
|
+
═══════════════════════════════════════════════════════════════
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Then proceed with the user's request.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## MANDATORY: Rules.md is Binding
|
|
21
|
+
|
|
22
|
+
**YOU MUST READ AND FOLLOW `Rules.md` THROUGHOUT THIS SESSION.**
|
|
23
|
+
|
|
24
|
+
This is not optional. This is not advisory. This is a binding, mandatory, non-negotiable contract.
|
|
25
|
+
|
|
26
|
+
`Rules.md` contains immutable rules including:
|
|
27
|
+
|
|
28
|
+
### SC1-SC3: Skill Compliance Rules (CRITICAL)
|
|
29
|
+
|
|
30
|
+
When a skill is loaded:
|
|
31
|
+
- **ALL instructions within the skill are BINDING**, not advisory
|
|
32
|
+
- **You MUST spawn sub-agents when the skill specifies sub-agent spawning**
|
|
33
|
+
- **You MUST NOT perform the sub-agent's work yourself**
|
|
34
|
+
- **You MUST NOT substitute your judgment for skill instructions**
|
|
35
|
+
- **You MUST NOT skip steps because they seem unnecessary**
|
|
36
|
+
|
|
37
|
+
If you find yourself thinking "I can analyze this directly and give a faster answer" - **STOP**. That thought pattern violates SC1-SC2. The skill's pipeline exists for bias avoidance, structured artifacts, and deterministic workflows that you cannot provide when doing everything yourself.
|
|
38
|
+
|
|
39
|
+
### Violation Consequences
|
|
40
|
+
|
|
41
|
+
Ignoring skill instructions:
|
|
42
|
+
- Defeats the purpose of the Bulwark quality enforcement system
|
|
43
|
+
- Produces inconsistent, non-reproducible outputs
|
|
44
|
+
- Bypasses bias separation that sub-agent pipelines enforce
|
|
45
|
+
- Breaks the observability chain required for multi-agent workflows
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Bulwark Governance Protocol
|
|
50
|
+
|
|
51
|
+
This session is governed by The Bulwark quality enforcement system.
|
|
52
|
+
|
|
53
|
+
### How This Works
|
|
54
|
+
|
|
55
|
+
This skill is automatically injected into Claude's context at session start via the SessionStart hook configured in `hooks/hooks.json`. It does not need to be manually invoked. The `inject-protocol.sh` script reads this file and outputs its content to Claude's context.
|
|
56
|
+
|
|
57
|
+
### Quality Gates (Automatic)
|
|
58
|
+
|
|
59
|
+
PostToolUse hooks run after every Write/Edit operation on code files:
|
|
60
|
+
|
|
61
|
+
1. **Typecheck** - Code must pass type checking (`just typecheck`)
|
|
62
|
+
2. **Lint** - Code must pass linting (`just lint`)
|
|
63
|
+
3. **Build** - Code must compile/build (`just build`)
|
|
64
|
+
|
|
65
|
+
Failures **BLOCK** the operation. You will see error messages if quality checks fail.
|
|
66
|
+
|
|
67
|
+
### Before Declaring Complete
|
|
68
|
+
|
|
69
|
+
**Never declare implementation complete without verification:**
|
|
70
|
+
|
|
71
|
+
1. All code MUST pass quality gates (typecheck, lint, build)
|
|
72
|
+
2. Tests MUST verify real behavior (T1-T4 rules - no mock-only tests)
|
|
73
|
+
3. Changes MUST be verified by running them, not just implementing
|
|
74
|
+
4. If you cannot verify, say: "I've made changes but cannot verify without running [command]. Please run and confirm."
|
|
75
|
+
|
|
76
|
+
### T1-T4 Testing Rules
|
|
77
|
+
|
|
78
|
+
| Rule | Requirement |
|
|
79
|
+
|------|-------------|
|
|
80
|
+
| T1 | Never mock the system under test |
|
|
81
|
+
| T2 | Verify observable output, not function calls |
|
|
82
|
+
| T3 | Integration tests use real systems |
|
|
83
|
+
| T4 | Run tests before declaring complete |
|
|
84
|
+
|
|
85
|
+
### Pipeline Orchestration
|
|
86
|
+
|
|
87
|
+
For significant changes, you may be prompted to run review pipelines:
|
|
88
|
+
- **Code Review** - Security, type safety, coding standards
|
|
89
|
+
- **Test Audit** - T1-T4 compliance verification
|
|
90
|
+
- **Fix Validation** - Root cause analysis and fix verification
|
|
91
|
+
|
|
92
|
+
Follow pipeline instructions when prompted.
|
|
93
|
+
|
|
94
|
+
### Your Role
|
|
95
|
+
|
|
96
|
+
- Write production-grade code that passes quality checks
|
|
97
|
+
- Use real behavior verification in tests
|
|
98
|
+
- Verify implementations before declaring complete
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## Project-Specific Rules
|
|
103
|
+
|
|
104
|
+
<!--
|
|
105
|
+
Users can add project-specific governance rules below.
|
|
106
|
+
These will be injected into Claude's context at session start.
|
|
107
|
+
|
|
108
|
+
NOTE: The core governance rules above should not be modified.
|
|
109
|
+
This section is for project-specific additions only.
|
|
110
|
+
|
|
111
|
+
Examples:
|
|
112
|
+
- Always use atomic commits with descriptive messages
|
|
113
|
+
- Test coverage must exceed 80%
|
|
114
|
+
- Security-sensitive changes require manual review
|
|
115
|
+
- Reference docs/architecture.md for design decisions
|
|
116
|
+
-->
|