← Back to Skills Marketplace
cnatom

Ai Cli Orchestrator

by Atom · GitHub ↗ · v1.0.3 · MIT-0
cross-platform ⚠ suspicious
330
Downloads
0
Stars
0
Active Installs
4
Versions
Install in OpenClaw
/install ai-cli-orchestrator
Description
Orchestrates multiple AI CLI tools by auto-detecting, prioritizing, and switching among them for stable, seamless automation workflows with fallback on errors.
README (SKILL.md)

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

  1. Auto-Scan: Scan system PATH to detect installed AI CLI tools (gemini, cursor-agent, claude, etc.).
  2. Availability Check: Run tool --version or simple echo tests to verify API key validity.
  3. Environment Sync: Read .ai-config.yaml or .env from 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

  1. Intent Recognition: Analyze user input (Research, Code, or Debug?).
  2. Priority Matching: Select preferred tool based on priority matrix.
  3. 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

  1. Real-time Monitoring: Monitor CLI stderr and exit codes.
  2. Failure Detection:
    • Non-zero exit code with "rate limit", "overloaded", "auth error".
    • Output fails local validation 3 times consecutively.
  3. 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:

  1. Read task summary
  2. Load key history fragments
  3. 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 diff or latest summary.md to 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 test or ruff regardless 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:

  1. detect(): How to find the tool.
  2. execute(prompt, context): How to call and get output.
  3. 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
Usage Guidance
This skill is broadly coherent with its stated aim, but exercise caution before installing or running it: - Inspect $HOME/.zshrc and any project .env/.ai-config* files referenced by the skill. The included script explicitly sources $HOME/.zshrc, which executes whatever is in that file in the current shell — this can run code or expose environment variables (API keys). - Note inconsistent config paths in SKILL.md vs. the script (several different filenames). Ask the author which files the skill will read and write, and where. - The availability check described (running --version/--help) does not actually validate API credentials; expect false positives for 'available but unauthenticated' tools. - Because the skill passes git diffs and file snapshots between tools, be careful that secrets (API keys, tokens, private data) are not included in those diffs or echoed into prompts sent to external services. Recommended actions: 1) Run the script in a controlled environment (container or VM) first, or with a dry-run, to observe behavior. 2) Manually review and, if desired, remove or sandbox the line that sources $HOME/.zshrc before using the script. 3) Ask the maintainer to fix inconsistent filenames, clarify how credentials are discovered/used, and add explicit safeguards against leaking secrets. Given these inconsistencies and over-broad file access, treat this skill as suspicious until the above issues are resolved.
Capability Analysis
Type: OpenClaw Skill Name: ai-cli-orchestrator Version: 1.0.3 The skill bundle functions as an orchestrator for multiple AI CLI tools, requiring high-privilege access such as sourcing the user's `~/.zshrc` and scanning for credentials in `.env` files (`SKILL.md`, `scripts/scan_ai_tools.sh`). While no explicit data exfiltration or malicious payloads were identified, the broad system access and the instruction for the AI agent to verify API keys by executing CLI commands create a significant attack surface for credential theft or unauthorized execution.
Capability Assessment
Purpose & Capability
The overall purpose (discover installed AI CLIs, prioritize, and fallback) matches the provided script and SKILL.md. However, there are mismatches in config file names/locations (.ai-cli-orchestrator.yaml, .ai-config.yaml, ~/.ai-cli-config.json) and the described 'verify API key validity' step is implemented only as --version/--help checks, which do not validate credentials.
Instruction Scope
Runtime instructions explicitly tell the agent to read project files (.ai-config.yaml, .env), pass git diffs and file snapshots between tools, and the included script sources $HOME/.zshrc. Those actions expand scope into reading local secrets/configuration and executing whatever is in a user's shell rc — behavior that is not strictly necessary to 'detect installed CLI binaries' and can expose sensitive data or execute unintended code.
Install Mechanism
No install spec is provided (instruction-only skill) and the only shipped code is a small shell script. This minimizes install-time risk because nothing is downloaded or extracted from remote URLs.
Credentials
The skill declares no required environment variables, yet its instructions and script read/suggest reading .env, .ai-config.yaml, and source $HOME/.zshrc to obtain environment information. Requesting/dereferencing those files without declaring them is disproportionate and could lead to accidental use of credentials found there.
Persistence & Privilege
The skill writes a configuration file to $HOME/.ai-cli-config.json (persistence in the user's home). It does not request always:true or system-wide modification rights, which is appropriate, but the file-write behavior should be noted and confirmed acceptable by the user.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install ai-cli-orchestrator
  3. After installation, invoke the skill by name or use /ai-cli-orchestrator
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.3
ai-cli-orchestrator v1.0.3 - Updated `scripts/scan_ai_tools.sh` (details of specific code changes not shown). - No changes to documentation or core functionality described in SKILL.md.
v1.0.2
- Updated `scripts/scan_ai_tools.sh` (details not shown). - No changes to documentation, workflow, or public interfaces. - Version bump to 1.0.2.
v1.0.1
- Added a new "Security & Credentials" section detailing local-only credential handling, config file use, and best practices for credential protection. - Clarified why shell and project config files are read and emphasized minimal, read-only access. - Specified that all credential processing is local with no data exfiltration and sandboxed execution. - No other content or feature changes. - Updated documentation only; feature set remains the same.
v1.0.0
ai-cli-orchestrator 2.0.0 – Major meta-skill upgrade for robust multi-AI CLI task automation - Added intelligent detection and configuration for multiple AI CLI tools, with auto-scan, priority setting, and custom integration. - Introduced advanced task dispatching: analyzes task intent, allocates the optimal AI tool, and preserves session state/context during tool switching. - Implemented real-time monitoring and automatic fallback to backup AI CLIs on failures (rate limits, API errors, etc). - Enhanced error handling with detailed detection and recovery strategies for common automation failures. - Comprehensive session management for seamless multi-task, multi-tool switching with state recovery. - Provided extensibility for integrating additional AI CLIs via simple adapters.
Metadata
Slug ai-cli-orchestrator
Version 1.0.3
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 4
Frequently Asked Questions

What is 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. It is an AI Agent Skill for Claude Code / OpenClaw, with 330 downloads so far.

How do I install Ai Cli Orchestrator?

Run "/install ai-cli-orchestrator" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Ai Cli Orchestrator free?

Yes, Ai Cli Orchestrator is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Ai Cli Orchestrator support?

Ai Cli Orchestrator is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Ai Cli Orchestrator?

It is built and maintained by Atom (@cnatom); the current version is v1.0.3.

💬 Comments