@qball-inc/the-bulwark 1.1.0 → 1.2.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 (222) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.gitattributes +48 -0
  3. package/CHANGELOG.md +121 -0
  4. package/LICENSE +21 -21
  5. package/README.md +426 -408
  6. package/agents/bulwark-fix-validator.md +643 -633
  7. package/agents/bulwark-implementer.md +407 -391
  8. package/agents/bulwark-issue-analyzer.md +310 -308
  9. package/agents/bulwark-standards-reviewer.md +305 -221
  10. package/agents/plan-creation-architect.md +325 -323
  11. package/agents/plan-creation-eng-lead.md +354 -352
  12. package/agents/plan-creation-po.md +302 -300
  13. package/agents/plan-creation-qa-critic.md +336 -334
  14. package/agents/product-ideation-competitive-analyzer.md +2 -0
  15. package/agents/product-ideation-idea-validator.md +2 -0
  16. package/agents/product-ideation-market-researcher.md +2 -0
  17. package/agents/product-ideation-pattern-documenter.md +2 -0
  18. package/agents/product-ideation-segment-analyzer.md +2 -0
  19. package/agents/product-ideation-strategist.md +2 -0
  20. package/agents/statusline-setup.md +99 -97
  21. package/hooks/hooks.json +19 -1
  22. package/package.json +6 -5
  23. package/scripts/apply-section.sh +243 -0
  24. package/scripts/hooks/check-template-drift.sh +191 -0
  25. package/scripts/hooks/cleanup-review-registry.sh +106 -0
  26. package/scripts/hooks/cleanup-stale.sh +19 -2
  27. package/scripts/hooks/enforce-quality.sh +2 -2
  28. package/scripts/hooks/lib/coverage_check.py +513 -0
  29. package/scripts/hooks/suggest-pipeline-stop.sh +172 -56
  30. package/scripts/init.sh +56 -0
  31. package/scripts/install-bun.sh +327 -0
  32. package/scripts/update.sh +342 -0
  33. package/skills/anthropic-validator/SKILL.md +497 -607
  34. package/skills/anthropic-validator/references/agents-checklist.md +144 -131
  35. package/skills/anthropic-validator/references/agents-validation.md +90 -0
  36. package/skills/anthropic-validator/references/commands-checklist.md +102 -102
  37. package/skills/anthropic-validator/references/commands-validation.md +42 -0
  38. package/skills/anthropic-validator/references/hooks-checklist.md +160 -151
  39. package/skills/anthropic-validator/references/hooks-validation.md +82 -0
  40. package/skills/anthropic-validator/references/mcp-checklist.md +136 -136
  41. package/skills/anthropic-validator/references/mcp-validation.md +39 -0
  42. package/skills/anthropic-validator/references/plugins-checklist.md +154 -148
  43. package/skills/anthropic-validator/references/plugins-validation.md +68 -0
  44. package/skills/anthropic-validator/references/skills-checklist.md +105 -85
  45. package/skills/anthropic-validator/references/skills-validation.md +79 -0
  46. package/skills/assertion-patterns/SKILL.md +298 -296
  47. package/skills/bug-magnet-data/SKILL.md +286 -284
  48. package/skills/bug-magnet-data/context/cli-args.md +91 -91
  49. package/skills/bug-magnet-data/context/db-query.md +104 -104
  50. package/skills/bug-magnet-data/context/file-contents.md +103 -103
  51. package/skills/bug-magnet-data/context/http-body.md +91 -91
  52. package/skills/bug-magnet-data/context/process-spawn.md +123 -123
  53. package/skills/bug-magnet-data/data/booleans/boundaries.yaml +143 -143
  54. package/skills/bug-magnet-data/data/collections/arrays.yaml +114 -114
  55. package/skills/bug-magnet-data/data/collections/objects.yaml +123 -123
  56. package/skills/bug-magnet-data/data/concurrency/race-conditions.yaml +118 -118
  57. package/skills/bug-magnet-data/data/concurrency/state-machines.yaml +115 -115
  58. package/skills/bug-magnet-data/data/dates/boundaries.yaml +137 -137
  59. package/skills/bug-magnet-data/data/dates/invalid.yaml +132 -132
  60. package/skills/bug-magnet-data/data/dates/timezone.yaml +118 -118
  61. package/skills/bug-magnet-data/data/encoding/charset.yaml +79 -79
  62. package/skills/bug-magnet-data/data/encoding/normalization.yaml +105 -105
  63. package/skills/bug-magnet-data/data/formats/email.yaml +154 -154
  64. package/skills/bug-magnet-data/data/formats/json.yaml +187 -187
  65. package/skills/bug-magnet-data/data/formats/url.yaml +165 -165
  66. package/skills/bug-magnet-data/data/language-specific/javascript.yaml +182 -182
  67. package/skills/bug-magnet-data/data/language-specific/python.yaml +174 -174
  68. package/skills/bug-magnet-data/data/language-specific/rust.yaml +148 -148
  69. package/skills/bug-magnet-data/data/numbers/boundaries.yaml +161 -161
  70. package/skills/bug-magnet-data/data/numbers/precision.yaml +89 -89
  71. package/skills/bug-magnet-data/data/numbers/special.yaml +69 -69
  72. package/skills/bug-magnet-data/data/strings/boundaries.yaml +109 -109
  73. package/skills/bug-magnet-data/data/strings/injection.yaml +208 -208
  74. package/skills/bug-magnet-data/data/strings/special-chars.yaml +190 -190
  75. package/skills/bug-magnet-data/data/strings/unicode.yaml +139 -139
  76. package/skills/bug-magnet-data/references/external-lists.md +115 -115
  77. package/skills/bulwark-brainstorm/SKILL.md +566 -563
  78. package/skills/bulwark-brainstorm/references/at-teammate-prompts.md +95 -60
  79. package/skills/bulwark-brainstorm/references/role-critical-analyst.md +78 -78
  80. package/skills/bulwark-brainstorm/references/role-development-lead.md +66 -66
  81. package/skills/bulwark-brainstorm/references/role-product-delivery-lead.md +79 -79
  82. package/skills/bulwark-brainstorm/references/role-product-manager.md +62 -62
  83. package/skills/bulwark-brainstorm/references/role-project-sme.md +59 -59
  84. package/skills/bulwark-brainstorm/references/role-technical-architect.md +66 -66
  85. package/skills/bulwark-research/SKILL.md +300 -298
  86. package/skills/bulwark-research/references/viewpoint-contrarian.md +63 -63
  87. package/skills/bulwark-research/references/viewpoint-direct-investigation.md +62 -62
  88. package/skills/bulwark-research/references/viewpoint-first-principles.md +65 -65
  89. package/skills/bulwark-research/references/viewpoint-practitioner.md +62 -62
  90. package/skills/bulwark-research/references/viewpoint-prior-art.md +66 -66
  91. package/skills/bulwark-scaffold/SKILL.md +483 -396
  92. package/skills/bulwark-statusline/SKILL.md +166 -161
  93. package/skills/bulwark-statusline/scripts/statusline.sh +1 -1
  94. package/skills/bulwark-verify/SKILL.md +532 -519
  95. package/skills/code-review/SKILL.md +488 -428
  96. package/skills/code-review/examples/anti-patterns/linting.ts +181 -181
  97. package/skills/code-review/examples/anti-patterns/security.ts +91 -91
  98. package/skills/code-review/examples/anti-patterns/standards.ts +195 -195
  99. package/skills/code-review/examples/anti-patterns/type-safety.ts +108 -108
  100. package/skills/code-review/examples/recommended/linting.ts +195 -195
  101. package/skills/code-review/examples/recommended/security.ts +154 -154
  102. package/skills/code-review/examples/recommended/standards.ts +231 -231
  103. package/skills/code-review/examples/recommended/type-safety.ts +181 -181
  104. package/skills/code-review/frameworks/angular.md +218 -218
  105. package/skills/code-review/frameworks/django.md +235 -235
  106. package/skills/code-review/frameworks/express.md +207 -207
  107. package/skills/code-review/frameworks/fastapi.md +326 -0
  108. package/skills/code-review/frameworks/flask.md +298 -298
  109. package/skills/code-review/frameworks/generic.md +146 -146
  110. package/skills/code-review/frameworks/react.md +152 -152
  111. package/skills/code-review/frameworks/vue.md +244 -244
  112. package/skills/code-review/references/linting-patterns.md +221 -221
  113. package/skills/code-review/references/security-patterns.md +125 -125
  114. package/skills/code-review/references/standards-patterns.md +246 -246
  115. package/skills/code-review/references/type-safety-patterns.md +130 -130
  116. package/skills/component-patterns/SKILL.md +133 -131
  117. package/skills/component-patterns/references/pattern-cli-command.md +118 -118
  118. package/skills/component-patterns/references/pattern-database.md +166 -166
  119. package/skills/component-patterns/references/pattern-external-api.md +139 -139
  120. package/skills/component-patterns/references/pattern-file-parser.md +168 -168
  121. package/skills/component-patterns/references/pattern-http-server.md +162 -162
  122. package/skills/component-patterns/references/pattern-process-spawner.md +133 -133
  123. package/skills/continuous-feedback/SKILL.md +329 -327
  124. package/skills/continuous-feedback/references/collect-instructions.md +81 -81
  125. package/skills/continuous-feedback/references/specialize-code-review.md +82 -82
  126. package/skills/continuous-feedback/references/specialize-general.md +98 -98
  127. package/skills/continuous-feedback/references/specialize-test-audit.md +81 -81
  128. package/skills/create-skill/SKILL.md +550 -359
  129. package/skills/create-skill/agents/skill-eval-comparator.md +158 -0
  130. package/skills/create-skill/agents/skill-eval-grader.md +168 -0
  131. package/skills/create-skill/references/agent-conventions.md +194 -194
  132. package/skills/create-skill/references/agent-template.md +195 -195
  133. package/skills/create-skill/references/content-guidance.md +541 -291
  134. package/skills/create-skill/references/decision-framework.md +232 -124
  135. package/skills/create-skill/references/eval-scaffolding.md +468 -0
  136. package/skills/create-skill/references/eval-shape.md +383 -0
  137. package/skills/create-skill/references/scripts-conventions.md +142 -0
  138. package/skills/create-skill/references/template-generator.md +183 -0
  139. package/skills/create-skill/references/template-inversion.md +269 -0
  140. package/skills/create-skill/references/template-pipeline.md +248 -217
  141. package/skills/create-skill/references/template-research.md +234 -210
  142. package/skills/create-skill/references/template-reviewer.md +231 -0
  143. package/skills/create-skill/references/template-script-driven.md +185 -172
  144. package/skills/create-skill/references/template-tool-wrapper.md +199 -0
  145. package/skills/create-skill/scripts/check-description.ts +238 -0
  146. package/skills/create-skill/scripts/check-skill-size.ts +201 -0
  147. package/skills/create-skill/scripts/grade.ts +855 -0
  148. package/skills/create-skill/scripts/run-loop.ts +297 -0
  149. package/skills/create-subagent/SKILL.md +355 -353
  150. package/skills/create-subagent/references/agent-conventions.md +268 -268
  151. package/skills/create-subagent/references/content-guidance.md +232 -232
  152. package/skills/create-subagent/references/decision-framework.md +134 -134
  153. package/skills/create-subagent/references/template-single-agent.md +194 -192
  154. package/skills/fix-bug/SKILL.md +243 -241
  155. package/skills/governance-protocol/SKILL.md +118 -116
  156. package/skills/init/SKILL.md +519 -437
  157. package/skills/init/references/update-askuser-prompts.md +198 -0
  158. package/skills/init/references/update-mode.md +305 -0
  159. package/skills/init/references/update-section-anchor-diff.md +163 -0
  160. package/skills/issue-debugging/SKILL.md +387 -385
  161. package/skills/issue-debugging/references/anti-patterns.md +245 -245
  162. package/skills/issue-debugging/references/debug-report-schema.md +227 -227
  163. package/skills/mock-detection/SKILL.md +528 -511
  164. package/skills/mock-detection/references/false-positive-prevention.md +402 -402
  165. package/skills/mock-detection/references/stub-patterns.md +236 -236
  166. package/skills/pipeline-templates/SKILL.md +262 -215
  167. package/skills/pipeline-templates/references/code-change-workflow.md +277 -277
  168. package/skills/pipeline-templates/references/code-review.md +348 -336
  169. package/skills/pipeline-templates/references/fix-validation.md +421 -421
  170. package/skills/pipeline-templates/references/new-feature.md +335 -335
  171. package/skills/pipeline-templates/references/research-brainstorm.md +161 -161
  172. package/skills/pipeline-templates/references/research-planning.md +257 -257
  173. package/skills/pipeline-templates/references/test-audit.md +389 -389
  174. package/skills/pipeline-templates/references/test-execution-fix.md +238 -238
  175. package/skills/plan-creation/SKILL.md +531 -497
  176. package/skills/plan-to-tasks/SKILL.md +151 -0
  177. package/skills/plan-to-tasks/references/askuserquestion-prompts.md +75 -0
  178. package/skills/plan-to-tasks/references/transform.md +253 -0
  179. package/skills/product-ideation/SKILL.md +2 -0
  180. package/skills/session-handoff/SKILL.md +167 -165
  181. package/skills/session-handoff/references/examples.md +223 -223
  182. package/skills/setup-lsp/SKILL.md +314 -312
  183. package/skills/setup-lsp/references/server-registry.md +85 -85
  184. package/skills/setup-lsp/references/troubleshooting.md +135 -135
  185. package/skills/spec-drift-check/SKILL.md +287 -0
  186. package/skills/spec-drift-check/evals/evals.json +33 -0
  187. package/skills/spec-drift-check/evals/triggers.json +19 -0
  188. package/skills/spec-drift-check/examples/clean-spec.md +52 -0
  189. package/skills/spec-drift-check/examples/expected-output-clean.yaml +96 -0
  190. package/skills/spec-drift-check/examples/expected-output-high-drift.yaml +78 -0
  191. package/skills/spec-drift-check/examples/expected-output-low-drift.yaml +67 -0
  192. package/skills/spec-drift-check/examples/high-drift-spec.md +49 -0
  193. package/skills/spec-drift-check/examples/low-drift-spec.md +39 -0
  194. package/skills/spec-drift-check/references/anti-patterns.md +65 -0
  195. package/skills/spec-drift-check/references/output-template.md +142 -0
  196. package/skills/spec-drift-check/references/step-1-claim-extraction.md +147 -0
  197. package/skills/spec-drift-check/references/step-2-verification-methods.md +203 -0
  198. package/skills/spec-drift-check/references/step-3-categorization.md +105 -0
  199. package/skills/spec-drift-check/references/step-4-plan-adjustment.md +122 -0
  200. package/skills/spec-drift-check/references/step-5-log-template.md +220 -0
  201. package/skills/spec-drift-check/references/step-6-decision-matrix.md +136 -0
  202. package/skills/subagent-output-templating/SKILL.md +417 -415
  203. package/skills/subagent-output-templating/references/examples.md +440 -440
  204. package/skills/subagent-prompting/SKILL.md +366 -364
  205. package/skills/subagent-prompting/references/examples.md +342 -342
  206. package/skills/test-audit/SKILL.md +545 -531
  207. package/skills/test-audit/references/known-limitations.md +41 -41
  208. package/skills/test-audit/references/priority-classification.md +30 -30
  209. package/skills/test-audit/references/prompts/deep-mode-detection.md +83 -83
  210. package/skills/test-audit/references/prompts/synthesis.md +58 -57
  211. package/skills/test-audit/references/rewrite-instructions.md +46 -46
  212. package/skills/test-audit/references/schemas/audit-output.yaml +131 -100
  213. package/skills/test-audit/references/schemas/diagnostic-output.yaml +56 -49
  214. package/skills/test-audit/references/two-gate-logic.md +43 -0
  215. package/skills/test-audit/scripts/data-flow-analyzer.ts +508 -508
  216. package/skills/test-audit/scripts/integration-mock-detector.ts +462 -462
  217. package/skills/test-audit/scripts/skip-detector.ts +211 -211
  218. package/skills/test-audit/scripts/verification-counter.ts +295 -295
  219. package/skills/test-classification/SKILL.md +326 -310
  220. package/skills/test-fixture-creation/SKILL.md +297 -295
  221. package/skills/create-skill/references/template-reference-heavy.md +0 -111
  222. package/skills/create-skill/references/template-simple.md +0 -80
@@ -1,415 +1,417 @@
1
- ---
2
- name: subagent-output-templating
3
- description: Template for structured sub-agent output including YAML log format, task completion reports (WHY/WHAT/TRADE-OFFS/RISKS), and summary constraints. Use when defining how sub-agents should report results.
4
- user-invocable: false
5
- ---
6
-
7
- # Sub-Agent Output Templating
8
-
9
- ## Overview
10
-
11
- This skill provides standardized templates for sub-agent OUTPUT formatting. It complements `subagent-prompting` (P0.1) which defines INPUT structure:
12
-
13
- | Skill | Purpose |
14
- |-------|---------|
15
- | `subagent-prompting` | How to prompt sub-agents (GOAL/CONSTRAINTS/CONTEXT/OUTPUT) |
16
- | `subagent-output-templating` | How sub-agents report results (logs, summaries, diagnostics) |
17
-
18
- Use this skill when:
19
- - Defining output requirements for sub-agent invocations
20
- - Parsing sub-agent results in pipeline stages
21
- - Ensuring consistent log formats across all agents
22
-
23
- ---
24
-
25
- ## Log File Format
26
-
27
- ### File Location
28
-
29
- ```
30
- logs/{agent-name}-{YYYYMMDD-HHMMSS}.yaml
31
- ```
32
-
33
- Example: `logs/bulwark-code-auditor-20260111-143022.yaml`
34
-
35
- ### YAML Schema
36
-
37
- ```yaml
38
- # Required: Metadata block
39
- metadata:
40
- agent: {agent-name} # e.g., bulwark-code-auditor
41
- timestamp: {ISO-8601} # e.g., 2026-01-11T14:30:22Z
42
- model: {model-used} # sonnet, haiku, or opus
43
- task_id: {unique-identifier} # For tracking across pipeline stages
44
- duration_ms: {execution-time} # Execution duration in milliseconds
45
-
46
- # Required: Goal from the prompt (for traceability)
47
- goal: "{GOAL from 4-part prompt}"
48
-
49
- # Required: Completion report
50
- completion:
51
- why:
52
- problem: "{What was broken/missing}"
53
- root_cause: "{Why it happened}"
54
- solution: "{What was implemented}"
55
-
56
- what:
57
- - file: {path}
58
- lines: "{range}"
59
- change: "{description}"
60
-
61
- trade_offs:
62
- gained:
63
- - "{benefit 1}"
64
- cost:
65
- - "{drawback 1}"
66
-
67
- risks:
68
- - risk: "{description}"
69
- mitigation: "{how addressed}"
70
- severity: {low|medium|high|critical}
71
-
72
- next_steps:
73
- - "{action item 1}"
74
-
75
- # Required for code-writing agents (omit for read-only agents):
76
- # Pipeline suggestions from implementer-quality.sh output
77
- pipeline_suggestions:
78
- - pipeline: "{recommended pipeline name}"
79
- target_files:
80
- - "{file path}"
81
- reason: "{why this pipeline is recommended}"
82
-
83
- # Required: Summary for main thread (100-300 tokens)
84
- summary: |
85
- {Concise summary for main thread consumption}
86
-
87
- # Required: Diagnostic output
88
- diagnostics:
89
- model_requested: {model}
90
- model_actual: {model}
91
- context_type: {main|forked}
92
- parent_vars_accessible: {true|false}
93
- hooks_fired:
94
- - {hook-name}
95
- execution_time_ms: {duration}
96
- completion_status: {success|error|timeout}
97
- ```
98
-
99
- ---
100
-
101
- ## Task Completion Report (WHY/WHAT/TRADE-OFFS/RISKS)
102
-
103
- Every sub-agent MUST conclude with this structured report. This enables explicit decision documentation rather than implicit code changes.
104
-
105
- ### WHY Section
106
-
107
- Document the problem and solution rationale.
108
-
109
- ```yaml
110
- why:
111
- problem: "Authentication bypass vulnerability in refresh token path"
112
- root_cause: "Token validation skips expiry check on refresh"
113
- solution: "Added isExpired() check to refresh token handler"
114
- ```
115
-
116
- **Guidelines**:
117
- - `problem`: What was broken, missing, or needs improvement
118
- - `root_cause`: The underlying reason (not just symptoms)
119
- - `solution`: What was done to address it
120
-
121
- ### WHAT Section
122
-
123
- List all changes made with file locations.
124
-
125
- ```yaml
126
- what:
127
- - file: src/auth/token.ts
128
- lines: "45-52"
129
- change: "Added isExpired() check before token refresh"
130
- - file: src/auth/token.test.ts
131
- lines: "120-145"
132
- change: "Added test for expired refresh token rejection"
133
- ```
134
-
135
- **Guidelines**:
136
- - One entry per file modified
137
- - Include line ranges for precise location
138
- - Describe the change, not the code
139
-
140
- ### TRADE-OFFS Section
141
-
142
- Acknowledge explicit compromises made.
143
-
144
- ```yaml
145
- trade_offs:
146
- gained:
147
- - "Security: Expired tokens now properly rejected"
148
- - "Compliance: Meets OWASP session management requirements"
149
- cost:
150
- - "Performance: Additional DB lookup on refresh (negligible)"
151
- - "Complexity: New error handling path for expired tokens"
152
- ```
153
-
154
- **Guidelines**:
155
- - Be honest about costs
156
- - Quantify impact where possible
157
- - Include both technical and business trade-offs
158
-
159
- ### RISKS Section
160
-
161
- Document forward-looking concerns.
162
-
163
- ```yaml
164
- risks:
165
- - risk: "Existing sessions with expired refresh tokens will fail"
166
- mitigation: "Grace period of 24h for migration"
167
- severity: medium
168
- - risk: "Grace period could be exploited"
169
- mitigation: "Monitor for unusual refresh patterns"
170
- severity: low
171
- ```
172
-
173
- **Severity Levels**:
174
- | Level | Definition |
175
- |-------|------------|
176
- | `low` | Unlikely or minor impact |
177
- | `medium` | Possible impact, manageable |
178
- | `high` | Likely impact, needs attention |
179
- | `critical` | Must be addressed before deployment |
180
-
181
- ### NEXT STEPS Section
182
-
183
- List follow-up actions for pipeline or human.
184
-
185
- ```yaml
186
- next_steps:
187
- - "Monitor refresh failure rate for 24h"
188
- - "Remove grace period after migration window"
189
- - "Update documentation for new error codes"
190
- ```
191
-
192
- **Guidelines**:
193
- - Actionable items only
194
- - Include owner if known (e.g., "DevOps: Update monitoring dashboard")
195
- - Order by priority
196
-
197
- ---
198
-
199
- ## Summary Format for Main Thread
200
-
201
- ### Purpose
202
-
203
- The summary is returned to the main thread for pipeline decision-making. It should enable the orchestrator to:
204
- 1. Understand key findings without reading full log
205
- 2. Decide next pipeline stage
206
- 3. Report status to user
207
-
208
- ### Token Budget
209
-
210
- | Complexity | Target Tokens | Use Case |
211
- |------------|---------------|----------|
212
- | Simple | 100-150 | Single finding, clear action |
213
- | Moderate | 150-250 | Multiple findings, some nuance |
214
- | Complex | 250-300 | Many findings, trade-off decisions |
215
-
216
- ### Summary Template
217
-
218
- ```
219
- Found [N] [severity] issue(s): [brief description].
220
- [Action taken / recommendation].
221
- [Key risk or follow-up if any].
222
- ```
223
-
224
- ### Examples
225
-
226
- **Simple (120 tokens)**:
227
- ```
228
- Found 1 critical vulnerability: refresh tokens not validated for expiry.
229
- Fixed by adding isExpired() check in token.ts:45-52. Added regression test.
230
- Risk: existing sessions may fail during 24h migration window.
231
- ```
232
-
233
- **Moderate (200 tokens)**:
234
- ```
235
- Found 3 issues in authentication module:
236
- - 1 critical: token expiry bypass (fixed)
237
- - 1 medium: weak password hashing (fixed, migration needed)
238
- - 1 low: verbose error messages (fixed)
239
-
240
- All issues addressed with tests added. Migration script created for password re-hashing.
241
- Next: run migration in staging, monitor for 48h before production.
242
- ```
243
-
244
- ### What to Include
245
-
246
- - Finding count and severity
247
- - Actions taken
248
- - Key risks or blockers
249
- - Recommended next steps
250
-
251
- ### What to Exclude
252
-
253
- - Full reasoning or analysis
254
- - Code snippets
255
- - Verbose explanations
256
- - Duplicate information from log
257
-
258
- ### Pipeline Suggestions in Summary (Code-Writing Agents)
259
-
260
- Code-writing agents (e.g., bulwark-implementer) that invoke `implementer-quality.sh` and receive pipeline suggestions MUST include them in the summary with MANDATORY language. This ensures the orchestrator sees and acts on them per SA6.
261
-
262
- ```
263
- MANDATORY FOLLOW-UP (SA6): Run the following pipeline(s):
264
- - {pipeline} on {target_files} ({reason})
265
- Orchestrator MUST evaluate each suggestion and either execute or document deferral per SA6.
266
- ```
267
-
268
- Read-only agents (reviewers, auditors) omit this section.
269
-
270
- ---
271
-
272
- ## Diagnostic Output
273
-
274
- ### Purpose
275
-
276
- Enable automated behavioral testing without mocking. Diagnostics verify:
277
- - Correct model was used
278
- - Context isolation worked (for `context: fork` agents)
279
- - Hooks fired as expected
280
- - Execution completed successfully
281
-
282
- ### Location
283
-
284
- ```
285
- logs/diagnostics/{agent-name}-{YYYYMMDD-HHMMSS}.yaml
286
- ```
287
-
288
- ### Format
289
-
290
- ```yaml
291
- skill: subagent-output-templating
292
- timestamp: 2026-01-11T14:30:22Z
293
- diagnostics:
294
- model_requested: sonnet
295
- model_actual: sonnet
296
- context_type: forked # main or forked
297
- parent_vars_accessible: false # Should be false for forked
298
- hooks_fired:
299
- - Stop
300
- execution_time_ms: 4520
301
- completion_status: success # success, error, timeout
302
- notes: "Task completed successfully"
303
- ```
304
-
305
- ### Diagnostic Fields
306
-
307
- | Field | Purpose | Values |
308
- |-------|---------|--------|
309
- | `model_requested` | Model specified in prompt | haiku, sonnet, opus |
310
- | `model_actual` | Model that actually ran | haiku, sonnet, opus |
311
- | `context_type` | Execution context | main, forked |
312
- | `parent_vars_accessible` | Context isolation test | true, false |
313
- | `hooks_fired` | Lifecycle hooks that executed | Array of hook names |
314
- | `execution_time_ms` | Duration | Integer |
315
- | `completion_status` | Final status | success, error, timeout |
316
-
317
- ---
318
-
319
- ## Quick Reference
320
-
321
- ### Minimal Log Template
322
-
323
- ```yaml
324
- metadata:
325
- agent: {name}
326
- timestamp: {ISO-8601}
327
- model: sonnet
328
- task_id: "{id}"
329
- duration_ms: 0
330
-
331
- goal: "{goal}"
332
-
333
- completion:
334
- why:
335
- problem: "{problem}"
336
- root_cause: "{cause}"
337
- solution: "{solution}"
338
- what:
339
- - file: {path}
340
- lines: "{range}"
341
- change: "{description}"
342
- trade_offs:
343
- gained: ["{benefit}"]
344
- cost: ["{cost}"]
345
- risks:
346
- - risk: "{risk}"
347
- mitigation: "{mitigation}"
348
- severity: medium
349
- next_steps:
350
- - "{action}"
351
-
352
- # Include for code-writing agents only (omit for read-only agents):
353
- pipeline_suggestions:
354
- - pipeline: "{pipeline name}"
355
- target_files: ["{path}"]
356
- reason: "{reason}"
357
-
358
- summary: |
359
- {100-300 token summary}
360
-
361
- diagnostics:
362
- model_requested: sonnet
363
- model_actual: sonnet
364
- context_type: forked
365
- parent_vars_accessible: false
366
- hooks_fired: []
367
- execution_time_ms: 0
368
- completion_status: success
369
- ```
370
-
371
- ### Summary Checklist
372
-
373
- ```
374
- [ ] Count and severity of findings stated
375
- [ ] Actions taken described
376
- [ ] Key risks mentioned
377
- [ ] Next steps listed
378
- [ ] Under 300 tokens
379
- [ ] Pipeline suggestions with MANDATORY language (code-writing agents only)
380
- ```
381
-
382
- ### Output Location Checklist
383
-
384
- ```
385
- [ ] Main log: logs/{agent}-{YYYYMMDD-HHMMSS}.yaml
386
- [ ] Diagnostics: logs/diagnostics/{agent}-{YYYYMMDD-HHMMSS}.yaml
387
- ```
388
-
389
- ---
390
-
391
- ## Timestamp Formats
392
-
393
- | Context | Placeholder | Format | Example |
394
- |---------|-------------|--------|---------|
395
- | **File paths** | `{YYYYMMDD-HHMMSS}` | Compact, filesystem-safe | `20260119-143022` |
396
- | **YAML fields** | `{ISO-8601}` | Standard ISO format | `2026-01-19T14:30:22Z` |
397
-
398
- **Why two formats?**
399
- - File names: No colons (filesystem-safe on Windows), compact, lexically sortable
400
- - YAML fields: Standard ISO-8601 for parsing and interoperability
401
-
402
- **Important**: Always use `{YYYYMMDD-HHMMSS}` in file paths, never `{timestamp}` or `{ts}`.
403
-
404
- ---
405
-
406
- ## Related Skills
407
-
408
- - **subagent-prompting** (P0.1): Defines INPUT structure (GOAL/CONSTRAINTS/CONTEXT/OUTPUT)
409
- - **pipeline-templates** (P0.3): Pre-defined workflows that consume this output format
410
-
411
- ---
412
-
413
- ## References
414
-
415
- For extended examples and edge cases, see `references/examples.md`.
1
+ ---
2
+ name: subagent-output-templating
3
+ description: Template for structured sub-agent output including YAML log format, task completion reports (WHY/WHAT/TRADE-OFFS/RISKS), and summary constraints. Use when defining how sub-agents should report results.
4
+ user-invocable: false
5
+ version: 1.0.0
6
+ author: "Ashay Kubal @ Qball Inc."
7
+ ---
8
+
9
+ # Sub-Agent Output Templating
10
+
11
+ ## Overview
12
+
13
+ This skill provides standardized templates for sub-agent OUTPUT formatting. It complements `subagent-prompting` (P0.1) which defines INPUT structure:
14
+
15
+ | Skill | Purpose |
16
+ |-------|---------|
17
+ | `subagent-prompting` | How to prompt sub-agents (GOAL/CONSTRAINTS/CONTEXT/OUTPUT) |
18
+ | `subagent-output-templating` | How sub-agents report results (logs, summaries, diagnostics) |
19
+
20
+ Use this skill when:
21
+ - Defining output requirements for sub-agent invocations
22
+ - Parsing sub-agent results in pipeline stages
23
+ - Ensuring consistent log formats across all agents
24
+
25
+ ---
26
+
27
+ ## Log File Format
28
+
29
+ ### File Location
30
+
31
+ ```
32
+ logs/{agent-name}-{YYYYMMDD-HHMMSS}.yaml
33
+ ```
34
+
35
+ Example: `logs/bulwark-code-auditor-20260111-143022.yaml`
36
+
37
+ ### YAML Schema
38
+
39
+ ```yaml
40
+ # Required: Metadata block
41
+ metadata:
42
+ agent: {agent-name} # e.g., bulwark-code-auditor
43
+ timestamp: {ISO-8601} # e.g., 2026-01-11T14:30:22Z
44
+ model: {model-used} # sonnet, haiku, or opus
45
+ task_id: {unique-identifier} # For tracking across pipeline stages
46
+ duration_ms: {execution-time} # Execution duration in milliseconds
47
+
48
+ # Required: Goal from the prompt (for traceability)
49
+ goal: "{GOAL from 4-part prompt}"
50
+
51
+ # Required: Completion report
52
+ completion:
53
+ why:
54
+ problem: "{What was broken/missing}"
55
+ root_cause: "{Why it happened}"
56
+ solution: "{What was implemented}"
57
+
58
+ what:
59
+ - file: {path}
60
+ lines: "{range}"
61
+ change: "{description}"
62
+
63
+ trade_offs:
64
+ gained:
65
+ - "{benefit 1}"
66
+ cost:
67
+ - "{drawback 1}"
68
+
69
+ risks:
70
+ - risk: "{description}"
71
+ mitigation: "{how addressed}"
72
+ severity: {low|medium|high|critical}
73
+
74
+ next_steps:
75
+ - "{action item 1}"
76
+
77
+ # Required for code-writing agents (omit for read-only agents):
78
+ # Pipeline suggestions from implementer-quality.sh output
79
+ pipeline_suggestions:
80
+ - pipeline: "{recommended pipeline name}"
81
+ target_files:
82
+ - "{file path}"
83
+ reason: "{why this pipeline is recommended}"
84
+
85
+ # Required: Summary for main thread (100-300 tokens)
86
+ summary: |
87
+ {Concise summary for main thread consumption}
88
+
89
+ # Required: Diagnostic output
90
+ diagnostics:
91
+ model_requested: {model}
92
+ model_actual: {model}
93
+ context_type: {main|forked}
94
+ parent_vars_accessible: {true|false}
95
+ hooks_fired:
96
+ - {hook-name}
97
+ execution_time_ms: {duration}
98
+ completion_status: {success|error|timeout}
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Task Completion Report (WHY/WHAT/TRADE-OFFS/RISKS)
104
+
105
+ Every sub-agent MUST conclude with this structured report. This enables explicit decision documentation rather than implicit code changes.
106
+
107
+ ### WHY Section
108
+
109
+ Document the problem and solution rationale.
110
+
111
+ ```yaml
112
+ why:
113
+ problem: "Authentication bypass vulnerability in refresh token path"
114
+ root_cause: "Token validation skips expiry check on refresh"
115
+ solution: "Added isExpired() check to refresh token handler"
116
+ ```
117
+
118
+ **Guidelines**:
119
+ - `problem`: What was broken, missing, or needs improvement
120
+ - `root_cause`: The underlying reason (not just symptoms)
121
+ - `solution`: What was done to address it
122
+
123
+ ### WHAT Section
124
+
125
+ List all changes made with file locations.
126
+
127
+ ```yaml
128
+ what:
129
+ - file: src/auth/token.ts
130
+ lines: "45-52"
131
+ change: "Added isExpired() check before token refresh"
132
+ - file: src/auth/token.test.ts
133
+ lines: "120-145"
134
+ change: "Added test for expired refresh token rejection"
135
+ ```
136
+
137
+ **Guidelines**:
138
+ - One entry per file modified
139
+ - Include line ranges for precise location
140
+ - Describe the change, not the code
141
+
142
+ ### TRADE-OFFS Section
143
+
144
+ Acknowledge explicit compromises made.
145
+
146
+ ```yaml
147
+ trade_offs:
148
+ gained:
149
+ - "Security: Expired tokens now properly rejected"
150
+ - "Compliance: Meets OWASP session management requirements"
151
+ cost:
152
+ - "Performance: Additional DB lookup on refresh (negligible)"
153
+ - "Complexity: New error handling path for expired tokens"
154
+ ```
155
+
156
+ **Guidelines**:
157
+ - Be honest about costs
158
+ - Quantify impact where possible
159
+ - Include both technical and business trade-offs
160
+
161
+ ### RISKS Section
162
+
163
+ Document forward-looking concerns.
164
+
165
+ ```yaml
166
+ risks:
167
+ - risk: "Existing sessions with expired refresh tokens will fail"
168
+ mitigation: "Grace period of 24h for migration"
169
+ severity: medium
170
+ - risk: "Grace period could be exploited"
171
+ mitigation: "Monitor for unusual refresh patterns"
172
+ severity: low
173
+ ```
174
+
175
+ **Severity Levels**:
176
+ | Level | Definition |
177
+ |-------|------------|
178
+ | `low` | Unlikely or minor impact |
179
+ | `medium` | Possible impact, manageable |
180
+ | `high` | Likely impact, needs attention |
181
+ | `critical` | Must be addressed before deployment |
182
+
183
+ ### NEXT STEPS Section
184
+
185
+ List follow-up actions for pipeline or human.
186
+
187
+ ```yaml
188
+ next_steps:
189
+ - "Monitor refresh failure rate for 24h"
190
+ - "Remove grace period after migration window"
191
+ - "Update documentation for new error codes"
192
+ ```
193
+
194
+ **Guidelines**:
195
+ - Actionable items only
196
+ - Include owner if known (e.g., "DevOps: Update monitoring dashboard")
197
+ - Order by priority
198
+
199
+ ---
200
+
201
+ ## Summary Format for Main Thread
202
+
203
+ ### Purpose
204
+
205
+ The summary is returned to the main thread for pipeline decision-making. It should enable the orchestrator to:
206
+ 1. Understand key findings without reading full log
207
+ 2. Decide next pipeline stage
208
+ 3. Report status to user
209
+
210
+ ### Token Budget
211
+
212
+ | Complexity | Target Tokens | Use Case |
213
+ |------------|---------------|----------|
214
+ | Simple | 100-150 | Single finding, clear action |
215
+ | Moderate | 150-250 | Multiple findings, some nuance |
216
+ | Complex | 250-300 | Many findings, trade-off decisions |
217
+
218
+ ### Summary Template
219
+
220
+ ```
221
+ Found [N] [severity] issue(s): [brief description].
222
+ [Action taken / recommendation].
223
+ [Key risk or follow-up if any].
224
+ ```
225
+
226
+ ### Examples
227
+
228
+ **Simple (120 tokens)**:
229
+ ```
230
+ Found 1 critical vulnerability: refresh tokens not validated for expiry.
231
+ Fixed by adding isExpired() check in token.ts:45-52. Added regression test.
232
+ Risk: existing sessions may fail during 24h migration window.
233
+ ```
234
+
235
+ **Moderate (200 tokens)**:
236
+ ```
237
+ Found 3 issues in authentication module:
238
+ - 1 critical: token expiry bypass (fixed)
239
+ - 1 medium: weak password hashing (fixed, migration needed)
240
+ - 1 low: verbose error messages (fixed)
241
+
242
+ All issues addressed with tests added. Migration script created for password re-hashing.
243
+ Next: run migration in staging, monitor for 48h before production.
244
+ ```
245
+
246
+ ### What to Include
247
+
248
+ - Finding count and severity
249
+ - Actions taken
250
+ - Key risks or blockers
251
+ - Recommended next steps
252
+
253
+ ### What to Exclude
254
+
255
+ - Full reasoning or analysis
256
+ - Code snippets
257
+ - Verbose explanations
258
+ - Duplicate information from log
259
+
260
+ ### Pipeline Suggestions in Summary (Code-Writing Agents)
261
+
262
+ Code-writing agents (e.g., bulwark-implementer) that invoke `implementer-quality.sh` and receive pipeline suggestions MUST include them in the summary with MANDATORY language. This ensures the orchestrator sees and acts on them per SA6.
263
+
264
+ ```
265
+ MANDATORY FOLLOW-UP (SA6): Run the following pipeline(s):
266
+ - {pipeline} on {target_files} ({reason})
267
+ Orchestrator MUST evaluate each suggestion and either execute or document deferral per SA6.
268
+ ```
269
+
270
+ Read-only agents (reviewers, auditors) omit this section.
271
+
272
+ ---
273
+
274
+ ## Diagnostic Output
275
+
276
+ ### Purpose
277
+
278
+ Enable automated behavioral testing without mocking. Diagnostics verify:
279
+ - Correct model was used
280
+ - Context isolation worked (for `context: fork` agents)
281
+ - Hooks fired as expected
282
+ - Execution completed successfully
283
+
284
+ ### Location
285
+
286
+ ```
287
+ logs/diagnostics/{agent-name}-{YYYYMMDD-HHMMSS}.yaml
288
+ ```
289
+
290
+ ### Format
291
+
292
+ ```yaml
293
+ skill: subagent-output-templating
294
+ timestamp: 2026-01-11T14:30:22Z
295
+ diagnostics:
296
+ model_requested: sonnet
297
+ model_actual: sonnet
298
+ context_type: forked # main or forked
299
+ parent_vars_accessible: false # Should be false for forked
300
+ hooks_fired:
301
+ - Stop
302
+ execution_time_ms: 4520
303
+ completion_status: success # success, error, timeout
304
+ notes: "Task completed successfully"
305
+ ```
306
+
307
+ ### Diagnostic Fields
308
+
309
+ | Field | Purpose | Values |
310
+ |-------|---------|--------|
311
+ | `model_requested` | Model specified in prompt | haiku, sonnet, opus |
312
+ | `model_actual` | Model that actually ran | haiku, sonnet, opus |
313
+ | `context_type` | Execution context | main, forked |
314
+ | `parent_vars_accessible` | Context isolation test | true, false |
315
+ | `hooks_fired` | Lifecycle hooks that executed | Array of hook names |
316
+ | `execution_time_ms` | Duration | Integer |
317
+ | `completion_status` | Final status | success, error, timeout |
318
+
319
+ ---
320
+
321
+ ## Quick Reference
322
+
323
+ ### Minimal Log Template
324
+
325
+ ```yaml
326
+ metadata:
327
+ agent: {name}
328
+ timestamp: {ISO-8601}
329
+ model: sonnet
330
+ task_id: "{id}"
331
+ duration_ms: 0
332
+
333
+ goal: "{goal}"
334
+
335
+ completion:
336
+ why:
337
+ problem: "{problem}"
338
+ root_cause: "{cause}"
339
+ solution: "{solution}"
340
+ what:
341
+ - file: {path}
342
+ lines: "{range}"
343
+ change: "{description}"
344
+ trade_offs:
345
+ gained: ["{benefit}"]
346
+ cost: ["{cost}"]
347
+ risks:
348
+ - risk: "{risk}"
349
+ mitigation: "{mitigation}"
350
+ severity: medium
351
+ next_steps:
352
+ - "{action}"
353
+
354
+ # Include for code-writing agents only (omit for read-only agents):
355
+ pipeline_suggestions:
356
+ - pipeline: "{pipeline name}"
357
+ target_files: ["{path}"]
358
+ reason: "{reason}"
359
+
360
+ summary: |
361
+ {100-300 token summary}
362
+
363
+ diagnostics:
364
+ model_requested: sonnet
365
+ model_actual: sonnet
366
+ context_type: forked
367
+ parent_vars_accessible: false
368
+ hooks_fired: []
369
+ execution_time_ms: 0
370
+ completion_status: success
371
+ ```
372
+
373
+ ### Summary Checklist
374
+
375
+ ```
376
+ [ ] Count and severity of findings stated
377
+ [ ] Actions taken described
378
+ [ ] Key risks mentioned
379
+ [ ] Next steps listed
380
+ [ ] Under 300 tokens
381
+ [ ] Pipeline suggestions with MANDATORY language (code-writing agents only)
382
+ ```
383
+
384
+ ### Output Location Checklist
385
+
386
+ ```
387
+ [ ] Main log: logs/{agent}-{YYYYMMDD-HHMMSS}.yaml
388
+ [ ] Diagnostics: logs/diagnostics/{agent}-{YYYYMMDD-HHMMSS}.yaml
389
+ ```
390
+
391
+ ---
392
+
393
+ ## Timestamp Formats
394
+
395
+ | Context | Placeholder | Format | Example |
396
+ |---------|-------------|--------|---------|
397
+ | **File paths** | `{YYYYMMDD-HHMMSS}` | Compact, filesystem-safe | `20260119-143022` |
398
+ | **YAML fields** | `{ISO-8601}` | Standard ISO format | `2026-01-19T14:30:22Z` |
399
+
400
+ **Why two formats?**
401
+ - File names: No colons (filesystem-safe on Windows), compact, lexically sortable
402
+ - YAML fields: Standard ISO-8601 for parsing and interoperability
403
+
404
+ **Important**: Always use `{YYYYMMDD-HHMMSS}` in file paths, never `{timestamp}` or `{ts}`.
405
+
406
+ ---
407
+
408
+ ## Related Skills
409
+
410
+ - **subagent-prompting** (P0.1): Defines INPUT structure (GOAL/CONSTRAINTS/CONTEXT/OUTPUT)
411
+ - **pipeline-templates** (P0.3): Pre-defined workflows that consume this output format
412
+
413
+ ---
414
+
415
+ ## References
416
+
417
+ For extended examples and edge cases, see `references/examples.md`.