# AIW Project Overview

## Purpose
AIW (AI Warden) is a **unified gateway** for AI CLI tools and MCP servers. It acts as:
- **AI CLI Proxy**: Route requests to claude/codex/gemini with provider switching, role injection, and transparent parameter forwarding
- **MCP Proxy**: Route tool calls to multiple MCP servers with intelligent selection, plugin marketplace, and hot-reload

## Version
- Current: 0.5.50
- License: MIT

## Core Features
1. **AI CLI Routing**: `aiw <cli> [-r role] [-p provider] [-C cwd] "prompt"`
2. **Auto Mode**: Automatic failover across AI CLIs (`aiw auto "task"`)
3. **Provider Management**: Switch API providers without modifying native configs
4. **Role Injection**: Pre-defined prompts for specific tasks
5. **MCP Server**: Serve as MCP gateway with intelligent routing
6. **Plugin Marketplace**: Browse and install MCP plugins

## Key Technologies
- **Runtime**: Tokio async
- **TUI**: ratatui + crossterm
- **MCP**: rmcp library
- **Vector DB**: MemVDB (in-memory), SahomeDB (persistent)
- **Embeddings**: gllm (pure Rust)
- **JS Engine**: Boa (for orchestration)
- **HTTP**: reqwest with rustls-tls
- **Git**: git2

## Project Structure
```
aiw/
├── src/
│   ├── commands/     # CLI command implementations
│   ├── mcp/          # MCP server implementation
│   ├── mcp_routing/  # Intelligent MCP routing
│   ├── tui/          # TUI screens and widgets
│   ├── roles/        # Role management
│   ├── provider/     # Provider configuration
│   ├── core/         # Core functionality
│   ├── auto_mode/    # Auto failover logic
│   └── utils/        # Utility functions
├── SPEC/             # Requirements specification
├── tests/            # Test files
└── config/           # Configuration templates
```
