@qball-inc/the-bulwark 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. package/.claude-plugin/plugin.json +43 -0
  2. package/agents/bulwark-fix-validator.md +633 -0
  3. package/agents/bulwark-implementer.md +391 -0
  4. package/agents/bulwark-issue-analyzer.md +308 -0
  5. package/agents/bulwark-standards-reviewer.md +221 -0
  6. package/agents/plan-creation-architect.md +323 -0
  7. package/agents/plan-creation-eng-lead.md +352 -0
  8. package/agents/plan-creation-po.md +300 -0
  9. package/agents/plan-creation-qa-critic.md +334 -0
  10. package/agents/product-ideation-competitive-analyzer.md +298 -0
  11. package/agents/product-ideation-idea-validator.md +268 -0
  12. package/agents/product-ideation-market-researcher.md +292 -0
  13. package/agents/product-ideation-pattern-documenter.md +308 -0
  14. package/agents/product-ideation-segment-analyzer.md +303 -0
  15. package/agents/product-ideation-strategist.md +259 -0
  16. package/agents/statusline-setup.md +97 -0
  17. package/hooks/hooks.json +59 -0
  18. package/package.json +45 -0
  19. package/scripts/hooks/cleanup-stale.sh +13 -0
  20. package/scripts/hooks/enforce-quality.sh +166 -0
  21. package/scripts/hooks/implementer-quality.sh +256 -0
  22. package/scripts/hooks/inject-protocol.sh +52 -0
  23. package/scripts/hooks/suggest-pipeline.sh +175 -0
  24. package/scripts/hooks/track-pipeline-start.sh +37 -0
  25. package/scripts/hooks/track-pipeline-stop.sh +52 -0
  26. package/scripts/init-rules.sh +35 -0
  27. package/scripts/init.sh +151 -0
  28. package/skills/anthropic-validator/SKILL.md +607 -0
  29. package/skills/anthropic-validator/references/agents-checklist.md +131 -0
  30. package/skills/anthropic-validator/references/commands-checklist.md +102 -0
  31. package/skills/anthropic-validator/references/hooks-checklist.md +151 -0
  32. package/skills/anthropic-validator/references/mcp-checklist.md +136 -0
  33. package/skills/anthropic-validator/references/plugins-checklist.md +148 -0
  34. package/skills/anthropic-validator/references/skills-checklist.md +85 -0
  35. package/skills/assertion-patterns/SKILL.md +296 -0
  36. package/skills/bug-magnet-data/SKILL.md +284 -0
  37. package/skills/bug-magnet-data/context/cli-args.md +91 -0
  38. package/skills/bug-magnet-data/context/db-query.md +104 -0
  39. package/skills/bug-magnet-data/context/file-contents.md +103 -0
  40. package/skills/bug-magnet-data/context/http-body.md +91 -0
  41. package/skills/bug-magnet-data/context/process-spawn.md +123 -0
  42. package/skills/bug-magnet-data/data/booleans/boundaries.yaml +143 -0
  43. package/skills/bug-magnet-data/data/collections/arrays.yaml +114 -0
  44. package/skills/bug-magnet-data/data/collections/objects.yaml +123 -0
  45. package/skills/bug-magnet-data/data/concurrency/race-conditions.yaml +118 -0
  46. package/skills/bug-magnet-data/data/concurrency/state-machines.yaml +115 -0
  47. package/skills/bug-magnet-data/data/dates/boundaries.yaml +137 -0
  48. package/skills/bug-magnet-data/data/dates/invalid.yaml +132 -0
  49. package/skills/bug-magnet-data/data/dates/timezone.yaml +118 -0
  50. package/skills/bug-magnet-data/data/encoding/charset.yaml +79 -0
  51. package/skills/bug-magnet-data/data/encoding/normalization.yaml +105 -0
  52. package/skills/bug-magnet-data/data/formats/email.yaml +154 -0
  53. package/skills/bug-magnet-data/data/formats/json.yaml +187 -0
  54. package/skills/bug-magnet-data/data/formats/url.yaml +165 -0
  55. package/skills/bug-magnet-data/data/language-specific/javascript.yaml +182 -0
  56. package/skills/bug-magnet-data/data/language-specific/python.yaml +174 -0
  57. package/skills/bug-magnet-data/data/language-specific/rust.yaml +148 -0
  58. package/skills/bug-magnet-data/data/numbers/boundaries.yaml +161 -0
  59. package/skills/bug-magnet-data/data/numbers/precision.yaml +89 -0
  60. package/skills/bug-magnet-data/data/numbers/special.yaml +69 -0
  61. package/skills/bug-magnet-data/data/strings/boundaries.yaml +109 -0
  62. package/skills/bug-magnet-data/data/strings/injection.yaml +208 -0
  63. package/skills/bug-magnet-data/data/strings/special-chars.yaml +190 -0
  64. package/skills/bug-magnet-data/data/strings/unicode.yaml +139 -0
  65. package/skills/bug-magnet-data/references/external-lists.md +115 -0
  66. package/skills/bulwark-brainstorm/SKILL.md +563 -0
  67. package/skills/bulwark-brainstorm/references/at-teammate-prompts.md +60 -0
  68. package/skills/bulwark-brainstorm/references/role-critical-analyst.md +78 -0
  69. package/skills/bulwark-brainstorm/references/role-development-lead.md +66 -0
  70. package/skills/bulwark-brainstorm/references/role-product-delivery-lead.md +79 -0
  71. package/skills/bulwark-brainstorm/references/role-product-manager.md +62 -0
  72. package/skills/bulwark-brainstorm/references/role-project-sme.md +59 -0
  73. package/skills/bulwark-brainstorm/references/role-technical-architect.md +66 -0
  74. package/skills/bulwark-research/SKILL.md +298 -0
  75. package/skills/bulwark-research/references/viewpoint-contrarian.md +63 -0
  76. package/skills/bulwark-research/references/viewpoint-direct-investigation.md +62 -0
  77. package/skills/bulwark-research/references/viewpoint-first-principles.md +65 -0
  78. package/skills/bulwark-research/references/viewpoint-practitioner.md +62 -0
  79. package/skills/bulwark-research/references/viewpoint-prior-art.md +66 -0
  80. package/skills/bulwark-scaffold/SKILL.md +330 -0
  81. package/skills/bulwark-statusline/SKILL.md +161 -0
  82. package/skills/bulwark-statusline/scripts/statusline.sh +144 -0
  83. package/skills/bulwark-verify/SKILL.md +519 -0
  84. package/skills/code-review/SKILL.md +428 -0
  85. package/skills/code-review/examples/anti-patterns/linting.ts +181 -0
  86. package/skills/code-review/examples/anti-patterns/security.ts +91 -0
  87. package/skills/code-review/examples/anti-patterns/standards.ts +195 -0
  88. package/skills/code-review/examples/anti-patterns/type-safety.ts +108 -0
  89. package/skills/code-review/examples/recommended/linting.ts +195 -0
  90. package/skills/code-review/examples/recommended/security.ts +154 -0
  91. package/skills/code-review/examples/recommended/standards.ts +231 -0
  92. package/skills/code-review/examples/recommended/type-safety.ts +181 -0
  93. package/skills/code-review/frameworks/angular.md +218 -0
  94. package/skills/code-review/frameworks/django.md +235 -0
  95. package/skills/code-review/frameworks/express.md +207 -0
  96. package/skills/code-review/frameworks/flask.md +298 -0
  97. package/skills/code-review/frameworks/generic.md +146 -0
  98. package/skills/code-review/frameworks/react.md +152 -0
  99. package/skills/code-review/frameworks/vue.md +244 -0
  100. package/skills/code-review/references/linting-patterns.md +221 -0
  101. package/skills/code-review/references/security-patterns.md +125 -0
  102. package/skills/code-review/references/standards-patterns.md +246 -0
  103. package/skills/code-review/references/type-safety-patterns.md +130 -0
  104. package/skills/component-patterns/SKILL.md +131 -0
  105. package/skills/component-patterns/references/pattern-cli-command.md +118 -0
  106. package/skills/component-patterns/references/pattern-database.md +166 -0
  107. package/skills/component-patterns/references/pattern-external-api.md +139 -0
  108. package/skills/component-patterns/references/pattern-file-parser.md +168 -0
  109. package/skills/component-patterns/references/pattern-http-server.md +162 -0
  110. package/skills/component-patterns/references/pattern-process-spawner.md +133 -0
  111. package/skills/continuous-feedback/SKILL.md +327 -0
  112. package/skills/continuous-feedback/references/collect-instructions.md +81 -0
  113. package/skills/continuous-feedback/references/specialize-code-review.md +82 -0
  114. package/skills/continuous-feedback/references/specialize-general.md +98 -0
  115. package/skills/continuous-feedback/references/specialize-test-audit.md +81 -0
  116. package/skills/create-skill/SKILL.md +359 -0
  117. package/skills/create-skill/references/agent-conventions.md +194 -0
  118. package/skills/create-skill/references/agent-template.md +195 -0
  119. package/skills/create-skill/references/content-guidance.md +291 -0
  120. package/skills/create-skill/references/decision-framework.md +124 -0
  121. package/skills/create-skill/references/template-pipeline.md +217 -0
  122. package/skills/create-skill/references/template-reference-heavy.md +111 -0
  123. package/skills/create-skill/references/template-research.md +210 -0
  124. package/skills/create-skill/references/template-script-driven.md +172 -0
  125. package/skills/create-skill/references/template-simple.md +80 -0
  126. package/skills/create-subagent/SKILL.md +353 -0
  127. package/skills/create-subagent/references/agent-conventions.md +268 -0
  128. package/skills/create-subagent/references/content-guidance.md +232 -0
  129. package/skills/create-subagent/references/decision-framework.md +134 -0
  130. package/skills/create-subagent/references/template-single-agent.md +192 -0
  131. package/skills/fix-bug/SKILL.md +241 -0
  132. package/skills/governance-protocol/SKILL.md +116 -0
  133. package/skills/init/SKILL.md +341 -0
  134. package/skills/issue-debugging/SKILL.md +385 -0
  135. package/skills/issue-debugging/references/anti-patterns.md +245 -0
  136. package/skills/issue-debugging/references/debug-report-schema.md +227 -0
  137. package/skills/mock-detection/SKILL.md +511 -0
  138. package/skills/mock-detection/references/false-positive-prevention.md +402 -0
  139. package/skills/mock-detection/references/stub-patterns.md +236 -0
  140. package/skills/pipeline-templates/SKILL.md +215 -0
  141. package/skills/pipeline-templates/references/code-change-workflow.md +277 -0
  142. package/skills/pipeline-templates/references/code-review.md +336 -0
  143. package/skills/pipeline-templates/references/fix-validation.md +421 -0
  144. package/skills/pipeline-templates/references/new-feature.md +335 -0
  145. package/skills/pipeline-templates/references/research-brainstorm.md +161 -0
  146. package/skills/pipeline-templates/references/research-planning.md +257 -0
  147. package/skills/pipeline-templates/references/test-audit.md +389 -0
  148. package/skills/pipeline-templates/references/test-execution-fix.md +238 -0
  149. package/skills/plan-creation/SKILL.md +497 -0
  150. package/skills/product-ideation/SKILL.md +372 -0
  151. package/skills/product-ideation/references/analysis-frameworks.md +161 -0
  152. package/skills/session-handoff/SKILL.md +139 -0
  153. package/skills/session-handoff/references/examples.md +223 -0
  154. package/skills/setup-lsp/SKILL.md +312 -0
  155. package/skills/setup-lsp/references/server-registry.md +85 -0
  156. package/skills/setup-lsp/references/troubleshooting.md +135 -0
  157. package/skills/subagent-output-templating/SKILL.md +415 -0
  158. package/skills/subagent-output-templating/references/examples.md +440 -0
  159. package/skills/subagent-prompting/SKILL.md +364 -0
  160. package/skills/subagent-prompting/references/examples.md +342 -0
  161. package/skills/test-audit/SKILL.md +531 -0
  162. package/skills/test-audit/references/known-limitations.md +41 -0
  163. package/skills/test-audit/references/priority-classification.md +30 -0
  164. package/skills/test-audit/references/prompts/deep-mode-detection.md +83 -0
  165. package/skills/test-audit/references/prompts/synthesis.md +57 -0
  166. package/skills/test-audit/references/rewrite-instructions.md +46 -0
  167. package/skills/test-audit/references/schemas/audit-output.yaml +100 -0
  168. package/skills/test-audit/references/schemas/diagnostic-output.yaml +49 -0
  169. package/skills/test-audit/scripts/data-flow-analyzer.ts +509 -0
  170. package/skills/test-audit/scripts/integration-mock-detector.ts +462 -0
  171. package/skills/test-audit/scripts/package.json +20 -0
  172. package/skills/test-audit/scripts/skip-detector.ts +211 -0
  173. package/skills/test-audit/scripts/verification-counter.ts +295 -0
  174. package/skills/test-classification/SKILL.md +310 -0
  175. package/skills/test-fixture-creation/SKILL.md +295 -0
@@ -0,0 +1,135 @@
1
+ # LSP Troubleshooting Reference
2
+
3
+ Reference data for diagnosing LSP configuration failures. Load this file during Stage 7 (Diagnostics) and whenever Stage 6 verification fails.
4
+
5
+ ---
6
+
7
+ ## Common Issues
8
+
9
+ Work through issues in the order listed. Stop at the first issue that is detected and apply the fix before continuing.
10
+
11
+ | # | Issue | Detection Method | Fix Procedure |
12
+ |---|-------|-----------------|---------------|
13
+ | 1 | `ENABLE_LSP_TOOL` not set | Run `echo $ENABLE_LSP_TOOL`. If output is empty or not `1`, flag is missing. | Add `export ENABLE_LSP_TOOL=1` to shell profile (`~/.bashrc` or `~/.zshrc`). Also set the key in `~/.claude/settings.json`. Then exit and resume session. |
14
+ | 2 | Plugin not installed | Check `/plugin` Installed tab or run `claude plugin list` from a separate terminal. If plugin name is absent, plugin was not installed. | Tell user to install the plugin: type `/plugin`, search for the plugin name, and install it. Or from a separate terminal: `claude plugin install {plugin-name}`. |
15
+ | 3 | Plugin installed but not enabled | Check `/plugin` Installed tab. If plugin appears but status is not "enabled", plugin is installed but inactive. | Tell user to enable the plugin: type `/plugin`, find the plugin, and enable it. Or from a separate terminal: `claude plugin enable {plugin-name}`. |
16
+ | 4 | Debug log shows 0 servers loaded | Run `cat ~/.claude/debug/latest` and search for `Total LSP servers loaded`. If value is 0, servers did not initialize. | Confirm issues 1-3 are resolved. Tell user to exit Claude Code fully and resume the session. Check log again after resume — async loading race means first post-install resume sometimes fails. A second exit+resume resolves it. |
17
+ | 5 | Server binary not in PATH | Run `which {binary-name}` (e.g., `which typescript-language-server`). If not found, binary is not installed or not in PATH. | Install the binary using the command from `references/server-registry.md`. If installed but not in PATH, add the install location to PATH in shell profile. |
18
+
19
+ ---
20
+
21
+ ## Known Behaviors (Not Defects)
22
+
23
+ ### Java JVM Warmup Delay
24
+
25
+ The `jdtls` server (Java) takes approximately 8 seconds to initialize due to JVM startup overhead. This is normal. Other servers typically initialize in 0.5-0.6 seconds.
26
+
27
+ If the debug log shows `Total LSP servers loaded: N` where N is less than expected and Java is one of the detected languages:
28
+ - Wait 10-15 seconds after session resume.
29
+ - Re-read `~/.claude/debug/latest`.
30
+ - jdtls should appear once JVM warmup completes.
31
+
32
+ Do not treat slow jdtls initialization as a failure unless it is absent after 20 seconds.
33
+
34
+ ### Async Loading Race on First Post-Install Resume
35
+
36
+ After a fresh plugin install, the first session resume may show `Total LSP servers loaded: 0` even when configuration is correct. This is a known async loading race condition (community issue #10997).
37
+
38
+ Detection: Configuration looks correct (issues 1-3 resolved), but first resume still shows 0 servers.
39
+
40
+ Fix: Exit Claude Code and resume again. A second exit+resume consistently resolves this race.
41
+
42
+ ### "Executable not found in $PATH" in Plugin Errors Tab
43
+
44
+ LSP plugins configure how Claude Code connects to a language server, but they don't include the server binary itself. If you see this error in the `/plugin` Errors tab, the binary needs to be installed separately (see server-registry.md for install commands).
45
+
46
+ ---
47
+
48
+ ## Debug Log Inspection
49
+
50
+ The debug log is the primary diagnostic source for LSP initialization.
51
+
52
+ **Log location:**
53
+ ```
54
+ ~/.claude/debug/latest
55
+ ```
56
+
57
+ **Key lines to search for:**
58
+
59
+ | Line Pattern | Meaning |
60
+ |--------------|---------|
61
+ | `Total LSP servers loaded: N` | N servers initialized successfully. N=0 means none loaded. |
62
+ | `Initializing LSP server: {name}` | Server startup was attempted for this plugin. |
63
+ | `LSP server {name} failed: {reason}` | Server startup was attempted but failed. Reason indicates root cause. |
64
+ | `Plugin {name} enabled` | Plugin was found in enabled state at startup. |
65
+ | `ENABLE_LSP_TOOL not set` | The environment flag is missing. Fix issue #1. |
66
+ | `Executable not found in $PATH` | Language server binary is not installed. Fix issue #5. |
67
+
68
+ **Useful search commands:**
69
+ ```bash
70
+ # Check total servers loaded
71
+ grep "Total LSP servers" ~/.claude/debug/latest
72
+
73
+ # Check for any LSP-related log lines
74
+ grep -i "lsp" ~/.claude/debug/latest
75
+
76
+ # Check for plugin loading
77
+ grep "Plugin" ~/.claude/debug/latest
78
+
79
+ # Check for failures
80
+ grep -i "failed\|error" ~/.claude/debug/latest
81
+ ```
82
+
83
+ ---
84
+
85
+ ## ENABLE_LSP_TOOL Verification
86
+
87
+ `ENABLE_LSP_TOOL` is an undocumented flag required for LSP tool activation, discovered via community report (#15619). It must be set in two places:
88
+
89
+ **1. Shell profile** (persists across terminal sessions):
90
+ ```bash
91
+ # In ~/.bashrc or ~/.zshrc
92
+ export ENABLE_LSP_TOOL=1
93
+ ```
94
+
95
+ **2. `~/.claude/settings.json`** (read by Claude Code at startup):
96
+ ```json
97
+ {
98
+ "ENABLE_LSP_TOOL": "1"
99
+ }
100
+ ```
101
+
102
+ To verify both locations are configured:
103
+ ```bash
104
+ # Check shell profile
105
+ grep "ENABLE_LSP_TOOL" ~/.bashrc ~/.zshrc 2>/dev/null
106
+
107
+ # Check settings.json
108
+ grep "ENABLE_LSP_TOOL" ~/.claude/settings.json
109
+ ```
110
+
111
+ Both must return a match with value `1`. If either is missing, fix and exit+resume.
112
+
113
+ ---
114
+
115
+ ## enabledPlugins Format
116
+
117
+ The `enabledPlugins` field in `~/.claude/settings.json` uses an object format with marketplace-qualified names:
118
+
119
+ ```json
120
+ {
121
+ "ENABLE_LSP_TOOL": "1",
122
+ "enabledPlugins": {
123
+ "typescript-lsp@claude-plugins-official": true,
124
+ "pyright-lsp@claude-plugins-official": true
125
+ }
126
+ }
127
+ ```
128
+
129
+ **Common mistakes:**
130
+ - Using binary names instead of plugin names (e.g., `typescript-language-server` instead of `typescript-lsp`)
131
+ - Using an array format instead of object format
132
+ - Omitting the `@claude-plugins-official` marketplace qualifier
133
+ - Adding entries manually instead of letting `claude plugin install/enable` manage them
134
+
135
+ **Best practice:** Let the `claude plugin install` and `claude plugin enable` commands manage `enabledPlugins` entries. Manual editing should only be used for troubleshooting.
@@ -0,0 +1,415 @@
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`.