# Agentic Flow CLI Design & Command Structure ## CLI Architecture Overview ### Design Principles 1. **Intuitive**: Commands follow natural language patterns 2. **Consistent**: Uniform syntax across all commands 3. **Powerful**: Advanced features accessible via flags 4. **Extensible**: Plugin architecture for custom commands 5. **Enterprise-Ready**: Built-in security and compliance ## Complete Command Reference ### Core Commands #### 1. Initialization & Setup ```bash # Initialize new project agentic-flow init [options] --template # Use template: api, web, ml, enterprise --mastra # Enable Mastra integration --enterprise # Enable enterprise features --wizard # Interactive setup wizard # Examples agentic-flow init --template api --mastra agentic-flow init --wizard --enterprise ``` #### 2. Server & Runtime Management ```bash # Start server with various modes agentic-flow serve [options] --ui # Enable web UI (default: true) --port # Server port (default: 8080) --mode # Mode: development, production, enterprise --cluster # Enable cluster mode --metrics # Enable Prometheus metrics --secure # Enable TLS/mTLS # Examples agentic-flow serve --ui --port 3000 agentic-flow serve --mode production --cluster --secure ``` #### 3. Agent Orchestration ```bash # Orchestrate agents for objectives agentic-flow orchestrate [options] --strategy # Strategy: parallel, sequential, adaptive --agents # Max agents (default: auto) --timeout # Execution timeout --dry-run # Preview without execution --monitor # Real-time monitoring --cost-limit # Token cost limit # Examples agentic-flow orchestrate "Build REST API" --strategy parallel --monitor agentic-flow orchestrate "Analyze codebase" --dry-run --agents 3 ``` #### 4. Agent Management ```bash # Manage individual agents agentic-flow agent [options] # Actions: create # Create new agent --type # Agent type: developer, analyst, tester, etc. --name # Custom name --capabilities # Comma-separated capabilities --sandbox # Enable sandboxing list # List all agents --filter # Filter by status, type, etc. --format # Output format: table, json, yaml inspect # Detailed agent info --metrics # Include performance metrics --history # Include execution history terminate # Stop agent --force # Force termination --cleanup # Clean up resources # Examples agentic-flow agent create --type developer --name "API Builder" agentic-flow agent list --filter "status:active" agentic-flow agent inspect agent-123 --metrics ``` #### 5. Methodology Commands (SPARC & Beyond) ```bash # Execute development methodologies agentic-flow methodology [options] --method # Method: sparc, agile, tdd, ddd, clean --phase # Specific phase to execute --parallel # Run phases in parallel --quality-gates # Enable quality checks # SPARC-specific shortcuts agentic-flow sparc [options] spec # Specification phase pseudocode # Algorithm design architect # Architecture design refine # Implementation & refinement complete # Integration & completion # Examples agentic-flow methodology sparc "Build auth system" --quality-gates agentic-flow sparc architect "Design microservices" ``` #### 6. State & Memory Management ```bash # Manage distributed state agentic-flow state [options] # Actions: store # Store data --namespace # Namespace (default: global) --ttl # Time to live --encrypt # Encrypt data get # Retrieve data --namespace # Namespace --decrypt # Decrypt if encrypted search # Search by pattern --namespace # Search namespace --limit # Result limit --regex # Use regex pattern sync # Synchronize state --source # Source location --target # Target location --bidirectional # Two-way sync # Examples agentic-flow state store "api.config" '{"version": "2.0"}' --encrypt agentic-flow state search "api.*" --limit 10 ``` #### 7. Version Control Integration ```bash # Multi-VCS support agentic-flow vcs [options] # Actions: analyze # Analyze repository --metrics # Code metrics --security # Security scan --quality # Quality assessment pr # Pull request operations create # Create PR review # AI review merge # Smart merge release # Release management prepare # Prepare release deploy # Deploy release rollback # Rollback if needed # Examples agentic-flow vcs analyze --security --quality agentic-flow vcs pr review --auto-fix ``` ### Cluster & Distributed Commands #### 8. Cluster Management ```bash # Manage agent clusters agentic-flow cluster [options] # Actions: init # Initialize cluster --size # Initial size --topology # mesh, star, hierarchical --region # Deployment region deploy # Deploy to cluster --strategy # Deployment strategy --rolling # Rolling deployment --canary # Canary deployment scale # Scale cluster --size # Target size --auto # Enable autoscaling --metrics # Scaling metrics status # Cluster status --detailed # Detailed view --watch # Real-time updates # Examples agentic-flow cluster init --size 5 --topology mesh agentic-flow cluster deploy "Process data" --canary ``` #### 9. Consensus & Coordination ```bash # Distributed consensus agentic-flow consensus [options] # Actions: propose # Propose decision --quorum # Required quorum --timeout # Decision timeout vote # Vote on proposal --choice # yes, no, abstain --reason # Vote reasoning status # Check consensus status # Examples agentic-flow consensus propose "Switch to microservices" --quorum 3 agentic-flow consensus vote prop-123 --choice yes ``` ### Intelligence & Learning Commands #### 10. Training & ML Operations ```bash # Machine learning operations agentic-flow train [options] --data # Training data source --epochs # Training epochs --validation # Validation split --gpu # Enable GPU training --distributed # Distributed training # Model management agentic-flow model [options] deploy # Deploy model evaluate # Evaluate performance compare # Compare models optimize # Optimize model # Examples agentic-flow train task-predictor --data ./dataset --gpu agentic-flow model deploy model-v2 --canary --monitor ``` #### 11. Analysis & Insights ```bash # Advanced analysis agentic-flow analyze [options] --type # Type: performance, security, quality --depth # Analysis depth: shallow, normal, deep --ai-insights # Generate AI insights --recommendations # Include recommendations # Examples agentic-flow analyze ./src --type security --depth deep agentic-flow analyze cluster-123 --ai-insights ``` ### Automation & Workflow Commands #### 12. Workflow Management ```bash # Create and manage workflows agentic-flow workflow [options] # Actions: create # Create workflow --template # Use template --visual # Open visual designer run # Execute workflow --params # Parameters --async # Asynchronous execution --monitor # Real-time monitoring schedule # Schedule workflow --cron # Cron expression --timezone # Timezone # Examples agentic-flow workflow create "Daily Build" --visual agentic-flow workflow run wf-123 --params '{"env": "prod"}' ``` #### 13. Automation Rules ```bash # Define automation rules agentic-flow automate [options] # Actions: rule create # Create automation rule --trigger # Trigger event --condition # Condition expression --action # Action to execute policy set # Set automation policy --scope # Policy scope --rules # Rules file # Examples agentic-flow automate rule create --trigger "pr.opened" --action "run tests" agentic-flow automate policy set --scope project --rules ./policies.yaml ``` ### Enterprise Commands #### 14. Security & Compliance ```bash # Security operations agentic-flow security [options] # Actions: scan # Security scan --target # Scan target --profile # Security profile --fix # Auto-fix issues audit # Compliance audit --standard # Standard: SOC2, HIPAA, GDPR --report # Generate report encrypt # Encrypt data --data # Data to encrypt --key # Encryption key # Examples agentic-flow security scan --target . --profile strict --fix agentic-flow security audit --standard SOC2 --report ``` #### 15. Multi-Tenancy ```bash # Tenant management agentic-flow tenant [options] # Actions: create # Create tenant --tier # Tier: starter, pro, enterprise --region # Deployment region switch # Switch context configure # Configure tenant isolate # Ensure isolation # Examples agentic-flow tenant create "AcmeCorp" --tier enterprise agentic-flow tenant switch tenant-123 ``` ### Monitoring & Operations #### 16. Monitoring Commands ```bash # System monitoring agentic-flow monitor [options] --metrics # Metrics to monitor --interval # Update interval --dashboard # Open dashboard --alerts # Configure alerts # Examples agentic-flow monitor cluster --metrics cpu,memory --dashboard agentic-flow monitor costs --alerts --interval 60 ``` #### 17. Debugging & Diagnostics ```bash # Debug operations agentic-flow debug [options] --trace # Enable tracing --profile # Performance profiling --breakpoint # Set breakpoints --replay # Replay session # Diagnostics agentic-flow diagnose [options] --component # Specific component --deep # Deep diagnostics --fix # Attempt auto-fix # Examples agentic-flow debug agent-123 --trace --profile agentic-flow diagnose --component memory --fix ``` ### Utility Commands #### 18. Configuration Management ```bash # Manage configurations agentic-flow config [options] # Actions: get # Get config value set # Set config value validate # Validate configuration export # Export configuration import # Import configuration # Examples agentic-flow config set api.timeout 30 agentic-flow config validate --strict ``` #### 19. Plugin Management ```bash # Manage plugins agentic-flow plugin [options] # Actions: install # Install plugin --version # Specific version --source # Custom source list # List plugins enable # Enable plugin disable # Disable plugin # Examples agentic-flow plugin install @mastra/advanced-analytics agentic-flow plugin list --enabled ``` #### 20. Help & Documentation ```bash # Get help agentic-flow help [command] agentic-flow --help agentic-flow docs agentic-flow tutorial # Interactive mode agentic-flow interactive agentic-flow shell ``` ## Advanced Features ### 1. Batch Operations ```bash # Execute batch operations agentic-flow batch [options] --parallel # Parallel execution --on-error # Error handling: stop, continue, rollback --progress # Show progress # Example batch file # batch.yaml operations: - orchestrate: "Build API" strategy: parallel - analyze: "./src" type: security - test: all coverage: 80 ``` ### 2. Pipeline Definitions ```bash # Define CI/CD pipelines agentic-flow pipeline [options] # Example pipeline # pipeline.yaml name: "Production Deploy" stages: - name: "Test" commands: - test: all - analyze: security - name: "Build" commands: - build: production - name: "Deploy" commands: - deploy: canary - monitor: 300 - deploy: full ``` ### 3. Interactive Shell ```bash # Enter interactive shell agentic-flow shell # Shell commands AF> orchestrate "Build feature" AF> agent list AF> monitor --dashboard AF> exit ``` ## Environment Variables ```bash # Core configuration AGENTIC_FLOW_HOME=/opt/agentic-flow AGENTIC_FLOW_CONFIG=/etc/agentic-flow/config.yaml AGENTIC_FLOW_LOG_LEVEL=info # Mastra integration MASTRA_API_KEY=your-api-key MASTRA_ENDPOINT=https://api.mastra.ai # Enterprise features AF_ENTERPRISE_LICENSE=license-key AF_TENANT_ID=tenant-123 AF_REGION=us-east-1 # Performance tuning AF_MAX_WORKERS=16 AF_CACHE_SIZE=1024 AF_TIMEOUT=300 ``` ## Configuration File ```yaml # ~/.agentic-flow/config.yaml version: "1.0" # Core settings core: mode: production region: us-east-1 timeout: 300 # Mastra integration mastra: enabled: true api_key: ${MASTRA_API_KEY} features: - workflows - integrations - analytics # Agent configuration agents: max_concurrent: 10 default_timeout: 120 sandbox: true resource_limits: cpu: "2" memory: "4Gi" # Security settings security: encryption: true audit_logging: true compliance: - SOC2 - HIPAA # Monitoring monitoring: metrics: enabled: true port: 9090 tracing: enabled: true sampling_rate: 0.1 ``` ## Shell Completion ```bash # Bash completion agentic-flow completion bash > /etc/bash_completion.d/agentic-flow # Zsh completion agentic-flow completion zsh > "${fpath[1]}/_agentic-flow" # Fish completion agentic-flow completion fish > ~/.config/fish/completions/agentic-flow.fish # PowerShell completion agentic-flow completion powershell > $PROFILE ``` ## Migration from Claude Flow ```bash # One-command migration curl -fsSL https://get.agentic-flow.mastra.ai/migrate | bash # Or manual migration agentic-flow migrate from-claude-flow [options] --backup # Create backup --dry-run # Preview changes --config # Claude Flow config --output # Output directory ``` ## Conclusion The Agentic Flow CLI provides a comprehensive, intuitive interface that: 1. **Maintains familiarity** for Claude Flow users 2. **Adds enterprise features** for production use 3. **Integrates Mastra** capabilities seamlessly 4. **Scales efficiently** for any workload 5. **Ensures security** and compliance