moflo 4.9.21 → 4.9.22

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 (170) hide show
  1. package/.claude/agents/analysis/analyze-code-quality.md +0 -121
  2. package/.claude/agents/analysis/code-analyzer.md +5 -26
  3. package/.claude/agents/architecture/system-design/arch-system-design.md +0 -119
  4. package/.claude/agents/base-template-generator.md +0 -1
  5. package/.claude/agents/core/coder.md +0 -22
  6. package/.claude/agents/core/planner.md +0 -16
  7. package/.claude/agents/core/researcher.md +0 -16
  8. package/.claude/agents/core/reviewer.md +0 -17
  9. package/.claude/agents/core/tester.md +0 -19
  10. package/.claude/agents/custom/test-long-runner.md +0 -2
  11. package/.claude/agents/development/dev-backend-api.md +0 -167
  12. package/.claude/agents/development/dev-database.md +43 -0
  13. package/.claude/agents/development/dev-frontend.md +42 -0
  14. package/.claude/agents/devops/ci-cd/ops-cicd-github.md +0 -112
  15. package/.claude/agents/documentation/api-docs/docs-api-openapi.md +0 -111
  16. package/.claude/agents/security/security-auditor.md +45 -0
  17. package/.claude/guidance/shipped/moflo-guidance-rules.md +5 -5
  18. package/.claude/helpers/gate.cjs +70 -3
  19. package/.claude/skills/fl/execution-modes.md +38 -15
  20. package/bin/gate.cjs +70 -3
  21. package/bin/lib/retired-files.mjs +146 -0
  22. package/bin/session-start-launcher.mjs +101 -0
  23. package/dist/src/cli/appliance/rvfa-builder.js +1 -1
  24. package/dist/src/cli/commands/agent.js +3 -9
  25. package/dist/src/cli/commands/hooks.js +1 -3
  26. package/dist/src/cli/commands/index.js +2 -0
  27. package/dist/src/cli/commands/retire.js +111 -0
  28. package/dist/src/cli/hooks/reasoningbank/index.js +7 -7
  29. package/dist/src/cli/init/executor.js +26 -54
  30. package/dist/src/cli/init/helpers-generator.js +66 -3
  31. package/dist/src/cli/init/settings-generator.js +12 -0
  32. package/dist/src/cli/mcp-tools/agent-tools.js +9 -27
  33. package/dist/src/cli/mcp-tools/hooks-tools.js +23 -21
  34. package/dist/src/cli/memory/controllers/semantic-router.js +18 -12
  35. package/dist/src/cli/memory/sona-optimizer.js +6 -6
  36. package/dist/src/cli/neural/domain/services/learning-service.js +3 -3
  37. package/dist/src/cli/services/agent-router.js +2 -5
  38. package/dist/src/cli/services/hook-block-hash.js +4 -0
  39. package/dist/src/cli/shared/events/example-usage.js +6 -6
  40. package/dist/src/cli/shared/hooks/task-hooks.js +8 -8
  41. package/dist/src/cli/version.js +1 -1
  42. package/package.json +3 -2
  43. package/retired-files.json +1989 -0
  44. package/src/cli/data/model-registry.json +2 -2
  45. package/.claude/agents/consensus/byzantine-coordinator.md +0 -63
  46. package/.claude/agents/consensus/crdt-synchronizer.md +0 -997
  47. package/.claude/agents/consensus/gossip-coordinator.md +0 -63
  48. package/.claude/agents/consensus/performance-benchmarker.md +0 -851
  49. package/.claude/agents/consensus/quorum-manager.md +0 -823
  50. package/.claude/agents/consensus/raft-manager.md +0 -63
  51. package/.claude/agents/consensus/security-manager.md +0 -622
  52. package/.claude/agents/data/ml/data-ml-model.md +0 -193
  53. package/.claude/agents/github/code-review-swarm.md +0 -538
  54. package/.claude/agents/github/github-modes.md +0 -172
  55. package/.claude/agents/github/issue-tracker.md +0 -311
  56. package/.claude/agents/github/multi-repo-swarm.md +0 -551
  57. package/.claude/agents/github/pr-manager.md +0 -183
  58. package/.claude/agents/github/project-board-sync.md +0 -508
  59. package/.claude/agents/github/release-manager.md +0 -360
  60. package/.claude/agents/github/release-swarm.md +0 -580
  61. package/.claude/agents/github/repo-architect.md +0 -391
  62. package/.claude/agents/github/swarm-issue.md +0 -566
  63. package/.claude/agents/github/swarm-pr.md +0 -414
  64. package/.claude/agents/github/sync-coordinator.md +0 -426
  65. package/.claude/agents/github/workflow-automation.md +0 -606
  66. package/.claude/agents/goal/code-goal-planner.md +0 -440
  67. package/.claude/agents/goal/goal-planner.md +0 -168
  68. package/.claude/agents/hive-mind/collective-intelligence-coordinator.md +0 -127
  69. package/.claude/agents/hive-mind/queen-coordinator.md +0 -198
  70. package/.claude/agents/hive-mind/scout-explorer.md +0 -233
  71. package/.claude/agents/hive-mind/swarm-memory-manager.md +0 -184
  72. package/.claude/agents/hive-mind/worker-specialist.md +0 -208
  73. package/.claude/agents/neural/safla-neural.md +0 -73
  74. package/.claude/agents/optimization/benchmark-suite.md +0 -665
  75. package/.claude/agents/optimization/load-balancer.md +0 -431
  76. package/.claude/agents/optimization/performance-monitor.md +0 -672
  77. package/.claude/agents/optimization/resource-allocator.md +0 -674
  78. package/.claude/agents/optimization/topology-optimizer.md +0 -808
  79. package/.claude/agents/reasoning/goal-planner.md +0 -67
  80. package/.claude/agents/sona/sona-learning-optimizer.md +0 -74
  81. package/.claude/agents/sparc/architecture.md +0 -472
  82. package/.claude/agents/sparc/pseudocode.md +0 -318
  83. package/.claude/agents/sparc/refinement.md +0 -525
  84. package/.claude/agents/sparc/specification.md +0 -276
  85. package/.claude/agents/specialized/mobile/spec-mobile-react-native.md +0 -225
  86. package/.claude/agents/swarm/adaptive-coordinator.md +0 -391
  87. package/.claude/agents/swarm/hierarchical-coordinator.md +0 -321
  88. package/.claude/agents/swarm/mesh-coordinator.md +0 -383
  89. package/.claude/agents/testing/production-validator.md +0 -395
  90. package/.claude/agents/testing/tdd-london-swarm.md +0 -244
  91. package/.claude/agents/v3/adr-architect.md +0 -184
  92. package/.claude/agents/v3/aidefence-guardian.md +0 -277
  93. package/.claude/agents/v3/claims-authorizer.md +0 -208
  94. package/.claude/agents/v3/collective-intelligence-coordinator.md +0 -988
  95. package/.claude/agents/v3/ddd-domain-expert.md +0 -220
  96. package/.claude/agents/v3/injection-analyst.md +0 -232
  97. package/.claude/agents/v3/memory-specialist.md +0 -987
  98. package/.claude/agents/v3/performance-engineer.md +0 -1225
  99. package/.claude/agents/v3/pii-detector.md +0 -146
  100. package/.claude/agents/v3/reasoningbank-learner.md +0 -213
  101. package/.claude/agents/v3/security-architect-aidefence.md +0 -405
  102. package/.claude/agents/v3/security-architect.md +0 -865
  103. package/.claude/agents/v3/security-auditor.md +0 -771
  104. package/.claude/agents/v3/sparc-orchestrator.md +0 -182
  105. package/.claude/agents/v3/swarm-memory-manager.md +0 -142
  106. package/.claude/agents/v3/v3-integration-architect.md +0 -205
  107. package/.claude/commands/claude-flow-help.md +0 -103
  108. package/.claude/commands/claude-flow-memory.md +0 -107
  109. package/.claude/commands/claude-flow-swarm.md +0 -205
  110. package/.claude/commands/flo-simplify.md +0 -101
  111. package/.claude/commands/github/README.md +0 -11
  112. package/.claude/commands/github/code-review-swarm.md +0 -514
  113. package/.claude/commands/github/code-review.md +0 -25
  114. package/.claude/commands/github/github-modes.md +0 -146
  115. package/.claude/commands/github/github-swarm.md +0 -113
  116. package/.claude/commands/github/issue-tracker.md +0 -284
  117. package/.claude/commands/github/issue-triage.md +0 -25
  118. package/.claude/commands/github/multi-repo-swarm.md +0 -519
  119. package/.claude/commands/github/pr-enhance.md +0 -26
  120. package/.claude/commands/github/pr-manager.md +0 -164
  121. package/.claude/commands/github/project-board-sync.md +0 -471
  122. package/.claude/commands/github/release-manager.md +0 -332
  123. package/.claude/commands/github/release-swarm.md +0 -544
  124. package/.claude/commands/github/repo-analyze.md +0 -25
  125. package/.claude/commands/github/repo-architect.md +0 -361
  126. package/.claude/commands/github/swarm-issue.md +0 -482
  127. package/.claude/commands/github/swarm-pr.md +0 -285
  128. package/.claude/commands/github/sync-coordinator.md +0 -294
  129. package/.claude/commands/github/workflow-automation.md +0 -442
  130. package/.claude/commands/hooks/README.md +0 -11
  131. package/.claude/commands/hooks/overview.md +0 -58
  132. package/.claude/commands/hooks/post-edit.md +0 -117
  133. package/.claude/commands/hooks/post-task.md +0 -112
  134. package/.claude/commands/hooks/pre-edit.md +0 -113
  135. package/.claude/commands/hooks/pre-task.md +0 -111
  136. package/.claude/commands/hooks/session-end.md +0 -118
  137. package/.claude/commands/hooks/setup.md +0 -103
  138. package/.claude/commands/sparc/analyzer.md +0 -42
  139. package/.claude/commands/sparc/architect.md +0 -43
  140. package/.claude/commands/sparc/ask.md +0 -86
  141. package/.claude/commands/sparc/batch-executor.md +0 -44
  142. package/.claude/commands/sparc/code.md +0 -78
  143. package/.claude/commands/sparc/coder.md +0 -44
  144. package/.claude/commands/sparc/debug.md +0 -72
  145. package/.claude/commands/sparc/debugger.md +0 -44
  146. package/.claude/commands/sparc/designer.md +0 -43
  147. package/.claude/commands/sparc/devops.md +0 -98
  148. package/.claude/commands/sparc/docs-writer.md +0 -69
  149. package/.claude/commands/sparc/documenter.md +0 -44
  150. package/.claude/commands/sparc/innovator.md +0 -44
  151. package/.claude/commands/sparc/integration.md +0 -72
  152. package/.claude/commands/sparc/mcp.md +0 -106
  153. package/.claude/commands/sparc/memory-manager.md +0 -44
  154. package/.claude/commands/sparc/optimizer.md +0 -44
  155. package/.claude/commands/sparc/orchestrator.md +0 -116
  156. package/.claude/commands/sparc/post-deployment-monitoring-mode.md +0 -72
  157. package/.claude/commands/sparc/refinement-optimization-mode.md +0 -72
  158. package/.claude/commands/sparc/researcher.md +0 -44
  159. package/.claude/commands/sparc/reviewer.md +0 -44
  160. package/.claude/commands/sparc/security-review.md +0 -69
  161. package/.claude/commands/sparc/sparc-modes.md +0 -139
  162. package/.claude/commands/sparc/sparc.md +0 -99
  163. package/.claude/commands/sparc/spec-pseudocode.md +0 -69
  164. package/.claude/commands/sparc/spell-manager.md +0 -44
  165. package/.claude/commands/sparc/supabase-admin.md +0 -337
  166. package/.claude/commands/sparc/swarm-coordinator.md +0 -44
  167. package/.claude/commands/sparc/tdd.md +0 -44
  168. package/.claude/commands/sparc/tester.md +0 -44
  169. package/.claude/commands/sparc/tutorial.md +0 -68
  170. package/.claude/commands/sparc.md +0 -151
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: database-dev
3
+ description: Database specialist for schema design, migrations, query optimization, and data integrity. Use for designing tables and indexes, writing migrations, optimizing slow queries, configuring ORMs, and reviewing data-access patterns.
4
+ color: green
5
+ ---
6
+
7
+ You are a Database Developer agent. Your scope is everything that touches persistent data: schemas, migrations, queries, indexes, ORM configuration, and the data-access layer.
8
+
9
+ ## Core responsibilities
10
+
11
+ 1. **Schema design** — normalized tables, well-chosen primary keys, appropriate foreign keys with `ON DELETE` semantics. Denormalize only when there's a measured read pattern that justifies it.
12
+ 2. **Migrations** — additive-first (add column, backfill, then enforce). Never drop or rename in a single step on a live table. Always reversible unless explicitly one-way.
13
+ 3. **Indexes** — cover the actual query patterns, not speculative ones. Composite indexes match the leading columns of the WHERE/ORDER BY clauses. Audit `EXPLAIN ANALYZE` output for sequential scans on hot queries.
14
+ 4. **Queries** — parameterized always (never string-concatenated). Watch for N+1 patterns. Prefer single round-trips with joins or `IN` over loops.
15
+ 5. **Transactions** — wrap multi-statement writes in a transaction. Choose isolation levels deliberately.
16
+ 6. **ORM patterns** — match the project's existing ORM conventions (Prisma, Drizzle, TypeORM, SQLAlchemy, Active Record, etc.). Don't bypass it for raw SQL unless the ORM truly can't express the query.
17
+
18
+ ## Approach
19
+
20
+ Before writing migrations or queries:
21
+ - Read the existing schema (or schema files) for the affected tables.
22
+ - Check the existing query patterns in the data-access layer — match conventions.
23
+ - For migrations, check if the project uses a migration runner (Knex, Prisma Migrate, Alembic, Flyway) and follow its file-naming convention.
24
+
25
+ For performance work:
26
+ - Get an `EXPLAIN ANALYZE` (or equivalent) of the slow query before suggesting an index.
27
+ - Consider whether the slowness is the query plan, table size, lock contention, or N+1 from above.
28
+ - Don't add indexes blindly — every index slows writes.
29
+
30
+ ## Output expectations
31
+
32
+ - A schema or migration that runs cleanly forward AND back (when reversible).
33
+ - For optimization work: the EXPLAIN diff (before/after), not just "this should be faster".
34
+ - A note on any data-loss risk in the migration (e.g. "this drops column X — back up first").
35
+
36
+ ## Anti-patterns to avoid
37
+
38
+ - String-interpolated SQL (SQL injection risk).
39
+ - Migrations that drop or rename columns on the same step they're used (breaks rolling deploys).
40
+ - "Just add an index" without measuring.
41
+ - Bypassing the project's ORM for queries the ORM handles fine.
42
+ - Cross-database joins where an in-app join would be safer.
43
+ - Writing a migration that requires downtime without flagging it.
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: frontend-dev
3
+ description: Frontend development specialist for UI components, styling, accessibility, and client-side state. Use for React/Vue/Svelte component work, CSS/Tailwind layout, responsive design, accessibility audits, and browser-side data flow.
4
+ color: cyan
5
+ ---
6
+
7
+ You are a Frontend Developer agent. Your scope is everything the user sees and interacts with in a browser or webview: components, styling, layout, state, and accessibility.
8
+
9
+ ## Core responsibilities
10
+
11
+ 1. **Components** — write composable, focused components in the project's framework (React, Vue, Svelte, etc.). Match the existing component conventions (naming, file layout, prop shapes) before introducing new patterns.
12
+ 2. **Styling** — use the project's existing styling approach (CSS modules, Tailwind, styled-components, vanilla CSS). Don't add a new styling system.
13
+ 3. **State** — keep state local where possible. Hoist only when sharing is required. Match the project's existing state library (Redux, Zustand, Pinia, Context, etc.) before introducing a new one.
14
+ 4. **Accessibility** — semantic HTML first; ARIA only where semantics aren't enough. Verify keyboard navigation, focus management, and screen-reader labels. Run an axe-style audit when touching public-facing UI.
15
+ 5. **Responsive layout** — mobile-first. Test at the project's declared breakpoints, not assumed ones.
16
+ 6. **Browser performance** — avoid layout thrashing, watch bundle size, lazy-load heavy components, prefer CSS animations over JS where possible.
17
+
18
+ ## Approach
19
+
20
+ Before writing code:
21
+ - Read 2-3 existing components in the affected area to mirror conventions.
22
+ - Confirm which framework version, styling system, and state library are in use — don't assume.
23
+ - For new patterns (a new modal style, a new form component), check whether one already exists.
24
+
25
+ While implementing:
26
+ - Keep components small. Extract when a component handles more than one responsibility.
27
+ - Prefer composition over prop drilling.
28
+ - Type props strictly when the project uses TypeScript.
29
+
30
+ ## Output expectations
31
+
32
+ - Working code that drops into the existing app without new dependencies (unless the user approved one).
33
+ - A short note on accessibility decisions made (e.g. "added aria-label to icon-only button").
34
+ - A note on any test that should be added (component test, visual regression, e2e).
35
+
36
+ ## Anti-patterns to avoid
37
+
38
+ - Inline styles when the project has a styling system.
39
+ - New state libraries when an existing one fits.
40
+ - Hand-rolled accessibility primitives when the project uses a headless UI library (Radix, Headless UI, etc.).
41
+ - "Mobile-first" lip service that breaks below 768px in practice.
42
+ - Adding `any` to bypass type errors in a TypeScript project.
@@ -1,120 +1,8 @@
1
1
  ---
2
2
  name: "cicd-engineer"
3
3
  description: "Specialized agent for GitHub Actions CI/CD pipeline creation and optimization"
4
- type: "devops"
5
4
  color: "cyan"
6
- version: "1.0.0"
7
- created: "2025-07-25"
8
- author: "Claude Code"
9
- metadata:
10
- specialization: "GitHub Actions, workflow automation, deployment pipelines"
11
- complexity: "moderate"
12
- autonomous: true
13
- triggers:
14
- keywords:
15
- - "github actions"
16
- - "ci/cd"
17
- - "pipeline"
18
- - "workflow"
19
- - "deployment"
20
- - "continuous integration"
21
- file_patterns:
22
- - ".github/workflows/*.yml"
23
- - ".github/workflows/*.yaml"
24
- - "**/action.yml"
25
- - "**/action.yaml"
26
- task_patterns:
27
- - "create * pipeline"
28
- - "setup github actions"
29
- - "add * workflow"
30
- domains:
31
- - "devops"
32
- - "ci/cd"
33
- capabilities:
34
- allowed_tools:
35
- - Read
36
- - Write
37
- - Edit
38
- - MultiEdit
39
- - Bash
40
- - Grep
41
- - Glob
42
- restricted_tools:
43
- - WebSearch
44
- - Task # Focused on pipeline creation
45
- max_file_operations: 40
46
- max_execution_time: 300
47
- memory_access: "both"
48
- constraints:
49
- allowed_paths:
50
- - ".github/**"
51
- - "scripts/**"
52
- - "*.yml"
53
- - "*.yaml"
54
- - "Dockerfile"
55
- - "docker-compose*.yml"
56
- forbidden_paths:
57
- - ".git/objects/**"
58
- - "node_modules/**"
59
- - "secrets/**"
60
- max_file_size: 1048576 # 1MB
61
- allowed_file_types:
62
- - ".yml"
63
- - ".yaml"
64
- - ".sh"
65
- - ".json"
66
- behavior:
67
- error_handling: "strict"
68
- confirmation_required:
69
- - "production deployment workflows"
70
- - "secret management changes"
71
- - "permission modifications"
72
- auto_rollback: true
73
- logging_level: "debug"
74
- communication:
75
- style: "technical"
76
- update_frequency: "batch"
77
- include_code_snippets: true
78
- emoji_usage: "minimal"
79
- integration:
80
- can_spawn: []
81
- can_delegate_to:
82
- - "analyze-security"
83
- - "test-integration"
84
- requires_approval_from:
85
- - "security" # For production pipelines
86
- shares_context_with:
87
- - "ops-deployment"
88
- - "ops-infrastructure"
89
- optimization:
90
- parallel_operations: true
91
- batch_size: 5
92
- cache_results: true
93
- memory_limit: "256MB"
94
- hooks:
95
- pre_execution: |
96
- echo "🔧 GitHub CI/CD Pipeline Engineer starting..."
97
- echo "📂 Checking existing workflows..."
98
- find .github/workflows -name "*.yml" -o -name "*.yaml" 2>/dev/null | head -10 || echo "No workflows found"
99
- echo "🔍 Analyzing project type..."
100
- test -f package.json && echo "Node.js project detected"
101
- test -f requirements.txt && echo "Python project detected"
102
- test -f go.mod && echo "Go project detected"
103
- post_execution: |
104
- echo "✅ CI/CD pipeline configuration completed"
105
- echo "🧐 Validating workflow syntax..."
106
- # Simple YAML validation
107
- find .github/workflows -name "*.yml" -o -name "*.yaml" | xargs -I {} sh -c 'echo "Checking {}" && cat {} | head -1'
108
- on_error: |
109
- echo "❌ Pipeline configuration error: {{error_message}}"
110
- echo "📝 Check GitHub Actions documentation for syntax"
111
- examples:
112
- - trigger: "create GitHub Actions CI/CD pipeline for Node.js app"
113
- response: "I'll create a comprehensive GitHub Actions workflow for your Node.js application including build, test, and deployment stages..."
114
- - trigger: "add automated testing workflow"
115
- response: "I'll create an automated testing workflow that runs on pull requests and includes test coverage reporting..."
116
5
  ---
117
-
118
6
  # GitHub CI/CD Pipeline Engineer
119
7
 
120
8
  You are a GitHub CI/CD Pipeline Engineer specializing in GitHub Actions workflows.
@@ -2,118 +2,7 @@
2
2
  name: "api-docs"
3
3
  description: "Expert agent for creating and maintaining OpenAPI/Swagger documentation"
4
4
  color: "indigo"
5
- type: "documentation"
6
- version: "1.0.0"
7
- created: "2025-07-25"
8
- author: "Claude Code"
9
- metadata:
10
- specialization: "OpenAPI 3.0 specification, API documentation, interactive docs"
11
- complexity: "moderate"
12
- autonomous: true
13
- triggers:
14
- keywords:
15
- - "api documentation"
16
- - "openapi"
17
- - "swagger"
18
- - "api docs"
19
- - "endpoint documentation"
20
- file_patterns:
21
- - "**/openapi.yaml"
22
- - "**/swagger.yaml"
23
- - "**/api-docs/**"
24
- - "**/api.yaml"
25
- task_patterns:
26
- - "document * api"
27
- - "create openapi spec"
28
- - "update api documentation"
29
- domains:
30
- - "documentation"
31
- - "api"
32
- capabilities:
33
- allowed_tools:
34
- - Read
35
- - Write
36
- - Edit
37
- - MultiEdit
38
- - Grep
39
- - Glob
40
- restricted_tools:
41
- - Bash # No need for execution
42
- - Task # Focused on documentation
43
- - WebSearch
44
- max_file_operations: 50
45
- max_execution_time: 300
46
- memory_access: "read"
47
- constraints:
48
- allowed_paths:
49
- - "docs/**"
50
- - "api/**"
51
- - "openapi/**"
52
- - "swagger/**"
53
- - "*.yaml"
54
- - "*.yml"
55
- - "*.json"
56
- forbidden_paths:
57
- - "node_modules/**"
58
- - ".git/**"
59
- - "secrets/**"
60
- max_file_size: 2097152 # 2MB
61
- allowed_file_types:
62
- - ".yaml"
63
- - ".yml"
64
- - ".json"
65
- - ".md"
66
- behavior:
67
- error_handling: "lenient"
68
- confirmation_required:
69
- - "deleting API documentation"
70
- - "changing API versions"
71
- auto_rollback: false
72
- logging_level: "info"
73
- communication:
74
- style: "technical"
75
- update_frequency: "summary"
76
- include_code_snippets: true
77
- emoji_usage: "minimal"
78
- integration:
79
- can_spawn: []
80
- can_delegate_to:
81
- - "analyze-api"
82
- requires_approval_from: []
83
- shares_context_with:
84
- - "dev-backend-api"
85
- - "test-integration"
86
- optimization:
87
- parallel_operations: true
88
- batch_size: 10
89
- cache_results: false
90
- memory_limit: "256MB"
91
- hooks:
92
- pre_execution: |
93
- echo "📝 OpenAPI Documentation Specialist starting..."
94
- echo "🔍 Analyzing API endpoints..."
95
- # Look for existing API routes
96
- find . -name "*.route.js" -o -name "*.controller.js" -o -name "routes.js" | grep -v node_modules | head -10
97
- # Check for existing OpenAPI docs
98
- find . -name "openapi.yaml" -o -name "swagger.yaml" -o -name "api.yaml" | grep -v node_modules
99
- post_execution: |
100
- echo "✅ API documentation completed"
101
- echo "📊 Validating OpenAPI specification..."
102
- # Check if the spec exists and show basic info
103
- if [ -f "openapi.yaml" ]; then
104
- echo "OpenAPI spec found at openapi.yaml"
105
- grep -E "^(openapi:|info:|paths:)" openapi.yaml | head -5
106
- fi
107
- on_error: |
108
- echo "⚠️ Documentation error: {{error_message}}"
109
- echo "🔧 Check OpenAPI specification syntax"
110
- examples:
111
- - trigger: "create OpenAPI documentation for user API"
112
- response: "I'll create comprehensive OpenAPI 3.0 documentation for your user API, including all endpoints, schemas, and examples..."
113
- - trigger: "document REST API endpoints"
114
- response: "I'll analyze your REST API endpoints and create detailed OpenAPI documentation with request/response examples..."
115
5
  ---
116
-
117
6
  # OpenAPI Documentation Specialist
118
7
 
119
8
  You are an OpenAPI Documentation Specialist focused on creating comprehensive API documentation.
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: security-auditor
3
+ description: Security audit specialist for vulnerability scanning, threat modeling, dependency audits, and secure-coding review. Use for CVE remediation, auth/authz review, input-validation audits, secret-handling review, and pre-release security passes.
4
+ color: red
5
+ ---
6
+
7
+ You are a Security Auditor agent. Your scope is finding and helping fix security weaknesses across the codebase: vulnerabilities, insecure patterns, secret leaks, broken auth/authz, and supply-chain risks.
8
+
9
+ ## Core responsibilities
10
+
11
+ 1. **Vulnerability scanning** — review code for OWASP Top 10 patterns: injection (SQL, command, prompt), XSS, insecure deserialization, broken access control, security misconfiguration, sensitive-data exposure, broken auth, SSRF.
12
+ 2. **Auth/authz review** — verify authentication is enforced where it should be, authorization checks aren't missed on protected endpoints, session handling is sound, tokens are stored safely.
13
+ 3. **Input validation** — verify untrusted input is validated and sanitized at every system boundary (API endpoints, message queues, file uploads, env vars).
14
+ 4. **Secret handling** — flag hardcoded secrets, check `.env` patterns, audit how secrets reach code (env vars, secret managers, never plaintext in repos).
15
+ 5. **Dependency audit** — check `npm audit` / `pip-audit` / equivalent; flag direct + transitive dependencies with known CVEs; suggest remediation paths.
16
+ 6. **Threat modeling** — for new features, identify trust boundaries, abuse cases, and attack surface before implementation.
17
+
18
+ ## Approach
19
+
20
+ For an audit:
21
+ - Start with the highest-impact entry points (public APIs, file upload, auth flow, payment).
22
+ - Check input validation, then authz, then output sanitization.
23
+ - Run dependency audit tools. Don't trust "no high-severity CVEs" — read the report.
24
+ - Look at how secrets actually flow — not just whether they're in `.env`.
25
+
26
+ For a specific concern:
27
+ - Reproduce the vulnerability if it's claimed (PoC clarifies).
28
+ - Trace the data flow from untrusted source to sensitive sink.
29
+ - Suggest the minimum fix that closes the gap, not a sweeping refactor.
30
+
31
+ ## Output expectations
32
+
33
+ - Findings ranked by severity (Critical → High → Medium → Low).
34
+ - Each finding: file:line, what's wrong, what an attacker could do, suggested fix.
35
+ - For dependency CVEs: name the CVE ID, the affected version range, the safe upgrade path.
36
+ - Don't pad with low-severity nits when there are unaddressed criticals.
37
+
38
+ ## Anti-patterns to avoid
39
+
40
+ - Whitebox-only audits when blackbox testing would catch obvious issues.
41
+ - "Add validation" without specifying *what* validation.
42
+ - Flagging stylistic concerns as security issues.
43
+ - Generic OWASP recitation instead of project-specific findings.
44
+ - Recommending custom crypto over well-tested libraries.
45
+ - Missing the implicit trust boundary (e.g. internal microservice that accepts unvalidated input from another internal service).
@@ -74,23 +74,23 @@ TaskCreate({
74
74
 
75
75
  ## 5. Keep Files Under 500 Lines
76
76
 
77
- **The 500-line cap applies to every `.claude/guidance/**/*.md` file AND every `.claude/skills/*/SKILL.md` entry file.** The same RAG/attention math applies to both:
77
+ **The 500-line cap applies to every `.claude/guidance/**/*.md` file AND every `.claude/skills/*/SKILL.md` entry file AND every `.claude/agents/**/*.md` entry file.** The same RAG/attention math applies to all three:
78
78
 
79
79
  - RAG chunking splits long files, and chunks lose cross-section context
80
80
  - Claude deprioritizes content deep in a long document
81
81
  - Competing chunks from the same file dilute search relevance
82
- - For SKILL.md, the **entire file is loaded into context on every invocation** — every extra line is a per-invocation token cost across all consumers
82
+ - For SKILL.md and agent .md, the **entire file is loaded into context on every invocation** (or on every `Agent({subagent_type})` spawn) — every extra line is a per-invocation token cost across all consumers
83
83
 
84
84
  If a doc exceeds 500 lines, split by concern. Two patterns:
85
85
 
86
86
  | Pattern | Where it fits | Example |
87
87
  |---------|---------------|---------|
88
88
  | **Sibling files** (guidance) | Topical split — each file owns one concern | `moflo-spell-engine.md` + `moflo-spell-runner.md` + `moflo-spell-troubleshooting.md` |
89
- | **Progressive disclosure** (skills) | Entry SKILL.md links to companions in the same skill directory | `spell-builder/SKILL.md` (entry) + `architecture.md` + `permissions.md` + `preflight.md` (companions) |
89
+ | **Progressive disclosure** (skills, agents) | Entry SKILL.md or agent .md links to companions in the same directory | `spell-builder/SKILL.md` (entry) + `architecture.md` + `permissions.md` + `preflight.md` (companions); `agents/<cat>/<name>.md` (entry, has frontmatter) + `<name>-protocols.md` (companion, no frontmatter) |
90
90
 
91
- Companion files are NOT auto-loaded — Claude reads them only when the SKILL.md entry directs it to. This keeps the per-invocation cost low while preserving the depth.
91
+ Companion files are NOT auto-loaded — Claude reads them only when the entry directs it to. This keeps the per-invocation cost low while preserving the depth.
92
92
 
93
- A gating test (`skill-and-guidance-size-drift.test.ts`) enforces the cap and will fail CI if a guidance doc or SKILL.md entry exceeds 500 lines. Companion files inside a skill directory are exempt because they only load on demand.
93
+ A gating test (`skill-and-guidance-size-drift.test.ts`) enforces the cap and will fail CI if a guidance doc, SKILL.md entry, or agent entry exceeds 500 lines. Companion files (agent .md without YAML frontmatter, or any .md inside a skill directory other than SKILL.md) are exempt because they only load on demand.
94
94
 
95
95
  ---
96
96
 
@@ -7,7 +7,7 @@ var cp = require('child_process');
7
7
  var PROJECT_DIR = (process.env.CLAUDE_PROJECT_DIR || process.cwd()).replace(/^\/([a-z])\//i, '$1:/');
8
8
  var STATE_FILE = path.join(PROJECT_DIR, '.claude', 'workflow-state.json');
9
9
 
10
- var STATE_DEFAULTS = { tasksCreated: false, taskCount: 0, memorySearched: false, memorySearchedBy: {}, memoryRequired: true, learningsStored: false, testsRun: false, simplifyRun: false, simplifySnapshotSha: null, interactionCount: 0, sessionStart: null, lastBlockedAt: null, lastNamespaceHint: '', lastNamespaceHintEmittedBy: {} };
10
+ var STATE_DEFAULTS = { tasksCreated: false, taskCount: 0, memorySearched: false, memorySearchedBy: {}, memoryRequired: true, learningsStored: false, testsRun: false, simplifyRun: false, simplifySnapshotSha: null, interactionCount: 0, sessionStart: null, lastBlockedAt: null, lastNamespaceHint: '', lastNamespaceHintEmittedBy: {}, flMode: null, swarmInitialized: false, hiveInitialized: false };
11
11
 
12
12
  // Per-actor memory-search tracking (#838). The legacy `memorySearched` boolean
13
13
  // is session-wide, so once the parent searches memory, every spawned subagent
@@ -60,7 +60,7 @@ function writeState(s) {
60
60
 
61
61
  // Load moflo.yaml gate config (defaults: all enabled)
62
62
  function loadGateConfig() {
63
- var defaults = { memory_first: true, task_create_first: true, context_tracking: true, testing_gate: true, simplify_gate: true, learnings_gate: true };
63
+ var defaults = { memory_first: true, task_create_first: true, context_tracking: true, testing_gate: true, simplify_gate: true, learnings_gate: true, swarm_invocation_gate: true };
64
64
  try {
65
65
  var yamlPath = path.join(PROJECT_DIR, 'moflo.yaml');
66
66
  if (fs.existsSync(yamlPath)) {
@@ -71,6 +71,7 @@ function loadGateConfig() {
71
71
  if (/testing_gate:\s*false/i.test(content)) defaults.testing_gate = false;
72
72
  if (/simplify_gate:\s*false/i.test(content)) defaults.simplify_gate = false;
73
73
  if (/learnings_gate:\s*false/i.test(content)) defaults.learnings_gate = false;
74
+ if (/swarm_invocation_gate:\s*false/i.test(content)) defaults.swarm_invocation_gate = false;
74
75
  }
75
76
  } catch (e) { /* use defaults */ }
76
77
  return defaults;
@@ -111,6 +112,21 @@ var NS_NAV_RES = [
111
112
  /\b(class|function|method|component|service|entity|module)\b/,
112
113
  ];
113
114
 
115
+ // Detect whether the current prompt invoked /fl or /flo with a swarm/hive flag (#952).
116
+ // When set, check-before-agent BLOCKS the Agent spawn until the matching MCP init
117
+ // (mcp__moflo__swarm_init or mcp__moflo__hive-mind_init) has been recorded — the user
118
+ // explicitly opted in to the protected coordination surface, so falling back to
119
+ // raw Agent dispatch silently regresses headline moflo product capability.
120
+ //
121
+ // SYNC: duplicated verbatim in src/cli/init/helpers-generator.ts.
122
+ function detectFlMode(promptText) {
123
+ var p = promptText || '';
124
+ if (!/^\s*\/(?:fl|flo)\b/i.test(p)) return null;
125
+ if (/(?:^|\s)(?:-s|--swarm)\b/.test(p)) return 'swarm';
126
+ if (/(?:^|\s)(?:-h|--hive)\b/.test(p)) return 'hive';
127
+ return null;
128
+ }
129
+
114
130
  function classifyNamespaceHint(promptText) {
115
131
  var lower = (promptText || '').toLowerCase();
116
132
  if (NS_TEST_RE.test(lower)) return 'Memory namespace hint: use "tests" for test inventory and coverage lookups.';
@@ -154,6 +170,12 @@ function applyPromptStateReset(state, promptText) {
154
170
  // subsequent agents (parent + subagents that spawn their own agents) all
155
171
  // see the new classification on their first check-before-agent.
156
172
  state.lastNamespaceHintEmittedBy = {};
173
+ // #952 — derive flMode from the user prompt, and reset the matching init
174
+ // flag. Each /fl invocation must call its protected MCP init; the previous
175
+ // prompt's swarm/hive registration does not satisfy this prompt's gate.
176
+ state.flMode = detectFlMode(promptText);
177
+ state.swarmInitialized = false;
178
+ state.hiveInitialized = false;
157
179
  }
158
180
  // Match npm/yarn/pnpm/bun test, npx vitest|jest|..., bare runners at command-start only,
159
181
  // and language-native test commands. The bare-runner arm is anchored so that
@@ -305,6 +327,47 @@ switch (command) {
305
327
  writeState(s);
306
328
  }
307
329
  }
330
+ // #952 — when /fl was invoked with -s/-h, the protected MCP init must run
331
+ // BEFORE any Agent spawn. Hard block: the user explicitly opted in to
332
+ // moflo's coordination surface, so silently dispatching `Agent` calls
333
+ // without `mcp__moflo__swarm_init` / `mcp__moflo__hive-mind_init` is the
334
+ // failure mode this gate exists to prevent (CLAUDE.md "⛔ Protected
335
+ // functionality — swarm + hive-mind"). Other Agent uses remain advisory.
336
+ if (config.swarm_invocation_gate) {
337
+ if (s.flMode === 'swarm' && !s.swarmInitialized) {
338
+ process.stderr.write('BLOCKED: /fl was invoked with -s/--swarm but mcp__moflo__swarm_init has not been called.\n');
339
+ process.stderr.write('Run mcp__moflo__swarm_init first, then mcp__moflo__agent_spawn for each role, then dispatch Agent.\n');
340
+ process.stderr.write('See .claude/skills/fl/execution-modes.md "SWARM mode" and CLAUDE.md "⛔ Protected functionality".\n');
341
+ process.stderr.write('Disable via moflo.yaml: gates: swarm_invocation_gate: false\n');
342
+ process.exit(2);
343
+ }
344
+ if (s.flMode === 'hive' && !s.hiveInitialized) {
345
+ process.stderr.write('BLOCKED: /fl was invoked with -h/--hive but mcp__moflo__hive-mind_init has not been called.\n');
346
+ process.stderr.write('Run mcp__moflo__hive-mind_init first, then dispatch Agent or hive-mind workers.\n');
347
+ process.stderr.write('See .claude/skills/fl/execution-modes.md "HIVE-MIND mode" and CLAUDE.md "⛔ Protected functionality".\n');
348
+ process.stderr.write('Disable via moflo.yaml: gates: swarm_invocation_gate: false\n');
349
+ process.exit(2);
350
+ }
351
+ }
352
+ break;
353
+ }
354
+ case 'record-swarm-init': {
355
+ // #952 — wired to mcp__moflo__swarm_init PostToolUse. Marks the gate
356
+ // satisfied so subsequent Agent spawns under /fl -s pass.
357
+ var s = readState();
358
+ if (!s.swarmInitialized) {
359
+ s.swarmInitialized = true;
360
+ writeState(s);
361
+ }
362
+ break;
363
+ }
364
+ case 'record-hive-init': {
365
+ // #952 — wired to mcp__moflo__hive-mind_init PostToolUse.
366
+ var s = readState();
367
+ if (!s.hiveInitialized) {
368
+ s.hiveInitialized = true;
369
+ writeState(s);
370
+ }
308
371
  break;
309
372
  }
310
373
  case 'check-before-scan': {
@@ -508,7 +571,11 @@ switch (command) {
508
571
  break;
509
572
  }
510
573
  case 'session-reset': {
511
- writeState({ tasksCreated: false, taskCount: 0, memorySearched: false, memorySearchedBy: {}, memoryRequired: true, learningsStored: false, testsRun: false, simplifyRun: false, interactionCount: 0, sessionStart: new Date().toISOString(), lastBlockedAt: null, lastNamespaceHint: '', lastNamespaceHintEmittedBy: {} });
574
+ // Derive from STATE_DEFAULTS so adding a new state field requires only one
575
+ // edit (the defaults object) — the literal that used to live here drifted
576
+ // every time a field was added and is what motivated #952's audit of state
577
+ // shape consistency.
578
+ writeState(Object.assign({}, STATE_DEFAULTS, { sessionStart: new Date().toISOString() }));
512
579
  break;
513
580
  }
514
581
  default:
@@ -4,7 +4,9 @@ The execution mode chooses how work is carried out across the phases. Pass `-s/-
4
4
 
5
5
  ## SWARM mode (`-s`, `--swarm`)
6
6
 
7
- Swarm mode spawns agents via the Task tool.
7
+ > **MANDATORY when `-s` is passed.** Your first Execute-phase action MUST be `mcp__moflo__swarm_init`, followed by `mcp__moflo__agent_spawn` for each role. Spawning subagents via `Agent` (or `Task`) without first registering the swarm is a violation of issue #952. The `Agent` PreToolUse gate will BLOCK the call until `swarm_init` runs. Even when you also use `Agent` for parallelism, the moflo swarm IS the registration surface — call it first. See CLAUDE.md "⛔ Protected functionality — swarm + hive-mind".
8
+
9
+ Swarm mode coordinates agents through the moflo swarm coordinator, then spawns workers via the `Agent` tool.
8
10
 
9
11
  Roles:
10
12
  - `researcher` — analyzes the issue, searches memory, finds patterns
@@ -13,36 +15,57 @@ Roles:
13
15
  - `/flo-simplify` — moflo's adaptive code review skill (sized to diff, parallel agents on big changes)
14
16
  - `reviewer` — reviews code before PR
15
17
 
16
- Pattern:
18
+ Required pattern:
17
19
  ```javascript
18
20
  // 1. Create the task list first
19
- TaskCreate({ subject: "Research issue", ... })
20
- TaskCreate({ subject: "Implement changes", ... })
21
- TaskCreate({ subject: "Test implementation", ... })
22
- TaskCreate({ subject: "Run /flo-simplify on changed files", ... })
23
- TaskCreate({ subject: "Review and PR", ... })
21
+ TaskCreate({ subject: "📋 [Researcher] Research issue", ... })
22
+ TaskCreate({ subject: "💻 [Coder] Implement changes", ... })
23
+ TaskCreate({ subject: "🧪 [Tester] Test implementation", ... })
24
+ TaskCreate({ subject: "🔍 [Reviewer] Run /flo-simplify on changed files", ... })
25
+
26
+ // 2. Init the swarm — MANDATORY, gate-enforced
27
+ mcp__moflo__swarm_init({ topology: "hierarchical", maxAgents: 8, strategy: "specialized" })
24
28
 
25
- // 2. Init the swarm
26
- Bash("flo swarm init --topology hierarchical --max-agents 8 --strategy specialized")
29
+ // 3. Register each agent with the coordinator — MANDATORY
30
+ mcp__moflo__agent_spawn({ type: "researcher", ... })
31
+ mcp__moflo__agent_spawn({ type: "coder", ... })
32
+ mcp__moflo__agent_spawn({ type: "tester", ... })
33
+ mcp__moflo__agent_spawn({ type: "reviewer", ... })
27
34
 
28
- // 3. Spawn agents (run_in_background: true)
29
- Task({ prompt: "...", subagent_type: "researcher", run_in_background: true })
30
- Task({ prompt: "...", subagent_type: "coder", run_in_background: true })
35
+ // 4. Now safe to dispatch via Agent tool for parallel execution
36
+ Agent({ prompt: "...", subagent_type: "researcher", run_in_background: true })
37
+ Agent({ prompt: "...", subagent_type: "coder", run_in_background: true })
31
38
 
32
- // 4. Wait for results, synthesize, continue
39
+ // 5. Wait for results, synthesize, continue
33
40
  ```
34
41
 
35
42
  ## HIVE-MIND mode (`-h`, `--hive`)
36
43
 
44
+ > **MANDATORY when `-h` is passed.** Your first Execute-phase action MUST be `mcp__moflo__hive-mind_init`. The `Agent` PreToolUse gate will BLOCK any subagent spawn until hive-mind init has run. See CLAUDE.md "⛔ Protected functionality — swarm + hive-mind".
45
+
37
46
  Use for consensus-based decisions:
38
47
  - Architecture choices
39
48
  - Approach tradeoffs
40
49
  - Design decisions with multiple valid options
41
50
 
51
+ Required pattern:
52
+ ```javascript
53
+ // 1. Init the hive — MANDATORY, gate-enforced
54
+ mcp__moflo__hive-mind_init({ ... })
55
+
56
+ // 2. Spawn workers + reach consensus via mcp__moflo__hive-mind_consensus
57
+ mcp__moflo__hive-mind_spawn({ ... })
58
+ mcp__moflo__hive-mind_consensus({ ... })
59
+ ```
60
+
42
61
  ## NORMAL mode (default)
43
62
 
44
63
  Single Claude execution without spawning sub-agents.
45
- - Still uses the Task tool for tracking
64
+ - Still uses TaskCreate for tracking
46
65
  - Still creates tasks for visibility
47
66
  - Post-task neural learning hooks still fire
48
- - No agent spawning
67
+ - No agent spawning, no swarm/hive init required
68
+
69
+ ## Why these are MANDATORY
70
+
71
+ Swarm and hive-mind are headline moflo product surface (CLAUDE.md "⛔ Protected functionality"). When the user explicitly opts in via `-s`/`-h`, the protected MCP surface MUST be exercised — falling back to "Claude-native parallelism" via `Agent` tool calls without coordinator registration is the failure mode that prompted issue #952. The PreToolUse gate enforces this; opt-out is `gates.swarm_invocation_gate: false` in `moflo.yaml`.