/install ai-cli-orchestrator
SKILL: ai-cli-orchestrator (Multi AI CLI Orchestrator)
Version: 2.0.0 (2026-03-16)
Status: Stable
Expertise: CLI Automation, Error Recovery, Tool Chain Management
1. Description
ai-cli-orchestrator is a meta-skill that integrates multiple AI CLI tools (such as Gemini CLI, Cursor Agent, Claude Code) to build a highly available automation workflow. It intelligently identifies the AI toolchain in the current environment, allocates the optimal tool based on task type, and achieves seamless task context transfer with automatic fallback when the primary tool encounters rate limits, API failures, or logical bottlenecks.
2. Trigger Scenarios
- Complex Coding Tasks: When large-scale refactoring across files and modules is needed, and a single AI logic hits bottlenecks.
- High Stability Requirements: In CI/CD or automation scripts, tasks cannot be interrupted due to single AI service API fluctuations.
- Domain-Specific Optimization: Leveraging the strengths of different AIs (e.g., Gemini's long context, Claude's rigorous code logic).
- Resource Limits: When the primary tool triggers token or rate limits, need to switch to backup options.
3. Core Workflow
3.1 Discovery Phase
- Auto-Scan: Scan system PATH to detect installed AI CLI tools (
gemini,cursor-agent,claude, etc.). - Availability Check: Run
tool --versionor simple echo tests to verify API key validity. - Environment Sync: Read
.ai-config.yamlor.envfrom project root for permission config.
3.2 User Configuration
1. Auto-Scan Available AI CLI
🤖 AI Assistant Initialization
Detected AI CLI tools:
✅ gemini - Installed
❌ cursor-agent - Not detected
✅ claude - Installed
Select tools to enable (multi-select):
[1] gemini
[2] cursor-agent
[3] claude
[4] Add custom...
2. Add Custom AI CLI
Enter command name: kimi
Enter test command: kimi --version
Enter description: Moonshot AI
3. Set Priority
Priority (lower number = higher priority):
1. gemini
2. claude
4. Select Strategy
Choose AI response strategy:
[1] AI CLI First
- When receiving questions, automatically use AI CLI to search for answers first
[2] Direct Response
- Use model capabilities directly
[3] Hybrid Mode
- Simple questions answered directly, complex questions use AI CLI
3.3 Task Dispatching Phase
- Intent Recognition: Analyze user input (Research, Code, or Debug?).
- Priority Matching: Select preferred tool based on priority matrix.
- Session Management:
- Check for associated Session ID.
- For continuous tasks, try to inject intermediate outputs (diff or thought chain) as context to the new tool.
3.4 Monitoring & Fallback Phase
- Real-time Monitoring: Monitor CLI stderr and exit codes.
- Failure Detection:
- Non-zero exit code with "rate limit", "overloaded", "auth error".
- Output fails local validation 3 times consecutively.
- State Handover: Start backup tool, automatically retry failed instruction.
4. Configuration Example
Create .ai-cli-orchestrator.yaml in project root:
version: "2.0"
settings:
default_strategy: "balanced" # options: speed, quality, economy
auto_fallback: true
max_retries: 2
tools:
gemini:
priority: 1
alias: "gemini"
capabilities: ["long-context", "multimodal", "fast-search"]
cursor-agent:
priority: 2
alias: "cursor"
capabilities: ["codebase-indexing", "surgical-edit"]
claude-code:
priority: 3
alias: "claude"
capabilities: ["logic-reasoning", "unit-testing"]
strategies:
balanced:
primary: "gemini"
secondary: "cursor-agent"
emergency: "claude-code"
5. Error Handling
| Error Type | Detection | Response |
|---|---|---|
| Rate Limit | 429 Too Many Requests |
Record offset, switch to next tool, delay 30s then reset. |
| Logic Loop | Same File Edit 3 times | Force interrupt, output context, request higher-level tool. |
| Auth Failed | 401 Unauthorized |
Try local backup .env; if failed, skip and notify user. |
| Network Timeout | ETIMEDOUT |
Retry once; if still fails, switch to offline mode or backup CLI. |
| Command Not Found | command not found |
Skip this tool, switch to next available tool. |
| Stalled > 30s | Timeout | Force interrupt, switch tool and retry. |
6. Session Management
6.1 Task Metadata
Each task associates:
- TaskID (unique identifier)
- File snapshots (task-related files)
- Command history (executed commands)
- Last summary
6.2 Session Switching Rules
| Scenario | Action |
|---|---|
| Same task | Keep long conversation, don't create new session |
| Different task | Create new session |
| Return to previous task | Switch to corresponding session |
6.3 Context Recovery
When switching back to old task:
- Read task summary
- Load key history fragments
- Quickly restore state
7. AI CLI Priority
| Priority | Tool | Purpose | Fallback |
|---|---|---|---|
| 1 | gemini | Primary Q&A/Search | Auto-switch to 2 |
| 2 | cursor-agent | Code tasks | Auto-switch to 3 |
| 3 | claude-code | Emergency fallback | Error and notify user |
8. Best Practices
- Atomic Operations: Execute single-intent tasks to accurately transfer "last successful state" during fallback.
- Shared Context: When switching tools, always pass
git diffor latestsummary.mdto the接管 tool. - Protect Credentials: Never leak API Keys from environment variables in logs or AI prompts.
- Verification is King: Always verify with local tools like
npm testorruffregardless of which AI tool is used. - Regular Maintenance: Run updates monthly to sync the latest versions of all CLI tools.
9. Available Commands
ai-cli-orchestrator init: Interactive configuration of toolchain and priority.ai-cli-orchestrator run "\x3Ctask>": Execute task based on strategy and manage lifecycle.ai-cli-orchestrator status: View availability report of all AI services.ai-cli-orchestrator session switch \x3Cid>: Manually migrate data between different AI sessions.
10. Extensibility
Support integrating new AI CLIs by writing simple adapters. Just provide:
detect(): How to find the tool.execute(prompt, context): How to call and get output.parse_error(): How to parse its unique error types.
12. Security & Credentials
Why We Need to Read Config Files
This skill requires reading shell and project configuration files to:
- Scan for installed AI CLI tools in PATH
- Verify API keys/credentials are valid
- Read project-specific AI configs (
.ai-config.yaml,.env)
Credential Protection
- Local Processing Only: All credential checks happen locally on your machine
- No Data Exfiltration: Credentials are never sent to external servers
- Minimal Access: Only reads necessary config files, never writes or modifies them
- Sandboxed Execution: AI CLI tools run in isolated processes
Best Practices
- Always verify which AI CLIs have access to your credentials
- Use environment-specific API keys (dev vs production)
- Regularly audit installed AI CLI tools
11. Version History
- v2.0.0 (2026-03-16) - Major update: initialization config, execution strategy, session management, automatic fallback
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install ai-cli-orchestrator - 安装完成后,直接呼叫该 Skill 的名称或使用
/ai-cli-orchestrator触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
Ai Cli Orchestrator 是什么?
Orchestrates multiple AI CLI tools by auto-detecting, prioritizing, and switching among them for stable, seamless automation workflows with fallback on errors. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 330 次。
如何安装 Ai Cli Orchestrator?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install ai-cli-orchestrator」即可一键安装,无需额外配置。
Ai Cli Orchestrator 是免费的吗?
是的,Ai Cli Orchestrator 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Ai Cli Orchestrator 支持哪些平台?
Ai Cli Orchestrator 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Ai Cli Orchestrator?
由 Atom(@cnatom)开发并维护,当前版本 v1.0.3。