Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

Checkpoint: File edits

rUve3d04c2318b9
diff --git a/v3/@claude-flow/codex/.agents/config.toml b/v3/@claude-flow/codex/.agents/config.toml
new file mode 100644
index 0000000000..0be4aad079
--- /dev/null
+++ b/v3/@claude-flow/codex/.agents/config.toml
@@ -0,0 +1,135 @@
+# Claude Flow V3 - Codex Configuration
+# Generated by: @claude-flow/codex
+# Documentation: https://github.com/ruvnet/claude-flow
+
+# =============================================================================
+# Core Settings
+# =============================================================================
+
+# Model selection
+model = "gpt-5.3-codex"
+
+# Approval policy: untrusted | on-failure | on-request | never
+approval_policy = "on-request"
+
+# Sandbox mode: read-only | workspace-write | danger-full-access
+sandbox_mode = "workspace-write"
+
+# Web search: disabled | cached | live
+web_search = "cached"
+
+# =============================================================================
+# Project Documentation
+# =============================================================================
+
+# Maximum bytes to read from AGENTS.md files
+project_doc_max_bytes = 65536
+
+# Fallback filenames if AGENTS.md not found
+project_doc_fallback_filenames = [
+ "AGENTS.md",
+ "TEAM_GUIDE.md",
+ ".agents.md"
+]
+
+# =============================================================================
+# Features
+# =============================================================================
+
+[features]
+# Enable child AGENTS.md guidance
+child_agents_md = true
+
+# Cache shell environment for faster repeated commands
+shell_snapshot = true
+
+# Smart approvals based on request context
+request_rule = true
+
+# Enable remote compaction for large histories
+remote_compaction = true
+
+# =============================================================================
+# MCP Servers
+# =============================================================================
+
+[mcp_servers.claude-flow]
+command = "npx"
+args = ["-y", "@claude-flow/cli@latest"]
+enabled = true
+tool_timeout_sec = 120
+
+# =============================================================================
+# Skills Configuration
+# =============================================================================
+
+[[skills.config]]
+path = ".agents/skills/swarm-orchestration"
+enabled = true
+
+[[skills.config]]
+path = ".agents/skills/memory-management"
+enabled = true
+
+[[skills.config]]
+path = ".agents/skills/sparc-methodology"
+enabled = true
+
+[[skills.config]]
+path = ".agents/skills/security-audit"
+enabled = true
+
+# =============================================================================
+# Profiles
+# =============================================================================
+
+# Development profile - more permissive for local work
+[profiles.dev]
+approval_policy = "never"
+sandbox_mode = "danger-full-access"
+web_search = "live"
+
+# Safe profile - maximum restrictions
+[profiles.safe]
+approval_policy = "untrusted"
+sandbox_mode = "read-only"
+web_search = "disabled"
+
+# CI profile - for automated pipelines
+[profiles.ci]
+approval_policy = "never"
+sandbox_mode = "workspace-write"
+web_search = "cached"
+
+# =============================================================================
+# History
+# =============================================================================
+
+[history]
+# Save all session transcripts
+persistence = "save-all"
+
+# =============================================================================
+# Shell Environment
+# =============================================================================
+
+[shell_environment_policy]
+# Inherit environment variables
+inherit = "core"
+
+# Exclude sensitive variables
+exclude = ["*_KEY", "*_SECRET", "*_TOKEN", "*_PASSWORD"]
+
+# =============================================================================
+# Sandbox Workspace Write Settings
+# =============================================================================
+
+[sandbox_workspace_write]
+# Additional writable paths beyond workspace
+writable_roots = []
+
+# Allow network access
+network_access = true
+
+# Exclude temp directories
+exclude_slash_tmp = false
diff --git a/v3/@claude-flow/codex/.agents/skills/memory-management/SKILL.md b/v3/@claude-flow/codex/.agents/skills/memory-management/SKILL.md
new file mode 100644
index 0000000000..0a2e0a02f6
--- /dev/null
+++ b/v3/@claude-flow/codex/.agents/skills/memory-management/SKILL.md
@@ -0,0 +1,45 @@
+---
+name: memory-management
+description: >
+ AgentDB memory system with HNSW vector search.
+ Use when: need to store patterns, search for solutions, semantic lookup.
+ Skip when: no learning needed, ephemeral tasks.
+---
+
+# Memory Management Skill
+
+## Purpose
+AgentDB memory system with HNSW vector search.
+
+## When to Trigger
+- need to store patterns
+- search for solutions
+- semantic lookup
+
+## When to Skip
+- no learning needed
+- ephemeral tasks
+
+## Commands
+
+### Store Data
+Store a pattern in memory
+
+```bash
+npx @claude-flow/cli memory store --key "key" --value "value" --namespace patterns
+```
+
+### Search Data
+Semantic search in memory
+
+```bash
+npx @claude-flow/cli memory search --query "search terms" --limit 10
+```
+
+
+
+## Best Practices
+1. Check memory for existing patterns before starting
+2. Use hierarchical topology for coordination
+3. Store successful patterns after completion
+4. Document any new learnings
diff --git a/v3/@claude-flow/codex/.agents/skills/security-audit/SKILL.md b/v3/@claude-flow/codex/.agents/skills/security-audit/SKILL.md
new file mode 100644
index 0000000000..f80ceae149
--- /dev/null
+++ b/v3/@claude-flow/codex/.agents/skills/security-audit/SKILL.md
@@ -0,0 +1,46 @@
+---
+name: security-audit
+description: >
+ Security scanning and vulnerability detection.
+ Use when: authentication, authorization, payment processing, user data.
+ Skip when: read-only operations, internal tooling.
+---
+
+# Security Audit Skill
+
+## Purpose
+Security scanning and vulnerability detection.
+
+## When to Trigger
+- authentication
+- authorization
+- payment processing
+- user data
+
+## When to Skip
+- read-only operations
+- internal tooling
+
+## Commands
+
+### Full Security Scan
+Run comprehensive security analysis
+
+```bash
+npx @claude-flow/cli security scan --depth full
+```
+
+### Input Validation Check
+Check for input validation issues
+
+```bash
+npx @claude-flow/cli security scan --check input-validation
+```
+
+
+
+## Best Practices
+1. Check memory for existing patterns before starting
+2. Use hierarchical topology for coordination
+3. Store successful patterns after completion
+4. Document any new learnings
diff --git a/v3/@claude-flow/codex/.agents/skills/sparc-methodology/SKILL.md b/v3/@claude-flow/codex/.agents/skills/sparc-methodology/SKILL.md
new file mode 100644
index 0000000000..e99f9d5ed3
--- /dev/null
+++ b/v3/@claude-flow/codex/.agents/skills/sparc-methodology/SKILL.md
@@ -0,0 +1,46 @@
+---
+name: sparc-methodology
+description: >
+ SPARC development workflow (Specification, Pseudocode, Architecture, Refinement, Completion).
+ Use when: new features, complex implementations, architectural changes.
+ Skip when: simple fixes, documentation, configuration.
+---
+
+# Sparc Methodology Skill
+
+## Purpose
+SPARC development workflow (Specification, Pseudocode, Architecture, Refinement, Completion).
+
+## When to Trigger
+- new features
+- complex implementations
+- architectural changes
+
+## When to Skip
+- simple fixes
+- documentation
+- configuration
+
+## Commands
+
+### Specification Phase
+Define requirements and acceptance criteria
+
+```bash
+npx @claude-flow/cli hooks route --task "specification: [requirements]"
+```
+
+### Architecture Phase
+Design system structure
+
+```bash
+npx @claude-flow/cli hooks route --task "architecture: [design]"
+```
+
+
+
+## Best Practices
+1. Check memory for existing patterns before starting
+2. Use hierarchical topology for coordination
+3. Store successful patterns after completion
+4. Document any new learnings
diff --git a/v3/@claude-flow/codex/.agents/skills/swarm-orchestration/SKILL.md b/v3/@claude-flow/codex/.agents/skills/swarm-orchestration/SKILL.md
new file mode 100644
index 0000000000..6023703db2
--- /dev/null
+++ b/v3/@claude-flow/codex/.agents/skills/swarm-orchestration/SKILL.md
@@ -0,0 +1,53 @@
+---
+name: swarm-orchestration
+description: >
+ Multi-agent swarm coordination for complex tasks.
+ Use when: 3+ files need changes, new features, refactoring.
+ Skip when: single file edits, simple fixes, documentation.
+---
+
+# Swarm Orchestration Skill
+
+## Purpose
+Multi-agent swarm coordination for complex tasks.
+
+## When to Trigger
+- 3+ files need changes
+- new features
+- refactoring
+
+## When to Skip
+- single file edits
+- simple fixes
+- documentation
+
+## Commands
+
+### Initialize Swarm
+Start a new swarm with hierarchical topology
+
+```bash
+npx @claude-flow/cli swarm init --topology hierarchical --max-agents 8
+```
+
+### Route Task
+Route a task to the appropriate agents
+
+```bash
+npx @claude-flow/cli hooks route --task "[task description]"
+```
+
+### Monitor Status
+Check the current swarm status
+
+```bash
+npx @claude-flow/cli swarm status
+```
+
+
+
+## Best Practices
+1. Check memory for existing patterns before starting
+2. Use hierarchical topology for coordination
+3. Store successful patterns after completion
+4. Document any new learnings
diff --git a/v3/@claude-flow/codex/.gitignore b/v3/@claude-flow/codex/.gitignore
new file mode 100644
index 0000000000..41026821f1
--- /dev/null
+++ b/v3/@claude-flow/codex/.gitignore
@@ -0,0 +1,12 @@
+
+# Codex local configuration
+.codex/
+
+# Claude Flow runtime data
+.claude-flow/data/
+.claude-flow/logs/
+
+# Environment variables
+.env
+.env.local
+.env.*.local
diff --git a/v3/@claude-flow/codex/AGENTS.md b/v3/@claude-flow/codex/AGENTS.md
new file mode 100644
index 0000000000..2974111d91
--- /dev/null
+++ b/v3/@claude-flow/codex/AGENTS.md
@@ -0,0 +1,145 @@
+# codex
+
+> Multi-agent orchestration framework for agentic coding
+
+## Project Overview
+
+A Claude Flow powered project
+
+**Tech Stack**: TypeScript, Node.js
+**Architecture**: Domain-Driven Design with bounded contexts
+
+## Quick Start
+
+### Installation
+```bash
+npm install
+```
+
+### Build
+```bash
+npm run build
+```
+
+### Test
+```bash
+npm test
+```
+
+### Development
+```bash
+npm run dev
+```
+
+## Agent Coordination
+
+### Swarm Configuration
+
+This project uses hierarchical swarm coordination for complex tasks:
+
+| Setting | Value | Purpose |
+|---------|-------|---------|
+| Topology | `hierarchical` | Queen-led coordination (anti-drift) |
+| Max Agents | 8 | Optimal team size |
+| Strategy | `specialized` | Clear role boundaries |
+| Consensus | `raft` | Leader-based consistency |
+
+### When to Use Swarms
+
+**Invoke swarm for:**
+- Multi-file changes (3+ files)
+- New feature implementation
+- Cross-module refactoring
+- API changes with tests
+- Security-related changes
+- Performance optimization
+
+**Skip swarm for:**
+- Single file edits
+- Simple bug fixes (1-2 lines)
+- Documentation updates
+- Configuration changes
+
+### Available Skills
+
+Use `$skill-name` syntax to invoke:
+
+| Skill | Use Case |
+|-------|----------|
+| `$swarm-orchestration` | Multi-agent task coordination |
+| `$memory-management` | Pattern storage and retrieval |
+| `$sparc-methodology` | Structured development workflow |
+| `$security-audit` | Security scanning and CVE detection |
+
+### Agent Types
+
+| Type | Role | Use Case |
+|------|------|----------|
+| `researcher` | Requirements analysis | Understanding scope |
+| `architect` | System design | Planning structure |
+| `coder` | Implementation | Writing code |
+| `tester` | Test creation | Quality assurance |
+| `reviewer` | Code review | Security and quality |
+
+## Code Standards
+
+### File Organization
+- **NEVER** save to root folder
+- `/src` - Source code files
+- `/tests` - Test files
+- `/docs` - Documentation
+- `/config` - Configuration files
+
+### Quality Rules
+- Files under 500 lines
+- No hardcoded secrets
+- Input validation at boundaries
+- Typed interfaces for public APIs
+- TDD London School (mock-first) preferred
+
+### Commit Messages
+```
+<type>(<scope>): <description>
+
+[optional body]
+
+Co-Authored-By: claude-flow <[email protected]>
+```
+
+Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `chore`
+
+## Security
+
+### Critical Rules
+- NEVER commit secrets, credentials, or .env files
+- NEVER hardcode API keys
+- Always validate user input
+- Use parameterized queries for SQL
+- Sanitize output to prevent XSS
+
+### Path Security
+- Validate all file paths
+- Prevent directory traversal (../)
+- Use absolute paths internally
+
+## Memory System
+
+### Storing Patterns
+```bash
+npx @claude-flow/cli memory store \
+ --key "pattern-name" \
+ --value "pattern description" \
+ --namespace patterns
+```
+
+### Searching Memory
+```bash
+npx @claude-flow/cli memory search \
+ --query "search terms" \
+ --namespace patterns
+```
+
+## Links
+
+- Documentation: https://github.com/ruvnet/claude-flow
+- Issues: https://github.com/ruvnet/claude-flow/issues
diff --git a/v3/@claude-flow/codex/src/generators/skill-md.ts b/v3/@claude-flow/codex/src/generators/skill-md.ts
index f67efc7e66..bc8974ce9e 100644
--- a/v3/@claude-flow/codex/src/generators/skill-md.ts
+++ b/v3/@claude-flow/codex/src/generators/skill-md.ts
@@ -146,114 +146,537 @@ export async function generateBuiltInSkill(
const skillTemplates: Record<string, SkillMdOptions> = {
'swarm-orchestration': {
name: 'swarm-orchestration',
- description: 'Multi-agent swarm coordination for complex tasks.',
- triggers: ['3+ files need changes', 'new features', 'refactoring'],
- skipWhen: ['single file edits', 'simple fixes', 'documentation'],
+ description: 'Multi-agent swarm coordination for complex tasks. Uses hierarchical topology with specialized agents to break down and execute complex work across multiple files and modules.',
+ triggers: [
+ '3+ files need changes',
+ 'new feature implementation',
+ 'cross-module refactoring',
+ 'API changes with tests',
+ 'security-related changes',
+ 'performance optimization across codebase',
+ 'database schema changes',
+ ],
+ skipWhen: [
+ 'single file edits',
+ 'simple bug fixes (1-2 lines)',
+ 'documentation updates',
+ 'configuration changes',
+ 'quick exploration',
+ ],
commands: [
{
name: 'Initialize Swarm',
- description: 'Start a new swarm with hierarchical topology',
- command: 'npx @claude-flow/cli swarm init --topology hierarchical --max-agents 8',
+ description: 'Start a new swarm with hierarchical topology (anti-drift)',
+ command: 'npx @claude-flow/cli swarm init --topology hierarchical --max-agents 8 --strategy specialized',
+ example: 'npx @claude-flow/cli swarm init --topology hierarchical --max-agents 6 --strategy specialized',
},
{
name: 'Route Task',
- description: 'Route a task to the appropriate agents',
+ description: 'Route a task to the appropriate agents based on task type',
command: 'npx @claude-flow/cli hooks route --task "[task description]"',
+ example: 'npx @claude-flow/cli hooks route --task "implement OAuth2 authentication flow"',
+ },
+ {
+ name: 'Spawn Agent',
+ description: 'Spawn a specific agent type',
+ command: 'npx @claude-flow/cli agent spawn --type [type] --name [name]',
+ example: 'npx @claude-flow/cli agent spawn --type coder --name impl-auth',
},
{
name: 'Monitor Status',
description: 'Check the current swarm status',
- command: 'npx @claude-flow/cli swarm status',
+ command: 'npx @claude-flow/cli swarm status --verbose',
+ },
+ {
+ name: 'Orchestrate Task',
+ description: 'Orchestrate a task across multiple agents',
+ command: 'npx @claude-flow/cli task orchestrate --task "[task]" --strategy adaptive',
+ example: 'npx @claude-flow/cli task orchestrate --task "refactor auth module" --strategy parallel --max-agents 4',
+ },
+ {
+ name: 'List Agents',
+ description: 'List all active agents',
+ command: 'npx @claude-flow/cli agent list --filter active',
+ },
+ ],
+ scripts: [
+ {
+ name: 'swarm-start',
+ path: '.agents/scripts/swarm-start.sh',
+ description: 'Initialize swarm with default settings',
+ },
+ {
+ name: 'swarm-monitor',
+ path: '.agents/scripts/swarm-monitor.sh',
+ description: 'Real-time swarm monitoring dashboard',
+ },
+ ],
+ references: [
+ {
+ name: 'Agent Types',
+ path: 'docs/agents.md',
+ description: 'Complete list of agent types and capabilities',
+ },
+ {
+ name: 'Topology Guide',
+ path: 'docs/topology.md',
+ description: 'Swarm topology configuration guide',
},
],
},
'memory-management': {
name: 'memory-management',
- description: 'AgentDB memory system with HNSW vector search.',
- triggers: ['need to store patterns', 'search for solutions', 'semantic lookup'],
- skipWhen: ['no learning needed', 'ephemeral tasks'],
+ description: 'AgentDB memory system with HNSW vector search. Provides 150x-12,500x faster pattern retrieval, persistent storage, and semantic search capabilities for learning and knowledge management.',
+ triggers: [
+ 'need to store successful patterns',
+ 'searching for similar solutions',
+ 'semantic lookup of past work',
+ 'learning from previous tasks',
+ 'sharing knowledge between agents',
+ 'building knowledge base',
+ ],
+ skipWhen: [
+ 'no learning needed',
+ 'ephemeral one-off tasks',
+ 'external data sources available',
+ 'read-only exploration',
+ ],
commands: [
{
- name: 'Store Data',
- description: 'Store a pattern in memory',
- command: 'npx @claude-flow/cli memory store --key "key" --value "value" --namespace patterns',
+ name: 'Store Pattern',
+ description: 'Store a pattern or knowledge item in memory',
+ command: 'npx @claude-flow/cli memory store --key "[key]" --value "[value]" --namespace patterns',
+ example: 'npx @claude-flow/cli memory store --key "auth-jwt-pattern" --value "JWT validation with refresh tokens" --namespace patterns',
+ },
+ {
+ name: 'Semantic Search',
+ description: 'Search memory using semantic similarity',
+ command: 'npx @claude-flow/cli memory search --query "[search terms]" --limit 10',
+ example: 'npx @claude-flow/cli memory search --query "authentication best practices" --limit 5',
},
{
- name: 'Search Data',
- description: 'Semantic search in memory',
- command: 'npx @claude-flow/cli memory search --query "search terms" --limit 10',
+ name: 'Retrieve Entry',
+ description: 'Retrieve a specific memory entry by key',
+ command: 'npx @claude-flow/cli memory get --key "[key]" --namespace [namespace]',
+ example: 'npx @claude-flow/cli memory get --key "auth-jwt-pattern" --namespace patterns',
+ },
+ {
+ name: 'List Entries',
+ description: 'List all entries in a namespace',
+ command: 'npx @claude-flow/cli memory list --namespace [namespace]',
+ example: 'npx @claude-flow/cli memory list --namespace patterns --limit 20',
+ },
+ {
+ name: 'Delete Entry',
+ description: 'Delete a memory entry',
+ command: 'npx @claude-flow/cli memory delete --key "[key]" --namespace [namespace]',
+ },
+ {
+ name: 'Initialize HNSW Index',
+ description: 'Initialize HNSW vector search index',
+ command: 'npx @claude-flow/cli memory init --enable-hnsw',
+ },
+ {
+ name: 'Memory Stats',
+ description: 'Show memory usage statistics',
+ command: 'npx @claude-flow/cli memory stats',
+ },
+ {
+ name: 'Export Memory',
+ description: 'Export memory to JSON',
+ command: 'npx @claude-flow/cli memory export --output memory-backup.json',
+ },
+ ],
+ scripts: [
+ {
+ name: 'memory-backup',
+ path: '.agents/scripts/memory-backup.sh',
+ description: 'Backup memory to external storage',
+ },
+ {
+ name: 'memory-consolidate',
+ path: '.agents/scripts/memory-consolidate.sh',
+ description: 'Consolidate and optimize memory',
+ },
+ ],
+ references: [
+ {
+ name: 'HNSW Guide',
+ path: 'docs/hnsw.md',
+ description: 'HNSW vector search configuration',
+ },
+ {
+ name: 'Memory Schema',
+ path: 'docs/memory-schema.md',
+ description: 'Memory namespace and schema reference',
},
],
},
'sparc-methodology': {
name: 'sparc-methodology',
- description: 'SPARC development workflow (Specification, Pseudocode, Architecture, Refinement, Completion).',
- triggers: ['new features', 'complex implementations', 'architectural changes'],
- skipWhen: ['simple fixes', 'documentation', 'configuration'],
+ description: 'SPARC development workflow: Specification, Pseudocode, Architecture, Refinement, Completion. A structured approach for complex implementations that ensures thorough planning before coding.',
+ triggers: [
+ 'new feature implementation',
+ 'complex implementations',
+ 'architectural changes',
+ 'system redesign',
+ 'integration work',
+ 'unclear requirements',
+ ],
+ skipWhen: [
+ 'simple bug fixes',
+ 'documentation updates',
+ 'configuration changes',
+ 'well-defined small tasks',
+ 'routine maintenance',
+ ],
commands: [
{
name: 'Specification Phase',
- description: 'Define requirements and acceptance criteria',
+ description: 'Define requirements, acceptance criteria, and constraints',
command: 'npx @claude-flow/cli hooks route --task "specification: [requirements]"',
+ example: 'npx @claude-flow/cli hooks route --task "specification: user authentication with OAuth2, MFA, and session management"',
+ },
+ {
+ name: 'Pseudocode Phase',
+ description: 'Write high-level pseudocode for the implementation',
+ command: 'npx @claude-flow/cli hooks route --task "pseudocode: [feature]"',
+ example: 'npx @claude-flow/cli hooks route --task "pseudocode: OAuth2 login flow with token refresh"',
},
{
name: 'Architecture Phase',
- description: 'Design system structure',
+ description: 'Design system structure, interfaces, and dependencies',
command: 'npx @claude-flow/cli hooks route --task "architecture: [design]"',
+ example: 'npx @claude-flow/cli hooks route --task "architecture: auth module with service layer, repository, and API endpoints"',
+ },
+ {
+ name: 'Refinement Phase',
+ description: 'Iterate on the design based on feedback',
+ command: 'npx @claude-flow/cli hooks route --task "refinement: [feedback]"',
+ example: 'npx @claude-flow/cli hooks route --task "refinement: add rate limiting and brute force protection"',
+ },
+ {
+ name: 'Completion Phase',
+ description: 'Finalize implementation with tests and documentation',
+ command: 'npx @claude-flow/cli hooks route --task "completion: [final checks]"',
+ example: 'npx @claude-flow/cli hooks route --task "completion: verify all tests pass, update API docs, security review"',
+ },
+ {
+ name: 'SPARC Coordinator',
+ description: 'Spawn SPARC coordinator agent',
+ command: 'npx @claude-flow/cli agent spawn --type sparc-coord --name sparc-lead',
+ },
+ ],
+ scripts: [
+ {
+ name: 'sparc-init',
+ path: '.agents/scripts/sparc-init.sh',
+ description: 'Initialize SPARC workflow for a new feature',
+ },
+ {
+ name: 'sparc-review',
+ path: '.agents/scripts/sparc-review.sh',
+ description: 'Run SPARC phase review checklist',
+ },
+ ],
+ references: [
+ {
+ name: 'SPARC Overview',
+ path: 'docs/sparc.md',
+ description: 'Complete SPARC methodology guide',
+ },
+ {
+ name: 'Phase Templates',
+ path: 'docs/sparc-templates.md',
+ description: 'Templates for each SPARC phase',
},
],
},
'security-audit': {
name: 'security-audit',
- description: 'Security scanning and vulnerability detection.',
- triggers: ['authentication', 'authorization', 'payment processing', 'user data'],
- skipWhen: ['read-only operations', 'internal tooling'],
+ description: 'Comprehensive security scanning and vulnerability detection. Includes input validation, path traversal prevention, CVE detection, and secure coding pattern enforcement.',
+ triggers: [
+ 'authentication implementation',
+ 'authorization logic',
+ 'payment processing',
+ 'user data handling',
+ 'API endpoint creation',
+ 'file upload handling',
+ 'database queries',
+ 'external API integration',
+ ],
+ skipWhen: [
+ 'read-only operations on public data',
+ 'internal development tooling',
+ 'static documentation',
+ 'styling changes',
+ ],
commands: [
{
name: 'Full Security Scan',
- description: 'Run comprehensive security analysis',
+ description: 'Run comprehensive security analysis on the codebase',
command: 'npx @claude-flow/cli security scan --depth full',
+ example: 'npx @claude-flow/cli security scan --depth full --output security-report.json',
},
{
name: 'Input Validation Check',
description: 'Check for input validation issues',
command: 'npx @claude-flow/cli security scan --check input-validation',
+ example: 'npx @claude-flow/cli security scan --check input-validation --path ./src/api',
+ },
+ {
+ name: 'Path Traversal Check',
+ description: 'Check for path traversal vulnerabilities',
+ command: 'npx @claude-flow/cli security scan --check path-traversal',
+ },
+ {
+ name: 'SQL Injection Check',
+ description: 'Check for SQL injection vulnerabilities',
+ command: 'npx @claude-flow/cli security scan --check sql-injection',
+ },
+ {
+ name: 'XSS Check',
+ description: 'Check for cross-site scripting vulnerabilities',
+ command: 'npx @claude-flow/cli security scan --check xss',
+ },
+ {
+ name: 'CVE Scan',
+ description: 'Scan dependencies for known CVEs',
+ command: 'npx @claude-flow/cli security cve --scan',
+ example: 'npx @claude-flow/cli security cve --scan --severity high',
+ },
+ {
+ name: 'Security Audit Report',
+ description: 'Generate full security audit report',
+ command: 'npx @claude-flow/cli security audit --report',
+ example: 'npx @claude-flow/cli security audit --report --format markdown --output SECURITY.md',
+ },
+ {
+ name: 'Threat Modeling',
+ description: 'Run threat modeling analysis',
+ command: 'npx @claude-flow/cli security threats --analyze',
+ },
+ {
+ name: 'Validate Secrets',
+ description: 'Check for hardcoded secrets',
+ command: 'npx @claude-flow/cli security validate --check secrets',
+ },
+ ],
+ scripts: [
+ {
+ name: 'security-scan',
+ path: '.agents/scripts/security-scan.sh',
+ description: 'Run full security scan pipeline',
+ },
+ {
+ name: 'cve-remediate',
+ path: '.agents/scripts/cve-remediate.sh',
+ description: 'Auto-remediate known CVEs',
+ },
+ ],
+ references: [
+ {
+ name: 'Security Checklist',
+ path: 'docs/security-checklist.md',
+ description: 'Security review checklist',
+ },
+ {
+ name: 'OWASP Guide',
+ path: 'docs/owasp-top10.md',
+ description: 'OWASP Top 10 mitigation guide',
},
],
},
'performance-analysis': {
name: 'performance-analysis',
- description: 'Performance profiling and optimization.',
- triggers: ['slow operations', 'memory issues', 'optimization needed'],
- skipWhen: ['feature development', 'documentation'],
+ description: 'Performance profiling, benchmarking, and optimization. Includes CPU profiling, memory analysis, latency measurement, and automated optimization suggestions.',
+ triggers: [
+ 'slow operations detected',
+ 'memory usage issues',
+ 'optimization needed',
+ 'pre-release performance validation',
+ 'database query optimization',
+ 'API latency concerns',
+ 'bundle size analysis',
+ ],
+ skipWhen: [
+ 'early feature development',
+ 'documentation updates',
+ 'prototyping phase',
+ 'configuration changes',
+ ],
commands: [
{
- name: 'Run Benchmark',
- description: 'Execute performance benchmarks',
+ name: 'Run Benchmark Suite',
+ description: 'Execute all performance benchmarks',
command: 'npx @claude-flow/cli performance benchmark --suite all',
+ example: 'npx @claude-flow/cli performance benchmark --suite all --iterations 100 --output bench-results.json',
},
{
name: 'Profile Code',
- description: 'Profile code execution',
+ description: 'Profile code execution for CPU and memory',
command: 'npx @claude-flow/cli performance profile --target ./src',
+ example: 'npx @claude-flow/cli performance profile --target ./src/api --duration 60s',
+ },
+ {
+ name: 'Memory Analysis',
+ description: 'Analyze memory usage patterns',
+ command: 'npx @claude-flow/cli performance metrics --metric memory',
+ example: 'npx @claude-flow/cli performance metrics --metric memory --threshold 100MB',
+ },
+ {
+ name: 'Latency Analysis',
+ description: 'Measure and analyze latency',
+ command: 'npx @claude-flow/cli performance metrics --metric latency',
+ },
+ {
+ name: 'Optimize Suggestions',
+ description: 'Get automated optimization suggestions',
+ command: 'npx @claude-flow/cli performance optimize --analyze',
+ example: 'npx @claude-flow/cli performance optimize --analyze --apply-safe',
+ },
+ {
+ name: 'Performance Report',
+ description: 'Generate performance report',
+ command: 'npx @claude-flow/cli performance report',
+ example: 'npx @claude-flow/cli performance report --format html --output perf-report.html',
+ },
+ {
+ name: 'Compare Benchmarks',
+ description: 'Compare benchmark results',
+ command: 'npx @claude-flow/cli performance benchmark --compare baseline.json current.json',
+ },
+ {
+ name: 'WASM Benchmark',
+ description: 'Run WASM-specific benchmarks',
+ command: 'npx @claude-flow/cli performance benchmark --suite wasm',
+ },
+ ],
+ scripts: [
+ {
+ name: 'perf-baseline',
+ path: '.agents/scripts/perf-baseline.sh',
+ description: 'Capture performance baseline',
+ },
+ {
+ name: 'perf-regression',
+ path: '.agents/scripts/perf-regression.sh',
+ description: 'Check for performance regressions',
+ },
+ ],
+ references: [
+ {
+ name: 'Performance Guide',
+ path: 'docs/performance.md',
+ description: 'Performance optimization guide',
+ },
+ {
+ name: 'Benchmark Reference',
+ path: 'docs/benchmarks.md',
+ description: 'Benchmark configuration reference',
},
],
},
'github-automation': {
name: 'github-automation',
- description: 'CI/CD and PR management automation.',
- triggers: ['PR creation', 'CI setup', 'release management'],
- skipWhen: ['local development', 'prototyping'],
+ description: 'GitHub workflow automation including PR management, CI/CD, issue tracking, and release management. Integrates with GitHub CLI for seamless automation.',
+ triggers: [
+ 'creating pull requests',
+ 'setting up CI/CD pipelines',
+ 'release management',
+ 'issue tracking automation',
+ 'branch management',
+ 'code review workflows',
+ 'repository maintenance',
+ ],
+ skipWhen: [
+ 'local-only development',
+ 'prototyping without commits',
+ 'non-GitHub repositories',
+ 'offline work',
+ ],
commands: [
{
- name: 'Create PR',
- description: 'Create a pull request',
- command: 'gh pr create --title "title" --body "description"',
+ name: 'Create Pull Request',
+ description: 'Create a new pull request with summary',
+ command: 'gh pr create --title "[title]" --body "[description]"',
+ example: 'gh pr create --title "feat: add OAuth2 authentication" --body "## Summary\\n- Implemented OAuth2 flow\\n- Added token refresh\\n\\n## Test Plan\\n- Run auth tests"',
},
{
- name: 'Run CI',
- description: 'Trigger CI workflow',
- command: 'gh workflow run ci.yml',
+ name: 'View PR',
+ description: 'View pull request details',
+ command: 'gh pr view [number]',
+ example: 'gh pr view 123 --comments',
+ },
+ {
+ name: 'Merge PR',
+ description: 'Merge a pull request',
+ command: 'gh pr merge [number] --squash',
+ example: 'gh pr merge 123 --squash --delete-branch',
+ },
+ {
+ name: 'Run Workflow',
+ description: 'Trigger a GitHub Actions workflow',
+ command: 'gh workflow run [workflow]',
+ example: 'gh workflow run ci.yml --ref feature-branch',
+ },
+ {
+ name: 'View Workflow Runs',
+ description: 'List recent workflow runs',
+ command: 'gh run list --limit 10',
+ },
+ {
+ name: 'Create Issue',
+ description: 'Create a new issue',
+ command: 'gh issue create --title "[title]" --body "[body]"',
+ example: 'gh issue create --title "Bug: login fails on mobile" --body "## Description\\n..." --label bug',
+ },
+ {
+ name: 'Create Release',
+ description: 'Create a new release',
+ command: 'gh release create [tag] --notes "[notes]"',
+ example: 'gh release create v1.0.0 --notes "Initial release" --generate-notes',
+ },
+ {
+ name: 'View Checks',
+ description: 'View PR check status',
+ command: 'gh pr checks [number]',
+ example: 'gh pr checks 123 --watch',
+ },
+ {
+ name: 'Review PR',
+ description: 'Submit a PR review',
+ command: 'gh pr review [number] --approve --body "[comment]"',
+ example: 'gh pr review 123 --approve --body "LGTM! Great work on the tests."',
+ },
+ ],
+ scripts: [
+ {
+ name: 'pr-template',
+ path: '.agents/scripts/pr-template.sh',
+ description: 'Generate PR from template',
+ },
+ {
+ name: 'release-prep',
+ path: '.agents/scripts/release-prep.sh',
+ description: 'Prepare release with changelog',
+ },
+ ],
+ references: [
+ {
+ name: 'GitHub CLI Reference',
+ path: 'docs/gh-cli.md',
+ description: 'GitHub CLI command reference',
+ },
+ {
+ name: 'PR Guidelines',
+ path: 'docs/pr-guidelines.md',
+ description: 'Pull request best practices',
+ },
+ {
+ name: 'CI/CD Setup',
+ path: 'docs/ci-cd.md',
+ description: 'CI/CD pipeline configuration',
},
],
},
@@ -266,9 +689,291 @@ export async function generateBuiltInSkill(
const skillMd = await generateSkillMd(template);
+ // Generate helper scripts
+ const scripts: Record<string, string> = {};
+ if (template.scripts) {
+ for (const script of template.scripts) {
+ scripts[script.path] = generateHelperScript(skillName, script.name);
+ }
+ }
+
return {
skillMd,
- scripts: {},
+ scripts,
references: {},
};
}
+
+/**
+ * Generate a helper script for a skill
+ */
+function generateHelperScript(skillName: string, scriptName: string): string {
+ const scripts: Record<string, Record<string, string>> = {
+ 'swarm-orchestration': {
+ 'swarm-start': `#!/bin/bash
+# Swarm Orchestration - Start Script
+# Initialize swarm with default anti-drift settings
+
+set -e
+
+echo "Initializing hierarchical swarm..."
+npx @claude-flow/cli swarm init \\
+ --topology hierarchical \\
+ --max-agents 8 \\
+ --strategy specialized
+
+echo "Swarm initialized successfully"
+npx @claude-flow/cli swarm status
+`,
+ 'swarm-monitor': `#!/bin/bash
+# Swarm Orchestration - Monitor Script
+# Real-time swarm monitoring
+
+set -e
+
+echo "Starting swarm monitor..."
+npx @claude-flow/cli swarm status --watch --interval 5
+`,
+ },
+ 'memory-management': {
+ 'memory-backup': `#!/bin/bash
+# Memory Management - Backup Script
+# Export memory to backup file
+
+set -e
+
+BACKUP_DIR="\${BACKUP_DIR:-./.backups}"
+TIMESTAMP=$(date +%Y%m%d_%H%M%S)
+BACKUP_FILE="\${BACKUP_DIR}/memory_\${TIMESTAMP}.json"
+
+mkdir -p "$BACKUP_DIR"
+
+echo "Backing up memory to $BACKUP_FILE..."
+npx @claude-flow/cli memory export --output "$BACKUP_FILE"
+
+echo "Backup complete: $BACKUP_FILE"
+`,
+ 'memory-consolidate': `#!/bin/bash
+# Memory Management - Consolidate Script
+# Optimize and consolidate memory
+
+set -e
+
+echo "Running memory consolidation..."
+npx @claude-flow/cli hooks worker dispatch --trigger consolidate
+
+echo "Memory consolidation complete"
+npx @claude-flow/cli memory stats
+`,
+ },
+ 'sparc-methodology': {
+ 'sparc-init': `#!/bin/bash
+# SPARC Methodology - Init Script
+# Initialize SPARC workflow for a new feature
+
+set -e
+
+FEATURE_NAME="\${1:-new-feature}"
+
+echo "Initializing SPARC workflow for: $FEATURE_NAME"
+
+# Create SPARC documentation directory
+mkdir -p "./docs/sparc/$FEATURE_NAME"
+
+# Create phase files
+touch "./docs/sparc/$FEATURE_NAME/1-specification.md"
+touch "./docs/sparc/$FEATURE_NAME/2-pseudocode.md"
+touch "./docs/sparc/$FEATURE_NAME/3-architecture.md"
+touch "./docs/sparc/$FEATURE_NAME/4-refinement.md"
+touch "./docs/sparc/$FEATURE_NAME/5-completion.md"
+
+echo "SPARC workflow initialized in ./docs/sparc/$FEATURE_NAME"
+`,
+ 'sparc-review': `#!/bin/bash
+# SPARC Methodology - Review Script
+# Run SPARC phase review checklist
+
+set -e
+
+FEATURE_DIR="\${1:-.}"
+
+echo "SPARC Phase Review Checklist"
+echo "============================="
+
+for phase in specification pseudocode architecture refinement completion; do
+ if [ -f "$FEATURE_DIR/\${phase}.md" ]; then
+ echo "[x] $phase - found"
+ else
+ echo "[ ] $phase - missing"
+ fi
+done
+`,
+ },
+ 'security-audit': {
+ 'security-scan': `#!/bin/bash
+# Security Audit - Full Scan Script
+# Run comprehensive security scan pipeline
+
+set -e
+
+echo "Running full security scan..."
+
+# Input validation
+echo "Checking input validation..."
+npx @claude-flow/cli security scan --check input-validation
+
+# Path traversal
+echo "Checking path traversal..."
+npx @claude-flow/cli security scan --check path-traversal
+
+# SQL injection
+echo "Checking SQL injection..."
+npx @claude-flow/cli security scan --check sql-injection
+
+# XSS
+echo "Checking XSS..."
+npx @claude-flow/cli security scan --check xss
+
+# Secrets
+echo "Checking for hardcoded secrets..."
+npx @claude-flow/cli security validate --check secrets
+
+# CVE scan
+echo "Scanning dependencies for CVEs..."
+npx @claude-flow/cli security cve --scan
+
+echo "Security scan complete"
+`,
+ 'cve-remediate': `#!/bin/bash
+# Security Audit - CVE Remediation Script
+# Auto-remediate known CVEs
+
+set -e
+
+echo "Scanning for CVEs..."
+npx @claude-flow/cli security cve --scan --severity high
+
+echo "Attempting auto-remediation..."
+npm audit fix
+
+echo "Re-scanning after remediation..."
+npx @claude-flow/cli security cve --scan
+
+echo "CVE remediation complete"
+`,
+ },
+ 'performance-analysis': {
+ 'perf-baseline': `#!/bin/bash
+# Performance Analysis - Baseline Script
+# Capture performance baseline
+
+set -e
+
+BASELINE_FILE="\${1:-baseline.json}"
+
+echo "Capturing performance baseline..."
+npx @claude-flow/cli performance benchmark \\
+ --suite all \\
+ --iterations 100 \\
+ --output "$BASELINE_FILE"
+
+echo "Baseline saved to $BASELINE_FILE"
+`,
+ 'perf-regression': `#!/bin/bash
+# Performance Analysis - Regression Check Script
+# Check for performance regressions
+
+set -e
+
+BASELINE_FILE="\${1:-baseline.json}"
+CURRENT_FILE="current.json"
+THRESHOLD="\${2:-10}"
+
+echo "Running current benchmarks..."
+npx @claude-flow/cli performance benchmark \\
+ --suite all \\
+ --iterations 100 \\
+ --output "$CURRENT_FILE"
+
+echo "Comparing against baseline..."
+npx @claude-flow/cli performance benchmark \\
+ --compare "$BASELINE_FILE" "$CURRENT_FILE" \\
+ --threshold "$THRESHOLD"
+
+rm "$CURRENT_FILE"
+`,
+ },
+ 'github-automation': {
+ 'pr-template': `#!/bin/bash
+# GitHub Automation - PR Template Script
+# Generate PR from template
+
+set -e
+
+TITLE="\${1:-Update}"
+BRANCH=$(git rev-parse --abbrev-ref HEAD)
+
+echo "Creating PR for branch: $BRANCH"
+
+gh pr create \\
+ --title "$TITLE" \\
+ --body "$(cat <<EOF
+## Summary
+<!-- Describe your changes -->
+
+## Test Plan
+- [ ] Unit tests pass
+- [ ] Integration tests pass
+- [ ] Manual testing completed
+
+## Checklist
+- [ ] Code follows style guidelines
+- [ ] Documentation updated
+- [ ] No breaking changes
+
+Generated with claude-flow
+EOF
+)"
+
+echo "PR created successfully"
+`,
+ 'release-prep': `#!/bin/bash
+# GitHub Automation - Release Prep Script
+# Prepare release with changelog
+
+set -e
+
+VERSION="\${1:-patch}"
+
+echo "Preparing release..."
+
+# Bump version
+npm version "$VERSION" --no-git-tag-version
+
+NEW_VERSION=$(node -p "require('./package.json').version")
+
+echo "Creating release v$NEW_VERSION..."
+gh release create "v$NEW_VERSION" \\
+ --generate-notes \\
+ --draft
+
+echo "Draft release v$NEW_VERSION created"
+`,
+ },
+ };
+
+ const skillScripts = scripts[skillName];
+ if (skillScripts && skillScripts[scriptName]) {
+ return skillScripts[scriptName];
+ }
+
+ return `#!/bin/bash
+# ${skillName} - ${scriptName}
+# Generated by @claude-flow/codex
+
+set -e
+
+echo "Running ${scriptName}..."
+# Add your script logic here
+`;
+}