# Giasip Dispatch

> “Multi-model dispatcher -- sends a task or prompt to other AI models (Codex / Gemini / Kimi / DeepSeek / Doubao / Qwen / GLM / MiniMax) and retrieves results. Triggers when you want to run a task on a specific model, need multi-model cross-validation, or want to use a cheaper model.”

- **Type:** Skill
- **Install:** `agentstack add skill-giasip-giasip-skills-giasip-dispatch`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [GiaSip](https://agentstack.voostack.com/s/giasip)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [GiaSip](https://github.com/GiaSip)
- **Source:** https://github.com/GiaSip/giasip-skills/tree/main/skills/giasip-dispatch
- **Website:** https://github.com/GiaSip/giasip-skills/blob/main/docs/claim-ledger-method.md

## Install

```sh
agentstack add skill-giasip-giasip-skills-giasip-dispatch
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

> ✦ A **GiaSip** skill · part of the `giasip` toolkit · github.com/GiaSip

# /dispatch — Multi-Model Dispatcher

Sends a task or prompt to another AI model for execution and retrieves the result. This skill **only provides the dispatch capability** — which model to pick, whether to fan out to multiple models, is decided by you (or the current Claude) based on the task at hand. No built-in model preference.

## Script Directory

**Important**: All scripts live in the `scripts/` subdirectory of *this* skill folder.

**Agent setup — do this ONCE before running any command below**: determine the absolute path of the directory that contains this `SKILL.md`, and export it as `BASE_DIR`:

```bash
# Global install (most common); use the plugin cache path instead if installed as a plugin
export BASE_DIR="$HOME/.claude/skills/giasip-dispatch"
```

Every command below references scripts as `$BASE_DIR/scripts/`. `BASE_DIR` is a shell variable **you** set in the session — there is **no** `CLAUDE_SKILL_DIR` environment variable injected by the runtime, so set `BASE_DIR` first or the script paths will resolve to nothing.

## Two Dispatch Channels

| Channel | Models | Prerequisite |
|---------|--------|-------------|
| **API direct call** (curl, fastest) | DeepSeek / Qwen / GLM / Doubao / MiniMax | Just place the corresponding `.env` in `~/.config/ai-keys/` (with API key) |
| **CLI invocation** | Codex / Gemini / Kimi | Requires local install + login for each CLI |
| **Internal SubAgent** | Claude Haiku / Sonnet | Built into Claude Code, no external dependency |

> For pure thinking/analysis tasks (no file I/O, no command execution, no code changes), prefer **API direct call** — roughly 10x faster than CLI. Use CLI only when the task needs agent capabilities (file system access, command execution, code changes).

---

## General Discipline (must-read for all CLI calls)

1. **Use heredoc for prompts** — avoids quoting / special character issues.
2. **Append ` 10 files or 3 modules
- Chinese business/strategic analysis tasks (default: three-way parallel)

→ See `references/model-roster.md` for multi-dispatch lineup recommendations by task type.

---

## Dispatch Methods

### API Direct Call (DeepSeek / Qwen / GLM / Doubao / MiniMax)

For pure analysis tasks that don't need agent capabilities, call the API directly:

```bash
$BASE_DIR/scripts/api-dispatch.sh --model  "$(cat  --stdin
```

Supported models — see `references/model-roster.md` for the full roster with per-model strengths and multi-dispatch lineup recommendations.

| Parameter | Model | Key File | Context |
|-----------|-------|----------|---------|
| `deepseek` | DeepSeek V4-Pro (thinking mode on) | `deepseek.env` | 1M |
| `qwen` | Qwen3.6 Plus (Tongyi) | `dashscope.env` | 1M |
| `glm` | GLM-5.1 (Zhipu flagship) | `zai.env` | 200K |
| `doubao` | Doubao Seed-2.0 Pro (ByteDance) | `volcengine.env` | 256K |
| `minimax` | MiniMax M2.7 | `minimax.env` | — |

> Model names evolve with vendor updates — check vendor docs before calling.

### Codex CLI (OpenAI) — App Server protocol, no cold start

Read-only mode (analysis / review / research):

```bash
node $BASE_DIR/scripts/codex-appserver.mjs --effort xhigh "$(cat /dev/null` — the script outputs structured progress and error info on stderr
- Long text can use stdin: `echo "long text" | node $BASE_DIR/scripts/codex-appserver.mjs --stdin --effort xhigh`

### Gemini CLI (Google) — supervisor script recommended

The supervisor has built-in smart retry / fallback chain / circuit breaker / timeout / logging:

```bash
$BASE_DIR/scripts/gemini-supervisor.sh --cwd "/path/to/work/dir" "$(cat  "prompt"`
**stdin mode (recommended for long prompts):** `cat prompt.txt | $BASE_DIR/scripts/gemini-supervisor.sh --stdin --cwd "/work/dir"`

**Gemini vision / PDF parsing** (Gemini natively supports PDF + image visual analysis — the standard path for scanned PDFs / screenshots):

```bash
$BASE_DIR/scripts/gemini-supervisor.sh \
  --cwd "/path/to/files/dir" \
  "$(cat  output.md
```

Use cases: PDF catalogs (no text layer), scans, product datasheets, screenshot analysis, image OCR, chart data extraction. Pipe to file (`... > output.md`) for large outputs to avoid stdout truncation.

### Kimi CLI (Moonshot) — wrapper script recommended, auto endpoint routing

> **Thinking model discipline**: Kimi K2.6 is a thinking model — reasoning can take minutes for complex prompts. **Bash timeout must be ≥600000** (10 min) for complex tasks. The script has built-in SSE streaming + idle guard (120s no-byte threshold) + 900s hard cap. Do NOT kill mid-run or substitute with hand-written curl. For fast mode: prefix `KIMI_NO_THINK=1` (injects `{"thinking":{"type":"disabled"}}`, ~4s response, but quality drops — only for non-reasoning tasks).

```bash
# Default: Moonshot general endpoint (api.moonshot.cn/v1, MOONSHOT_API_KEY)
$BASE_DIR/scripts/kimi-dispatch.sh "$(cat /dev/null
```

Only dispatch to available models. If a CLI is unavailable, fall back to API direct call or switch models; an existing API key file means that model is callable.

---

## Multi-Model Parallel (cross-validation / multi-perspective)

When you need multiple models to give independent perspectives on the same question, **fire multiple Bash calls in parallel** and have Claude synthesize the results. Typical scenarios: important decisions, tech selection, pre-flight check before irreversible actions, low confidence in a single model's output.

```bash
# Three-way parallel example (same prompt to three models)
$BASE_DIR/scripts/kimi-dispatch.sh "analysis task" &
$BASE_DIR/scripts/api-dispatch.sh --model deepseek "analysis task" &
$BASE_DIR/scripts/api-dispatch.sh --model doubao "analysis task" &
wait
```

Selection principle: cognitive diversity > quantity — pick models with different training data / architecture to get genuinely different perspectives; always use each model's highest tier; control cost by controlling frequency, not by downgrading per-call quality.

---

## Execution Parameters

- **Bash timeout:**
  - Codex deep reasoning (xhigh): `600000` (10 minutes, Bash tool ceiling, aligned with script default 600s)
  - Gemini single dispatch: `240000` (4 minutes); multi-dispatch per route `300000` (5 minutes)
  - **Kimi (thinking model)**: single/multi-dispatch always `≥600000` (reasoning tail is long and unpredictable); only `KIMI_NO_THINK=1` fast mode can use `240000`
- Single dispatch = one Bash call; multi-dispatch = multiple Bash calls fired in parallel
- Codex uses App Server protocol with no cold start; xhigh deep reasoning typically takes 3-8 minutes
- Gemini / Kimi use CLI headless mode; keep `2>/dev/null`

## Fallback Chain

```
Primary channel fails (timeout / error)
→ Try alternative model (similar capability)
→ Alternative also fails
→ Downgrade to "recommendation only" mode: output suggested approach but don't execute, hand back to user
```

---

## Output Format

**Single dispatch:**

```markdown
## Task Result
**Executor:** [model name]  **Task:** [one-line recap]

### Result
[model output]

### Execution Info
- Duration: [X seconds]  Status: [success / partial / failed]
```

**Multi-dispatch:**

```markdown
## Task Result (Multi-Dispatch)
**Task:** [one-line recap]

### [Model 1]'s Take
[3-5 key points]

### [Model 2]'s Take
[3-5 key points]

### Synthesis
- **Consensus:** [what all parties agree on]
- **Divergence:** [differences, with each party's position noted]
- **My judgment:** [Claude's independent assessment as the orchestrator]
```

---

## Response Logging

Use `dispatch-persist.mjs` to persist **complete first-hand responses** to `~/.cache/dispatch/responses/YYYY/MM/DD/.md` (YAML frontmatter + prompt + response) and append to `~/.cache/dispatch/index.jsonl` (consumption entry point). Pipe dispatch output to this script, or hook it into your dispatch scripts to avoid losing responses to volatile /tmp or session logs.

For multi-dispatch runs, set `DISPATCH_BATCH_ID` to group responses from the same batch:

```bash
batch_id="$(uuidgen)"
DISPATCH_BATCH_ID="$batch_id" $BASE_DIR/scripts/kimi-dispatch.sh "task" &
DISPATCH_BATCH_ID="$batch_id" $BASE_DIR/scripts/api-dispatch.sh --model deepseek "task" &
wait
```

Implementation: see `$BASE_DIR/scripts/dispatch-persist.mjs`.

---

## Script Inventory

| Script | Purpose |
|--------|---------|
| `api-dispatch.sh` | API direct call (DeepSeek / Qwen / GLM / Doubao / MiniMax) |
| `codex-appserver.mjs` | Codex App Server protocol (read-only / write mode) |
| `gemini-supervisor.sh` | Gemini CLI + retry / fallback / circuit breaker |
| `kimi-dispatch.sh` | Kimi dispatch + endpoint routing + thinking mode control |
| `dispatch-persist.mjs` | Response logging — auto-persists dispatch results to disk |
| `stop-review-gate.mjs` | Codex stop hook — gates on code review before stopping |

> For installation, dependencies, and API key setup, see README.md.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [GiaSip](https://github.com/GiaSip)
- **Source:** [GiaSip/giasip-skills](https://github.com/GiaSip/giasip-skills)
- **License:** MIT
- **Homepage:** https://github.com/GiaSip/giasip-skills/blob/main/docs/claim-ledger-method.md

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** yes
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-giasip-giasip-skills-giasip-dispatch
- Seller: https://agentstack.voostack.com/s/giasip
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
