claude-flow-novice 2.6.0 → 2.8.1

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 (364) hide show
  1. package/.claude/adaptive-context/cfn-v3-reflection.json +21 -0
  2. package/.claude/agents/AGENT_LIFECYCLE.md +495 -0
  3. package/.claude/agents/CLAUDE.md +1002 -995
  4. package/.claude/agents/accessibility-advocate.md +457 -0
  5. package/.claude/agents/agent-principles/README.md +226 -226
  6. package/.claude/agents/agent-principles/agent-type-guidelines.md +10 -0
  7. package/.claude/agents/agent-principles/format-selection.md +10 -0
  8. package/.claude/agents/agent-principles/phase4-template-optimization.md +502 -494
  9. package/.claude/agents/agent-principles/prompt-engineering.md +8 -0
  10. package/.claude/agents/agent-principles/quality-metrics.md +8 -0
  11. package/.claude/agents/analysis/code-analyzer.md +7 -17
  12. package/.claude/agents/analysis/code-review/analyze-code-quality.md +2 -104
  13. package/.claude/agents/analysis/perf-analyzer.md +2 -196
  14. package/.claude/agents/context/context-curator.md +78 -84
  15. package/.claude/agents/context/context-reflector.md +27 -81
  16. package/.claude/agents/coordinators/README.md +42 -0
  17. package/.claude/agents/coordinators/cfn-v3-coordinator.md +440 -0
  18. package/.claude/agents/{product-owner-team → coordinators}/cto-agent.md +154 -187
  19. package/.claude/agents/coordinators/multi-sprint-coordinator.md +50 -0
  20. package/.claude/agents/{product-owner-team → coordinators}/product-owner-agent.md +6 -39
  21. package/.claude/agents/{cfn-loop → coordinators}/product-owner.md +72 -17
  22. package/.claude/agents/core-agents/reviewer.md +114 -135
  23. package/.claude/agents/custom/agent-builder.md +637 -637
  24. package/.claude/agents/developers/README.md +69 -0
  25. package/.claude/agents/developers/backend-dev.md +77 -0
  26. package/.claude/agents/{core-agents → developers}/coder.md +131 -26
  27. package/.claude/agents/developers/react-frontend-engineer.md +121 -0
  28. package/.claude/agents/{frontend → developers}/state-architect.md +1 -0
  29. package/.claude/agents/{frontend → developers}/ui-designer.md +1 -0
  30. package/.claude/agents/development/backend/dev-backend-api.md +0 -29
  31. package/.claude/agents/development/npm-package-specialist.md +355 -347
  32. package/.claude/agents/documentation/api-docs/docs-api-openapi.md +8 -0
  33. package/.claude/agents/documentation/api-docs.md +8 -0
  34. package/.claude/agents/github/github-commit-agent.md +125 -117
  35. package/.claude/agents/goal/goal-planner.md +8 -0
  36. package/.claude/agents/infrastructure/README.md +100 -0
  37. package/.claude/agents/{specialized → infrastructure}/devops-engineer.md +131 -150
  38. package/.claude/agents/planners/README.md +94 -0
  39. package/.claude/agents/{core-agents → planners}/analyst.md +1 -22
  40. package/.claude/agents/{planning-team → planners}/api-designer-persona.md +8 -0
  41. package/.claude/agents/{core-agents → planners}/architect.md +7 -20
  42. package/.claude/agents/{core-agents → planners}/planner.md +0 -21
  43. package/.claude/agents/{planning-team → planners}/security-architect-persona.md +8 -28
  44. package/.claude/agents/{planning-team → planners}/system-architect-persona.md +6 -38
  45. package/.claude/agents/{architecture → planners}/system-architect.md +12 -17
  46. package/.claude/agents/product-owner-team/accessibility-advocate-persona.md +132 -161
  47. package/.claude/agents/product-owner-team/power-user-persona.md +149 -182
  48. package/.claude/agents/retrospective-analyst.md +84 -0
  49. package/.claude/agents/reviewers/README.md +58 -0
  50. package/.claude/agents/{analysis → reviewers}/code-quality-validator.md +8 -17
  51. package/.claude/agents/reviewers/reviewer.md +181 -0
  52. package/.claude/agents/sparc/architecture.md +6 -25
  53. package/.claude/agents/sparc/pseudocode.md +6 -0
  54. package/.claude/agents/sparc/refinement.md +6 -0
  55. package/.claude/agents/sparc/specification.md +1 -0
  56. package/.claude/agents/specialists/README.md +60 -0
  57. package/.claude/agents/{core-agents → specialists}/base-template-generator.md +8 -21
  58. package/.claude/agents/{specialized → specialists}/cli-agent-optimizer.md +1 -1
  59. package/.claude/agents/{specialized → specialists}/code-booster.md +1 -0
  60. package/.claude/agents/{consensus → specialists}/consensus-builder.md +1 -17
  61. package/.claude/agents/{specialized/mobile → specialists}/mobile-dev.md +0 -20
  62. package/.claude/agents/{core-agents → specialists}/performance-benchmarker.md +134 -148
  63. package/.claude/agents/{specialized → specialists}/rust-developer.md +1 -20
  64. package/.claude/agents/{specialized → specialists}/rust-enterprise-developer.md +1 -20
  65. package/.claude/agents/{specialized → specialists}/rust-mvp-developer.md +1 -20
  66. package/.claude/agents/{core-agents → specialists}/security-manager.md +68 -88
  67. package/.claude/agents/{security → specialists}/security-specialist-existing.md +6 -57
  68. package/.claude/agents/{security → specialists}/security-specialist.md +6 -30
  69. package/.claude/agents/{specialized/mobile → specialists}/spec-mobile-react-native.md +2 -21
  70. package/.claude/agents/testers/README.md +94 -0
  71. package/.claude/agents/{testing → testers}/e2e/playwright-agent.md +1 -20
  72. package/.claude/agents/{testing → testers}/interaction-tester.md +1 -20
  73. package/.claude/agents/{testing → testers}/playwright-tester.md +1 -1
  74. package/.claude/agents/testers/tester.md +139 -0
  75. package/.claude/agents/testers/unit/tdd-london-swarm.md +49 -0
  76. package/.claude/agents/testers/validation/production-validator.md +33 -0
  77. package/.claude/agents-ignore/cfn-loop-coordinator.md +157 -0
  78. package/.claude/agents-ignore/cfn-loop-coordinator.md.backup +156 -0
  79. package/.claude/agents-ignore/coordinator.md.backup +182 -0
  80. package/.claude/agents-ignore/cost-savings-cfn-loop-coordinator.md +760 -0
  81. package/.claude/agents-ignore/cost-savings-coordinator.md +173 -0
  82. package/.claude/artifacts/ace-reflections/REFLECT-001-summary.json +39 -0
  83. package/.claude/artifacts/ace-reflections/sprint-7_$(date -u +/"%Y%m%d_%H%M%S/").json" +47 -0
  84. package/.claude/commands/CFN_COORDINATOR_PARAMETERS.md +10 -10
  85. package/.claude/commands/cfn-loop-epic.md +3 -3
  86. package/.claude/commands/cfn-loop-single.md +3 -3
  87. package/.claude/commands/cfn-loop-sprints.md +1 -1
  88. package/.claude/commands/cfn-loop.md +3 -3
  89. package/.claude/commands/cfn-mode.md +20 -0
  90. package/.claude/commands/write-plan.md +104 -0
  91. package/.claude/data/cfn-loop.db +0 -0
  92. package/.claude/data/cfn_loop_logs.db +0 -0
  93. package/.claude/hooks/BACKUP_USAGE.md +243 -0
  94. package/.claude/hooks/post-edit-cfn-retrospective.sh +79 -0
  95. package/.claude/hooks/post-edit.sh +21 -0
  96. package/.claude/hooks/pre-edit-backup.sh +71 -0
  97. package/.claude/hooks/restore-from-backup.sh +37 -0
  98. package/.claude/prompts/cfn-loop-context.md +115 -0
  99. package/.claude/prompts/loop-specific/loop2.md +50 -0
  100. package/.claude/prompts/loop-specific/loop3.md +43 -0
  101. package/.claude/prompts/loop-specific/loop4.md +54 -0
  102. package/.claude/root-claude-distribute/CLAUDE.md +76 -2
  103. package/.claude/skills/ace-system/sprint-7-lessons.json +46 -0
  104. package/.claude/skills/ace-system/store-reflection.sh +33 -136
  105. package/.claude/skills/agent-discovery/SKILL.md +40 -0
  106. package/.claude/skills/agent-discovery/agents-registry-clean.json +0 -0
  107. package/.claude/skills/agent-discovery/agents-registry-fixed.json +19 -0
  108. package/.claude/skills/agent-discovery/agents-registry.json +718 -0
  109. package/.claude/skills/agent-discovery/discover-agents.py +175 -0
  110. package/.claude/skills/agent-discovery/discover-agents.sh +87 -0
  111. package/.claude/skills/agent-discovery/invoke-registry.sh +11 -0
  112. package/.claude/skills/agent-discovery/temp_script.py +0 -0
  113. package/.claude/skills/agent-output-processing/SKILL.md +359 -0
  114. package/.claude/skills/agent-selector/SKILL.md +90 -0
  115. package/.claude/skills/agent-selector/select-agents.sh +96 -0
  116. package/.claude/skills/agent-spawning/agent-selection-guide.md +1 -1
  117. package/.claude/skills/agent-swap/SKILL.md +36 -0
  118. package/.claude/skills/agent-swap/recommend-swap.sh +60 -0
  119. package/.claude/skills/api-validation/test-endpoints.sh +54 -0
  120. package/.claude/skills/automatic-memory-persistence/SKILL.md +73 -0
  121. package/.claude/skills/automatic-memory-persistence/persist-agent-output.sh +49 -0
  122. package/.claude/skills/automatic-memory-persistence/query-agent-history.sh +35 -0
  123. package/.claude/skills/automatic-memory-persistence/test-memory-persistence.sh +235 -0
  124. package/.claude/skills/cfn-loop-orchestration/README.md +41 -0
  125. package/.claude/skills/cfn-loop-orchestration/SKILL.md +299 -0
  126. package/.claude/skills/cfn-loop-orchestration/helpers/auto-tune-timeouts.sh +228 -0
  127. package/.claude/skills/cfn-loop-orchestration/helpers/consensus.sh +84 -0
  128. package/.claude/skills/cfn-loop-orchestration/helpers/deliverable-verifier.sh +71 -0
  129. package/.claude/skills/cfn-loop-orchestration/helpers/gate-check.sh +90 -0
  130. package/.claude/skills/cfn-loop-orchestration/helpers/iteration-manager.sh +87 -0
  131. package/.claude/skills/cfn-loop-orchestration/helpers/timeout-calculator.sh +51 -0
  132. package/.claude/skills/cfn-loop-orchestration/inject-loop-context.sh +41 -0
  133. package/.claude/skills/cfn-loop-orchestration/monitor-execution.sh +156 -0
  134. package/.claude/skills/cfn-loop-orchestration/orchestrate.sh +840 -0
  135. package/.claude/skills/cfn-loop-orchestration/security_utils.sh +99 -0
  136. package/.claude/skills/cfn-loop-orchestration/test-cfn-orchestration.sh +281 -0
  137. package/.claude/skills/cfn-loop-orchestration/test-edge-cases.sh +188 -0
  138. package/.claude/skills/cfn-loop-validation/SKILL.md +307 -217
  139. package/.claude/skills/complexity-estimator/SKILL.md +96 -0
  140. package/.claude/skills/complexity-estimator/estimate-complexity.sh +144 -0
  141. package/.claude/skills/context-pruner/SKILL.md +75 -0
  142. package/.claude/skills/context-pruner/prune-context.sh +73 -0
  143. package/.claude/skills/defense-in-depth/SKILL.md +133 -0
  144. package/.claude/skills/dependency-extractor/SKILL.md +35 -0
  145. package/.claude/skills/dependency-extractor/extract-dependencies.sh +66 -0
  146. package/.claude/skills/epic-decomposer/SKILL.md +44 -0
  147. package/.claude/skills/epic-decomposer/decompose-epic.sh +104 -0
  148. package/.claude/skills/improvement-recommender/SKILL.md +33 -0
  149. package/.claude/skills/improvement-recommender/recommend-improvements.sh +92 -0
  150. package/.claude/skills/intervention-detector/SKILL.md +39 -0
  151. package/.claude/skills/intervention-detector/detect-intervention.sh +111 -0
  152. package/.claude/skills/intervention-orchestrator/SKILL.md +43 -0
  153. package/.claude/skills/intervention-orchestrator/execute-intervention.sh +59 -0
  154. package/.claude/skills/loop2-output-processing/SKILL.md +163 -0
  155. package/.claude/skills/loop2-output-processing/execute-and-extract.sh +77 -0
  156. package/.claude/skills/loop2-output-processing/execute-and-extract.sh.backup +36 -0
  157. package/.claude/skills/loop2-output-processing/parse-feedback.sh +147 -0
  158. package/.claude/skills/loop2-output-processing/process-validator-output.sh +275 -0
  159. package/.claude/skills/loop2-output-processing/test-bug27-fix.sh +200 -0
  160. package/.claude/skills/loop2-output-processing/test-loop2-processing.sh +113 -0
  161. package/.claude/skills/loop3-output-processing/AGENT_COMPLETION_PROTOCOL.md +206 -0
  162. package/.claude/skills/loop3-output-processing/SKILL.md +421 -0
  163. package/.claude/skills/loop3-output-processing/calculate-confidence.sh +28 -0
  164. package/.claude/skills/loop3-output-processing/execute-and-extract.sh +85 -0
  165. package/.claude/skills/loop3-output-processing/parse-confidence.sh +31 -0
  166. package/.claude/skills/loop3-output-processing/test-agent-timeout.sh +327 -0
  167. package/.claude/skills/loop3-output-processing/test-loop3-processing.sh +155 -0
  168. package/.claude/skills/loop3-output-processing/verify-deliverables.sh +42 -0
  169. package/.claude/skills/pattern-extraction/SKILL.md +30 -0
  170. package/.claude/skills/pattern-extraction/extract-patterns.sh +80 -0
  171. package/.claude/skills/playbook/SKILL.md +113 -0
  172. package/.claude/skills/playbook/init-playbook.sh +54 -0
  173. package/.claude/skills/playbook/playbook.db +0 -0
  174. package/.claude/skills/playbook/query-playbook.sh +79 -0
  175. package/.claude/skills/playbook/update-playbook.sh +69 -0
  176. package/.claude/skills/playbook-auto-update/SKILL.md +29 -0
  177. package/.claude/skills/playbook-auto-update/auto-update-playbook.sh +86 -0
  178. package/.claude/skills/product-owner-decision/SKILL.md +332 -0
  179. package/.claude/skills/product-owner-decision/execute-decision.sh +176 -0
  180. package/.claude/skills/product-owner-decision/parse-decision.sh +66 -0
  181. package/.claude/skills/product-owner-decision/validate-deliverables.sh +82 -0
  182. package/.claude/skills/redis-coordination/LOGGING.md +260 -0
  183. package/.claude/skills/redis-coordination/README.md +30 -29
  184. package/.claude/skills/redis-coordination/SKILL.md +685 -83
  185. package/.claude/skills/redis-coordination/analyze-task-complexity.sh +277 -0
  186. package/.claude/skills/redis-coordination/cfn-loop-exec.sh +468 -0
  187. package/.claude/skills/redis-coordination/collect-confidence-scores.sh +179 -0
  188. package/.claude/skills/redis-coordination/collect-results.sh +75 -0
  189. package/.claude/skills/redis-coordination/data/cfn-loop.db +0 -0
  190. package/.claude/skills/redis-coordination/{test-orchestrator.sh → demos/test-orchestrator.sh} +25 -0
  191. package/.claude/skills/redis-coordination/execute-product-owner-decision.sh +258 -0
  192. package/.claude/skills/redis-coordination/get-agent-timeout.sh +176 -176
  193. package/.claude/skills/redis-coordination/invoke-waiting-mode.sh +93 -227
  194. package/.claude/skills/redis-coordination/invoke-waiting-mode.sh.backup-p7 +423 -0
  195. package/.claude/skills/redis-coordination/log-event.sh +109 -0
  196. package/.claude/skills/redis-coordination/monitor-cfn-violations.sh +391 -0
  197. package/.claude/skills/redis-coordination/orchestrate-cfn-loop-v3.sh +141 -0
  198. package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh +31 -993
  199. package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup +38 -0
  200. package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup-1761167675 +1672 -0
  201. package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup-p5 +1604 -0
  202. package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup-phase1 +1550 -0
  203. package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup-phase2 +1621 -0
  204. package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup-phase3 +1621 -0
  205. package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.bak +0 -0
  206. package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.broken +1627 -0
  207. package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.corrupted +80 -0
  208. package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.deprecated +1864 -0
  209. package/.claude/skills/redis-coordination/query-logs.sh +103 -0
  210. package/.claude/skills/redis-coordination/retrieve-context.sh +58 -0
  211. package/.claude/skills/redis-coordination/select-specialist-agent.sh +371 -0
  212. package/.claude/skills/redis-coordination/semantic-match-tfidf.py +252 -0
  213. package/.claude/skills/redis-coordination/send-heartbeat.sh +164 -72
  214. package/.claude/skills/redis-coordination/signal.sh +38 -0
  215. package/.claude/skills/redis-coordination/store-context.sh +86 -0
  216. package/.claude/skills/redis-coordination/test-context-injection.sh +354 -0
  217. package/.claude/skills/redis-coordination/test-timeout-enforcement.sh +513 -0
  218. package/.claude/skills/redis-coordination/tests/convert-line-endings.sh +15 -0
  219. package/.claude/skills/redis-coordination/tests/dlq-functionality-test.sh +101 -101
  220. package/.claude/skills/redis-coordination/tests/edge-cases-test.sh +98 -98
  221. package/.claude/skills/redis-coordination/tests/integration-test.sh +169 -169
  222. package/.claude/skills/redis-coordination/tests/retry-mechanism-test.sh +81 -81
  223. package/.claude/skills/redis-coordination/tests/run-test-suite.sh +91 -91
  224. package/.claude/skills/redis-coordination/tests/run-tests.sh +4 -0
  225. package/.claude/skills/redis-coordination/tests/test-primitives.sh +166 -0
  226. package/.claude/skills/redis-coordination/tests/test-utils.sh +53 -121
  227. package/.claude/skills/redis-coordination/tests/test_coordination_primitives.sh.deprecated +20 -0
  228. package/.claude/skills/redis-coordination/tests/test_utils.sh +49 -0
  229. package/.claude/skills/redis-coordination/v2_modularization/core_orchestration.sh +76 -0
  230. package/.claude/skills/redis-coordination/validate-parameters.sh +492 -0
  231. package/.claude/skills/retrospective-report/SKILL.md +31 -0
  232. package/.claude/skills/retrospective-report/generate-report.sh +101 -0
  233. package/.claude/skills/run-all-skill-tests.sh +124 -0
  234. package/.claude/skills/scope-simplifier/SKILL.md +37 -0
  235. package/.claude/skills/scope-simplifier/simplify-scope.sh +68 -0
  236. package/.claude/skills/simplified-agent-lifecycle/COST_ANALYSIS.md +49 -0
  237. package/.claude/skills/simplified-agent-lifecycle/DESIGN.md +98 -0
  238. package/.claude/skills/simplified-agent-lifecycle/MIGRATION_PLAN.md +74 -0
  239. package/.claude/skills/specialist-injection/SKILL.md +41 -0
  240. package/.claude/skills/specialist-injection/recommend-specialist.sh +57 -0
  241. package/.claude/skills/sprint-execution/SKILL.md +27 -0
  242. package/.claude/skills/sprint-execution/execute-sprint-task.sh +59 -0
  243. package/.claude/skills/sprint-execution/execute-sprint.sh +65 -0
  244. package/.claude/skills/sprint-planner/SKILL.md +37 -0
  245. package/.claude/skills/sprint-planner/plan-sprint.sh +85 -0
  246. package/.claude/skills/standardized-error-handling/SKILL.md +56 -0
  247. package/.claude/skills/standardized-error-handling/capture-agent-error.sh +87 -0
  248. package/.claude/skills/standardized-error-handling/test-error-handling.sh +166 -0
  249. package/.claude/skills/task-classifier/SKILL.md +94 -0
  250. package/.claude/skills/task-classifier/classify-task.sh +115 -0
  251. package/.claude/skills/validation-templates/SKILL.md +47 -0
  252. package/.claude/skills/validation-templates/content.json +38 -0
  253. package/.claude/skills/validation-templates/data.json +38 -0
  254. package/.claude/skills/validation-templates/design.json +38 -0
  255. package/.claude/skills/validation-templates/infrastructure.json +38 -0
  256. package/.claude/skills/validation-templates/research.json +38 -0
  257. package/.claude/skills/validation-templates/software.json +38 -0
  258. package/.claude/skills/webapp-testing/README.md +142 -0
  259. package/.claude/skills/webapp-testing/SCREENSHOT_NAMING_CONVENTION.md +547 -0
  260. package/.claude/skills/webapp-testing/SKILL.md +877 -0
  261. package/.claude/skills/webapp-testing/capture-screenshot.sh +238 -0
  262. package/.claude/skills/webapp-testing/cfn-loop-integration.sh +265 -0
  263. package/.claude/skills/webapp-testing/compare-screenshots.sh +199 -0
  264. package/.claude/skills/webapp-testing/init-storage.sh +150 -0
  265. package/.claude/skills/webapp-testing/set-baseline.sh +196 -0
  266. package/.claude/skills/webapp-testing/test-webapp-testing.sh +233 -0
  267. package/.claude/spawn-pattern-examples.md +3 -3
  268. package/CLAUDE.md +319 -45
  269. package/README.md +598 -251
  270. package/dist/agents/agent-loader.js +146 -165
  271. package/dist/agents/agent-loader.js.map +1 -1
  272. package/dist/cli/agent-command.js +2 -0
  273. package/dist/cli/agent-command.js.map +1 -1
  274. package/dist/cli/agent-definition-parser.js +7 -0
  275. package/dist/cli/agent-definition-parser.js.map +1 -1
  276. package/dist/cli/agent-executor.js +145 -11
  277. package/dist/cli/agent-executor.js.map +1 -1
  278. package/dist/cli/agent-prompt-builder.js +81 -1
  279. package/dist/cli/agent-prompt-builder.js.map +1 -1
  280. package/dist/cli/agent-spawn.js +10 -1
  281. package/dist/cli/agent-spawn.js.map +1 -1
  282. package/dist/cli/anthropic-client.js +192 -13
  283. package/dist/cli/anthropic-client.js.map +1 -1
  284. package/dist/cli/cfn-context.js +150 -0
  285. package/dist/cli/cfn-context.js.map +1 -1
  286. package/dist/cli/cfn-fork.js +159 -0
  287. package/dist/cli/cfn-fork.js.map +1 -0
  288. package/dist/cli/cli-agent-context.js +8 -3
  289. package/dist/cli/cli-agent-context.js.map +1 -1
  290. package/dist/cli/config-manager.js +109 -91
  291. package/dist/cli/config-manager.js.map +1 -1
  292. package/dist/cli/conversation-fork.js +201 -0
  293. package/dist/cli/conversation-fork.js.map +1 -0
  294. package/dist/cli/index.js +4 -0
  295. package/dist/cli/index.js.map +1 -1
  296. package/dist/cli/tool-definitions.js +263 -0
  297. package/dist/cli/tool-definitions.js.map +1 -0
  298. package/dist/cli/tool-executor.js +247 -0
  299. package/dist/cli/tool-executor.js.map +1 -0
  300. package/dist/hello.js +8 -0
  301. package/dist/hello.js.map +1 -0
  302. package/package.json +14 -6
  303. package/scripts/README.md +68 -0
  304. package/scripts/cfn-intervention-example.sh +21 -0
  305. package/scripts/migrate-test-infrastructure.sh +40 -0
  306. package/scripts/validate-test-migration.sh +49 -0
  307. package/scripts/verify-no-secrets.sh +55 -0
  308. package/.claude/agents/architecture/system-architect.md.backup +0 -603
  309. package/.claude/agents/code-booster.md +0 -131
  310. package/.claude/agents/consensus/performance-benchmarker.md +0 -101
  311. package/.claude/agents/consensus/security-manager.md +0 -107
  312. package/.claude/agents/context-curator.md +0 -167
  313. package/.claude/agents/context-reflector.md +0 -65
  314. package/.claude/agents/core-agents/cfn-loop-coordinator.md +0 -134
  315. package/.claude/agents/core-agents/code-quality-validator.md +0 -149
  316. package/.claude/agents/core-agents/context-curator.md +0 -452
  317. package/.claude/agents/core-agents/context-reflector.md +0 -273
  318. package/.claude/agents/core-agents/cost-savings-cfn-loop-coordinator.md +0 -235
  319. package/.claude/agents/core-agents/tester.md +0 -170
  320. package/.claude/agents/development/backend-dev.md +0 -165
  321. package/.claude/agents/devops/devops-engineer.md +0 -148
  322. package/.claude/agents/frontend/interaction-tester.md +0 -139
  323. package/.claude/agents/frontend/react-frontend-engineer.md +0 -9
  324. package/.claude/agents/personas/accessibility-advocate-persona.md +0 -107
  325. package/.claude/agents/testing/production-validator.md +0 -179
  326. package/.claude/agents/testing/tdd-london-swarm.md +0 -209
  327. package/.claude/agents/testing/unit/tdd-london-swarm.md +0 -43
  328. package/.claude/agents/testing/validation/production-validator.md +0 -43
  329. package/.claude/api-configs/config-current-zai-config.env +0 -62
  330. package/.claude/api-configs/config-test-zai-config.env +0 -62
  331. package/.claude/api-configs/env-backups/before-anthropic-20251020-025404.env +0 -62
  332. package/.claude/api-configs/env-backups/before-restore-20251020-025431.env +0 -62
  333. package/.claude/skills/redis-coordination/orchestrate-cfn-loop.sh.backup-1760949407 +0 -933
  334. package/dist/cli/cli-agent-context.test.js +0 -451
  335. package/dist/cli/cli-agent-context.test.js.map +0 -1
  336. package/dist/coordination/fleet-manager.test.js +0 -141
  337. package/dist/coordination/fleet-manager.test.js.map +0 -1
  338. package/dist/middleware/transparency-middleware.test.js +0 -184
  339. package/dist/middleware/transparency-middleware.test.js.map +0 -1
  340. /package/.claude/agents/{core-agents → developers}/researcher.md +0 -0
  341. /package/.claude/agents/{consensus → specialists}/crdt-synchronizer.md +0 -0
  342. /package/.claude/agents/{consensus → specialists}/quorum-manager.md +0 -0
  343. /package/.claude/agents/{consensus → specialists}/raft-manager.md +0 -0
  344. /package/.claude/{agents/core-agents → agents-ignore}/coordinator.md +0 -0
  345. /package/.claude/{agents/core-agents/cost-savings-coordinator.md → agents-ignore/cost-savings-coordinator.md.backup} +0 -0
  346. /package/.claude/skills/redis-coordination/{phase4-wake-queue-test-report.md → demos/phase4-wake-queue-test-report.md} +0 -0
  347. /package/.claude/skills/redis-coordination/{test-bzpopmin-fix.sh → demos/test-bzpopmin-fix.sh} +0 -0
  348. /package/.claude/skills/redis-coordination/{test-cancel-swarm.sh → demos/test-cancel-swarm.sh} +0 -0
  349. /package/.claude/skills/redis-coordination/{test-dlq.sh → demos/test-dlq.sh} +0 -0
  350. /package/.claude/skills/redis-coordination/{test-iteration-feedback.sh → demos/test-iteration-feedback.sh} +0 -0
  351. /package/.claude/skills/redis-coordination/{test-priority-wake-phase4-unix.sh → demos/test-priority-wake-phase4-unix.sh} +0 -0
  352. /package/.claude/skills/redis-coordination/{test-priority-wake-phase4.sh → demos/test-priority-wake-phase4.sh} +0 -0
  353. /package/.claude/skills/redis-coordination/{test-priority-wake.sh → demos/test-priority-wake.sh} +0 -0
  354. /package/.claude/skills/redis-coordination/{test-quick-fix.sh → demos/test-quick-fix.sh} +0 -0
  355. /package/.claude/skills/redis-coordination/{test-quorum-absolute.sh → demos/test-quorum-absolute.sh} +0 -0
  356. /package/.claude/skills/redis-coordination/{test-quorum-fallback.sh → demos/test-quorum-fallback.sh} +0 -0
  357. /package/.claude/skills/redis-coordination/{test-quorum-percentage.sh → demos/test-quorum-percentage.sh} +0 -0
  358. /package/.claude/skills/redis-coordination/{test-quorum-with-retry.sh → demos/test-quorum-with-retry.sh} +0 -0
  359. /package/.claude/skills/redis-coordination/{test-quorum.sh → demos/test-quorum.sh} +0 -0
  360. /package/.claude/skills/redis-coordination/{test-shutdown-handling.sh → demos/test-shutdown-handling.sh} +0 -0
  361. /package/.claude/skills/redis-coordination/{test-shutdown.sh → demos/test-shutdown.sh} +0 -0
  362. /package/.claude/skills/redis-coordination/{test-utils-unix.sh → demos/test-utils-unix.sh} +0 -0
  363. /package/.claude/skills/redis-coordination/{test-utils.sh → demos/test-utils.sh} +0 -0
  364. /package/.claude/skills/redis-coordination/{test-waiting-mode.sh → demos/test-waiting-mode.sh} +0 -0
@@ -1,995 +1,1002 @@
1
- # Agent Creation & Customization Guide
2
-
3
- **Version:** 4.0.0
4
- **Last Updated:** 2025-10-20
5
- **Audience:** NPM Users & Developers
6
-
7
- This is your practical guide to creating, customizing, and maintaining AI agents in the Claude Flow Novice system. Whether you're using our npm package or building custom workflows, this guide will help you create powerful, specialized agents tailored to your needs.
8
-
9
- ---
10
-
11
- ## Table of Contents
12
-
13
- 1. [Quick Start - Create Your First Agent](#quick-start-create-your-first-agent)
14
- 2. [Understanding the Agent Directory](#understanding-the-agent-directory)
15
- 3. [Agent Anatomy](#agent-anatomy)
16
- 4. [Step-by-Step Agent Creation](#step-by-step-agent-creation)
17
- 5. [Ready-to-Use Templates](#ready-to-use-templates)
18
- 6. [Customization Guide](#customization-guide)
19
- 7. [Testing Your Agent](#testing-your-agent)
20
- 8. [Advanced Concepts](#advanced-concepts)
21
- 9. [Troubleshooting](#troubleshooting)
22
-
23
- ---
24
-
25
- ## Quick Start - Create Your First Agent
26
-
27
- ### What You'll Learn
28
- In 5 minutes, you'll create a custom agent that can perform specialized tasks in your workflow.
29
-
30
- ### Prerequisites
31
- ```bash
32
- # Install claude-flow-novice
33
- npm install claude-flow-novice
34
-
35
- # Verify installation
36
- npx claude-flow-novice --version
37
- ```
38
-
39
- ### Your First Agent (3 Steps)
40
-
41
- **Step 1: Create the agent file**
42
- ```bash
43
- mkdir -p .claude/agents/custom
44
- touch .claude/agents/custom/my-first-agent.md
45
- ```
46
-
47
- **Step 2: Add basic configuration**
48
- ```markdown
49
- ---
50
- name: my-first-agent
51
- description: |
52
- MUST BE USED when performing [your specific task].
53
- Keywords - [relevant, keywords, for, your, task]
54
- tools: [Read, Write, Edit, Bash, TodoWrite]
55
- model: haiku
56
- type: specialist
57
- ---
58
-
59
- # My First Agent
60
-
61
- You are a specialized agent that helps with [describe what your agent does].
62
-
63
- ## Core Responsibilities
64
- - [Responsibility 1]
65
- - [Responsibility 2]
66
- - [Responsibility 3]
67
-
68
- ## Approach
69
- [Describe how your agent should approach tasks]
70
- ```
71
-
72
- **Step 3: Test your agent**
73
- ```bash
74
- # Spawn your agent
75
- npx claude-flow-novice agent-spawn my-first-agent --task-id test-1
76
- ```
77
-
78
- **That's it!** You've created a working agent.
79
-
80
- ---
81
-
82
- ## Understanding the Agent Directory
83
-
84
- ### Directory Structure
85
-
86
- ```
87
- .claude/agents/
88
- ├── CLAUDE.md # This guide
89
- ├── core-agents/ # Production-ready core agents
90
- │ ├── coder.md # Code implementation
91
- │ ├── reviewer.md # Code review & quality
92
- │ ├── tester.md # Testing & validation
93
- │ └── coordinator.md # Multi-agent coordination
94
- ├── development/ # Development-focused agents
95
- ├── backend-dev.md
96
- ├── frontend-dev.md
97
- └── devops-engineer.md
98
- ├── security/ # Security-focused agents
99
- └── security-specialist.md
100
- ├── custom/ # YOUR CUSTOM AGENTS GO HERE
101
- │ └── your-agent.md
102
- └── templates/ # Reusable templates
103
- ├── redis-coordination.md
104
- ├── memory-operations.md
105
- └── team-dynamics.md
106
- ```
107
-
108
- ### Where to Put Your Agents
109
-
110
- **Option 1: Project-Specific** (Recommended for teams)
111
- ```bash
112
- # Lives in your project repo
113
- <project-root>/.claude/agents/custom/
114
- ```
115
- - Version controlled with your code
116
- - ✅ Shared across team
117
- - Project-specific workflows
118
-
119
- **Option 2: Personal Agents**
120
- ```bash
121
- # Lives in your home directory
122
- ~/.claude/agents/
123
- ```
124
- - ✅ Available across all projects
125
- - ✅ Personal productivity tools
126
- - ⚠️ Not shared with team
127
-
128
- ---
129
-
130
- ## Agent Anatomy
131
-
132
- Every agent has three main parts:
133
-
134
- ### 1. Frontmatter (YAML Configuration)
135
-
136
- ```yaml
137
- ---
138
- name: agent-name # Unique identifier (lowercase, hyphens)
139
- description: | # What the agent does & when to use it
140
- MUST BE USED when [use case].
141
- Keywords - [searchable, terms]
142
- tools: [Read, Write, Edit, Bash] # Available tools (Bash includes Redis CLI)
143
- model: haiku # haiku | sonnet | opus
144
- type: specialist # specialist | coordinator | swarm
145
- capabilities: # Optional tags
146
- - api-development
147
- - database-design
148
- acl_level: 1 # Data access level (1-5)
149
- ---
150
- ```
151
-
152
- ### 2. Agent Body (Instructions)
153
-
154
- ```markdown
155
- # Agent Name
156
-
157
- Brief description of what this agent does.
158
-
159
- ## Core Responsibilities
160
- - Primary duty 1
161
- - Primary duty 2
162
-
163
- ## Approach & Methodology
164
- How the agent thinks about and solves problems.
165
-
166
- ## Collaboration
167
- How this agent works with other agents.
168
-
169
- ## Success Metrics
170
- How to measure if the agent succeeded.
171
- ```
172
-
173
- ### 3. Template References (Optional)
174
-
175
- ```markdown
176
- ## Redis Coordination
177
- See: `.claude/templates/redis-coordination.md`
178
-
179
- ## Memory Operations
180
- See: `.claude/templates/memory-operations.md`
181
- ```
182
-
183
- ---
184
-
185
- ## Step-by-Step Agent Creation
186
-
187
- ### Step 1: Define Your Agent's Purpose
188
-
189
- **Ask yourself:**
190
- - What specific task will this agent perform?
191
- - When should it be automatically triggered?
192
- - What expertise does it need?
193
- - How will it collaborate with other agents?
194
-
195
- **Example:**
196
- > "I need an agent that reviews database schema migrations for security issues and performance problems."
197
-
198
- ### Step 2: Choose Your Template
199
-
200
- We provide 3 templates based on task complexity:
201
-
202
- | Template | Best For | Size | Example Use |
203
- |----------|----------|------|-------------|
204
- | **Simple** | Single, focused tasks | 100-200 lines | File formatter, linter |
205
- | **Standard** | Multi-step workflows | 200-400 lines | API developer, reviewer |
206
- | **Advanced** | Complex coordination | 400-700 lines | Architect, coordinator |
207
-
208
- ### Step 3: Create Your Agent File
209
-
210
- ```bash
211
- # For a database migration reviewer
212
- touch .claude/agents/custom/migration-reviewer.md
213
- ```
214
-
215
- ### Step 4: Fill in the Template
216
-
217
- **Simple Template Example:**
218
-
219
- ```markdown
220
- ---
221
- name: migration-reviewer
222
- description: |
223
- MUST BE USED when reviewing database migrations for security and performance.
224
- Use PROACTIVELY for SQL schema changes, migrations, database updates.
225
- Keywords - database, migration, schema, SQL, security, performance
226
- tools: [Read, Grep, TodoWrite]
227
- model: haiku
228
- type: specialist
229
- capabilities:
230
- - database-security
231
- - sql-review
232
- - performance-analysis
233
- acl_level: 3
234
- ---
235
-
236
- # Database Migration Reviewer
237
-
238
- You are a specialized database expert focused on reviewing migration files for
239
- security vulnerabilities and performance issues.
240
-
241
- ## Core Responsibilities
242
-
243
- 1. **Security Review**
244
- - Check for SQL injection vulnerabilities
245
- - Validate access control patterns
246
- - Review encryption of sensitive data
247
- - Ensure proper sanitization
248
-
249
- 2. **Performance Analysis**
250
- - Identify missing indexes
251
- - Flag inefficient queries
252
- - Check for N+1 query patterns
253
- - Validate transaction boundaries
254
-
255
- 3. **Best Practices**
256
- - Ensure migrations are reversible
257
- - Check for breaking changes
258
- - Validate naming conventions
259
- - Verify proper error handling
260
-
261
- ## Review Process
262
-
263
- 1. Read migration file
264
- 2. Analyze SQL patterns
265
- 3. Check against security checklist
266
- 4. Evaluate performance implications
267
- 5. Provide actionable feedback
268
-
269
- ## Output Format
270
-
271
- Provide a confidence score (0.0-1.0) and structured feedback:
272
- - Critical issues (must fix)
273
- - Warnings (should address)
274
- - Suggestions (nice to have)
275
- - Approved changes
276
-
277
- ## Success Metrics
278
- - Zero critical security issues
279
- - No obvious performance bottlenecks
280
- - Migrations are reversible
281
- - Confidence score 0.85
282
- ```
283
-
284
- ### Step 5: Test Your Agent
285
-
286
- ```bash
287
- # Test with a sample task
288
- npx claude-flow-novice agent-spawn migration-reviewer \
289
- --task-id test-migration \
290
- --prompt "Review the migration in db/migrations/001_add_users_table.sql"
291
- ```
292
-
293
- ---
294
-
295
- ## Ready-to-Use Templates
296
-
297
- ### Template 1: Code Implementer
298
-
299
- ```markdown
300
- ---
301
- name: my-implementer
302
- description: |
303
- MUST BE USED when implementing [specific type of code].
304
- Keywords - implement, build, create, develop
305
- tools: [Read, Write, Edit, Bash, TodoWrite]
306
- model: haiku
307
- type: specialist
308
- acl_level: 1
309
- ---
310
-
311
- # [Type] Implementer
312
-
313
- You implement [specific type of code] following best practices.
314
-
315
- ## Core Responsibilities
316
- - Write clean, maintainable code
317
- - Follow TDD approach
318
- - Implement features from specifications
319
- - Optimize for readability
320
-
321
- ## Implementation Workflow
322
- 1. Understand requirements
323
- 2. Write tests first
324
- 3. Implement solution
325
- 4. Refactor for quality
326
- 5. Validate coverage
327
-
328
- ## Success Criteria
329
- - All tests pass
330
- - Code coverage ≥ 80%
331
- - Follows coding standards
332
- - Confidence score ≥ 0.80
333
- ```
334
-
335
- ### Template 2: Code Reviewer
336
-
337
- ```markdown
338
- ---
339
- name: my-reviewer
340
- description: |
341
- MUST BE USED for reviewing [specific type of code].
342
- Keywords - review, validate, quality, security
343
- tools: [Read, Grep, TodoWrite]
344
- model: haiku
345
- type: validator
346
- acl_level: 3
347
- ---
348
-
349
- # [Type] Code Reviewer
350
-
351
- You review [specific type of code] for quality, security, and best practices.
352
-
353
- ## Review Criteria
354
-
355
- ### Code Quality
356
- - [ ] Clear variable names
357
- - [ ] Proper error handling
358
- - [ ] Minimal complexity
359
- - [ ] Good documentation
360
-
361
- ### Security
362
- - [ ] No hardcoded secrets
363
- - [ ] Proper input validation
364
- - [ ] Safe API usage
365
- - [ ] No XSS/injection risks
366
-
367
- ### Performance
368
- - [ ] Efficient algorithms
369
- - [ ] No memory leaks
370
- - [ ] Proper caching
371
- - [ ] Optimized queries
372
-
373
- ## Output Format
374
- Provide confidence score and categorized feedback:
375
- - 🔴 Critical (blocking issues)
376
- - 🟡 Warnings (should fix)
377
- - 🟢 Suggestions (improvements)
378
-
379
- ## Success Metrics
380
- - Confidence score ≥ 0.90
381
- - Zero critical issues
382
- - Actionable feedback provided
383
- ```
384
-
385
- ### Template 3: Specialist Agent
386
-
387
- ```markdown
388
- ---
389
- name: my-specialist
390
- description: |
391
- MUST BE USED when [specialized task].
392
- Use PROACTIVELY for [scenarios].
393
- Keywords - [domain, specific, keywords]
394
- tools: [Read, Write, Edit, Bash, Grep, Glob, TodoWrite]
395
- model: sonnet
396
- type: specialist
397
- capabilities:
398
- - [capability-1]
399
- - [capability-2]
400
- acl_level: 1
401
- ---
402
-
403
- # [Domain] Specialist
404
-
405
- You are an expert in [domain] with deep knowledge of [specific expertise].
406
-
407
- ## Expertise Areas
408
- - [Area 1]: [Description]
409
- - [Area 2]: [Description]
410
- - [Area 3]: [Description]
411
-
412
- ## Approach
413
- [How you analyze and solve problems in this domain]
414
-
415
- ## Tools & Techniques
416
- - [Tool/Technique 1]
417
- - [Tool/Technique 2]
418
- - [Tool/Technique 3]
419
-
420
- ## Collaboration
421
- - **With Implementers**: Provide specifications and guidance
422
- - **With Reviewers**: Share domain expertise
423
- - **Solo**: Full end-to-end implementation
424
-
425
- ## Success Metrics
426
- - Domain-specific quality criteria
427
- - Stakeholder satisfaction
428
- - Technical accuracy
429
- - Confidence score 0.85
430
- ```
431
-
432
- ---
433
-
434
- ## Customization Guide
435
-
436
- ### 1. Choosing the Right Model
437
-
438
- | Model | Speed | Cost | Best For |
439
- |-------|-------|------|----------|
440
- | **haiku** | ⚡⚡⚡ | $ | Simple tasks, quick iterations |
441
- | **sonnet** | ⚡⚡ | $$ | Balanced performance, most tasks |
442
- | **opus** | ⚡ | $$$ | Complex reasoning, critical tasks |
443
-
444
- **Recommendation:** Start with `haiku`, upgrade to `sonnet` if needed.
445
-
446
- ### 2. Selecting Tools
447
-
448
- Available tools:
449
- ```yaml
450
- # File Operations
451
- tools: [Read, Write, Edit, MultiEdit]
452
-
453
- # Search & Navigation
454
- tools: [Grep, Glob]
455
-
456
- # Execution
457
- tools: [Bash]
458
-
459
- # Coordination & Task Management
460
- tools: [TodoWrite]
461
-
462
- # Agent Spawning (Coordinators)
463
- tools: [Bash] # For CLI spawning: npx claude-flow-novice agent-spawn
464
- ```
465
-
466
- **Note:** Agent coordination uses Redis pub/sub + CLI spawning, not MCP tools.
467
-
468
- **Rule of Thumb:** Only include tools your agent will actually use. More tools = more complexity.
469
-
470
- ### 3. Setting ACL Levels
471
-
472
- | Level | Scope | Use When |
473
- |-------|-------|----------|
474
- | **1** | Private | Agent's own data only |
475
- | **3** | Swarm | Shared across team of agents |
476
- | **4** | Project | Strategic decisions, audit logs |
477
- | **5** | System | Infrastructure only |
478
-
479
- **Most agents use level 1 or 3.**
480
-
481
- ### 4. Adding Capabilities (Tags)
482
-
483
- ```yaml
484
- capabilities:
485
- - rust # Language expertise
486
- - api-design # Domain knowledge
487
- - security-review # Specialized skill
488
- - performance-opt # Focus area
489
- ```
490
-
491
- These help with agent discovery and routing.
492
-
493
- ### 5. Customizing Behavior
494
-
495
- **Tone & Style:**
496
- ```markdown
497
- You are a [friendly/professional/technical] agent that [approach].
498
-
499
- ## Communication Style
500
- - Use [formal/casual] language
501
- - Provide [detailed/concise] explanations
502
- - Focus on [theory/practice]
503
- ```
504
-
505
- **Decision-Making:**
506
- ```markdown
507
- ## Decision Framework
508
- When [situation], prioritize:
509
- 1. [Criterion 1]
510
- 2. [Criterion 2]
511
- 3. [Criterion 3]
512
- ```
513
-
514
- **Error Handling:**
515
- ```markdown
516
- ## Error Handling Strategy
517
- - For [error type]: [action]
518
- - If [condition]: [fallback]
519
- - Always: [safety measure]
520
- ```
521
-
522
- ---
523
-
524
- ## Testing Your Agent
525
-
526
- ### Manual Testing
527
-
528
- ```bash
529
- # Basic spawn test
530
- npx claude-flow-novice agent-spawn my-agent --task-id test-1
531
-
532
- # With specific prompt
533
- npx claude-flow-novice agent-spawn my-agent \
534
- --task-id test-2 \
535
- --prompt "Specific task instructions"
536
- ```
537
-
538
- ### Integration Testing
539
-
540
- Create a test task:
541
- ```bash
542
- # Create test directory
543
- mkdir -p tests/agents
544
-
545
- # Create test file
546
- cat > tests/agents/test-my-agent.sh << 'EOF'
547
- #!/bin/bash
548
- set -e
549
-
550
- echo "Testing my-agent..."
551
-
552
- # Spawn agent
553
- npx claude-flow-novice agent-spawn my-agent \
554
- --task-id test-integration
555
-
556
- # Verify output
557
- # [Add your verification logic]
558
-
559
- echo "✅ Test passed"
560
- EOF
561
-
562
- chmod +x tests/agents/test-my-agent.sh
563
-
564
- # Run test
565
- ./tests/agents/test-my-agent.sh
566
- ```
567
-
568
- ### Validation Checklist
569
-
570
- Before deploying your agent:
571
-
572
- - [ ] YAML frontmatter is valid
573
- - [ ] Name is unique and descriptive
574
- - [ ] Description includes use cases and keywords
575
- - [ ] Tools list includes only needed tools
576
- - [ ] Core responsibilities are clear
577
- - [ ] Success metrics are defined
578
- - [ ] Agent tested with sample tasks
579
- - [ ] Documentation is complete
580
-
581
- ---
582
-
583
- ## Advanced Concepts
584
-
585
- ### Multi-Agent Coordination
586
-
587
- Agents can work together using Redis pub/sub and CLI spawning:
588
-
589
- ```markdown
590
- ## Redis Coordination
591
- → See: `.claude/templates/redis-coordination.md`
592
-
593
- ### Agent Spawning Pattern
594
- ```bash
595
- # Spawn agents via CLI (coordinators only)
596
- npx claude-flow-novice agent-spawn backend-dev --task-id "${TASK_ID}"
597
- npx claude-flow-novice agent-spawn reviewer --task-id "${TASK_ID}"
598
- ```
599
-
600
- ### Signaling Pattern
601
- ```bash
602
- # Signal completion
603
- redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
604
-
605
- # Wait for other agent (zero-token blocking)
606
- redis-cli blpop "swarm:${TASK_ID}:other-agent:done" 30
607
- ```
608
- ```
609
-
610
- ### Memory Operations
611
-
612
- Agents can persist and share data:
613
-
614
- ```markdown
615
- ## Memory Operations
616
- → See: `.claude/templates/memory-operations.md`
617
-
618
- ### SQLite Integration
619
- ```typescript
620
- await sqlite.memoryAdapter.set(
621
- `agent/${agentId}/data/${taskId}`,
622
- { confidence: 0.85, status: 'complete' },
623
- { aclLevel: 1, ttl: 2592000 }
624
- );
625
- ```
626
- ```
627
-
628
- ### CFN Loop Integration
629
-
630
- For self-correcting workflows:
631
-
632
- ```markdown
633
- ## CFN Loop Mechanics
634
- → See: `.claude/templates/cfn-loop-mechanics.md`
635
-
636
- Agents participate in 3-loop validation:
637
- - Loop 3: Implementation
638
- - Loop 2: Validation
639
- - Loop 4: Strategic decisions
640
- ```
641
-
642
- ### Lifecycle Hooks
643
-
644
- ```yaml
645
- lifecycle:
646
- pre_task: |
647
- # Runs before agent starts
648
- echo "Initializing agent..."
649
-
650
- post_task: |
651
- # Runs after agent completes
652
- echo "Agent completed with confidence: ${CONFIDENCE_SCORE}"
653
- ```
654
-
655
- ### Validation Hooks
656
-
657
- ```yaml
658
- validation_hooks:
659
- - agent-template-validator # Validates agent structure
660
- - cfn-loop-memory-validator # Validates memory operations
661
- - test-coverage-validator # Validates test coverage
662
- ```
663
-
664
- ---
665
-
666
- ## Troubleshooting
667
-
668
- ### Agent Not Found
669
-
670
- **Problem:** `Error: Agent 'my-agent' not found`
671
-
672
- **Solutions:**
673
- 1. Check file is in `.claude/agents/` directory
674
- 2. Verify filename matches agent name: `my-agent.md`
675
- 3. Ensure YAML frontmatter has `name: my-agent`
676
-
677
- ### Invalid YAML
678
-
679
- **Problem:** `Error: Invalid YAML frontmatter`
680
-
681
- **Solutions:**
682
- 1. Check YAML syntax with `---` delimiters
683
- 2. Ensure proper indentation (2 spaces)
684
- 3. Quote special characters in strings
685
- 4. Validate at https://www.yamllint.com/
686
-
687
- ### Agent Behavior Issues
688
-
689
- **Problem:** Agent doesn't perform as expected
690
-
691
- **Solutions:**
692
- 1. Review and clarify core responsibilities
693
- 2. Simplify instructions (less is often more)
694
- 3. Add specific examples of desired behavior
695
- 4. Test with varied prompts
696
- 5. Check model choice (try upgrading haiku → sonnet)
697
-
698
- ### Tools Not Working
699
-
700
- **Problem:** `Error: Tool [X] not available`
701
-
702
- **Solutions:**
703
- 1. Verify tool is in frontmatter `tools` list
704
- 2. Check spelling matches exactly
705
- 3. For agent spawning, use Bash tool with CLI commands
706
- 4. Review tool permissions
707
-
708
- ### Memory/Coordination Issues
709
-
710
- **Problem:** Agents can't share data
711
-
712
- **Solutions:**
713
- 1. Check Redis is running: `redis-cli ping`
714
- 2. Verify ACL levels are compatible
715
- 3. Ensure memory keys follow patterns
716
- 4. Check SQLite database exists
717
-
718
- ---
719
-
720
- ## Example: Complete Custom Agent
721
-
722
- Here's a real-world example - a Terraform reviewer agent:
723
-
724
- ```markdown
725
- ---
726
- name: terraform-reviewer
727
- description: |
728
- MUST BE USED when reviewing Terraform infrastructure code.
729
- Use PROACTIVELY for IaC review, security validation, cost optimization.
730
- Keywords - terraform, infrastructure, IaC, cloud, AWS, security
731
- tools: [Read, Grep, Glob, TodoWrite]
732
- model: sonnet
733
- type: specialist
734
- capabilities:
735
- - terraform
736
- - infrastructure-as-code
737
- - cloud-security
738
- - cost-optimization
739
- acl_level: 3
740
- ---
741
-
742
- # Terraform Infrastructure Reviewer
743
-
744
- You are an infrastructure expert specializing in Terraform code review with
745
- focus on security, best practices, and cost optimization.
746
-
747
- ## Core Responsibilities
748
-
749
- ### 1. Security Review
750
- - Check for exposed secrets or credentials
751
- - Validate IAM policies (principle of least privilege)
752
- - Review security group rules
753
- - Ensure encryption at rest and in transit
754
- - Verify logging and monitoring
755
-
756
- ### 2. Best Practices
757
- - Validate resource naming conventions
758
- - Check for proper tagging strategy
759
- - Ensure state management best practices
760
- - Review module structure and reusability
761
- - Validate provider versioning
762
-
763
- ### 3. Cost Optimization
764
- - Identify over-provisioned resources
765
- - Flag expensive resource types
766
- - Suggest reserved instances where applicable
767
- - Review data transfer patterns
768
- - Validate auto-scaling configurations
769
-
770
- ### 4. Compliance
771
- - Check against company standards
772
- - Validate regulatory requirements
773
- - Ensure disaster recovery provisions
774
- - Review backup strategies
775
-
776
- ## Review Process
777
-
778
- 1. **Parse Terraform Files**
779
- - Read all `.tf` files in directory
780
- - Identify resource types and configurations
781
- - Map dependencies
782
-
783
- 2. **Security Analysis**
784
- - Run security checklist
785
- - Flag critical issues
786
- - Identify vulnerabilities
787
-
788
- 3. **Cost Analysis**
789
- - Estimate monthly costs
790
- - Identify optimization opportunities
791
- - Calculate potential savings
792
-
793
- 4. **Compliance Check**
794
- - Verify against standards
795
- - Document exceptions
796
- - Recommend remediation
797
-
798
- 5. **Generate Report**
799
- - Categorize findings by severity
800
- - Provide specific recommendations
801
- - Include confidence score
802
-
803
- ## Output Format
804
-
805
- ### Summary
806
- - Overall confidence score (0.0-1.0)
807
- - Total issues found by severity
808
- - Estimated monthly cost
809
- - Compliance status
810
-
811
- ### Detailed Findings
812
-
813
- **🔴 Critical Issues** (must fix before deployment)
814
- - [Issue description]
815
- - File: `path/to/file.tf:line`
816
- - Recommendation: [specific fix]
817
-
818
- **🟡 Warnings** (should address)
819
- - [Issue description]
820
- - Impact: [description]
821
- - Suggestion: [improvement]
822
-
823
- **🟢 Optimizations** (nice to have)
824
- - [Opportunity description]
825
- - Potential savings: [amount]
826
- - Effort: [low/medium/high]
827
-
828
- ## Success Metrics
829
- - Security score ≥ 0.90
830
- - Zero critical vulnerabilities
831
- - Cost optimization opportunities identified
832
- - Compliance requirements met
833
- - Clear, actionable feedback
834
-
835
- ## Collaboration
836
- - **With DevOps**: Review infrastructure changes
837
- - **With Security Team**: Validate security posture
838
- - **With Finance**: Optimize cloud spend
839
- - **Solo**: Complete IaC review and reporting
840
- ```
841
-
842
- **Usage:**
843
- ```bash
844
- npx claude-flow-novice agent-spawn terraform-reviewer \
845
- --prompt "Review Terraform files in ./infrastructure"
846
- ```
847
-
848
- ---
849
-
850
- ## Quick Reference
851
-
852
- ### Common Agent Patterns
853
-
854
- **Code Writer:**
855
- ```yaml
856
- tools: [Read, Write, Edit, Bash, TodoWrite]
857
- model: haiku
858
- type: specialist
859
- acl_level: 1
860
- ```
861
-
862
- **Code Reviewer:**
863
- ```yaml
864
- tools: [Read, Grep, TodoWrite]
865
- model: sonnet
866
- type: validator
867
- acl_level: 3
868
- ```
869
-
870
- **Coordinator:**
871
- ```yaml
872
- tools: [Read, Bash, TodoWrite] # Bash for Redis CLI + agent spawning
873
- model: sonnet
874
- type: coordinator
875
- acl_level: 3
876
- ```
877
-
878
- ### File Naming Convention
879
-
880
- ```
881
- .claude/agents/
882
- ├── [category]/
883
- │ └── [agent-name].md # lowercase, hyphens, descriptive
884
- ```
885
-
886
- **Good:** `terraform-reviewer.md`, `api-security-validator.md`
887
- **Bad:** `TerraformReviewer.md`, `agent1.md`, `myAgent.md`
888
-
889
- ### Essential YAML Fields
890
-
891
- **Minimum required:**
892
- ```yaml
893
- ---
894
- name: agent-name
895
- description: |
896
- What the agent does and when to use it
897
- tools: [Read, Write]
898
- model: haiku
899
- ---
900
- ```
901
-
902
- **Recommended:**
903
- ```yaml
904
- ---
905
- name: agent-name
906
- description: |
907
- MUST BE USED when [use case]
908
- Keywords - [keywords]
909
- tools: [Read, Write, Edit, TodoWrite]
910
- model: haiku
911
- type: specialist
912
- capabilities: [capability-tags]
913
- acl_level: 1
914
- ---
915
- ```
916
-
917
- ---
918
-
919
- ## Resources
920
-
921
- ### Template Files
922
- - `.claude/templates/redis-coordination.md` - Multi-agent coordination
923
- - `.claude/templates/memory-operations.md` - Data persistence
924
- - `.claude/templates/team-dynamics.md` - Agent collaboration
925
- - `.claude/templates/cfn-loop-mechanics.md` - Self-correcting workflows
926
-
927
- ### Example Agents
928
- - `.claude/agents/core-agents/coder.md` - Code implementation
929
- - `.claude/agents/core-agents/reviewer.md` - Code review
930
- - `.claude/agents/core-agents/tester.md` - Testing & validation
931
- - `.claude/agents/development/backend-dev.md` - Backend development
932
- - `.claude/agents/security/security-specialist.md` - Security analysis
933
-
934
- ### Documentation
935
- - `README.md` - Project overview
936
- - `.claude/skills/` - Reusable skill modules
937
- - `.claude/commands/` - Slash command definitions
938
-
939
- ### Technical Deep-Dive
940
-
941
- For advanced users who want to understand the theoretical foundations:
942
- - [Format Selection Principles](./agent-principles/format-selection.md)
943
- - [Agent Type Guidelines](./agent-principles/agent-type-guidelines.md)
944
- - [Prompt Engineering Best Practices](./agent-principles/prompt-engineering.md)
945
- - [Quality Metrics & Validation](./agent-principles/quality-metrics.md)
946
-
947
- ---
948
-
949
- ## Need Help?
950
-
951
- ### Common Questions
952
-
953
- **Q: How many agents should I create?**
954
- A: Start with 1-3 focused agents. Add more as needed. Quality > quantity.
955
-
956
- **Q: Should I modify core agents?**
957
- A: No, create custom agents instead. Core agents may be updated in new releases.
958
-
959
- **Q: Can agents call other agents?**
960
- A: Yes! Coordinators spawn agents via CLI: `npx claude-flow-novice agent-spawn [agent-name]`
961
-
962
- **Q: How do I share agents with my team?**
963
- A: Put them in `.claude/agents/` and commit to git.
964
-
965
- **Q: What's the difference between skills and agents?**
966
- A: Skills are reusable behaviors (like templates). Agents are executable workers that use skills.
967
-
968
- ### Getting Help
969
-
970
- 1. Check existing agents for examples
971
- 2. Review template files for patterns
972
- 3. Test incrementally with simple tasks
973
- 4. Start simple, add complexity gradually
974
- 5. Open issues on GitHub for bugs
975
-
976
- ---
977
-
978
- ## What's Next?
979
-
980
- Now that you understand agent creation, explore:
981
-
982
- 1. **Multi-Agent Workflows** - Coordinate multiple agents for complex tasks
983
- 2. **CFN Loop Integration** - Build self-correcting pipelines
984
- 3. **Custom Skills** - Create reusable behavior modules
985
- 4. **Web Portal** - Monitor agent execution in real-time
986
- 5. **Advanced Coordination** - Redis pub/sub, memory operations
987
-
988
- **Ready to build something amazing? Start creating your first agent!**
989
-
990
- ---
991
-
992
- **Document Version:** 4.0.0 (User-Friendly Edition)
993
- **Last Updated:** 2025-10-20
994
- **Maintained By:** Claude Flow Novice Team
995
- **Feedback:** We'd love to hear how you're using agents! Share your creations.
1
+ ---
2
+ name: agent-creation-guide
3
+ description: Practical guide to creating, customizing, and maintaining AI agents in the Claude Flow Novice system
4
+ model: claude-sonnet-4
5
+ tools: [Read, Write, Edit, Bash, Grep, Glob, TodoWrite]
6
+ ---
7
+
8
+ # Agent Creation & Customization Guide
9
+
10
+ **Version:** 4.0.0
11
+ **Last Updated:** 2025-10-20
12
+ **Audience:** NPM Users & Developers
13
+
14
+ This is your practical guide to creating, customizing, and maintaining AI agents in the Claude Flow Novice system. Whether you're using our npm package or building custom workflows, this guide will help you create powerful, specialized agents tailored to your needs.
15
+
16
+ ---
17
+
18
+ ## Table of Contents
19
+
20
+ 1. [Quick Start - Create Your First Agent](#quick-start-create-your-first-agent)
21
+ 2. [Understanding the Agent Directory](#understanding-the-agent-directory)
22
+ 3. [Agent Anatomy](#agent-anatomy)
23
+ 4. [Step-by-Step Agent Creation](#step-by-step-agent-creation)
24
+ 5. [Ready-to-Use Templates](#ready-to-use-templates)
25
+ 6. [Customization Guide](#customization-guide)
26
+ 7. [Testing Your Agent](#testing-your-agent)
27
+ 8. [Advanced Concepts](#advanced-concepts)
28
+ 9. [Troubleshooting](#troubleshooting)
29
+
30
+ ---
31
+
32
+ ## Quick Start - Create Your First Agent
33
+
34
+ ### What You'll Learn
35
+ In 5 minutes, you'll create a custom agent that can perform specialized tasks in your workflow.
36
+
37
+ ### Prerequisites
38
+ ```bash
39
+ # Install claude-flow-novice
40
+ npm install claude-flow-novice
41
+
42
+ # Verify installation
43
+ npx claude-flow-novice --version
44
+ ```
45
+
46
+ ### Your First Agent (3 Steps)
47
+
48
+ **Step 1: Create the agent file**
49
+ ```bash
50
+ mkdir -p .claude/agents/custom
51
+ touch .claude/agents/custom/my-first-agent.md
52
+ ```
53
+
54
+ **Step 2: Add basic configuration**
55
+ ```markdown
56
+ ---
57
+ name: my-first-agent
58
+ description: |
59
+ MUST BE USED when performing [your specific task].
60
+ Keywords - [relevant, keywords, for, your, task]
61
+ tools: [Read, Write, Edit, Bash, TodoWrite]
62
+ model: haiku
63
+ type: specialist
64
+ ---
65
+
66
+ # My First Agent
67
+
68
+ You are a specialized agent that helps with [describe what your agent does].
69
+
70
+ ## Core Responsibilities
71
+ - [Responsibility 1]
72
+ - [Responsibility 2]
73
+ - [Responsibility 3]
74
+
75
+ ## Approach
76
+ [Describe how your agent should approach tasks]
77
+ ```
78
+
79
+ **Step 3: Test your agent**
80
+ ```bash
81
+ # Spawn your agent
82
+ npx claude-flow-novice agent-spawn my-first-agent --task-id test-1
83
+ ```
84
+
85
+ **That's it!** You've created a working agent.
86
+
87
+ ---
88
+
89
+ ## Understanding the Agent Directory
90
+
91
+ ### Directory Structure
92
+
93
+ ```
94
+ .claude/agents/
95
+ ├── CLAUDE.md # This guide
96
+ ├── core-agents/ # Production-ready core agents
97
+ ├── coder.md # Code implementation
98
+ ├── reviewer.md # Code review & quality
99
+ ├── tester.md # Testing & validation
100
+ │ └── coordinator.md # Multi-agent coordination
101
+ ├── development/ # Development-focused agents
102
+ │ ├── backend-dev.md
103
+ ├── react-frontend-engineer.md
104
+ │ └── devops-engineer.md
105
+ ├── security/ # Security-focused agents
106
+ │ └── security-specialist.md
107
+ ├── custom/ # YOUR CUSTOM AGENTS GO HERE
108
+ │ └── your-agent.md
109
+ └── templates/ # Reusable templates
110
+ ├── redis-coordination.md
111
+ ├── memory-operations.md
112
+ └── team-dynamics.md
113
+ ```
114
+
115
+ ### Where to Put Your Agents
116
+
117
+ **Option 1: Project-Specific** (Recommended for teams)
118
+ ```bash
119
+ # Lives in your project repo
120
+ <project-root>/.claude/agents/custom/
121
+ ```
122
+ - ✅ Version controlled with your code
123
+ - ✅ Shared across team
124
+ - ✅ Project-specific workflows
125
+
126
+ **Option 2: Personal Agents**
127
+ ```bash
128
+ # Lives in your home directory
129
+ ~/.claude/agents/
130
+ ```
131
+ - ✅ Available across all projects
132
+ - Personal productivity tools
133
+ - ⚠️ Not shared with team
134
+
135
+ ---
136
+
137
+ ## Agent Anatomy
138
+
139
+ Every agent has three main parts:
140
+
141
+ ### 1. Frontmatter (YAML Configuration)
142
+
143
+ ```yaml
144
+ ---
145
+ name: agent-name # Unique identifier (lowercase, hyphens)
146
+ description: | # What the agent does & when to use it
147
+ MUST BE USED when [use case].
148
+ Keywords - [searchable, terms]
149
+ tools: [Read, Write, Edit, Bash] # Available tools (Bash includes Redis CLI)
150
+ model: haiku # haiku | sonnet | opus
151
+ type: specialist # specialist | coordinator | swarm
152
+ capabilities: # Optional tags
153
+ - api-development
154
+ - database-design
155
+ acl_level: 1 # Data access level (1-5)
156
+ ---
157
+ ```
158
+
159
+ ### 2. Agent Body (Instructions)
160
+
161
+ ```markdown
162
+ # Agent Name
163
+
164
+ Brief description of what this agent does.
165
+
166
+ ## Core Responsibilities
167
+ - Primary duty 1
168
+ - Primary duty 2
169
+
170
+ ## Approach & Methodology
171
+ How the agent thinks about and solves problems.
172
+
173
+ ## Collaboration
174
+ How this agent works with other agents.
175
+
176
+ ## Success Metrics
177
+ How to measure if the agent succeeded.
178
+ ```
179
+
180
+ ### 3. Template References (Optional)
181
+
182
+ ```markdown
183
+ ## Redis Coordination
184
+ → See: `.claude/templates/redis-coordination.md`
185
+
186
+ ## Memory Operations
187
+ See: `.claude/templates/memory-operations.md`
188
+ ```
189
+
190
+ ---
191
+
192
+ ## Step-by-Step Agent Creation
193
+
194
+ ### Step 1: Define Your Agent's Purpose
195
+
196
+ **Ask yourself:**
197
+ - What specific task will this agent perform?
198
+ - When should it be automatically triggered?
199
+ - What expertise does it need?
200
+ - How will it collaborate with other agents?
201
+
202
+ **Example:**
203
+ > "I need an agent that reviews database schema migrations for security issues and performance problems."
204
+
205
+ ### Step 2: Choose Your Template
206
+
207
+ We provide 3 templates based on task complexity:
208
+
209
+ | Template | Best For | Size | Example Use |
210
+ |----------|----------|------|-------------|
211
+ | **Simple** | Single, focused tasks | 100-200 lines | File formatter, linter |
212
+ | **Standard** | Multi-step workflows | 200-400 lines | API developer, reviewer |
213
+ | **Advanced** | Complex coordination | 400-700 lines | Architect, coordinator |
214
+
215
+ ### Step 3: Create Your Agent File
216
+
217
+ ```bash
218
+ # For a database migration reviewer
219
+ touch .claude/agents/custom/migration-reviewer.md
220
+ ```
221
+
222
+ ### Step 4: Fill in the Template
223
+
224
+ **Simple Template Example:**
225
+
226
+ ```markdown
227
+ ---
228
+ name: migration-reviewer
229
+ description: |
230
+ MUST BE USED when reviewing database migrations for security and performance.
231
+ Use PROACTIVELY for SQL schema changes, migrations, database updates.
232
+ Keywords - database, migration, schema, SQL, security, performance
233
+ tools: [Read, Grep, TodoWrite]
234
+ model: haiku
235
+ type: specialist
236
+ capabilities:
237
+ - database-security
238
+ - sql-review
239
+ - performance-analysis
240
+ acl_level: 3
241
+ ---
242
+
243
+ # Database Migration Reviewer
244
+
245
+ You are a specialized database expert focused on reviewing migration files for
246
+ security vulnerabilities and performance issues.
247
+
248
+ ## Core Responsibilities
249
+
250
+ 1. **Security Review**
251
+ - Check for SQL injection vulnerabilities
252
+ - Validate access control patterns
253
+ - Review encryption of sensitive data
254
+ - Ensure proper sanitization
255
+
256
+ 2. **Performance Analysis**
257
+ - Identify missing indexes
258
+ - Flag inefficient queries
259
+ - Check for N+1 query patterns
260
+ - Validate transaction boundaries
261
+
262
+ 3. **Best Practices**
263
+ - Ensure migrations are reversible
264
+ - Check for breaking changes
265
+ - Validate naming conventions
266
+ - Verify proper error handling
267
+
268
+ ## Review Process
269
+
270
+ 1. Read migration file
271
+ 2. Analyze SQL patterns
272
+ 3. Check against security checklist
273
+ 4. Evaluate performance implications
274
+ 5. Provide actionable feedback
275
+
276
+ ## Output Format
277
+
278
+ Provide a confidence score (0.0-1.0) and structured feedback:
279
+ - Critical issues (must fix)
280
+ - Warnings (should address)
281
+ - Suggestions (nice to have)
282
+ - Approved changes
283
+
284
+ ## Success Metrics
285
+ - Zero critical security issues
286
+ - No obvious performance bottlenecks
287
+ - Migrations are reversible
288
+ - Confidence score ≥ 0.85
289
+ ```
290
+
291
+ ### Step 5: Test Your Agent
292
+
293
+ ```bash
294
+ # Test with a sample task
295
+ npx claude-flow-novice agent-spawn migration-reviewer \
296
+ --task-id test-migration \
297
+ --prompt "Review the migration in db/migrations/001_add_users_table.sql"
298
+ ```
299
+
300
+ ---
301
+
302
+ ## Ready-to-Use Templates
303
+
304
+ ### Template 1: Code Implementer
305
+
306
+ ```markdown
307
+ ---
308
+ name: my-implementer
309
+ description: |
310
+ MUST BE USED when implementing [specific type of code].
311
+ Keywords - implement, build, create, develop
312
+ tools: [Read, Write, Edit, Bash, TodoWrite]
313
+ model: haiku
314
+ type: specialist
315
+ acl_level: 1
316
+ ---
317
+
318
+ # [Type] Implementer
319
+
320
+ You implement [specific type of code] following best practices.
321
+
322
+ ## Core Responsibilities
323
+ - Write clean, maintainable code
324
+ - Follow TDD approach
325
+ - Implement features from specifications
326
+ - Optimize for readability
327
+
328
+ ## Implementation Workflow
329
+ 1. Understand requirements
330
+ 2. Write tests first
331
+ 3. Implement solution
332
+ 4. Refactor for quality
333
+ 5. Validate coverage
334
+
335
+ ## Success Criteria
336
+ - All tests pass
337
+ - Code coverage ≥ 80%
338
+ - Follows coding standards
339
+ - Confidence score ≥ 0.80
340
+ ```
341
+
342
+ ### Template 2: Code Reviewer
343
+
344
+ ```markdown
345
+ ---
346
+ name: my-reviewer
347
+ description: |
348
+ MUST BE USED for reviewing [specific type of code].
349
+ Keywords - review, validate, quality, security
350
+ tools: [Read, Grep, TodoWrite]
351
+ model: haiku
352
+ type: validator
353
+ acl_level: 3
354
+ ---
355
+
356
+ # [Type] Code Reviewer
357
+
358
+ You review [specific type of code] for quality, security, and best practices.
359
+
360
+ ## Review Criteria
361
+
362
+ ### Code Quality
363
+ - [ ] Clear variable names
364
+ - [ ] Proper error handling
365
+ - [ ] Minimal complexity
366
+ - [ ] Good documentation
367
+
368
+ ### Security
369
+ - [ ] No hardcoded secrets
370
+ - [ ] Proper input validation
371
+ - [ ] Safe API usage
372
+ - [ ] No XSS/injection risks
373
+
374
+ ### Performance
375
+ - [ ] Efficient algorithms
376
+ - [ ] No memory leaks
377
+ - [ ] Proper caching
378
+ - [ ] Optimized queries
379
+
380
+ ## Output Format
381
+ Provide confidence score and categorized feedback:
382
+ - 🔴 Critical (blocking issues)
383
+ - 🟡 Warnings (should fix)
384
+ - 🟢 Suggestions (improvements)
385
+
386
+ ## Success Metrics
387
+ - Confidence score ≥ 0.90
388
+ - Zero critical issues
389
+ - Actionable feedback provided
390
+ ```
391
+
392
+ ### Template 3: Specialist Agent
393
+
394
+ ```markdown
395
+ ---
396
+ name: my-specialist
397
+ description: |
398
+ MUST BE USED when [specialized task].
399
+ Use PROACTIVELY for [scenarios].
400
+ Keywords - [domain, specific, keywords]
401
+ tools: [Read, Write, Edit, Bash, Grep, Glob, TodoWrite]
402
+ model: sonnet
403
+ type: specialist
404
+ capabilities:
405
+ - [capability-1]
406
+ - [capability-2]
407
+ acl_level: 1
408
+ ---
409
+
410
+ # [Domain] Specialist
411
+
412
+ You are an expert in [domain] with deep knowledge of [specific expertise].
413
+
414
+ ## Expertise Areas
415
+ - [Area 1]: [Description]
416
+ - [Area 2]: [Description]
417
+ - [Area 3]: [Description]
418
+
419
+ ## Approach
420
+ [How you analyze and solve problems in this domain]
421
+
422
+ ## Tools & Techniques
423
+ - [Tool/Technique 1]
424
+ - [Tool/Technique 2]
425
+ - [Tool/Technique 3]
426
+
427
+ ## Collaboration
428
+ - **With Implementers**: Provide specifications and guidance
429
+ - **With Reviewers**: Share domain expertise
430
+ - **Solo**: Full end-to-end implementation
431
+
432
+ ## Success Metrics
433
+ - Domain-specific quality criteria
434
+ - Stakeholder satisfaction
435
+ - Technical accuracy
436
+ - Confidence score 0.85
437
+ ```
438
+
439
+ ---
440
+
441
+ ## Customization Guide
442
+
443
+ ### 1. Choosing the Right Model
444
+
445
+ | Model | Speed | Cost | Best For |
446
+ |-------|-------|------|----------|
447
+ | **haiku** | ⚡⚡⚡ | $ | Simple tasks, quick iterations |
448
+ | **sonnet** | ⚡⚡ | $$ | Balanced performance, most tasks |
449
+ | **opus** | ⚡ | $$$ | Complex reasoning, critical tasks |
450
+
451
+ **Recommendation:** Start with `haiku`, upgrade to `sonnet` if needed.
452
+
453
+ ### 2. Selecting Tools
454
+
455
+ Available tools:
456
+ ```yaml
457
+ # File Operations
458
+ tools: [Read, Write, Edit, MultiEdit]
459
+
460
+ # Search & Navigation
461
+ tools: [Grep, Glob]
462
+
463
+ # Execution
464
+ tools: [Bash]
465
+
466
+ # Coordination & Task Management
467
+ tools: [TodoWrite]
468
+
469
+ # Agent Spawning (Coordinators)
470
+ tools: [Bash] # For CLI spawning: npx claude-flow-novice agent-spawn
471
+ ```
472
+
473
+ **Note:** Agent coordination uses Redis pub/sub + CLI spawning, not MCP tools.
474
+
475
+ **Rule of Thumb:** Only include tools your agent will actually use. More tools = more complexity.
476
+
477
+ ### 3. Setting ACL Levels
478
+
479
+ | Level | Scope | Use When |
480
+ |-------|-------|----------|
481
+ | **1** | Private | Agent's own data only |
482
+ | **3** | Swarm | Shared across team of agents |
483
+ | **4** | Project | Strategic decisions, audit logs |
484
+ | **5** | System | Infrastructure only |
485
+
486
+ **Most agents use level 1 or 3.**
487
+
488
+ ### 4. Adding Capabilities (Tags)
489
+
490
+ ```yaml
491
+ capabilities:
492
+ - rust # Language expertise
493
+ - api-design # Domain knowledge
494
+ - security-review # Specialized skill
495
+ - performance-opt # Focus area
496
+ ```
497
+
498
+ These help with agent discovery and routing.
499
+
500
+ ### 5. Customizing Behavior
501
+
502
+ **Tone & Style:**
503
+ ```markdown
504
+ You are a [friendly/professional/technical] agent that [approach].
505
+
506
+ ## Communication Style
507
+ - Use [formal/casual] language
508
+ - Provide [detailed/concise] explanations
509
+ - Focus on [theory/practice]
510
+ ```
511
+
512
+ **Decision-Making:**
513
+ ```markdown
514
+ ## Decision Framework
515
+ When [situation], prioritize:
516
+ 1. [Criterion 1]
517
+ 2. [Criterion 2]
518
+ 3. [Criterion 3]
519
+ ```
520
+
521
+ **Error Handling:**
522
+ ```markdown
523
+ ## Error Handling Strategy
524
+ - For [error type]: [action]
525
+ - If [condition]: [fallback]
526
+ - Always: [safety measure]
527
+ ```
528
+
529
+ ---
530
+
531
+ ## Testing Your Agent
532
+
533
+ ### Manual Testing
534
+
535
+ ```bash
536
+ # Basic spawn test
537
+ npx claude-flow-novice agent-spawn my-agent --task-id test-1
538
+
539
+ # With specific prompt
540
+ npx claude-flow-novice agent-spawn my-agent \
541
+ --task-id test-2 \
542
+ --prompt "Specific task instructions"
543
+ ```
544
+
545
+ ### Integration Testing
546
+
547
+ Create a test task:
548
+ ```bash
549
+ # Create test directory
550
+ mkdir -p tests/agents
551
+
552
+ # Create test file
553
+ cat > tests/agents/test-my-agent.sh << 'EOF'
554
+ #!/bin/bash
555
+ set -e
556
+
557
+ echo "Testing my-agent..."
558
+
559
+ # Spawn agent
560
+ npx claude-flow-novice agent-spawn my-agent \
561
+ --task-id test-integration
562
+
563
+ # Verify output
564
+ # [Add your verification logic]
565
+
566
+ echo "✅ Test passed"
567
+ EOF
568
+
569
+ chmod +x tests/agents/test-my-agent.sh
570
+
571
+ # Run test
572
+ ./tests/agents/test-my-agent.sh
573
+ ```
574
+
575
+ ### Validation Checklist
576
+
577
+ Before deploying your agent:
578
+
579
+ - [ ] YAML frontmatter is valid
580
+ - [ ] Name is unique and descriptive
581
+ - [ ] Description includes use cases and keywords
582
+ - [ ] Tools list includes only needed tools
583
+ - [ ] Core responsibilities are clear
584
+ - [ ] Success metrics are defined
585
+ - [ ] Agent tested with sample tasks
586
+ - [ ] Documentation is complete
587
+
588
+ ---
589
+
590
+ ## Advanced Concepts
591
+
592
+ ### Multi-Agent Coordination
593
+
594
+ Agents can work together using Redis pub/sub and CLI spawning:
595
+
596
+ ```markdown
597
+ ## Redis Coordination
598
+ → See: `.claude/templates/redis-coordination.md`
599
+
600
+ ### Agent Spawning Pattern
601
+ ```bash
602
+ # Spawn agents via CLI (coordinators only)
603
+ npx claude-flow-novice agent-spawn backend-dev --task-id "${TASK_ID}"
604
+ npx claude-flow-novice agent-spawn reviewer --task-id "${TASK_ID}"
605
+ ```
606
+
607
+ ### Signaling Pattern
608
+ ```bash
609
+ # Signal completion
610
+ redis-cli lpush "swarm:${TASK_ID}:${AGENT_ID}:done" "complete"
611
+
612
+ # Wait for other agent (zero-token blocking)
613
+ redis-cli blpop "swarm:${TASK_ID}:other-agent:done" 30
614
+ ```
615
+ ```
616
+
617
+ ### Memory Operations
618
+
619
+ Agents can persist and share data:
620
+
621
+ ```markdown
622
+ ## Memory Operations
623
+ See: `.claude/templates/memory-operations.md`
624
+
625
+ ### SQLite Integration
626
+ ```typescript
627
+ await sqlite.memoryAdapter.set(
628
+ `agent/${agentId}/data/${taskId}`,
629
+ { confidence: 0.85, status: 'complete' },
630
+ { aclLevel: 1, ttl: 2592000 }
631
+ );
632
+ ```
633
+ ```
634
+
635
+ ### CFN Loop Integration
636
+
637
+ For self-correcting workflows:
638
+
639
+ ```markdown
640
+ ## CFN Loop Mechanics
641
+ → See: `.claude/templates/cfn-loop-mechanics.md`
642
+
643
+ Agents participate in 3-loop validation:
644
+ - Loop 3: Implementation
645
+ - Loop 2: Validation
646
+ - Loop 4: Strategic decisions
647
+ ```
648
+
649
+ ### Lifecycle Hooks
650
+
651
+ ```yaml
652
+ lifecycle:
653
+ pre_task: |
654
+ # Runs before agent starts
655
+ echo "Initializing agent..."
656
+
657
+ post_task: |
658
+ # Runs after agent completes
659
+ echo "Agent completed with confidence: ${CONFIDENCE_SCORE}"
660
+ ```
661
+
662
+ ### Validation Hooks
663
+
664
+ ```yaml
665
+ validation_hooks:
666
+ - agent-template-validator # Validates agent structure
667
+ - cfn-loop-memory-validator # Validates memory operations
668
+ - test-coverage-validator # Validates test coverage
669
+ ```
670
+
671
+ ---
672
+
673
+ ## Troubleshooting
674
+
675
+ ### Agent Not Found
676
+
677
+ **Problem:** `Error: Agent 'my-agent' not found`
678
+
679
+ **Solutions:**
680
+ 1. Check file is in `.claude/agents/` directory
681
+ 2. Verify filename matches agent name: `my-agent.md`
682
+ 3. Ensure YAML frontmatter has `name: my-agent`
683
+
684
+ ### Invalid YAML
685
+
686
+ **Problem:** `Error: Invalid YAML frontmatter`
687
+
688
+ **Solutions:**
689
+ 1. Check YAML syntax with `---` delimiters
690
+ 2. Ensure proper indentation (2 spaces)
691
+ 3. Quote special characters in strings
692
+ 4. Validate at https://www.yamllint.com/
693
+
694
+ ### Agent Behavior Issues
695
+
696
+ **Problem:** Agent doesn't perform as expected
697
+
698
+ **Solutions:**
699
+ 1. Review and clarify core responsibilities
700
+ 2. Simplify instructions (less is often more)
701
+ 3. Add specific examples of desired behavior
702
+ 4. Test with varied prompts
703
+ 5. Check model choice (try upgrading haiku → sonnet)
704
+
705
+ ### Tools Not Working
706
+
707
+ **Problem:** `Error: Tool [X] not available`
708
+
709
+ **Solutions:**
710
+ 1. Verify tool is in frontmatter `tools` list
711
+ 2. Check spelling matches exactly
712
+ 3. For agent spawning, use Bash tool with CLI commands
713
+ 4. Review tool permissions
714
+
715
+ ### Memory/Coordination Issues
716
+
717
+ **Problem:** Agents can't share data
718
+
719
+ **Solutions:**
720
+ 1. Check Redis is running: `redis-cli ping`
721
+ 2. Verify ACL levels are compatible
722
+ 3. Ensure memory keys follow patterns
723
+ 4. Check SQLite database exists
724
+
725
+ ---
726
+
727
+ ## Example: Complete Custom Agent
728
+
729
+ Here's a real-world example - a Terraform reviewer agent:
730
+
731
+ ```markdown
732
+ ---
733
+ name: terraform-reviewer
734
+ description: |
735
+ MUST BE USED when reviewing Terraform infrastructure code.
736
+ Use PROACTIVELY for IaC review, security validation, cost optimization.
737
+ Keywords - terraform, infrastructure, IaC, cloud, AWS, security
738
+ tools: [Read, Grep, Glob, TodoWrite]
739
+ model: sonnet
740
+ type: specialist
741
+ capabilities:
742
+ - terraform
743
+ - infrastructure-as-code
744
+ - cloud-security
745
+ - cost-optimization
746
+ acl_level: 3
747
+ ---
748
+
749
+ # Terraform Infrastructure Reviewer
750
+
751
+ You are an infrastructure expert specializing in Terraform code review with
752
+ focus on security, best practices, and cost optimization.
753
+
754
+ ## Core Responsibilities
755
+
756
+ ### 1. Security Review
757
+ - Check for exposed secrets or credentials
758
+ - Validate IAM policies (principle of least privilege)
759
+ - Review security group rules
760
+ - Ensure encryption at rest and in transit
761
+ - Verify logging and monitoring
762
+
763
+ ### 2. Best Practices
764
+ - Validate resource naming conventions
765
+ - Check for proper tagging strategy
766
+ - Ensure state management best practices
767
+ - Review module structure and reusability
768
+ - Validate provider versioning
769
+
770
+ ### 3. Cost Optimization
771
+ - Identify over-provisioned resources
772
+ - Flag expensive resource types
773
+ - Suggest reserved instances where applicable
774
+ - Review data transfer patterns
775
+ - Validate auto-scaling configurations
776
+
777
+ ### 4. Compliance
778
+ - Check against company standards
779
+ - Validate regulatory requirements
780
+ - Ensure disaster recovery provisions
781
+ - Review backup strategies
782
+
783
+ ## Review Process
784
+
785
+ 1. **Parse Terraform Files**
786
+ - Read all `.tf` files in directory
787
+ - Identify resource types and configurations
788
+ - Map dependencies
789
+
790
+ 2. **Security Analysis**
791
+ - Run security checklist
792
+ - Flag critical issues
793
+ - Identify vulnerabilities
794
+
795
+ 3. **Cost Analysis**
796
+ - Estimate monthly costs
797
+ - Identify optimization opportunities
798
+ - Calculate potential savings
799
+
800
+ 4. **Compliance Check**
801
+ - Verify against standards
802
+ - Document exceptions
803
+ - Recommend remediation
804
+
805
+ 5. **Generate Report**
806
+ - Categorize findings by severity
807
+ - Provide specific recommendations
808
+ - Include confidence score
809
+
810
+ ## Output Format
811
+
812
+ ### Summary
813
+ - Overall confidence score (0.0-1.0)
814
+ - Total issues found by severity
815
+ - Estimated monthly cost
816
+ - Compliance status
817
+
818
+ ### Detailed Findings
819
+
820
+ **🔴 Critical Issues** (must fix before deployment)
821
+ - [Issue description]
822
+ - File: `path/to/file.tf:line`
823
+ - Recommendation: [specific fix]
824
+
825
+ **🟡 Warnings** (should address)
826
+ - [Issue description]
827
+ - Impact: [description]
828
+ - Suggestion: [improvement]
829
+
830
+ **🟢 Optimizations** (nice to have)
831
+ - [Opportunity description]
832
+ - Potential savings: [amount]
833
+ - Effort: [low/medium/high]
834
+
835
+ ## Success Metrics
836
+ - Security score 0.90
837
+ - Zero critical vulnerabilities
838
+ - Cost optimization opportunities identified
839
+ - Compliance requirements met
840
+ - Clear, actionable feedback
841
+
842
+ ## Collaboration
843
+ - **With DevOps**: Review infrastructure changes
844
+ - **With Security Team**: Validate security posture
845
+ - **With Finance**: Optimize cloud spend
846
+ - **Solo**: Complete IaC review and reporting
847
+ ```
848
+
849
+ **Usage:**
850
+ ```bash
851
+ npx claude-flow-novice agent-spawn terraform-reviewer \
852
+ --prompt "Review Terraform files in ./infrastructure"
853
+ ```
854
+
855
+ ---
856
+
857
+ ## Quick Reference
858
+
859
+ ### Common Agent Patterns
860
+
861
+ **Code Writer:**
862
+ ```yaml
863
+ tools: [Read, Write, Edit, Bash, TodoWrite]
864
+ model: haiku
865
+ type: specialist
866
+ acl_level: 1
867
+ ```
868
+
869
+ **Code Reviewer:**
870
+ ```yaml
871
+ tools: [Read, Grep, TodoWrite]
872
+ model: sonnet
873
+ type: validator
874
+ acl_level: 3
875
+ ```
876
+
877
+ **Coordinator:**
878
+ ```yaml
879
+ tools: [Read, Bash, TodoWrite] # Bash for Redis CLI + agent spawning
880
+ model: sonnet
881
+ type: coordinator
882
+ acl_level: 3
883
+ ```
884
+
885
+ ### File Naming Convention
886
+
887
+ ```
888
+ .claude/agents/
889
+ ├── [category]/
890
+ │ └── [agent-name].md # lowercase, hyphens, descriptive
891
+ ```
892
+
893
+ **Good:** `terraform-reviewer.md`, `api-security-validator.md`
894
+ **Bad:** `TerraformReviewer.md`, `agent1.md`, `myAgent.md`
895
+
896
+ ### Essential YAML Fields
897
+
898
+ **Minimum required:**
899
+ ```yaml
900
+ ---
901
+ name: agent-name
902
+ description: |
903
+ What the agent does and when to use it
904
+ tools: [Read, Write]
905
+ model: haiku
906
+ ---
907
+ ```
908
+
909
+ **Recommended:**
910
+ ```yaml
911
+ ---
912
+ name: agent-name
913
+ description: |
914
+ MUST BE USED when [use case]
915
+ Keywords - [keywords]
916
+ tools: [Read, Write, Edit, TodoWrite]
917
+ model: haiku
918
+ type: specialist
919
+ capabilities: [capability-tags]
920
+ acl_level: 1
921
+ ---
922
+ ```
923
+
924
+ ---
925
+
926
+ ## Resources
927
+
928
+ ### Template Files
929
+ - `.claude/templates/redis-coordination.md` - Multi-agent coordination
930
+ - `.claude/templates/memory-operations.md` - Data persistence
931
+ - `.claude/templates/team-dynamics.md` - Agent collaboration
932
+ - `.claude/templates/cfn-loop-mechanics.md` - Self-correcting workflows
933
+
934
+ ### Example Agents
935
+ - `.claude/agents/core-agents/coder.md` - Code implementation
936
+ - `.claude/agents/core-agents/reviewer.md` - Code review
937
+ - `.claude/agents/core-agents/tester.md` - Testing & validation
938
+ - `.claude/agents/development/backend-dev.md` - Backend development
939
+ - `.claude/agents/security/security-specialist.md` - Security analysis
940
+
941
+ ### Documentation
942
+ - `README.md` - Project overview
943
+ - `.claude/skills/` - Reusable skill modules
944
+ - `.claude/commands/` - Slash command definitions
945
+
946
+ ### Technical Deep-Dive
947
+
948
+ For advanced users who want to understand the theoretical foundations:
949
+ - [Format Selection Principles](./agent-principles/format-selection.md)
950
+ - [Agent Type Guidelines](./agent-principles/agent-type-guidelines.md)
951
+ - [Prompt Engineering Best Practices](./agent-principles/prompt-engineering.md)
952
+ - [Quality Metrics & Validation](./agent-principles/quality-metrics.md)
953
+
954
+ ---
955
+
956
+ ## Need Help?
957
+
958
+ ### Common Questions
959
+
960
+ **Q: How many agents should I create?**
961
+ A: Start with 1-3 focused agents. Add more as needed. Quality > quantity.
962
+
963
+ **Q: Should I modify core agents?**
964
+ A: No, create custom agents instead. Core agents may be updated in new releases.
965
+
966
+ **Q: Can agents call other agents?**
967
+ A: Yes! Coordinators spawn agents via CLI: `npx claude-flow-novice agent-spawn [agent-name]`
968
+
969
+ **Q: How do I share agents with my team?**
970
+ A: Put them in `.claude/agents/` and commit to git.
971
+
972
+ **Q: What's the difference between skills and agents?**
973
+ A: Skills are reusable behaviors (like templates). Agents are executable workers that use skills.
974
+
975
+ ### Getting Help
976
+
977
+ 1. Check existing agents for examples
978
+ 2. Review template files for patterns
979
+ 3. Test incrementally with simple tasks
980
+ 4. Start simple, add complexity gradually
981
+ 5. Open issues on GitHub for bugs
982
+
983
+ ---
984
+
985
+ ## What's Next?
986
+
987
+ Now that you understand agent creation, explore:
988
+
989
+ 1. **Multi-Agent Workflows** - Coordinate multiple agents for complex tasks
990
+ 2. **CFN Loop Integration** - Build self-correcting pipelines
991
+ 3. **Custom Skills** - Create reusable behavior modules
992
+ 4. **Web Portal** - Monitor agent execution in real-time
993
+ 5. **Advanced Coordination** - Redis pub/sub, memory operations
994
+
995
+ **Ready to build something amazing? Start creating your first agent!**
996
+
997
+ ---
998
+
999
+ **Document Version:** 4.0.0 (User-Friendly Edition)
1000
+ **Last Updated:** 2025-10-20
1001
+ **Maintained By:** Claude Flow Novice Team
1002
+ **Feedback:** We'd love to hear how you're using agents! Share your creations.