@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,133 @@
1
+ # Pattern 4: Process Spawner Verification
2
+
3
+ ## Strategy
4
+
5
+ Spawn process, verify it's running (check port/pid), verify behavior, cleanup.
6
+
7
+ ---
8
+
9
+ ## Template (Bash)
10
+
11
+ ```bash
12
+ #!/bin/bash
13
+ # Process Spawner Verification: {component_name}
14
+ set -e
15
+
16
+ echo "=== Process Spawner Verification: {component_name} ==="
17
+
18
+ # Spawn process
19
+ {spawn_command} &
20
+ PROC_PID=$!
21
+ echo "Spawned process (PID: $PROC_PID)"
22
+
23
+ # Cleanup trap
24
+ cleanup() {
25
+ echo "Cleaning up..."
26
+ kill $PROC_PID 2>/dev/null || true
27
+ wait $PROC_PID 2>/dev/null || true
28
+ }
29
+ trap cleanup EXIT
30
+
31
+ sleep 2 # Wait for startup
32
+
33
+ # Test 1: Process is running
34
+ echo -n "Test 1: Process running... "
35
+ if kill -0 $PROC_PID 2>/dev/null; then
36
+ echo "PASS (PID $PROC_PID alive)"
37
+ else
38
+ echo "FAIL (process not running)"
39
+ exit 1
40
+ fi
41
+
42
+ # Test 2: Port is open (if applicable)
43
+ echo -n "Test 2: Port {port} open... "
44
+ if nc -z localhost {port} 2>/dev/null; then
45
+ echo "PASS"
46
+ else
47
+ echo "FAIL"
48
+ exit 1
49
+ fi
50
+
51
+ # Test 3: Process responds correctly
52
+ echo -n "Test 3: Process responds... "
53
+ RESPONSE=$({verification_command})
54
+ if echo "$RESPONSE" | grep -q "{expected_pattern}"; then
55
+ echo "PASS"
56
+ else
57
+ echo "FAIL (expected pattern: {expected_pattern}, got: $RESPONSE)"
58
+ exit 1
59
+ fi
60
+
61
+ echo "=== All tests passed ==="
62
+ ```
63
+
64
+ ---
65
+
66
+ ## Template (Node/Jest)
67
+
68
+ ```javascript
69
+ const { spawn, execSync } = require('child_process');
70
+ const net = require('net');
71
+
72
+ function waitForPort(port, timeout = 5000) {
73
+ return new Promise((resolve, reject) => {
74
+ const start = Date.now();
75
+ const check = () => {
76
+ const socket = new net.Socket();
77
+ socket.setTimeout(100);
78
+ socket.on('connect', () => {
79
+ socket.destroy();
80
+ resolve(true);
81
+ });
82
+ socket.on('error', () => {
83
+ socket.destroy();
84
+ if (Date.now() - start > timeout) reject(new Error('Timeout'));
85
+ else setTimeout(check, 100);
86
+ });
87
+ socket.connect(port, 'localhost');
88
+ };
89
+ check();
90
+ });
91
+ }
92
+
93
+ describe('{component_name} Process', () => {
94
+ let proc;
95
+
96
+ beforeAll(async () => {
97
+ proc = spawn('{spawn_command}', [], { detached: true });
98
+ await waitForPort({port});
99
+ });
100
+
101
+ afterAll(() => {
102
+ if (proc) {
103
+ process.kill(-proc.pid);
104
+ }
105
+ });
106
+
107
+ test('process is running', () => {
108
+ expect(proc.pid).toBeDefined();
109
+ expect(() => process.kill(proc.pid, 0)).not.toThrow();
110
+ });
111
+
112
+ test('port is open', async () => {
113
+ await expect(waitForPort({port}, 1000)).resolves.toBe(true);
114
+ });
115
+
116
+ test('responds correctly', () => {
117
+ const output = execSync('{verification_command}', { encoding: 'utf8' });
118
+ expect(output).toContain('{expected_pattern}');
119
+ });
120
+ });
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Placeholders
126
+
127
+ | Placeholder | Description |
128
+ |-------------|-------------|
129
+ | `{component_name}` | Name of the process spawner component |
130
+ | `{spawn_command}` | Command to spawn the process |
131
+ | `{port}` | Port the process listens on (if applicable) |
132
+ | `{verification_command}` | Command to verify process behavior |
133
+ | `{expected_pattern}` | Expected pattern in response |
@@ -0,0 +1,327 @@
1
+ ---
2
+ name: continuous-feedback
3
+ description: Identifies improvement targets from accumulated session learnings and proposes concrete skill/agent modifications. General-purpose pipeline for any Claude Code project.
4
+ user-invocable: true
5
+ argument-hint: "<target-skill-or-path> [--sources <paths>] [--since <session-N>]"
6
+ skills:
7
+ - subagent-prompting
8
+ ---
9
+
10
+ # Continuous Feedback
11
+
12
+ Analyzes accumulated session handoffs, memory files, and other learning sources to identify concrete improvement opportunities for skills and agents. Spawns a Collector, 1-3 specialized Analyzers (parallel), and a Proposer — then validates and annotates proposals for user review.
13
+
14
+ ---
15
+
16
+ ## When to Use This Skill
17
+
18
+ **Load this skill when the user request matches ANY of these patterns:**
19
+
20
+ | Trigger Pattern | Example User Request |
21
+ |-----------------|---------------------|
22
+ | Skill improvement | "What improvements can we make to test-audit?", "Evolve code-review" |
23
+ | Session learning harvest | "What have we learned across sessions?", "Harvest learnings" |
24
+ | Feedback loop | "Run continuous feedback on X", "Analyze our session learnings" |
25
+ | Retrospective | "What patterns have emerged?", "Review accumulated experience" |
26
+
27
+ **DO NOT use for:**
28
+ - Initial topic research (use `bulwark-research`)
29
+ - Brainstorming new features (use `bulwark-brainstorm`)
30
+ - Code review (use `code-review`)
31
+ - Debugging (use `issue-debugging`)
32
+
33
+ ---
34
+
35
+ ## Dependencies
36
+
37
+ | Category | Files | Requirement | When to Load |
38
+ |----------|-------|-------------|--------------|
39
+ | **Collect instructions** | `references/collect-instructions.md` | **REQUIRED** | Include in Collector prompt |
40
+ | **Specialization references** | `references/specialize-*.md` | **REQUIRED** | Load matching specializations for Analyzers |
41
+ | **Collect output template** | `templates/collect-output.md` | **REQUIRED** | Include in Collector prompt |
42
+ | **Proposal output template** | `templates/proposal-output.md` | **REQUIRED** | Include in Proposer prompt |
43
+ | **Diagnostic template** | `templates/diagnostic-output.yaml` | **REQUIRED** | Use when writing diagnostics |
44
+ | **Subagent prompting** | `subagent-prompting` skill | **REQUIRED** | Load at Stage 0 for 4-part prompt template |
45
+
46
+ **Fallback behavior:**
47
+ - If a specialization reference is missing: Skip that specialization, always run general Analyzer, note in diagnostics
48
+ - If output template is missing: Use the schemas from this SKILL.md directly
49
+
50
+ ---
51
+
52
+ ## Usage
53
+
54
+ ```
55
+ /continuous-feedback <target-skill-or-path> [--sources <paths>] [--since <session-N>]
56
+ ```
57
+
58
+ **Arguments:**
59
+ - `<target-skill-or-path>` — Target skill name (e.g., `test-audit`) or path to a skill directory. If a directory containing multiple skills, analyze all detected skill types.
60
+ - `--sources <paths>` — Custom input source paths (files or directories). Overrides default input sources.
61
+ - `--since <session-N>` — Only collect learnings from session N onwards. Default: last 10 sessions.
62
+
63
+ **Examples:**
64
+ - `/continuous-feedback test-audit` — Analyze learnings for the test-audit skill
65
+ - `/continuous-feedback test-audit --since session-50` — Only learnings from session 50 onwards
66
+ - `/continuous-feedback skills/code-review/ --sources logs/research/` — Custom input sources
67
+ - `/continuous-feedback .claude/skills/` — Analyze all skills in the directory
68
+
69
+ ---
70
+
71
+ ## Stages
72
+
73
+ ### Stage 0: Pre-Flight (Orchestrator)
74
+
75
+ ```
76
+ Stage 0: Pre-Flight
77
+ ├── Parse arguments (target, --sources, --since)
78
+ ├── Resolve target: skill name → skill directory path
79
+ │ ├── Check skills/{name}/ first
80
+ │ ├── Then .claude/skills/{name}/
81
+ │ └── If raw path provided, use directly
82
+ ├── Verify Pre-Flight Gate (see below)
83
+ ├── Resolve input sources (default or custom)
84
+ ├── Determine specializations: read target's SKILL.md to detect skill type
85
+ ├── Slugify target for output directory
86
+ ├── Create output directory: logs/continuous-feedback/{run-slug}/
87
+ ├── Load subagent-prompting skill
88
+ ├── Load references/collect-instructions.md
89
+ ├── Load matching references/specialize-*.md files
90
+ ├── AskUserQuestion if target is ambiguous or inputs are unclear
91
+ └── Token budget check (warn if >30% consumed)
92
+ ```
93
+
94
+ #### Pre-Flight Gate
95
+
96
+ **MANDATORY** — These checks MUST pass before proceeding. Do NOT skip.
97
+
98
+ | Check | Condition | Failure Action |
99
+ |-------|-----------|----------------|
100
+ | Session handoff threshold | ≥5 session handoffs exist in the input scope | STOP: "Insufficient input data. Need at least 5 session handoffs. Found {N}." |
101
+ | Target path exists | Target path exists and contains readable files | STOP: "Target path does not exist: {path}" |
102
+ | Target is identifiable | Can determine what kind of skill/asset the target is | AskUserQuestion: "Could not determine target type. What kind of skill is {target}?" |
103
+
104
+ #### Default Input Sources
105
+
106
+ When `--sources` is NOT provided, use these defaults:
107
+
108
+ 1. `sessions/*.md` — Session handoff files (windowed by `--since`, default: last 10)
109
+ 2. Project MEMORY.md — Always read in full (curated summary, not windowed)
110
+ 3. `.claude/agent-memory/*/MEMORY.md` — Agent memory files when available
111
+
112
+ ### Stage 1: Collect (Sonnet sub-agent, sequential)
113
+
114
+ ```
115
+ Stage 1: Collect
116
+ ├── Construct prompt using 4-part template (GOAL/CONSTRAINTS/CONTEXT/OUTPUT)
117
+ │ ├── GOAL: Parse input sources and extract learning items with source
118
+ │ │ attribution and LLM-classified skill_relevance tags
119
+ │ ├── CONSTRAINTS:
120
+ │ │ ├── Use Grep to locate section headers, Read with offsets for targeted extraction
121
+ │ │ ├── Preserve full learning content (pass-through, no lossy compression)
122
+ │ │ ├── Assign skill_relevance via LLM classification (NOT keyword matching)
123
+ │ │ ├── Each item MUST have: id, source, section, category, skill_relevance, content
124
+ │ │ └── Target 1000-2000 words depending on input volume
125
+ │ ├── CONTEXT:
126
+ │ │ ├── Input file paths (resolved session handoffs, memory files, custom paths)
127
+ │ │ ├── Parsing rules from references/collect-instructions.md
128
+ │ │ └── Collect output template from templates/collect-output.md
129
+ │ └── OUTPUT: logs/continuous-feedback/{run-slug}/01-collect.md
130
+ ├── Spawn general-purpose Sonnet agent
131
+ ├── Read Collector output
132
+ ├── Verify output is non-empty (see Error Handling)
133
+ ├── Extract skill_types_detected from Collector YAML header
134
+ └── Token budget check
135
+ ```
136
+
137
+ **Pass-through schema**: The Collector groups and tags learning items but preserves near-raw content. Each item includes:
138
+
139
+ ```yaml
140
+ - id: L001
141
+ source: "session_45_20260208.md"
142
+ section: "Learnings"
143
+ category: "defect-pattern" # defect-pattern | architecture-decision | framework-observation | workflow-improvement | tool-behavior
144
+ skill_relevance: ["test-audit", "code-review"] # LLM-classified
145
+ content: |
146
+ Full learning text preserved with surrounding context.
147
+ No lossy compression — Analyzers handle interpretation.
148
+ ```
149
+
150
+ ### Stage 2: Analyze (1-3 Sonnet sub-agents, parallel)
151
+
152
+ ```
153
+ Stage 2: Analyze
154
+ ├── Read Collector output (01-collect.md)
155
+ ├── Determine Analyzer count from skill_types_detected:
156
+ │ ├── If "test-audit" in detected types → load specialize-test-audit.md
157
+ │ ├── If "code-review" in detected types → load specialize-code-review.md
158
+ │ └── ALWAYS spawn general Analyzer with specialize-general.md
159
+ ├── For each Analyzer, construct prompt using 4-part template:
160
+ │ ├── GOAL: Analyze collected learnings through {specialization} lens and
161
+ │ │ identify concrete improvements for the target skill
162
+ │ ├── CONSTRAINTS:
163
+ │ │ ├── Only analyze items matching your specialization (filtered by skill_relevance)
164
+ │ │ ├── General Analyzer: also process items not fully covered by other Analyzers
165
+ │ │ ├── Read the target skill's current files to avoid proposing existing content
166
+ │ │ ├── For each improvement: what was learned, what it affects, proposed change, priority, evidence
167
+ │ │ └── Target 800-1200 words
168
+ │ ├── CONTEXT:
169
+ │ │ ├── Collector output (01-collect.md)
170
+ │ │ ├── Specialization reference (references/specialize-{type}.md)
171
+ │ │ └── Target skill path for autonomous exploration
172
+ │ └── OUTPUT: logs/continuous-feedback/{run-slug}/02-analyze-{specialization}.md
173
+ ├── Spawn all Analyzers in parallel (single message, multiple Task calls)
174
+ ├── Read all Analyzer outputs
175
+ └── Token budget check (checkpoint if >55%)
176
+ ```
177
+
178
+ **CRITICAL**: Spawn all Analyzers in a single message with N Task tool calls. Do NOT spawn sequentially.
179
+
180
+ **Dynamic spawning**: The number of Analyzers is data-driven (1-3). If collected learnings only match test-audit and general, only 2 Analyzers spawn. The general Analyzer ALWAYS runs.
181
+
182
+ ### Stage 3: Act/Propose (Sonnet sub-agent, sequential)
183
+
184
+ ```
185
+ Stage 3: Act
186
+ ├── Construct prompt using 4-part template:
187
+ │ ├── GOAL: Synthesize all analyses into concrete, copy-paste-ready change
188
+ │ │ proposals for the target skill
189
+ │ ├── CONSTRAINTS:
190
+ │ │ ├── Every proposal MUST have all mandatory fields (see proposal template)
191
+ │ │ ├── Proposed content MUST be copy-paste ready — specific enough to apply
192
+ │ │ │ without interpretation
193
+ │ │ ├── "Improve X" is a FAILURE. "Add the following pattern to {file} under
194
+ │ │ │ {section}: [specific content]" is SUCCESS
195
+ │ │ ├── Read target skill's current files to avoid stale proposals
196
+ │ │ ├── Skip proposals for content that already exists in the target
197
+ │ │ ├── Deduplicate across analyses — merge overlapping improvements
198
+ │ │ └── Target 1500-2500 words
199
+ │ ├── CONTEXT:
200
+ │ │ ├── All Analyzer outputs (02-analyze-*.md files)
201
+ │ │ ├── Proposal output template from templates/proposal-output.md
202
+ │ │ └── Target skill path for autonomous exploration
203
+ │ └── OUTPUT: logs/continuous-feedback/{run-slug}/03-proposal.md
204
+ ├── Spawn general-purpose Sonnet agent
205
+ ├── Read Proposer output
206
+ ├── Verify proposals have mandatory fields (see Error Handling)
207
+ └── Token budget check
208
+ ```
209
+
210
+ **Proposal mandatory fields** (each proposed change):
211
+
212
+ | Field | Required | Description |
213
+ |-------|----------|-------------|
214
+ | Target | YES | Exact file path |
215
+ | Change type | YES | Add / Modify / Remove |
216
+ | Section | YES | Target section within file, or "New section" |
217
+ | Priority | YES | High / Medium / Low |
218
+ | Source learnings | YES | L-IDs and session/memory references |
219
+ | Proposed content | YES | Copy-paste ready text |
220
+ | Rationale | YES | Why this improves the skill, traced to learning items |
221
+ | Validation | YES | How to verify the change works |
222
+
223
+ ### Stage 4: Validate (Orchestrator, no sub-agent)
224
+
225
+ ```
226
+ Stage 4: Validate
227
+ ├── Read proposal document (03-proposal.md)
228
+ ├── For each proposed change:
229
+ │ ├── If targeting a skill asset (.md in skills/ or .claude/skills/):
230
+ │ │ └── Annotate: "Run /anthropic-validator on {target} after applying"
231
+ │ ├── If targeting a code file (.ts, .js, .sh, etc.):
232
+ │ │ └── Annotate: "Run just typecheck && just lint && just test after applying"
233
+ │ └── If targeting configuration:
234
+ │ └── Annotate: "Verify configuration is valid and reload"
235
+ ├── Write validation notes to logs/continuous-feedback/{run-slug}/04-validation.md
236
+ └── Present proposals to user with validation annotations
237
+ ```
238
+
239
+ **Design note**: Stage 4 does NOT run validators on proposals (proposals are not applied yet). It annotates each proposal with the appropriate validation steps the user should run after applying.
240
+
241
+ ### Stage 5: Diagnostics (REQUIRED)
242
+
243
+ ```
244
+ Stage 5: Diagnostics
245
+ ├── Write diagnostic YAML to logs/diagnostics/continuous-feedback-{YYYYMMDD-HHMMSS}.yaml
246
+ │ └── Use templates/diagnostic-output.yaml schema
247
+ └── Verify completion checklist
248
+ ```
249
+
250
+ ---
251
+
252
+ ## Execution Flow (F# Pipeline)
253
+
254
+ ```fsharp
255
+ // continuous-feedback pipeline
256
+ PreFlight(args, inputs) // Stage 0: Orchestrator
257
+ |> Collector(sessions, memory, custom) // Stage 1: Sonnet, sequential
258
+ |> [Analyzer(test-audit), Analyzer(code-review), Analyzer(general)] // Stage 2: Sonnet, parallel (dynamic 1-3)
259
+ |> Proposer(all_analyses, target_skills) // Stage 3: Sonnet, sequential
260
+ |> Validate(proposal) // Stage 4: Orchestrator, no sub-agent
261
+ ```
262
+
263
+ ---
264
+
265
+ ## Token Budget Management
266
+
267
+ | Checkpoint | Threshold | Action |
268
+ |------------|-----------|--------|
269
+ | After Pre-Flight | >30% consumed | Warn user: "Pipeline agents will consume significant context" |
270
+ | After Collector output read | Running tally | If approaching 45%, checkpoint with user |
271
+ | After all Analyzers complete | Running tally | If approaching 55%, checkpoint with user |
272
+ | After Proposer output read | Must be <65% | Leave room for validation + diagnostics |
273
+ | Pipeline complete at >65% | Immediate | Write diagnostics, do not start additional work |
274
+
275
+ If token budget is insufficient to complete the full pipeline, inform the user and suggest: "Collector + Analyzers this session, Proposer + validation next session."
276
+
277
+ ---
278
+
279
+ ## Error Handling
280
+
281
+ | Scenario | Action |
282
+ |----------|--------|
283
+ | Collector returns empty output | Re-spawn once with reinforced extraction instructions. If still empty, STOP — cannot proceed without collected learnings. |
284
+ | Collector returns truncated output | Accept as-is, note in diagnostics. |
285
+ | Analyzer returns empty output | Re-spawn once. If still empty, skip that specialization, document gap. |
286
+ | Proposer returns empty/vague output | Re-spawn once with reinforced specificity instructions. If still vague, document in diagnostics. |
287
+ | Proposer proposals missing mandatory fields | Re-spawn once with explicit field checklist. If still incomplete, document in diagnostics. |
288
+ | Token budget exceeded mid-pipeline | Stop spawning, write partial results, note incomplete in diagnostics. |
289
+ | No learnings match a specialization | Do not spawn that Analyzer. Document in diagnostics. |
290
+ | Fewer than 5 session handoffs | Pre-Flight Gate blocks. Inform user. |
291
+ | Target path does not exist | Pre-Flight Gate blocks. Inform user. |
292
+
293
+ ---
294
+
295
+ ## Diagnostic Output (REQUIRED)
296
+
297
+ **MANDATORY**: You MUST write diagnostic output after every invocation. This is Stage 5 and cannot be skipped.
298
+
299
+ Write to: `logs/diagnostics/continuous-feedback-{YYYYMMDD-HHMMSS}.yaml`
300
+
301
+ **Template**: Use `templates/diagnostic-output.yaml` for the schema. Fill in actual values from the session.
302
+
303
+ ---
304
+
305
+ ## Completion Checklist
306
+
307
+ **IMPORTANT**: Before returning to the user, verify ALL items are complete:
308
+
309
+ - [ ] Stage 0: Pre-Flight Gate passed (≥5 session handoffs, target exists)
310
+ - [ ] Stage 0: Arguments parsed (target, --since, --sources)
311
+ - [ ] Stage 0: Output directory created at `logs/continuous-feedback/{run-slug}/`
312
+ - [ ] Stage 0: subagent-prompting skill loaded
313
+ - [ ] Stage 0: AskUserQuestion used if target was ambiguous
314
+ - [ ] Stage 1: Collector spawned (Sonnet) and output read
315
+ - [ ] Stage 1: Collector output is non-empty with learning items
316
+ - [ ] Stage 2: Correct number of Analyzers spawned (1-3, based on detected skill types)
317
+ - [ ] Stage 2: All Analyzers spawned in parallel (single message)
318
+ - [ ] Stage 2: General Analyzer always included
319
+ - [ ] Stage 2: All Analyzer outputs read
320
+ - [ ] Stage 3: Proposer spawned (Sonnet) and output read
321
+ - [ ] Stage 3: All proposals have mandatory fields (target, change_type, section, proposed_content, rationale, validation)
322
+ - [ ] Stage 3: Proposals are copy-paste ready (not vague recommendations)
323
+ - [ ] Stage 4: Validation annotations written to `logs/continuous-feedback/{run-slug}/04-validation.md`
324
+ - [ ] Stage 4: Proposals presented to user with validation steps
325
+ - [ ] Stage 5: Diagnostic YAML written to `logs/diagnostics/`
326
+
327
+ **Do NOT return to user until all checkboxes can be marked complete.**
@@ -0,0 +1,81 @@
1
+ # Collection Instructions
2
+
3
+ These instructions guide the Collector sub-agent on how to parse input sources and extract learning items.
4
+
5
+ ## Input Sources
6
+
7
+ ### Session Handoffs (`sessions/*.md`)
8
+
9
+ Session handoff files follow a consistent structure. Extract learning items from these sections:
10
+
11
+ | Section Header | What to Extract | Category Mapping |
12
+ |----------------|-----------------|------------------|
13
+ | `## Learnings` | Bullet points describing what was learned | defect-pattern, workflow-improvement, tool-behavior |
14
+ | `## Technical Decisions` | Design choices with rationale | architecture-decision |
15
+ | `## Blockers / Issues` | Problems encountered and resolutions | defect-pattern, framework-observation |
16
+ | `## What Was Accomplished` | Completed work items (extract patterns, not status) | workflow-improvement |
17
+ | `## Verification Status` | Test/validation outcomes revealing gaps | defect-pattern |
18
+
19
+ **Parsing approach:**
20
+ 1. Use Grep to locate section headers (`^## Learnings`, `^## Technical Decisions`, etc.)
21
+ 2. Use Read with offsets to extract content between section headers
22
+ 3. Each bullet point or decision block becomes one learning item
23
+ 4. Preserve the full text of each item including surrounding context sentences
24
+
25
+ **Session windowing:** When `--since` is specified, only process session files with session number >= N. Session number is extracted from filename: `session_{N}_*.md`.
26
+
27
+ ### Project MEMORY.md
28
+
29
+ MEMORY.md is a curated summary that persists across sessions. Extract from these sections:
30
+
31
+ | Section Header | What to Extract | Category Mapping |
32
+ |----------------|-----------------|------------------|
33
+ | `## Defects & Lessons Learned` | Defect patterns and their fixes | defect-pattern |
34
+ | `## Architecture Decisions` | Design choices | architecture-decision |
35
+ | `## Framework Observations` | Platform behaviors | framework-observation |
36
+ | `## Critical Findings` | Cross-cutting discoveries | defect-pattern, tool-behavior |
37
+ | `## Hook Behavior` | Hook system behaviors | framework-observation, tool-behavior |
38
+ | `## Key Patterns` | Workflow conventions | workflow-improvement |
39
+
40
+ **Parsing approach:**
41
+ 1. Read MEMORY.md in full (it's curated and concise)
42
+ 2. Each bold-prefixed bullet (e.g., `**DEF-P4-005**:`) is one learning item
43
+ 3. Preserve the full text including any sub-bullets
44
+
45
+ ### Agent Memory Files (`.claude/agent-memory/*/MEMORY.md`)
46
+
47
+ When available, these contain agent-specific learnings. Parse using the same approach as project MEMORY.md.
48
+
49
+ ### Custom Paths (`--sources`)
50
+
51
+ When custom paths are provided:
52
+ 1. If path is a file: read and extract any structured learning content
53
+ 2. If path is a directory: scan for `.md` files and apply session handoff parsing rules
54
+ 3. Look for the same section headers as session handoffs
55
+ 4. If no recognized headers found, treat entire file content as a single learning item with category "workflow-improvement"
56
+
57
+ ## Skill Relevance Classification
58
+
59
+ After extracting each learning item, classify which skills it could improve. This is an LLM judgment task, not keyword matching.
60
+
61
+ ### Classification Guidelines
62
+
63
+ | Skill Type | Indicators in Content |
64
+ |------------|----------------------|
65
+ | test-audit | Mock detection, test classification, assertion patterns, AST analysis, T1-T4 rules, test mode selection, verification line counting |
66
+ | code-review | Security patterns, review lenses, pipeline stages, coding standards, OWASP, type safety, framework conventions |
67
+ | general | Skill authoring, prompt engineering, sub-agent behavior, workflow patterns, hook behavior, configuration, frontmatter, token management |
68
+
69
+ **Multi-tag rule**: A learning item may be relevant to multiple skills. Assign all applicable tags. When uncertain, include "general" as a fallback.
70
+
71
+ **Do NOT use keyword matching.** The sentence "Mock return values used as literal inputs violate T3" is relevant to `test-audit` even though it doesn't contain the word "test-audit". Classify based on what the learning would improve, not which words appear in it.
72
+
73
+ ## Output Requirements
74
+
75
+ 1. Write output to the path specified in the GOAL
76
+ 2. Use the collect-output template structure
77
+ 3. Assign sequential IDs (L001, L002, ...) to each item
78
+ 4. Group items by source file for readability
79
+ 5. Include the YAML header with counts and detected skill types
80
+ 6. If a source file has no extractable learnings, skip it silently
81
+ 7. If total items extracted is 0, write an output file stating "No learning items found in scanned sources" — the orchestrator will handle the empty result
@@ -0,0 +1,82 @@
1
+ # Specialization: Code Review
2
+
3
+ This reference guides the code-review Analyzer on what improvement patterns to look for in collected learnings.
4
+
5
+ ## Target Skill Structure
6
+
7
+ The code-review skill (`skills/code-review/` or `.claude/skills/code-review/`) typically contains:
8
+
9
+ | Component | Purpose |
10
+ |-----------|---------|
11
+ | `SKILL.md` | Main skill document with 3-phase pipeline (static tools, LLM judgment, diagnostic log) |
12
+ | `references/security-patterns.md` | Security vulnerability detection patterns (OWASP, injection, etc.) |
13
+ | `references/type-safety-patterns.md` | Type safety review patterns |
14
+ | `references/coding-standards.md` | Coding standards enforcement patterns |
15
+ | `references/framework-patterns.md` | Framework-specific review patterns |
16
+
17
+ ## What to Look For
18
+
19
+ ### Security Pattern Gaps
20
+
21
+ Learnings that reveal security patterns not currently covered:
22
+
23
+ - New vulnerability types encountered during code review or debugging
24
+ - OWASP patterns missing from security references
25
+ - Framework-specific security concerns (e.g., WSL path traversal, CRLF injection)
26
+ - Supply chain or dependency vulnerabilities discovered
27
+
28
+ **Action**: Propose additions to `references/security-patterns.md` with specific vulnerability descriptions and detection heuristics.
29
+
30
+ ### Framework Pattern Updates
31
+
32
+ Learnings about framework behaviors that affect code review:
33
+
34
+ - New framework conventions or anti-patterns discovered
35
+ - Hook system behaviors that the review should check for
36
+ - Configuration patterns that indicate quality issues
37
+ - Build system quirks (e.g., CRLF on WSL, executable bit issues)
38
+
39
+ **Action**: Propose additions to `references/framework-patterns.md` with concrete examples.
40
+
41
+ ### Review Lens Improvements
42
+
43
+ Learnings about the review process itself:
44
+
45
+ - Cases where the review missed an issue that was later found in testing
46
+ - Patterns where reviewer bias led to false positives or negatives
47
+ - New review dimensions not covered by current lenses
48
+ - Effectiveness of static tools vs LLM judgment for specific pattern types
49
+
50
+ **Action**: Propose review lens updates or new review categories in `SKILL.md`.
51
+
52
+ ### Type Safety Enhancements
53
+
54
+ Learnings about type safety patterns:
55
+
56
+ - New TypeScript patterns that indicate type unsafety
57
+ - Cases where `any` or type assertions masked real issues
58
+ - Generics patterns that improve or degrade type safety
59
+ - Runtime type validation patterns at system boundaries
60
+
61
+ **Action**: Propose additions to `references/type-safety-patterns.md` with violation and fix examples.
62
+
63
+ ### Instruction Hardening
64
+
65
+ Learnings about LLM compliance with code-review instructions:
66
+
67
+ - Cases where the reviewer skipped steps or produced incomplete output
68
+ - Missing BINDING language that allowed instruction drift
69
+ - Stage sequencing issues (e.g., LLM judgment running before static tools)
70
+ - Output format compliance gaps
71
+
72
+ **Action**: Propose instruction strengthening with specific MUST/MUST NOT language.
73
+
74
+ ## Analysis Output Structure
75
+
76
+ For each improvement identified, produce:
77
+
78
+ 1. **What was learned** — the specific learning item(s) driving this
79
+ 2. **What it affects** — which code-review component (reference file, SKILL.md section)
80
+ 3. **Proposed improvement** — specific enough for the Proposer to create a copy-paste-ready change
81
+ 4. **Priority** — High (current misses cause real failures), Medium (improves coverage), Low (nice to have)
82
+ 5. **Evidence** — reference the source learning item IDs (L-NNN)