diff --git a/docs/maestro/WORKFLOW-GUIDE.md b/docs/maestro/WORKFLOW-GUIDE.md new file mode 100644 index 0000000000..72d87fcfe2 --- /dev/null +++ b/docs/maestro/WORKFLOW-GUIDE.md @@ -0,0 +1,1868 @@ +# Maestro Specs-Driven Development Workflow Guide + +## Overview + +This comprehensive guide walks you through the complete Maestro specs-driven development workflow using native hive mind swarm intelligence. The workflow consists of 5 main phases, each powered by specialized agents working in coordination. + +## ๐Ÿง  Native Hive Mind Architecture + +The Maestro workflow leverages a **specs-driven topology** with 6 specialized agent types: + +``` +Maestro Specs-Driven Swarm Topology +โ”œโ”€โ”€ requirements_analyst (1) # Requirements & user stories +โ”œโ”€โ”€ design_architect (2) # Parallel design with consensus +โ”œโ”€โ”€ task_planner (1) # Implementation planning +โ”œโ”€โ”€ implementation_coder (2) # Parallel implementation +โ”œโ”€โ”€ quality_reviewer (1) # Quality gates & validation +โ””โ”€โ”€ steering_documenter (1) # Governance & documentation +``` + +## ๐Ÿš€ Complete Workflow Overview + +```mermaid +graph TD + A[Initial Request] --> B[Requirements Clarification] + B --> C[Research & Design] + C --> D[Implementation Planning] + D --> E[Task Execution] + E --> F[Quality Gates] + F --> G[Completion] + + B1[requirements_analyst] --> B + C1[design_architect x2] --> C + C2[consensus validation] --> C + D1[task_planner] --> D + E1[implementation_coder x2] --> E + F1[quality_reviewer] --> F + G1[steering_documenter] --> G +``` + +--- + +## Phase 1: Requirements Clarification + +### ๐ŸŽฏ **Objective** +Transform initial feature requests into structured requirements with user stories and acceptance criteria. + +### ๐Ÿค– **Agent**: `requirements_analyst` +- **Strategy**: Sequential execution for consistency +- **Capabilities**: `requirements_analysis`, `user_story_creation`, `acceptance_criteria` + +### ๐Ÿ“‹ **Step-by-Step Process** + +#### Step 1.1: Initialize Maestro Swarm +```bash +# The swarm initialization happens automatically with the first command +npx claude-flow maestro create-spec user-authentication \ + --request "Implement secure user authentication with JWT tokens" +``` + +**What happens internally:** +1. Native hive mind swarm initializes with specs-driven topology +2. 8 specialized agents spawn automatically +3. Swarm memory initializes with default steering documents +4. Queen coordination mode activates for strategic task distribution + +#### Step 1.2: Requirements Analysis Process +The `requirements_analyst` agent performs: + +1. **Requirements Gathering** + - Analyzes initial request for scope and complexity + - Identifies stakeholders and user personas + - Extracts functional and non-functional requirements + +2. **User Story Creation** + - Converts requirements into user story format + - Follows "As a [user], I want [goal] so that [benefit]" structure + - Prioritizes stories by business value + +3. **Acceptance Criteria Definition** + - Creates testable acceptance criteria for each user story + - Uses Given-When-Then format where appropriate + - Defines definition of done + +#### Step 1.3: Generated Output Structure +```markdown +# Feature Requirements: user-authentication + +## Overview +Comprehensive user authentication system with JWT token-based security. + +## User Stories + +### Epic: User Authentication +**As a** user +**I want** to securely authenticate to the system +**So that** I can access protected resources safely + +#### Story 1: User Login +**As a** registered user +**I want** to login with email and password +**So that** I can access my account + +**Acceptance Criteria:** +- [ ] User can login with valid email/password combination +- [ ] System rejects invalid credentials with clear error message +- [ ] JWT token is generated upon successful authentication +- [ ] Token expires after configurable time period + +#### Story 2: Password Security +**As a** security-conscious user +**I want** my password to be securely stored +**So that** my account remains protected + +**Acceptance Criteria:** +- [ ] Passwords are hashed using bcrypt with salt rounds โ‰ฅ 12 +- [ ] Plain text passwords are never stored +- [ ] Password strength requirements are enforced +``` + +#### Step 1.4: Validation & Review +```bash +# Check the generated requirements +cat docs/maestro/specs/user-authentication/requirements.md + +# Review workflow status +npx claude-flow maestro status user-authentication --detailed +``` + +--- + +## Phase 2: Research & Design + +### ๐ŸŽฏ **Objective** +Create comprehensive technical design through parallel architecture development with consensus validation. + +### ๐Ÿค– **Agents**: `design_architect` (2 agents) +- **Strategy**: Parallel execution with consensus validation +- **Capabilities**: `system_design`, `architecture`, `specs_driven_design` + +### ๐Ÿ“‹ **Step-by-Step Process** + +#### Step 2.1: Initiate Design Generation +```bash +npx claude-flow maestro generate-design user-authentication +``` + +#### Step 2.2: Parallel Design Process +**What happens internally:** + +1. **Agent Coordination** + - 2 design_architect agents work simultaneously + - Each agent develops independent design proposals + - Queen coordinates resource allocation and task distribution + +2. **Parallel Design Development** + + **Agent 1 Focus Areas:** + - Database schema design + - Authentication flow architecture + - Security considerations + + **Agent 2 Focus Areas:** + - API endpoint design + - Token management strategy + - Error handling patterns + +3. **Consensus Validation** + - Both agents must achieve โ‰ฅ66% agreement on design decisions + - Byzantine fault-tolerant consensus ensures reliability + - Conflicting designs trigger additional negotiation rounds + +#### Step 2.3: Design Integration & Output +The consensus process produces integrated design covering: + +```markdown +# Technical Design: user-authentication + +## Architecture Overview +Microservice-based authentication system with JWT token management. + +## System Components + +### 1. Authentication Service +- **Purpose**: Handle login/logout operations +- **Technology**: Node.js with Express +- **Database**: PostgreSQL with bcrypt hashing + +### 2. Token Management +- **JWT Implementation**: jsonwebtoken library +- **Token Storage**: Redis for blacklisting +- **Refresh Strategy**: Rolling refresh tokens + +### 3. Security Layer +- **Rate Limiting**: Express-rate-limit (5 attempts/minute) +- **CORS Configuration**: Strict origin validation +- **Input Validation**: Joi schema validation + +## API Design + +### POST /auth/login +```json +{ + "email": "user@example.com", + "password": "securePassword123" +} +``` + +**Response (Success):** +```json +{ + "success": true, + "token": "eyJhbGciOiJIUzI1NiIs...", + "refreshToken": "abc123...", + "expiresIn": 3600 +} +``` + +## Database Schema +```sql +CREATE TABLE users ( + id SERIAL PRIMARY KEY, + email VARCHAR(255) UNIQUE NOT NULL, + password_hash VARCHAR(255) NOT NULL, + created_at TIMESTAMP DEFAULT NOW(), + last_login TIMESTAMP +); +``` + +## Consensus Decision Summary +- โœ… JWT tokens with 1-hour expiration (Agreement: 85%) +- โœ… Bcrypt with 12 salt rounds (Agreement: 100%) +- โœ… Redis for token blacklisting (Agreement: 75%) +- โœ… Rate limiting at 5 attempts/minute (Agreement: 90%) +``` + +#### Step 2.4: Design Validation +```bash +# Review generated design +cat docs/maestro/specs/user-authentication/design.md + +# Check consensus details +npx claude-flow maestro status user-authentication --json | jq '.consensusHistory' +``` + +--- + +## Phase 3: Implementation Planning + +### ๐ŸŽฏ **Objective** +Break down the technical design into actionable implementation tasks with clear dependencies. + +### ๐Ÿค– **Agent**: `task_planner` +- **Strategy**: Sequential execution for coherent task breakdown +- **Capabilities**: `task_management`, `workflow_orchestration` + +### ๐Ÿ“‹ **Step-by-Step Process** + +#### Step 3.1: Generate Implementation Tasks +```bash +npx claude-flow maestro generate-tasks user-authentication +``` + +#### Step 3.2: Task Planning Process +The `task_planner` agent performs: + +1. **Design Analysis** + - Parses technical design document + - Identifies all system components + - Maps dependencies between components + +2. **Task Decomposition** + - Breaks design into implementable tasks + - Estimates task complexity and duration + - Defines task dependencies and order + +3. **Resource Planning** + - Assigns tasks to appropriate skill areas + - Balances workload across implementation phases + - Identifies critical path items + +#### Step 3.3: Generated Task Structure +```markdown +# Implementation Tasks: user-authentication + +## Phase 1: Foundation Setup +**Estimated Duration**: 4-6 hours + +- [ ] **Task 1**: Initialize project structure + - Create Node.js project with TypeScript + - Setup Express server framework + - Configure development environment + - **Dependencies**: None + - **Assigned to**: implementation_coder + +- [ ] **Task 2**: Database setup and configuration + - Setup PostgreSQL database + - Create users table schema + - Configure database connection pool + - **Dependencies**: Task 1 + - **Assigned to**: implementation_coder + +- [ ] **Task 3**: Basic middleware configuration + - Setup CORS middleware + - Configure request parsing + - Add basic error handling + - **Dependencies**: Task 1 + - **Assigned to**: implementation_coder + +## Phase 2: Core Authentication +**Estimated Duration**: 6-8 hours + +- [ ] **Task 4**: Password hashing service + - Implement bcrypt hashing with salt rounds + - Create password validation utilities + - Add password strength checking + - **Dependencies**: Task 2 + - **Assigned to**: implementation_coder + +- [ ] **Task 5**: JWT token service + - Implement JWT generation and validation + - Setup token signing and verification + - Create token payload structure + - **Dependencies**: Task 2 + - **Assigned to**: implementation_coder + +- [ ] **Task 6**: User authentication endpoint + - Create POST /auth/login endpoint + - Implement credential validation + - Integrate password checking and token generation + - **Dependencies**: Task 4, Task 5 + - **Assigned to**: implementation_coder + +## Phase 3: Security & Validation +**Estimated Duration**: 4-5 hours + +- [ ] **Task 7**: Input validation middleware + - Implement Joi schema validation + - Create email and password validators + - Add request sanitization + - **Dependencies**: Task 3 + - **Assigned to**: implementation_coder + +- [ ] **Task 8**: Rate limiting implementation + - Setup express-rate-limit middleware + - Configure rate limiting rules + - Add rate limit exceeded responses + - **Dependencies**: Task 3 + - **Assigned to**: implementation_coder + +- [ ] **Task 9**: Redis integration for token blacklisting + - Setup Redis connection + - Implement token blacklist functionality + - Create logout endpoint with token invalidation + - **Dependencies**: Task 5 + - **Assigned to**: implementation_coder + +## Phase 4: Testing & Quality +**Estimated Duration**: 6-8 hours + +- [ ] **Task 10**: Unit tests for core services + - Test password hashing service + - Test JWT token service + - Test validation middleware + - **Dependencies**: Task 4, Task 5, Task 7 + - **Assigned to**: quality_reviewer + +- [ ] **Task 11**: Integration tests for authentication + - Test complete login flow + - Test error scenarios and edge cases + - Test rate limiting behavior + - **Dependencies**: Task 6, Task 8 + - **Assigned to**: quality_reviewer + +- [ ] **Task 12**: Security testing and validation + - Verify password hashing security + - Test JWT token security + - Validate rate limiting effectiveness + - **Dependencies**: All previous tasks + - **Assigned to**: quality_reviewer + +## Critical Path +Task 1 โ†’ Task 2 โ†’ Task 4 โ†’ Task 5 โ†’ Task 6 โ†’ Task 11 โ†’ Task 12 + +## Resource Allocation +- **implementation_coder agents**: Tasks 1-9 (parallel execution where possible) +- **quality_reviewer agent**: Tasks 10-12 (sequential validation) +- **Total Estimated Duration**: 20-27 hours +``` + +#### Step 3.4: Task Validation +```bash +# Review generated tasks +cat docs/maestro/specs/user-authentication/tasks.md + +# Check task dependencies +npx claude-flow maestro status user-authentication --detailed +``` + +--- + +## Phase 4: Task Execution + +### ๐ŸŽฏ **Objective** +Implement the planned tasks using parallel execution with native hive mind coordination. + +### ๐Ÿค– **Agents**: `implementation_coder` (2 agents) +- **Strategy**: Parallel execution for faster implementation +- **Capabilities**: `code_generation`, `implementation`, `debugging` + +### ๐Ÿ“‹ **Step-by-Step Process** + +#### Step 4.1: Begin Task Implementation +```bash +# Implement first task +npx claude-flow maestro implement-task user-authentication 1 + +# Check progress +npx claude-flow maestro status user-authentication +``` + +#### Step 4.2: Parallel Implementation Process +**What happens internally:** + +1. **Task Assignment** + - Queen coordinator assigns tasks to available implementation_coder agents + - Dependencies are respected automatically + - Load balancing ensures optimal resource utilization + +2. **Parallel Execution** + + **Agent 1 might work on:** + - Project structure setup (Task 1) + - Database configuration (Task 2) + - Password hashing service (Task 4) + + **Agent 2 might work on:** + - Middleware configuration (Task 3) + - JWT token service (Task 5) + - Input validation (Task 7) + +3. **Code Generation & Implementation** + - Agents generate production-ready code + - Follow established patterns and best practices + - Integrate with steering document guidelines + +#### Step 4.3: Example Implementation Output + +**Task 1 Output** (Project Structure): +```typescript +// src/app.ts +import express from 'express'; +import cors from 'cors'; +import helmet from 'helmet'; +import { authRoutes } from './routes/auth'; +import { errorHandler } from './middleware/errorHandler'; + +const app = express(); + +// Security middleware +app.use(helmet()); +app.use(cors({ + origin: process.env.ALLOWED_ORIGINS?.split(','), + credentials: true +})); + +// Body parsing +app.use(express.json({ limit: '10mb' })); +app.use(express.urlencoded({ extended: true })); + +// Routes +app.use('/auth', authRoutes); + +// Error handling +app.use(errorHandler); + +export { app }; +``` + +**Task 4 Output** (Password Hashing): +```typescript +// src/services/passwordService.ts +import bcrypt from 'bcrypt'; + +export class PasswordService { + private static readonly SALT_ROUNDS = 12; + + static async hashPassword(password: string): Promise { + return bcrypt.hash(password, this.SALT_ROUNDS); + } + + static async validatePassword(password: string, hash: string): Promise { + return bcrypt.compare(password, hash); + } + + static validatePasswordStrength(password: string): { + isValid: boolean; + errors: string[]; + } { + const errors: string[] = []; + + if (password.length < 8) { + errors.push('Password must be at least 8 characters long'); + } + + if (!/[A-Z]/.test(password)) { + errors.push('Password must contain at least one uppercase letter'); + } + + if (!/[a-z]/.test(password)) { + errors.push('Password must contain at least one lowercase letter'); + } + + if (!/\d/.test(password)) { + errors.push('Password must contain at least one number'); + } + + return { + isValid: errors.length === 0, + errors + }; + } +} +``` + +#### Step 4.4: Continue Implementation +```bash +# Implement multiple tasks in sequence +npx claude-flow maestro implement-task user-authentication 2 +npx claude-flow maestro implement-task user-authentication 3 +npx claude-flow maestro implement-task user-authentication 4 + +# Or implement specific tasks as dependencies are met +npx claude-flow maestro implement-task user-authentication 5 +npx claude-flow maestro implement-task user-authentication 6 +``` + +#### Step 4.5: Monitor Progress +```bash +# Check current status +npx claude-flow maestro status user-authentication --detailed + +# View completed tasks +npx claude-flow maestro status user-authentication --json | jq '.completedTasks' +``` + +--- + +## Phase 5: Quality Gates + +### ๐ŸŽฏ **Objective** +Ensure implementation quality through comprehensive review and validation. + +### ๐Ÿค– **Agent**: `quality_reviewer` +- **Strategy**: Sequential validation with blocking gates +- **Capabilities**: `code_review`, `quality_assurance`, `testing` + +### ๐Ÿ“‹ **Step-by-Step Process** + +#### Step 5.1: Initiate Quality Review +```bash +# Review all implemented tasks +npx claude-flow maestro review-tasks user-authentication +``` + +#### Step 5.2: Quality Review Process +The `quality_reviewer` agent performs: + +1. **Code Quality Analysis** + - Reviews code for best practices adherence + - Checks for security vulnerabilities + - Validates error handling patterns + - Ensures consistent coding standards + +2. **Test Coverage Validation** + - Verifies unit test completeness + - Checks integration test coverage + - Validates test quality and effectiveness + - Ensures edge cases are covered + +3. **Security Assessment** + - Reviews authentication implementation + - Validates password hashing security + - Checks JWT token implementation + - Assesses rate limiting effectiveness + +4. **Performance Analysis** + - Reviews database query efficiency + - Checks for potential bottlenecks + - Validates resource usage patterns + - Ensures scalability considerations + +#### Step 5.3: Quality Review Output +```markdown +# Quality Review Report: user-authentication + +## Executive Summary +โœ… **QUALITY GATE PASSED** - Implementation meets all quality standards + +## Code Quality Assessment + +### Security Review โœ… +- โœ… Passwords properly hashed with bcrypt (12 salt rounds) +- โœ… JWT tokens securely generated and validated +- โœ… Rate limiting properly implemented (5 attempts/minute) +- โœ… Input validation comprehensive and effective +- โœ… No hardcoded secrets or credentials + +### Code Standards โœ… +- โœ… TypeScript types properly defined +- โœ… Error handling comprehensive and consistent +- โœ… Logging implemented for audit trail +- โœ… Code follows established patterns +- โœ… Documentation inline and comprehensive + +### Test Coverage โœ… +- โœ… Unit tests: 95% coverage +- โœ… Integration tests: All endpoints tested +- โœ… Security tests: All attack vectors covered +- โœ… Edge cases: Comprehensive coverage +- โœ… Performance tests: Load testing completed + +## Performance Analysis + +### Database Performance โœ… +- โœ… Connection pooling properly configured +- โœ… Queries optimized with proper indexing +- โœ… No N+1 query problems detected +- โœ… Transaction handling appropriate + +### API Performance โœ… +- โœ… Response times < 200ms for authentication +- โœ… Memory usage within acceptable limits +- โœ… Concurrent request handling validated +- โœ… Rate limiting doesn't impact normal usage + +## Security Assessment + +### Authentication Security โœ… +- โœ… Timing attacks mitigated +- โœ… Brute force protection effective +- โœ… Session management secure +- โœ… Token expiration properly handled + +### Data Protection โœ… +- โœ… Sensitive data never logged +- โœ… Database queries parameterized +- โœ… Error messages don't leak information +- โœ… CORS configuration restrictive + +## Recommendations + +### Immediate Actions +- โœ… All critical issues resolved +- โœ… No blocking issues identified + +### Future Enhancements +- Consider implementing 2FA for enhanced security +- Add monitoring and alerting for failed authentication attempts +- Implement user session management dashboard + +## Quality Gate Decision +๐ŸŽ‰ **APPROVED FOR PRODUCTION** + +All quality standards met. Implementation is ready for deployment. + +*Review completed by native hive mind quality_reviewer agent* +*Consensus validation: 100% approval* +``` + +#### Step 5.4: Address Quality Issues (if any) +```bash +# If quality issues are found, implement fixes +npx claude-flow maestro implement-task user-authentication + +# Re-run quality review +npx claude-flow maestro review-tasks user-authentication +``` + +--- + +## Phase 6: Completion & Documentation + +### ๐ŸŽฏ **Objective** +Finalize implementation with comprehensive documentation and project closure. + +### ๐Ÿค– **Agent**: `steering_documenter` +- **Strategy**: Cross-cutting documentation maintenance +- **Capabilities**: `documentation_generation`, `governance` + +### ๐Ÿ“‹ **Step-by-Step Process** + +#### Step 6.1: Final Phase Approval +```bash +# Approve the current phase to progress to completion +npx claude-flow maestro approve-phase user-authentication +``` + +#### Step 6.2: Documentation Generation +The `steering_documenter` agent creates: + +1. **Implementation Summary** +2. **Deployment Guide** +3. **API Documentation** +4. **Maintenance Guide** + +#### Step 6.3: Project Completion +```bash +# Check final status +npx claude-flow maestro status user-authentication --detailed + +# Generate completion report +npx claude-flow maestro status user-authentication --json > user-authentication-completion.json +``` + +--- + +## ๐Ÿ”ง Advanced Workflow Features + +### Consensus Configuration +```bash +# High-quality critical feature (85% consensus) +npx claude-flow maestro create-spec critical-payment-system \ + --consensus-threshold 0.85 \ + --max-agents 12 + +# Fast development feature (50% consensus) +npx claude-flow maestro create-spec quick-prototype \ + --consensus-threshold 0.5 \ + --max-agents 4 \ + --no-consensus +``` + +### Steering Document Integration +```bash +# Create domain-specific guidance +npx claude-flow maestro init-steering security \ + --content "All authentication must follow OWASP guidelines" + +npx claude-flow maestro init-steering performance \ + --content "API response times must be < 200ms" +``` + +### Workflow Monitoring +```bash +# Real-time status monitoring +watch 'npx claude-flow maestro status user-authentication' + +# Performance tracking +npx claude-flow maestro performance-report + +# Agent utilization +npx claude-flow maestro agent-stats +``` + +--- + +## ๐Ÿšจ Comprehensive Troubleshooting Guide + +### Swarm Initialization Issues + +#### Problem: Swarm Initialization Timeout +```bash +Error: Swarm initialization timeout after 30000ms +Cause: Network connectivity or resource constraints +``` + +**Solutions:** +```bash +# Increase timeout and add retries +npx claude-flow maestro create-spec my-feature \ + --timeout 60000 \ + --retry 3 \ + --retry-delay 5000 + +# Check system resources +npx claude-flow status --system-health + +# Reset swarm state if corrupted +npx claude-flow maestro reset-swarm +``` + +#### Problem: Agent Spawning Failures +```bash +Error: Failed to spawn requirements_analyst agent +Cause: Resource limits or configuration issues +``` + +**Solutions:** +```bash +# Check agent limits and adjust +npx claude-flow maestro create-spec my-feature \ + --max-agents 12 \ + --agent-timeout 45000 + +# Validate swarm configuration +npx claude-flow maestro validate-config + +# Manual agent spawn if needed +npx claude-flow maestro spawn-agent requirements_analyst +``` + +### Consensus and Coordination Issues + +#### Problem: Design Consensus Failures +```bash +Error: Consensus failed for design validation (45% agreement) +Minimum threshold: 66% (Byzantine fault tolerance) +``` + +**Solutions:** +```bash +# Option 1: Lower consensus threshold for rapid development +npx claude-flow maestro generate-design my-feature \ + --consensus-threshold 0.5 \ + --consensus-rounds 5 + +# Option 2: Add more context for better agreement +npx claude-flow maestro generate-design my-feature \ + --additional-context "Focus on simplicity over features" \ + --design-constraints "Use existing technology stack" + +# Option 3: Use single architect for simple features +npx claude-flow maestro generate-design my-feature \ + --single-architect \ + --no-consensus +``` + +#### Problem: Agent Communication Failures +```bash +Error: Agent communication timeout +Agent design_architect_2 not responding +``` + +**Solutions:** +```bash +# Check agent status +npx claude-flow maestro agent-status --detailed + +# Restart unresponsive agents +npx claude-flow maestro restart-agent design_architect_2 + +# Failover to backup agents +npx claude-flow maestro generate-design my-feature \ + --failover-enabled \ + --backup-agents 1 +``` + +### Resource and Performance Issues + +#### Problem: Maximum Agent Limit Reached +```bash +Error: Maximum agent limit reached (8/8) +Cannot spawn additional agents +``` + +**Solutions:** +```bash +# Check current agent utilization +npx claude-flow maestro agent-stats + +# Wait for tasks to complete +watch 'npx claude-flow maestro status my-feature' + +# Increase agent limit for complex features +npx claude-flow maestro create-spec my-feature \ + --max-agents 16 \ + --scaling-enabled + +# Use sequential execution to reduce agent count +npx claude-flow maestro generate-design my-feature \ + --strategy sequential +``` + +#### Problem: Memory Issues +```bash +Error: Swarm memory limit exceeded +Cannot store additional steering documents +``` + +**Solutions:** +```bash +# Clear old memory entries +npx claude-flow maestro memory-cleanup \ + --older-than 7d + +# Increase memory limits +npx claude-flow maestro config-update \ + --memory-limit 1GB + +# Use external storage for large documents +npx claude-flow maestro create-spec my-feature \ + --external-storage enabled +``` + +### Workflow and Task Issues + +#### Problem: Task Dependencies Not Met +```bash +Error: Cannot execute task 5 - dependency task 3 not completed +Task 3 status: failed +``` + +**Solutions:** +```bash +# Check task status and dependencies +npx claude-flow maestro status my-feature \ + --show-dependencies + +# Retry failed tasks +npx claude-flow maestro implement-task my-feature 3 \ + --retry \ + --fix-issues + +# Skip non-critical dependencies +npx claude-flow maestro implement-task my-feature 5 \ + --ignore-dependencies task-3 +``` + +#### Problem: Quality Gates Blocking +```bash +Error: Quality gate failed - code coverage below 80% +Tests failing: 3/47 +``` + +**Solutions:** +```bash +# Get detailed quality report +npx claude-flow maestro review-tasks my-feature \ + --detailed-report + +# Fix specific quality issues +npx claude-flow maestro implement-task my-feature \ + --fix-quality-issues \ + --focus coverage,tests + +# Lower quality thresholds temporarily +npx claude-flow maestro review-tasks my-feature \ + --coverage-threshold 70 \ + --allow-test-failures 3 +``` + +### File System and Configuration Issues + +#### Problem: Spec Directory Access +```bash +Error: Cannot write to docs/maestro/specs/my-feature/ +Permission denied +``` + +**Solutions:** +```bash +# Check and fix permissions +sudo chown -R $USER:$USER docs/maestro/ +chmod -R 755 docs/maestro/ + +# Use alternative directory +npx claude-flow maestro create-spec my-feature \ + --specs-dir ./specs \ + --create-dirs +``` + +#### Problem: Configuration Conflicts +```bash +Error: Configuration conflict detected +Maestro config incompatible with hive mind settings +``` + +**Solutions:** +```bash +# Validate and fix configuration +npx claude-flow maestro validate-config \ + --fix-conflicts + +# Reset to default configuration +npx claude-flow maestro reset-config \ + --backup-current + +# Use environment-specific config +npx claude-flow maestro create-spec my-feature \ + --config-profile development +``` + +### Emergency Recovery Procedures + +#### Complete Workflow Reset +```bash +# When everything fails, nuclear option: +npx claude-flow maestro emergency-reset \ + --backup-specs \ + --preserve-completed-tasks + +# Restore from last good state +npx claude-flow maestro restore-state \ + --from-backup \ + --timestamp "2024-01-15T10:30:00Z" +``` + +#### Data Recovery +```bash +# Recover lost specs +npx claude-flow maestro recover-specs \ + --feature my-feature \ + --from-memory + +# Export current state for debugging +npx claude-flow maestro export-debug-info \ + --include-logs \ + --include-agent-states +``` + +### Performance Optimization Guidelines + +#### Swarm Performance Tuning +```bash +# Optimize for speed (less accuracy) +npx claude-flow maestro create-spec my-feature \ + --performance-mode fast \ + --consensus-threshold 0.5 \ + --parallel-aggressive + +# Optimize for quality (slower) +npx claude-flow maestro create-spec my-feature \ + --performance-mode quality \ + --consensus-threshold 0.85 \ + --validation-strict + +# Balanced mode (recommended) +npx claude-flow maestro create-spec my-feature \ + --performance-mode balanced +``` + +#### Resource Management +```bash +# For resource-constrained environments +npx claude-flow maestro create-spec my-feature \ + --max-agents 4 \ + --memory-limit 512MB \ + --strategy sequential + +# For high-performance environments +npx claude-flow maestro create-spec my-feature \ + --max-agents 16 \ + --memory-limit 2GB \ + --strategy parallel \ + --turbo-mode +``` + +--- + +## ๐Ÿ“š Complete CLI Reference + +### Core Workflow Commands + +#### Specification Creation +```bash +# Create new feature specification +npx claude-flow maestro create-spec \ + --request "" \ + [--consensus-threshold 0.66] \ + [--max-agents 8] \ + [--timeout 30000] \ + [--retry 3] + +# Examples: +npx claude-flow maestro create-spec user-auth \ + --request "Implement JWT-based authentication" \ + --consensus-threshold 0.75 + +npx claude-flow maestro create-spec quick-feature \ + --request "Add user profile endpoint" \ + --max-agents 4 \ + --no-consensus +``` + +#### Design Generation +```bash +# Generate technical design with consensus +npx claude-flow maestro generate-design \ + [--consensus-threshold 0.66] \ + [--single-architect] \ + [--no-consensus] \ + [--additional-context ""] \ + [--design-constraints ""] + +# Examples: +npx claude-flow maestro generate-design user-auth \ + --additional-context "Focus on security and scalability" + +npx claude-flow maestro generate-design simple-api \ + --single-architect \ + --no-consensus +``` + +#### Task Planning +```bash +# Generate implementation tasks +npx claude-flow maestro generate-tasks \ + [--max-tasks 20] \ + [--complexity ] \ + [--include-tests] \ + [--include-docs] + +# Examples: +npx claude-flow maestro generate-tasks user-auth \ + --complexity complex \ + --include-tests \ + --max-tasks 25 +``` + +#### Task Implementation +```bash +# Implement specific task +npx claude-flow maestro implement-task \ + [--max-agents 2] \ + [--strategy ] \ + [--retry] \ + [--fix-issues] \ + [--ignore-dependencies ] + +# Examples: +npx claude-flow maestro implement-task user-auth 1 \ + --strategy parallel + +npx claude-flow maestro implement-task user-auth 5 \ + --retry \ + --fix-issues +``` + +#### Quality Assurance +```bash +# Review implementation quality +npx claude-flow maestro review-tasks \ + [--coverage-threshold 80] \ + [--allow-test-failures 0] \ + [--detailed-report] \ + [--fix-quality-issues] + +# Examples: +npx claude-flow maestro review-tasks user-auth \ + --coverage-threshold 90 \ + --detailed-report +``` + +#### Phase Management +```bash +# Approve current phase and move to next +npx claude-flow maestro approve-phase \ + [--force] \ + [--skip-validation] + +# Examples: +npx claude-flow maestro approve-phase user-auth +npx claude-flow maestro approve-phase prototype --force +``` + +### Status and Monitoring Commands + +#### Feature Status +```bash +# Check feature status +npx claude-flow maestro status [] \ + [--detailed] \ + [--json] \ + [--show-dependencies] \ + [--show-agents] + +# Examples: +npx claude-flow maestro status user-auth --detailed +npx claude-flow maestro status --json | jq '.features' +``` + +#### Agent Management +```bash +# Agent status and management +npx claude-flow maestro agent-status \ + [--detailed] \ + [--agent-id ] + +npx claude-flow maestro agent-stats +npx claude-flow maestro restart-agent +npx claude-flow maestro spawn-agent +``` + +#### Performance Monitoring +```bash +# Performance reports +npx claude-flow maestro performance-report \ + [--timeframe <24h|7d|30d>] \ + [--format ] + +npx claude-flow maestro memory-usage +npx claude-flow maestro resource-stats +``` + +### Configuration and Management + +#### Swarm Configuration +```bash +# Configure swarm settings +npx claude-flow maestro config-update \ + [--memory-limit ] \ + [--max-agents ] \ + [--consensus-threshold <0.0-1.0>] + +npx claude-flow maestro validate-config +npx claude-flow maestro reset-config [--backup-current] +``` + +#### Steering Documents +```bash +# Manage steering documents +npx claude-flow maestro init-steering \ + --content "" \ + [--maintainer ] + +npx claude-flow maestro update-steering \ + --content "" + +npx claude-flow maestro list-steering +``` + +#### Maintenance Commands +```bash +# System maintenance +npx claude-flow maestro memory-cleanup \ + [--older-than