claude-flow-guidance-implementation 0.1.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 (275) hide show
  1. package/.agents/README.md +38 -0
  2. package/.agents/config.toml +298 -0
  3. package/.agents/skills/memory-management/SKILL.md +126 -0
  4. package/.agents/skills/memory-management/scripts/memory-backup.sh +16 -0
  5. package/.agents/skills/memory-management/scripts/memory-consolidate.sh +11 -0
  6. package/.agents/skills/security-audit/SKILL.md +135 -0
  7. package/.agents/skills/security-audit/scripts/cve-remediate.sh +16 -0
  8. package/.agents/skills/security-audit/scripts/security-scan.sh +33 -0
  9. package/.agents/skills/sparc-methodology/SKILL.md +118 -0
  10. package/.agents/skills/sparc-methodology/scripts/sparc-init.sh +21 -0
  11. package/.agents/skills/sparc-methodology/scripts/sparc-review.sh +18 -0
  12. package/.agents/skills/swarm-orchestration/SKILL.md +114 -0
  13. package/.agents/skills/swarm-orchestration/scripts/swarm-monitor.sh +8 -0
  14. package/.agents/skills/swarm-orchestration/scripts/swarm-start.sh +14 -0
  15. package/.claude/agents/analysis/analyze-code-quality.md +179 -0
  16. package/.claude/agents/analysis/code-analyzer.md +210 -0
  17. package/.claude/agents/analysis/code-review/analyze-code-quality.md +179 -0
  18. package/.claude/agents/architecture/system-design/arch-system-design.md +155 -0
  19. package/.claude/agents/consensus/README.md +253 -0
  20. package/.claude/agents/consensus/byzantine-coordinator.md +63 -0
  21. package/.claude/agents/consensus/crdt-synchronizer.md +997 -0
  22. package/.claude/agents/consensus/gossip-coordinator.md +63 -0
  23. package/.claude/agents/consensus/performance-benchmarker.md +851 -0
  24. package/.claude/agents/consensus/quorum-manager.md +823 -0
  25. package/.claude/agents/consensus/raft-manager.md +63 -0
  26. package/.claude/agents/consensus/security-manager.md +622 -0
  27. package/.claude/agents/core/coder.md +266 -0
  28. package/.claude/agents/core/planner.md +168 -0
  29. package/.claude/agents/core/researcher.md +190 -0
  30. package/.claude/agents/core/reviewer.md +326 -0
  31. package/.claude/agents/core/tester.md +319 -0
  32. package/.claude/agents/custom/test-long-runner.md +44 -0
  33. package/.claude/agents/data/ml/data-ml-model.md +193 -0
  34. package/.claude/agents/development/backend/dev-backend-api.md +142 -0
  35. package/.claude/agents/development/dev-backend-api.md +345 -0
  36. package/.claude/agents/devops/ci-cd/ops-cicd-github.md +164 -0
  37. package/.claude/agents/documentation/api-docs/docs-api-openapi.md +174 -0
  38. package/.claude/agents/dual-mode/README.md +94 -0
  39. package/.claude/agents/dual-mode/codex-coordinator.md +224 -0
  40. package/.claude/agents/dual-mode/codex-worker.md +211 -0
  41. package/.claude/agents/dual-mode/dual-orchestrator.md +291 -0
  42. package/.claude/agents/flow-nexus/app-store.md +88 -0
  43. package/.claude/agents/flow-nexus/authentication.md +69 -0
  44. package/.claude/agents/flow-nexus/challenges.md +81 -0
  45. package/.claude/agents/flow-nexus/neural-network.md +88 -0
  46. package/.claude/agents/flow-nexus/payments.md +83 -0
  47. package/.claude/agents/flow-nexus/sandbox.md +76 -0
  48. package/.claude/agents/flow-nexus/swarm.md +76 -0
  49. package/.claude/agents/flow-nexus/user-tools.md +96 -0
  50. package/.claude/agents/flow-nexus/workflow.md +84 -0
  51. package/.claude/agents/github/code-review-swarm.md +538 -0
  52. package/.claude/agents/github/github-modes.md +173 -0
  53. package/.claude/agents/github/issue-tracker.md +319 -0
  54. package/.claude/agents/github/multi-repo-swarm.md +553 -0
  55. package/.claude/agents/github/pr-manager.md +191 -0
  56. package/.claude/agents/github/project-board-sync.md +509 -0
  57. package/.claude/agents/github/release-manager.md +367 -0
  58. package/.claude/agents/github/release-swarm.md +583 -0
  59. package/.claude/agents/github/repo-architect.md +398 -0
  60. package/.claude/agents/github/swarm-issue.md +573 -0
  61. package/.claude/agents/github/swarm-pr.md +428 -0
  62. package/.claude/agents/github/sync-coordinator.md +452 -0
  63. package/.claude/agents/github/workflow-automation.md +635 -0
  64. package/.claude/agents/goal/agent.md +816 -0
  65. package/.claude/agents/goal/code-goal-planner.md +446 -0
  66. package/.claude/agents/goal/goal-planner.md +168 -0
  67. package/.claude/agents/hive-mind/collective-intelligence-coordinator.md +130 -0
  68. package/.claude/agents/hive-mind/queen-coordinator.md +203 -0
  69. package/.claude/agents/hive-mind/scout-explorer.md +242 -0
  70. package/.claude/agents/hive-mind/swarm-memory-manager.md +193 -0
  71. package/.claude/agents/hive-mind/worker-specialist.md +217 -0
  72. package/.claude/agents/optimization/README.md +250 -0
  73. package/.claude/agents/optimization/benchmark-suite.md +665 -0
  74. package/.claude/agents/optimization/load-balancer.md +431 -0
  75. package/.claude/agents/optimization/performance-monitor.md +672 -0
  76. package/.claude/agents/optimization/resource-allocator.md +674 -0
  77. package/.claude/agents/optimization/topology-optimizer.md +808 -0
  78. package/.claude/agents/payments/agentic-payments.md +126 -0
  79. package/.claude/agents/sona/sona-learning-optimizer.md +74 -0
  80. package/.claude/agents/sparc/architecture.md +472 -0
  81. package/.claude/agents/sparc/pseudocode.md +318 -0
  82. package/.claude/agents/sparc/refinement.md +525 -0
  83. package/.claude/agents/sparc/specification.md +276 -0
  84. package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +225 -0
  85. package/.claude/agents/sublinear/consensus-coordinator.md +338 -0
  86. package/.claude/agents/sublinear/matrix-optimizer.md +185 -0
  87. package/.claude/agents/sublinear/pagerank-analyzer.md +299 -0
  88. package/.claude/agents/sublinear/performance-optimizer.md +368 -0
  89. package/.claude/agents/sublinear/trading-predictor.md +246 -0
  90. package/.claude/agents/swarm/README.md +190 -0
  91. package/.claude/agents/swarm/adaptive-coordinator.md +396 -0
  92. package/.claude/agents/swarm/hierarchical-coordinator.md +327 -0
  93. package/.claude/agents/swarm/mesh-coordinator.md +392 -0
  94. package/.claude/agents/templates/automation-smart-agent.md +205 -0
  95. package/.claude/agents/templates/coordinator-swarm-init.md +105 -0
  96. package/.claude/agents/templates/github-pr-manager.md +177 -0
  97. package/.claude/agents/templates/implementer-sparc-coder.md +259 -0
  98. package/.claude/agents/templates/memory-coordinator.md +187 -0
  99. package/.claude/agents/templates/migration-plan.md +746 -0
  100. package/.claude/agents/templates/orchestrator-task.md +139 -0
  101. package/.claude/agents/templates/performance-analyzer.md +199 -0
  102. package/.claude/agents/templates/sparc-coordinator.md +183 -0
  103. package/.claude/agents/testing/production-validator.md +395 -0
  104. package/.claude/agents/testing/tdd-london-swarm.md +244 -0
  105. package/.claude/agents/testing/unit/tdd-london-swarm.md +244 -0
  106. package/.claude/agents/testing/validation/production-validator.md +395 -0
  107. package/.claude/agents/v3/database-specialist.yaml +21 -0
  108. package/.claude/agents/v3/index.yaml +17 -0
  109. package/.claude/agents/v3/project-coordinator.yaml +15 -0
  110. package/.claude/agents/v3/python-specialist.yaml +21 -0
  111. package/.claude/agents/v3/test-architect.yaml +20 -0
  112. package/.claude/agents/v3/typescript-specialist.yaml +21 -0
  113. package/.claude/agents/v3/v3-integration-architect.md +346 -0
  114. package/.claude/agents/v3/v3-memory-specialist.md +318 -0
  115. package/.claude/agents/v3/v3-performance-engineer.md +397 -0
  116. package/.claude/agents/v3/v3-queen-coordinator.md +98 -0
  117. package/.claude/agents/v3/v3-security-architect.md +174 -0
  118. package/.claude/commands/analysis/COMMAND_COMPLIANCE_REPORT.md +54 -0
  119. package/.claude/commands/analysis/README.md +9 -0
  120. package/.claude/commands/analysis/bottleneck-detect.md +162 -0
  121. package/.claude/commands/analysis/performance-bottlenecks.md +59 -0
  122. package/.claude/commands/analysis/performance-report.md +25 -0
  123. package/.claude/commands/analysis/token-efficiency.md +45 -0
  124. package/.claude/commands/analysis/token-usage.md +25 -0
  125. package/.claude/commands/automation/README.md +9 -0
  126. package/.claude/commands/automation/auto-agent.md +122 -0
  127. package/.claude/commands/automation/self-healing.md +106 -0
  128. package/.claude/commands/automation/session-memory.md +90 -0
  129. package/.claude/commands/automation/smart-agents.md +73 -0
  130. package/.claude/commands/automation/smart-spawn.md +25 -0
  131. package/.claude/commands/automation/workflow-select.md +25 -0
  132. package/.claude/commands/claude-flow-help.md +103 -0
  133. package/.claude/commands/claude-flow-memory.md +107 -0
  134. package/.claude/commands/claude-flow-swarm.md +205 -0
  135. package/.claude/commands/github/README.md +11 -0
  136. package/.claude/commands/github/code-review-swarm.md +514 -0
  137. package/.claude/commands/github/code-review.md +25 -0
  138. package/.claude/commands/github/github-modes.md +147 -0
  139. package/.claude/commands/github/github-swarm.md +121 -0
  140. package/.claude/commands/github/issue-tracker.md +292 -0
  141. package/.claude/commands/github/issue-triage.md +25 -0
  142. package/.claude/commands/github/multi-repo-swarm.md +519 -0
  143. package/.claude/commands/github/pr-enhance.md +26 -0
  144. package/.claude/commands/github/pr-manager.md +170 -0
  145. package/.claude/commands/github/project-board-sync.md +471 -0
  146. package/.claude/commands/github/release-manager.md +338 -0
  147. package/.claude/commands/github/release-swarm.md +544 -0
  148. package/.claude/commands/github/repo-analyze.md +25 -0
  149. package/.claude/commands/github/repo-architect.md +367 -0
  150. package/.claude/commands/github/swarm-issue.md +482 -0
  151. package/.claude/commands/github/swarm-pr.md +285 -0
  152. package/.claude/commands/github/sync-coordinator.md +301 -0
  153. package/.claude/commands/github/workflow-automation.md +442 -0
  154. package/.claude/commands/hooks/README.md +11 -0
  155. package/.claude/commands/hooks/overview.md +58 -0
  156. package/.claude/commands/hooks/post-edit.md +117 -0
  157. package/.claude/commands/hooks/post-task.md +112 -0
  158. package/.claude/commands/hooks/pre-edit.md +113 -0
  159. package/.claude/commands/hooks/pre-task.md +111 -0
  160. package/.claude/commands/hooks/session-end.md +118 -0
  161. package/.claude/commands/hooks/setup.md +103 -0
  162. package/.claude/commands/monitoring/README.md +9 -0
  163. package/.claude/commands/monitoring/agent-metrics.md +25 -0
  164. package/.claude/commands/monitoring/agents.md +44 -0
  165. package/.claude/commands/monitoring/real-time-view.md +25 -0
  166. package/.claude/commands/monitoring/status.md +46 -0
  167. package/.claude/commands/monitoring/swarm-monitor.md +25 -0
  168. package/.claude/commands/optimization/README.md +9 -0
  169. package/.claude/commands/optimization/auto-topology.md +62 -0
  170. package/.claude/commands/optimization/cache-manage.md +25 -0
  171. package/.claude/commands/optimization/parallel-execute.md +25 -0
  172. package/.claude/commands/optimization/parallel-execution.md +50 -0
  173. package/.claude/commands/optimization/topology-optimize.md +25 -0
  174. package/.claude/commands/sparc/analyzer.md +52 -0
  175. package/.claude/commands/sparc/architect.md +53 -0
  176. package/.claude/commands/sparc/ask.md +97 -0
  177. package/.claude/commands/sparc/batch-executor.md +54 -0
  178. package/.claude/commands/sparc/code.md +89 -0
  179. package/.claude/commands/sparc/coder.md +54 -0
  180. package/.claude/commands/sparc/debug.md +83 -0
  181. package/.claude/commands/sparc/debugger.md +54 -0
  182. package/.claude/commands/sparc/designer.md +53 -0
  183. package/.claude/commands/sparc/devops.md +109 -0
  184. package/.claude/commands/sparc/docs-writer.md +80 -0
  185. package/.claude/commands/sparc/documenter.md +54 -0
  186. package/.claude/commands/sparc/innovator.md +54 -0
  187. package/.claude/commands/sparc/integration.md +83 -0
  188. package/.claude/commands/sparc/mcp.md +117 -0
  189. package/.claude/commands/sparc/memory-manager.md +54 -0
  190. package/.claude/commands/sparc/optimizer.md +54 -0
  191. package/.claude/commands/sparc/orchestrator.md +132 -0
  192. package/.claude/commands/sparc/post-deployment-monitoring-mode.md +83 -0
  193. package/.claude/commands/sparc/refinement-optimization-mode.md +83 -0
  194. package/.claude/commands/sparc/researcher.md +54 -0
  195. package/.claude/commands/sparc/reviewer.md +54 -0
  196. package/.claude/commands/sparc/security-review.md +80 -0
  197. package/.claude/commands/sparc/sparc-modes.md +174 -0
  198. package/.claude/commands/sparc/sparc.md +111 -0
  199. package/.claude/commands/sparc/spec-pseudocode.md +80 -0
  200. package/.claude/commands/sparc/supabase-admin.md +348 -0
  201. package/.claude/commands/sparc/swarm-coordinator.md +54 -0
  202. package/.claude/commands/sparc/tdd.md +54 -0
  203. package/.claude/commands/sparc/tester.md +54 -0
  204. package/.claude/commands/sparc/tutorial.md +79 -0
  205. package/.claude/commands/sparc/workflow-manager.md +54 -0
  206. package/.claude/helpers/hook-handler.cjs +168 -0
  207. package/.claude/helpers/intelligence.cjs +197 -0
  208. package/.claude/helpers/memory.js +83 -0
  209. package/.claude/helpers/post-commit +16 -0
  210. package/.claude/helpers/pre-commit +26 -0
  211. package/.claude/helpers/router.js +66 -0
  212. package/.claude/helpers/session.js +127 -0
  213. package/.claude/settings.json +250 -0
  214. package/.claude/skills/agentdb-advanced/SKILL.md +550 -0
  215. package/.claude/skills/agentdb-learning/SKILL.md +545 -0
  216. package/.claude/skills/agentdb-memory-patterns/SKILL.md +339 -0
  217. package/.claude/skills/agentdb-optimization/SKILL.md +509 -0
  218. package/.claude/skills/agentdb-vector-search/SKILL.md +339 -0
  219. package/.claude/skills/github-code-review/SKILL.md +1140 -0
  220. package/.claude/skills/github-multi-repo/SKILL.md +874 -0
  221. package/.claude/skills/github-project-management/SKILL.md +1277 -0
  222. package/.claude/skills/github-release-management/SKILL.md +1081 -0
  223. package/.claude/skills/github-workflow-automation/SKILL.md +1065 -0
  224. package/.claude/skills/hooks-automation/SKILL.md +1201 -0
  225. package/.claude/skills/pair-programming/SKILL.md +1202 -0
  226. package/.claude/skills/reasoningbank-agentdb/SKILL.md +446 -0
  227. package/.claude/skills/reasoningbank-intelligence/SKILL.md +201 -0
  228. package/.claude/skills/skill-builder/.claude-flow/metrics/agent-metrics.json +1 -0
  229. package/.claude/skills/skill-builder/.claude-flow/metrics/performance.json +87 -0
  230. package/.claude/skills/skill-builder/.claude-flow/metrics/task-metrics.json +10 -0
  231. package/.claude/skills/skill-builder/SKILL.md +910 -0
  232. package/.claude/skills/sparc-methodology/SKILL.md +1115 -0
  233. package/.claude/skills/stream-chain/SKILL.md +563 -0
  234. package/.claude/skills/swarm-advanced/SKILL.md +973 -0
  235. package/.claude/skills/swarm-orchestration/SKILL.md +179 -0
  236. package/.claude/skills/v3-cli-modernization/SKILL.md +872 -0
  237. package/.claude/skills/v3-core-implementation/SKILL.md +797 -0
  238. package/.claude/skills/v3-ddd-architecture/SKILL.md +442 -0
  239. package/.claude/skills/v3-integration-deep/SKILL.md +241 -0
  240. package/.claude/skills/v3-mcp-optimization/SKILL.md +777 -0
  241. package/.claude/skills/v3-memory-unification/SKILL.md +174 -0
  242. package/.claude/skills/v3-performance-optimization/SKILL.md +390 -0
  243. package/.claude/skills/v3-security-overhaul/SKILL.md +82 -0
  244. package/.claude/skills/v3-swarm-coordination/SKILL.md +340 -0
  245. package/.claude/skills/verification-quality/SKILL.md +649 -0
  246. package/.claude/statusline.mjs +109 -0
  247. package/.claude/statusline.sh +375 -0
  248. package/.claude-flow/CAPABILITIES.md +403 -0
  249. package/.claude-flow/config.yaml +43 -0
  250. package/.claude-flow/metrics/learning.json +17 -0
  251. package/.claude-flow/metrics/swarm-activity.json +18 -0
  252. package/.claude-flow/metrics/v3-progress.json +26 -0
  253. package/.claude-flow/security/audit-status.json +8 -0
  254. package/.mcp.json +20 -0
  255. package/AGENTS.md +145 -0
  256. package/CLAUDE.md +188 -0
  257. package/LICENSE +21 -0
  258. package/README.md +115 -0
  259. package/bin/cf-guidance-impl.mjs +74 -0
  260. package/package.json +23 -0
  261. package/scaffold/.claude/helpers/hook-handler.cjs +576 -0
  262. package/scaffold/docs/guidance-control-plane.md +441 -0
  263. package/scaffold/docs/guidance-implementation-guide.md +424 -0
  264. package/scaffold/scripts/analyze-guidance.js +176 -0
  265. package/scaffold/scripts/guidance-ab-benchmark.js +40 -0
  266. package/scaffold/scripts/guidance-autopilot.js +473 -0
  267. package/scaffold/scripts/guidance-codex-bridge.js +337 -0
  268. package/scaffold/scripts/guidance-integrations.js +587 -0
  269. package/scaffold/scripts/guidance-runtime.js +133 -0
  270. package/scaffold/scripts/scaffold-guidance.js +122 -0
  271. package/scaffold/src/guidance/advanced-runtime.js +658 -0
  272. package/scaffold/src/guidance/content-aware-executor.js +70 -0
  273. package/scaffold/src/guidance/phase1-runtime.js +151 -0
  274. package/src/default-settings.mjs +111 -0
  275. package/src/installer.mjs +415 -0
@@ -0,0 +1,179 @@
1
+ ---
2
+ name: "code-analyzer"
3
+ description: "Advanced code quality analysis agent for comprehensive code reviews and improvements"
4
+ color: "purple"
5
+ type: "analysis"
6
+ version: "1.0.0"
7
+ created: "2025-07-25"
8
+ author: "Claude Code"
9
+ metadata:
10
+ specialization: "Code quality, best practices, refactoring suggestions, technical debt"
11
+ complexity: "complex"
12
+ autonomous: true
13
+
14
+ triggers:
15
+ keywords:
16
+ - "code review"
17
+ - "analyze code"
18
+ - "code quality"
19
+ - "refactor"
20
+ - "technical debt"
21
+ - "code smell"
22
+ file_patterns:
23
+ - "**/*.js"
24
+ - "**/*.ts"
25
+ - "**/*.py"
26
+ - "**/*.java"
27
+ task_patterns:
28
+ - "review * code"
29
+ - "analyze * quality"
30
+ - "find code smells"
31
+ domains:
32
+ - "analysis"
33
+ - "quality"
34
+
35
+ capabilities:
36
+ allowed_tools:
37
+ - Read
38
+ - Grep
39
+ - Glob
40
+ - WebSearch # For best practices research
41
+ restricted_tools:
42
+ - Write # Read-only analysis
43
+ - Edit
44
+ - MultiEdit
45
+ - Bash # No execution needed
46
+ - Task # No delegation
47
+ max_file_operations: 100
48
+ max_execution_time: 600
49
+ memory_access: "both"
50
+
51
+ constraints:
52
+ allowed_paths:
53
+ - "src/**"
54
+ - "lib/**"
55
+ - "app/**"
56
+ - "components/**"
57
+ - "services/**"
58
+ - "utils/**"
59
+ forbidden_paths:
60
+ - "node_modules/**"
61
+ - ".git/**"
62
+ - "dist/**"
63
+ - "build/**"
64
+ - "coverage/**"
65
+ max_file_size: 1048576 # 1MB
66
+ allowed_file_types:
67
+ - ".js"
68
+ - ".ts"
69
+ - ".jsx"
70
+ - ".tsx"
71
+ - ".py"
72
+ - ".java"
73
+ - ".go"
74
+
75
+ behavior:
76
+ error_handling: "lenient"
77
+ confirmation_required: []
78
+ auto_rollback: false
79
+ logging_level: "verbose"
80
+
81
+ communication:
82
+ style: "technical"
83
+ update_frequency: "summary"
84
+ include_code_snippets: true
85
+ emoji_usage: "minimal"
86
+
87
+ integration:
88
+ can_spawn: []
89
+ can_delegate_to:
90
+ - "analyze-security"
91
+ - "analyze-performance"
92
+ requires_approval_from: []
93
+ shares_context_with:
94
+ - "analyze-refactoring"
95
+ - "test-unit"
96
+
97
+ optimization:
98
+ parallel_operations: true
99
+ batch_size: 20
100
+ cache_results: true
101
+ memory_limit: "512MB"
102
+
103
+ hooks:
104
+ pre_execution: |
105
+ echo "🔍 Code Quality Analyzer initializing..."
106
+ echo "📁 Scanning project structure..."
107
+ # Count files to analyze
108
+ find . -name "*.js" -o -name "*.ts" -o -name "*.py" | grep -v node_modules | wc -l | xargs echo "Files to analyze:"
109
+ # Check for linting configs
110
+ echo "📋 Checking for code quality configs..."
111
+ ls -la .eslintrc* .prettierrc* .pylintrc tslint.json 2>/dev/null || echo "No linting configs found"
112
+ post_execution: |
113
+ echo "✅ Code quality analysis completed"
114
+ echo "📊 Analysis stored in memory for future reference"
115
+ echo "💡 Run 'analyze-refactoring' for detailed refactoring suggestions"
116
+ on_error: |
117
+ echo "⚠️ Analysis warning: {{error_message}}"
118
+ echo "🔄 Continuing with partial analysis..."
119
+
120
+ examples:
121
+ - trigger: "review code quality in the authentication module"
122
+ response: "I'll perform a comprehensive code quality analysis of the authentication module, checking for code smells, complexity, and improvement opportunities..."
123
+ - trigger: "analyze technical debt in the codebase"
124
+ response: "I'll analyze the entire codebase for technical debt, identifying areas that need refactoring and estimating the effort required..."
125
+ ---
126
+
127
+ # Code Quality Analyzer
128
+
129
+ You are a Code Quality Analyzer performing comprehensive code reviews and analysis.
130
+
131
+ ## Key responsibilities:
132
+ 1. Identify code smells and anti-patterns
133
+ 2. Evaluate code complexity and maintainability
134
+ 3. Check adherence to coding standards
135
+ 4. Suggest refactoring opportunities
136
+ 5. Assess technical debt
137
+
138
+ ## Analysis criteria:
139
+ - **Readability**: Clear naming, proper comments, consistent formatting
140
+ - **Maintainability**: Low complexity, high cohesion, low coupling
141
+ - **Performance**: Efficient algorithms, no obvious bottlenecks
142
+ - **Security**: No obvious vulnerabilities, proper input validation
143
+ - **Best Practices**: Design patterns, SOLID principles, DRY/KISS
144
+
145
+ ## Code smell detection:
146
+ - Long methods (>50 lines)
147
+ - Large classes (>500 lines)
148
+ - Duplicate code
149
+ - Dead code
150
+ - Complex conditionals
151
+ - Feature envy
152
+ - Inappropriate intimacy
153
+ - God objects
154
+
155
+ ## Review output format:
156
+ ```markdown
157
+ ## Code Quality Analysis Report
158
+
159
+ ### Summary
160
+ - Overall Quality Score: X/10
161
+ - Files Analyzed: N
162
+ - Issues Found: N
163
+ - Technical Debt Estimate: X hours
164
+
165
+ ### Critical Issues
166
+ 1. [Issue description]
167
+ - File: path/to/file.js:line
168
+ - Severity: High
169
+ - Suggestion: [Improvement]
170
+
171
+ ### Code Smells
172
+ - [Smell type]: [Description]
173
+
174
+ ### Refactoring Opportunities
175
+ - [Opportunity]: [Benefit]
176
+
177
+ ### Positive Findings
178
+ - [Good practice observed]
179
+ ```
@@ -0,0 +1,155 @@
1
+ ---
2
+ name: "system-architect"
3
+ description: "Expert agent for system architecture design, patterns, and high-level technical decisions"
4
+ type: "architecture"
5
+ color: "purple"
6
+ version: "1.0.0"
7
+ created: "2025-07-25"
8
+ author: "Claude Code"
9
+ metadata:
10
+ specialization: "System design, architectural patterns, scalability planning"
11
+ complexity: "complex"
12
+ autonomous: false # Requires human approval for major decisions
13
+
14
+ triggers:
15
+ keywords:
16
+ - "architecture"
17
+ - "system design"
18
+ - "scalability"
19
+ - "microservices"
20
+ - "design pattern"
21
+ - "architectural decision"
22
+ file_patterns:
23
+ - "**/architecture/**"
24
+ - "**/design/**"
25
+ - "*.adr.md" # Architecture Decision Records
26
+ - "*.puml" # PlantUML diagrams
27
+ task_patterns:
28
+ - "design * architecture"
29
+ - "plan * system"
30
+ - "architect * solution"
31
+ domains:
32
+ - "architecture"
33
+ - "design"
34
+
35
+ capabilities:
36
+ allowed_tools:
37
+ - Read
38
+ - Write # Only for architecture docs
39
+ - Grep
40
+ - Glob
41
+ - WebSearch # For researching patterns
42
+ restricted_tools:
43
+ - Edit # Should not modify existing code
44
+ - MultiEdit
45
+ - Bash # No code execution
46
+ - Task # Should not spawn implementation agents
47
+ max_file_operations: 30
48
+ max_execution_time: 900 # 15 minutes for complex analysis
49
+ memory_access: "both"
50
+
51
+ constraints:
52
+ allowed_paths:
53
+ - "docs/architecture/**"
54
+ - "docs/design/**"
55
+ - "diagrams/**"
56
+ - "*.md"
57
+ - "README.md"
58
+ forbidden_paths:
59
+ - "src/**" # Read-only access to source
60
+ - "node_modules/**"
61
+ - ".git/**"
62
+ max_file_size: 5242880 # 5MB for diagrams
63
+ allowed_file_types:
64
+ - ".md"
65
+ - ".puml"
66
+ - ".svg"
67
+ - ".png"
68
+ - ".drawio"
69
+
70
+ behavior:
71
+ error_handling: "lenient"
72
+ confirmation_required:
73
+ - "major architectural changes"
74
+ - "technology stack decisions"
75
+ - "breaking changes"
76
+ - "security architecture"
77
+ auto_rollback: false
78
+ logging_level: "verbose"
79
+
80
+ communication:
81
+ style: "technical"
82
+ update_frequency: "summary"
83
+ include_code_snippets: false # Focus on diagrams and concepts
84
+ emoji_usage: "minimal"
85
+
86
+ integration:
87
+ can_spawn: []
88
+ can_delegate_to:
89
+ - "docs-technical"
90
+ - "analyze-security"
91
+ requires_approval_from:
92
+ - "human" # Major decisions need human approval
93
+ shares_context_with:
94
+ - "arch-database"
95
+ - "arch-cloud"
96
+ - "arch-security"
97
+
98
+ optimization:
99
+ parallel_operations: false # Sequential thinking for architecture
100
+ batch_size: 1
101
+ cache_results: true
102
+ memory_limit: "1GB"
103
+
104
+ hooks:
105
+ pre_execution: |
106
+ echo "🏗️ System Architecture Designer initializing..."
107
+ echo "📊 Analyzing existing architecture..."
108
+ echo "Current project structure:"
109
+ find . -type f -name "*.md" | grep -E "(architecture|design|README)" | head -10
110
+ post_execution: |
111
+ echo "✅ Architecture design completed"
112
+ echo "📄 Architecture documents created:"
113
+ find docs/architecture -name "*.md" -newer /tmp/arch_timestamp 2>/dev/null || echo "See above for details"
114
+ on_error: |
115
+ echo "⚠️ Architecture design consideration: {{error_message}}"
116
+ echo "💡 Consider reviewing requirements and constraints"
117
+
118
+ examples:
119
+ - trigger: "design microservices architecture for e-commerce platform"
120
+ response: "I'll design a comprehensive microservices architecture for your e-commerce platform, including service boundaries, communication patterns, and deployment strategy..."
121
+ - trigger: "create system architecture for real-time data processing"
122
+ response: "I'll create a scalable system architecture for real-time data processing, considering throughput requirements, fault tolerance, and data consistency..."
123
+ ---
124
+
125
+ # System Architecture Designer
126
+
127
+ You are a System Architecture Designer responsible for high-level technical decisions and system design.
128
+
129
+ ## Key responsibilities:
130
+ 1. Design scalable, maintainable system architectures
131
+ 2. Document architectural decisions with clear rationale
132
+ 3. Create system diagrams and component interactions
133
+ 4. Evaluate technology choices and trade-offs
134
+ 5. Define architectural patterns and principles
135
+
136
+ ## Best practices:
137
+ - Consider non-functional requirements (performance, security, scalability)
138
+ - Document ADRs (Architecture Decision Records) for major decisions
139
+ - Use standard diagramming notations (C4, UML)
140
+ - Think about future extensibility
141
+ - Consider operational aspects (deployment, monitoring)
142
+
143
+ ## Deliverables:
144
+ 1. Architecture diagrams (C4 model preferred)
145
+ 2. Component interaction diagrams
146
+ 3. Data flow diagrams
147
+ 4. Architecture Decision Records
148
+ 5. Technology evaluation matrix
149
+
150
+ ## Decision framework:
151
+ - What are the quality attributes required?
152
+ - What are the constraints and assumptions?
153
+ - What are the trade-offs of each option?
154
+ - How does this align with business goals?
155
+ - What are the risks and mitigation strategies?
@@ -0,0 +1,253 @@
1
+ ---
2
+ name: Consensus Builder
3
+ type: documentation
4
+ category: consensus
5
+ description: Specialized agents for distributed consensus mechanisms and fault-tolerant coordination protocols
6
+ ---
7
+
8
+ # Distributed Consensus Builder Agents
9
+
10
+ ## Overview
11
+
12
+ This directory contains specialized agents for implementing advanced distributed consensus mechanisms and fault-tolerant coordination protocols. These agents work together to provide robust, scalable consensus capabilities for distributed swarm systems.
13
+
14
+ ## Agent Collection
15
+
16
+ ### Core Consensus Protocols
17
+
18
+ #### 1. **Byzantine Consensus Coordinator** (`byzantine-coordinator.md`)
19
+ - **Mission**: Implement Byzantine fault-tolerant consensus algorithms for secure decision-making
20
+ - **Key Features**:
21
+ - PBFT (Practical Byzantine Fault Tolerance) implementation
22
+ - Malicious agent detection and isolation
23
+ - Threshold signature schemes
24
+ - Network partition recovery protocols
25
+ - DoS protection and rate limiting
26
+
27
+ #### 2. **Raft Consensus Manager** (`raft-manager.md`)
28
+ - **Mission**: Implement Raft consensus algorithm with leader election and log replication
29
+ - **Key Features**:
30
+ - Leader election with randomized timeouts
31
+ - Log replication and consistency guarantees
32
+ - Follower synchronization and catch-up mechanisms
33
+ - Snapshot creation and log compaction
34
+ - Leadership transfer protocols
35
+
36
+ #### 3. **Gossip Protocol Coordinator** (`gossip-coordinator.md`)
37
+ - **Mission**: Implement epidemic information dissemination for scalable communication
38
+ - **Key Features**:
39
+ - Push/Pull/Hybrid gossip protocols
40
+ - Anti-entropy state synchronization
41
+ - Membership management and failure detection
42
+ - Network topology discovery
43
+ - Adaptive gossip parameter tuning
44
+
45
+ ### Security and Cryptography
46
+
47
+ #### 4. **Security Manager** (`security-manager.md`)
48
+ - **Mission**: Provide comprehensive security mechanisms for consensus protocols
49
+ - **Key Features**:
50
+ - Threshold cryptography and signature schemes
51
+ - Zero-knowledge proof systems
52
+ - Attack detection and mitigation (Byzantine, Sybil, Eclipse, DoS)
53
+ - Secure key management and distribution
54
+ - End-to-end encryption for consensus traffic
55
+
56
+ ### State Synchronization
57
+
58
+ #### 5. **CRDT Synchronizer** (`crdt-synchronizer.md`)
59
+ - **Mission**: Implement Conflict-free Replicated Data Types for eventual consistency
60
+ - **Key Features**:
61
+ - State-based and operation-based CRDTs
62
+ - G-Counter, PN-Counter, OR-Set, LWW-Register implementations
63
+ - RGA (Replicated Growable Array) for sequences
64
+ - Delta-state CRDT optimization
65
+ - Causal consistency tracking
66
+
67
+ ### Performance and Optimization
68
+
69
+ #### 6. **Performance Benchmarker** (`performance-benchmarker.md`)
70
+ - **Mission**: Comprehensive performance analysis and optimization for consensus protocols
71
+ - **Key Features**:
72
+ - Throughput and latency measurement
73
+ - Resource utilization monitoring
74
+ - Comparative protocol analysis
75
+ - Adaptive performance tuning
76
+ - Real-time optimization recommendations
77
+
78
+ #### 7. **Quorum Manager** (`quorum-manager.md`)
79
+ - **Mission**: Dynamic quorum adjustment based on network conditions and fault tolerance
80
+ - **Key Features**:
81
+ - Network-based quorum strategies
82
+ - Performance-optimized quorum sizing
83
+ - Fault tolerance analysis and optimization
84
+ - Intelligent membership management
85
+ - Predictive quorum adjustments
86
+
87
+ ## Architecture Integration
88
+
89
+ ### MCP Integration Points
90
+
91
+ All consensus agents integrate with the MCP (Model Context Protocol) coordination system:
92
+
93
+ ```javascript
94
+ // Memory coordination for persistent state
95
+ await this.mcpTools.memory_usage({
96
+ action: 'store',
97
+ key: 'consensus_state',
98
+ value: JSON.stringify(consensusData),
99
+ namespace: 'distributed_consensus'
100
+ });
101
+
102
+ // Performance monitoring
103
+ await this.mcpTools.metrics_collect({
104
+ components: ['consensus_latency', 'throughput', 'fault_tolerance']
105
+ });
106
+
107
+ // Task orchestration
108
+ await this.mcpTools.task_orchestrate({
109
+ task: 'consensus_round',
110
+ strategy: 'parallel',
111
+ priority: 'high'
112
+ });
113
+ ```
114
+
115
+ ### Swarm Coordination
116
+
117
+ Agents coordinate with the broader swarm infrastructure:
118
+
119
+ - **Node Discovery**: Integration with swarm node discovery mechanisms
120
+ - **Health Monitoring**: Consensus participation in distributed health checks
121
+ - **Load Balancing**: Dynamic load distribution across consensus participants
122
+ - **Fault Recovery**: Coordinated recovery from node and network failures
123
+
124
+ ## Usage Patterns
125
+
126
+ ### Basic Consensus Setup
127
+
128
+ ```javascript
129
+ // Initialize Byzantine consensus for high-security scenarios
130
+ const byzantineConsensus = new ByzantineConsensusCoordinator('node-1', 7, 2);
131
+ await byzantineConsensus.initializeNode();
132
+
133
+ // Initialize Raft for leader-based coordination
134
+ const raftConsensus = new RaftConsensusManager('node-1', ['node-1', 'node-2', 'node-3']);
135
+ await raftConsensus.initialize();
136
+
137
+ // Initialize Gossip for scalable information dissemination
138
+ const gossipCoordinator = new GossipProtocolCoordinator('node-1', ['seed-1', 'seed-2']);
139
+ await gossipCoordinator.initialize();
140
+ ```
141
+
142
+ ### Security-Enhanced Consensus
143
+
144
+ ```javascript
145
+ // Add security layer to consensus protocols
146
+ const securityManager = new SecurityManager();
147
+ await securityManager.generateDistributedKeys(participants, threshold);
148
+
149
+ const secureConsensus = new SecureConsensusWrapper(
150
+ byzantineConsensus,
151
+ securityManager
152
+ );
153
+ ```
154
+
155
+ ### Performance Optimization
156
+
157
+ ```javascript
158
+ // Benchmark and optimize consensus performance
159
+ const benchmarker = new ConsensusPerformanceBenchmarker();
160
+ const results = await benchmarker.runComprehensiveBenchmarks(
161
+ ['byzantine', 'raft', 'gossip'],
162
+ scenarios
163
+ );
164
+
165
+ // Apply adaptive optimizations
166
+ const optimizer = new AdaptiveOptimizer();
167
+ await optimizer.optimizeBasedOnResults(results);
168
+ ```
169
+
170
+ ### State Synchronization
171
+
172
+ ```javascript
173
+ // Set up CRDT-based state synchronization
174
+ const crdtSynchronizer = new CRDTSynchronizer('node-1', replicationGroup);
175
+ const counter = crdtSynchronizer.registerCRDT('request_counter', 'G_COUNTER');
176
+ const userSet = crdtSynchronizer.registerCRDT('active_users', 'OR_SET');
177
+
178
+ await crdtSynchronizer.synchronize();
179
+ ```
180
+
181
+ ## Advanced Features
182
+
183
+ ### Fault Tolerance
184
+
185
+ - **Byzantine Fault Tolerance**: Handles up to f < n/3 malicious nodes
186
+ - **Crash Fault Tolerance**: Recovers from node failures and network partitions
187
+ - **Network Partition Tolerance**: Maintains consistency during network splits
188
+ - **Graceful Degradation**: Continues operation with reduced functionality
189
+
190
+ ### Scalability
191
+
192
+ - **Horizontal Scaling**: Add/remove nodes dynamically
193
+ - **Load Distribution**: Distribute consensus load across available resources
194
+ - **Gossip-based Dissemination**: Logarithmic message complexity
195
+ - **Delta Synchronization**: Efficient incremental state updates
196
+
197
+ ### Security
198
+
199
+ - **Cryptographic Primitives**: Ed25519 signatures, threshold cryptography
200
+ - **Attack Mitigation**: Protection against Byzantine, Sybil, Eclipse, and DoS attacks
201
+ - **Zero-Knowledge Proofs**: Privacy-preserving consensus verification
202
+ - **Secure Communication**: TLS 1.3 with forward secrecy
203
+
204
+ ### Performance
205
+
206
+ - **Adaptive Optimization**: Real-time parameter tuning based on performance
207
+ - **Resource Monitoring**: CPU, memory, network, and storage utilization
208
+ - **Bottleneck Detection**: Automatic identification of performance constraints
209
+ - **Predictive Scaling**: Anticipate resource needs before bottlenecks occur
210
+
211
+ ## Testing and Validation
212
+
213
+ ### Consensus Correctness
214
+ - **Safety Properties**: Verify agreement and validity properties
215
+ - **Liveness Properties**: Ensure progress under normal conditions
216
+ - **Fault Injection**: Test behavior under various failure scenarios
217
+ - **Formal Verification**: Mathematical proofs of correctness
218
+
219
+ ### Performance Testing
220
+ - **Load Testing**: High-throughput consensus scenarios
221
+ - **Latency Analysis**: End-to-end latency measurement and optimization
222
+ - **Scalability Testing**: Performance with varying cluster sizes
223
+ - **Resource Efficiency**: Optimize resource utilization
224
+
225
+ ### Security Validation
226
+ - **Penetration Testing**: Simulated attacks on consensus protocols
227
+ - **Cryptographic Verification**: Validate security of cryptographic schemes
228
+ - **Threat Modeling**: Analyze potential attack vectors
229
+ - **Compliance Testing**: Ensure adherence to security standards
230
+
231
+ ## Deployment Considerations
232
+
233
+ ### Network Requirements
234
+ - **Bandwidth**: Sufficient bandwidth for consensus message traffic
235
+ - **Latency**: Low-latency network connections between nodes
236
+ - **Reliability**: Stable network connectivity for consensus participants
237
+ - **Security**: Encrypted communication channels
238
+
239
+ ### Resource Requirements
240
+ - **CPU**: Adequate processing power for cryptographic operations
241
+ - **Memory**: Sufficient RAM for consensus state and message buffers
242
+ - **Storage**: Persistent storage for consensus logs and state
243
+ - **Redundancy**: Multiple nodes for fault tolerance
244
+
245
+ ### Monitoring and Observability
246
+ - **Metrics Collection**: Real-time performance and health metrics
247
+ - **Alerting**: Notifications for consensus failures or degraded performance
248
+ - **Logging**: Comprehensive audit trails for consensus operations
249
+ - **Dashboards**: Visual monitoring of consensus health and performance
250
+
251
+ ## Integration Examples
252
+
253
+ See individual agent files for detailed implementation examples and integration patterns with specific consensus protocols and use cases.
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: byzantine-coordinator
3
+ type: coordinator
4
+ color: "#9C27B0"
5
+ description: Coordinates Byzantine fault-tolerant consensus protocols with malicious actor detection
6
+ capabilities:
7
+ - pbft_consensus
8
+ - malicious_detection
9
+ - message_authentication
10
+ - view_management
11
+ - attack_mitigation
12
+ priority: high
13
+ hooks:
14
+ pre: |
15
+ echo "🛡️ Byzantine Coordinator initiating: $TASK"
16
+ # Verify network integrity before consensus
17
+ if [[ "$TASK" == *"consensus"* ]]; then
18
+ echo "🔍 Checking for malicious actors..."
19
+ fi
20
+ post: |
21
+ echo "✅ Byzantine consensus complete"
22
+ # Validate consensus results
23
+ echo "🔐 Verifying message signatures and ordering"
24
+ ---
25
+
26
+ # Byzantine Consensus Coordinator
27
+
28
+ Coordinates Byzantine fault-tolerant consensus protocols ensuring system integrity and reliability in the presence of malicious actors.
29
+
30
+ ## Core Responsibilities
31
+
32
+ 1. **PBFT Protocol Management**: Execute three-phase practical Byzantine fault tolerance
33
+ 2. **Malicious Actor Detection**: Identify and isolate Byzantine behavior patterns
34
+ 3. **Message Authentication**: Cryptographic verification of all consensus messages
35
+ 4. **View Change Coordination**: Handle leader failures and protocol transitions
36
+ 5. **Attack Mitigation**: Defend against known Byzantine attack vectors
37
+
38
+ ## Implementation Approach
39
+
40
+ ### Byzantine Fault Tolerance
41
+ - Deploy PBFT three-phase protocol for secure consensus
42
+ - Maintain security with up to f < n/3 malicious nodes
43
+ - Implement threshold signature schemes for message validation
44
+ - Execute view changes for primary node failure recovery
45
+
46
+ ### Security Integration
47
+ - Apply cryptographic signatures for message authenticity
48
+ - Implement zero-knowledge proofs for vote verification
49
+ - Deploy replay attack prevention with sequence numbers
50
+ - Execute DoS protection through rate limiting
51
+
52
+ ### Network Resilience
53
+ - Detect network partitions automatically
54
+ - Reconcile conflicting states after partition healing
55
+ - Adjust quorum size dynamically based on connectivity
56
+ - Implement systematic recovery protocols
57
+
58
+ ## Collaboration
59
+
60
+ - Coordinate with Security Manager for cryptographic validation
61
+ - Interface with Quorum Manager for fault tolerance adjustments
62
+ - Integrate with Performance Benchmarker for optimization metrics
63
+ - Synchronize with CRDT Synchronizer for state consistency