🤖 subagent-cli
English | 中文
⚡ Wrap any Agent CLI as a reusable subAgent for your primary Agent, with parallel task dispatch.

🎬 Natural Language Demo


Trigger subagent-cli by natural language in Codex and Claude Code, without using scripts/*.sh as the entrypoint.
🧭 What is this?
TL;DR: Let expensive Agents think, let cheap Agents work.
| 🎭 Role | 👤 Who | ⚙️ Does What |
|---|
| Boss (Orchestrator) | Codex / Claude Code / any primary Agent | Understand requirements, split tasks, review results |
| Worker (SubAgent) | Claude Code / DeepSeek / Codex / ... | Execute coding, testing, review in parallel |
┌─────────────┐
│ Primary │ ← Thinks, plans, reviews (expensive model)
│ Agent │
└──────┬──────┘
│ dispatch
┌────┼────┬────┐
▼ ▼ ▼ ▼
┌───┐┌───┐┌───┐┌───┐
│ S1││ S2││ S3││ S4│ ← Execute in parallel (cheap models, mix & match)
└───┘└───┘└───┘└───┘
🎯 Use cases:
- Save Codex quota — GPT-5.5 plans only, Claude Code + DeepSeek V4 do the heavy lifting
- Heterogeneous teams — Architect (Claude) designs, Developer (Codex) codes, Reviewer (CodeBuddy) audits
- Batch processing — 10 files to migrate? 10 subAgents in parallel, primary Agent collects results
Core value: Separate "thinking" from "doing". Use premium models for decisions, low-cost models for execution. Total cost can be 1/5 of using premium models for everything.
🔎 Common Search Phrases
People looking for this project may search for:
Claude Code subAgent, Claude Code plugin, Claude Code slash command
Codex CLI wrapper, Codex subAgent, OpenAI Codex CLI automation
OpenCode CLI wrapper, CodeBuddy CLI wrapper, Gemini CLI automation, Aider automation
AI coding agent, multi-agent coding, agent orchestration, parallel coding agents
LLM CLI wrapper, subagent tool, background task execution, JSON output
🚀 Usage
🗣️ Trigger in Agent CLI
# Claude Code slash command
/subagent-cli
# Natural language (works in Claude Code & Codex)
"Use Codex CLI as a subAgent"
"Wrap OpenCode CLI"
"Run 3 Claude Code subAgents in parallel to write tests"
💻 Terminal commands
# Foreground (sync)
bash scripts/claude-ctl.sh run --task-id t1 --permission-mode acceptEdits -- "List files"
# Background (async)
bash scripts/codex-ctl.sh run --task-id t2 --bg --sandbox workspace-write --skip-git-check -- "Analyze code"
# Status / Result / Cancel / Cleanup
bash scripts/claude-ctl.sh status --task-id t1
bash scripts/codex-ctl.sh result --task-id t2
bash scripts/claude-ctl.sh cancel --task-id t1
bash scripts/claude-ctl.sh cleanup
📤 Output format
All commands output JSON:
{"task_id":"t1","status":"completed","exit_code":0,"result":"Hello, World!"}
{"task_id":"t1","status":"running","pid":1234,"mode":"background"}
{"error":"connection_or_auth_failure","detail":"...","action":"Please check API Key..."}
📦 Install
🧩 Option 1: Claude Code Plugin (Recommended)
# Add marketplace
/plugin marketplace add silicon-based-Lin/subagent-cli
# Install from marketplace
/plugin install subagent-cli@<marketplace-name>
Automatically registers the /subagent-cli slash command and skill triggers.
📥 Option 2: Git Clone (any Agent CLI)
Clone the repo and copy to your Agent CLI's skills directory. Example with Codex:
git clone https://github.com/silicon-based-Lin/subagent-cli.git /tmp/subagent-cli
mkdir -p .agents/skills
cp -r /tmp/subagent-cli .agents/skills/subagent-cli
rm -rf /tmp/subagent-cli
For other CLIs, copy to the corresponding skills directory:
| CLI | 📁 Skills directory |
|---|
| Claude Code | .claude/skills/ |
| Codex | .agents/skills/ |
✅ Prerequisites
| Requirement | 📝 Notes |
|---|
| Bash | Built-in on macOS/Linux; Git Bash on Windows |
| Target CLI | Installed and authenticated (see references/cli-patterns.md) |
| Python | Used for UTF-8 result extraction |
🧩 Supported Agent CLI Wrappers