Checkpoint: File edits

Automatic checkpoint created by Claude Code
- Branch: v3
- Timestamp: 2026-01-08T02:40:47Z
- Changes: 199 file(s)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
rUvandClaude Opus 4.5 committed 2026-01-08 02:40:47 +00:00
1 parent a91bb00ff0
commit 7d70a535a7
199 files changed
+40336

No files matched your search

@@ -0,0 +1,11 @@
# architect agent configuration
type: architect
version: "3.0.0"
capabilities:
- system-design
- api-design
- documentation
optimizations:
- context-caching
- memory-persistence
createdAt: "2026-01-07T22:37:39.402Z"
@@ -0,0 +1,11 @@
# coder agent configuration
type: coder
version: "3.0.0"
capabilities:
- code-generation
- refactoring
- debugging
optimizations:
- flash-attention
- token-reduction
createdAt: "2026-01-07T22:37:39.401Z"
@@ -0,0 +1,10 @@
# reviewer agent configuration
type: reviewer
version: "3.0.0"
capabilities:
- code-review
- quality-analysis
- best-practices
optimizations:
- incremental-analysis
createdAt: "2026-01-07T22:37:39.402Z"
@@ -0,0 +1,10 @@
# security-architect agent configuration
type: security-architect
version: "3.0.0"
capabilities:
- threat-modeling
- vulnerability-analysis
- security-review
optimizations:
- pattern-matching
createdAt: "2026-01-07T22:37:39.402Z"
@@ -0,0 +1,10 @@
# tester agent configuration
type: tester
version: "3.0.0"
capabilities:
- unit-testing
- integration-testing
- coverage
optimizations:
- parallel-execution
createdAt: "2026-01-07T22:37:39.402Z"
@@ -0,0 +1,10 @@
# Agents Commands
Commands for agents operations in Claude Flow.
## Available Commands
- [agent-types](./agent-types.md)
- [agent-capabilities](./agent-capabilities.md)
- [agent-coordination](./agent-coordination.md)
- [agent-spawning](./agent-spawning.md)
@@ -0,0 +1,21 @@
# agent-capabilities
Matrix of agent capabilities and their specializations.
## Capability Matrix
| Agent Type | Primary Skills | Best For |
|------------|---------------|----------|
| coder | Implementation, debugging | Feature development |
| researcher | Analysis, synthesis | Requirements gathering |
| tester | Testing, validation | Quality assurance |
| architect | Design, planning | System architecture |
## Querying Capabilities
```bash
# List all capabilities
npx claude-flow agents capabilities
# For specific agent
npx claude-flow agents capabilities --type coder
```
@@ -0,0 +1,28 @@
# agent-coordination
Coordination patterns for multi-agent collaboration.
## Coordination Patterns
### Hierarchical
Queen-led with worker specialization
```bash
npx claude-flow swarm init --topology hierarchical
```
### Mesh
Peer-to-peer collaboration
```bash
npx claude-flow swarm init --topology mesh
```
### Adaptive
Dynamic topology based on workload
```bash
npx claude-flow swarm init --topology adaptive
```
## Best Practices
- Use hierarchical for complex projects
- Use mesh for research tasks
- Use adaptive for unknown workloads
@@ -0,0 +1,28 @@
# agent-spawning
Guide to spawning agents with Claude Code's Task tool.
## Using Claude Code's Task Tool
**CRITICAL**: Always use Claude Code's Task tool for actual agent execution:
```javascript
// Spawn ALL agents in ONE message
Task("Researcher", "Analyze requirements...", "researcher")
Task("Coder", "Implement features...", "coder")
Task("Tester", "Create tests...", "tester")
```
## MCP Coordination Setup (Optional)
MCP tools are ONLY for coordination:
```javascript
mcp__claude-flow__swarm_init { topology: "mesh" }
mcp__claude-flow__agent_spawn { type: "researcher" }
```
## Best Practices
1. Always spawn agents concurrently
2. Use Task tool for execution
3. MCP only for coordination
4. Batch all operations
@@ -0,0 +1,26 @@
# agent-types
Complete guide to all 54 available agent types in Claude Flow.
## Core Development Agents
- `coder` - Implementation specialist
- `reviewer` - Code quality assurance
- `tester` - Test creation and validation
- `planner` - Strategic planning
- `researcher` - Information gathering
## Swarm Coordination Agents
- `hierarchical-coordinator` - Queen-led coordination
- `mesh-coordinator` - Peer-to-peer networks
- `adaptive-coordinator` - Dynamic topology
## Specialized Agents
- `backend-dev` - API development
- `mobile-dev` - React Native development
- `ml-developer` - Machine learning
- `system-architect` - High-level design
For full list and details:
```bash
npx claude-flow agents list
```
@@ -0,0 +1,54 @@
# Analysis Commands Compliance Report
## Overview
Reviewed all command files in `.claude/commands/analysis/` directory to ensure proper usage of:
- `mcp__claude-flow__*` tools (preferred)
- `npx claude-flow` commands (as fallback)
- No direct implementation calls
## Files Reviewed
### 1. token-efficiency.md
**Status**: ✅ Updated
**Changes Made**:
- Replaced `npx ruv-swarm hook session-end --export-metrics` with proper MCP tool call
- Updated to: `Tool: mcp__claude-flow__token_usage` with appropriate parameters
- Maintained result format and context
**Before**:
```bash
npx ruv-swarm hook session-end --export-metrics
```
**After**:
```
Tool: mcp__claude-flow__token_usage
Parameters: {"operation": "session", "timeframe": "24h"}
```
### 2. performance-bottlenecks.md
**Status**: ✅ Compliant (No changes needed)
**Reason**: Already uses proper `mcp__claude-flow__task_results` tool format
## Summary
- **Total files reviewed**: 2
- **Files updated**: 1
- **Files already compliant**: 1
- **Compliance rate after updates**: 100%
## Compliance Patterns Enforced
1. **MCP Tool Usage**: All direct tool calls now use `mcp__claude-flow__*` format
2. **Parameter Format**: JSON parameters properly structured
3. **Command Context**: Preserved original functionality and expected results
4. **Documentation**: Maintained clarity and examples
## Recommendations
1. All analysis commands now follow the proper pattern
2. No direct bash commands or implementation calls remain
3. Token usage analysis properly integrated with MCP tools
4. Performance analysis already using correct tool format
The analysis directory is now fully compliant with the Claude Flow command standards.
@@ -0,0 +1,9 @@
# Analysis Commands
Commands for analysis operations in Claude Flow.
## Available Commands
- [bottleneck-detect](./bottleneck-detect.md)
- [token-usage](./token-usage.md)
- [performance-report](./performance-report.md)
@@ -0,0 +1,162 @@
# bottleneck detect
Analyze performance bottlenecks in swarm operations and suggest optimizations.
## Usage
```bash
npx claude-flow bottleneck detect [options]
```
## Options
- `--swarm-id, -s <id>` - Analyze specific swarm (default: current)
- `--time-range, -t <range>` - Analysis period: 1h, 24h, 7d, all (default: 1h)
- `--threshold <percent>` - Bottleneck threshold percentage (default: 20)
- `--export, -e <file>` - Export analysis to file
- `--fix` - Apply automatic optimizations
## Examples
### Basic bottleneck detection
```bash
npx claude-flow bottleneck detect
```
### Analyze specific swarm
```bash
npx claude-flow bottleneck detect --swarm-id swarm-123
```
### Last 24 hours with export
```bash
npx claude-flow bottleneck detect -t 24h -e bottlenecks.json
```
### Auto-fix detected issues
```bash
npx claude-flow bottleneck detect --fix --threshold 15
```
## Metrics Analyzed
### Communication Bottlenecks
- Message queue delays
- Agent response times
- Coordination overhead
- Memory access patterns
### Processing Bottlenecks
- Task completion times
- Agent utilization rates
- Parallel execution efficiency
- Resource contention
### Memory Bottlenecks
- Cache hit rates
- Memory access patterns
- Storage I/O performance
- Neural pattern loading
### Network Bottlenecks
- API call latency
- MCP communication delays
- External service timeouts
- Concurrent request limits
## Output Format
```
🔍 Bottleneck Analysis Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━
📊 Summary
├── Time Range: Last 1 hour
├── Agents Analyzed: 6
├── Tasks Processed: 42
└── Critical Issues: 2
🚨 Critical Bottlenecks
1. Agent Communication (35% impact)
└── coordinator → coder-1 messages delayed by 2.3s avg
2. Memory Access (28% impact)
└── Neural pattern loading taking 1.8s per access
⚠️ Warning Bottlenecks
1. Task Queue (18% impact)
└── 5 tasks waiting > 10s for assignment
💡 Recommendations
1. Switch to hierarchical topology (est. 40% improvement)
2. Enable memory caching (est. 25% improvement)
3. Increase agent concurrency to 8 (est. 20% improvement)
✅ Quick Fixes Available
Run with --fix to apply:
- Enable smart caching
- Optimize message routing
- Adjust agent priorities
```
## Automatic Fixes
When using `--fix`, the following optimizations may be applied:
1. **Topology Optimization**
- Switch to more efficient topology
- Adjust communication patterns
- Reduce coordination overhead
2. **Caching Enhancement**
- Enable memory caching
- Optimize cache strategies
- Preload common patterns
3. **Concurrency Tuning**
- Adjust agent counts
- Optimize parallel execution
- Balance workload distribution
4. **Priority Adjustment**
- Reorder task queues
- Prioritize critical paths
- Reduce wait times
## Performance Impact
Typical improvements after bottleneck resolution:
- **Communication**: 30-50% faster message delivery
- **Processing**: 20-40% reduced task completion time
- **Memory**: 40-60% fewer cache misses
- **Overall**: 25-45% performance improvement
## Integration with Claude Code
```javascript
// Check for bottlenecks in Claude Code
mcp__claude-flow__bottleneck_detect {
timeRange: "1h",
threshold: 20,
autoFix: false
}
```
## See Also
- `performance report` - Detailed performance analysis
- `token usage` - Token optimization analysis
- `swarm monitor` - Real-time monitoring
- `cache manage` - Cache optimization
@@ -0,0 +1,59 @@
# Performance Bottleneck Analysis
## Purpose
Identify and resolve performance bottlenecks in your development workflow.
## Automated Analysis
### 1. Real-time Detection
The post-task hook automatically analyzes:
- Execution time vs. complexity
- Agent utilization rates
- Resource constraints
- Operation patterns
### 2. Common Bottlenecks
**Time Bottlenecks:**
- Tasks taking > 5 minutes
- Sequential operations that could parallelize
- Redundant file operations
**Coordination Bottlenecks:**
- Single agent for complex tasks
- Unbalanced agent workloads
- Poor topology selection
**Resource Bottlenecks:**
- High operation count (> 100)
- Memory constraints
- I/O limitations
### 3. Improvement Suggestions
```
Tool: mcp__claude-flow__task_results
Parameters: {"taskId": "task-123", "format": "detailed"}
Result includes:
{
"bottlenecks": [
{
"type": "coordination",
"severity": "high",
"description": "Single agent used for complex task",
"recommendation": "Spawn specialized agents for parallel work"
}
],
"improvements": [
{
"area": "execution_time",
"suggestion": "Use parallel task execution",
"expectedImprovement": "30-50% time reduction"
}
]
}
```
## Continuous Optimization
The system learns from each task to prevent future bottlenecks!
@@ -0,0 +1,25 @@
# performance-report
Generate comprehensive performance reports for swarm operations.
## Usage
```bash
npx claude-flow analysis performance-report [options]
```
## Options
- `--format <type>` - Report format (json, html, markdown)
- `--include-metrics` - Include detailed metrics
- `--compare <id>` - Compare with previous swarm
## Examples
```bash
# Generate HTML report
npx claude-flow analysis performance-report --format html
# Compare swarms
npx claude-flow analysis performance-report --compare swarm-123
# Full metrics report
npx claude-flow analysis performance-report --include-metrics --format markdown
```
@@ -0,0 +1,45 @@
# Token Usage Optimization
## Purpose
Reduce token consumption while maintaining quality through intelligent coordination.
## Optimization Strategies
### 1. Smart Caching
- Search results cached for 5 minutes
- File content cached during session
- Pattern recognition reduces redundant searches
### 2. Efficient Coordination
- Agents share context automatically
- Avoid duplicate file reads
- Batch related operations
### 3. Measurement & Tracking
```bash
# Check token savings after session
Tool: mcp__claude-flow__token_usage
Parameters: {"operation": "session", "timeframe": "24h"}
# Result shows:
{
"metrics": {
"tokensSaved": 15420,
"operations": 45,
"efficiency": "343 tokens/operation"
}
}
```
## Best Practices
1. **Use Task tool** for complex searches
2. **Enable caching** in pre-search hooks
3. **Batch operations** when possible
4. **Review session summaries** for insights
## Token Reduction Results
- 📉 32.3% average token reduction
- 🎯 More focused operations
- 🔄 Intelligent result reuse
- 📊 Cumulative improvements
@@ -0,0 +1,25 @@
# token-usage
Analyze token usage patterns and optimize for efficiency.
## Usage
```bash
npx claude-flow analysis token-usage [options]
```
## Options
- `--period <time>` - Analysis period (1h, 24h, 7d, 30d)
- `--by-agent` - Break down by agent
- `--by-operation` - Break down by operation type
## Examples
```bash
# Last 24 hours token usage
npx claude-flow analysis token-usage --period 24h
# By agent breakdown
npx claude-flow analysis token-usage --by-agent
# Export detailed report
npx claude-flow analysis token-usage --period 7d --export tokens.csv
```
@@ -0,0 +1,9 @@
# Automation Commands
Commands for automation operations in Claude Flow.
## Available Commands
- [auto-agent](./auto-agent.md)
- [smart-spawn](./smart-spawn.md)
- [workflow-select](./workflow-select.md)
@@ -0,0 +1,122 @@
# auto agent
Automatically spawn and manage agents based on task requirements.
## Usage
```bash
npx claude-flow auto agent [options]
```
## Options
- `--task, -t <description>` - Task description for agent analysis
- `--max-agents, -m <number>` - Maximum agents to spawn (default: auto)
- `--min-agents <number>` - Minimum agents required (default: 1)
- `--strategy, -s <type>` - Selection strategy: optimal, minimal, balanced
- `--no-spawn` - Analyze only, don't spawn agents
## Examples
### Basic auto-spawning
```bash
npx claude-flow auto agent --task "Build a REST API with authentication"
```
### Constrained spawning
```bash
npx claude-flow auto agent -t "Debug performance issue" --max-agents 3
```
### Analysis only
```bash
npx claude-flow auto agent -t "Refactor codebase" --no-spawn
```
### Minimal strategy
```bash
npx claude-flow auto agent -t "Fix bug in login" -s minimal
```
## How It Works
1. **Task Analysis**
- Parses task description
- Identifies required skills
- Estimates complexity
- Determines parallelization opportunities
2. **Agent Selection**
- Matches skills to agent types
- Considers task dependencies
- Optimizes for efficiency
- Respects constraints
3. **Topology Selection**
- Chooses optimal swarm structure
- Configures communication patterns
- Sets up coordination rules
- Enables monitoring
4. **Automatic Spawning**
- Creates selected agents
- Assigns specific roles
- Distributes subtasks
- Initiates coordination
## Agent Types Selected
- **Architect**: System design, architecture decisions
- **Coder**: Implementation, code generation
- **Tester**: Test creation, quality assurance
- **Analyst**: Performance, optimization
- **Researcher**: Documentation, best practices
- **Coordinator**: Task management, progress tracking
## Strategies
### Optimal
- Maximum efficiency
- May spawn more agents
- Best for complex tasks
- Highest resource usage
### Minimal
- Minimum viable agents
- Conservative approach
- Good for simple tasks
- Lowest resource usage
### Balanced
- Middle ground
- Adaptive to complexity
- Default strategy
- Good performance/resource ratio
## Integration with Claude Code
```javascript
// In Claude Code after auto-spawning
mcp__claude-flow__auto_agent {
task: "Build authentication system",
strategy: "balanced",
maxAgents: 6
}
```
## See Also
- `agent spawn` - Manual agent creation
- `swarm init` - Initialize swarm manually
- `smart spawn` - Intelligent agent spawning
- `workflow select` - Choose predefined workflows
@@ -0,0 +1,106 @@
# Self-Healing Workflows
## Purpose
Automatically detect and recover from errors without interrupting your flow.
## Self-Healing Features
### 1. Error Detection
Monitors for:
- Failed commands
- Syntax errors
- Missing dependencies
- Broken tests
### 2. Automatic Recovery
**Missing Dependencies:**
```
Error: Cannot find module 'express'
→ Automatically runs: npm install express
→ Retries original command
```
**Syntax Errors:**
```
Error: Unexpected token
→ Analyzes error location
→ Suggests fix through analyzer agent
→ Applies fix with confirmation
```
**Test Failures:**
```
Test failed: "user authentication"
→ Spawns debugger agent
→ Analyzes failure cause
→ Implements fix
→ Re-runs tests
```
### 3. Learning from Failures
Each recovery improves future prevention:
- Patterns saved to knowledge base
- Similar errors prevented proactively
- Recovery strategies optimized
**Pattern Storage:**
```javascript
// Store error patterns
mcp__claude-flow__memory_usage({
"action": "store",
"key": "error-pattern-" + Date.now(),
"value": JSON.stringify(errorData),
"namespace": "error-patterns",
"ttl": 2592000 // 30 days
})
// Analyze patterns
mcp__claude-flow__neural_patterns({
"action": "analyze",
"operation": "error-recovery",
"outcome": "success"
})
```
## Self-Healing Integration
### MCP Tool Coordination
```javascript
// Initialize self-healing swarm
mcp__claude-flow__swarm_init({
"topology": "star",
"maxAgents": 4,
"strategy": "adaptive"
})
// Spawn recovery agents
mcp__claude-flow__agent_spawn({
"type": "monitor",
"name": "Error Monitor",
"capabilities": ["error-detection", "recovery"]
})
// Orchestrate recovery
mcp__claude-flow__task_orchestrate({
"task": "recover from error",
"strategy": "sequential",
"priority": "critical"
})
```
### Fallback Hook Configuration
```json
{
"PostToolUse": [{
"matcher": "^Bash$",
"command": "npx claude-flow hook post-bash --exit-code '${tool.result.exitCode}' --auto-recover"
}]
}
```
## Benefits
- 🛡️ Resilient workflows
- 🔄 Automatic recovery
- 📚 Learns from errors
- ⏱️ Saves debugging time
@@ -0,0 +1,90 @@
# Cross-Session Memory
## Purpose
Maintain context and learnings across Claude Code sessions for continuous improvement.
## Memory Features
### 1. Automatic State Persistence
At session end, automatically saves:
- Active agents and specializations
- Task history and patterns
- Performance metrics
- Neural network weights
- Knowledge base updates
### 2. Session Restoration
```javascript
// Using MCP tools for memory operations
mcp__claude-flow__memory_usage({
"action": "retrieve",
"key": "session-state",
"namespace": "sessions"
})
// Restore swarm state
mcp__claude-flow__context_restore({
"snapshotId": "sess-123"
})
```
**Fallback with npx:**
```bash
npx claude-flow hook session-restore --session-id "sess-123"
```
### 3. Memory Types
**Project Memory:**
- File relationships
- Common edit patterns
- Testing approaches
- Build configurations
**Agent Memory:**
- Specialization levels
- Task success rates
- Optimization strategies
- Error patterns
**Performance Memory:**
- Bottleneck history
- Optimization results
- Token usage patterns
- Efficiency trends
### 4. Privacy & Control
```javascript
// List memory contents
mcp__claude-flow__memory_usage({
"action": "list",
"namespace": "sessions"
})
// Delete specific memory
mcp__claude-flow__memory_usage({
"action": "delete",
"key": "session-123",
"namespace": "sessions"
})
// Backup memory
mcp__claude-flow__memory_backup({
"path": "./backups/memory-backup.json"
})
```
**Manual control:**
```bash
# View stored memory
ls .claude-flow/memory/
# Disable memory
export CLAUDE_FLOW_MEMORY_PERSIST=false
```
## Benefits
- 🧠 Contextual awareness
- 📈 Cumulative learning
- ⚡ Faster task completion
- 🎯 Personalized optimization
@@ -0,0 +1,73 @@
# Smart Agent Auto-Spawning
## Purpose
Automatically spawn the right agents at the right time without manual intervention.
## Auto-Spawning Triggers
### 1. File Type Detection
When editing files, agents auto-spawn:
- **JavaScript/TypeScript**: Coder agent
- **Markdown**: Researcher agent
- **JSON/YAML**: Analyst agent
- **Multiple files**: Coordinator agent
### 2. Task Complexity
```
Simple task: "Fix typo"
→ Single coordinator agent
Complex task: "Implement OAuth with Google"
→ Architect + Coder + Tester + Researcher
```
### 3. Dynamic Scaling
The system monitors workload and spawns additional agents when:
- Task queue grows
- Complexity increases
- Parallel opportunities exist
**Status Monitoring:**
```javascript
// Check swarm health
mcp__claude-flow__swarm_status({
"swarmId": "current"
})
// Monitor agent performance
mcp__claude-flow__agent_metrics({
"agentId": "agent-123"
})
```
## Configuration
### MCP Tool Integration
Uses Claude Flow MCP tools for agent coordination:
```javascript
// Initialize swarm with appropriate topology
mcp__claude-flow__swarm_init({
"topology": "mesh",
"maxAgents": 8,
"strategy": "auto"
})
// Spawn agents based on file type
mcp__claude-flow__agent_spawn({
"type": "coder",
"name": "JavaScript Handler",
"capabilities": ["javascript", "typescript"]
})
```
### Fallback Configuration
If MCP tools are unavailable:
```bash
npx claude-flow hook pre-task --auto-spawn-agents
```
## Benefits
- 🤖 Zero manual agent management
- 🎯 Perfect agent selection
- 📈 Dynamic scaling
- 💾 Resource efficiency
@@ -0,0 +1,25 @@
# smart-spawn
Intelligently spawn agents based on workload analysis.
## Usage
```bash
npx claude-flow automation smart-spawn [options]
```
## Options
- `--analyze` - Analyze before spawning
- `--threshold <n>` - Spawn threshold
- `--topology <type>` - Preferred topology
## Examples
```bash
# Smart spawn with analysis
npx claude-flow automation smart-spawn --analyze
# Set spawn threshold
npx claude-flow automation smart-spawn --threshold 5
# Force topology
npx claude-flow automation smart-spawn --topology hierarchical
```
@@ -0,0 +1,25 @@
# workflow-select
Automatically select optimal workflow based on task type.
## Usage
```bash
npx claude-flow automation workflow-select [options]
```
## Options
- `--task <description>` - Task description
- `--constraints <list>` - Workflow constraints
- `--preview` - Preview without executing
## Examples
```bash
# Select workflow for task
npx claude-flow automation workflow-select --task "Deploy to production"
# With constraints
npx claude-flow automation workflow-select --constraints "no-downtime,rollback"
# Preview mode
npx claude-flow automation workflow-select --task "Database migration" --preview
```
@@ -0,0 +1,103 @@
---
name: claude-flow-help
description: Show Claude-Flow commands and usage
---
# Claude-Flow Commands
## 🌊 Claude-Flow: Agent Orchestration Platform
Claude-Flow is the ultimate multi-terminal orchestration platform that revolutionizes how you work with Claude Code.
## Core Commands
### 🚀 System Management
- `./claude-flow start` - Start orchestration system
- `./claude-flow start --ui` - Start with interactive process management UI
- `./claude-flow status` - Check system status
- `./claude-flow monitor` - Real-time monitoring
- `./claude-flow stop` - Stop orchestration
### 🤖 Agent Management
- `./claude-flow agent spawn <type>` - Create new agent
- `./claude-flow agent list` - List active agents
- `./claude-flow agent info <id>` - Agent details
- `./claude-flow agent terminate <id>` - Stop agent
### 📋 Task Management
- `./claude-flow task create <type> "description"` - Create task
- `./claude-flow task list` - List all tasks
- `./claude-flow task status <id>` - Task status
- `./claude-flow task cancel <id>` - Cancel task
- `./claude-flow task workflow <file>` - Execute workflow
### 🧠 Memory Operations
- `./claude-flow memory store "key" "value"` - Store data
- `./claude-flow memory query "search"` - Search memory
- `./claude-flow memory stats` - Memory statistics
- `./claude-flow memory export <file>` - Export memory
- `./claude-flow memory import <file>` - Import memory
### ⚡ SPARC Development
- `./claude-flow sparc "task"` - Run SPARC orchestrator
- `./claude-flow sparc modes` - List all 17+ SPARC modes
- `./claude-flow sparc run <mode> "task"` - Run specific mode
- `./claude-flow sparc tdd "feature"` - TDD workflow
- `./claude-flow sparc info <mode>` - Mode details
### 🐝 Swarm Coordination
- `./claude-flow swarm "task" --strategy <type>` - Start swarm
- `./claude-flow swarm "task" --background` - Long-running swarm
- `./claude-flow swarm "task" --monitor` - With monitoring
- `./claude-flow swarm "task" --ui` - Interactive UI
- `./claude-flow swarm "task" --distributed` - Distributed coordination
### 🌍 MCP Integration
- `./claude-flow mcp status` - MCP server status
- `./claude-flow mcp tools` - List available tools
- `./claude-flow mcp config` - Show configuration
- `./claude-flow mcp logs` - View MCP logs
### 🤖 Claude Integration
- `./claude-flow claude spawn "task"` - Spawn Claude with enhanced guidance
- `./claude-flow claude batch <file>` - Execute workflow configuration
## 🌟 Quick Examples
### Initialize with SPARC:
```bash
npx -y claude-flow@latest init --sparc
```
### Start a development swarm:
```bash
./claude-flow swarm "Build REST API" --strategy development --monitor --review
```
### Run TDD workflow:
```bash
./claude-flow sparc tdd "user authentication"
```
### Store project context:
```bash
./claude-flow memory store "project_requirements" "e-commerce platform specs" --namespace project
```
### Spawn specialized agents:
```bash
./claude-flow agent spawn researcher --name "Senior Researcher" --priority 8
./claude-flow agent spawn developer --name "Lead Developer" --priority 9
```
## 🎯 Best Practices
- Use `./claude-flow` instead of `npx claude-flow` after initialization
- Store important context in memory for cross-session persistence
- Use swarm mode for complex tasks requiring multiple agents
- Enable monitoring for real-time progress tracking
- Use background mode for tasks > 30 minutes
## 📚 Resources
- Documentation: https://github.com/ruvnet/claude-code-flow/docs
- Examples: https://github.com/ruvnet/claude-code-flow/examples
- Issues: https://github.com/ruvnet/claude-code-flow/issues
@@ -0,0 +1,107 @@
---
name: claude-flow-memory
description: Interact with Claude-Flow memory system
---
# 🧠 Claude-Flow Memory System
The memory system provides persistent storage for cross-session and cross-agent collaboration with CRDT-based conflict resolution.
## Store Information
```bash
# Store with default namespace
./claude-flow memory store "key" "value"
# Store with specific namespace
./claude-flow memory store "architecture_decisions" "microservices with API gateway" --namespace arch
```
## Query Memory
```bash
# Search across all namespaces
./claude-flow memory query "authentication"
# Search with filters
./claude-flow memory query "API design" --namespace arch --limit 10
```
## Memory Statistics
```bash
# Show overall statistics
./claude-flow memory stats
# Show namespace-specific stats
./claude-flow memory stats --namespace project
```
## Export/Import
```bash
# Export all memory
./claude-flow memory export full-backup.json
# Export specific namespace
./claude-flow memory export project-backup.json --namespace project
# Import memory
./claude-flow memory import backup.json
```
## Cleanup Operations
```bash
# Clean entries older than 30 days
./claude-flow memory cleanup --days 30
# Clean specific namespace
./claude-flow memory cleanup --namespace temp --days 7
```
## 🗂️ Namespaces
- **default** - General storage
- **agents** - Agent-specific data and state
- **tasks** - Task information and results
- **sessions** - Session history and context
- **swarm** - Swarm coordination and objectives
- **project** - Project-specific context
- **spec** - Requirements and specifications
- **arch** - Architecture decisions
- **impl** - Implementation notes
- **test** - Test results and coverage
- **debug** - Debug logs and fixes
## 🎯 Best Practices
### Naming Conventions
- Use descriptive, searchable keys
- Include timestamp for time-sensitive data
- Prefix with component name for clarity
### Organization
- Use namespaces to categorize data
- Store related data together
- Keep values concise but complete
### Maintenance
- Regular backups with export
- Clean old data periodically
- Monitor storage statistics
- Compress large values
## Examples
### Store SPARC context:
```bash
./claude-flow memory store "spec_auth_requirements" "OAuth2 + JWT with refresh tokens" --namespace spec
./claude-flow memory store "arch_api_design" "RESTful microservices with GraphQL gateway" --namespace arch
./claude-flow memory store "test_coverage_auth" "95% coverage, all tests passing" --namespace test
```
### Query project decisions:
```bash
./claude-flow memory query "authentication" --namespace arch --limit 5
./claude-flow memory query "test results" --namespace test
```
### Backup project memory:
```bash
./claude-flow memory export project-$(date +%Y%m%d).json --namespace project
```
@@ -0,0 +1,205 @@
---
name: claude-flow-swarm
description: Coordinate multi-agent swarms for complex tasks
---
# 🐝 Claude-Flow Swarm Coordination
Advanced multi-agent coordination system with timeout-free execution, distributed memory sharing, and intelligent load balancing.
## Basic Usage
```bash
./claude-flow swarm "your complex task" --strategy <type> [options]
```
## 🎯 Swarm Strategies
- **auto** - Automatic strategy selection based on task analysis
- **development** - Code implementation with review and testing
- **research** - Information gathering and synthesis
- **analysis** - Data processing and pattern identification
- **testing** - Comprehensive quality assurance
- **optimization** - Performance tuning and refactoring
- **maintenance** - System updates and bug fixes
## 🤖 Agent Types
- **coordinator** - Plans and delegates tasks to other agents
- **developer** - Writes code and implements solutions
- **researcher** - Gathers and analyzes information
- **analyzer** - Identifies patterns and generates insights
- **tester** - Creates and runs tests for quality assurance
- **reviewer** - Performs code and design reviews
- **documenter** - Creates documentation and guides
- **monitor** - Tracks performance and system health
- **specialist** - Domain-specific expert agents
## 🔄 Coordination Modes
- **centralized** - Single coordinator manages all agents (default)
- **distributed** - Multiple coordinators share management
- **hierarchical** - Tree structure with nested coordination
- **mesh** - Peer-to-peer agent collaboration
- **hybrid** - Mixed coordination strategies
## ⚙️ Common Options
- `--strategy <type>` - Execution strategy
- `--mode <type>` - Coordination mode
- `--max-agents <n>` - Maximum concurrent agents (default: 5)
- `--timeout <minutes>` - Timeout in minutes (default: 60)
- `--background` - Run in background for tasks > 30 minutes
- `--monitor` - Enable real-time monitoring
- `--ui` - Launch terminal UI interface
- `--parallel` - Enable parallel execution
- `--distributed` - Enable distributed coordination
- `--review` - Enable peer review process
- `--testing` - Include automated testing
- `--encryption` - Enable data encryption
- `--verbose` - Detailed logging output
- `--dry-run` - Show configuration without executing
## 🌟 Examples
### Development Swarm with Review
```bash
./claude-flow swarm "Build e-commerce REST API" \
--strategy development \
--monitor \
--review \
--testing
```
### Long-Running Research Swarm
```bash
./claude-flow swarm "Analyze AI market trends 2024-2025" \
--strategy research \
--background \
--distributed \
--max-agents 8
```
### Performance Optimization Swarm
```bash
./claude-flow swarm "Optimize database queries and API performance" \
--strategy optimization \
--testing \
--parallel \
--monitor
```
### Enterprise Development Swarm
```bash
./claude-flow swarm "Implement secure payment processing system" \
--strategy development \
--mode distributed \
--max-agents 10 \
--parallel \
--monitor \
--review \
--testing \
--encryption \
--verbose
```
### Testing and QA Swarm
```bash
./claude-flow swarm "Comprehensive security audit and testing" \
--strategy testing \
--review \
--verbose \
--max-agents 6
```
## 📊 Monitoring and Control
### Real-time monitoring:
```bash
# Monitor swarm activity
./claude-flow monitor
# Monitor specific component
./claude-flow monitor --focus swarm
```
### Check swarm status:
```bash
# Overall system status
./claude-flow status
# Detailed swarm status
./claude-flow status --verbose
```
### View agent activity:
```bash
# List all agents
./claude-flow agent list
# Agent details
./claude-flow agent info <agent-id>
```
## 💾 Memory Integration
Swarms automatically use distributed memory for collaboration:
```bash
# Store swarm objectives
./claude-flow memory store "swarm_objective" "Build scalable API" --namespace swarm
# Query swarm progress
./claude-flow memory query "swarm_progress" --namespace swarm
# Export swarm memory
./claude-flow memory export swarm-results.json --namespace swarm
```
## 🎯 Key Features
### Timeout-Free Execution
- Background mode for long-running tasks
- State persistence across sessions
- Automatic checkpoint recovery
### Work Stealing & Load Balancing
- Dynamic task redistribution
- Automatic agent scaling
- Resource-aware scheduling
### Circuit Breakers & Fault Tolerance
- Automatic retry with exponential backoff
- Graceful degradation
- Health monitoring and recovery
### Real-Time Collaboration
- Cross-agent communication
- Shared memory access
- Event-driven coordination
### Enterprise Security
- Role-based access control
- Audit logging
- Data encryption
- Input validation
## 🔧 Advanced Configuration
### Dry run to preview:
```bash
./claude-flow swarm "Test task" --dry-run --strategy development
```
### Custom quality thresholds:
```bash
./claude-flow swarm "High quality API" \
--strategy development \
--quality-threshold 0.95
```
### Scheduling algorithms:
- FIFO (First In, First Out)
- Priority-based
- Deadline-driven
- Shortest Job First
- Critical Path
- Resource-aware
- Adaptive
For detailed documentation, see: https://github.com/ruvnet/claude-code-flow/docs/swarm-system.md
@@ -0,0 +1,124 @@
---
name: flow-nexus-app-store
description: Browse, publish, and deploy applications
---
# Flow Nexus App Store
Browse templates, publish apps, and deploy solutions.
## Browse Apps
```javascript
// Search apps
mcp__flow-nexus__app_search({
search: "authentication",
category: "backend",
featured: true,
limit: 20
})
// Get app details
mcp__flow-nexus__app_get({ app_id: "app_id" })
// List templates
mcp__flow-nexus__app_store_list_templates({
category: "web-api",
tags: ["express", "jwt"],
limit: 20
})
```
## Publish App
```javascript
mcp__flow-nexus__app_store_publish_app({
name: "My Auth Service",
description: "JWT-based authentication microservice",
category: "backend",
version: "1.0.0",
source_code: sourceCode,
tags: ["auth", "jwt", "express"],
metadata: {
author: "Your Name",
license: "MIT",
repository: "github.com/user/repo"
}
})
```
## Deploy Templates
```javascript
// Get template details
mcp__flow-nexus__template_get({
template_name: "express-api-starter"
})
// Deploy template
mcp__flow-nexus__template_deploy({
template_name: "express-api-starter",
deployment_name: "my-api",
variables: {
api_key: "your_key",
database_url: "postgres://..."
},
env_vars: {
NODE_ENV: "production"
}
})
```
## Analytics
```javascript
// Get app analytics
mcp__flow-nexus__app_analytics({
app_id: "your_app_id",
timeframe: "30d" // 24h, 7d, 30d, 90d
})
// View installed apps
mcp__flow-nexus__app_installed({
user_id: "your_id"
})
```
## Update App
```javascript
mcp__flow-nexus__app_update({
app_id: "app_id",
updates: {
version: "1.1.0",
description: "Updated description",
tags: ["new", "tags"]
}
})
```
## Market Data
```javascript
// Get market statistics
mcp__flow-nexus__market_data()
```
## Template Categories
- **web-api**: RESTful APIs and microservices
- **frontend**: React, Vue, Angular apps
- **full-stack**: Complete applications
- **cli-tools**: Command-line utilities
- **data-processing**: ETL and analytics
- **ml-models**: Pre-trained models
- **blockchain**: Web3 applications
- **mobile**: React Native apps
## Publishing Best Practices
1. Include comprehensive documentation
2. Add example usage and configuration
3. Include tests and CI/CD setup
4. Use semantic versioning
5. Add clear license information
6. Include docker/deployment configs
7. Provide migration guides for updates
## Revenue Sharing
- Earn rUv credits when others use your templates
- Set pricing (0 for free templates)
- Track usage and earnings in analytics
- Withdraw credits or use for Flow Nexus services
@@ -0,0 +1,120 @@
---
name: flow-nexus-challenges
description: Coding challenges, achievements, and leaderboards
---
# Flow Nexus Challenges
Complete coding challenges to earn rUv credits and climb the leaderboard.
## List Challenges
```javascript
mcp__flow-nexus__challenges_list({
difficulty: "intermediate", // beginner, advanced, expert
category: "algorithms",
status: "active",
limit: 20
})
```
## Get Challenge Details
```javascript
mcp__flow-nexus__challenge_get({
challenge_id: "two-sum-problem"
})
```
## Submit Solution
```javascript
mcp__flow-nexus__challenge_submit({
challenge_id: "challenge_id",
user_id: "your_id",
solution_code: `
function solution(nums, target) {
const map = new Map();
for (let i = 0; i < nums.length; i++) {
const complement = target - nums[i];
if (map.has(complement)) {
return [map.get(complement), i];
}
map.set(nums[i], i);
}
return [];
}
`,
language: "javascript",
execution_time: 45 // milliseconds
})
```
## Complete Challenge
```javascript
mcp__flow-nexus__app_store_complete_challenge({
challenge_id: "challenge_id",
user_id: "your_id",
submission_data: {
passed_tests: 10,
total_tests: 10,
execution_time: 45
}
})
```
## Leaderboards
```javascript
// Global leaderboard
mcp__flow-nexus__leaderboard_get({
type: "global", // weekly, monthly, challenge
limit: 10
})
// Challenge-specific leaderboard
mcp__flow-nexus__leaderboard_get({
type: "challenge",
challenge_id: "specific_challenge",
limit: 25
})
```
## Achievements
```javascript
mcp__flow-nexus__achievements_list({
user_id: "your_id",
category: "speed_demon" // Categories vary
})
```
## rUv Credits
```javascript
// Check balance
mcp__flow-nexus__ruv_balance({ user_id: "your_id" })
// View history
mcp__flow-nexus__ruv_history({
user_id: "your_id",
limit: 20
})
// Earn credits (automatic on completion)
mcp__flow-nexus__app_store_earn_ruv({
user_id: "your_id",
amount: 100,
reason: "Completed expert challenge",
source: "challenge"
})
```
## Challenge Categories
- **algorithms**: Classic algorithm problems
- **data-structures**: DS implementation challenges
- **system-design**: Architecture challenges
- **optimization**: Performance challenges
- **security**: Security-focused problems
- **ml-basics**: Machine learning fundamentals
## Tips
1. Start with beginner challenges
2. Review other solutions after completing
3. Optimize for both correctness and speed
4. Complete daily challenges for bonus credits
5. Unlock achievements for extra rewards
@@ -0,0 +1,65 @@
---
name: flow-nexus-auth
description: Flow Nexus authentication and user management
---
# Flow Nexus Authentication
Quick commands for Flow Nexus login and registration.
## Register New Account
```javascript
mcp__flow-nexus__user_register({
email: "user@example.com",
password: "secure_password",
full_name: "Your Name" // optional
})
```
## Login
```javascript
mcp__flow-nexus__user_login({
email: "user@example.com",
password: "your_password"
})
```
## Check Auth Status
```javascript
mcp__flow-nexus__auth_status({ detailed: true })
```
## Logout
```javascript
mcp__flow-nexus__user_logout()
```
## Password Reset
```javascript
// Request reset
mcp__flow-nexus__user_reset_password({ email: "user@example.com" })
// Update with token
mcp__flow-nexus__user_update_password({
token: "reset_token",
new_password: "new_secure_password"
})
```
## Profile Management
```javascript
// Get profile
mcp__flow-nexus__user_profile({ user_id: "your_id" })
// Update profile
mcp__flow-nexus__user_update_profile({
user_id: "your_id",
updates: { full_name: "New Name" }
})
```
## Quick Start
1. Register with your email
2. Check your email for verification
3. Login to access all features
4. Configure auto-refill for uninterrupted service
@@ -0,0 +1,134 @@
---
name: flow-nexus-neural
description: Train and deploy neural networks in distributed sandboxes
---
# Flow Nexus Neural Networks
Train custom neural networks with distributed computing.
## Train Model
```javascript
mcp__flow-nexus__neural_train({
config: {
architecture: {
type: "feedforward", // lstm, gan, autoencoder, transformer
layers: [
{ type: "dense", units: 128, activation: "relu" },
{ type: "dropout", rate: 0.2 },
{ type: "dense", units: 10, activation: "softmax" }
]
},
training: {
epochs: 100,
batch_size: 32,
learning_rate: 0.001,
optimizer: "adam"
}
},
tier: "small" // nano, mini, small, medium, large
})
```
## Run Inference
```javascript
mcp__flow-nexus__neural_predict({
model_id: "model_id",
input: [[0.5, 0.3, 0.2], [0.1, 0.8, 0.1]],
user_id: "your_id"
})
```
## Use Templates
```javascript
// List templates
mcp__flow-nexus__neural_list_templates({
category: "classification", // regression, nlp, vision, anomaly
tier: "free",
limit: 20
})
// Deploy template
mcp__flow-nexus__neural_deploy_template({
template_id: "sentiment-analysis",
custom_config: {
training: { epochs: 50 }
}
})
```
## Distributed Training
```javascript
// Initialize cluster
mcp__flow-nexus__neural_cluster_init({
name: "training-cluster",
architecture: "transformer",
topology: "mesh",
consensus: "proof-of-learning",
wasmOptimization: true
})
// Deploy nodes
mcp__flow-nexus__neural_node_deploy({
cluster_id: "cluster_id",
node_type: "worker", // parameter_server, aggregator
model: "large",
capabilities: ["training", "inference"]
})
// Start training
mcp__flow-nexus__neural_train_distributed({
cluster_id: "cluster_id",
dataset: "mnist",
epochs: 100,
federated: true // Enable federated learning
})
```
## Model Management
```javascript
// List your models
mcp__flow-nexus__neural_list_models({
user_id: "your_id",
include_public: true
})
// Benchmark performance
mcp__flow-nexus__neural_performance_benchmark({
model_id: "model_id",
benchmark_type: "comprehensive"
})
// Publish as template
mcp__flow-nexus__neural_publish_template({
model_id: "model_id",
name: "My Custom Model",
description: "Highly accurate classifier",
category: "classification",
price: 0 // Free template
})
```
## Common Patterns
### Image Classification
```javascript
mcp__flow-nexus__neural_train({
config: {
architecture: { type: "cnn" },
training: { epochs: 50, batch_size: 64 }
},
tier: "medium"
})
```
### Time Series Prediction
```javascript
mcp__flow-nexus__neural_train({
config: {
architecture: { type: "lstm" },
training: { epochs: 100, learning_rate: 0.01 }
},
tier: "small"
})
```
@@ -0,0 +1,116 @@
---
name: flow-nexus-payments
description: Credit management, billing, and payment configuration
---
# Flow Nexus Payments
Manage credits, configure billing, and track usage.
## Check Balance
```javascript
mcp__flow-nexus__check_balance()
```
## Purchase Credits
```javascript
// Create payment link
mcp__flow-nexus__create_payment_link({
amount: 50 // USD, minimum $10
})
// Returns secure payment URL to complete purchase
```
## Auto-Refill Configuration
```javascript
// Enable auto-refill
mcp__flow-nexus__configure_auto_refill({
enabled: true,
threshold: 100, // Refill when credits drop below 100
amount: 50 // Refill with $50 worth of credits
})
// Disable auto-refill
mcp__flow-nexus__configure_auto_refill({
enabled: false
})
```
## Payment History
```javascript
mcp__flow-nexus__get_payment_history({
limit: 50
})
```
## rUv Credits Management
```javascript
// Check balance
mcp__flow-nexus__ruv_balance({
user_id: "your_id"
})
// Transaction history
mcp__flow-nexus__ruv_history({
user_id: "your_id",
limit: 100
})
```
## Upgrade Tier
```javascript
mcp__flow-nexus__user_upgrade({
user_id: "your_id",
tier: "pro" // pro, enterprise
})
```
## Usage Statistics
```javascript
mcp__flow-nexus__user_stats({
user_id: "your_id"
})
```
## Credit Pricing
- **Swarm Operations**: 1-10 credits/hour
- **Sandbox Execution**: 0.5-5 credits/hour
- **Neural Training**: 5-50 credits/job
- **Workflow Runs**: 0.1-1 credit/execution
- **Storage**: 0.01 credits/GB/day
## Earning Credits
1. **Complete Challenges**: 10-500 credits per challenge
2. **Publish Templates**: Earn when others use
3. **Referrals**: Bonus credits for invites
4. **Daily Login**: Small daily bonus
5. **Achievements**: Unlock milestone rewards
## Tiers
### Free Tier
- 100 free credits monthly
- Basic sandbox access
- Limited swarm agents (3 max)
- Community support
### Pro Tier ($29/month)
- 1000 credits monthly
- Priority sandbox access
- Unlimited agents
- Advanced workflows
- Email support
### Enterprise Tier (Custom)
- Unlimited credits
- Dedicated resources
- Custom models
- SLA guarantee
- Priority support
## Cost Optimization Tips
1. Use smaller sandboxes when possible
2. Optimize neural network training parameters
3. Batch workflow executions
4. Clean up unused resources
5. Monitor usage regularly
6. Use templates to avoid redundant work
@@ -0,0 +1,83 @@
---
name: flow-nexus-sandbox
description: E2B sandbox management for isolated code execution
---
# Flow Nexus Sandboxes
Deploy and manage isolated execution environments.
## Create Sandbox
```javascript
mcp__flow-nexus__sandbox_create({
template: "node", // node, python, react, nextjs, vanilla, base
name: "my-sandbox",
env_vars: {
API_KEY: "your_api_key",
NODE_ENV: "development"
},
timeout: 3600 // seconds
})
```
## Execute Code
```javascript
mcp__flow-nexus__sandbox_execute({
sandbox_id: "sandbox_id",
code: `
console.log('Hello from sandbox!');
const result = await fetch('https://api.example.com');
return result.json();
`,
language: "javascript",
capture_output: true
})
```
## Manage Sandboxes
```javascript
// List all sandboxes
mcp__flow-nexus__sandbox_list({ status: "running" })
// Get status
mcp__flow-nexus__sandbox_status({ sandbox_id: "id" })
// Upload file
mcp__flow-nexus__sandbox_upload({
sandbox_id: "id",
file_path: "/app/data.json",
content: JSON.stringify(data)
})
// Stop sandbox
mcp__flow-nexus__sandbox_stop({ sandbox_id: "id" })
// Delete sandbox
mcp__flow-nexus__sandbox_delete({ sandbox_id: "id" })
```
## Templates
- **node**: Node.js environment
- **python**: Python 3.x environment
- **react**: React development setup
- **nextjs**: Next.js full-stack
- **vanilla**: Basic HTML/CSS/JS
- **base**: Minimal Linux environment
## Common Patterns
```javascript
// API development sandbox
mcp__flow-nexus__sandbox_create({
template: "node",
name: "api-dev",
install_packages: ["express", "cors", "dotenv"],
startup_script: "npm run dev"
})
// ML sandbox
mcp__flow-nexus__sandbox_create({
template: "python",
name: "ml-training",
install_packages: ["numpy", "pandas", "scikit-learn"]
})
```
@@ -0,0 +1,87 @@
---
name: flow-nexus-swarm
description: AI swarm deployment and coordination in cloud
---
# Flow Nexus Swarms
Deploy and manage AI agent swarms in the cloud.
## Initialize Swarm
```javascript
mcp__flow-nexus__swarm_init({
topology: "hierarchical", // mesh, ring, star, hierarchical
maxAgents: 8,
strategy: "balanced" // balanced, specialized, adaptive
})
```
## Spawn Agents
```javascript
mcp__flow-nexus__agent_spawn({
type: "researcher", // coder, analyst, optimizer, coordinator
name: "Lead Researcher",
capabilities: ["web_search", "analysis", "summarization"]
})
```
## Orchestrate Tasks
```javascript
mcp__flow-nexus__task_orchestrate({
task: "Build a REST API with authentication",
strategy: "parallel", // parallel, sequential, adaptive
maxAgents: 5,
priority: "high"
})
```
## Monitor Swarm
```javascript
// Get swarm status
mcp__flow-nexus__swarm_status()
// List active swarms
mcp__flow-nexus__swarm_list({ status: "active" })
// Scale swarm
mcp__flow-nexus__swarm_scale({ target_agents: 10 })
// Destroy swarm
mcp__flow-nexus__swarm_destroy({ swarm_id: "id" })
```
## Templates
```javascript
// Use pre-built swarm template
mcp__flow-nexus__swarm_create_from_template({
template_name: "full-stack-dev",
overrides: {
maxAgents: 6,
strategy: "specialized"
}
})
// List available templates
mcp__flow-nexus__swarm_templates_list({
category: "quickstart" // specialized, enterprise, custom
})
```
## Common Swarm Patterns
### Research Swarm
```javascript
mcp__flow-nexus__swarm_init({ topology: "mesh", maxAgents: 5 })
mcp__flow-nexus__agent_spawn({ type: "researcher", name: "Lead" })
mcp__flow-nexus__agent_spawn({ type: "analyst", name: "Data Analyst" })
mcp__flow-nexus__task_orchestrate({ task: "Research ML trends" })
```
### Development Swarm
```javascript
mcp__flow-nexus__swarm_init({ topology: "hierarchical", maxAgents: 8 })
mcp__flow-nexus__agent_spawn({ type: "coordinator", name: "PM" })
mcp__flow-nexus__agent_spawn({ type: "coder", name: "Backend Dev" })
mcp__flow-nexus__agent_spawn({ type: "coder", name: "Frontend Dev" })
mcp__flow-nexus__task_orchestrate({ task: "Build e-commerce platform" })
```
@@ -0,0 +1,152 @@
---
name: flow-nexus-user-tools
description: User management, storage, and system utilities
---
# Flow Nexus User Tools
Utilities for user management, storage, and system operations.
## Profile Management
```javascript
// Get profile
mcp__flow-nexus__user_profile({
user_id: "your_id"
})
// Update profile
mcp__flow-nexus__user_update_profile({
user_id: "your_id",
updates: {
full_name: "New Name",
bio: "Developer interested in AI",
github_username: "username"
}
})
// Get statistics
mcp__flow-nexus__user_stats({
user_id: "your_id"
})
```
## Storage Management
```javascript
// Upload file
mcp__flow-nexus__storage_upload({
bucket: "my-bucket",
path: "data/file.json",
content: JSON.stringify(data),
content_type: "application/json"
})
// List files
mcp__flow-nexus__storage_list({
bucket: "my-bucket",
path: "data/",
limit: 100
})
// Get public URL
mcp__flow-nexus__storage_get_url({
bucket: "my-bucket",
path: "data/file.json",
expires_in: 3600 // seconds
})
// Delete file
mcp__flow-nexus__storage_delete({
bucket: "my-bucket",
path: "data/file.json"
})
```
## Real-time Subscriptions
```javascript
// Subscribe to database changes
mcp__flow-nexus__realtime_subscribe({
table: "tasks",
event: "INSERT", // UPDATE, DELETE, *
filter: "status=eq.pending"
})
// List subscriptions
mcp__flow-nexus__realtime_list()
// Unsubscribe
mcp__flow-nexus__realtime_unsubscribe({
subscription_id: "sub_id"
})
```
## Execution Monitoring
```javascript
// Monitor execution stream
mcp__flow-nexus__execution_stream_subscribe({
stream_type: "claude-flow-swarm",
deployment_id: "deployment_id"
})
// Get stream status
mcp__flow-nexus__execution_stream_status({
stream_id: "stream_id"
})
// List generated files
mcp__flow-nexus__execution_files_list({
stream_id: "stream_id",
created_by: "claude-flow",
file_type: "javascript"
})
// Get file content
mcp__flow-nexus__execution_file_get({
file_id: "file_id"
})
```
## System Health
```javascript
// Check system health
mcp__flow-nexus__system_health()
// View audit logs
mcp__flow-nexus__audit_log({
user_id: "your_id",
limit: 100
})
```
## Queen Seraphina Chat
```javascript
// Seek guidance from Queen Seraphina
mcp__flow-nexus__seraphina_chat({
message: "How should I architect my distributed system?",
enable_tools: true, // Allow her to create swarms/deploy code
conversation_history: [
{ role: "user", content: "Previous message" },
{ role: "assistant", content: "Previous response" }
]
})
```
## Email Verification
```javascript
mcp__flow-nexus__user_verify_email({
token: "verification_token_from_email"
})
```
## Storage Buckets
- **public**: Publicly accessible files
- **private**: User-only access
- **shared**: Team collaboration
- **temp**: Auto-deleted after 24h
## Best Practices
1. Use appropriate storage buckets
2. Set expiration on temporary URLs
3. Monitor real-time subscriptions
4. Clean up unused subscriptions
5. Regular audit log reviews
6. Enable 2FA for security (coming soon)
@@ -0,0 +1,115 @@
---
name: flow-nexus-workflow
description: Event-driven workflow automation with message queues
---
# Flow Nexus Workflows
Create and manage automated workflows with event-driven processing.
## Create Workflow
```javascript
mcp__flow-nexus__workflow_create({
name: "CI/CD Pipeline",
description: "Automated testing and deployment",
steps: [
{ id: "test", action: "run_tests", agent: "tester" },
{ id: "build", action: "build_app", agent: "builder" },
{ id: "deploy", action: "deploy_prod", agent: "deployer" }
],
triggers: ["push_to_main", "manual_trigger"]
})
```
## Execute Workflow
```javascript
mcp__flow-nexus__workflow_execute({
workflow_id: "workflow_id",
input_data: {
branch: "main",
commit: "abc123"
},
async: true // Execute via message queue
})
```
## Monitor Workflows
```javascript
// Get workflow status
mcp__flow-nexus__workflow_status({
workflow_id: "id",
include_metrics: true
})
// List workflows
mcp__flow-nexus__workflow_list({
status: "running",
limit: 10
})
// Get audit trail
mcp__flow-nexus__workflow_audit_trail({
workflow_id: "id",
limit: 50
})
```
## Agent Assignment
```javascript
mcp__flow-nexus__workflow_agent_assign({
task_id: "task_id",
agent_type: "coder",
use_vector_similarity: true // AI-powered matching
})
```
## Queue Management
```javascript
mcp__flow-nexus__workflow_queue_status({
include_messages: true
})
```
## Common Workflow Patterns
### CI/CD Pipeline
```javascript
mcp__flow-nexus__workflow_create({
name: "Deploy Pipeline",
steps: [
{ action: "lint", parallel: true },
{ action: "test", parallel: true },
{ action: "build", depends_on: ["lint", "test"] },
{ action: "deploy", depends_on: ["build"] }
],
triggers: ["github_push"]
})
```
### Data Processing
```javascript
mcp__flow-nexus__workflow_create({
name: "ETL Pipeline",
steps: [
{ action: "extract_data", agent: "data_extractor" },
{ action: "transform_data", agent: "transformer" },
{ action: "load_data", agent: "loader" },
{ action: "validate", agent: "validator" }
],
triggers: ["schedule:0 2 * * *"] // Daily at 2 AM
})
```
### Multi-Stage Review
```javascript
mcp__flow-nexus__workflow_create({
name: "PR Review",
steps: [
{ action: "code_analysis", agent: "analyzer" },
{ action: "security_scan", agent: "security" },
{ action: "performance_test", agent: "perf_tester" },
{ action: "approve_merge", agent: "reviewer" }
],
metadata: { priority: 10 }
})
```
@@ -0,0 +1,11 @@
# Github Commands
Commands for github operations in Claude Flow.
## Available Commands
- [github-swarm](./github-swarm.md)
- [repo-analyze](./repo-analyze.md)
- [pr-enhance](./pr-enhance.md)
- [issue-triage](./issue-triage.md)
- [code-review](./code-review.md)
@@ -0,0 +1,514 @@
# Code Review Swarm - Automated Code Review with AI Agents
## Overview
Deploy specialized AI agents to perform comprehensive, intelligent code reviews that go beyond traditional static analysis.
## Core Features
### 1. Multi-Agent Review System
```bash
# Initialize code review swarm with gh CLI
# Get PR details
PR_DATA=$(gh pr view 123 --json files,additions,deletions,title,body)
PR_DIFF=$(gh pr diff 123)
# Initialize swarm with PR context
npx ruv-swarm github review-init \
--pr 123 \
--pr-data "$PR_DATA" \
--diff "$PR_DIFF" \
--agents "security,performance,style,architecture,accessibility" \
--depth comprehensive
# Post initial review status
gh pr comment 123 --body "🔍 Multi-agent code review initiated"
```
### 2. Specialized Review Agents
#### Security Agent
```bash
# Security-focused review with gh CLI
# Get changed files
CHANGED_FILES=$(gh pr view 123 --json files --jq '.files[].path')
# Run security review
SECURITY_RESULTS=$(npx ruv-swarm github review-security \
--pr 123 \
--files "$CHANGED_FILES" \
--check "owasp,cve,secrets,permissions" \
--suggest-fixes)
# Post security findings
if echo "$SECURITY_RESULTS" | grep -q "critical"; then
# Request changes for critical issues
gh pr review 123 --request-changes --body "$SECURITY_RESULTS"
# Add security label
gh pr edit 123 --add-label "security-review-required"
else
# Post as comment for non-critical issues
gh pr comment 123 --body "$SECURITY_RESULTS"
fi
```
#### Performance Agent
```bash
# Performance analysis
npx ruv-swarm github review-performance \
--pr 123 \
--profile "cpu,memory,io" \
--benchmark-against main \
--suggest-optimizations
```
#### Architecture Agent
```bash
# Architecture review
npx ruv-swarm github review-architecture \
--pr 123 \
--check "patterns,coupling,cohesion,solid" \
--visualize-impact \
--suggest-refactoring
```
### 3. Review Configuration
```yaml
# .github/review-swarm.yml
version: 1
review:
auto-trigger: true
required-agents:
- security
- performance
- style
optional-agents:
- architecture
- accessibility
- i18n
thresholds:
security: block
performance: warn
style: suggest
rules:
security:
- no-eval
- no-hardcoded-secrets
- proper-auth-checks
performance:
- no-n-plus-one
- efficient-queries
- proper-caching
architecture:
- max-coupling: 5
- min-cohesion: 0.7
- follow-patterns
```
## Review Agents
### Security Review Agent
```javascript
// Security checks performed
{
"checks": [
"SQL injection vulnerabilities",
"XSS attack vectors",
"Authentication bypasses",
"Authorization flaws",
"Cryptographic weaknesses",
"Dependency vulnerabilities",
"Secret exposure",
"CORS misconfigurations"
],
"actions": [
"Block PR on critical issues",
"Suggest secure alternatives",
"Add security test cases",
"Update security documentation"
]
}
```
### Performance Review Agent
```javascript
// Performance analysis
{
"metrics": [
"Algorithm complexity",
"Database query efficiency",
"Memory allocation patterns",
"Cache utilization",
"Network request optimization",
"Bundle size impact",
"Render performance"
],
"benchmarks": [
"Compare with baseline",
"Load test simulations",
"Memory leak detection",
"Bottleneck identification"
]
}
```
### Style & Convention Agent
```javascript
// Style enforcement
{
"checks": [
"Code formatting",
"Naming conventions",
"Documentation standards",
"Comment quality",
"Test coverage",
"Error handling patterns",
"Logging standards"
],
"auto-fix": [
"Formatting issues",
"Import organization",
"Trailing whitespace",
"Simple naming issues"
]
}
```
### Architecture Review Agent
```javascript
// Architecture analysis
{
"patterns": [
"Design pattern adherence",
"SOLID principles",
"DRY violations",
"Separation of concerns",
"Dependency injection",
"Layer violations",
"Circular dependencies"
],
"metrics": [
"Coupling metrics",
"Cohesion scores",
"Complexity measures",
"Maintainability index"
]
}
```
## Advanced Review Features
### 1. Context-Aware Reviews
```bash
# Review with full context
npx ruv-swarm github review-context \
--pr 123 \
--load-related-prs \
--analyze-impact \
--check-breaking-changes
```
### 2. Learning from History
```bash
# Learn from past reviews
npx ruv-swarm github review-learn \
--analyze-past-reviews \
--identify-patterns \
--improve-suggestions \
--reduce-false-positives
```
### 3. Cross-PR Analysis
```bash
# Analyze related PRs together
npx ruv-swarm github review-batch \
--prs "123,124,125" \
--check-consistency \
--verify-integration \
--combined-impact
```
## Review Automation
### Auto-Review on Push
```yaml
# .github/workflows/auto-review.yml
name: Automated Code Review
on:
pull_request:
types: [opened, synchronize]
jobs:
swarm-review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup GitHub CLI
run: echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
- name: Run Review Swarm
run: |
# Get PR context with gh CLI
PR_NUM=${{ github.event.pull_request.number }}
PR_DATA=$(gh pr view $PR_NUM --json files,title,body,labels)
# Run swarm review
REVIEW_OUTPUT=$(npx ruv-swarm github review-all \
--pr $PR_NUM \
--pr-data "$PR_DATA" \
--agents "security,performance,style,architecture")
# Post review results
echo "$REVIEW_OUTPUT" | gh pr review $PR_NUM --comment -F -
# Update PR status
if echo "$REVIEW_OUTPUT" | grep -q "approved"; then
gh pr review $PR_NUM --approve
elif echo "$REVIEW_OUTPUT" | grep -q "changes-requested"; then
gh pr review $PR_NUM --request-changes -b "See review comments above"
fi
```
### Review Triggers
```javascript
// Custom review triggers
{
"triggers": {
"high-risk-files": {
"paths": ["**/auth/**", "**/payment/**"],
"agents": ["security", "architecture"],
"depth": "comprehensive"
},
"performance-critical": {
"paths": ["**/api/**", "**/database/**"],
"agents": ["performance", "database"],
"benchmarks": true
},
"ui-changes": {
"paths": ["**/components/**", "**/styles/**"],
"agents": ["accessibility", "style", "i18n"],
"visual-tests": true
}
}
}
```
## Review Comments
### Intelligent Comment Generation
```bash
# Generate contextual review comments with gh CLI
# Get PR diff with context
PR_DIFF=$(gh pr diff 123 --color never)
PR_FILES=$(gh pr view 123 --json files)
# Generate review comments
COMMENTS=$(npx ruv-swarm github review-comment \
--pr 123 \
--diff "$PR_DIFF" \
--files "$PR_FILES" \
--style "constructive" \
--include-examples \
--suggest-fixes)
# Post comments using gh CLI
echo "$COMMENTS" | jq -c '.[]' | while read -r comment; do
FILE=$(echo "$comment" | jq -r '.path')
LINE=$(echo "$comment" | jq -r '.line')
BODY=$(echo "$comment" | jq -r '.body')
# Create review with inline comments
gh api \
--method POST \
/repos/:owner/:repo/pulls/123/comments \
-f path="$FILE" \
-f line="$LINE" \
-f body="$BODY" \
-f commit_id="$(gh pr view 123 --json headRefOid -q .headRefOid)"
done
```
### Comment Templates
```markdown
<!-- Security Issue Template -->
🔒 **Security Issue: [Type]**
**Severity**: 🔴 Critical / 🟡 High / 🟢 Low
**Description**:
[Clear explanation of the security issue]
**Impact**:
[Potential consequences if not addressed]
**Suggested Fix**:
```language
[Code example of the fix]
```
**References**:
- [OWASP Guide](link)
- [Security Best Practices](link)
```
### Batch Comment Management
```bash
# Manage review comments efficiently
npx ruv-swarm github review-comments \
--pr 123 \
--group-by "agent,severity" \
--summarize \
--resolve-outdated
```
## Integration with CI/CD
### Status Checks
```yaml
# Required status checks
protection_rules:
required_status_checks:
contexts:
- "review-swarm/security"
- "review-swarm/performance"
- "review-swarm/architecture"
```
### Quality Gates
```bash
# Define quality gates
npx ruv-swarm github quality-gates \
--define '{
"security": {"threshold": "no-critical"},
"performance": {"regression": "<5%"},
"coverage": {"minimum": "80%"},
"architecture": {"complexity": "<10"}
}'
```
### Review Metrics
```bash
# Track review effectiveness
npx ruv-swarm github review-metrics \
--period 30d \
--metrics "issues-found,false-positives,fix-rate" \
--export-dashboard
```
## Best Practices
### 1. Review Configuration
- Define clear review criteria
- Set appropriate thresholds
- Configure agent specializations
- Establish override procedures
### 2. Comment Quality
- Provide actionable feedback
- Include code examples
- Reference documentation
- Maintain respectful tone
### 3. Performance
- Cache analysis results
- Incremental reviews for large PRs
- Parallel agent execution
- Smart comment batching
## Advanced Features
### 1. AI Learning
```bash
# Train on your codebase
npx ruv-swarm github review-train \
--learn-patterns \
--adapt-to-style \
--improve-accuracy
```
### 2. Custom Review Agents
```javascript
// Create custom review agent
class CustomReviewAgent {
async review(pr) {
const issues = [];
// Custom logic here
if (await this.checkCustomRule(pr)) {
issues.push({
severity: 'warning',
message: 'Custom rule violation',
suggestion: 'Fix suggestion'
});
}
return issues;
}
}
```
### 3. Review Orchestration
```bash
# Orchestrate complex reviews
npx ruv-swarm github review-orchestrate \
--strategy "risk-based" \
--allocate-time-budget \
--prioritize-critical
```
## Examples
### Security-Critical PR
```bash
# Auth system changes
npx ruv-swarm github review-init \
--pr 456 \
--agents "security,authentication,audit" \
--depth "maximum" \
--require-security-approval
```
### Performance-Sensitive PR
```bash
# Database optimization
npx ruv-swarm github review-init \
--pr 789 \
--agents "performance,database,caching" \
--benchmark \
--profile
```
### UI Component PR
```bash
# New component library
npx ruv-swarm github review-init \
--pr 321 \
--agents "accessibility,style,i18n,docs" \
--visual-regression \
--component-tests
```
## Monitoring & Analytics
### Review Dashboard
```bash
# Launch review dashboard
npx ruv-swarm github review-dashboard \
--real-time \
--show "agent-activity,issue-trends,fix-rates"
```
### Review Reports
```bash
# Generate review reports
npx ruv-swarm github review-report \
--format "markdown" \
--include "summary,details,trends" \
--email-stakeholders
```
See also: [swarm-pr.md](./swarm-pr.md), [workflow-automation.md](./workflow-automation.md)
@@ -0,0 +1,25 @@
# code-review
Automated code review with swarm intelligence.
## Usage
```bash
npx claude-flow github code-review [options]
```
## Options
- `--pr-number <n>` - Pull request to review
- `--focus <areas>` - Review focus (security, performance, style)
- `--suggest-fixes` - Suggest code fixes
## Examples
```bash
# Review PR
npx claude-flow github code-review --pr-number 456
# Security focus
npx claude-flow github code-review --pr-number 456 --focus security
# With fix suggestions
npx claude-flow github code-review --pr-number 456 --suggest-fixes
```
@@ -0,0 +1,147 @@
# GitHub Integration Modes
## Overview
This document describes all GitHub integration modes available in Claude-Flow with ruv-swarm coordination. Each mode is optimized for specific GitHub workflows and includes batch tool integration for maximum efficiency.
## GitHub Workflow Modes
### gh-coordinator
**GitHub workflow orchestration and coordination**
- **Coordination Mode**: Hierarchical
- **Max Parallel Operations**: 10
- **Batch Optimized**: Yes
- **Tools**: gh CLI commands, TodoWrite, TodoRead, Task, Memory, Bash
- **Usage**: `/github gh-coordinator <GitHub workflow description>`
- **Best For**: Complex GitHub workflows, multi-repo coordination
### pr-manager
**Pull request management and review coordination**
- **Review Mode**: Automated
- **Multi-reviewer**: Yes
- **Conflict Resolution**: Intelligent
- **Tools**: gh pr create, gh pr view, gh pr review, gh pr merge, TodoWrite, Task
- **Usage**: `/github pr-manager <PR management task>`
- **Best For**: PR reviews, merge coordination, conflict resolution
### issue-tracker
**Issue management and project coordination**
- **Issue Workflow**: Automated
- **Label Management**: Smart
- **Progress Tracking**: Real-time
- **Tools**: gh issue create, gh issue edit, gh issue comment, gh issue list, TodoWrite
- **Usage**: `/github issue-tracker <issue management task>`
- **Best For**: Project management, issue coordination, progress tracking
### release-manager
**Release coordination and deployment**
- **Release Pipeline**: Automated
- **Versioning**: Semantic
- **Deployment**: Multi-stage
- **Tools**: gh pr create, gh pr merge, gh release create, Bash, TodoWrite
- **Usage**: `/github release-manager <release task>`
- **Best For**: Release management, version coordination, deployment pipelines
## Repository Management Modes
### repo-architect
**Repository structure and organization**
- **Structure Optimization**: Yes
- **Multi-repo**: Support
- **Template Management**: Advanced
- **Tools**: gh repo create, gh repo clone, git commands, Write, Read, Bash
- **Usage**: `/github repo-architect <repository management task>`
- **Best For**: Repository setup, structure optimization, multi-repo management
### code-reviewer
**Automated code review and quality assurance**
- **Review Quality**: Deep
- **Security Analysis**: Yes
- **Performance Check**: Automated
- **Tools**: gh pr view --json files, gh pr review, gh pr comment, Read, Write
- **Usage**: `/github code-reviewer <review task>`
- **Best For**: Code quality, security reviews, performance analysis
### branch-manager
**Branch management and workflow coordination**
- **Branch Strategy**: GitFlow
- **Merge Strategy**: Intelligent
- **Conflict Prevention**: Proactive
- **Tools**: gh api (for branch operations), git commands, Bash
- **Usage**: `/github branch-manager <branch management task>`
- **Best For**: Branch coordination, merge strategies, workflow management
## Integration Commands
### sync-coordinator
**Multi-package synchronization**
- **Package Sync**: Intelligent
- **Version Alignment**: Automatic
- **Dependency Resolution**: Advanced
- **Tools**: git commands, gh pr create, Read, Write, Bash
- **Usage**: `/github sync-coordinator <sync task>`
- **Best For**: Package synchronization, version management, dependency updates
### ci-orchestrator
**CI/CD pipeline coordination**
- **Pipeline Management**: Advanced
- **Test Coordination**: Parallel
- **Deployment**: Automated
- **Tools**: gh pr checks, gh workflow list, gh run list, Bash, TodoWrite, Task
- **Usage**: `/github ci-orchestrator <CI/CD task>`
- **Best For**: CI/CD coordination, test management, deployment automation
### security-guardian
**Security and compliance management**
- **Security Scan**: Automated
- **Compliance Check**: Continuous
- **Vulnerability Management**: Proactive
- **Tools**: gh search code, gh issue create, gh secret list, Read, Write
- **Usage**: `/github security-guardian <security task>`
- **Best For**: Security audits, compliance checks, vulnerability management
## Usage Examples
### Creating a coordinated pull request workflow:
```bash
/github pr-manager "Review and merge feature/new-integration branch with automated testing and multi-reviewer coordination"
```
### Managing repository synchronization:
```bash
/github sync-coordinator "Synchronize claude-code-flow and ruv-swarm packages, align versions, and update cross-dependencies"
```
### Setting up automated issue tracking:
```bash
/github issue-tracker "Create and manage integration issues with automated progress tracking and swarm coordination"
```
## Batch Operations
All GitHub modes support batch operations for maximum efficiency:
### Parallel GitHub Operations Example:
```javascript
[Single Message with BatchTool]:
Bash("gh issue create --title 'Feature A' --body '...'")
Bash("gh issue create --title 'Feature B' --body '...'")
Bash("gh pr create --title 'PR 1' --head 'feature-a' --base 'main'")
Bash("gh pr create --title 'PR 2' --head 'feature-b' --base 'main'")
TodoWrite { todos: [todo1, todo2, todo3] }
Bash("git checkout main && git pull")
```
## Integration with ruv-swarm
All GitHub modes can be enhanced with ruv-swarm coordination:
```javascript
// Initialize swarm for GitHub workflow
mcp__claude-flow__swarm_init { topology: "hierarchical", maxAgents: 5 }
mcp__claude-flow__agent_spawn { type: "coordinator", name: "GitHub Coordinator" }
mcp__claude-flow__agent_spawn { type: "reviewer", name: "Code Reviewer" }
mcp__claude-flow__agent_spawn { type: "tester", name: "QA Agent" }
// Execute GitHub workflow with coordination
mcp__claude-flow__task_orchestrate { task: "GitHub workflow", strategy: "parallel" }
```
@@ -0,0 +1,121 @@
# github swarm
Create a specialized swarm for GitHub repository management.
## Usage
```bash
npx claude-flow github swarm [options]
```
## Options
- `--repository, -r <owner/repo>` - Target GitHub repository
- `--agents, -a <number>` - Number of specialized agents (default: 5)
- `--focus, -f <type>` - Focus area: maintenance, development, review, triage
- `--auto-pr` - Enable automatic pull request enhancements
- `--issue-labels` - Auto-categorize and label issues
- `--code-review` - Enable AI-powered code reviews
## Examples
### Basic GitHub swarm
```bash
npx claude-flow github swarm --repository owner/repo
```
### Maintenance-focused swarm
```bash
npx claude-flow github swarm -r owner/repo -f maintenance --issue-labels
```
### Development swarm with PR automation
```bash
npx claude-flow github swarm -r owner/repo -f development --auto-pr --code-review
```
### Full-featured triage swarm
```bash
npx claude-flow github swarm -r owner/repo -a 8 -f triage --issue-labels --auto-pr
```
## Agent Types
### Issue Triager
- Analyzes and categorizes issues
- Suggests labels and priorities
- Identifies duplicates and related issues
### PR Reviewer
- Reviews code changes
- Suggests improvements
- Checks for best practices
### Documentation Agent
- Updates README files
- Creates API documentation
- Maintains changelog
### Test Agent
- Identifies missing tests
- Suggests test cases
- Validates test coverage
### Security Agent
- Scans for vulnerabilities
- Reviews dependencies
- Suggests security improvements
## Workflows
### Issue Triage Workflow
1. Scan all open issues
2. Categorize by type and priority
3. Apply appropriate labels
4. Suggest assignees
5. Link related issues
### PR Enhancement Workflow
1. Analyze PR changes
2. Suggest missing tests
3. Improve documentation
4. Format code consistently
5. Add helpful comments
### Repository Health Check
1. Analyze code quality metrics
2. Review dependency status
3. Check test coverage
4. Assess documentation completeness
5. Generate health report
## Integration with Claude Code
Use in Claude Code with MCP tools:
```javascript
mcp__claude-flow__github_swarm {
repository: "owner/repo",
agents: 6,
focus: "maintenance"
}
```
## See Also
- `repo analyze` - Deep repository analysis
- `pr enhance` - Enhance pull requests
- `issue triage` - Intelligent issue management
- `code review` - Automated reviews
@@ -0,0 +1,292 @@
# GitHub Issue Tracker
## Purpose
Intelligent issue management and project coordination with ruv-swarm integration for automated tracking, progress monitoring, and team coordination.
## Capabilities
- **Automated issue creation** with smart templates and labeling
- **Progress tracking** with swarm-coordinated updates
- **Multi-agent collaboration** on complex issues
- **Project milestone coordination** with integrated workflows
- **Cross-repository issue synchronization** for monorepo management
## Tools Available
- `mcp__github__create_issue`
- `mcp__github__list_issues`
- `mcp__github__get_issue`
- `mcp__github__update_issue`
- `mcp__github__add_issue_comment`
- `mcp__github__search_issues`
- `mcp__claude-flow__*` (all swarm coordination tools)
- `TodoWrite`, `TodoRead`, `Task`, `Bash`, `Read`, `Write`
## Usage Patterns
### 1. Create Coordinated Issue with Swarm Tracking
```javascript
// Initialize issue management swarm
mcp__claude-flow__swarm_init { topology: "star", maxAgents: 3 }
mcp__claude-flow__agent_spawn { type: "coordinator", name: "Issue Coordinator" }
mcp__claude-flow__agent_spawn { type: "researcher", name: "Requirements Analyst" }
mcp__claude-flow__agent_spawn { type: "coder", name: "Implementation Planner" }
// Create comprehensive issue
mcp__github__create_issue {
owner: "ruvnet",
repo: "ruv-FANN",
title: "Integration Review: claude-code-flow and ruv-swarm complete integration",
body: `## 🔄 Integration Review
### Overview
Comprehensive review and integration between packages.
### Objectives
- [ ] Verify dependencies and imports
- [ ] Ensure MCP tools integration
- [ ] Check hook system integration
- [ ] Validate memory systems alignment
### Swarm Coordination
This issue will be managed by coordinated swarm agents for optimal progress tracking.`,
labels: ["integration", "review", "enhancement"],
assignees: ["ruvnet"]
}
// Set up automated tracking
mcp__claude-flow__task_orchestrate {
task: "Monitor and coordinate issue progress with automated updates",
strategy: "adaptive",
priority: "medium"
}
```
### 2. Automated Progress Updates
```javascript
// Update issue with progress from swarm memory
mcp__claude-flow__memory_usage {
action: "retrieve",
key: "issue/54/progress"
}
// Add coordinated progress comment
mcp__github__add_issue_comment {
owner: "ruvnet",
repo: "ruv-FANN",
issue_number: 54,
body: `## 🚀 Progress Update
### Completed Tasks
- ✅ Architecture review completed (agent-1751574161764)
- ✅ Dependency analysis finished (agent-1751574162044)
- ✅ Integration testing verified (agent-1751574162300)
### Current Status
- 🔄 Documentation review in progress
- 📊 Integration score: 89% (Excellent)
### Next Steps
- Final validation and merge preparation
---
🤖 Generated with Claude Code using ruv-swarm coordination`
}
// Store progress in swarm memory
mcp__claude-flow__memory_usage {
action: "store",
key: "issue/54/latest_update",
value: { timestamp: Date.now(), progress: "89%", status: "near_completion" }
}
```
### 3. Multi-Issue Project Coordination
```javascript
// Search and coordinate related issues
mcp__github__search_issues {
q: "repo:ruvnet/ruv-FANN label:integration state:open",
sort: "created",
order: "desc"
}
// Create coordinated issue updates
mcp__github__update_issue {
owner: "ruvnet",
repo: "ruv-FANN",
issue_number: 54,
state: "open",
labels: ["integration", "review", "enhancement", "in-progress"],
milestone: 1
}
```
## Batch Operations Example
### Complete Issue Management Workflow:
```javascript
[Single Message - Issue Lifecycle Management]:
// Initialize issue coordination swarm
mcp__claude-flow__swarm_init { topology: "mesh", maxAgents: 4 }
mcp__claude-flow__agent_spawn { type: "coordinator", name: "Issue Manager" }
mcp__claude-flow__agent_spawn { type: "analyst", name: "Progress Tracker" }
mcp__claude-flow__agent_spawn { type: "researcher", name: "Context Gatherer" }
// Create multiple related issues using gh CLI
Bash(`gh issue create \
--repo :owner/:repo \
--title "Feature: Advanced GitHub Integration" \
--body "Implement comprehensive GitHub workflow automation..." \
--label "feature,github,high-priority"`)
Bash(`gh issue create \
--repo :owner/:repo \
--title "Bug: PR merge conflicts in integration branch" \
--body "Resolve merge conflicts in integration/claude-code-flow-ruv-swarm..." \
--label "bug,integration,urgent"`)
Bash(`gh issue create \
--repo :owner/:repo \
--title "Documentation: Update integration guides" \
--body "Update all documentation to reflect new GitHub workflows..." \
--label "documentation,integration"`)
// Set up coordinated tracking
TodoWrite { todos: [
{ id: "github-feature", content: "Implement GitHub integration", status: "pending", priority: "high" },
{ id: "merge-conflicts", content: "Resolve PR conflicts", status: "pending", priority: "critical" },
{ id: "docs-update", content: "Update documentation", status: "pending", priority: "medium" }
]}
// Store initial coordination state
mcp__claude-flow__memory_usage {
action: "store",
key: "project/github_integration/issues",
value: { created: Date.now(), total_issues: 3, status: "initialized" }
}
```
## Smart Issue Templates
### Integration Issue Template:
```markdown
## 🔄 Integration Task
### Overview
[Brief description of integration requirements]
### Objectives
- [ ] Component A integration
- [ ] Component B validation
- [ ] Testing and verification
- [ ] Documentation updates
### Integration Areas
#### Dependencies
- [ ] Package.json updates
- [ ] Version compatibility
- [ ] Import statements
#### Functionality
- [ ] Core feature integration
- [ ] API compatibility
- [ ] Performance validation
#### Testing
- [ ] Unit tests
- [ ] Integration tests
- [ ] End-to-end validation
### Swarm Coordination
- **Coordinator**: Overall progress tracking
- **Analyst**: Technical validation
- **Tester**: Quality assurance
- **Documenter**: Documentation updates
### Progress Tracking
Updates will be posted automatically by swarm agents during implementation.
---
🤖 Generated with Claude Code
```
### Bug Report Template:
```markdown
## 🐛 Bug Report
### Problem Description
[Clear description of the issue]
### Expected Behavior
[What should happen]
### Actual Behavior
[What actually happens]
### Reproduction Steps
1. [Step 1]
2. [Step 2]
3. [Step 3]
### Environment
- Package: [package name and version]
- Node.js: [version]
- OS: [operating system]
### Investigation Plan
- [ ] Root cause analysis
- [ ] Fix implementation
- [ ] Testing and validation
- [ ] Regression testing
### Swarm Assignment
- **Debugger**: Issue investigation
- **Coder**: Fix implementation
- **Tester**: Validation and testing
---
🤖 Generated with Claude Code
```
## Best Practices
### 1. **Swarm-Coordinated Issue Management**
- Always initialize swarm for complex issues
- Assign specialized agents based on issue type
- Use memory for progress coordination
### 2. **Automated Progress Tracking**
- Regular automated updates with swarm coordination
- Progress metrics and completion tracking
- Cross-issue dependency management
### 3. **Smart Labeling and Organization**
- Consistent labeling strategy across repositories
- Priority-based issue sorting and assignment
- Milestone integration for project coordination
### 4. **Batch Issue Operations**
- Create multiple related issues simultaneously
- Bulk updates for project-wide changes
- Coordinated cross-repository issue management
## Integration with Other Modes
### Seamless integration with:
- `/github pr-manager` - Link issues to pull requests
- `/github release-manager` - Coordinate release issues
- `/sparc orchestrator` - Complex project coordination
- `/sparc tester` - Automated testing workflows
## Metrics and Analytics
### Automatic tracking of:
- Issue creation and resolution times
- Agent productivity metrics
- Project milestone progress
- Cross-repository coordination efficiency
### Reporting features:
- Weekly progress summaries
- Agent performance analytics
- Project health metrics
- Integration success rates
@@ -0,0 +1,25 @@
# issue-triage
Intelligent issue classification and triage.
## Usage
```bash
npx claude-flow github issue-triage [options]
```
## Options
- `--repository <owner/repo>` - Target repository
- `--auto-label` - Automatically apply labels
- `--assign` - Auto-assign to team members
## Examples
```bash
# Triage issues
npx claude-flow github issue-triage --repository myorg/myrepo
# With auto-labeling
npx claude-flow github issue-triage --repository myorg/myrepo --auto-label
# Full automation
npx claude-flow github issue-triage --repository myorg/myrepo --auto-label --assign
```
@@ -0,0 +1,519 @@
# Multi-Repo Swarm - Cross-Repository Swarm Orchestration
## Overview
Coordinate AI swarms across multiple repositories, enabling organization-wide automation and intelligent cross-project collaboration.
## Core Features
### 1. Cross-Repo Initialization
```bash
# Initialize multi-repo swarm with gh CLI
# List organization repositories
REPOS=$(gh repo list org --limit 100 --json name,description,languages \
--jq '.[] | select(.name | test("frontend|backend|shared"))')
# Get repository details
REPO_DETAILS=$(echo "$REPOS" | jq -r '.name' | while read -r repo; do
gh api repos/org/$repo --jq '{name, default_branch, languages, topics}'
done | jq -s '.')
# Initialize swarm with repository context
npx ruv-swarm github multi-repo-init \
--repo-details "$REPO_DETAILS" \
--repos "org/frontend,org/backend,org/shared" \
--topology hierarchical \
--shared-memory \
--sync-strategy eventual
```
### 2. Repository Discovery
```bash
# Auto-discover related repositories with gh CLI
# Search organization repositories
REPOS=$(gh repo list my-organization --limit 100 \
--json name,description,languages,topics \
--jq '.[] | select(.languages | keys | contains(["TypeScript"]))')
# Analyze repository dependencies
DEPS=$(echo "$REPOS" | jq -r '.name' | while read -r repo; do
# Get package.json if it exists
if gh api repos/my-organization/$repo/contents/package.json --jq '.content' 2>/dev/null; then
gh api repos/my-organization/$repo/contents/package.json \
--jq '.content' | base64 -d | jq '{name, dependencies, devDependencies}'
fi
done | jq -s '.')
# Discover and analyze
npx ruv-swarm github discover-repos \
--repos "$REPOS" \
--dependencies "$DEPS" \
--analyze-dependencies \
--suggest-swarm-topology
```
### 3. Synchronized Operations
```bash
# Execute synchronized changes across repos with gh CLI
# Get matching repositories
MATCHING_REPOS=$(gh repo list org --limit 100 --json name \
--jq '.[] | select(.name | test("-service$")) | .name')
# Execute task and create PRs
echo "$MATCHING_REPOS" | while read -r repo; do
# Clone repo
gh repo clone org/$repo /tmp/$repo -- --depth=1
# Execute task
cd /tmp/$repo
npx ruv-swarm github task-execute \
--task "update-dependencies" \
--repo "org/$repo"
# Create PR if changes exist
if [[ -n $(git status --porcelain) ]]; then
git checkout -b update-dependencies-$(date +%Y%m%d)
git add -A
git commit -m "chore: Update dependencies"
# Push and create PR
git push origin HEAD
PR_URL=$(gh pr create \
--title "Update dependencies" \
--body "Automated dependency update across services" \
--label "dependencies,automated")
echo "$PR_URL" >> /tmp/created-prs.txt
fi
cd -
done
# Link related PRs
PR_URLS=$(cat /tmp/created-prs.txt)
npx ruv-swarm github link-prs --urls "$PR_URLS"
```
## Configuration
### Multi-Repo Config File
```yaml
# .swarm/multi-repo.yml
version: 1
organization: my-org
repositories:
- name: frontend
url: github.com/my-org/frontend
role: ui
agents: [coder, designer, tester]
- name: backend
url: github.com/my-org/backend
role: api
agents: [architect, coder, tester]
- name: shared
url: github.com/my-org/shared
role: library
agents: [analyst, coder]
coordination:
topology: hierarchical
communication: webhook
memory: redis://shared-memory
dependencies:
- from: frontend
to: [backend, shared]
- from: backend
to: [shared]
```
### Repository Roles
```javascript
// Define repository roles and responsibilities
{
"roles": {
"ui": {
"responsibilities": ["user-interface", "ux", "accessibility"],
"default-agents": ["designer", "coder", "tester"]
},
"api": {
"responsibilities": ["endpoints", "business-logic", "data"],
"default-agents": ["architect", "coder", "security"]
},
"library": {
"responsibilities": ["shared-code", "utilities", "types"],
"default-agents": ["analyst", "coder", "documenter"]
}
}
}
```
## Orchestration Commands
### Dependency Management
```bash
# Update dependencies across all repos with gh CLI
# Create tracking issue first
TRACKING_ISSUE=$(gh issue create \
--title "Dependency Update: typescript@5.0.0" \
--body "Tracking issue for updating TypeScript across all repositories" \
--label "dependencies,tracking" \
--json number -q .number)
# Get all repos with TypeScript
TS_REPOS=$(gh repo list org --limit 100 --json name | jq -r '.[].name' | \
while read -r repo; do
if gh api repos/org/$repo/contents/package.json 2>/dev/null | \
jq -r '.content' | base64 -d | grep -q '"typescript"'; then
echo "$repo"
fi
done)
# Update each repository
echo "$TS_REPOS" | while read -r repo; do
# Clone and update
gh repo clone org/$repo /tmp/$repo -- --depth=1
cd /tmp/$repo
# Update dependency
npm install --save-dev typescript@5.0.0
# Test changes
if npm test; then
# Create PR
git checkout -b update-typescript-5
git add package.json package-lock.json
git commit -m "chore: Update TypeScript to 5.0.0
Part of #$TRACKING_ISSUE"
git push origin HEAD
gh pr create \
--title "Update TypeScript to 5.0.0" \
--body "Updates TypeScript to version 5.0.0\n\nTracking: #$TRACKING_ISSUE" \
--label "dependencies"
else
# Report failure
gh issue comment $TRACKING_ISSUE \
--body "❌ Failed to update $repo - tests failing"
fi
cd -
done
```
### Refactoring Operations
```bash
# Coordinate large-scale refactoring
npx ruv-swarm github multi-repo-refactor \
--pattern "rename:OldAPI->NewAPI" \
--analyze-impact \
--create-migration-guide \
--staged-rollout
```
### Security Updates
```bash
# Coordinate security patches
npx ruv-swarm github multi-repo-security \
--scan-all \
--patch-vulnerabilities \
--verify-fixes \
--compliance-report
```
## Communication Strategies
### 1. Webhook-Based Coordination
```javascript
// webhook-coordinator.js
const { MultiRepoSwarm } = require('ruv-swarm');
const swarm = new MultiRepoSwarm({
webhook: {
url: 'https://swarm-coordinator.example.com',
secret: process.env.WEBHOOK_SECRET
}
});
// Handle cross-repo events
swarm.on('repo:update', async (event) => {
await swarm.propagate(event, {
to: event.dependencies,
strategy: 'eventual-consistency'
});
});
```
### 2. GraphQL Federation
```graphql
# Federated schema for multi-repo queries
type Repository @key(fields: "id") {
id: ID!
name: String!
swarmStatus: SwarmStatus!
dependencies: [Repository!]!
agents: [Agent!]!
}
type SwarmStatus {
active: Boolean!
topology: Topology!
tasks: [Task!]!
memory: JSON!
}
```
### 3. Event Streaming
```yaml
# Kafka configuration for real-time coordination
kafka:
brokers: ['kafka1:9092', 'kafka2:9092']
topics:
swarm-events:
partitions: 10
replication: 3
swarm-memory:
partitions: 5
replication: 3
```
## Advanced Features
### 1. Distributed Task Queue
```bash
# Create distributed task queue
npx ruv-swarm github multi-repo-queue \
--backend redis \
--workers 10 \
--priority-routing \
--dead-letter-queue
```
### 2. Cross-Repo Testing
```bash
# Run integration tests across repos
npx ruv-swarm github multi-repo-test \
--setup-test-env \
--link-services \
--run-e2e \
--tear-down
```
### 3. Monorepo Migration
```bash
# Assist in monorepo migration
npx ruv-swarm github to-monorepo \
--analyze-repos \
--suggest-structure \
--preserve-history \
--create-migration-prs
```
## Monitoring & Visualization
### Multi-Repo Dashboard
```bash
# Launch monitoring dashboard
npx ruv-swarm github multi-repo-dashboard \
--port 3000 \
--metrics "agent-activity,task-progress,memory-usage" \
--real-time
```
### Dependency Graph
```bash
# Visualize repo dependencies
npx ruv-swarm github dep-graph \
--format mermaid \
--include-agents \
--show-data-flow
```
### Health Monitoring
```bash
# Monitor swarm health across repos
npx ruv-swarm github health-check \
--repos "org/*" \
--check "connectivity,memory,agents" \
--alert-on-issues
```
## Synchronization Patterns
### 1. Eventually Consistent
```javascript
// Eventual consistency for non-critical updates
{
"sync": {
"strategy": "eventual",
"max-lag": "5m",
"retry": {
"attempts": 3,
"backoff": "exponential"
}
}
}
```
### 2. Strong Consistency
```javascript
// Strong consistency for critical operations
{
"sync": {
"strategy": "strong",
"consensus": "raft",
"quorum": 0.51,
"timeout": "30s"
}
}
```
### 3. Hybrid Approach
```javascript
// Mix of consistency levels
{
"sync": {
"default": "eventual",
"overrides": {
"security-updates": "strong",
"dependency-updates": "strong",
"documentation": "eventual"
}
}
}
```
## Use Cases
### 1. Microservices Coordination
```bash
# Coordinate microservices development
npx ruv-swarm github microservices \
--services "auth,users,orders,payments" \
--ensure-compatibility \
--sync-contracts \
--integration-tests
```
### 2. Library Updates
```bash
# Update shared library across consumers
npx ruv-swarm github lib-update \
--library "org/shared-lib" \
--version "2.0.0" \
--find-consumers \
--update-imports \
--run-tests
```
### 3. Organization-Wide Changes
```bash
# Apply org-wide policy changes
npx ruv-swarm github org-policy \
--policy "add-security-headers" \
--repos "org/*" \
--validate-compliance \
--create-reports
```
## Best Practices
### 1. Repository Organization
- Clear repository roles and boundaries
- Consistent naming conventions
- Documented dependencies
- Shared configuration standards
### 2. Communication
- Use appropriate sync strategies
- Implement circuit breakers
- Monitor latency and failures
- Clear error propagation
### 3. Security
- Secure cross-repo authentication
- Encrypted communication channels
- Audit trail for all operations
- Principle of least privilege
## Performance Optimization
### Caching Strategy
```bash
# Implement cross-repo caching
npx ruv-swarm github cache-strategy \
--analyze-patterns \
--suggest-cache-layers \
--implement-invalidation
```
### Parallel Execution
```bash
# Optimize parallel operations
npx ruv-swarm github parallel-optimize \
--analyze-dependencies \
--identify-parallelizable \
--execute-optimal
```
### Resource Pooling
```bash
# Pool resources across repos
npx ruv-swarm github resource-pool \
--share-agents \
--distribute-load \
--monitor-usage
```
## Troubleshooting
### Connectivity Issues
```bash
# Diagnose connectivity problems
npx ruv-swarm github diagnose-connectivity \
--test-all-repos \
--check-permissions \
--verify-webhooks
```
### Memory Synchronization
```bash
# Debug memory sync issues
npx ruv-swarm github debug-memory \
--check-consistency \
--identify-conflicts \
--repair-state
```
### Performance Bottlenecks
```bash
# Identify performance issues
npx ruv-swarm github perf-analysis \
--profile-operations \
--identify-bottlenecks \
--suggest-optimizations
```
## Examples
### Full-Stack Application Update
```bash
# Update full-stack application
npx ruv-swarm github fullstack-update \
--frontend "org/web-app" \
--backend "org/api-server" \
--database "org/db-migrations" \
--coordinate-deployment
```
### Cross-Team Collaboration
```bash
# Facilitate cross-team work
npx ruv-swarm github cross-team \
--teams "frontend,backend,devops" \
--task "implement-feature-x" \
--assign-by-expertise \
--track-progress
```
See also: [swarm-pr.md](./swarm-pr.md), [project-board-sync.md](./project-board-sync.md)
@@ -0,0 +1,26 @@
# pr-enhance
AI-powered pull request enhancements.
## Usage
```bash
npx claude-flow github pr-enhance [options]
```
## Options
- `--pr-number <n>` - Pull request number
- `--add-tests` - Add missing tests
- `--improve-docs` - Improve documentation
- `--check-security` - Security review
## Examples
```bash
# Enhance PR
npx claude-flow github pr-enhance --pr-number 123
# Add tests
npx claude-flow github pr-enhance --pr-number 123 --add-tests
# Full enhancement
npx claude-flow github pr-enhance --pr-number 123 --add-tests --improve-docs
```
@@ -0,0 +1,170 @@
# GitHub PR Manager
## Purpose
Comprehensive pull request management with ruv-swarm coordination for automated reviews, testing, and merge workflows.
## Capabilities
- **Multi-reviewer coordination** with swarm agents
- **Automated conflict resolution** and merge strategies
- **Comprehensive testing** integration and validation
- **Real-time progress tracking** with GitHub issue coordination
- **Intelligent branch management** and synchronization
## Tools Available
- `mcp__github__create_pull_request`
- `mcp__github__get_pull_request`
- `mcp__github__list_pull_requests`
- `mcp__github__create_pull_request_review`
- `mcp__github__merge_pull_request`
- `mcp__github__get_pull_request_files`
- `mcp__github__get_pull_request_status`
- `mcp__github__update_pull_request_branch`
- `mcp__github__get_pull_request_comments`
- `mcp__github__get_pull_request_reviews`
- `mcp__claude-flow__*` (all swarm coordination tools)
- `TodoWrite`, `TodoRead`, `Task`, `Bash`, `Read`, `Write`
## Usage Patterns
### 1. Create and Manage PR with Swarm Coordination
```javascript
// Initialize review swarm
mcp__claude-flow__swarm_init { topology: "mesh", maxAgents: 4 }
mcp__claude-flow__agent_spawn { type: "reviewer", name: "Code Quality Reviewer" }
mcp__claude-flow__agent_spawn { type: "tester", name: "Testing Agent" }
mcp__claude-flow__agent_spawn { type: "coordinator", name: "PR Coordinator" }
// Create PR and orchestrate review
mcp__github__create_pull_request {
owner: "ruvnet",
repo: "ruv-FANN",
title: "Integration: claude-code-flow and ruv-swarm",
head: "integration/claude-code-flow-ruv-swarm",
base: "main",
body: "Comprehensive integration between packages..."
}
// Orchestrate review process
mcp__claude-flow__task_orchestrate {
task: "Complete PR review with testing and validation",
strategy: "parallel",
priority: "high"
}
```
### 2. Automated Multi-File Review
```javascript
// Get PR files and create parallel review tasks
mcp__github__get_pull_request_files { owner: "ruvnet", repo: "ruv-FANN", pull_number: 54 }
// Create coordinated reviews
mcp__github__create_pull_request_review {
owner: "ruvnet",
repo: "ruv-FANN",
pull_number: 54,
body: "Automated swarm review with comprehensive analysis",
event: "APPROVE",
comments: [
{ path: "package.json", line: 78, body: "Dependency integration verified" },
{ path: "src/index.js", line: 45, body: "Import structure optimized" }
]
}
```
### 3. Merge Coordination with Testing
```javascript
// Validate PR status and merge when ready
mcp__github__get_pull_request_status { owner: "ruvnet", repo: "ruv-FANN", pull_number: 54 }
// Merge with coordination
mcp__github__merge_pull_request {
owner: "ruvnet",
repo: "ruv-FANN",
pull_number: 54,
merge_method: "squash",
commit_title: "feat: Complete claude-code-flow and ruv-swarm integration",
commit_message: "Comprehensive integration with swarm coordination"
}
// Post-merge coordination
mcp__claude-flow__memory_usage {
action: "store",
key: "pr/54/merged",
value: { timestamp: Date.now(), status: "success" }
}
```
## Batch Operations Example
### Complete PR Lifecycle in Parallel:
```javascript
[Single Message - Complete PR Management]:
// Initialize coordination
mcp__claude-flow__swarm_init { topology: "hierarchical", maxAgents: 5 }
mcp__claude-flow__agent_spawn { type: "reviewer", name: "Senior Reviewer" }
mcp__claude-flow__agent_spawn { type: "tester", name: "QA Engineer" }
mcp__claude-flow__agent_spawn { type: "coordinator", name: "Merge Coordinator" }
// Create and manage PR using gh CLI
Bash("gh pr create --repo :owner/:repo --title '...' --head '...' --base 'main'")
Bash("gh pr view 54 --repo :owner/:repo --json files")
Bash("gh pr review 54 --repo :owner/:repo --approve --body '...'")
// Execute tests and validation
Bash("npm test")
Bash("npm run lint")
Bash("npm run build")
// Track progress
TodoWrite { todos: [
{ id: "review", content: "Complete code review", status: "completed" },
{ id: "test", content: "Run test suite", status: "completed" },
{ id: "merge", content: "Merge when ready", status: "pending" }
]}
```
## Best Practices
### 1. **Always Use Swarm Coordination**
- Initialize swarm before complex PR operations
- Assign specialized agents for different review aspects
- Use memory for cross-agent coordination
### 2. **Batch PR Operations**
- Combine multiple GitHub API calls in single messages
- Parallel file operations for large PRs
- Coordinate testing and validation simultaneously
### 3. **Intelligent Review Strategy**
- Automated conflict detection and resolution
- Multi-agent review for comprehensive coverage
- Performance and security validation integration
### 4. **Progress Tracking**
- Use TodoWrite for PR milestone tracking
- GitHub issue integration for project coordination
- Real-time status updates through swarm memory
## Integration with Other Modes
### Works seamlessly with:
- `/github issue-tracker` - For project coordination
- `/github branch-manager` - For branch strategy
- `/github ci-orchestrator` - For CI/CD integration
- `/sparc reviewer` - For detailed code analysis
- `/sparc tester` - For comprehensive testing
## Error Handling
### Automatic retry logic for:
- Network failures during GitHub API calls
- Merge conflicts with intelligent resolution
- Test failures with automatic re-runs
- Review bottlenecks with load balancing
### Swarm coordination ensures:
- No single point of failure
- Automatic agent failover
- Progress preservation across interruptions
- Comprehensive error reporting and recovery
@@ -0,0 +1,471 @@
# Project Board Sync - GitHub Projects Integration
## Overview
Synchronize AI swarms with GitHub Projects for visual task management, progress tracking, and team coordination.
## Core Features
### 1. Board Initialization
```bash
# Connect swarm to GitHub Project using gh CLI
# Get project details
PROJECT_ID=$(gh project list --owner @me --format json | \
jq -r '.projects[] | select(.title == "Development Board") | .id')
# Initialize swarm with project
npx ruv-swarm github board-init \
--project-id "$PROJECT_ID" \
--sync-mode "bidirectional" \
--create-views "swarm-status,agent-workload,priority"
# Create project fields for swarm tracking
gh project field-create $PROJECT_ID --owner @me \
--name "Swarm Status" \
--data-type "SINGLE_SELECT" \
--single-select-options "pending,in_progress,completed"
```
### 2. Task Synchronization
```bash
# Sync swarm tasks with project cards
npx ruv-swarm github board-sync \
--map-status '{
"todo": "To Do",
"in_progress": "In Progress",
"review": "Review",
"done": "Done"
}' \
--auto-move-cards \
--update-metadata
```
### 3. Real-time Updates
```bash
# Enable real-time board updates
npx ruv-swarm github board-realtime \
--webhook-endpoint "https://api.example.com/github-sync" \
--update-frequency "immediate" \
--batch-updates false
```
## Configuration
### Board Mapping Configuration
```yaml
# .github/board-sync.yml
version: 1
project:
name: "AI Development Board"
number: 1
mapping:
# Map swarm task status to board columns
status:
pending: "Backlog"
assigned: "Ready"
in_progress: "In Progress"
review: "Review"
completed: "Done"
blocked: "Blocked"
# Map agent types to labels
agents:
coder: "🔧 Development"
tester: "🧪 Testing"
analyst: "📊 Analysis"
designer: "🎨 Design"
architect: "🏗️ Architecture"
# Map priority to project fields
priority:
critical: "🔴 Critical"
high: "🟡 High"
medium: "🟢 Medium"
low: "⚪ Low"
# Custom fields
fields:
- name: "Agent Count"
type: number
source: task.agents.length
- name: "Complexity"
type: select
source: task.complexity
- name: "ETA"
type: date
source: task.estimatedCompletion
```
### View Configuration
```javascript
// Custom board views
{
"views": [
{
"name": "Swarm Overview",
"type": "board",
"groupBy": "status",
"filters": ["is:open"],
"sort": "priority:desc"
},
{
"name": "Agent Workload",
"type": "table",
"groupBy": "assignedAgent",
"columns": ["title", "status", "priority", "eta"],
"sort": "eta:asc"
},
{
"name": "Sprint Progress",
"type": "roadmap",
"dateField": "eta",
"groupBy": "milestone"
}
]
}
```
## Automation Features
### 1. Auto-Assignment
```bash
# Automatically assign cards to agents
npx ruv-swarm github board-auto-assign \
--strategy "load-balanced" \
--consider "expertise,workload,availability" \
--update-cards
```
### 2. Progress Tracking
```bash
# Track and visualize progress
npx ruv-swarm github board-progress \
--show "burndown,velocity,cycle-time" \
--time-period "sprint" \
--export-metrics
```
### 3. Smart Card Movement
```bash
# Intelligent card state transitions
npx ruv-swarm github board-smart-move \
--rules '{
"auto-progress": "when:all-subtasks-done",
"auto-review": "when:tests-pass",
"auto-done": "when:pr-merged"
}'
```
## Board Commands
### Create Cards from Issues
```bash
# Convert issues to project cards using gh CLI
# List issues with label
ISSUES=$(gh issue list --label "enhancement" --json number,title,body)
# Add issues to project
echo "$ISSUES" | jq -r '.[].number' | while read -r issue; do
gh project item-add $PROJECT_ID --owner @me --url "https://github.com/$GITHUB_REPOSITORY/issues/$issue"
done
# Process with swarm
npx ruv-swarm github board-import-issues \
--issues "$ISSUES" \
--add-to-column "Backlog" \
--parse-checklist \
--assign-agents
```
### Bulk Operations
```bash
# Bulk card operations
npx ruv-swarm github board-bulk \
--filter "status:blocked" \
--action "add-label:needs-attention" \
--notify-assignees
```
### Card Templates
```bash
# Create cards from templates
npx ruv-swarm github board-template \
--template "feature-development" \
--variables '{
"feature": "User Authentication",
"priority": "high",
"agents": ["architect", "coder", "tester"]
}' \
--create-subtasks
```
## Advanced Synchronization
### 1. Multi-Board Sync
```bash
# Sync across multiple boards
npx ruv-swarm github multi-board-sync \
--boards "Development,QA,Release" \
--sync-rules '{
"Development->QA": "when:ready-for-test",
"QA->Release": "when:tests-pass"
}'
```
### 2. Cross-Organization Sync
```bash
# Sync boards across organizations
npx ruv-swarm github cross-org-sync \
--source "org1/Project-A" \
--target "org2/Project-B" \
--field-mapping "custom" \
--conflict-resolution "source-wins"
```
### 3. External Tool Integration
```bash
# Sync with external tools
npx ruv-swarm github board-integrate \
--tool "jira" \
--mapping "bidirectional" \
--sync-frequency "5m" \
--transform-rules "custom"
```
## Visualization & Reporting
### Board Analytics
```bash
# Generate board analytics using gh CLI data
# Fetch project data
PROJECT_DATA=$(gh project item-list $PROJECT_ID --owner @me --format json)
# Get issue metrics
ISSUE_METRICS=$(echo "$PROJECT_DATA" | jq -r '.items[] | select(.content.type == "Issue")' | \
while read -r item; do
ISSUE_NUM=$(echo "$item" | jq -r '.content.number')
gh issue view $ISSUE_NUM --json createdAt,closedAt,labels,assignees
done)
# Generate analytics with swarm
npx ruv-swarm github board-analytics \
--project-data "$PROJECT_DATA" \
--issue-metrics "$ISSUE_METRICS" \
--metrics "throughput,cycle-time,wip" \
--group-by "agent,priority,type" \
--time-range "30d" \
--export "dashboard"
```
### Custom Dashboards
```javascript
// Dashboard configuration
{
"dashboard": {
"widgets": [
{
"type": "chart",
"title": "Task Completion Rate",
"data": "completed-per-day",
"visualization": "line"
},
{
"type": "gauge",
"title": "Sprint Progress",
"data": "sprint-completion",
"target": 100
},
{
"type": "heatmap",
"title": "Agent Activity",
"data": "agent-tasks-per-day"
}
]
}
}
```
### Reports
```bash
# Generate reports
npx ruv-swarm github board-report \
--type "sprint-summary" \
--format "markdown" \
--include "velocity,burndown,blockers" \
--distribute "slack,email"
```
## Workflow Integration
### Sprint Management
```bash
# Manage sprints with swarms
npx ruv-swarm github sprint-manage \
--sprint "Sprint 23" \
--auto-populate \
--capacity-planning \
--track-velocity
```
### Milestone Tracking
```bash
# Track milestone progress
npx ruv-swarm github milestone-track \
--milestone "v2.0 Release" \
--update-board \
--show-dependencies \
--predict-completion
```
### Release Planning
```bash
# Plan releases using board data
npx ruv-swarm github release-plan-board \
--analyze-velocity \
--estimate-completion \
--identify-risks \
--optimize-scope
```
## Team Collaboration
### Work Distribution
```bash
# Distribute work among team
npx ruv-swarm github board-distribute \
--strategy "skills-based" \
--balance-workload \
--respect-preferences \
--notify-assignments
```
### Standup Automation
```bash
# Generate standup reports
npx ruv-swarm github standup-report \
--team "frontend" \
--include "yesterday,today,blockers" \
--format "slack" \
--schedule "daily-9am"
```
### Review Coordination
```bash
# Coordinate reviews via board
npx ruv-swarm github review-coordinate \
--board "Code Review" \
--assign-reviewers \
--track-feedback \
--ensure-coverage
```
## Best Practices
### 1. Board Organization
- Clear column definitions
- Consistent labeling system
- Regular board grooming
- Automation rules
### 2. Data Integrity
- Bidirectional sync validation
- Conflict resolution strategies
- Audit trails
- Regular backups
### 3. Team Adoption
- Training materials
- Clear workflows
- Regular reviews
- Feedback loops
## Troubleshooting
### Sync Issues
```bash
# Diagnose sync problems
npx ruv-swarm github board-diagnose \
--check "permissions,webhooks,rate-limits" \
--test-sync \
--show-conflicts
```
### Performance
```bash
# Optimize board performance
npx ruv-swarm github board-optimize \
--analyze-size \
--archive-completed \
--index-fields \
--cache-views
```
### Data Recovery
```bash
# Recover board data
npx ruv-swarm github board-recover \
--backup-id "2024-01-15" \
--restore-cards \
--preserve-current \
--merge-conflicts
```
## Examples
### Agile Development Board
```bash
# Setup agile board
npx ruv-swarm github agile-board \
--methodology "scrum" \
--sprint-length "2w" \
--ceremonies "planning,review,retro" \
--metrics "velocity,burndown"
```
### Kanban Flow Board
```bash
# Setup kanban board
npx ruv-swarm github kanban-board \
--wip-limits '{
"In Progress": 5,
"Review": 3
}' \
--cycle-time-tracking \
--continuous-flow
```
### Research Project Board
```bash
# Setup research board
npx ruv-swarm github research-board \
--phases "ideation,research,experiment,analysis,publish" \
--track-citations \
--collaborate-external
```
## Metrics & KPIs
### Performance Metrics
```bash
# Track board performance
npx ruv-swarm github board-kpis \
--metrics '[
"average-cycle-time",
"throughput-per-sprint",
"blocked-time-percentage",
"first-time-pass-rate"
]' \
--dashboard-url
```
### Team Metrics
```bash
# Track team performance
npx ruv-swarm github team-metrics \
--board "Development" \
--per-member \
--include "velocity,quality,collaboration" \
--anonymous-option
```
See also: [swarm-issue.md](./swarm-issue.md), [multi-repo-swarm.md](./multi-repo-swarm.md)
@@ -0,0 +1,338 @@
# GitHub Release Manager
## Purpose
Automated release coordination and deployment with ruv-swarm orchestration for seamless version management, testing, and deployment across multiple packages.
## Capabilities
- **Automated release pipelines** with comprehensive testing
- **Version coordination** across multiple packages
- **Deployment orchestration** with rollback capabilities
- **Release documentation** generation and management
- **Multi-stage validation** with swarm coordination
## Tools Available
- `mcp__github__create_pull_request`
- `mcp__github__merge_pull_request`
- `mcp__github__create_branch`
- `mcp__github__push_files`
- `mcp__github__create_issue`
- `mcp__claude-flow__*` (all swarm coordination tools)
- `TodoWrite`, `TodoRead`, `Task`, `Bash`, `Read`, `Write`, `Edit`
## Usage Patterns
### 1. Coordinated Release Preparation
```javascript
// Initialize release management swarm
mcp__claude-flow__swarm_init { topology: "hierarchical", maxAgents: 6 }
mcp__claude-flow__agent_spawn { type: "coordinator", name: "Release Coordinator" }
mcp__claude-flow__agent_spawn { type: "tester", name: "QA Engineer" }
mcp__claude-flow__agent_spawn { type: "reviewer", name: "Release Reviewer" }
mcp__claude-flow__agent_spawn { type: "coder", name: "Version Manager" }
mcp__claude-flow__agent_spawn { type: "analyst", name: "Deployment Analyst" }
// Create release preparation branch
mcp__github__create_branch {
owner: "ruvnet",
repo: "ruv-FANN",
branch: "release/v1.0.72",
from_branch: "main"
}
// Orchestrate release preparation
mcp__claude-flow__task_orchestrate {
task: "Prepare release v1.0.72 with comprehensive testing and validation",
strategy: "sequential",
priority: "critical"
}
```
### 2. Multi-Package Version Coordination
```javascript
// Update versions across packages
mcp__github__push_files {
owner: "ruvnet",
repo: "ruv-FANN",
branch: "release/v1.0.72",
files: [
{
path: "claude-code-flow/claude-code-flow/package.json",
content: JSON.stringify({
name: "claude-flow",
version: "1.0.72",
// ... rest of package.json
}, null, 2)
},
{
path: "ruv-swarm/npm/package.json",
content: JSON.stringify({
name: "ruv-swarm",
version: "1.0.12",
// ... rest of package.json
}, null, 2)
},
{
path: "CHANGELOG.md",
content: `# Changelog
## [1.0.72] - ${new Date().toISOString().split('T')[0]}
### Added
- Comprehensive GitHub workflow integration
- Enhanced swarm coordination capabilities
- Advanced MCP tools suite
### Changed
- Aligned Node.js version requirements
- Improved package synchronization
- Enhanced documentation structure
### Fixed
- Dependency resolution issues
- Integration test reliability
- Memory coordination optimization`
}
],
message: "release: Prepare v1.0.72 with GitHub integration and swarm enhancements"
}
```
### 3. Automated Release Validation
```javascript
// Comprehensive release testing
Bash("cd /workspaces/ruv-FANN/claude-code-flow/claude-code-flow && npm install")
Bash("cd /workspaces/ruv-FANN/claude-code-flow/claude-code-flow && npm run test")
Bash("cd /workspaces/ruv-FANN/claude-code-flow/claude-code-flow && npm run lint")
Bash("cd /workspaces/ruv-FANN/claude-code-flow/claude-code-flow && npm run build")
Bash("cd /workspaces/ruv-FANN/ruv-swarm/npm && npm install")
Bash("cd /workspaces/ruv-FANN/ruv-swarm/npm && npm run test:all")
Bash("cd /workspaces/ruv-FANN/ruv-swarm/npm && npm run lint")
// Create release PR with validation results
mcp__github__create_pull_request {
owner: "ruvnet",
repo: "ruv-FANN",
title: "Release v1.0.72: GitHub Integration and Swarm Enhancements",
head: "release/v1.0.72",
base: "main",
body: `## 🚀 Release v1.0.72
### 🎯 Release Highlights
- **GitHub Workflow Integration**: Complete GitHub command suite with swarm coordination
- **Package Synchronization**: Aligned versions and dependencies across packages
- **Enhanced Documentation**: Synchronized CLAUDE.md with comprehensive integration guides
- **Improved Testing**: Comprehensive integration test suite with 89% success rate
### 📦 Package Updates
- **claude-flow**: v1.0.71 → v1.0.72
- **ruv-swarm**: v1.0.11 → v1.0.12
### 🔧 Changes
#### Added
- GitHub command modes: pr-manager, issue-tracker, sync-coordinator, release-manager
- Swarm-coordinated GitHub workflows
- Advanced MCP tools integration
- Cross-package synchronization utilities
#### Changed
- Node.js requirement aligned to >=20.0.0 across packages
- Enhanced swarm coordination protocols
- Improved package dependency management
- Updated integration documentation
#### Fixed
- Dependency resolution issues between packages
- Integration test reliability improvements
- Memory coordination optimization
- Documentation synchronization
### ✅ Validation Results
- [x] Unit tests: All passing
- [x] Integration tests: 89% success rate
- [x] Lint checks: Clean
- [x] Build verification: Successful
- [x] Cross-package compatibility: Verified
- [x] Documentation: Updated and synchronized
### 🐝 Swarm Coordination
This release was coordinated using ruv-swarm agents:
- **Release Coordinator**: Overall release management
- **QA Engineer**: Comprehensive testing validation
- **Release Reviewer**: Code quality and standards review
- **Version Manager**: Package version coordination
- **Deployment Analyst**: Release deployment validation
### 🎁 Ready for Deployment
This release is production-ready with comprehensive validation and testing.
---
🤖 Generated with Claude Code using ruv-swarm coordination`
}
```
## Batch Release Workflow
### Complete Release Pipeline:
```javascript
[Single Message - Complete Release Management]:
// Initialize comprehensive release swarm
mcp__claude-flow__swarm_init { topology: "star", maxAgents: 8 }
mcp__claude-flow__agent_spawn { type: "coordinator", name: "Release Director" }
mcp__claude-flow__agent_spawn { type: "tester", name: "QA Lead" }
mcp__claude-flow__agent_spawn { type: "reviewer", name: "Senior Reviewer" }
mcp__claude-flow__agent_spawn { type: "coder", name: "Version Controller" }
mcp__claude-flow__agent_spawn { type: "analyst", name: "Performance Analyst" }
mcp__claude-flow__agent_spawn { type: "researcher", name: "Compatibility Checker" }
// Create release branch and prepare files using gh CLI
Bash("gh api repos/:owner/:repo/git/refs --method POST -f ref='refs/heads/release/v1.0.72' -f sha=$(gh api repos/:owner/:repo/git/refs/heads/main --jq '.object.sha')")
// Clone and update release files
Bash("gh repo clone :owner/:repo /tmp/release-v1.0.72 -- --branch release/v1.0.72 --depth=1")
// Update all release-related files
Write("/tmp/release-v1.0.72/claude-code-flow/claude-code-flow/package.json", "[updated package.json]")
Write("/tmp/release-v1.0.72/ruv-swarm/npm/package.json", "[updated package.json]")
Write("/tmp/release-v1.0.72/CHANGELOG.md", "[release changelog]")
Write("/tmp/release-v1.0.72/RELEASE_NOTES.md", "[detailed release notes]")
Bash("cd /tmp/release-v1.0.72 && git add -A && git commit -m 'release: Prepare v1.0.72 with comprehensive updates' && git push")
// Run comprehensive validation
Bash("cd /workspaces/ruv-FANN/claude-code-flow/claude-code-flow && npm install && npm test && npm run lint && npm run build")
Bash("cd /workspaces/ruv-FANN/ruv-swarm/npm && npm install && npm run test:all && npm run lint")
// Create release PR using gh CLI
Bash(`gh pr create \
--repo :owner/:repo \
--title "Release v1.0.72: GitHub Integration and Swarm Enhancements" \
--head "release/v1.0.72" \
--base "main" \
--body "[comprehensive release description]"`)
// Track release progress
TodoWrite { todos: [
{ id: "rel-prep", content: "Prepare release branch and files", status: "completed", priority: "critical" },
{ id: "rel-test", content: "Run comprehensive test suite", status: "completed", priority: "critical" },
{ id: "rel-pr", content: "Create release pull request", status: "completed", priority: "high" },
{ id: "rel-review", content: "Code review and approval", status: "pending", priority: "high" },
{ id: "rel-merge", content: "Merge and deploy release", status: "pending", priority: "critical" }
]}
// Store release state
mcp__claude-flow__memory_usage {
action: "store",
key: "release/v1.0.72/status",
value: {
timestamp: Date.now(),
version: "1.0.72",
stage: "validation_complete",
packages: ["claude-flow", "ruv-swarm"],
validation_passed: true,
ready_for_review: true
}
}
```
## Release Strategies
### 1. **Semantic Versioning Strategy**
```javascript
const versionStrategy = {
major: "Breaking changes or architecture overhauls",
minor: "New features, GitHub integration, swarm enhancements",
patch: "Bug fixes, documentation updates, dependency updates",
coordination: "Cross-package version alignment"
}
```
### 2. **Multi-Stage Validation**
```javascript
const validationStages = [
"unit_tests", // Individual package testing
"integration_tests", // Cross-package integration
"performance_tests", // Performance regression detection
"compatibility_tests", // Version compatibility validation
"documentation_tests", // Documentation accuracy verification
"deployment_tests" // Deployment simulation
]
```
### 3. **Rollback Strategy**
```javascript
const rollbackPlan = {
triggers: ["test_failures", "deployment_issues", "critical_bugs"],
automatic: ["failed_tests", "build_failures"],
manual: ["user_reported_issues", "performance_degradation"],
recovery: "Previous stable version restoration"
}
```
## Best Practices
### 1. **Comprehensive Testing**
- Multi-package test coordination
- Integration test validation
- Performance regression detection
- Security vulnerability scanning
### 2. **Documentation Management**
- Automated changelog generation
- Release notes with detailed changes
- Migration guides for breaking changes
- API documentation updates
### 3. **Deployment Coordination**
- Staged deployment with validation
- Rollback mechanisms and procedures
- Performance monitoring during deployment
- User communication and notifications
### 4. **Version Management**
- Semantic versioning compliance
- Cross-package version coordination
- Dependency compatibility validation
- Breaking change documentation
## Integration with CI/CD
### GitHub Actions Integration:
```yaml
name: Release Management
on:
pull_request:
branches: [main]
paths: ['**/package.json', 'CHANGELOG.md']
jobs:
release-validation:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- name: Install and Test
run: |
cd claude-code-flow/claude-code-flow && npm install && npm test
cd ../../ruv-swarm/npm && npm install && npm test:all
- name: Validate Release
run: npx claude-flow release validate
```
## Monitoring and Metrics
### Release Quality Metrics:
- Test coverage percentage
- Integration success rate
- Deployment time metrics
- Rollback frequency
### Automated Monitoring:
- Performance regression detection
- Error rate monitoring
- User adoption metrics
- Feedback collection and analysis
@@ -0,0 +1,544 @@
# Release Swarm - Intelligent Release Automation
## Overview
Orchestrate complex software releases using AI swarms that handle everything from changelog generation to multi-platform deployment.
## Core Features
### 1. Release Planning
```bash
# Plan next release using gh CLI
# Get commit history since last release
LAST_TAG=$(gh release list --limit 1 --json tagName -q '.[0].tagName')
COMMITS=$(gh api repos/:owner/:repo/compare/${LAST_TAG}...HEAD --jq '.commits')
# Get merged PRs
MERGED_PRS=$(gh pr list --state merged --base main --json number,title,labels,mergedAt \
--jq ".[] | select(.mergedAt > \"$(gh release view $LAST_TAG --json publishedAt -q .publishedAt)\")")
# Plan release with commit analysis
npx ruv-swarm github release-plan \
--commits "$COMMITS" \
--merged-prs "$MERGED_PRS" \
--analyze-commits \
--suggest-version \
--identify-breaking \
--generate-timeline
```
### 2. Automated Versioning
```bash
# Smart version bumping
npx ruv-swarm github release-version \
--strategy "semantic" \
--analyze-changes \
--check-breaking \
--update-files
```
### 3. Release Orchestration
```bash
# Full release automation with gh CLI
# Generate changelog from PRs and commits
CHANGELOG=$(gh api repos/:owner/:repo/compare/${LAST_TAG}...HEAD \
--jq '.commits[].commit.message' | \
npx ruv-swarm github generate-changelog)
# Create release draft
gh release create v2.0.0 \
--draft \
--title "Release v2.0.0" \
--notes "$CHANGELOG" \
--target main
# Run release orchestration
npx ruv-swarm github release-create \
--version "2.0.0" \
--changelog "$CHANGELOG" \
--build-artifacts \
--deploy-targets "npm,docker,github"
# Publish release after validation
gh release edit v2.0.0 --draft=false
# Create announcement issue
gh issue create \
--title "🎉 Released v2.0.0" \
--body "$CHANGELOG" \
--label "announcement,release"
```
## Release Configuration
### Release Config File
```yaml
# .github/release-swarm.yml
version: 1
release:
versioning:
strategy: semantic
breaking-keywords: ["BREAKING", "!"]
changelog:
sections:
- title: "🚀 Features"
labels: ["feature", "enhancement"]
- title: "🐛 Bug Fixes"
labels: ["bug", "fix"]
- title: "📚 Documentation"
labels: ["docs", "documentation"]
artifacts:
- name: npm-package
build: npm run build
publish: npm publish
- name: docker-image
build: docker build -t app:$VERSION .
publish: docker push app:$VERSION
- name: binaries
build: ./scripts/build-binaries.sh
upload: github-release
deployment:
environments:
- name: staging
auto-deploy: true
validation: npm run test:e2e
- name: production
approval-required: true
rollback-enabled: true
notifications:
- slack: releases-channel
- email: stakeholders@company.com
- discord: webhook-url
```
## Release Agents
### Changelog Agent
```bash
# Generate intelligent changelog with gh CLI
# Get all merged PRs between versions
PRS=$(gh pr list --state merged --base main --json number,title,labels,author,mergedAt \
--jq ".[] | select(.mergedAt > \"$(gh release view v1.0.0 --json publishedAt -q .publishedAt)\")")
# Get contributors
CONTRIBUTORS=$(echo "$PRS" | jq -r '[.author.login] | unique | join(", ")')
# Get commit messages
COMMITS=$(gh api repos/:owner/:repo/compare/v1.0.0...HEAD \
--jq '.commits[].commit.message')
# Generate categorized changelog
CHANGELOG=$(npx ruv-swarm github changelog \
--prs "$PRS" \
--commits "$COMMITS" \
--contributors "$CONTRIBUTORS" \
--from v1.0.0 \
--to HEAD \
--categorize \
--add-migration-guide)
# Save changelog
echo "$CHANGELOG" > CHANGELOG.md
# Create PR with changelog update
gh pr create \
--title "docs: Update changelog for v2.0.0" \
--body "Automated changelog update" \
--base main
```
**Capabilities:**
- Semantic commit analysis
- Breaking change detection
- Contributor attribution
- Migration guide generation
- Multi-language support
### Version Agent
```bash
# Determine next version
npx ruv-swarm github version-suggest \
--current v1.2.3 \
--analyze-commits \
--check-compatibility \
--suggest-pre-release
```
**Logic:**
- Analyzes commit messages
- Detects breaking changes
- Suggests appropriate bump
- Handles pre-releases
- Validates version constraints
### Build Agent
```bash
# Coordinate multi-platform builds
npx ruv-swarm github release-build \
--platforms "linux,macos,windows" \
--architectures "x64,arm64" \
--parallel \
--optimize-size
```
**Features:**
- Cross-platform compilation
- Parallel build execution
- Artifact optimization
- Dependency bundling
- Build caching
### Test Agent
```bash
# Pre-release testing
npx ruv-swarm github release-test \
--suites "unit,integration,e2e,performance" \
--environments "node:16,node:18,node:20" \
--fail-fast false \
--generate-report
```
### Deploy Agent
```bash
# Multi-target deployment
npx ruv-swarm github release-deploy \
--targets "npm,docker,github,s3" \
--staged-rollout \
--monitor-metrics \
--auto-rollback
```
## Advanced Features
### 1. Progressive Deployment
```yaml
# Staged rollout configuration
deployment:
strategy: progressive
stages:
- name: canary
percentage: 5
duration: 1h
metrics:
- error-rate < 0.1%
- latency-p99 < 200ms
- name: partial
percentage: 25
duration: 4h
validation: automated-tests
- name: full
percentage: 100
approval: required
```
### 2. Multi-Repo Releases
```bash
# Coordinate releases across repos
npx ruv-swarm github multi-release \
--repos "frontend:v2.0.0,backend:v2.1.0,cli:v1.5.0" \
--ensure-compatibility \
--atomic-release \
--synchronized
```
### 3. Hotfix Automation
```bash
# Emergency hotfix process
npx ruv-swarm github hotfix \
--issue 789 \
--target-version v1.2.4 \
--cherry-pick-commits \
--fast-track-deploy
```
## Release Workflows
### Standard Release Flow
```yaml
# .github/workflows/release.yml
name: Release Workflow
on:
push:
tags: ['v*']
jobs:
release-swarm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup GitHub CLI
run: echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
- name: Initialize Release Swarm
run: |
# Get release tag and previous tag
RELEASE_TAG=${{ github.ref_name }}
PREV_TAG=$(gh release list --limit 2 --json tagName -q '.[1].tagName')
# Get PRs and commits for changelog
PRS=$(gh pr list --state merged --base main --json number,title,labels,author \
--search "merged:>=$(gh release view $PREV_TAG --json publishedAt -q .publishedAt)")
npx ruv-swarm github release-init \
--tag $RELEASE_TAG \
--previous-tag $PREV_TAG \
--prs "$PRS" \
--spawn-agents "changelog,version,build,test,deploy"
- name: Generate Release Assets
run: |
# Generate changelog from PR data
CHANGELOG=$(npx ruv-swarm github release-changelog \
--format markdown)
# Update release notes
gh release edit ${{ github.ref_name }} \
--notes "$CHANGELOG"
# Generate and upload assets
npx ruv-swarm github release-assets \
--changelog \
--binaries \
--documentation
- name: Upload Release Assets
run: |
# Upload generated assets to GitHub release
for file in dist/*; do
gh release upload ${{ github.ref_name }} "$file"
done
- name: Publish Release
run: |
# Publish to package registries
npx ruv-swarm github release-publish \
--platforms all
# Create announcement issue
gh issue create \
--title "🚀 Released ${{ github.ref_name }}" \
--body "See [release notes](https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }})" \
--label "announcement"
```
### Continuous Deployment
```bash
# Automated deployment pipeline
npx ruv-swarm github cd-pipeline \
--trigger "merge-to-main" \
--auto-version \
--deploy-on-success \
--rollback-on-failure
```
## Release Validation
### Pre-Release Checks
```bash
# Comprehensive validation
npx ruv-swarm github release-validate \
--checks "
version-conflicts,
dependency-compatibility,
api-breaking-changes,
security-vulnerabilities,
performance-regression,
documentation-completeness
" \
--block-on-failure
```
### Compatibility Testing
```bash
# Test backward compatibility
npx ruv-swarm github compat-test \
--previous-versions "v1.0,v1.1,v1.2" \
--api-contracts \
--data-migrations \
--generate-report
```
### Security Scanning
```bash
# Security validation
npx ruv-swarm github release-security \
--scan-dependencies \
--check-secrets \
--audit-permissions \
--sign-artifacts
```
## Monitoring & Rollback
### Release Monitoring
```bash
# Monitor release health
npx ruv-swarm github release-monitor \
--version v2.0.0 \
--metrics "error-rate,latency,throughput" \
--alert-thresholds \
--duration 24h
```
### Automated Rollback
```bash
# Configure auto-rollback
npx ruv-swarm github rollback-config \
--triggers '{
"error-rate": ">5%",
"latency-p99": ">1000ms",
"availability": "<99.9%"
}' \
--grace-period 5m \
--notify-on-rollback
```
### Release Analytics
```bash
# Analyze release performance
npx ruv-swarm github release-analytics \
--version v2.0.0 \
--compare-with v1.9.0 \
--metrics "adoption,performance,stability" \
--generate-insights
```
## Documentation
### Auto-Generated Docs
```bash
# Update documentation
npx ruv-swarm github release-docs \
--api-changes \
--migration-guide \
--example-updates \
--publish-to "docs-site,wiki"
```
### Release Notes
```markdown
<!-- Auto-generated release notes template -->
# Release v2.0.0
## 🎉 Highlights
- Major feature X with 50% performance improvement
- New API endpoints for feature Y
- Enhanced security with feature Z
## 🚀 Features
### Feature Name (#PR)
Detailed description of the feature...
## 🐛 Bug Fixes
### Fixed issue with... (#PR)
Description of the fix...
## 💥 Breaking Changes
### API endpoint renamed
- Before: `/api/old-endpoint`
- After: `/api/new-endpoint`
- Migration: Update all client calls...
## 📈 Performance Improvements
- Reduced memory usage by 30%
- API response time improved by 200ms
## 🔒 Security Updates
- Updated dependencies to patch CVE-XXXX
- Enhanced authentication mechanism
## 📚 Documentation
- Added examples for new features
- Updated API reference
- New troubleshooting guide
## 🙏 Contributors
Thanks to all contributors who made this release possible!
```
## Best Practices
### 1. Release Planning
- Regular release cycles
- Feature freeze periods
- Beta testing phases
- Clear communication
### 2. Automation
- Comprehensive CI/CD
- Automated testing
- Progressive rollouts
- Monitoring and alerts
### 3. Documentation
- Up-to-date changelogs
- Migration guides
- API documentation
- Example updates
## Integration Examples
### NPM Package Release
```bash
# NPM package release
npx ruv-swarm github npm-release \
--version patch \
--test-all \
--publish-beta \
--tag-latest-on-success
```
### Docker Image Release
```bash
# Docker multi-arch release
npx ruv-swarm github docker-release \
--platforms "linux/amd64,linux/arm64" \
--tags "latest,v2.0.0,stable" \
--scan-vulnerabilities \
--push-to "dockerhub,gcr,ecr"
```
### Mobile App Release
```bash
# Mobile app store release
npx ruv-swarm github mobile-release \
--platforms "ios,android" \
--build-release \
--submit-review \
--staged-rollout
```
## Emergency Procedures
### Hotfix Process
```bash
# Emergency hotfix
npx ruv-swarm github emergency-release \
--severity critical \
--bypass-checks security-only \
--fast-track \
--notify-all
```
### Rollback Procedure
```bash
# Immediate rollback
npx ruv-swarm github rollback \
--to-version v1.9.9 \
--reason "Critical bug in v2.0.0" \
--preserve-data \
--notify-users
```
See also: [workflow-automation.md](./workflow-automation.md), [multi-repo-swarm.md](./multi-repo-swarm.md)
@@ -0,0 +1,25 @@
# repo-analyze
Deep analysis of GitHub repository with AI insights.
## Usage
```bash
npx claude-flow github repo-analyze [options]
```
## Options
- `--repository <owner/repo>` - Repository to analyze
- `--deep` - Enable deep analysis
- `--include <areas>` - Include specific areas (issues, prs, code, commits)
## Examples
```bash
# Basic analysis
npx claude-flow github repo-analyze --repository myorg/myrepo
# Deep analysis
npx claude-flow github repo-analyze --repository myorg/myrepo --deep
# Specific areas
npx claude-flow github repo-analyze --repository myorg/myrepo --include issues,prs
```
@@ -0,0 +1,367 @@
# GitHub Repository Architect
## Purpose
Repository structure optimization and multi-repo management with ruv-swarm coordination for scalable project architecture and development workflows.
## Capabilities
- **Repository structure optimization** with best practices
- **Multi-repository coordination** and synchronization
- **Template management** for consistent project setup
- **Architecture analysis** and improvement recommendations
- **Cross-repo workflow** coordination and management
## Tools Available
- `mcp__github__create_repository`
- `mcp__github__fork_repository`
- `mcp__github__search_repositories`
- `mcp__github__push_files`
- `mcp__github__create_or_update_file`
- `mcp__claude-flow__*` (all swarm coordination tools)
- `TodoWrite`, `TodoRead`, `Task`, `Bash`, `Read`, `Write`, `LS`, `Glob`
## Usage Patterns
### 1. Repository Structure Analysis and Optimization
```javascript
// Initialize architecture analysis swarm
mcp__claude-flow__swarm_init { topology: "mesh", maxAgents: 4 }
mcp__claude-flow__agent_spawn { type: "analyst", name: "Structure Analyzer" }
mcp__claude-flow__agent_spawn { type: "architect", name: "Repository Architect" }
mcp__claude-flow__agent_spawn { type: "optimizer", name: "Structure Optimizer" }
mcp__claude-flow__agent_spawn { type: "coordinator", name: "Multi-Repo Coordinator" }
// Analyze current repository structure
LS("/workspaces/ruv-FANN/claude-code-flow/claude-code-flow")
LS("/workspaces/ruv-FANN/ruv-swarm/npm")
// Search for related repositories
mcp__github__search_repositories {
query: "user:ruvnet claude",
sort: "updated",
order: "desc"
}
// Orchestrate structure optimization
mcp__claude-flow__task_orchestrate {
task: "Analyze and optimize repository structure for scalability and maintainability",
strategy: "adaptive",
priority: "medium"
}
```
### 2. Multi-Repository Template Creation
```javascript
// Create standardized repository template
mcp__github__create_repository {
name: "claude-project-template",
description: "Standardized template for Claude Code projects with ruv-swarm integration",
private: false,
autoInit: true
}
// Push template structure
mcp__github__push_files {
owner: "ruvnet",
repo: "claude-project-template",
branch: "main",
files: [
{
path: ".claude/commands/github/github-modes.md",
content: "[GitHub modes template]"
},
{
path: ".claude/commands/sparc/sparc-modes.md",
content: "[SPARC modes template]"
},
{
path: ".claude/config.json",
content: JSON.stringify({
version: "1.0",
mcp_servers: {
"ruv-swarm": {
command: "npx",
args: ["ruv-swarm", "mcp", "start"],
stdio: true
}
},
hooks: {
pre_task: "npx ruv-swarm hook pre-task",
post_edit: "npx ruv-swarm hook post-edit",
notification: "npx ruv-swarm hook notification"
}
}, null, 2)
},
{
path: "CLAUDE.md",
content: "[Standardized CLAUDE.md template]"
},
{
path: "package.json",
content: JSON.stringify({
name: "claude-project-template",
version: "1.0.0",
description: "Claude Code project with ruv-swarm integration",
engines: { node: ">=20.0.0" },
dependencies: {
"ruv-swarm": "^1.0.11"
}
}, null, 2)
},
{
path: "README.md",
content: `# Claude Project Template
## Quick Start
\`\`\`bash
npx claude-flow init --sparc
npm install
npx claude-flow start --ui
\`\`\`
## Features
- 🧠 ruv-swarm integration
- 🎯 SPARC development modes
- 🔧 GitHub workflow automation
- 📊 Advanced coordination capabilities
## Documentation
See CLAUDE.md for complete integration instructions.`
}
],
message: "feat: Create standardized Claude project template with ruv-swarm integration"
}
```
### 3. Cross-Repository Synchronization
```javascript
// Synchronize structure across related repositories
const repositories = [
"claude-code-flow",
"ruv-swarm",
"claude-extensions"
]
// Update common files across repositories
repositories.forEach(repo => {
mcp__github__create_or_update_file({
owner: "ruvnet",
repo: "ruv-FANN",
path: `${repo}/.github/workflows/integration.yml`,
content: `name: Integration Tests
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with: { node-version: '20' }
- run: npm install && npm test`,
message: "ci: Standardize integration workflow across repositories",
branch: "structure/standardization"
})
})
```
## Batch Architecture Operations
### Complete Repository Architecture Optimization:
```javascript
[Single Message - Repository Architecture Review]:
// Initialize comprehensive architecture swarm
mcp__claude-flow__swarm_init { topology: "hierarchical", maxAgents: 6 }
mcp__claude-flow__agent_spawn { type: "architect", name: "Senior Architect" }
mcp__claude-flow__agent_spawn { type: "analyst", name: "Structure Analyst" }
mcp__claude-flow__agent_spawn { type: "optimizer", name: "Performance Optimizer" }
mcp__claude-flow__agent_spawn { type: "researcher", name: "Best Practices Researcher" }
mcp__claude-flow__agent_spawn { type: "coordinator", name: "Multi-Repo Coordinator" }
// Analyze current repository structures
LS("/workspaces/ruv-FANN/claude-code-flow/claude-code-flow")
LS("/workspaces/ruv-FANN/ruv-swarm/npm")
Read("/workspaces/ruv-FANN/claude-code-flow/claude-code-flow/package.json")
Read("/workspaces/ruv-FANN/ruv-swarm/npm/package.json")
// Search for architectural patterns using gh CLI
ARCH_PATTERNS=$(Bash(`gh search repos "language:javascript template architecture" \
--limit 10 \
--json fullName,description,stargazersCount \
--sort stars \
--order desc`))
// Create optimized structure files
mcp__github__push_files {
branch: "architecture/optimization",
files: [
{
path: "claude-code-flow/claude-code-flow/.github/ISSUE_TEMPLATE/integration.yml",
content: "[Integration issue template]"
},
{
path: "claude-code-flow/claude-code-flow/.github/PULL_REQUEST_TEMPLATE.md",
content: "[Standardized PR template]"
},
{
path: "claude-code-flow/claude-code-flow/docs/ARCHITECTURE.md",
content: "[Architecture documentation]"
},
{
path: "ruv-swarm/npm/.github/workflows/cross-package-test.yml",
content: "[Cross-package testing workflow]"
}
],
message: "feat: Optimize repository architecture for scalability and maintainability"
}
// Track architecture improvements
TodoWrite { todos: [
{ id: "arch-analysis", content: "Analyze current repository structure", status: "completed", priority: "high" },
{ id: "arch-research", content: "Research best practices and patterns", status: "completed", priority: "medium" },
{ id: "arch-templates", content: "Create standardized templates", status: "completed", priority: "high" },
{ id: "arch-workflows", content: "Implement improved workflows", status: "completed", priority: "medium" },
{ id: "arch-docs", content: "Document architecture decisions", status: "pending", priority: "medium" }
]}
// Store architecture analysis
mcp__claude-flow__memory_usage {
action: "store",
key: "architecture/analysis/results",
value: {
timestamp: Date.now(),
repositories_analyzed: ["claude-code-flow", "ruv-swarm"],
optimization_areas: ["structure", "workflows", "templates", "documentation"],
recommendations: ["standardize_structure", "improve_workflows", "enhance_templates"],
implementation_status: "in_progress"
}
}
```
## Architecture Patterns
### 1. **Monorepo Structure Pattern**
```
ruv-FANN/
├── packages/
│ ├── claude-code-flow/
│ │ ├── src/
│ │ ├── .claude/
│ │ └── package.json
│ ├── ruv-swarm/
│ │ ├── src/
│ │ ├── wasm/
│ │ └── package.json
│ └── shared/
│ ├── types/
│ ├── utils/
│ └── config/
├── tools/
│ ├── build/
│ ├── test/
│ └── deploy/
├── docs/
│ ├── architecture/
│ ├── integration/
│ └── examples/
└── .github/
├── workflows/
├── templates/
└── actions/
```
### 2. **Command Structure Pattern**
```
.claude/
├── commands/
│ ├── github/
│ │ ├── github-modes.md
│ │ ├── pr-manager.md
│ │ ├── issue-tracker.md
│ │ └── sync-coordinator.md
│ ├── sparc/
│ │ ├── sparc-modes.md
│ │ ├── coder.md
│ │ └── tester.md
│ └── swarm/
│ ├── coordination.md
│ └── orchestration.md
├── templates/
│ ├── issue.md
│ ├── pr.md
│ └── project.md
└── config.json
```
### 3. **Integration Pattern**
```javascript
const integrationPattern = {
packages: {
"claude-code-flow": {
role: "orchestration_layer",
dependencies: ["ruv-swarm"],
provides: ["CLI", "workflows", "commands"]
},
"ruv-swarm": {
role: "coordination_engine",
dependencies: [],
provides: ["MCP_tools", "neural_networks", "memory"]
}
},
communication: "MCP_protocol",
coordination: "swarm_based",
state_management: "persistent_memory"
}
```
## Best Practices
### 1. **Structure Optimization**
- Consistent directory organization across repositories
- Standardized configuration files and formats
- Clear separation of concerns and responsibilities
- Scalable architecture for future growth
### 2. **Template Management**
- Reusable project templates for consistency
- Standardized issue and PR templates
- Workflow templates for common operations
- Documentation templates for clarity
### 3. **Multi-Repository Coordination**
- Cross-repository dependency management
- Synchronized version and release management
- Consistent coding standards and practices
- Automated cross-repo validation
### 4. **Documentation Architecture**
- Comprehensive architecture documentation
- Clear integration guides and examples
- Maintainable and up-to-date documentation
- User-friendly onboarding materials
## Monitoring and Analysis
### Architecture Health Metrics:
- Repository structure consistency score
- Documentation coverage percentage
- Cross-repository integration success rate
- Template adoption and usage statistics
### Automated Analysis:
- Structure drift detection
- Best practices compliance checking
- Performance impact analysis
- Scalability assessment and recommendations
## Integration with Development Workflow
### Seamless integration with:
- `/github sync-coordinator` - For cross-repo synchronization
- `/github release-manager` - For coordinated releases
- `/sparc architect` - For detailed architecture design
- `/sparc optimizer` - For performance optimization
### Workflow Enhancement:
- Automated structure validation
- Continuous architecture improvement
- Best practices enforcement
- Documentation generation and maintenance
@@ -0,0 +1,482 @@
# Swarm Issue - Issue-Based Swarm Coordination
## Overview
Transform GitHub Issues into intelligent swarm tasks, enabling automatic task decomposition and agent coordination.
## Core Features
### 1. Issue-to-Swarm Conversion
```bash
# Create swarm from issue using gh CLI
# Get issue details
ISSUE_DATA=$(gh issue view 456 --json title,body,labels,assignees,comments)
# Create swarm from issue
npx ruv-swarm github issue-to-swarm 456 \
--issue-data "$ISSUE_DATA" \
--auto-decompose \
--assign-agents
# Batch process multiple issues
ISSUES=$(gh issue list --label "swarm-ready" --json number,title,body,labels)
npx ruv-swarm github issues-batch \
--issues "$ISSUES" \
--parallel
# Update issues with swarm status
echo "$ISSUES" | jq -r '.[].number' | while read -r num; do
gh issue edit $num --add-label "swarm-processing"
done
```
### 2. Issue Comment Commands
Execute swarm operations via issue comments:
```markdown
<!-- In issue comment -->
/swarm analyze
/swarm decompose 5
/swarm assign @agent-coder
/swarm estimate
/swarm start
```
### 3. Issue Templates for Swarms
```markdown
<!-- .github/ISSUE_TEMPLATE/swarm-task.yml -->
name: Swarm Task
description: Create a task for AI swarm processing
body:
- type: dropdown
id: topology
attributes:
label: Swarm Topology
options:
- mesh
- hierarchical
- ring
- star
- type: input
id: agents
attributes:
label: Required Agents
placeholder: "coder, tester, analyst"
- type: textarea
id: tasks
attributes:
label: Task Breakdown
placeholder: |
1. Task one description
2. Task two description
```
## Issue Label Automation
### Auto-Label Based on Content
```javascript
// .github/swarm-labels.json
{
"rules": [
{
"keywords": ["bug", "error", "broken"],
"labels": ["bug", "swarm-debugger"],
"agents": ["debugger", "tester"]
},
{
"keywords": ["feature", "implement", "add"],
"labels": ["enhancement", "swarm-feature"],
"agents": ["architect", "coder", "tester"]
},
{
"keywords": ["slow", "performance", "optimize"],
"labels": ["performance", "swarm-optimizer"],
"agents": ["analyst", "optimizer"]
}
]
}
```
### Dynamic Agent Assignment
```bash
# Assign agents based on issue content
npx ruv-swarm github issue-analyze 456 \
--suggest-agents \
--estimate-complexity \
--create-subtasks
```
## Issue Swarm Commands
### Initialize from Issue
```bash
# Create swarm with full issue context using gh CLI
# Get complete issue data
ISSUE=$(gh issue view 456 --json title,body,labels,assignees,comments,projectItems)
# Get referenced issues and PRs
REFERENCES=$(gh issue view 456 --json body --jq '.body' | \
grep -oE '#[0-9]+' | while read -r ref; do
NUM=${ref#\#}
gh issue view $NUM --json number,title,state 2>/dev/null || \
gh pr view $NUM --json number,title,state 2>/dev/null
done | jq -s '.')
# Initialize swarm
npx ruv-swarm github issue-init 456 \
--issue-data "$ISSUE" \
--references "$REFERENCES" \
--load-comments \
--analyze-references \
--auto-topology
# Add swarm initialization comment
gh issue comment 456 --body "🐝 Swarm initialized for this issue"
```
### Task Decomposition
```bash
# Break down issue into subtasks with gh CLI
# Get issue body
ISSUE_BODY=$(gh issue view 456 --json body --jq '.body')
# Decompose into subtasks
SUBTASKS=$(npx ruv-swarm github issue-decompose 456 \
--body "$ISSUE_BODY" \
--max-subtasks 10 \
--assign-priorities)
# Update issue with checklist
CHECKLIST=$(echo "$SUBTASKS" | jq -r '.tasks[] | "- [ ] " + .description')
UPDATED_BODY="$ISSUE_BODY
## Subtasks
$CHECKLIST"
gh issue edit 456 --body "$UPDATED_BODY"
# Create linked issues for major subtasks
echo "$SUBTASKS" | jq -r '.tasks[] | select(.priority == "high")' | while read -r task; do
TITLE=$(echo "$task" | jq -r '.title')
BODY=$(echo "$task" | jq -r '.description')
gh issue create \
--title "$TITLE" \
--body "$BODY
Parent issue: #456" \
--label "subtask"
done
```
### Progress Tracking
```bash
# Update issue with swarm progress using gh CLI
# Get current issue state
CURRENT=$(gh issue view 456 --json body,labels)
# Get swarm progress
PROGRESS=$(npx ruv-swarm github issue-progress 456)
# Update checklist in issue body
UPDATED_BODY=$(echo "$CURRENT" | jq -r '.body' | \
npx ruv-swarm github update-checklist --progress "$PROGRESS")
# Edit issue with updated body
gh issue edit 456 --body "$UPDATED_BODY"
# Post progress summary as comment
SUMMARY=$(echo "$PROGRESS" | jq -r '
"## 📊 Progress Update
**Completion**: \(.completion)%
**ETA**: \(.eta)
### Completed Tasks
\(.completed | map("- ✅ " + .) | join("\n"))
### In Progress
\(.in_progress | map("- 🔄 " + .) | join("\n"))
### Remaining
\(.remaining | map("- ⏳ " + .) | join("\n"))
---
🤖 Automated update by swarm agent"')
gh issue comment 456 --body "$SUMMARY"
# Update labels based on progress
if [[ $(echo "$PROGRESS" | jq -r '.completion') -eq 100 ]]; then
gh issue edit 456 --add-label "ready-for-review" --remove-label "in-progress"
fi
```
## Advanced Features
### 1. Issue Dependencies
```bash
# Handle issue dependencies
npx ruv-swarm github issue-deps 456 \
--resolve-order \
--parallel-safe \
--update-blocking
```
### 2. Epic Management
```bash
# Coordinate epic-level swarms
npx ruv-swarm github epic-swarm \
--epic 123 \
--child-issues "456,457,458" \
--orchestrate
```
### 3. Issue Templates
```bash
# Generate issue from swarm analysis
npx ruv-swarm github create-issues \
--from-analysis \
--template "bug-report" \
--auto-assign
```
## Workflow Integration
### GitHub Actions for Issues
```yaml
# .github/workflows/issue-swarm.yml
name: Issue Swarm Handler
on:
issues:
types: [opened, labeled, commented]
jobs:
swarm-process:
runs-on: ubuntu-latest
steps:
- name: Process Issue
uses: ruvnet/swarm-action@v1
with:
command: |
if [[ "${{ github.event.label.name }}" == "swarm-ready" ]]; then
npx ruv-swarm github issue-init ${{ github.event.issue.number }}
fi
```
### Issue Board Integration
```bash
# Sync with project board
npx ruv-swarm github issue-board-sync \
--project "Development" \
--column-mapping '{
"To Do": "pending",
"In Progress": "active",
"Done": "completed"
}'
```
## Issue Types & Strategies
### Bug Reports
```bash
# Specialized bug handling
npx ruv-swarm github bug-swarm 456 \
--reproduce \
--isolate \
--fix \
--test
```
### Feature Requests
```bash
# Feature implementation swarm
npx ruv-swarm github feature-swarm 456 \
--design \
--implement \
--document \
--demo
```
### Technical Debt
```bash
# Refactoring swarm
npx ruv-swarm github debt-swarm 456 \
--analyze-impact \
--plan-migration \
--execute \
--validate
```
## Automation Examples
### Auto-Close Stale Issues
```bash
# Process stale issues with swarm using gh CLI
# Find stale issues
STALE_DATE=$(date -d '30 days ago' --iso-8601)
STALE_ISSUES=$(gh issue list --state open --json number,title,updatedAt,labels \
--jq ".[] | select(.updatedAt < \"$STALE_DATE\")")
# Analyze each stale issue
echo "$STALE_ISSUES" | jq -r '.number' | while read -r num; do
# Get full issue context
ISSUE=$(gh issue view $num --json title,body,comments,labels)
# Analyze with swarm
ACTION=$(npx ruv-swarm github analyze-stale \
--issue "$ISSUE" \
--suggest-action)
case "$ACTION" in
"close")
# Add stale label and warning comment
gh issue comment $num --body "This issue has been inactive for 30 days and will be closed in 7 days if there's no further activity."
gh issue edit $num --add-label "stale"
;;
"keep")
# Remove stale label if present
gh issue edit $num --remove-label "stale" 2>/dev/null || true
;;
"needs-info")
# Request more information
gh issue comment $num --body "This issue needs more information. Please provide additional context or it may be closed as stale."
gh issue edit $num --add-label "needs-info"
;;
esac
done
# Close issues that have been stale for 37+ days
gh issue list --label stale --state open --json number,updatedAt \
--jq ".[] | select(.updatedAt < \"$(date -d '37 days ago' --iso-8601)\") | .number" | \
while read -r num; do
gh issue close $num --comment "Closing due to inactivity. Feel free to reopen if this is still relevant."
done
```
### Issue Triage
```bash
# Automated triage system
npx ruv-swarm github triage \
--unlabeled \
--analyze-content \
--suggest-labels \
--assign-priority
```
### Duplicate Detection
```bash
# Find duplicate issues
npx ruv-swarm github find-duplicates \
--threshold 0.8 \
--link-related \
--close-duplicates
```
## Integration Patterns
### 1. Issue-PR Linking
```bash
# Link issues to PRs automatically
npx ruv-swarm github link-pr \
--issue 456 \
--pr 789 \
--update-both
```
### 2. Milestone Coordination
```bash
# Coordinate milestone swarms
npx ruv-swarm github milestone-swarm \
--milestone "v2.0" \
--parallel-issues \
--track-progress
```
### 3. Cross-Repo Issues
```bash
# Handle issues across repositories
npx ruv-swarm github cross-repo \
--issue "org/repo#456" \
--related "org/other-repo#123" \
--coordinate
```
## Metrics & Analytics
### Issue Resolution Time
```bash
# Analyze swarm performance
npx ruv-swarm github issue-metrics \
--issue 456 \
--metrics "time-to-close,agent-efficiency,subtask-completion"
```
### Swarm Effectiveness
```bash
# Generate effectiveness report
npx ruv-swarm github effectiveness \
--issues "closed:>2024-01-01" \
--compare "with-swarm,without-swarm"
```
## Best Practices
### 1. Issue Templates
- Include swarm configuration options
- Provide task breakdown structure
- Set clear acceptance criteria
- Include complexity estimates
### 2. Label Strategy
- Use consistent swarm-related labels
- Map labels to agent types
- Priority indicators for swarm
- Status tracking labels
### 3. Comment Etiquette
- Clear command syntax
- Progress updates in threads
- Summary comments for decisions
- Link to relevant PRs
## Security & Permissions
1. **Command Authorization**: Validate user permissions before executing commands
2. **Rate Limiting**: Prevent spam and abuse of issue commands
3. **Audit Logging**: Track all swarm operations on issues
4. **Data Privacy**: Respect private repository settings
## Examples
### Complex Bug Investigation
```bash
# Issue #789: Memory leak in production
npx ruv-swarm github issue-init 789 \
--topology hierarchical \
--agents "debugger,analyst,tester,monitor" \
--priority critical \
--reproduce-steps
```
### Feature Implementation
```bash
# Issue #234: Add OAuth integration
npx ruv-swarm github issue-init 234 \
--topology mesh \
--agents "architect,coder,security,tester" \
--create-design-doc \
--estimate-effort
```
### Documentation Update
```bash
# Issue #567: Update API documentation
npx ruv-swarm github issue-init 567 \
--topology ring \
--agents "researcher,writer,reviewer" \
--check-links \
--validate-examples
```
See also: [swarm-pr.md](./swarm-pr.md), [project-board-sync.md](./project-board-sync.md)
@@ -0,0 +1,285 @@
# Swarm PR - Managing Swarms through Pull Requests
## Overview
Create and manage AI swarms directly from GitHub Pull Requests, enabling seamless integration with your development workflow.
## Core Features
### 1. PR-Based Swarm Creation
```bash
# Create swarm from PR description using gh CLI
gh pr view 123 --json body,title,labels,files | npx ruv-swarm swarm create-from-pr
# Auto-spawn agents based on PR labels
gh pr view 123 --json labels | npx ruv-swarm swarm auto-spawn
# Create swarm with PR context
gh pr view 123 --json body,labels,author,assignees | \
npx ruv-swarm swarm init --from-pr-data
```
### 2. PR Comment Commands
Execute swarm commands via PR comments:
```markdown
<!-- In PR comment -->
/swarm init mesh 6
/swarm spawn coder "Implement authentication"
/swarm spawn tester "Write unit tests"
/swarm status
```
### 3. Automated PR Workflows
```yaml
# .github/workflows/swarm-pr.yml
name: Swarm PR Handler
on:
pull_request:
types: [opened, labeled]
issue_comment:
types: [created]
jobs:
swarm-handler:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Handle Swarm Command
run: |
if [[ "${{ github.event.comment.body }}" == /swarm* ]]; then
npx ruv-swarm github handle-comment \
--pr ${{ github.event.pull_request.number }} \
--comment "${{ github.event.comment.body }}"
fi
```
## PR Label Integration
### Automatic Agent Assignment
Map PR labels to agent types:
```json
{
"label-mapping": {
"bug": ["debugger", "tester"],
"feature": ["architect", "coder", "tester"],
"refactor": ["analyst", "coder"],
"docs": ["researcher", "writer"],
"performance": ["analyst", "optimizer"]
}
}
```
### Label-Based Topology
```bash
# Small PR (< 100 lines): ring topology
# Medium PR (100-500 lines): mesh topology
# Large PR (> 500 lines): hierarchical topology
npx ruv-swarm github pr-topology --pr 123
```
## PR Swarm Commands
### Initialize from PR
```bash
# Create swarm with PR context using gh CLI
PR_DIFF=$(gh pr diff 123)
PR_INFO=$(gh pr view 123 --json title,body,labels,files,reviews)
npx ruv-swarm github pr-init 123 \
--auto-agents \
--pr-data "$PR_INFO" \
--diff "$PR_DIFF" \
--analyze-impact
```
### Progress Updates
```bash
# Post swarm progress to PR using gh CLI
PROGRESS=$(npx ruv-swarm github pr-progress 123 --format markdown)
gh pr comment 123 --body "$PROGRESS"
# Update PR labels based on progress
if [[ $(echo "$PROGRESS" | grep -o '[0-9]\+%' | sed 's/%//') -gt 90 ]]; then
gh pr edit 123 --add-label "ready-for-review"
fi
```
### Code Review Integration
```bash
# Create review agents with gh CLI integration
PR_FILES=$(gh pr view 123 --json files --jq '.files[].path')
# Run swarm review
REVIEW_RESULTS=$(npx ruv-swarm github pr-review 123 \
--agents "security,performance,style" \
--files "$PR_FILES")
# Post review comments using gh CLI
echo "$REVIEW_RESULTS" | jq -r '.comments[]' | while read -r comment; do
FILE=$(echo "$comment" | jq -r '.file')
LINE=$(echo "$comment" | jq -r '.line')
BODY=$(echo "$comment" | jq -r '.body')
gh pr review 123 --comment --body "$BODY"
done
```
## Advanced Features
### 1. Multi-PR Swarm Coordination
```bash
# Coordinate swarms across related PRs
npx ruv-swarm github multi-pr \
--prs "123,124,125" \
--strategy "parallel" \
--share-memory
```
### 2. PR Dependency Analysis
```bash
# Analyze PR dependencies
npx ruv-swarm github pr-deps 123 \
--spawn-agents \
--resolve-conflicts
```
### 3. Automated PR Fixes
```bash
# Auto-fix PR issues
npx ruv-swarm github pr-fix 123 \
--issues "lint,test-failures" \
--commit-fixes
```
## Best Practices
### 1. PR Templates
```markdown
<!-- .github/pull_request_template.md -->
## Swarm Configuration
- Topology: [mesh/hierarchical/ring/star]
- Max Agents: [number]
- Auto-spawn: [yes/no]
- Priority: [high/medium/low]
## Tasks for Swarm
- [ ] Task 1 description
- [ ] Task 2 description
```
### 2. Status Checks
```yaml
# Require swarm completion before merge
required_status_checks:
contexts:
- "swarm/tasks-complete"
- "swarm/tests-pass"
- "swarm/review-approved"
```
### 3. PR Merge Automation
```bash
# Auto-merge when swarm completes using gh CLI
# Check swarm completion status
SWARM_STATUS=$(npx ruv-swarm github pr-status 123)
if [[ "$SWARM_STATUS" == "complete" ]]; then
# Check review requirements
REVIEWS=$(gh pr view 123 --json reviews --jq '.reviews | length')
if [[ $REVIEWS -ge 2 ]]; then
# Enable auto-merge
gh pr merge 123 --auto --squash
fi
fi
```
## Webhook Integration
### Setup Webhook Handler
```javascript
// webhook-handler.js
const { createServer } = require('http');
const { execSync } = require('child_process');
createServer((req, res) => {
if (req.url === '/github-webhook') {
const event = JSON.parse(body);
if (event.action === 'opened' && event.pull_request) {
execSync(`npx ruv-swarm github pr-init ${event.pull_request.number}`);
}
res.writeHead(200);
res.end('OK');
}
}).listen(3000);
```
## Examples
### Feature Development PR
```bash
# PR #456: Add user authentication
npx ruv-swarm github pr-init 456 \
--topology hierarchical \
--agents "architect,coder,tester,security" \
--auto-assign-tasks
```
### Bug Fix PR
```bash
# PR #789: Fix memory leak
npx ruv-swarm github pr-init 789 \
--topology mesh \
--agents "debugger,analyst,tester" \
--priority high
```
### Documentation PR
```bash
# PR #321: Update API docs
npx ruv-swarm github pr-init 321 \
--topology ring \
--agents "researcher,writer,reviewer" \
--validate-links
```
## Metrics & Reporting
### PR Swarm Analytics
```bash
# Generate PR swarm report
npx ruv-swarm github pr-report 123 \
--metrics "completion-time,agent-efficiency,token-usage" \
--format markdown
```
### Dashboard Integration
```bash
# Export to GitHub Insights
npx ruv-swarm github export-metrics \
--pr 123 \
--to-insights
```
## Security Considerations
1. **Token Permissions**: Ensure GitHub tokens have appropriate scopes
2. **Command Validation**: Validate all PR comments before execution
3. **Rate Limiting**: Implement rate limits for PR operations
4. **Audit Trail**: Log all swarm operations for compliance
## Integration with Claude Code
When using with Claude Code:
1. Claude Code reads PR diff and context
2. Swarm coordinates approach based on PR type
3. Agents work in parallel on different aspects
4. Progress updates posted to PR automatically
5. Final review performed before marking ready
See also: [swarm-issue.md](./swarm-issue.md), [workflow-automation.md](./workflow-automation.md)
@@ -0,0 +1,301 @@
# GitHub Sync Coordinator
## Purpose
Multi-package synchronization and version alignment with ruv-swarm coordination for seamless integration between claude-code-flow and ruv-swarm packages.
## Capabilities
- **Package synchronization** with intelligent dependency resolution
- **Version alignment** across multiple repositories
- **Cross-package integration** with automated testing
- **Documentation synchronization** for consistent user experience
- **Release coordination** with automated deployment pipelines
## Tools Available
- `mcp__github__push_files`
- `mcp__github__create_or_update_file`
- `mcp__github__get_file_contents`
- `mcp__github__create_pull_request`
- `mcp__github__search_repositories`
- `mcp__claude-flow__*` (all swarm coordination tools)
- `TodoWrite`, `TodoRead`, `Task`, `Bash`, `Read`, `Write`, `Edit`, `MultiEdit`
## Usage Patterns
### 1. Synchronize Package Dependencies
```javascript
// Initialize sync coordination swarm
mcp__claude-flow__swarm_init { topology: "hierarchical", maxAgents: 5 }
mcp__claude-flow__agent_spawn { type: "coordinator", name: "Sync Coordinator" }
mcp__claude-flow__agent_spawn { type: "analyst", name: "Dependency Analyzer" }
mcp__claude-flow__agent_spawn { type: "coder", name: "Integration Developer" }
mcp__claude-flow__agent_spawn { type: "tester", name: "Validation Engineer" }
// Analyze current package states
Read("/workspaces/ruv-FANN/claude-code-flow/claude-code-flow/package.json")
Read("/workspaces/ruv-FANN/ruv-swarm/npm/package.json")
// Synchronize versions and dependencies using gh CLI
// First create branch
Bash("gh api repos/:owner/:repo/git/refs -f ref='refs/heads/sync/package-alignment' -f sha=$(gh api repos/:owner/:repo/git/refs/heads/main --jq '.object.sha')")
// Update file using gh CLI
Bash(`gh api repos/:owner/:repo/contents/claude-code-flow/claude-code-flow/package.json \
--method PUT \
-f message="feat: Align Node.js version requirements across packages" \
-f branch="sync/package-alignment" \
-f content="$(echo '{ updated package.json with aligned versions }' | base64)" \
-f sha="$(gh api repos/:owner/:repo/contents/claude-code-flow/claude-code-flow/package.json?ref=sync/package-alignment --jq '.sha')")`)
// Orchestrate validation
mcp__claude-flow__task_orchestrate {
task: "Validate package synchronization and run integration tests",
strategy: "parallel",
priority: "high"
}
```
### 2. Documentation Synchronization
```javascript
// Synchronize CLAUDE.md files across packages using gh CLI
// Get file contents
CLAUDE_CONTENT=$(Bash("gh api repos/:owner/:repo/contents/ruv-swarm/docs/CLAUDE.md --jq '.content' | base64 -d"))
// Update claude-code-flow CLAUDE.md to match using gh CLI
// Create or update branch
Bash("gh api repos/:owner/:repo/git/refs -f ref='refs/heads/sync/documentation' -f sha=$(gh api repos/:owner/:repo/git/refs/heads/main --jq '.object.sha') 2>/dev/null || gh api repos/:owner/:repo/git/refs/heads/sync/documentation --method PATCH -f sha=$(gh api repos/:owner/:repo/git/refs/heads/main --jq '.object.sha')")
// Update file
Bash(`gh api repos/:owner/:repo/contents/claude-code-flow/claude-code-flow/CLAUDE.md \
--method PUT \
-f message="docs: Synchronize CLAUDE.md with ruv-swarm integration patterns" \
-f branch="sync/documentation" \
-f content="$(echo '# Claude Code Configuration for ruv-swarm\n\n[synchronized content]' | base64)" \
-f sha="$(gh api repos/:owner/:repo/contents/claude-code-flow/claude-code-flow/CLAUDE.md?ref=sync/documentation --jq '.sha' 2>/dev/null || echo '')")`)
// Store sync state in memory
mcp__claude-flow__memory_usage {
action: "store",
key: "sync/documentation/status",
value: { timestamp: Date.now(), status: "synchronized", files: ["CLAUDE.md"] }
}
```
### 3. Cross-Package Feature Integration
```javascript
// Coordinate feature implementation across packages
mcp__github__push_files {
owner: "ruvnet",
repo: "ruv-FANN",
branch: "feature/github-commands",
files: [
{
path: "claude-code-flow/claude-code-flow/.claude/commands/github/github-modes.md",
content: "[GitHub modes documentation]"
},
{
path: "claude-code-flow/claude-code-flow/.claude/commands/github/pr-manager.md",
content: "[PR manager documentation]"
},
{
path: "ruv-swarm/npm/src/github-coordinator/claude-hooks.js",
content: "[GitHub coordination hooks]"
}
],
message: "feat: Add comprehensive GitHub workflow integration"
}
// Create coordinated pull request using gh CLI
Bash(`gh pr create \
--repo :owner/:repo \
--title "Feature: GitHub Workflow Integration with Swarm Coordination" \
--head "feature/github-commands" \
--base "main" \
--body "## 🚀 GitHub Workflow Integration
### Features Added
- ✅ Comprehensive GitHub command modes
- ✅ Swarm-coordinated PR management
- ✅ Automated issue tracking
- ✅ Cross-package synchronization
### Integration Points
- Claude-code-flow: GitHub command modes in .claude/commands/github/
- ruv-swarm: GitHub coordination hooks and utilities
- Documentation: Synchronized CLAUDE.md instructions
### Testing
- [x] Package dependency verification
- [x] Integration test suite
- [x] Documentation validation
- [x] Cross-package compatibility
### Swarm Coordination
This integration uses ruv-swarm agents for:
- Multi-agent GitHub workflow management
- Automated testing and validation
- Progress tracking and coordination
- Memory-based state management
---
🤖 Generated with Claude Code using ruv-swarm coordination`
}
```
## Batch Synchronization Example
### Complete Package Sync Workflow:
```javascript
[Single Message - Complete Synchronization]:
// Initialize comprehensive sync swarm
mcp__claude-flow__swarm_init { topology: "mesh", maxAgents: 6 }
mcp__claude-flow__agent_spawn { type: "coordinator", name: "Master Sync Coordinator" }
mcp__claude-flow__agent_spawn { type: "analyst", name: "Package Analyzer" }
mcp__claude-flow__agent_spawn { type: "coder", name: "Integration Coder" }
mcp__claude-flow__agent_spawn { type: "tester", name: "Validation Tester" }
mcp__claude-flow__agent_spawn { type: "reviewer", name: "Quality Reviewer" }
// Read current state of both packages
Read("/workspaces/ruv-FANN/claude-code-flow/claude-code-flow/package.json")
Read("/workspaces/ruv-FANN/ruv-swarm/npm/package.json")
Read("/workspaces/ruv-FANN/claude-code-flow/claude-code-flow/CLAUDE.md")
Read("/workspaces/ruv-FANN/ruv-swarm/docs/CLAUDE.md")
// Synchronize multiple files simultaneously
mcp__github__push_files {
branch: "sync/complete-integration",
files: [
{ path: "claude-code-flow/claude-code-flow/package.json", content: "[aligned package.json]" },
{ path: "claude-code-flow/claude-code-flow/CLAUDE.md", content: "[synchronized CLAUDE.md]" },
{ path: "claude-code-flow/claude-code-flow/.claude/commands/github/github-modes.md", content: "[GitHub modes]" }
],
message: "feat: Complete package synchronization with GitHub integration"
}
// Run validation tests
Bash("cd /workspaces/ruv-FANN/claude-code-flow/claude-code-flow && npm install")
Bash("cd /workspaces/ruv-FANN/claude-code-flow/claude-code-flow && npm test")
Bash("cd /workspaces/ruv-FANN/ruv-swarm/npm && npm test")
// Track synchronization progress
TodoWrite { todos: [
{ id: "sync-deps", content: "Synchronize package dependencies", status: "completed", priority: "high" },
{ id: "sync-docs", content: "Align documentation", status: "completed", priority: "medium" },
{ id: "sync-github", content: "Add GitHub command integration", status: "completed", priority: "high" },
{ id: "sync-test", content: "Validate synchronization", status: "completed", priority: "medium" },
{ id: "sync-pr", content: "Create integration PR", status: "pending", priority: "high" }
]}
// Store comprehensive sync state
mcp__claude-flow__memory_usage {
action: "store",
key: "sync/complete/status",
value: {
timestamp: Date.now(),
packages_synced: ["claude-code-flow", "ruv-swarm"],
version_alignment: "completed",
documentation_sync: "completed",
github_integration: "completed",
validation_status: "passed"
}
}
```
## Synchronization Strategies
### 1. **Version Alignment Strategy**
```javascript
// Intelligent version synchronization
const syncStrategy = {
nodeVersion: ">=20.0.0", // Align to highest requirement
dependencies: {
"better-sqlite3": "^12.2.0", // Use latest stable
"ws": "^8.14.2" // Maintain compatibility
},
engines: {
aligned: true,
strategy: "highest_common"
}
}
```
### 2. **Documentation Sync Pattern**
```javascript
// Keep documentation consistent across packages
const docSyncPattern = {
sourceOfTruth: "ruv-swarm/docs/CLAUDE.md",
targets: [
"claude-code-flow/claude-code-flow/CLAUDE.md",
"CLAUDE.md" // Root level
],
customSections: {
"claude-code-flow": "GitHub Commands Integration",
"ruv-swarm": "MCP Tools Reference"
}
}
```
### 3. **Integration Testing Matrix**
```javascript
// Comprehensive testing across synchronized packages
const testMatrix = {
packages: ["claude-code-flow", "ruv-swarm"],
tests: [
"unit_tests",
"integration_tests",
"cross_package_tests",
"mcp_integration_tests",
"github_workflow_tests"
],
validation: "parallel_execution"
}
```
## Best Practices
### 1. **Atomic Synchronization**
- Use batch operations for related changes
- Maintain consistency across all sync operations
- Implement rollback mechanisms for failed syncs
### 2. **Version Management**
- Semantic versioning alignment
- Dependency compatibility validation
- Automated version bump coordination
### 3. **Documentation Consistency**
- Single source of truth for shared concepts
- Package-specific customizations
- Automated documentation validation
### 4. **Testing Integration**
- Cross-package test validation
- Integration test automation
- Performance regression detection
## Monitoring and Metrics
### Sync Quality Metrics:
- Package version alignment percentage
- Documentation consistency score
- Integration test success rate
- Synchronization completion time
### Automated Reporting:
- Weekly sync status reports
- Dependency drift detection
- Documentation divergence alerts
- Integration health monitoring
## Error Handling and Recovery
### Automatic handling of:
- Version conflict resolution
- Merge conflict detection and resolution
- Test failure recovery strategies
- Documentation sync conflicts
### Recovery procedures:
- Automated rollback on critical failures
- Incremental sync retry mechanisms
- Manual intervention points for complex conflicts
- State preservation across sync operations
@@ -0,0 +1,442 @@
# Workflow Automation - GitHub Actions Integration
## Overview
Integrate AI swarms with GitHub Actions to create intelligent, self-organizing CI/CD pipelines that adapt to your codebase.
## Core Features
### 1. Swarm-Powered Actions
```yaml
# .github/workflows/swarm-ci.yml
name: Intelligent CI with Swarms
on: [push, pull_request]
jobs:
swarm-analysis:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Initialize Swarm
uses: ruvnet/swarm-action@v1
with:
topology: mesh
max-agents: 6
- name: Analyze Changes
run: |
npx ruv-swarm actions analyze \
--commit ${{ github.sha }} \
--suggest-tests \
--optimize-pipeline
```
### 2. Dynamic Workflow Generation
```bash
# Generate workflows based on code analysis
npx ruv-swarm actions generate-workflow \
--analyze-codebase \
--detect-languages \
--create-optimal-pipeline
```
### 3. Intelligent Test Selection
```yaml
# Smart test runner
- name: Swarm Test Selection
run: |
npx ruv-swarm actions smart-test \
--changed-files ${{ steps.files.outputs.all }} \
--impact-analysis \
--parallel-safe
```
## Workflow Templates
### Multi-Language Detection
```yaml
# .github/workflows/polyglot-swarm.yml
name: Polyglot Project Handler
on: push
jobs:
detect-and-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Detect Languages
id: detect
run: |
npx ruv-swarm actions detect-stack \
--output json > stack.json
- name: Dynamic Build Matrix
run: |
npx ruv-swarm actions create-matrix \
--from stack.json \
--parallel-builds
```
### Adaptive Security Scanning
```yaml
# .github/workflows/security-swarm.yml
name: Intelligent Security Scan
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
security-swarm:
runs-on: ubuntu-latest
steps:
- name: Security Analysis Swarm
run: |
# Use gh CLI for issue creation
SECURITY_ISSUES=$(npx ruv-swarm actions security \
--deep-scan \
--format json)
# Create issues for complex security problems
echo "$SECURITY_ISSUES" | jq -r '.issues[]? | @base64' | while read -r issue; do
_jq() {
echo ${issue} | base64 --decode | jq -r ${1}
}
gh issue create \
--title "$(_jq '.title')" \
--body "$(_jq '.body')" \
--label "security,critical"
done
```
## Action Commands
### Pipeline Optimization
```bash
# Optimize existing workflows
npx ruv-swarm actions optimize \
--workflow ".github/workflows/ci.yml" \
--suggest-parallelization \
--reduce-redundancy \
--estimate-savings
```
### Failure Analysis
```bash
# Analyze failed runs using gh CLI
gh run view ${{ github.run_id }} --json jobs,conclusion | \
npx ruv-swarm actions analyze-failure \
--suggest-fixes \
--auto-retry-flaky
# Create issue for persistent failures
if [ $? -ne 0 ]; then
gh issue create \
--title "CI Failure: Run ${{ github.run_id }}" \
--body "Automated analysis detected persistent failures" \
--label "ci-failure"
fi
```
### Resource Management
```bash
# Optimize resource usage
npx ruv-swarm actions resources \
--analyze-usage \
--suggest-runners \
--cost-optimize
```
## Advanced Workflows
### 1. Self-Healing CI/CD
```yaml
# Auto-fix common CI failures
name: Self-Healing Pipeline
on: workflow_run
jobs:
heal-pipeline:
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
runs-on: ubuntu-latest
steps:
- name: Diagnose and Fix
run: |
npx ruv-swarm actions self-heal \
--run-id ${{ github.event.workflow_run.id }} \
--auto-fix-common \
--create-pr-complex
```
### 2. Progressive Deployment
```yaml
# Intelligent deployment strategy
name: Smart Deployment
on:
push:
branches: [main]
jobs:
progressive-deploy:
runs-on: ubuntu-latest
steps:
- name: Analyze Risk
id: risk
run: |
npx ruv-swarm actions deploy-risk \
--changes ${{ github.sha }} \
--history 30d
- name: Choose Strategy
run: |
npx ruv-swarm actions deploy-strategy \
--risk ${{ steps.risk.outputs.level }} \
--auto-execute
```
### 3. Performance Regression Detection
```yaml
# Automatic performance testing
name: Performance Guard
on: pull_request
jobs:
perf-swarm:
runs-on: ubuntu-latest
steps:
- name: Performance Analysis
run: |
npx ruv-swarm actions perf-test \
--baseline main \
--threshold 10% \
--auto-profile-regression
```
## Custom Actions
### Swarm Action Development
```javascript
// action.yml
name: 'Swarm Custom Action'
description: 'Custom swarm-powered action'
inputs:
task:
description: 'Task for swarm'
required: true
runs:
using: 'node16'
main: 'dist/index.js'
// index.js
const { SwarmAction } = require('ruv-swarm');
async function run() {
const swarm = new SwarmAction({
topology: 'mesh',
agents: ['analyzer', 'optimizer']
});
await swarm.execute(core.getInput('task'));
}
```
## Matrix Strategies
### Dynamic Test Matrix
```yaml
# Generate test matrix from code analysis
jobs:
generate-matrix:
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
MATRIX=$(npx ruv-swarm actions test-matrix \
--detect-frameworks \
--optimize-coverage)
echo "matrix=${MATRIX}" >> $GITHUB_OUTPUT
test:
needs: generate-matrix
strategy:
matrix: ${{fromJson(needs.generate-matrix.outputs.matrix)}}
```
### Intelligent Parallelization
```bash
# Determine optimal parallelization
npx ruv-swarm actions parallel-strategy \
--analyze-dependencies \
--time-estimates \
--cost-aware
```
## Monitoring & Insights
### Workflow Analytics
```bash
# Analyze workflow performance
npx ruv-swarm actions analytics \
--workflow "ci.yml" \
--period 30d \
--identify-bottlenecks \
--suggest-improvements
```
### Cost Optimization
```bash
# Optimize GitHub Actions costs
npx ruv-swarm actions cost-optimize \
--analyze-usage \
--suggest-caching \
--recommend-self-hosted
```
### Failure Patterns
```bash
# Identify failure patterns
npx ruv-swarm actions failure-patterns \
--period 90d \
--classify-failures \
--suggest-preventions
```
## Integration Examples
### 1. PR Validation Swarm
```yaml
name: PR Validation Swarm
on: pull_request
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Multi-Agent Validation
run: |
# Get PR details using gh CLI
PR_DATA=$(gh pr view ${{ github.event.pull_request.number }} --json files,labels)
# Run validation with swarm
RESULTS=$(npx ruv-swarm actions pr-validate \
--spawn-agents "linter,tester,security,docs" \
--parallel \
--pr-data "$PR_DATA")
# Post results as PR comment
gh pr comment ${{ github.event.pull_request.number }} \
--body "$RESULTS"
```
### 2. Release Automation
```yaml
name: Intelligent Release
on:
push:
tags: ['v*']
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Release Swarm
run: |
npx ruv-swarm actions release \
--analyze-changes \
--generate-notes \
--create-artifacts \
--publish-smart
```
### 3. Documentation Updates
```yaml
name: Auto Documentation
on:
push:
paths: ['src/**']
jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Documentation Swarm
run: |
npx ruv-swarm actions update-docs \
--analyze-changes \
--update-api-docs \
--check-examples
```
## Best Practices
### 1. Workflow Organization
- Use reusable workflows for swarm operations
- Implement proper caching strategies
- Set appropriate timeouts
- Use workflow dependencies wisely
### 2. Security
- Store swarm configs in secrets
- Use OIDC for authentication
- Implement least-privilege principles
- Audit swarm operations
### 3. Performance
- Cache swarm dependencies
- Use appropriate runner sizes
- Implement early termination
- Optimize parallel execution
## Advanced Features
### Predictive Failures
```bash
# Predict potential failures
npx ruv-swarm actions predict \
--analyze-history \
--identify-risks \
--suggest-preventive
```
### Workflow Recommendations
```bash
# Get workflow recommendations
npx ruv-swarm actions recommend \
--analyze-repo \
--suggest-workflows \
--industry-best-practices
```
### Automated Optimization
```bash
# Continuously optimize workflows
npx ruv-swarm actions auto-optimize \
--monitor-performance \
--apply-improvements \
--track-savings
```
## Debugging & Troubleshooting
### Debug Mode
```yaml
- name: Debug Swarm
run: |
npx ruv-swarm actions debug \
--verbose \
--trace-agents \
--export-logs
```
### Performance Profiling
```bash
# Profile workflow performance
npx ruv-swarm actions profile \
--workflow "ci.yml" \
--identify-slow-steps \
--suggest-optimizations
```
See also: [swarm-pr.md](./swarm-pr.md), [release-swarm.md](./release-swarm.md)
@@ -0,0 +1,17 @@
# Hive-mind Commands
Commands for hive-mind operations in Claude Flow.
## Available Commands
- [hive-mind](./hive-mind.md)
- [hive-mind-init](./hive-mind-init.md)
- [hive-mind-spawn](./hive-mind-spawn.md)
- [hive-mind-status](./hive-mind-status.md)
- [hive-mind-resume](./hive-mind-resume.md)
- [hive-mind-stop](./hive-mind-stop.md)
- [hive-mind-sessions](./hive-mind-sessions.md)
- [hive-mind-consensus](./hive-mind-consensus.md)
- [hive-mind-memory](./hive-mind-memory.md)
- [hive-mind-metrics](./hive-mind-metrics.md)
- [hive-mind-wizard](./hive-mind-wizard.md)
@@ -0,0 +1,8 @@
# hive-mind-consensus
Command documentation for hive-mind-consensus in category hive-mind.
Usage:
```bash
npx claude-flow hive-mind hive-mind-consensus [options]
```
@@ -0,0 +1,18 @@
# hive-mind-init
Initialize the Hive Mind collective intelligence system.
## Usage
```bash
npx claude-flow hive-mind init [options]
```
## Options
- `--force` - Force reinitialize
- `--config <file>` - Configuration file
## Examples
```bash
npx claude-flow hive-mind init
npx claude-flow hive-mind init --force
```
@@ -0,0 +1,8 @@
# hive-mind-memory
Command documentation for hive-mind-memory in category hive-mind.
Usage:
```bash
npx claude-flow hive-mind hive-mind-memory [options]
```
@@ -0,0 +1,8 @@
# hive-mind-metrics
Command documentation for hive-mind-metrics in category hive-mind.
Usage:
```bash
npx claude-flow hive-mind hive-mind-metrics [options]
```
@@ -0,0 +1,8 @@
# hive-mind-resume
Command documentation for hive-mind-resume in category hive-mind.
Usage:
```bash
npx claude-flow hive-mind hive-mind-resume [options]
```
@@ -0,0 +1,8 @@
# hive-mind-sessions
Command documentation for hive-mind-sessions in category hive-mind.
Usage:
```bash
npx claude-flow hive-mind hive-mind-sessions [options]
```
@@ -0,0 +1,21 @@
# hive-mind-spawn
Spawn a Hive Mind swarm with queen-led coordination.
## Usage
```bash
npx claude-flow hive-mind spawn <objective> [options]
```
## Options
- `--queen-type <type>` - Queen type (strategic, tactical, adaptive)
- `--max-workers <n>` - Maximum worker agents
- `--consensus <type>` - Consensus algorithm
- `--claude` - Generate Claude Code spawn commands
## Examples
```bash
npx claude-flow hive-mind spawn "Build API"
npx claude-flow hive-mind spawn "Research patterns" --queen-type adaptive
npx claude-flow hive-mind spawn "Build service" --claude
```
@@ -0,0 +1,8 @@
# hive-mind-status
Command documentation for hive-mind-status in category hive-mind.
Usage:
```bash
npx claude-flow hive-mind hive-mind-status [options]
```
@@ -0,0 +1,8 @@
# hive-mind-stop
Command documentation for hive-mind-stop in category hive-mind.
Usage:
```bash
npx claude-flow hive-mind hive-mind-stop [options]
```
@@ -0,0 +1,8 @@
# hive-mind-wizard
Command documentation for hive-mind-wizard in category hive-mind.
Usage:
```bash
npx claude-flow hive-mind hive-mind-wizard [options]
```
@@ -0,0 +1,27 @@
# hive-mind
Hive Mind collective intelligence system for advanced swarm coordination.
## Usage
```bash
npx claude-flow hive-mind [subcommand] [options]
```
## Subcommands
- `init` - Initialize hive mind system
- `spawn` - Spawn hive mind swarm
- `status` - Show hive mind status
- `resume` - Resume paused session
- `stop` - Stop running session
## Examples
```bash
# Initialize hive mind
npx claude-flow hive-mind init
# Spawn swarm
npx claude-flow hive-mind spawn "Build microservices"
# Check status
npx claude-flow hive-mind status
```
@@ -0,0 +1,11 @@
# Hooks Commands
Commands for hooks operations in Claude Flow.
## Available Commands
- [pre-task](./pre-task.md)
- [post-task](./post-task.md)
- [pre-edit](./pre-edit.md)
- [post-edit](./post-edit.md)
- [session-end](./session-end.md)
@@ -0,0 +1,58 @@
# Claude Code Hooks for claude-flow
## Purpose
Automatically coordinate, format, and learn from Claude Code operations using hooks.
## Available Hooks
### Pre-Operation Hooks
- **pre-edit**: Validate and assign agents before file modifications
- **pre-bash**: Check command safety and resource requirements
- **pre-task**: Auto-spawn agents for complex tasks
### Post-Operation Hooks
- **post-edit**: Auto-format code and train neural patterns
- **post-bash**: Log execution and update metrics
- **post-search**: Cache results and improve search patterns
### MCP Integration Hooks
- **mcp-initialized**: Persist swarm configuration
- **agent-spawned**: Update agent roster
- **task-orchestrated**: Monitor task progress
- **neural-trained**: Save pattern improvements
### Session Hooks
- **notify**: Custom notifications with swarm status
- **session-end**: Generate summary and save state
- **session-restore**: Load previous session state
## Configuration
Hooks are configured in `.claude/settings.json`:
```json
{
"hooks": {
"PreToolUse": [
{
"matcher": "^(Write|Edit|MultiEdit)$",
"hooks": [{
"type": "command",
"command": "npx claude-flow hook pre-edit --file '${tool.params.file_path}'"
}]
}
]
}
}
```
## Benefits
- 🤖 Automatic agent assignment based on file type
- 🎨 Consistent code formatting
- 🧠 Continuous neural pattern improvement
- 💾 Cross-session memory persistence
- 📊 Performance metrics tracking
## See Also
- [Pre-Edit Hook](./pre-edit.md)
- [Post-Edit Hook](./post-edit.md)
- [Session End Hook](./session-end.md)
@@ -0,0 +1,117 @@
# hook post-edit
Execute post-edit processing including formatting, validation, and memory updates.
## Usage
```bash
npx claude-flow hook post-edit [options]
```
## Options
- `--file, -f <path>` - File path that was edited
- `--auto-format` - Automatically format code (default: true)
- `--memory-key, -m <key>` - Store edit context in memory
- `--train-patterns` - Train neural patterns from edit
- `--validate-output` - Validate edited file
## Examples
### Basic post-edit hook
```bash
npx claude-flow hook post-edit --file "src/components/Button.jsx"
```
### With memory storage
```bash
npx claude-flow hook post-edit -f "api/auth.js" --memory-key "auth/login-implementation"
```
### Format and validate
```bash
npx claude-flow hook post-edit -f "config/webpack.js" --auto-format --validate-output
```
### Neural training
```bash
npx claude-flow hook post-edit -f "utils/helpers.ts" --train-patterns --memory-key "utils/refactor"
```
## Features
### Auto Formatting
- Language-specific formatters
- Prettier for JS/TS/JSON
- Black for Python
- gofmt for Go
- Maintains consistency
### Memory Storage
- Saves edit context
- Records decisions made
- Tracks implementation details
- Enables knowledge sharing
### Pattern Training
- Learns from successful edits
- Improves future suggestions
- Adapts to coding style
- Enhances coordination
### Output Validation
- Checks syntax correctness
- Runs linting rules
- Validates formatting
- Ensures quality
## Integration
This hook is automatically called by Claude Code when:
- After Edit tool completes
- Following MultiEdit operations
- During file saves
- After code generation
Manual usage in agents:
```bash
# After editing files
npx claude-flow hook post-edit --file "path/to/edited.js" --memory-key "feature/step1"
```
## Output
Returns JSON with:
```json
{
"file": "src/components/Button.jsx",
"formatted": true,
"formatterUsed": "prettier",
"lintPassed": true,
"memorySaved": "component/button-refactor",
"patternsTrained": 3,
"warnings": [],
"stats": {
"linesChanged": 45,
"charactersAdded": 234
}
}
```
## See Also
- `hook pre-edit` - Pre-edit preparation
- `Edit` - File editing tool
- `memory usage` - Memory management
- `neural train` - Pattern training
@@ -0,0 +1,112 @@
# hook post-task
Execute post-task cleanup, performance analysis, and memory storage.
## Usage
```bash
npx claude-flow hook post-task [options]
```
## Options
- `--task-id, -t <id>` - Task identifier for tracking
- `--analyze-performance` - Generate performance metrics (default: true)
- `--store-decisions` - Save task decisions to memory
- `--export-learnings` - Export neural pattern learnings
- `--generate-report` - Create task completion report
## Examples
### Basic post-task hook
```bash
npx claude-flow hook post-task --task-id "auth-implementation"
```
### With full analysis
```bash
npx claude-flow hook post-task -t "api-refactor" --analyze-performance --generate-report
```
### Memory storage
```bash
npx claude-flow hook post-task -t "bug-fix-123" --store-decisions --export-learnings
```
### Quick cleanup
```bash
npx claude-flow hook post-task -t "minor-update" --analyze-performance false
```
## Features
### Performance Analysis
- Measures execution time
- Tracks token usage
- Identifies bottlenecks
- Suggests optimizations
### Decision Storage
- Saves key decisions made
- Records implementation choices
- Stores error resolutions
- Maintains knowledge base
### Neural Learning
- Exports successful patterns
- Updates coordination models
- Improves future performance
- Trains on task outcomes
### Report Generation
- Creates completion summary
- Documents changes made
- Lists files modified
- Tracks metrics achieved
## Integration
This hook is automatically called by Claude Code when:
- Completing a task
- Switching to a new task
- Ending a work session
- After major milestones
Manual usage in agents:
```bash
# In agent coordination
npx claude-flow hook post-task --task-id "your-task-id" --analyze-performance true
```
## Output
Returns JSON with:
```json
{
"taskId": "auth-implementation",
"duration": 1800000,
"tokensUsed": 45000,
"filesModified": 12,
"performanceScore": 0.92,
"learningsExported": true,
"reportPath": "/reports/task-auth-implementation.md"
}
```
## See Also
- `hook pre-task` - Pre-task setup
- `performance report` - Detailed metrics
- `memory usage` - Memory management
- `neural patterns` - Pattern analysis
@@ -0,0 +1,113 @@
# hook pre-edit
Execute pre-edit validations and agent assignment before file modifications.
## Usage
```bash
npx claude-flow hook pre-edit [options]
```
## Options
- `--file, -f <path>` - File path to be edited
- `--auto-assign-agent` - Automatically assign best agent (default: true)
- `--validate-syntax` - Pre-validate syntax before edit
- `--check-conflicts` - Check for merge conflicts
- `--backup-file` - Create backup before editing
## Examples
### Basic pre-edit hook
```bash
npx claude-flow hook pre-edit --file "src/auth/login.js"
```
### With validation
```bash
npx claude-flow hook pre-edit -f "config/database.js" --validate-syntax
```
### Manual agent assignment
```bash
npx claude-flow hook pre-edit -f "api/users.ts" --auto-assign-agent false
```
### Safe editing with backup
```bash
npx claude-flow hook pre-edit -f "production.env" --backup-file --check-conflicts
```
## Features
### Auto Agent Assignment
- Analyzes file type and content
- Assigns specialist agents
- TypeScript → TypeScript expert
- Database → Data specialist
- Tests → QA engineer
### Syntax Validation
- Pre-checks syntax validity
- Identifies potential errors
- Suggests corrections
- Prevents broken code
### Conflict Detection
- Checks for git conflicts
- Identifies concurrent edits
- Warns about stale files
- Suggests merge strategies
### File Backup
- Creates safety backups
- Enables quick rollback
- Tracks edit history
- Preserves originals
## Integration
This hook is automatically called by Claude Code when:
- Using Edit or MultiEdit tools
- Before file modifications
- During refactoring operations
- When updating critical files
Manual usage in agents:
```bash
# Before editing files
npx claude-flow hook pre-edit --file "path/to/file.js" --validate-syntax
```
## Output
Returns JSON with:
```json
{
"continue": true,
"file": "src/auth/login.js",
"assignedAgent": "auth-specialist",
"syntaxValid": true,
"conflicts": false,
"backupPath": ".backups/login.js.bak",
"warnings": []
}
```
## See Also
- `hook post-edit` - Post-edit processing
- `Edit` - File editing tool
- `MultiEdit` - Multiple edits tool
- `agent spawn` - Manual agent creation
@@ -0,0 +1,111 @@
# hook pre-task
Execute pre-task preparations and context loading.
## Usage
```bash
npx claude-flow hook pre-task [options]
```
## Options
- `--description, -d <text>` - Task description for context
- `--auto-spawn-agents` - Automatically spawn required agents (default: true)
- `--load-memory` - Load relevant memory from previous sessions
- `--optimize-topology` - Select optimal swarm topology
- `--estimate-complexity` - Analyze task complexity
## Examples
### Basic pre-task hook
```bash
npx claude-flow hook pre-task --description "Implement user authentication"
```
### With memory loading
```bash
npx claude-flow hook pre-task -d "Continue API development" --load-memory
```
### Manual agent control
```bash
npx claude-flow hook pre-task -d "Debug issue #123" --auto-spawn-agents false
```
### Full optimization
```bash
npx claude-flow hook pre-task -d "Refactor codebase" --optimize-topology --estimate-complexity
```
## Features
### Auto Agent Assignment
- Analyzes task requirements
- Determines needed agent types
- Spawns agents automatically
- Configures agent parameters
### Memory Loading
- Retrieves relevant past decisions
- Loads previous task contexts
- Restores agent configurations
- Maintains continuity
### Topology Optimization
- Analyzes task structure
- Selects best swarm topology
- Configures communication patterns
- Optimizes for performance
### Complexity Estimation
- Evaluates task difficulty
- Estimates time requirements
- Suggests agent count
- Identifies dependencies
## Integration
This hook is automatically called by Claude Code when:
- Starting a new task
- Resuming work after a break
- Switching between projects
- Beginning complex operations
Manual usage in agents:
```bash
# In agent coordination
npx claude-flow hook pre-task --description "Your task here"
```
## Output
Returns JSON with:
```json
{
"continue": true,
"topology": "hierarchical",
"agentsSpawned": 5,
"complexity": "medium",
"estimatedMinutes": 30,
"memoryLoaded": true
}
```
## See Also
- `hook post-task` - Post-task cleanup
- `agent spawn` - Manual agent creation
- `memory usage` - Memory management
- `swarm init` - Swarm initialization
@@ -0,0 +1,118 @@
# hook session-end
Cleanup and persist session state before ending work.
## Usage
```bash
npx claude-flow hook session-end [options]
```
## Options
- `--session-id, -s <id>` - Session identifier to end
- `--save-state` - Save current session state (default: true)
- `--export-metrics` - Export session metrics
- `--generate-summary` - Create session summary
- `--cleanup-temp` - Remove temporary files
## Examples
### Basic session end
```bash
npx claude-flow hook session-end --session-id "dev-session-2024"
```
### With full export
```bash
npx claude-flow hook session-end -s "feature-auth" --export-metrics --generate-summary
```
### Quick close
```bash
npx claude-flow hook session-end -s "quick-fix" --save-state false --cleanup-temp
```
### Complete persistence
```bash
npx claude-flow hook session-end -s "major-refactor" --save-state --export-metrics --generate-summary
```
## Features
### State Persistence
- Saves current context
- Stores open files
- Preserves task progress
- Maintains decisions
### Metric Export
- Session duration
- Commands executed
- Files modified
- Tokens consumed
- Performance data
### Summary Generation
- Work accomplished
- Key decisions made
- Problems solved
- Next steps identified
### Cleanup Operations
- Removes temp files
- Clears caches
- Frees resources
- Optimizes storage
## Integration
This hook is automatically called by Claude Code when:
- Ending a conversation
- Closing work session
- Before shutdown
- Switching contexts
Manual usage in agents:
```bash
# At session end
npx claude-flow hook session-end --session-id "your-session" --generate-summary
```
## Output
Returns JSON with:
```json
{
"sessionId": "dev-session-2024",
"duration": 7200000,
"saved": true,
"metrics": {
"commandsRun": 145,
"filesModified": 23,
"tokensUsed": 85000,
"tasksCompleted": 8
},
"summaryPath": "/sessions/dev-session-2024-summary.md",
"cleanedUp": true,
"nextSession": "dev-session-2025"
}
```
## See Also
- `hook session-start` - Session initialization
- `hook session-restore` - Session restoration
- `performance report` - Detailed metrics
- `memory backup` - State backup
@@ -0,0 +1,103 @@
# Setting Up ruv-swarm Hooks
## Quick Start
### 1. Initialize with Hooks
```bash
npx claude-flow init --hooks
```
This automatically creates:
- `.claude/settings.json` with hook configurations
- Hook command documentation
- Default hook handlers
### 2. Test Hook Functionality
```bash
# Test pre-edit hook
npx claude-flow hook pre-edit --file test.js
# Test session summary
npx claude-flow hook session-end --summary
```
### 3. Customize Hooks
Edit `.claude/settings.json` to customize:
```json
{
"hooks": {
"PreToolUse": [
{
"matcher": "^Write$",
"hooks": [{
"type": "command",
"command": "npx claude-flow hook pre-write --file '${tool.params.file_path}'"
}]
}
]
}
}
```
## Hook Response Format
Hooks return JSON with:
- `continue`: Whether to proceed (true/false)
- `reason`: Explanation for decision
- `metadata`: Additional context
Example blocking response:
```json
{
"continue": false,
"reason": "Protected file - manual review required",
"metadata": {
"file": ".env.production",
"protection_level": "high"
}
}
```
## Performance Tips
- Keep hooks lightweight (< 100ms)
- Use caching for repeated operations
- Batch related operations
- Run non-critical hooks asynchronously
## Debugging Hooks
```bash
# Enable debug output
export CLAUDE_FLOW_DEBUG=true
# Test specific hook
npx claude-flow hook pre-edit --file app.js --debug
```
## Common Patterns
### Auto-Format on Save
Already configured by default for common file types.
### Protected File Detection
```json
{
"matcher": "^(Write|Edit)$",
"hooks": [{
"type": "command",
"command": "npx claude-flow hook check-protected --file '${tool.params.file_path}'"
}]
}
```
### Automatic Testing
```json
{
"matcher": "^Write$",
"hooks": [{
"type": "command",
"command": "test -f '${tool.params.file_path%.js}.test.js' && npm test '${tool.params.file_path%.js}.test.js'"
}]
}
```
@@ -0,0 +1,9 @@
# Monitoring Commands
Commands for monitoring operations in Claude Flow.
## Available Commands
- [swarm-monitor](./swarm-monitor.md)
- [agent-metrics](./agent-metrics.md)
- [real-time-view](./real-time-view.md)
@@ -0,0 +1,25 @@
# agent-metrics
View agent performance metrics.
## Usage
```bash
npx claude-flow agent metrics [options]
```
## Options
- `--agent-id <id>` - Specific agent
- `--period <time>` - Time period
- `--format <type>` - Output format
## Examples
```bash
# All agents metrics
npx claude-flow agent metrics
# Specific agent
npx claude-flow agent metrics --agent-id agent-001
# Last hour
npx claude-flow agent metrics --period 1h
```
@@ -0,0 +1,44 @@
# List Active Patterns
## 🎯 Key Principle
**This tool coordinates Claude Code's actions. It does NOT write code or create content.**
## MCP Tool Usage in Claude Code
**Tool:** `mcp__claude-flow__agent_list`
## Parameters
```json
{
"swarmId": "current"
}
```
## Description
View all active cognitive patterns and their current focus areas
## Details
Filters:
- **all**: Show all defined patterns
- **active**: Currently engaged patterns
- **idle**: Available but unused patterns
- **busy**: Patterns actively coordinating tasks
## Example Usage
**In Claude Code:**
1. List all agents: Use tool `mcp__claude-flow__agent_list`
2. Get specific agent metrics: Use tool `mcp__claude-flow__agent_metrics` with parameters `{"agentId": "coder-123"}`
3. Monitor agent performance: Use tool `mcp__claude-flow__swarm_monitor` with parameters `{"interval": 2000}`
## Important Reminders
- ✅ This tool provides coordination and structure
- ✅ Claude Code performs all actual implementation
- ❌ The tool does NOT write code
- ❌ The tool does NOT access files directly
- ❌ The tool does NOT execute commands
## See Also
- Main documentation: /CLAUDE.md
- Other commands in this category
- Workflow examples in /workflows/
@@ -0,0 +1,25 @@
# real-time-view
Real-time view of swarm activity.
## Usage
```bash
npx claude-flow monitoring real-time-view [options]
```
## Options
- `--filter <type>` - Filter view
- `--highlight <pattern>` - Highlight pattern
- `--tail <n>` - Show last N events
## Examples
```bash
# Start real-time view
npx claude-flow monitoring real-time-view
# Filter errors
npx claude-flow monitoring real-time-view --filter errors
# Highlight pattern
npx claude-flow monitoring real-time-view --highlight "API"
```
@@ -0,0 +1,46 @@
# Check Coordination Status
## 🎯 Key Principle
**This tool coordinates Claude Code's actions. It does NOT write code or create content.**
## MCP Tool Usage in Claude Code
**Tool:** `mcp__claude-flow__swarm_status`
## Parameters
```json
{
"swarmId": "current"
}
```
## Description
Monitor the effectiveness of current coordination patterns
## Details
Shows:
- Active coordination topologies
- Current cognitive patterns in use
- Task breakdown and progress
- Resource utilization for coordination
- Overall system health
## Example Usage
**In Claude Code:**
1. Check swarm status: Use tool `mcp__claude-flow__swarm_status`
2. Monitor in real-time: Use tool `mcp__claude-flow__swarm_monitor` with parameters `{"interval": 1000}`
3. Get agent metrics: Use tool `mcp__claude-flow__agent_metrics` with parameters `{"agentId": "agent-123"}`
4. Health check: Use tool `mcp__claude-flow__health_check` with parameters `{"components": ["swarm", "memory", "neural"]}`
## Important Reminders
- ✅ This tool provides coordination and structure
- ✅ Claude Code performs all actual implementation
- ❌ The tool does NOT write code
- ❌ The tool does NOT access files directly
- ❌ The tool does NOT execute commands
## See Also
- Main documentation: /CLAUDE.md
- Other commands in this category
- Workflow examples in /workflows/
@@ -0,0 +1,25 @@
# swarm-monitor
Real-time swarm monitoring.
## Usage
```bash
npx claude-flow swarm monitor [options]
```
## Options
- `--interval <ms>` - Update interval
- `--metrics` - Show detailed metrics
- `--export` - Export monitoring data
## Examples
```bash
# Start monitoring
npx claude-flow swarm monitor
# Custom interval
npx claude-flow swarm monitor --interval 5000
# With metrics
npx claude-flow swarm monitor --metrics
```
@@ -0,0 +1,9 @@
# Optimization Commands
Commands for optimization operations in Claude Flow.
## Available Commands
- [topology-optimize](./topology-optimize.md)
- [parallel-execute](./parallel-execute.md)
- [cache-manage](./cache-manage.md)
@@ -0,0 +1,62 @@
# Automatic Topology Selection
## Purpose
Automatically select the optimal swarm topology based on task complexity analysis.
## How It Works
### 1. Task Analysis
The system analyzes your task description to determine:
- Complexity level (simple/medium/complex)
- Required agent types
- Estimated duration
- Resource requirements
### 2. Topology Selection
Based on analysis, it selects:
- **Star**: For simple, centralized tasks
- **Mesh**: For medium complexity with flexibility needs
- **Hierarchical**: For complex tasks requiring structure
- **Ring**: For sequential processing workflows
### 3. Example Usage
**Simple Task:**
```
Tool: mcp__claude-flow__task_orchestrate
Parameters: {"task": "Fix typo in README.md"}
Result: Automatically uses star topology with single agent
```
**Complex Task:**
```
Tool: mcp__claude-flow__task_orchestrate
Parameters: {"task": "Refactor authentication system with JWT, add tests, update documentation"}
Result: Automatically uses hierarchical topology with architect, coder, and tester agents
```
## Benefits
- 🎯 Optimal performance for each task type
- 🤖 Automatic agent assignment
- ⚡ Reduced setup time
- 📊 Better resource utilization
## Hook Configuration
The pre-task hook automatically handles topology selection:
```json
{
"command": "npx claude-flow hook pre-task --optimize-topology"
}
```
## Direct Optimization
```
Tool: mcp__claude-flow__topology_optimize
Parameters: {"swarmId": "current"}
```
## CLI Usage
```bash
# Auto-optimize topology via CLI
npx claude-flow optimize topology
```
@@ -0,0 +1,25 @@
# cache-manage
Manage operation cache for performance.
## Usage
```bash
npx claude-flow optimization cache-manage [options]
```
## Options
- `--action <type>` - Action (view, clear, optimize)
- `--max-size <mb>` - Maximum cache size
- `--ttl <seconds>` - Time to live
## Examples
```bash
# View cache stats
npx claude-flow optimization cache-manage --action view
# Clear cache
npx claude-flow optimization cache-manage --action clear
# Set limits
npx claude-flow optimization cache-manage --max-size 100 --ttl 3600
```
@@ -0,0 +1,25 @@
# parallel-execute
Execute tasks in parallel for maximum efficiency.
## Usage
```bash
npx claude-flow optimization parallel-execute [options]
```
## Options
- `--tasks <file>` - Task list file
- `--max-parallel <n>` - Maximum parallel tasks
- `--strategy <type>` - Execution strategy
## Examples
```bash
# Execute task list
npx claude-flow optimization parallel-execute --tasks tasks.json
# Limit parallelism
npx claude-flow optimization parallel-execute --tasks tasks.json --max-parallel 5
# Custom strategy
npx claude-flow optimization parallel-execute --strategy adaptive
```
@@ -0,0 +1,50 @@
# Parallel Task Execution
## Purpose
Execute independent subtasks in parallel for maximum efficiency.
## Coordination Strategy
### 1. Task Decomposition
```
Tool: mcp__claude-flow__task_orchestrate
Parameters: {
"task": "Build complete REST API with auth, CRUD operations, and tests",
"strategy": "parallel",
"maxAgents": 8
}
```
### 2. Parallel Workflows
The system automatically:
- Identifies independent components
- Assigns specialized agents
- Executes in parallel where possible
- Synchronizes at dependency points
### 3. Example Breakdown
For the REST API task:
- **Agent 1 (Architect)**: Design API structure
- **Agent 2-3 (Coders)**: Implement auth & CRUD in parallel
- **Agent 4 (Tester)**: Write tests as features complete
- **Agent 5 (Documenter)**: Update docs continuously
## CLI Usage
```bash
# Execute parallel tasks via CLI
npx claude-flow parallel "Build REST API" --max-agents 8
```
## Performance Gains
- 🚀 2.8-4.4x faster execution
- 💪 Optimal CPU utilization
- 🔄 Automatic load balancing
- 📈 Linear scalability with agents
## Monitoring
```
Tool: mcp__claude-flow__swarm_monitor
Parameters: {"interval": 1000, "swarmId": "current"}
```
Watch real-time parallel execution progress!
@@ -0,0 +1,25 @@
# topology-optimize
Optimize swarm topology for current workload.
## Usage
```bash
npx claude-flow optimization topology-optimize [options]
```
## Options
- `--analyze-first` - Analyze before optimizing
- `--target <metric>` - Optimization target
- `--apply` - Apply optimizations
## Examples
```bash
# Analyze and suggest
npx claude-flow optimization topology-optimize --analyze-first
# Optimize for speed
npx claude-flow optimization topology-optimize --target speed
# Apply changes
npx claude-flow optimization topology-optimize --target efficiency --apply
```
@@ -0,0 +1,261 @@
# 👥 Pair Programming Command
Collaborative development with real-time verification and AI assistance.
## Overview
The `pair` command enables collaborative pair programming between you and AI agents, with real-time verification, code review, and quality enforcement.
## Usage
```bash
claude-flow pair [--start] [options]
```
## Quick Start
```bash
# Start pair programming session
claude-flow pair --start
# Start with specific agent
claude-flow pair --start --agent senior-dev
# Start with verification
claude-flow pair --start --verify --threshold 0.98
```
## Options
- `--start` - Start new pair programming session
- `--agent <name>` - Specify AI pair partner (default: auto-select)
- `--verify` - Enable real-time verification
- `--threshold <0-1>` - Verification threshold (default: 0.95)
- `--mode <type>` - Programming mode: driver, navigator, switch
- `--focus <area>` - Focus area: refactor, test, debug, implement
- `--language <lang>` - Primary language for session
- `--review` - Enable continuous code review
- `--test` - Run tests after each change
## Modes
### Driver Mode
You write code, AI provides suggestions and reviews.
```bash
claude-flow pair --start --mode driver
```
### Navigator Mode
AI writes code, you provide guidance and review.
```bash
claude-flow pair --start --mode navigator
```
### Switch Mode (Default)
Alternate between driver and navigator roles.
```bash
claude-flow pair --start --mode switch --interval 10m
```
## Features
### Real-Time Verification
- Continuous truth checking (0.95 threshold)
- Automatic rollback on verification failure
- Quality gates before commits
### Code Review
- Instant feedback on code changes
- Best practice suggestions
- Security vulnerability detection
- Performance optimization tips
### Test Integration
- Automatic test generation
- Test-driven development support
- Coverage monitoring
- Integration test suggestions
### Collaboration Tools
- Shared context between you and AI
- Session history and replay
- Code explanation on demand
- Learning from your preferences
## Session Management
### Start Session
```bash
# Basic start
claude-flow pair --start
# With configuration
claude-flow pair --start \
--agent expert-coder \
--verify \
--test \
--focus refactor
```
### During Session
```commands
/help - Show available commands
/explain - Explain current code
/suggest - Get improvement suggestions
/test - Run tests
/verify - Check verification score
/switch - Switch driver/navigator roles
/focus <area> - Change focus area
/commit - Commit with verification
/pause - Pause session
/resume - Resume session
/end - End session
```
### End Session
```bash
# End and save session
claude-flow pair --end --save
# End and generate report
claude-flow pair --end --report
```
## Examples
### Refactoring Session
```bash
claude-flow pair --start \
--focus refactor \
--verify \
--threshold 0.98
```
### Test-Driven Development
```bash
claude-flow pair --start \
--focus test \
--mode tdd \
--language javascript
```
### Bug Fixing
```bash
claude-flow pair --start \
--focus debug \
--agent debugger-expert \
--test
```
### Code Review Session
```bash
claude-flow pair --start \
--review \
--verify \
--agent senior-reviewer
```
## Integration
### With Git
```bash
# Auto-commit with verification
claude-flow pair --start --git --auto-commit
# Review before commit
claude-flow pair --start --git --review-commit
```
### With Testing Frameworks
```bash
# Jest integration
claude-flow pair --start --test-framework jest
# Pytest integration
claude-flow pair --start --test-framework pytest
```
### With CI/CD
```bash
# CI-friendly mode
claude-flow pair --start --ci --non-interactive
```
## Session Output
```
👥 Pair Programming Session Started
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Partner: expert-coder
Mode: Switch (10m intervals)
Focus: Implementation
Verification: ✅ Enabled (0.95)
Testing: ✅ Auto-run
Current Role: DRIVER (you)
Navigator: expert-coder is reviewing...
📝 Working on: src/auth/login.js
Truth Score: 0.972 ✅
Test Coverage: 84% 📈
💡 Suggestion: Consider adding input validation for email field
🔍 Review: Line 23 - Potential SQL injection vulnerability
Type /help for commands or start coding...
```
## Quality Metrics
- **Session Duration**: Total pair programming time
- **Code Quality**: Average truth score during session
- **Productivity**: Lines changed, features completed
- **Learning**: Patterns learned from collaboration
- **Test Coverage**: Coverage improvement during session
## Configuration
Configure pair programming in `.claude-flow/config.json`:
```json
{
"pair": {
"defaultAgent": "expert-coder",
"defaultMode": "switch",
"switchInterval": "10m",
"verification": {
"enabled": true,
"threshold": 0.95,
"autoRollback": true
},
"testing": {
"autoRun": true,
"framework": "jest",
"coverage": {
"minimum": 80,
"enforce": true
}
},
"review": {
"continuous": true,
"preCommit": true
}
}
}
```
## Best Practices
1. **Start with Clear Goals**: Define what you want to accomplish
2. **Use Verification**: Enable verification for critical code
3. **Test Frequently**: Run tests after significant changes
4. **Review Together**: Use review features for learning
5. **Document Decisions**: AI will help document why choices were made
## Related Commands
- `verify` - Standalone verification
- `truth` - View quality metrics
- `test` - Run test suites
- `review` - Code review tools
@@ -0,0 +1,546 @@
# Pair Programming Commands Reference
Complete reference for all pair programming session commands.
## Session Control Commands
### /start
Start a new pair programming session.
```
/start [--mode <mode>] [--agent <agent>]
```
### /end
End the current session.
```
/end [--save] [--report]
```
### /pause
Pause the current session.
```
/pause [--reason <reason>]
```
### /resume
Resume a paused session.
```
/resume
```
### /status
Show current session status.
```
/status [--verbose]
```
### /switch
Switch driver/navigator roles.
```
/switch [--immediate]
```
## Code Commands
### /explain
Explain the current code or selection.
```
/explain [--level basic|detailed|expert]
```
### /suggest
Get improvement suggestions.
```
/suggest [--type refactor|optimize|security|style]
```
### /implement
Request implementation (navigator mode).
```
/implement <description>
```
### /refactor
Refactor selected code.
```
/refactor [--pattern <pattern>] [--scope function|file|module]
```
### /optimize
Optimize code for performance.
```
/optimize [--target speed|memory|both]
```
### /document
Add documentation to code.
```
/document [--format jsdoc|markdown|inline]
```
### /comment
Add inline comments.
```
/comment [--verbose]
```
### /pattern
Apply a design pattern.
```
/pattern <pattern-name> [--example]
```
## Testing Commands
### /test
Run test suite.
```
/test [--watch] [--coverage] [--only <pattern>]
```
### /test-gen
Generate tests for current code.
```
/test-gen [--type unit|integration|e2e]
```
### /coverage
Check test coverage.
```
/coverage [--report html|json|terminal]
```
### /mock
Generate mock data or functions.
```
/mock <target> [--realistic]
```
### /test-watch
Enable test watching.
```
/test-watch [--on-save]
```
### /snapshot
Create test snapshots.
```
/snapshot [--update]
```
## Review Commands
### /review
Perform code review.
```
/review [--scope current|file|changes] [--strict]
```
### /security
Security analysis.
```
/security [--deep] [--fix]
```
### /perf
Performance analysis.
```
/perf [--profile] [--suggestions]
```
### /quality
Check code quality metrics.
```
/quality [--detailed]
```
### /lint
Run linters.
```
/lint [--fix] [--config <config>]
```
### /complexity
Analyze code complexity.
```
/complexity [--threshold <value>]
```
## Navigation Commands
### /goto
Navigate to file or location.
```
/goto <file>[:line[:column]]
```
### /find
Search in project.
```
/find <pattern> [--regex] [--case-sensitive]
```
### /recent
Show recent files.
```
/recent [--limit <n>]
```
### /bookmark
Manage bookmarks.
```
/bookmark [add|list|goto|remove] [<name>]
```
### /history
Show command history.
```
/history [--limit <n>] [--filter <pattern>]
```
### /tree
Show project structure.
```
/tree [--depth <n>] [--filter <pattern>]
```
## Git Commands
### /diff
Show git diff.
```
/diff [--staged] [--file <file>]
```
### /commit
Commit with verification.
```
/commit [--message <msg>] [--amend]
```
### /branch
Branch operations.
```
/branch [create|switch|delete|list] [<name>]
```
### /stash
Stash operations.
```
/stash [save|pop|list|apply] [<message>]
```
### /log
View git log.
```
/log [--oneline] [--limit <n>]
```
### /blame
Show git blame.
```
/blame [<file>]
```
## AI Partner Commands
### /agent
Manage AI agent.
```
/agent [switch|info|config] [<agent-name>]
```
### /teach
Teach the AI your preferences.
```
/teach <preference>
```
### /feedback
Provide feedback to AI.
```
/feedback [positive|negative] <message>
```
### /personality
Adjust AI personality.
```
/personality [professional|friendly|concise|verbose]
```
### /expertise
Set AI expertise focus.
```
/expertise [add|remove|list] [<domain>]
```
## Metrics Commands
### /metrics
Show session metrics.
```
/metrics [--period today|session|week|all]
```
### /score
Show quality scores.
```
/score [--breakdown]
```
### /productivity
Show productivity metrics.
```
/productivity [--chart]
```
### /leaderboard
Show improvement leaderboard.
```
/leaderboard [--personal|team]
```
## Configuration Commands
### /config
Manage configuration.
```
/config [get|set|reset] [<key>] [<value>]
```
### /profile
Manage profiles.
```
/profile [use|create|list|delete] [<name>]
```
### /theme
Change interface theme.
```
/theme [dark|light|auto|<custom>]
```
### /shortcuts
Manage keyboard shortcuts.
```
/shortcuts [list|set|reset] [<action>] [<keys>]
```
## Collaboration Commands
### /share
Share session or code.
```
/share [session|code|screen] [--with <user>]
```
### /invite
Invite collaborator.
```
/invite <email> [--role observer|participant]
```
### /chat
Send message to team.
```
/chat <message>
```
### /note
Add session note.
```
/note <text> [--tag <tag>]
```
## Learning Commands
### /learn
Access learning resources.
```
/learn [<topic>] [--level beginner|intermediate|advanced]
```
### /example
Show code examples.
```
/example <pattern-or-concept> [--language <lang>]
```
### /quiz
Take a quiz on current topic.
```
/quiz [--difficulty easy|medium|hard]
```
### /tip
Get a coding tip.
```
/tip [--topic <topic>]
```
## Utility Commands
### /help
Show help.
```
/help [<command>]
```
### /undo
Undo last action.
```
/undo [--steps <n>]
```
### /redo
Redo undone action.
```
/redo [--steps <n>]
```
### /clear
Clear screen or cache.
```
/clear [screen|cache|history]
```
### /export
Export session data.
```
/export [--format json|md|html] [--file <path>]
```
### /import
Import configuration or data.
```
/import <file> [--type config|session|profile]
```
## Debugging Commands
### /debug
Enter debug mode.
```
/debug [on|off|toggle]
```
### /breakpoint
Manage breakpoints.
```
/breakpoint [add|remove|list|clear] [<location>]
```
### /trace
Enable tracing.
```
/trace [on|off|show]
```
### /inspect
Inspect variable or object.
```
/inspect <variable> [--deep]
```
### /watch
Watch expression.
```
/watch [add|remove|list] [<expression>]
```
## Advanced Commands
### /macro
Record or run macros.
```
/macro [record|stop|play|list|delete] [<name>]
```
### /plugin
Manage plugins.
```
/plugin [install|remove|list|config] [<plugin>]
```
### /api
API operations.
```
/api <endpoint> [--method GET|POST|PUT|DELETE] [--data <json>]
```
### /exec
Execute system command.
```
/exec <command> [--background]
```
## Quick Command Aliases
| Alias | Full Command |
|-------|-------------|
| `/s` | `/suggest` |
| `/e` | `/explain` |
| `/t` | `/test` |
| `/r` | `/review` |
| `/c` | `/commit` |
| `/g` | `/goto` |
| `/f` | `/find` |
| `/h` | `/help` |
| `/sw` | `/switch` |
| `/st` | `/status` |
## Command Modifiers
### Global Modifiers
- `--quiet` - Suppress output
- `--verbose` - Detailed output
- `--json` - JSON output format
- `--no-cache` - Skip cache
- `--timeout <s>` - Command timeout
### Chaining Commands
Use `&&` to chain commands:
```
/test && /commit && /push
```
### Command History
- `↑/↓` - Navigate history
- `Ctrl+R` - Search history
- `!!` - Repeat last command
- `!<n>` - Run command n from history
## Custom Commands
Define custom commands in configuration:
```json
{
"customCommands": {
"tdd": "/test-gen && /test --watch",
"full-review": "/lint --fix && /test && /review --strict",
"quick-fix": "/suggest --type fix && /implement && /test"
}
}
```
Use custom commands:
```
/custom tdd
/custom full-review
```
## Best Practices
1. **Learn Core Commands** - Master frequently used commands
2. **Use Aliases** - Speed up common operations
3. **Chain Commands** - Automate workflows
4. **Custom Commands** - Create your workflows
5. **Keyboard Shortcuts** - Faster than typing
## Related Documentation
- [Session Management](./session.md)
- [Configuration](./config.md)
- [Keyboard Shortcuts](./shortcuts.md)
- [Getting Started](./README.md)
@@ -0,0 +1,510 @@
# Pair Programming Configuration
Complete configuration guide for pair programming sessions.
## Configuration File
Main configuration file: `.claude-flow/pair-config.json`
## Basic Configuration
```json
{
"pair": {
"enabled": true,
"defaultMode": "switch",
"defaultAgent": "auto",
"autoStart": false,
"theme": "professional"
}
}
```
## Complete Configuration
```json
{
"pair": {
"general": {
"enabled": true,
"defaultMode": "switch",
"defaultAgent": "senior-dev",
"autoStart": false,
"theme": "professional",
"language": "javascript",
"timezone": "UTC"
},
"modes": {
"driver": {
"enabled": true,
"suggestions": true,
"realTimeReview": true,
"autoComplete": false
},
"navigator": {
"enabled": true,
"codeGeneration": true,
"explanations": true,
"alternatives": true
},
"switch": {
"enabled": true,
"interval": "10m",
"warning": "30s",
"autoSwitch": true,
"pauseOnIdle": true
}
},
"verification": {
"enabled": true,
"threshold": 0.95,
"autoRollback": true,
"preCommitCheck": true,
"continuousMonitoring": true,
"blockOnFailure": true
},
"testing": {
"enabled": true,
"autoRun": true,
"framework": "jest",
"onSave": true,
"coverage": {
"enabled": true,
"minimum": 80,
"enforce": true,
"reportFormat": "html"
},
"watch": true,
"parallel": true
},
"review": {
"enabled": true,
"continuous": true,
"preCommit": true,
"security": true,
"performance": true,
"style": true,
"complexity": {
"maxComplexity": 10,
"maxDepth": 4,
"maxLines": 100
}
},
"git": {
"enabled": true,
"autoCommit": false,
"commitTemplate": "feat: {message}",
"signCommits": false,
"pushOnEnd": false,
"branchProtection": true
},
"session": {
"autoSave": true,
"saveInterval": "5m",
"maxDuration": "4h",
"idleTimeout": "15m",
"breakReminder": "45m",
"metricsInterval": "1m",
"recordSession": false,
"shareByDefault": false
},
"ai": {
"model": "advanced",
"temperature": 0.7,
"maxTokens": 4000,
"contextWindow": 8000,
"personality": "professional",
"expertise": ["backend", "testing", "security"],
"learningEnabled": true
},
"interface": {
"theme": "dark",
"fontSize": 14,
"showMetrics": true,
"notifications": true,
"sounds": false,
"shortcuts": {
"switch": "ctrl+shift+s",
"suggest": "ctrl+space",
"review": "ctrl+r",
"test": "ctrl+t"
}
},
"quality": {
"linting": {
"enabled": true,
"autoFix": true,
"rules": "standard"
},
"formatting": {
"enabled": true,
"autoFormat": true,
"style": "prettier"
},
"documentation": {
"required": true,
"format": "jsdoc",
"checkCompleteness": true
}
},
"advanced": {
"parallelSessions": false,
"multiAgent": false,
"customAgents": [],
"plugins": [],
"webhooks": {
"onStart": "",
"onEnd": "",
"onCommit": "",
"onError": ""
}
}
}
}
```
## Agent Configuration
### Built-in Agents
```json
{
"agents": {
"senior-dev": {
"expertise": ["architecture", "patterns", "optimization"],
"style": "thorough",
"reviewLevel": "strict"
},
"tdd-specialist": {
"expertise": ["testing", "mocks", "coverage"],
"style": "test-first",
"reviewLevel": "comprehensive"
},
"debugger-expert": {
"expertise": ["debugging", "profiling", "tracing"],
"style": "analytical",
"reviewLevel": "focused"
},
"junior-dev": {
"expertise": ["learning", "basics", "documentation"],
"style": "questioning",
"reviewLevel": "educational"
}
}
}
```
### Custom Agents
```json
{
"customAgents": [
{
"id": "security-expert",
"name": "Security Specialist",
"expertise": ["security", "cryptography", "vulnerabilities"],
"personality": "cautious",
"prompts": {
"review": "Focus on security vulnerabilities",
"suggest": "Prioritize secure coding practices"
}
}
]
}
```
## Mode-Specific Configuration
### Driver Mode
```json
{
"driver": {
"autocomplete": {
"enabled": false,
"delay": 500,
"minChars": 3
},
"suggestions": {
"enabled": true,
"frequency": "onChange",
"inline": true
},
"review": {
"realTime": true,
"highlighting": true,
"annotations": true
}
}
}
```
### Navigator Mode
```json
{
"navigator": {
"generation": {
"style": "verbose",
"comments": true,
"tests": true
},
"explanation": {
"level": "detailed",
"examples": true,
"alternatives": 3
}
}
}
```
### Switch Mode
```json
{
"switch": {
"intervals": {
"default": "10m",
"minimum": "5m",
"maximum": "30m"
},
"handoff": {
"summary": true,
"context": true,
"nextSteps": true
}
}
}
```
## Quality Thresholds
```json
{
"thresholds": {
"verification": {
"error": 0.90,
"warning": 0.95,
"success": 0.98
},
"coverage": {
"error": 70,
"warning": 80,
"success": 90
},
"complexity": {
"error": 15,
"warning": 10,
"success": 5
}
}
}
```
## Language-Specific Settings
### JavaScript/TypeScript
```json
{
"languages": {
"javascript": {
"framework": "react",
"linter": "eslint",
"formatter": "prettier",
"testRunner": "jest",
"transpiler": "babel"
}
}
}
```
### Python
```json
{
"languages": {
"python": {
"version": "3.11",
"linter": "pylint",
"formatter": "black",
"testRunner": "pytest",
"typeChecker": "mypy"
}
}
}
```
## Environment Variables
```bash
# Override configuration via environment
export CLAUDE_PAIR_MODE=driver
export CLAUDE_PAIR_VERIFY=true
export CLAUDE_PAIR_THRESHOLD=0.98
export CLAUDE_PAIR_AGENT=senior-dev
export CLAUDE_PAIR_AUTO_TEST=true
```
## CLI Configuration
### Set Configuration
```bash
# Set single value
claude-flow pair config set defaultMode switch
# Set nested value
claude-flow pair config set verification.threshold 0.98
# Set from file
claude-flow pair config import config.json
```
### Get Configuration
```bash
# Get all configuration
claude-flow pair config get
# Get specific value
claude-flow pair config get defaultMode
# Export configuration
claude-flow pair config export > config.json
```
### Reset Configuration
```bash
# Reset to defaults
claude-flow pair config reset
# Reset specific section
claude-flow pair config reset verification
```
## Profile Management
### Create Profile
```bash
claude-flow pair profile create refactoring \
--mode driver \
--verify true \
--threshold 0.98 \
--focus refactor
```
### Use Profile
```bash
claude-flow pair --start --profile refactoring
```
### List Profiles
```bash
claude-flow pair profile list
```
### Profiles Configuration
```json
{
"profiles": {
"refactoring": {
"mode": "driver",
"verification": {
"enabled": true,
"threshold": 0.98
},
"focus": "refactor"
},
"debugging": {
"mode": "navigator",
"agent": "debugger-expert",
"trace": true,
"verbose": true
},
"learning": {
"mode": "mentor",
"pace": "slow",
"explanations": "detailed",
"examples": true
}
}
}
```
## Workspace Configuration
### Project-Specific
`.claude-flow/pair-config.json` in project root
### User-Specific
`~/.claude-flow/pair-config.json`
### Global
`/etc/claude-flow/pair-config.json`
### Priority Order
1. Command-line arguments
2. Environment variables
3. Project configuration
4. User configuration
5. Global configuration
6. Built-in defaults
## Configuration Validation
```bash
# Validate configuration
claude-flow pair config validate
# Test configuration
claude-flow pair config test
```
## Migration
### From Version 1.x
```bash
claude-flow pair config migrate --from 1.x
```
### Export/Import
```bash
# Export current config
claude-flow pair config export > my-config.json
# Import config
claude-flow pair config import my-config.json
```
## Best Practices
1. **Start Simple** - Use defaults, customize as needed
2. **Version Control** - Commit project config
3. **Team Standards** - Share configurations
4. **Regular Review** - Update thresholds based on metrics
5. **Profile Usage** - Create profiles for common scenarios
## Troubleshooting
### Configuration Not Loading
- Check file syntax (JSON)
- Verify file permissions
- Check priority order
- Validate configuration
### Settings Not Applied
- Restart session
- Clear cache
- Check overrides
- Review logs
## Related Documentation
- [Getting Started](./README.md)
- [Session Management](./session.md)
- [Modes](./modes.md)
- [Templates](./templates.md)
@@ -0,0 +1,512 @@
# Pair Programming Examples
Real-world examples and scenarios for pair programming sessions.
## Example 1: Feature Implementation
### Scenario
Implementing a user authentication feature with JWT tokens.
### Session Setup
```bash
claude-flow pair --start \
--mode switch \
--agent senior-dev \
--focus implement \
--verify \
--test
```
### Session Flow
```
👥 Starting pair programming for authentication feature...
[DRIVER: You - 10 minutes]
/explain JWT authentication flow
> AI explains JWT concepts and best practices
/suggest implementation approach
> AI suggests using middleware pattern with refresh tokens
# You write the basic auth middleware structure
[SWITCH TO NAVIGATOR]
[NAVIGATOR: AI - 10 minutes]
/implement JWT token generation with refresh tokens
> AI generates secure token implementation
/test-gen
> AI creates comprehensive test suite
[SWITCH TO DRIVER]
[DRIVER: You - 10 minutes]
# You refine the implementation
/review --security
> AI performs security review, suggests improvements
/commit --message "feat: JWT authentication with refresh tokens"
✅ Truth Score: 0.98 - Committed successfully
```
## Example 2: Bug Fixing Session
### Scenario
Debugging a memory leak in a Node.js application.
### Session Setup
```bash
claude-flow pair --start \
--mode navigator \
--agent debugger-expert \
--focus debug \
--trace
```
### Session Flow
```
👥 Starting debugging session...
/status
> Analyzing application for memory issues...
/perf --profile
> Memory usage growing: 150MB → 450MB over 10 minutes
/find "new EventEmitter" --regex
> Found 3 instances of EventEmitter creation
/inspect eventEmitters --deep
> Discovering listeners not being removed
/suggest fix for memory leak
> AI suggests: "Add removeListener in cleanup functions"
/implement cleanup functions for all event emitters
> AI generates proper cleanup code
/test
> Memory stable at 150MB ✅
/commit --message "fix: memory leak in event emitters"
```
## Example 3: Test-Driven Development
### Scenario
Building a shopping cart feature using TDD.
### Session Setup
```bash
claude-flow pair --start \
--mode tdd \
--agent tdd-specialist \
--test-first
```
### Session Flow
```
👥 TDD Session: Shopping Cart Feature
[RED PHASE]
/test-gen "add item to cart"
> AI writes failing test:
✗ should add item to cart
✗ should update quantity for existing item
✗ should calculate total price
[GREEN PHASE]
/implement minimal cart functionality
> You write just enough code to pass tests
/test
> Tests passing: 3/3 ✅
[REFACTOR PHASE]
/refactor --pattern repository
> AI refactors to repository pattern
/test
> Tests still passing: 3/3 ✅
[NEXT CYCLE]
/test-gen "remove item from cart"
> AI writes new failing tests...
```
## Example 4: Code Refactoring
### Scenario
Refactoring legacy code to modern patterns.
### Session Setup
```bash
claude-flow pair --start \
--mode driver \
--focus refactor \
--verify \
--threshold 0.98
```
### Session Flow
```
👥 Refactoring Session: Modernizing UserService
/analyze UserService.js
> AI identifies:
- Callback hell (5 levels deep)
- No error handling
- Tight coupling
- No tests
/suggest refactoring plan
> AI suggests:
1. Convert callbacks to async/await
2. Add error boundaries
3. Extract dependencies
4. Add unit tests
/test-gen --before-refactor
> AI generates tests for current behavior
/refactor callbacks to async/await
# You refactor with AI guidance
/test
> All tests passing ✅
/review --compare
> AI shows before/after comparison
> Code complexity: 35 → 12
> Truth score: 0.99 ✅
/commit --message "refactor: modernize UserService with async/await"
```
## Example 5: Learning Session
### Scenario
Learning React hooks with AI mentorship.
### Session Setup
```bash
claude-flow pair --start \
--mode mentor \
--agent react-expert \
--pace slow \
--examples
```
### Session Flow
```
👥 Learning Session: React Hooks
/learn useState hook
> AI explains with interactive examples
/example custom hook for API calls
> AI shows best practice implementation:
```javascript
function useApi(url) {
const [data, setData] = useState(null);
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
useEffect(() => {
// Implementation explained step by step
}, [url]);
return { data, loading, error };
}
```
/implement my own custom hook
# You write with AI guidance
/review --educational
> AI provides detailed feedback with learning points
/quiz react hooks
> AI tests your understanding
> Score: 8/10 - Good progress!
```
## Example 6: Performance Optimization
### Scenario
Optimizing a slow React application.
### Session Setup
```bash
claude-flow pair --start \
--mode switch \
--agent performance-expert \
--focus optimize \
--profile
```
### Session Flow
```
👥 Performance Optimization Session
/perf --profile
> React DevTools Profiler Results:
- ProductList: 450ms render
- CartSummary: 200ms render
- Unnecessary re-renders: 15
/suggest optimizations for ProductList
> AI suggests:
1. Add React.memo
2. Use useMemo for expensive calculations
3. Implement virtualization for long lists
/implement React.memo and useMemo
# You implement with AI guidance
/perf --profile
> ProductList: 45ms render (90% improvement!) ✅
/implement virtualization with react-window
> AI implements virtual scrolling
/perf --profile
> ProductList: 12ms render (97% improvement!) ✅
> FPS: 60 stable ✅
/commit --message "perf: optimize ProductList with memoization and virtualization"
```
## Example 7: API Development
### Scenario
Building a RESTful API with Express.
### Session Setup
```bash
claude-flow pair --start \
--mode navigator \
--agent backend-expert \
--focus implement \
--test
```
### Session Flow
```
👥 API Development Session
/design REST API for blog platform
> AI designs endpoints:
POST /api/posts
GET /api/posts
GET /api/posts/:id
PUT /api/posts/:id
DELETE /api/posts/:id
/implement CRUD endpoints with validation
> AI implements with Express + Joi validation
/test-gen --integration
> AI generates integration tests
/security --api
> AI adds:
- Rate limiting
- Input sanitization
- JWT authentication
- CORS configuration
/document --openapi
> AI generates OpenAPI documentation
/test --integration
> All endpoints tested: 15/15 ✅
/deploy --staging
> API deployed to staging environment
```
## Example 8: Database Migration
### Scenario
Migrating from MongoDB to PostgreSQL.
### Session Setup
```bash
claude-flow pair --start \
--mode switch \
--agent database-expert \
--verify \
--test
```
### Session Flow
```
👥 Database Migration Session
/analyze MongoDB schema
> AI maps current structure:
- users collection → users table
- posts collection → posts table
- Embedded comments → comments table with FK
/design PostgreSQL schema
> AI creates normalized schema with relations
/implement migration script
# You write migration with AI assistance
/test --migration --sample-data
> Migration successful for 10,000 records ✅
/implement data access layer
> AI creates repository pattern implementation
/test --integration
> All queries working correctly ✅
/verify data integrity
> Truth score: 0.995 ✅
> No data loss detected
```
## Example 9: CI/CD Pipeline
### Scenario
Setting up GitHub Actions CI/CD pipeline.
### Session Setup
```bash
claude-flow pair --start \
--mode navigator \
--agent devops-expert \
--focus implement
```
### Session Flow
```
👥 CI/CD Pipeline Setup
/implement GitHub Actions workflow
> AI creates .github/workflows/ci.yml:
- Build on push/PR
- Run tests
- Check coverage
- Deploy to staging
/test --ci --dry-run
> Pipeline simulation successful ✅
/implement deployment to production
> AI adds:
- Manual approval step
- Rollback capability
- Health checks
- Notifications
/security --scan-pipeline
> AI adds security scanning:
- Dependency scanning
- Container scanning
- Secret scanning
/commit --message "ci: complete CI/CD pipeline with security scanning"
```
## Example 10: Mobile App Development
### Scenario
Building a React Native mobile feature.
### Session Setup
```bash
claude-flow pair --start \
--mode switch \
--agent mobile-expert \
--language react-native \
--test
```
### Session Flow
```
👥 Mobile Development Session
/implement offline-first data sync
> AI implements:
- Local SQLite storage
- Queue for pending changes
- Sync on connection restore
- Conflict resolution
/test --device ios simulator
> Feature working on iOS ✅
/test --device android emulator
> Feature working on Android ✅
/optimize --mobile
> AI optimizes:
- Reduces bundle size by 30%
- Implements lazy loading
- Adds image caching
/review --accessibility
> AI ensures:
- Screen reader support
- Proper contrast ratios
- Touch target sizes
/commit --message "feat: offline-first sync with optimizations"
```
## Common Patterns
### Starting Patterns
```bash
# Quick start for common scenarios
claude-flow pair --template <template>
```
Available templates:
- `feature` - New feature development
- `bugfix` - Bug fixing session
- `refactor` - Code refactoring
- `optimize` - Performance optimization
- `test` - Test writing
- `review` - Code review
- `learn` - Learning session
### Session Commands Flow
#### Typical Feature Development
```
/start → /explain → /design → /implement → /test → /review → /commit → /end
```
#### Typical Bug Fix
```
/start → /reproduce → /debug → /trace → /fix → /test → /verify → /commit → /end
```
#### Typical Refactoring
```
/start → /analyze → /plan → /test-gen → /refactor → /test → /review → /commit → /end
```
## Best Practices from Examples
1. **Always Start with Context** - Use `/explain` or `/analyze`
2. **Test Early and Often** - Run tests after each change
3. **Verify Before Commit** - Check truth scores
4. **Document Decisions** - Use `/note` for important choices
5. **Review Security** - Always run `/security` for sensitive code
6. **Profile Performance** - Use `/perf` for optimization
7. **Save Sessions** - Use `/save` for complex work
## Related Documentation
- [Getting Started](./README.md)
- [Session Management](./session.md)
- [Commands Reference](./commands.md)
- [Configuration](./config.md)
@@ -0,0 +1,348 @@
# Pair Programming Modes
Detailed guide to pair programming modes and their optimal use cases.
## Driver Mode
In driver mode, you write the code while the AI acts as navigator.
### Usage
```bash
claude-flow pair --start --mode driver
```
### Responsibilities
**You (Driver):**
- Write the actual code
- Implement solutions
- Make immediate decisions
- Handle syntax and structure
**AI (Navigator):**
- Provide strategic guidance
- Spot potential issues
- Suggest improvements
- Review in real-time
- Track overall direction
### Best For
- Learning new patterns
- Implementing familiar features
- Quick iterations
- Hands-on debugging
### Example Session
```bash
claude-flow pair --start \
--mode driver \
--agent senior-navigator \
--review \
--verify
```
### Commands in Driver Mode
```
/suggest - Get implementation suggestions
/review - Request code review
/explain - Ask for explanations
/optimize - Request optimization ideas
/patterns - Get pattern recommendations
```
## Navigator Mode
In navigator mode, the AI writes code while you provide guidance.
### Usage
```bash
claude-flow pair --start --mode navigator
```
### Responsibilities
**You (Navigator):**
- Provide high-level direction
- Review generated code
- Make architectural decisions
- Ensure business requirements
**AI (Driver):**
- Write implementation code
- Handle syntax details
- Implement your guidance
- Manage boilerplate
- Execute refactoring
### Best For
- Rapid prototyping
- Boilerplate generation
- Learning from AI patterns
- Exploring solutions
### Example Session
```bash
claude-flow pair --start \
--mode navigator \
--agent expert-coder \
--test \
--language python
```
### Commands in Navigator Mode
```
/implement - Direct implementation
/refactor - Request refactoring
/test - Generate tests
/document - Add documentation
/alternate - See alternative approaches
```
## Switch Mode
Automatically alternates between driver and navigator roles.
### Usage
```bash
claude-flow pair --start --mode switch [--interval <time>]
```
### Default Intervals
- **10 minutes** - Standard switching
- **5 minutes** - Rapid collaboration
- **15 minutes** - Deep focus periods
- **Custom** - Set your preference
### Configuration
```bash
# 5-minute intervals
claude-flow pair --start --mode switch --interval 5m
# 15-minute intervals
claude-flow pair --start --mode switch --interval 15m
# Hour-long intervals
claude-flow pair --start --mode switch --interval 1h
```
### Role Transitions
**Handoff Process:**
1. 30-second warning before switch
2. Current driver completes thought
3. Context summary generated
4. Roles swap smoothly
5. New driver continues
### Best For
- Balanced collaboration
- Knowledge sharing
- Complex features
- Extended sessions
### Example Session
```bash
claude-flow pair --start \
--mode switch \
--interval 10m \
--verify \
--test
```
## Specialized Modes
### TDD Mode
Test-Driven Development focus.
```bash
claude-flow pair --start \
--mode tdd \
--test-first \
--coverage 100
```
**Workflow:**
1. Write failing test (Red)
2. Implement minimal code (Green)
3. Refactor (Refactor)
4. Repeat cycle
### Review Mode
Continuous code review focus.
```bash
claude-flow pair --start \
--mode review \
--strict \
--security
```
**Features:**
- Real-time feedback
- Security scanning
- Performance analysis
- Best practice enforcement
### Mentor Mode
Learning-focused collaboration.
```bash
claude-flow pair --start \
--mode mentor \
--explain-all \
--pace slow
```
**Features:**
- Detailed explanations
- Step-by-step guidance
- Pattern teaching
- Best practice examples
### Debug Mode
Problem-solving focus.
```bash
claude-flow pair --start \
--mode debug \
--verbose \
--trace
```
**Features:**
- Issue identification
- Root cause analysis
- Fix suggestions
- Prevention strategies
## Mode Selection Guide
### Choose Driver Mode When:
- You want hands-on practice
- Learning new concepts
- Implementing your ideas
- Prefer writing code yourself
### Choose Navigator Mode When:
- Need rapid implementation
- Generating boilerplate
- Exploring AI suggestions
- Learning from examples
### Choose Switch Mode When:
- Long sessions planned
- Balanced collaboration needed
- Complex features
- Team simulation
### Choose Specialized Modes When:
- **TDD**: Building with tests
- **Review**: Quality focus
- **Mentor**: Learning priority
- **Debug**: Fixing issues
## Mode Comparison
| Mode | You Write | AI Writes | Best For | Switch Time |
|------|-----------|-----------|----------|-------------|
| Driver | ✅ | ❌ | Learning, Control | N/A |
| Navigator | ❌ | ✅ | Speed, Generation | N/A |
| Switch | ✅/❌ | ✅/❌ | Balance, Long Sessions | 5-60min |
| TDD | ✅/❌ | ✅/❌ | Test-First | Per cycle |
| Review | ✅ | ❌ | Quality | N/A |
| Mentor | ✅ | ❌ | Learning | N/A |
| Debug | ✅/❌ | ✅/❌ | Fixing | N/A |
## Mode Combinations
### Quality-Focused
```bash
claude-flow pair --start \
--mode switch \
--verify \
--test \
--review \
--threshold 0.98
```
### Learning-Focused
```bash
claude-flow pair --start \
--mode mentor \
--explain-all \
--examples \
--pace slow
```
### Speed-Focused
```bash
claude-flow pair --start \
--mode navigator \
--quick \
--templates \
--no-review
```
### Debug-Focused
```bash
claude-flow pair --start \
--mode debug \
--trace \
--verbose \
--breakpoints
```
## Switching Modes Mid-Session
During any session, you can switch modes:
```
/mode driver - Switch to driver mode
/mode navigator - Switch to navigator mode
/mode switch - Enable auto-switching
/mode tdd - Switch to TDD mode
/mode review - Switch to review mode
```
## Mode Persistence
Save mode preferences:
```json
// .claude-flow/config.json
{
"pair": {
"defaultMode": "switch",
"switchInterval": "10m",
"preferredRole": "driver",
"autoSwitchOnIdle": true
}
}
```
## Best Practices by Mode
### Driver Mode
1. Ask questions frequently
2. Request reviews often
3. Use suggestions wisely
4. Learn from feedback
### Navigator Mode
1. Provide clear direction
2. Review thoroughly
3. Test generated code
4. Understand implementations
### Switch Mode
1. Prepare for handoffs
2. Maintain context
3. Document decisions
4. Stay synchronized
## Related Documentation
- [Pair Programming Overview](./README.md)
- [Starting Sessions](./start.md)
- [Session Management](./session.md)
- [Configuration](./config.md)
@@ -0,0 +1,407 @@
# Pair Programming Session Management
Complete guide to managing pair programming sessions.
## Session Lifecycle
### 1. Initialization
```bash
claude-flow pair --start
```
### 2. Active Session
- Real-time collaboration
- Continuous verification
- Quality monitoring
- Role management
### 3. Completion
```bash
claude-flow pair --end
```
## Session Commands
During an active session, use these commands:
### Basic Commands
```
/help - Show all available commands
/status - Current session status
/metrics - View quality metrics
/pause - Pause current session
/resume - Resume paused session
/end - End current session
```
### Code Commands
```
/explain - Explain current code
/suggest - Get improvement suggestions
/refactor - Refactor selected code
/optimize - Optimize for performance
/document - Add documentation
/comment - Add inline comments
```
### Testing Commands
```
/test - Run test suite
/test-gen - Generate tests
/coverage - Check test coverage
/test-watch - Enable test watching
/mock - Generate mocks
```
### Review Commands
```
/review - Full code review
/security - Security analysis
/perf - Performance review
/quality - Quality metrics
/lint - Run linters
```
### Navigation Commands
```
/goto <file> - Navigate to file
/find <text> - Search in project
/recent - Recent files
/bookmark - Bookmark location
/history - Command history
```
### Role Commands
```
/switch - Switch driver/navigator
/mode <type> - Change mode
/role - Show current role
/handoff - Prepare role handoff
```
### Git Commands
```
/diff - Show changes
/commit - Commit with verification
/branch - Branch operations
/stash - Stash changes
/log - View git log
```
## Session Status
Check current session status:
```bash
claude-flow pair --status
```
Output:
```
👥 Pair Programming Session
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Session ID: pair_1755021234567
Duration: 45 minutes
Status: Active
Partner: senior-dev
Current Role: DRIVER (you)
Mode: Switch (10m intervals)
Next Switch: in 3 minutes
📊 Metrics:
├── Truth Score: 0.982 ✅
├── Lines Changed: 234
├── Files Modified: 5
├── Tests Added: 12
├── Coverage: 87% ↑3%
└── Commits: 3
🎯 Focus: Implementation
📝 Current File: src/auth/login.js
```
## Session History
View past sessions:
```bash
claude-flow pair --history
```
Output:
```
📚 Session History
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
1. 2024-01-15 14:30 - 16:45 (2h 15m)
Partner: expert-coder
Focus: Refactoring
Truth Score: 0.975
Changes: +340 -125 lines
2. 2024-01-14 10:00 - 11:30 (1h 30m)
Partner: tdd-specialist
Focus: Testing
Truth Score: 0.991
Tests Added: 24
3. 2024-01-13 15:00 - 17:00 (2h)
Partner: debugger-expert
Focus: Bug Fixing
Truth Score: 0.968
Issues Fixed: 5
```
## Session Metrics
Real-time metrics during session:
### Truth Score
```
Current: 0.982 ✅
Average: 0.975
Minimum: 0.951
Threshold: 0.950
```
### Productivity
```
Lines Changed: 234
Files Modified: 5
Functions Added: 8
Functions Refactored: 3
```
### Quality
```
Test Coverage: 87% ↑3%
Lint Issues: 0
Security Issues: 0
Performance Issues: 1 ⚠️
```
### Collaboration
```
Suggestions Given: 45
Suggestions Accepted: 38 (84%)
Reviews Completed: 12
Rollbacks: 1
```
## Session Persistence
### Save Session
```bash
claude-flow pair --save [--name <name>]
```
### Load Session
```bash
claude-flow pair --load <session-id>
```
### Export Session
```bash
claude-flow pair --export <session-id> [--format json|md]
```
## Background Sessions
Run pair programming in background:
### Start Background Session
```bash
claude-flow pair --start --background
```
### Monitor Background Session
```bash
claude-flow pair --monitor
```
### Attach to Background Session
```bash
claude-flow pair --attach <session-id>
```
## Session Configuration
### Default Settings
```json
{
"pair": {
"session": {
"autoSave": true,
"saveInterval": "5m",
"maxDuration": "4h",
"idleTimeout": "15m",
"metricsInterval": "1m"
}
}
}
```
### Per-Session Config
```bash
claude-flow pair --start \
--config custom-config.json
```
## Session Templates
### Refactoring Template
```bash
claude-flow pair --template refactor
```
- Focus: Code improvement
- Verification: High (0.98)
- Testing: After each change
- Review: Continuous
### Feature Template
```bash
claude-flow pair --template feature
```
- Focus: Implementation
- Verification: Standard (0.95)
- Testing: On completion
- Review: Pre-commit
### Debug Template
```bash
claude-flow pair --template debug
```
- Focus: Problem solving
- Verification: Moderate (0.90)
- Testing: Regression tests
- Review: Root cause
### Learning Template
```bash
claude-flow pair --template learn
```
- Mode: Mentor
- Pace: Slow
- Explanations: Detailed
- Examples: Many
## Session Reports
Generate session report:
```bash
claude-flow pair --report <session-id>
```
Report includes:
- Session summary
- Metrics overview
- Code changes
- Test results
- Quality scores
- Learning points
- Recommendations
## Multi-Session Management
### List Active Sessions
```bash
claude-flow pair --list
```
### Switch Between Sessions
```bash
claude-flow pair --switch <session-id>
```
### Merge Sessions
```bash
claude-flow pair --merge <session-1> <session-2>
```
## Session Recovery
### Auto-Recovery
Sessions auto-save every 5 minutes with recovery points.
### Manual Recovery
```bash
claude-flow pair --recover [--point <timestamp>]
```
### Crash Recovery
```bash
claude-flow pair --crash-recovery
```
## Session Sharing
### Share with Team
```bash
claude-flow pair --share <session-id> \
--team <team-id>
```
### Export for Review
```bash
claude-flow pair --export-review <session-id>
```
### Create Learning Material
```bash
claude-flow pair --create-tutorial <session-id>
```
## Advanced Features
### Session Recording
```bash
claude-flow pair --start --record
```
Records all interactions for playback.
### Session Replay
```bash
claude-flow pair --replay <session-id>
```
Replay recorded session for learning.
### Session Analytics
```bash
claude-flow pair --analytics <session-id>
```
Deep analysis of session patterns.
## Troubleshooting
### Session Won't Start
- Check agent availability
- Verify configuration
- Ensure clean workspace
### Session Disconnected
- Use `--recover` to restore
- Check network connection
- Verify background processes
### Poor Performance
- Reduce verification threshold
- Disable continuous testing
- Check system resources
## Best Practices
1. **Regular Saves** - Auto-save enabled
2. **Clear Goals** - Define objectives
3. **Appropriate Duration** - 1-2 hour sessions
4. **Breaks** - Take regular breaks
5. **Review** - End with summary
## Related Commands
- `pair --start` - Start new session
- `pair --config` - Configure settings
- `pair --templates` - Manage templates
- `pair --analytics` - View analytics
@@ -0,0 +1,209 @@
# pair --start
Start a new pair programming session with AI assistance.
## Usage
```bash
claude-flow pair --start [options]
```
## Options
- `--agent <name>` - AI pair partner (default: auto-select)
- `--mode <type>` - Programming mode: driver, navigator, switch
- `--verify` - Enable real-time verification
- `--threshold <0-1>` - Verification threshold (default: 0.95)
- `--focus <area>` - Focus area: refactor, test, debug, implement
- `--language <lang>` - Primary programming language
- `--review` - Enable continuous code review
- `--test` - Run tests after each change
- `--interval <time>` - Switch interval for switch mode (default: 10m)
## Examples
### Basic Start
```bash
claude-flow pair --start
```
### Expert Refactoring Session
```bash
claude-flow pair --start \
--agent senior-dev \
--focus refactor \
--verify \
--threshold 0.98
```
### TDD Session
```bash
claude-flow pair --start \
--mode driver \
--focus test \
--test \
--language javascript
```
### Debugging Session
```bash
claude-flow pair --start \
--agent debugger-expert \
--focus debug \
--review
```
## Session Initialization
When starting a session, the system:
1. **Selects AI Partner** - Matches expertise to your needs
2. **Configures Environment** - Sets up verification and testing
3. **Establishes Roles** - Defines driver/navigator responsibilities
4. **Loads Context** - Imports project information
5. **Begins Monitoring** - Tracks quality metrics
## Modes Explained
### Driver Mode
You write code while AI:
- Provides real-time suggestions
- Reviews changes instantly
- Catches potential issues
- Suggests improvements
### Navigator Mode
AI writes code while you:
- Provide high-level guidance
- Review generated code
- Request modifications
- Control direction
### Switch Mode
Automatically alternates roles:
- Default: 10-minute intervals
- Configurable timing
- Smooth handoffs
- Shared context
## Focus Areas
### Refactor
- Code structure improvements
- Pattern implementation
- Performance optimization
- Readability enhancement
### Test
- Test-driven development
- Test coverage improvement
- Edge case identification
- Mock creation
### Debug
- Issue identification
- Root cause analysis
- Fix suggestions
- Prevention strategies
### Implement
- Feature development
- API creation
- UI components
- Business logic
## Quality Features
### Verification
- Real-time truth scoring
- Automatic rollback on failures
- Quality gates before commits
- Continuous monitoring
### Code Review
- Instant feedback
- Best practice enforcement
- Security scanning
- Performance analysis
### Testing
- Automatic test generation
- Coverage tracking
- Integration suggestions
- Regression prevention
## Session Output
```
👥 Pair Programming Session Started
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Session ID: pair_1755021234567
Partner: senior-dev
Mode: Switch (10m intervals)
Focus: Implementation
Language: JavaScript
Verification: ✅ Enabled (0.95 threshold)
Testing: ✅ Auto-run on save
Review: ✅ Continuous
Current Role: DRIVER (you)
Navigator: senior-dev is ready...
📝 Workspace: /workspaces/my-project
📊 Truth Score: 0.972 ✅
🧪 Test Coverage: 84%
Type /help for commands or start coding...
```
## Background Execution
Start sessions in background for long-running collaboration:
```bash
# Start in background
claude-flow pair --start --background
# Monitor session
claude-flow pair status
# View session output
claude-flow pair output session_id
# End background session
claude-flow pair --end session_id
```
## Integration
### With Git
```bash
claude-flow pair --start --git --auto-commit
```
### With CI/CD
```bash
claude-flow pair --start --ci --non-interactive
```
### With IDE
```bash
claude-flow pair --start --ide vscode
```
## Best Practices
1. **Clear Goals** - Define session objectives
2. **Appropriate Mode** - Choose based on task
3. **Enable Verification** - For critical code
4. **Regular Testing** - Maintain quality
5. **Session Notes** - Document decisions
## Related Commands
- `pair --end` - End current session
- `pair --status` - Check session status
- `pair --history` - View past sessions
- `pair --config` - Configure defaults
@@ -0,0 +1,166 @@
---
name: sparc
description: Execute SPARC methodology workflows with Claude-Flow
---
# ⚡️ SPARC Development Methodology
You are SPARC, the orchestrator of complex workflows. You break down large objectives into delegated subtasks aligned to the SPARC methodology. You ensure secure, modular, testable, and maintainable delivery using the appropriate specialist modes.
## SPARC Workflow
Follow SPARC:
1. Specification: Clarify objectives and scope. Never allow hard-coded env vars.
2. Pseudocode: Request high-level logic with TDD anchors.
3. Architecture: Ensure extensible system diagrams and service boundaries.
4. Refinement: Use TDD, debugging, security, and optimization flows.
5. Completion: Integrate, document, and monitor for continuous improvement.
Use `new_task` to assign:
- spec-pseudocode
## Available SPARC Modes
- `/sparc-architect` - 🏗️ Architect
- `/sparc-code` - 🧠 Auto-Coder
- `/sparc-tdd` - 🧪 Tester (TDD)
- `/sparc-debug` - 🪲 Debugger
- `/sparc-security-review` - 🛡️ Security Reviewer
- `/sparc-docs-writer` - 📚 Documentation Writer
- `/sparc-integration` - 🔗 System Integrator
- `/sparc-post-deployment-monitoring-mode` - 📈 Deployment Monitor
- `/sparc-refinement-optimization-mode` - 🧹 Optimizer
- `/sparc-ask` - ❓Ask
- `/sparc-devops` - 🚀 DevOps
- `/sparc-tutorial` - 📘 SPARC Tutorial
- `/sparc-supabase-admin` - 🔐 Supabase Admin
- `/sparc-spec-pseudocode` - 📋 Specification Writer
- `/sparc-mcp` - ♾️ MCP Integration
- `/sparc-sparc` - ⚡️ SPARC Orchestrator
## Quick Start
### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
// Run SPARC orchestrator (default)
mcp__claude-flow__sparc_mode {
mode: "sparc",
task_description: "build complete authentication system"
}
// Run a specific mode
mcp__claude-flow__sparc_mode {
mode: "architect",
task_description: "design API structure"
}
// TDD workflow
mcp__claude-flow__sparc_mode {
mode: "tdd",
task_description: "implement user authentication",
options: {workflow: "full"}
}
```
### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Run SPARC orchestrator (default)
npx claude-flow sparc "build complete authentication system"
# Run a specific mode
npx claude-flow sparc run architect "design API structure"
npx claude-flow sparc run tdd "implement user service"
# Execute full TDD workflow
npx claude-flow sparc tdd "implement user authentication"
# List all modes with details
npx claude-flow sparc modes --verbose
# For alpha features
npx claude-flow@alpha sparc run <mode> "your task"
```
### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc "build complete authentication system"
./claude-flow sparc run architect "design API structure"
```
## SPARC Methodology Phases
1. **📋 Specification**: Define requirements, constraints, and acceptance criteria
2. **🧠 Pseudocode**: Create detailed logic flows and algorithmic planning
3. **🏗️ Architecture**: Design system structure, APIs, and component boundaries
4. **🔄 Refinement**: Implement with TDD (Red-Green-Refactor cycle)
5. **✅ Completion**: Integrate, document, and validate against requirements
## Memory Integration
### Using MCP Tools (Preferred)
```javascript
// Store specifications
mcp__claude-flow__memory_usage {
action: "store",
key: "spec_auth",
value: "OAuth2 + JWT requirements",
namespace: "spec"
}
// Store architectural decisions
mcp__claude-flow__memory_usage {
action: "store",
key: "arch_decisions",
value: "Microservices with API Gateway",
namespace: "architecture"
}
```
### Using NPX CLI (Fallback)
```bash
# Store specifications
npx claude-flow memory store "spec_auth" "OAuth2 + JWT requirements" --namespace spec
# Store architectural decisions
./claude-flow memory store "arch_api" "RESTful microservices design" --namespace arch
# Query previous work
./claude-flow memory query "authentication" --limit 10
# Export project memory
./claude-flow memory export sparc-project-backup.json
```
## Advanced Swarm Mode
For complex tasks requiring multiple agents with timeout-free execution:
```bash
# Development swarm with monitoring
./claude-flow swarm "Build e-commerce platform" --strategy development --monitor --review
# Background optimization swarm
./claude-flow swarm "Optimize system performance" --strategy optimization --background
# Distributed research swarm
./claude-flow swarm "Analyze market trends" --strategy research --distributed --ui
```
## Non-Interactive Mode
For CI/CD integration and automation:
```bash
./claude-flow sparc run code "implement API" --non-interactive
./claude-flow sparc tdd "user tests" --non-interactive --enable-permissions
```
## Best Practices
✅ **Modular Design**: Keep files under 500 lines
✅ **Environment Safety**: Never hardcode secrets or env values
✅ **Test-First**: Always write tests before implementation
✅ **Memory Usage**: Store important decisions and context
✅ **Task Completion**: All tasks should end with `attempt_completion`
See `/claude-flow-help` for all available commands.
@@ -0,0 +1,52 @@
# SPARC Analyzer Mode
## Purpose
Deep code and data analysis with batch processing capabilities.
## Activation
### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
mode: "analyzer",
task_description: "analyze codebase performance",
options: {
parallel: true,
detailed: true
}
}
```
### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run analyzer "analyze codebase performance"
# For alpha features
npx claude-flow@alpha sparc run analyzer "analyze codebase performance"
```
### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run analyzer "analyze codebase performance"
```
## Core Capabilities
- Code analysis with parallel file processing
- Data pattern recognition
- Performance profiling
- Memory usage analysis
- Dependency mapping
## Batch Operations
- Parallel file analysis using concurrent Read operations
- Batch pattern matching with Grep tool
- Simultaneous metric collection
- Aggregated reporting
## Output Format
- Detailed analysis reports
- Performance metrics
- Improvement recommendations
- Visualizations when applicable
@@ -0,0 +1,53 @@
# SPARC Architect Mode
## Purpose
System design with Memory-based coordination for scalable architectures.
## Activation
### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
mode: "architect",
task_description: "design microservices architecture",
options: {
detailed: true,
memory_enabled: true
}
}
```
### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run architect "design microservices architecture"
# For alpha features
npx claude-flow@alpha sparc run architect "design microservices architecture"
```
### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run architect "design microservices architecture"
```
## Core Capabilities
- System architecture design
- Component interface definition
- Database schema design
- API contract specification
- Infrastructure planning
## Memory Integration
- Store architecture decisions in Memory
- Share component specifications across agents
- Maintain design consistency
- Track architectural evolution
## Design Patterns
- Microservices
- Event-driven architecture
- Domain-driven design
- Hexagonal architecture
- CQRS and Event Sourcing
@@ -0,0 +1,97 @@
---
name: sparc-ask
description: ❓Ask - You are a task-formulation guide that helps users navigate, ask, and delegate tasks to the correc...
---
# ❓Ask
## Role Definition
You are a task-formulation guide that helps users navigate, ask, and delegate tasks to the correct SPARC modes.
## Custom Instructions
Guide users to ask questions using SPARC methodology:
• 📋 `spec-pseudocode` – logic plans, pseudocode, flow outlines
• 🏗️ `architect` – system diagrams, API boundaries
• 🧠 `code` – implement features with env abstraction
• 🧪 `tdd` – test-first development, coverage tasks
• 🪲 `debug` – isolate runtime issues
• 🛡️ `security-review` – check for secrets, exposure
• 📚 `docs-writer` – create markdown guides
• 🔗 `integration` – link services, ensure cohesion
• 📈 `post-deployment-monitoring-mode` – observe production
• 🧹 `refinement-optimization-mode` – refactor & optimize
• 🔐 `supabase-admin` – manage Supabase database, auth, and storage
Help users craft `new_task` messages to delegate effectively, and always remind them:
✅ Modular
✅ Env-safe
✅ Files < 500 lines
✅ Use `attempt_completion`
## Available Tools
- **read**: File reading and viewing
## Usage
### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
mode: "ask",
task_description: "help me choose the right mode",
options: {
namespace: "ask",
non_interactive: false
}
}
```
### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run ask "help me choose the right mode"
# For alpha features
npx claude-flow@alpha sparc run ask "help me choose the right mode"
# With namespace
npx claude-flow sparc run ask "your task" --namespace ask
# Non-interactive mode
npx claude-flow sparc run ask "your task" --non-interactive
```
### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run ask "help me choose the right mode"
```
## Memory Integration
### Using MCP Tools (Preferred)
```javascript
// Store mode-specific context
mcp__claude-flow__memory_usage {
action: "store",
key: "ask_context",
value: "important decisions",
namespace: "ask"
}
// Query previous work
mcp__claude-flow__memory_search {
pattern: "ask",
namespace: "ask",
limit: 5
}
```
### Using NPX CLI (Fallback)
```bash
# Store mode-specific context
npx claude-flow memory store "ask_context" "important decisions" --namespace ask
# Query previous work
npx claude-flow memory query "ask" --limit 5
```
@@ -0,0 +1,54 @@
# SPARC Batch Executor Mode
## Purpose
Parallel task execution specialist using batch operations.
## Activation
### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
mode: "batch-executor",
task_description: "process multiple files",
options: {
parallel: true,
batch_size: 10
}
}
```
### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run batch-executor "process multiple files"
# For alpha features
npx claude-flow@alpha sparc run batch-executor "process multiple files"
```
### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run batch-executor "process multiple files"
```
## Core Capabilities
- Parallel file operations
- Concurrent task execution
- Resource optimization
- Load balancing
- Progress tracking
## Execution Patterns
- Parallel Read/Write operations
- Concurrent Edit operations
- Batch file transformations
- Distributed processing
- Pipeline orchestration
## Performance Features
- Dynamic resource allocation
- Automatic load balancing
- Progress monitoring
- Error recovery
- Result aggregation
@@ -0,0 +1,89 @@
---
name: sparc-code
description: 🧠 Auto-Coder - You write clean, efficient, modular code based on pseudocode and architecture. You use configurat...
---
# 🧠 Auto-Coder
## Role Definition
You write clean, efficient, modular code based on pseudocode and architecture. You use configuration for environments and break large components into maintainable files.
## Custom Instructions
Write modular code using clean architecture principles. Never hardcode secrets or environment values. Split code into files < 500 lines. Use config files or environment abstractions. Use `new_task` for subtasks and finish with `attempt_completion`.
## Tool Usage Guidelines:
- Use `insert_content` when creating new files or when the target file is empty
- Use `apply_diff` when modifying existing code, always with complete search and replace blocks
- Only use `search_and_replace` as a last resort and always include both search and replace parameters
- Always verify all required parameters are included before executing any tool
## Available Tools
- **read**: File reading and viewing
- **edit**: File modification and creation
- **browser**: Web browsing capabilities
- **mcp**: Model Context Protocol tools
- **command**: Command execution
## Usage
### Option 1: Using MCP Tools (Preferred in Claude Code)
```javascript
mcp__claude-flow__sparc_mode {
mode: "code",
task_description: "implement REST API endpoints",
options: {
namespace: "code",
non_interactive: false
}
}
```
### Option 2: Using NPX CLI (Fallback when MCP not available)
```bash
# Use when running from terminal or MCP tools unavailable
npx claude-flow sparc run code "implement REST API endpoints"
# For alpha features
npx claude-flow@alpha sparc run code "implement REST API endpoints"
# With namespace
npx claude-flow sparc run code "your task" --namespace code
# Non-interactive mode
npx claude-flow sparc run code "your task" --non-interactive
```
### Option 3: Local Installation
```bash
# If claude-flow is installed locally
./claude-flow sparc run code "implement REST API endpoints"
```
## Memory Integration
### Using MCP Tools (Preferred)
```javascript
// Store mode-specific context
mcp__claude-flow__memory_usage {
action: "store",
key: "code_context",
value: "important decisions",
namespace: "code"
}
// Query previous work
mcp__claude-flow__memory_search {
pattern: "code",
namespace: "code",
limit: 5
}
```
### Using NPX CLI (Fallback)
```bash
# Store mode-specific context
npx claude-flow memory store "code_context" "important decisions" --namespace code
# Query previous work
npx claude-flow memory query "code" --limit 5
```
Loaded 100 of 199 files, more files were not shown because too many files have changed in this diff. Show more