Files
ruflo/docs/agentic-flow-cli-design.md
T
rUv 16a2cd1c41 feat: Enhanced settings with self-improving workflows, performance optimizations, and agentic-flow EPIC
- Added comprehensive hook system with GitHub checkpoints
- Implemented neural optimization and memory persistence
- Created performance monitoring and optimization scripts
- Designed multi-LLM provider architecture for agentic-flow
- Created EPIC issue #421 for agentic-flow implementation
- Added 10-20x performance improvements through caching and parallelization
2025-07-20 20:45:53 +00:00

16 KiB

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

# Initialize new project
agentic-flow init [options]
  --template <name>        # 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

# Start server with various modes
agentic-flow serve [options]
  --ui                     # Enable web UI (default: true)
  --port <number>          # Server port (default: 8080)
  --mode <type>            # 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

# Orchestrate agents for objectives
agentic-flow orchestrate <objective> [options]
  --strategy <type>        # Strategy: parallel, sequential, adaptive
  --agents <number>        # Max agents (default: auto)
  --timeout <seconds>      # Execution timeout
  --dry-run               # Preview without execution
  --monitor               # Real-time monitoring
  --cost-limit <amount>   # 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

# Manage individual agents
agentic-flow agent <action> [options]

# Actions:
create                    # Create new agent
  --type <type>          # Agent type: developer, analyst, tester, etc.
  --name <name>          # Custom name
  --capabilities <list>  # Comma-separated capabilities
  --sandbox              # Enable sandboxing
  
list                     # List all agents
  --filter <query>       # Filter by status, type, etc.
  --format <type>        # Output format: table, json, yaml
  
inspect <agent-id>       # Detailed agent info
  --metrics             # Include performance metrics
  --history             # Include execution history
  
terminate <agent-id>     # 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)

# Execute development methodologies
agentic-flow methodology <method> <task> [options]
  --method               # Method: sparc, agile, tdd, ddd, clean
  --phase <name>         # Specific phase to execute
  --parallel             # Run phases in parallel
  --quality-gates        # Enable quality checks
  
# SPARC-specific shortcuts
agentic-flow sparc <phase> <task> [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

# Manage distributed state
agentic-flow state <action> [options]

# Actions:
store <key> <value>      # Store data
  --namespace <name>     # Namespace (default: global)
  --ttl <seconds>        # Time to live
  --encrypt             # Encrypt data
  
get <key>               # Retrieve data
  --namespace <name>    # Namespace
  --decrypt            # Decrypt if encrypted
  
search <pattern>        # Search by pattern
  --namespace <name>    # Search namespace
  --limit <number>      # Result limit
  --regex              # Use regex pattern
  
sync                    # Synchronize state
  --source <location>   # Source location
  --target <location>   # 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

# Multi-VCS support
agentic-flow vcs <action> [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

# Manage agent clusters
agentic-flow cluster <action> [options]

# Actions:
init                    # Initialize cluster
  --size <number>       # Initial size
  --topology <type>     # mesh, star, hierarchical
  --region <name>       # Deployment region
  
deploy <objective>      # Deploy to cluster
  --strategy <type>     # Deployment strategy
  --rolling             # Rolling deployment
  --canary              # Canary deployment
  
scale                   # Scale cluster
  --size <number>       # Target size
  --auto                # Enable autoscaling
  --metrics <list>      # 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

# Distributed consensus
agentic-flow consensus <action> [options]

# Actions:
propose <decision>      # Propose decision
  --quorum <number>     # Required quorum
  --timeout <seconds>   # Decision timeout
  
vote <proposal-id>      # Vote on proposal
  --choice <value>      # yes, no, abstain
  --reason <text>       # Vote reasoning
  
status <proposal-id>    # 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

# Machine learning operations
agentic-flow train <model-type> [options]
  --data <source>        # Training data source
  --epochs <number>      # Training epochs
  --validation <split>   # Validation split
  --gpu                  # Enable GPU training
  --distributed          # Distributed training
  
# Model management
agentic-flow model <action> [options]
  deploy <model-id>      # Deploy model
  evaluate <model-id>    # Evaluate performance
  compare <models>       # Compare models
  optimize <model-id>    # Optimize model
  
# Examples
agentic-flow train task-predictor --data ./dataset --gpu
agentic-flow model deploy model-v2 --canary --monitor

11. Analysis & Insights

# Advanced analysis
agentic-flow analyze <target> [options]
  --type <analysis>      # Type: performance, security, quality
  --depth <level>        # 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

# Create and manage workflows
agentic-flow workflow <action> [options]

# Actions:
create <name>           # Create workflow
  --template <name>     # Use template
  --visual              # Open visual designer
  
run <workflow-id>       # Execute workflow
  --params <json>       # Parameters
  --async               # Asynchronous execution
  --monitor             # Real-time monitoring
  
schedule <workflow-id>  # Schedule workflow
  --cron <expression>   # Cron expression
  --timezone <tz>       # Timezone
  
# Examples
agentic-flow workflow create "Daily Build" --visual
agentic-flow workflow run wf-123 --params '{"env": "prod"}'

13. Automation Rules

# Define automation rules
agentic-flow automate <action> [options]

# Actions:
rule create             # Create automation rule
  --trigger <event>     # Trigger event
  --condition <expr>    # Condition expression
  --action <command>    # Action to execute
  
policy set              # Set automation policy
  --scope <target>      # Policy scope
  --rules <file>        # 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

# Security operations
agentic-flow security <action> [options]

# Actions:
scan                    # Security scan
  --target <path>       # Scan target
  --profile <name>      # Security profile
  --fix                 # Auto-fix issues
  
audit                   # Compliance audit
  --standard <name>     # Standard: SOC2, HIPAA, GDPR
  --report              # Generate report
  
encrypt                 # Encrypt data
  --data <input>        # Data to encrypt
  --key <id>            # Encryption key
  
# Examples
agentic-flow security scan --target . --profile strict --fix
agentic-flow security audit --standard SOC2 --report

15. Multi-Tenancy

# Tenant management
agentic-flow tenant <action> [options]

# Actions:
create <name>           # Create tenant
  --tier <level>        # Tier: starter, pro, enterprise
  --region <name>       # Deployment region
  
switch <tenant-id>      # Switch context
configure <tenant-id>   # Configure tenant
isolate <tenant-id>     # Ensure isolation
  
# Examples
agentic-flow tenant create "AcmeCorp" --tier enterprise
agentic-flow tenant switch tenant-123

Monitoring & Operations

16. Monitoring Commands

# System monitoring
agentic-flow monitor <target> [options]
  --metrics <list>       # Metrics to monitor
  --interval <seconds>   # 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

# Debug operations
agentic-flow debug <target> [options]
  --trace                # Enable tracing
  --profile              # Performance profiling
  --breakpoint <loc>     # Set breakpoints
  --replay <session>     # Replay session
  
# Diagnostics
agentic-flow diagnose [options]
  --component <name>     # 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

# Manage configurations
agentic-flow config <action> [options]

# Actions:
get <key>               # Get config value
set <key> <value>       # Set config value
validate                # Validate configuration
export                  # Export configuration
import <file>           # Import configuration
  
# Examples
agentic-flow config set api.timeout 30
agentic-flow config validate --strict

19. Plugin Management

# Manage plugins
agentic-flow plugin <action> [options]

# Actions:
install <name>          # Install plugin
  --version <ver>       # Specific version
  --source <url>        # Custom source
  
list                    # List plugins
enable <name>           # Enable plugin
disable <name>          # Disable plugin
  
# Examples
agentic-flow plugin install @mastra/advanced-analytics
agentic-flow plugin list --enabled

20. Help & Documentation

# Get help
agentic-flow help [command]
agentic-flow <command> --help
agentic-flow docs <topic>
agentic-flow tutorial <name>

# Interactive mode
agentic-flow interactive
agentic-flow shell

Advanced Features

1. Batch Operations

# Execute batch operations
agentic-flow batch <file> [options]
  --parallel <number>    # Parallel execution
  --on-error <action>    # 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

# Define CI/CD pipelines
agentic-flow pipeline <action> [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

# Enter interactive shell
agentic-flow shell

# Shell commands
AF> orchestrate "Build feature"
AF> agent list
AF> monitor --dashboard
AF> exit

Environment Variables

# 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

# ~/.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 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

# 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 <file>       # Claude Flow config
  --output <dir>        # 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