CLIAI is a completely free and open-source command-line AI assistant that helps you with terminal commands, system administration, and general questions. Use your own API keys (OpenAI, Anthropic, etc.) or run locally with Ollama for maximum privacy.
- π Privacy-First: Local AI processing with Ollama - your data never leaves your machine
- π Bring Your Own Key: Use your own OpenAI, Anthropic, or other LLM API keys
- π Completely Free: No subscriptions, no hidden costs - 100% open source
- π‘οΈ Safety-Focused: Multi-level command validation and safety checks
- β‘ Fast & Reliable: Built-in performance monitoring and circuit breakers
- π― Smart Command Generation: Context-aware command suggestions with explanations
- π Copy-Paste Safe: Clean command output without formatting artifacts
- π Flexible Execution: Auto-execute, confirmation prompts, or manual copy-paste
- π Comprehensive Testing: Built-in test suite with 50+ scenarios
- π¨ Beautiful Interface: Colored output with progress indicators
- Ollama (recommended for local AI) - Install Ollama
git clone https://github.com/bytestrix/cliai.git
cd cliai
cargo build --release
sudo cp target/release/cliai /usr/local/bin/cargo install cliaiDownload from GitHub Releases:
- Linux:
cliai-linux-x86_64.tar.gzorcliai-linux-aarch64.tar.gz - macOS:
cliai-macos-x86_64.tar.gzorcliai-macos-aarch64.tar.gz - Windows:
cliai-windows-x86_64.zip
-
Choose your AI provider:
Option A: Local AI (Ollama - Free & Private)
# Install Ollama curl -fsSL https://ollama.ai/install.sh | sh # Pull a model (recommended: mistral or llama2) ollama pull mistral
Option B: Cloud AI (Your API Keys)
# Set your OpenAI API key cliai set-key openai sk-your-openai-key-here # Or use Anthropic Claude cliai set-key anthropic your-anthropic-key-here # Or other supported providers cliai list-providers # See all supported providers
-
Configure CLIAI:
# Set your preferred model
cliai select mistral # For Ollama
# or
cliai select gpt-4 # For OpenAI
# or
cliai select claude-3-sonnet # For Anthropic
# Optional: Set a custom prefix
cliai set-prefix ai- Start using CLIAI:
cliai "how do I list all files including hidden ones?"
# Output: ls -la
# π‘ Lists all files including hidden ones with detailed information
cliai "find all Python files in this directory"
# Output: find . -name "*.py"
# π‘ Recursively searches for Python files in current directory and subdirectories# Ask questions
cliai "how do I check disk usage?"
cliai "what's my IP address?"
cliai "compress this folder"
# Configuration
cliai config # Show current settings
cliai list-models # List available models
cliai list-providers # List supported AI providers
cliai select <model> # Switch models
cliai set-key <provider> <key> # Set API key for provider
cliai clear # Clear chat history
# API Key Management
cliai set-key openai sk-... # Set OpenAI API key
cliai set-key anthropic ... # Set Anthropic API key
cliai remove-key <provider> # Remove API key
cliai test-key <provider> # Test API key connection
# Safety & Execution
cliai auto-execute --enable # Enable auto-execution for safe commands
cliai dry-run --enable # Preview commands without executing
cliai safety-level high # Set safety level (low/medium/high)
# Monitoring
cliai provider-status # Check AI provider status
cliai performance-status # View performance metrics
cliai test # Run comprehensive test suiteSet a custom command prefix for easier access:
cliai set-prefix jarvis
# Now you can use: jarvis "list running processes"- Low: Minimal safety checks, allows most commands
- Medium: Balanced safety with confirmation for risky commands (default)
- High: Maximum safety, blocks dangerous operations
CLIAI follows a modular architecture designed for reliability and extensibility:
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β CLI Interface ββββββ Orchestrator ββββββ AI Providers β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β β
βββββββββββΌββββββββββ β
β β β β
βββββββββΌββββ βββββΌβββββ ββββΌββββββ β
β Intent β βContext β βCommand β β
βClassifier β βGathererβ βValidatorβ β
βββββββββββββ ββββββββββ ββββββββββ β
β
βββββββββββββββββββββββββββ
β
βββββββββββΌββββββββββ
β β
βββββββββΌβββββ βββββββββββΌβββββββ
βLocal Ollamaβ βCloud Providers β
β(Privacy) β β(Fallback) β
ββββββββββββββ ββββββββββββββββββ
- Orchestrator: Central coordinator managing AI providers and request routing
- Intent Classifier: Determines the type of request (command, question, etc.)
- Context Gatherer: Collects system information for better responses
- Command Validator: Multi-layer validation with security checks
- Execution Engine: Safe command execution with multiple modes
- Performance Monitor: Tracks metrics and system health
- Circuit Breakers: Automatic failover between providers
CLIAI supports multiple AI providers for maximum flexibility:
- Local Ollama (Free & Private): Complete privacy, offline capable
- OpenAI (Your API Key): GPT-3.5, GPT-4, and other OpenAI models
- Anthropic (Your API Key): Claude models for advanced reasoning
- Other Providers: Additional providers can be easily added
Supported Providers:
- Ollama (local)
- OpenAI (gpt-3.5-turbo, gpt-4, gpt-4-turbo)
- Anthropic (claude-3-sonnet, claude-3-haiku, claude-3-opus)
- More providers coming soon!
- Local-First: Primary processing happens on your machine
- No Data Collection: Commands and prompts are never logged in production
- Minimal Logging: Only errors and performance metrics are recorded
- Debug Mode: Explicit consent required for detailed logging
- Command Validation: Multi-layer validation prevents dangerous commands
- Placeholder Detection: Catches AI hallucinations and incomplete commands
- Syntax Checking: Validates command syntax before execution
- Risk Assessment: Categorizes commands by potential impact
- Confirmation Prompts: User confirmation for sensitive operations
# High Safety (Recommended for beginners)
cliai safety-level high
# Medium Safety (Balanced - default)
cliai safety-level medium
# Low Safety (Experienced users)
cliai safety-level lowCLIAI includes a comprehensive test suite covering 50+ real-world scenarios:
# Run full test suite
cliai test
# Run specific categories
cliai test --categories "file-management,system-info"
# Quick validation
cliai test --quick
# Save results
cliai test --save results.md- File Management: File operations, permissions, searching
- System Info: System monitoring, process management
- Git Operations: Version control commands
- Network: Connectivity, downloads, API calls
- Programming: Development tools, compilation
- Process Management: Service control, monitoring
CLIAI stores configuration in ~/.config/cliai/config.toml:
model = "mistral"
provider = "ollama" # or "openai", "anthropic"
auto_execute = false
dry_run = false
safety_level = "Medium"
context_timeout = 5000
ollama_url = "http://localhost:11434"
prefix = "cliai"
# API Keys (stored securely)
[api_keys]
# Keys are encrypted and stored separately for securityCLIAI securely stores your API keys using your system's keyring:
# Set API keys
cliai set-key openai sk-your-key-here
cliai set-key anthropic your-anthropic-key
# Test connections
cliai test-key openai
cliai test-key anthropic
# Remove keys
cliai remove-key openaigit clone https://github.com/bytestrix/cliai.git
cd cliai
cargo build --release# Unit tests
cargo test
# Build
cargo build --releasesrc/
βββ main.rs # CLI interface and main entry point
βββ lib.rs # Library exports
βββ agents/ # AI orchestration and provider management
β βββ mod.rs
β βββ profiles.rs
βββ config.rs # Configuration management
βββ context.rs # System context gathering
βββ execution.rs # Command execution engine
βββ validation.rs # Command validation and safety
βββ providers.rs # AI provider implementations
βββ history.rs # Chat history management
βββ performance.rs # Performance monitoring
βββ error_handling.rs # Enhanced error reporting
βββ logging.rs # Privacy-preserving logging
βββ test_suite.rs # Comprehensive testing framework
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Run tests:
cargo test - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details. This means you can use, modify, and distribute the software freely, including for commercial purposes.
- Ollama for making local AI accessible
- Clap for excellent CLI parsing
- Tokio for async runtime
- The Rust community for amazing tools and libraries
- Documentation: https://bytestrix.github.io/cliai/
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Made with β€οΈ by the CLIAI Team
