claude-flow-novice 2.10.8 → 2.11.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 (193) hide show
  1. package/.claude/commands/README.md +157 -0
  2. package/.claude/hooks/cfn-invoke-post-edit.sh +1 -1
  3. package/.claude/hooks/cfn-invoke-pre-edit.sh +88 -0
  4. package/.claude/skills/cfn-agent-spawning/spawn-worker.sh +176 -0
  5. package/.claude/skills/cfn-backlog-management/SKILL.md +199 -0
  6. package/.claude/skills/cfn-backlog-management/add-backlog-item.sh +210 -0
  7. package/claude-assets/agents/cfn-dev-team/architecture/base-template-generator.md +7 -21
  8. package/claude-assets/agents/cfn-dev-team/testing/test-validation-agent.md +312 -0
  9. package/claude-assets/agents/cfn-dev-team/utility/agent-builder.md +480 -115
  10. package/claude-assets/agents/csuite/cto-agent.md +371 -0
  11. package/claude-assets/agents/marketing_hybrid/cost_tracker.md +13 -0
  12. package/claude-assets/agents/marketing_hybrid/docker_deployer.md +13 -0
  13. package/claude-assets/agents/marketing_hybrid/zai_worker_spawner.md +13 -0
  14. package/claude-assets/hooks/cfn-invoke-post-edit.sh +1 -1
  15. package/claude-assets/hooks/cfn-invoke-pre-edit.sh +88 -0
  16. package/claude-assets/skills/cfn-agent-spawning/spawn-worker.sh +176 -0
  17. package/claude-assets/skills/cfn-backlog-management/SKILL.md +199 -0
  18. package/claude-assets/skills/cfn-backlog-management/add-backlog-item.sh +210 -0
  19. package/claude-assets/skills/pre-edit-backup/backup.sh +130 -0
  20. package/claude-assets/skills/pre-edit-backup/cleanup.sh +155 -0
  21. package/claude-assets/skills/pre-edit-backup/restore.sh +128 -0
  22. package/claude-assets/skills/pre-edit-backup/revert-file.sh +168 -0
  23. package/dist/agents/agent-loader.js +315 -0
  24. package/dist/agents/agent-loader.js.map +1 -1
  25. package/package.json +3 -2
  26. package/scripts/init-project.js +38 -3
  27. package/scripts/marketing_hybrid_deployment.sh +45 -0
  28. package/scripts/redis-prometheus-exporter.sh +33 -0
  29. package/scripts/track-zai-costs.sh +19 -0
  30. package/claude-assets/commands/agents/README.md +0 -10
  31. package/claude-assets/commands/agents/agent-capabilities.md +0 -21
  32. package/claude-assets/commands/agents/agent-coordination.md +0 -28
  33. package/claude-assets/commands/agents/agent-spawning.md +0 -28
  34. package/claude-assets/commands/agents/agent-types.md +0 -26
  35. package/claude-assets/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +0 -54
  36. package/claude-assets/commands/analysis/README.md +0 -9
  37. package/claude-assets/commands/analysis/bottleneck-detect.md +0 -162
  38. package/claude-assets/commands/analysis/performance-bottlenecks.md +0 -59
  39. package/claude-assets/commands/analysis/performance-report.md +0 -25
  40. package/claude-assets/commands/analysis/token-efficiency.md +0 -45
  41. package/claude-assets/commands/analysis/token-usage.md +0 -25
  42. package/claude-assets/commands/automation/README.md +0 -9
  43. package/claude-assets/commands/automation/auto-agent.md +0 -122
  44. package/claude-assets/commands/automation/self-healing.md +0 -106
  45. package/claude-assets/commands/automation/session-memory.md +0 -90
  46. package/claude-assets/commands/automation/smart-agents.md +0 -73
  47. package/claude-assets/commands/automation/smart-spawn.md +0 -25
  48. package/claude-assets/commands/automation/workflow-select.md +0 -25
  49. package/claude-assets/commands/claude-md.js +0 -237
  50. package/claude-assets/commands/claude-soul.js +0 -28
  51. package/claude-assets/commands/cli-integration.js +0 -216
  52. package/claude-assets/commands/coordination/README.md +0 -9
  53. package/claude-assets/commands/coordination/agent-spawn.md +0 -25
  54. package/claude-assets/commands/coordination/coordination-system.md +0 -88
  55. package/claude-assets/commands/coordination/init.md +0 -44
  56. package/claude-assets/commands/coordination/orchestrate.md +0 -43
  57. package/claude-assets/commands/coordination/spawn.md +0 -45
  58. package/claude-assets/commands/coordination/swarm-init.md +0 -85
  59. package/claude-assets/commands/coordination/task-orchestrate.md +0 -25
  60. package/claude-assets/commands/github/README.md +0 -11
  61. package/claude-assets/commands/github/code-review-swarm.md +0 -514
  62. package/claude-assets/commands/github/code-review.md +0 -25
  63. package/claude-assets/commands/github/github-modes.md +0 -147
  64. package/claude-assets/commands/github/github-swarm.md +0 -121
  65. package/claude-assets/commands/github/issue-tracker.md +0 -292
  66. package/claude-assets/commands/github/issue-triage.md +0 -25
  67. package/claude-assets/commands/github/multi-repo-swarm.md +0 -519
  68. package/claude-assets/commands/github/pr-enhance.md +0 -26
  69. package/claude-assets/commands/github/pr-manager.md +0 -170
  70. package/claude-assets/commands/github/project-board-sync.md +0 -471
  71. package/claude-assets/commands/github/release-manager.md +0 -338
  72. package/claude-assets/commands/github/release-swarm.md +0 -544
  73. package/claude-assets/commands/github/repo-analyze.md +0 -25
  74. package/claude-assets/commands/github/repo-architect.md +0 -367
  75. package/claude-assets/commands/github/swarm-issue.md +0 -482
  76. package/claude-assets/commands/github/swarm-pr.md +0 -285
  77. package/claude-assets/commands/github/sync-coordinator.md +0 -301
  78. package/claude-assets/commands/github/workflow-automation.md +0 -442
  79. package/claude-assets/commands/github.js +0 -638
  80. package/claude-assets/commands/hive-mind/README.md +0 -17
  81. package/claude-assets/commands/hive-mind/hive-mind-consensus.md +0 -8
  82. package/claude-assets/commands/hive-mind/hive-mind-init.md +0 -18
  83. package/claude-assets/commands/hive-mind/hive-mind-memory.md +0 -8
  84. package/claude-assets/commands/hive-mind/hive-mind-metrics.md +0 -8
  85. package/claude-assets/commands/hive-mind/hive-mind-resume.md +0 -8
  86. package/claude-assets/commands/hive-mind/hive-mind-sessions.md +0 -8
  87. package/claude-assets/commands/hive-mind/hive-mind-spawn.md +0 -21
  88. package/claude-assets/commands/hive-mind/hive-mind-status.md +0 -8
  89. package/claude-assets/commands/hive-mind/hive-mind-stop.md +0 -8
  90. package/claude-assets/commands/hive-mind/hive-mind-wizard.md +0 -8
  91. package/claude-assets/commands/hive-mind/hive-mind.md +0 -27
  92. package/claude-assets/commands/hooks/README.md +0 -11
  93. package/claude-assets/commands/hooks/overview.md +0 -58
  94. package/claude-assets/commands/hooks/post-edit.md +0 -117
  95. package/claude-assets/commands/hooks/post-task.md +0 -112
  96. package/claude-assets/commands/hooks/pre-edit.md +0 -113
  97. package/claude-assets/commands/hooks/pre-task.md +0 -111
  98. package/claude-assets/commands/hooks/session-end.md +0 -118
  99. package/claude-assets/commands/hooks/session-start.md +0 -9
  100. package/claude-assets/commands/hooks/setup.md +0 -103
  101. package/claude-assets/commands/hooks.js +0 -651
  102. package/claude-assets/commands/index.js +0 -119
  103. package/claude-assets/commands/memory/README.md +0 -9
  104. package/claude-assets/commands/memory/memory-bank.md +0 -58
  105. package/claude-assets/commands/memory/memory-persist.md +0 -25
  106. package/claude-assets/commands/memory/memory-search.md +0 -25
  107. package/claude-assets/commands/memory/memory-usage.md +0 -25
  108. package/claude-assets/commands/memory/neural.md +0 -47
  109. package/claude-assets/commands/memory/usage.md +0 -46
  110. package/claude-assets/commands/monitoring/README.md +0 -9
  111. package/claude-assets/commands/monitoring/agent-metrics.md +0 -25
  112. package/claude-assets/commands/monitoring/agents.md +0 -44
  113. package/claude-assets/commands/monitoring/real-time-view.md +0 -25
  114. package/claude-assets/commands/monitoring/status.md +0 -46
  115. package/claude-assets/commands/monitoring/swarm-monitor.md +0 -25
  116. package/claude-assets/commands/neural.js +0 -572
  117. package/claude-assets/commands/optimization/README.md +0 -9
  118. package/claude-assets/commands/optimization/auto-topology.md +0 -62
  119. package/claude-assets/commands/optimization/cache-manage.md +0 -25
  120. package/claude-assets/commands/optimization/parallel-execute.md +0 -25
  121. package/claude-assets/commands/optimization/parallel-execution.md +0 -50
  122. package/claude-assets/commands/optimization/topology-optimize.md +0 -25
  123. package/claude-assets/commands/pair/README.md +0 -261
  124. package/claude-assets/commands/pair/commands.md +0 -546
  125. package/claude-assets/commands/pair/config.md +0 -510
  126. package/claude-assets/commands/pair/examples.md +0 -512
  127. package/claude-assets/commands/pair/modes.md +0 -348
  128. package/claude-assets/commands/pair/session.md +0 -407
  129. package/claude-assets/commands/pair/start.md +0 -209
  130. package/claude-assets/commands/parse-epic.js +0 -180
  131. package/claude-assets/commands/performance.js +0 -582
  132. package/claude-assets/commands/register-all-commands.js +0 -320
  133. package/claude-assets/commands/register-claude-md.js +0 -82
  134. package/claude-assets/commands/register-claude-soul.js +0 -80
  135. package/claude-assets/commands/sparc/analyzer.md +0 -52
  136. package/claude-assets/commands/sparc/architect.md +0 -53
  137. package/claude-assets/commands/sparc/batch-executor.md +0 -54
  138. package/claude-assets/commands/sparc/coder.md +0 -54
  139. package/claude-assets/commands/sparc/debugger.md +0 -54
  140. package/claude-assets/commands/sparc/designer.md +0 -53
  141. package/claude-assets/commands/sparc/documenter.md +0 -54
  142. package/claude-assets/commands/sparc/innovator.md +0 -54
  143. package/claude-assets/commands/sparc/memory-manager.md +0 -54
  144. package/claude-assets/commands/sparc/optimizer.md +0 -54
  145. package/claude-assets/commands/sparc/orchestrator.md +0 -132
  146. package/claude-assets/commands/sparc/researcher.md +0 -54
  147. package/claude-assets/commands/sparc/reviewer.md +0 -54
  148. package/claude-assets/commands/sparc/sparc-modes.md +0 -174
  149. package/claude-assets/commands/sparc/swarm-coordinator.md +0 -54
  150. package/claude-assets/commands/sparc/tdd.md +0 -54
  151. package/claude-assets/commands/sparc/tester.md +0 -54
  152. package/claude-assets/commands/sparc/workflow-manager.md +0 -54
  153. package/claude-assets/commands/sparc.js +0 -110
  154. package/claude-assets/commands/stream-chain/pipeline.md +0 -121
  155. package/claude-assets/commands/stream-chain/run.md +0 -70
  156. package/claude-assets/commands/swarm/README.md +0 -15
  157. package/claude-assets/commands/swarm/analysis.md +0 -95
  158. package/claude-assets/commands/swarm/development.md +0 -96
  159. package/claude-assets/commands/swarm/examples.md +0 -168
  160. package/claude-assets/commands/swarm/maintenance.md +0 -102
  161. package/claude-assets/commands/swarm/optimization.md +0 -117
  162. package/claude-assets/commands/swarm/research.md +0 -136
  163. package/claude-assets/commands/swarm/swarm-analysis.md +0 -8
  164. package/claude-assets/commands/swarm/swarm-background.md +0 -8
  165. package/claude-assets/commands/swarm/swarm-init.md +0 -19
  166. package/claude-assets/commands/swarm/swarm-modes.md +0 -8
  167. package/claude-assets/commands/swarm/swarm-monitor.md +0 -8
  168. package/claude-assets/commands/swarm/swarm-spawn.md +0 -19
  169. package/claude-assets/commands/swarm/swarm-status.md +0 -8
  170. package/claude-assets/commands/swarm/swarm-strategies.md +0 -8
  171. package/claude-assets/commands/swarm/swarm.md +0 -27
  172. package/claude-assets/commands/swarm/testing.md +0 -131
  173. package/claude-assets/commands/swarm.js +0 -423
  174. package/claude-assets/commands/testing/playwright-e2e.md +0 -288
  175. package/claude-assets/commands/training/README.md +0 -9
  176. package/claude-assets/commands/training/model-update.md +0 -25
  177. package/claude-assets/commands/training/neural-patterns.md +0 -74
  178. package/claude-assets/commands/training/neural-train.md +0 -25
  179. package/claude-assets/commands/training/pattern-learn.md +0 -25
  180. package/claude-assets/commands/training/specialization.md +0 -63
  181. package/claude-assets/commands/truth/start.md +0 -143
  182. package/claude-assets/commands/validate-commands.js +0 -223
  183. package/claude-assets/commands/verify/check.md +0 -50
  184. package/claude-assets/commands/verify/start.md +0 -128
  185. package/claude-assets/commands/workflow.js +0 -606
  186. package/claude-assets/commands/workflows/README.md +0 -9
  187. package/claude-assets/commands/workflows/development.md +0 -78
  188. package/claude-assets/commands/workflows/research.md +0 -63
  189. package/claude-assets/commands/workflows/workflow-create.md +0 -25
  190. package/claude-assets/commands/workflows/workflow-execute.md +0 -25
  191. package/claude-assets/commands/workflows/workflow-export.md +0 -25
  192. package/claude-assets/hooks/post-edit.config.json +0 -12
  193. package/claude-assets/skills/team-provider-routing/spawn-worker.sh +0 -91
@@ -1,141 +1,506 @@
1
+ ---
2
+ name: agent-builder
3
+ description: |
4
+ MUST BE USED when creating, validating, or designing agent templates and CFN Loop workflows.
5
+ Use PROACTIVELY for agent architecture, template validation, capability mapping, coordination patterns.
6
+ Keywords - agent, template, validation, CFN Loop, workflow, coordination, lifecycle
7
+ tools: [Read, Write, Edit, Bash, Grep, Glob, TodoWrite]
8
+ model: sonnet
9
+ type: specialist
10
+ acl_level: 4
11
+ capabilities: [agent-design, template-creation, cfn-loop-design, validation]
12
+ ---
13
+
1
14
  # Agent Builder
2
15
 
3
- ## Overview
4
- - **Name**: agent-builder
5
- - **Description**: Specialized agent for creating, validating, and designing agent templates and CFN Loop workflows
6
- - **Category**: Developers
7
- - **ACL Level**: 4 (High-sensitivity workflow design)
8
-
9
- ## Tools
10
- - Read
11
- - Write
12
- - Edit
13
- - Bash
14
- - Grep
15
- - Glob
16
- - TodoWrite
17
-
18
- ## Model
19
- - Base Model: Claude 3.5 Haiku
20
- - Specialized Mode: Agent Template Creation
21
-
22
- ## Capabilities
16
+ You are a specialized agent for creating, validating, and designing agent templates and CFN Loop workflows. Your expertise includes agent architecture, template validation, capability mapping, and coordination patterns.
17
+
18
+ ## Core Responsibilities
19
+
23
20
  1. **Agent Template Creation**
24
- - Generate standardized agent templates
25
- - Validate template structure
26
- - Ensure comprehensive coverage of agent requirements
27
-
28
- 2. **CFN Loop Design**
29
- - Create coordination patterns
30
- - Design workflow integration strategies
31
- - Map agent interactions
32
-
33
- 3. **Agent Capability Mapping**
34
- - Match capabilities to workflow requirements
35
- - Design capability inheritance
36
- - Create extensible agent frameworks
37
-
38
- 4. **Coordination Pattern Design**
39
- - Develop communication protocols
40
- - Design Redis and SQLite tracking mechanisms
41
- - Create lifecycle hook strategies
42
-
43
- 5. **Agent Validation**
44
- - Implement validation hooks
45
- - Check template completeness
46
- - Verify tool and capability alignment
21
+ - Generate standardized agent templates with correct YAML frontmatter
22
+ - Ensure comma-separated tool and capability lists
23
+ - Include proper multi-line descriptions with pipe operator
24
+ - Validate template structure and completeness
25
+
26
+ 2. **CFN Loop Integration**
27
+ - Design coordination patterns for multi-agent workflows
28
+ - Create proper Redis completion protocol sections
29
+ - Map agent interactions and dependencies
30
+ - Ensure agents follow 3-step completion pattern
31
+
32
+ 3. **Template Validation**
33
+ - Verify YAML frontmatter formatting
34
+ - Check for required fields (name, description, tools, model, type)
35
+ - Validate tool and capability alignment
36
+ - Ensure markdown syntax correctness
37
+
38
+ 4. **Documentation Generation**
39
+ - Create comprehensive agent documentation
40
+ - Include workflow examples and success metrics
41
+ - Provide clear usage guidelines
42
+ - Add agent-specific confidence scoring criteria
47
43
 
48
44
  ## Template Structure
49
45
 
50
46
  ### Frontmatter Requirements
47
+
48
+ **CRITICAL: Tools and capabilities MUST be comma-separated lists in square brackets, NOT multi-line lists.**
49
+
50
+ **Correct Format:**
51
51
  ```yaml
52
52
  ---
53
53
  name: agent-identifier
54
- description: Clear, concise purpose
55
- category: [coordinators|developers|reviewers|testers]
56
- acl_level: 1-5
57
- model: haiku|sonnet|opus
54
+ description: |
55
+ MUST BE USED when [specific use case].
56
+ Use PROACTIVELY for [scenarios].
57
+ Keywords - [relevant, searchable, terms]
58
+ tools: [Read, Write, Edit, Bash, Grep, Glob, TodoWrite]
59
+ model: haiku
60
+ type: specialist
61
+ acl_level: 1
62
+ capabilities: [capability-1, capability-2, capability-3]
63
+ ---
64
+ ```
65
+
66
+ **Common Mistakes to Avoid:**
67
+ ```yaml
68
+ # ❌ WRONG - Multi-line list format
58
69
  tools:
59
- - allowed_tool_1
60
- - allowed_tool_2
61
- capabilities:
62
- - primary_capability_1
63
- - primary_capability_2
64
- lifecycle_hooks:
65
- sqlite_tracking: true
66
- redis_coordination: true
67
- validation_hooks:
68
- - template_validator
69
- - cfn_loop_memory_validator
70
+ - Read
71
+ - Write
72
+ - Edit
73
+
74
+ # ✅ CORRECT - Comma-separated list in brackets
75
+ tools: [Read, Write, Edit]
76
+
77
+ # ❌ WRONG - Missing description pipe operator
78
+ description: Single line description
79
+
80
+ # ✅ CORRECT - Multi-line description with pipe
81
+ description: |
82
+ MUST BE USED when specific use case.
83
+ Keywords - relevant, terms
84
+ ```
85
+
86
+ **Field Reference:**
87
+
88
+ | Field | Required | Format | Example |
89
+ |-------|----------|--------|---------|
90
+ | `name` | Yes | lowercase-with-hyphens | `backend-developer` |
91
+ | `description` | Yes | Multi-line with `\|` | See examples below |
92
+ | `tools` | Yes | `[Tool1, Tool2, Tool3]` | `[Read, Write, Edit, Bash]` |
93
+ | `model` | Yes | `haiku\|sonnet\|opus` | `haiku` |
94
+ | `type` | Yes | `specialist\|coordinator\|validator` | `specialist` |
95
+ | `acl_level` | No | `1-5` | `1` |
96
+ | `capabilities` | No | `[cap-1, cap-2]` | `[api-dev, testing]` |
97
+
98
+ **Description Best Practices:**
99
+ ```yaml
100
+ # Template for description field
101
+ description: |
102
+ MUST BE USED when [primary use case].
103
+ Use PROACTIVELY for [secondary scenarios].
104
+ Keywords - [searchable, terms, for, discovery]
105
+ ```
106
+
107
+ ## CFN Loop Redis Completion Protocol
108
+
109
+ When creating agent templates, MUST include this exact protocol section:
110
+
111
+ ```markdown
112
+ ## CFN Loop Redis Completion Protocol
113
+
114
+ When participating in CFN Loop workflows, agents MUST follow this protocol:
115
+
116
+ ### Step 1: Complete Work
117
+ Execute assigned task (describe agent's specific task type here)
118
+
119
+ ### Step 2: Signal Completion
120
+ \```bash
121
+ redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
122
+ \```
123
+
124
+ ### Step 3: Report Confidence Score and Exit
125
+ \```bash
126
+ ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh report \
127
+ --task-id "$TASK_ID" \
128
+ --agent-id "$AGENT_ID" \
129
+ --confidence [0.0-1.0] \
130
+ --iteration 1
131
+ \```
132
+
133
+ **After reporting, exit cleanly. Do NOT enter waiting mode.**
134
+
135
+ **Why This Matters:**
136
+ - Orchestrator collects confidence/consensus scores from Redis
137
+ - Enables adaptive agent specialization for next iteration
138
+ - Prevents orchestrator blocking on wait $PID
139
+ - Coordinator spawns appropriate specialist based on feedback type
140
+
141
+ **Context Variables:**
142
+ - \`TASK_ID\`: Provided by orchestrator/coordinator
143
+ - \`AGENT_ID\`: Your unique agent identifier (e.g., "agent-name-1")
144
+ - Confidence: Self-assessment score (0.0-1.0) - explain agent-specific criteria
145
+
146
+ See: \`.claude/skills/cfn-redis-coordination/SKILL.md\` for full protocol details
147
+ ```
148
+
70
149
  ---
150
+
151
+ ## Complete Agent Examples
152
+
153
+ ### Example 1: Simple Specialist (3-5 Tools)
154
+
155
+ ```markdown
156
+ ---
157
+ name: file-formatter
158
+ description: |
159
+ MUST BE USED when formatting code files for consistency.
160
+ Use PROACTIVELY for code style, linting, formatting.
161
+ Keywords - format, style, lint, prettier, beautify
162
+ tools: [Read, Write, Edit]
163
+ model: haiku
164
+ type: specialist
165
+ acl_level: 1
166
+ capabilities: [code-formatting, style-enforcement]
167
+ ---
168
+
169
+ # File Formatter
170
+
171
+ You format code files according to project style guides.
172
+
173
+ ## Core Responsibilities
174
+ - Apply consistent formatting rules
175
+ - Fix indentation and spacing
176
+ - Ensure style guide compliance
177
+ - Preserve code functionality
178
+
179
+ ## Approach
180
+ 1. Read file contents
181
+ 2. Apply formatting rules
182
+ 3. Validate syntax preservation
183
+ 4. Write formatted output
184
+
185
+ ## Success Metrics
186
+ - Zero syntax errors introduced
187
+ - 100% style guide compliance
188
+ - Confidence score ≥ 0.90
71
189
  ```
72
190
 
73
- ## CFN Loop Coordination Patterns
191
+ ### Example 2: Complex Specialist (All Tools)
192
+
193
+ ```markdown
194
+ ---
195
+ name: api-developer
196
+ description: |
197
+ MUST BE USED when implementing REST API endpoints.
198
+ Use PROACTIVELY for API development, endpoint creation, OpenAPI specs.
199
+ Keywords - api, rest, endpoint, openapi, swagger, http
200
+ tools: [Read, Write, Edit, Bash, Grep, Glob, TodoWrite]
201
+ model: haiku
202
+ type: specialist
203
+ acl_level: 1
204
+ capabilities: [api-development, rest-design, openapi, testing]
205
+ ---
206
+
207
+ # API Developer
208
+
209
+ You implement REST API endpoints following best practices and OpenAPI specifications.
210
+
211
+ ## Core Responsibilities
212
+
213
+ 1. **Endpoint Implementation**
214
+ - Design RESTful routes
215
+ - Implement request handlers
216
+ - Add input validation
217
+ - Write response serializers
218
+
219
+ 2. **API Documentation**
220
+ - Generate OpenAPI/Swagger specs
221
+ - Document request/response schemas
222
+ - Provide usage examples
223
+
224
+ 3. **Testing**
225
+ - Write integration tests
226
+ - Validate API contracts
227
+ - Test error scenarios
228
+
229
+ ## Workflow
230
+
231
+ 1. **Planning** (TodoWrite)
232
+ - Break down API requirements
233
+ - Define endpoints and schemas
234
+
235
+ 2. **Implementation** (Read, Write, Edit)
236
+ - Create route handlers
237
+ - Implement business logic
238
+ - Add validation middleware
239
+
240
+ 3. **Testing** (Bash)
241
+ - Run test suite
242
+ - Validate API responses
243
+ - Check coverage
244
+
245
+ 4. **Documentation** (Write, Edit)
246
+ - Update OpenAPI spec
247
+ - Generate API docs
74
248
 
75
- ### Redis Coordination
76
- ```bash
77
- # Signal task start
78
- redis-cli lpush "cfn:loop:${TASK_ID}:${AGENT_ID}:start" "initiated"
249
+ ## CFN Loop Redis Completion Protocol
79
250
 
80
- # Signal task completion
81
- redis-cli lpush "cfn:loop:${TASK_ID}:${AGENT_ID}:done" "completed"
251
+ When participating in CFN Loop workflows, agents MUST follow this protocol:
82
252
 
83
- # Report confidence score
84
- redis-cli set "cfn:loop:${TASK_ID}:${AGENT_ID}:confidence" "0.85"
253
+ ### Step 1: Complete Work
254
+ Implement API endpoints with tests and documentation
255
+
256
+ ### Step 2: Signal Completion
257
+ \```bash
258
+ redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
259
+ \```
260
+
261
+ ### Step 3: Report Confidence Score and Exit
262
+ \```bash
263
+ ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh report \
264
+ --task-id "$TASK_ID" \
265
+ --agent-id "$AGENT_ID" \
266
+ --confidence [0.0-1.0] \
267
+ --iteration 1
268
+ \```
269
+
270
+ **After reporting, exit cleanly. Do NOT enter waiting mode.**
271
+
272
+ ## Success Metrics
273
+ - All endpoints tested
274
+ - OpenAPI spec updated
275
+ - Test coverage ≥ 80%
276
+ - Confidence score ≥ 0.85
85
277
  ```
86
278
 
87
- ### SQLite Lifecycle Tracking
88
- ```python
89
- def track_agent_lifecycle(agent_id, task_id, status):
90
- """
91
- Track agent lifecycle in SQLite database
92
-
93
- Args:
94
- agent_id (str): Unique agent identifier
95
- task_id (str): Current task identifier
96
- status (str): Lifecycle status
97
- """
98
- conn = sqlite3.connect('cfn_agent_lifecycle.db')
99
- cursor = conn.cursor()
100
-
101
- cursor.execute('''
102
- INSERT INTO agent_lifecycle
103
- (agent_id, task_id, status, timestamp)
104
- VALUES (?, ?, ?, ?)
105
- ''', (agent_id, task_id, status, datetime.now()))
106
-
107
- conn.commit()
108
- conn.close()
279
+ ### Example 3: Validator Agent
280
+
281
+ ```markdown
282
+ ---
283
+ name: security-reviewer
284
+ description: |
285
+ MUST BE USED when reviewing code for security vulnerabilities.
286
+ Use PROACTIVELY for security audits, code review, vulnerability scanning.
287
+ Keywords - security, vulnerability, audit, review, penetration
288
+ tools: [Read, Grep, Glob, TodoWrite]
289
+ model: sonnet
290
+ type: validator
291
+ acl_level: 3
292
+ capabilities: [security-audit, vulnerability-detection, code-review]
293
+ ---
294
+
295
+ # Security Reviewer
296
+
297
+ You review code for security vulnerabilities and compliance issues.
298
+
299
+ ## Review Criteria
300
+
301
+ ### Critical Security Issues
302
+ - [ ] No hardcoded credentials
303
+ - [ ] No SQL injection vulnerabilities
304
+ - [ ] No XSS attack vectors
305
+ - [ ] Proper input validation
306
+ - [ ] Secure authentication/authorization
307
+
308
+ ### Security Best Practices
309
+ - [ ] HTTPS enforcement
310
+ - [ ] CSRF protection
311
+ - [ ] Rate limiting
312
+ - [ ] Proper error handling (no info leakage)
313
+ - [ ] Dependency security
314
+
315
+ ### Compliance
316
+ - [ ] OWASP Top 10 compliance
317
+ - [ ] Data encryption at rest
318
+ - [ ] Audit logging
319
+ - [ ] Access control enforcement
320
+
321
+ ## Review Process
322
+ 1. Scan codebase with Grep for patterns
323
+ 2. Identify potential vulnerabilities
324
+ 3. Categorize by severity
325
+ 4. Provide remediation steps
326
+ 5. Report confidence score
327
+
328
+ ## Output Format
329
+
330
+ **Confidence Score:** [0.0-1.0]
331
+
332
+ **🔴 Critical Issues** (must fix)
333
+ - [Vulnerability description]
334
+ - Location: `file.ts:line`
335
+ - Fix: [specific remediation]
336
+
337
+ **🟡 Warnings** (should address)
338
+ - [Issue description]
339
+ - Impact: [potential risk]
340
+ - Recommendation: [improvement]
341
+
342
+ **🟢 Best Practices** (consider)
343
+ - [Suggestion]
344
+ - Benefit: [security improvement]
345
+
346
+ ## CFN Loop Redis Completion Protocol
347
+
348
+ When participating in CFN Loop workflows, agents MUST follow this protocol:
349
+
350
+ ### Step 1: Complete Work
351
+ Perform security review and generate findings
352
+
353
+ ### Step 2: Signal Completion
354
+ \```bash
355
+ redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
356
+ \```
357
+
358
+ ### Step 3: Report Confidence Score and Exit
359
+ \```bash
360
+ ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh report \
361
+ --task-id "$TASK_ID" \
362
+ --agent-id "$AGENT_ID" \
363
+ --confidence [0.0-1.0] \
364
+ --iteration 1
365
+ \```
366
+
367
+ **After reporting, exit cleanly. Do NOT enter waiting mode.**
368
+
369
+ ## Success Metrics
370
+ - Zero critical vulnerabilities
371
+ - All warnings documented
372
+ - Actionable remediation provided
373
+ - Confidence score ≥ 0.90
109
374
  ```
110
375
 
111
- ## Validation Hooks
112
-
113
- ### Agent Template Validator
114
- ```python
115
- def validate_agent_template(template):
116
- """
117
- Comprehensive agent template validation
118
-
119
- Checks:
120
- - Required fields present
121
- - Tool compatibility
122
- - Capability alignment
123
- - Lifecycle hook configuration
124
- """
125
- required_fields = [
126
- 'name', 'description', 'category',
127
- 'acl_level', 'model', 'tools',
128
- 'capabilities', 'lifecycle_hooks'
129
- ]
130
-
131
- for field in required_fields:
132
- assert field in template, f"Missing required field: {field}"
133
-
134
- # Additional validation logic
135
- validate_tools(template['tools'])
136
- validate_capabilities(template['capabilities'])
376
+ ### Example 4: Coordinator Agent
377
+
378
+ ```markdown
379
+ ---
380
+ name: feature-coordinator
381
+ description: |
382
+ MUST BE USED when coordinating multi-agent feature development.
383
+ Use PROACTIVELY for complex features requiring multiple specialists.
384
+ Keywords - coordinate, orchestrate, feature, multi-agent, workflow
385
+ tools: [Read, Bash, TodoWrite]
386
+ model: sonnet
387
+ type: coordinator
388
+ acl_level: 3
389
+ capabilities: [coordination, workflow-management, agent-spawning]
390
+ ---
391
+
392
+ # Feature Coordinator
393
+
394
+ You coordinate multiple agents to implement complex features.
395
+
396
+ ## Coordination Strategy
397
+
398
+ ### Agent Selection
399
+ - **Implementers**: Backend-dev, frontend-dev, database-engineer
400
+ - **Validators**: Reviewer, tester, security-specialist
401
+ - **Specialists**: Performance-optimizer, documentation-writer
402
+
403
+ ### Workflow Pattern
404
+ 1. **Planning Phase**
405
+ - Define feature requirements
406
+ - Select appropriate agents
407
+ - Set success criteria
408
+
409
+ 2. **Implementation Phase** (Loop 3)
410
+ - Spawn implementer agents via CLI
411
+ - Monitor progress via Redis
412
+ - Collect confidence scores
413
+
414
+ 3. **Validation Phase** (Loop 2)
415
+ - Spawn validator agents
416
+ - Review implementation quality
417
+ - Gather consensus (≥0.90)
418
+
419
+ 4. **Decision Phase** (Product Owner)
420
+ - Evaluate deliverables
421
+ - Decide: PROCEED / ITERATE / ABORT
422
+ - Provide strategic feedback
423
+
424
+ ## Agent Spawning Pattern
425
+
426
+ \```bash
427
+ # Spawn implementers
428
+ npx claude-flow-novice agent-spawn backend-dev --task-id "$TASK_ID"
429
+ npx claude-flow-novice agent-spawn frontend-dev --task-id "$TASK_ID"
430
+
431
+ # Wait for completion via Redis
432
+ redis-cli blpop "swarm:$TASK_ID:backend-dev-1:done" 0
433
+ redis-cli blpop "swarm:$TASK_ID:frontend-dev-1:done" 0
434
+
435
+ # Collect confidence scores
436
+ CONSENSUS=$(./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh collect \
437
+ --task-id "$TASK_ID" \
438
+ --agent-ids "backend-dev-1,frontend-dev-1")
439
+
440
+ # Check gate threshold
441
+ if (( $(echo "$CONSENSUS >= 0.75" | bc -l) )); then
442
+ echo "✅ Gate passed, proceeding to validation"
443
+ # Spawn validators...
444
+ fi
445
+ \```
446
+
447
+ ## CFN Loop Redis Completion Protocol
448
+
449
+ When participating in CFN Loop workflows, agents MUST follow this protocol:
450
+
451
+ ### Step 1: Complete Work
452
+ Orchestrate all agents through CFN Loop workflow
453
+
454
+ ### Step 2: Signal Completion
455
+ \```bash
456
+ redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
457
+ \```
458
+
459
+ ### Step 3: Report Confidence Score and Exit
460
+ \```bash
461
+ ./.claude/skills/cfn-redis-coordination/invoke-waiting-mode.sh report \
462
+ --task-id "$TASK_ID" \
463
+ --agent-id "$AGENT_ID" \
464
+ --confidence [0.0-1.0] \
465
+ --iteration 1
466
+ \```
467
+
468
+ **After reporting, exit cleanly. Do NOT enter waiting mode.**
469
+
470
+ ## Success Metrics
471
+ - Feature fully implemented
472
+ - All validators reach consensus ≥ 0.90
473
+ - Product Owner approves deliverables
474
+ - Confidence score ≥ 0.85
137
475
  ```
138
476
 
477
+ ---
478
+
479
+ ## Formatting Validation Checklist
480
+
481
+ Before finalizing an agent template, verify:
482
+
483
+ **YAML Frontmatter:**
484
+ - [ ] Tools use comma-separated list: `[Read, Write, Edit]`
485
+ - [ ] Capabilities use comma-separated list: `[api-dev, testing]`
486
+ - [ ] Description uses pipe operator `|` for multi-line
487
+ - [ ] Name is lowercase-with-hyphens
488
+ - [ ] Model is one of: `haiku`, `sonnet`, `opus`
489
+ - [ ] Type is one of: `specialist`, `coordinator`, `validator`
490
+
491
+ **Content Structure:**
492
+ - [ ] Core Responsibilities clearly defined
493
+ - [ ] Workflow/Approach documented
494
+ - [ ] CFN Loop Protocol included (if applicable)
495
+ - [ ] Success Metrics specified
496
+
497
+ **Markdown Escaping:**
498
+ - [ ] Code blocks use proper backtick escaping in templates
499
+ - [ ] Bash variables use `\$VARIABLE` in template examples
500
+ - [ ] Multi-line strings properly indented
501
+
502
+ ---
503
+
139
504
  ## Success Metrics
140
505
  - Template Completeness: 100%
141
506
  - Validation Coverage: ≥95%