claude-code-dispatch
Dispatch development tasks to Claude Code with automatic callback on completion. Supports Agent Teams (multi-agent parallel dev with dedicated Testing Agent), cost controls (--max-budget-usd), model fallback, git worktree isolation, custom subagents via --agents JSON, and MCP server integration. Use when: (1) dispatching a coding task to Claude Code and wanting automatic Telegram notification on completion, (2) running Agent Teams for parallel dev+test workflows, (3) needing zero-polling task execution with Stop Hook callback, (4) the user says 'use Claude Code to build/develop/create X', (5) the user asks to dispatch or run a Claude Code task. THIS IS THE DEFAULT for any 'build/develop/create a project' request — prefer this over claude-code-clawdbot for anything that takes >2 min or needs background execution.
About this skill
This skill enables AI agents to delegate significant software development projects to Claude Code, automating the entire process from task initiation to completion notification. It facilitates zero-polling, background task execution, making it ideal for lengthy or resource-intensive coding efforts that would typically exceed typical interactive session limits. Key features include support for Agent Teams, allowing for parallel development and dedicated testing agents, robust cost controls through `--max-budget-usd`, and model fallback mechanisms. The system uses `git worktree` for project isolation, ensures automatic Telegram notifications upon task completion, and integrates with MCP servers. It is designed to be the default choice for any 'build/develop/create a project' request, particularly when the task is expected to take longer than two minutes or requires continuous background processing, thereby optimizing agent resource usage and user experience by providing timely updates without constant supervision.
Best use case
The primary use case is for AI agents or users who need to initiate and manage complex software development projects with Claude Code, but prefer an asynchronous, hands-off approach. It's perfect for delegating backend API development, full-stack application creation, or any substantial coding task that benefits from automated execution and progress reporting. Developers, project managers, or other AI agents requiring a reliable system for orchestrating development workflows with built-in monitoring and notification capabilities will benefit most.
Dispatch development tasks to Claude Code with automatic callback on completion. Supports Agent Teams (multi-agent parallel dev with dedicated Testing Agent), cost controls (--max-budget-usd), model fallback, git worktree isolation, custom subagents via --agents JSON, and MCP server integration. Use when: (1) dispatching a coding task to Claude Code and wanting automatic Telegram notification on completion, (2) running Agent Teams for parallel dev+test workflows, (3) needing zero-polling task execution with Stop Hook callback, (4) the user says 'use Claude Code to build/develop/create X', (5) the user asks to dispatch or run a Claude Code task. THIS IS THE DEFAULT for any 'build/develop/create a project' request — prefer this over claude-code-clawdbot for anything that takes >2 min or needs background execution.
A completed software project (e.g., a Python API, a full-stack app) developed autonomously by Claude Code, with the user receiving an automatic Telegram notification indicating task completion and providing relevant logs/output.
Practical example
Example input
Use Claude Code to build a Python REST API with FastAPI, name it 'my-api', and ensure I get a Telegram notification when it's done.
Example output
Task 'my-api' to build a Python REST API with FastAPI has been successfully dispatched to Claude Code for background execution. I will notify you via Telegram upon its completion, including any final outputs or logs. You can monitor progress in `/tmp/dispatch-my-api.log`.
When to use this skill
- When dispatching a coding task to Claude Code and desiring automatic Telegram notification upon completion.
- For running Agent Teams to manage parallel development and testing workflows.
- When needing zero-polling task execution with a Stop Hook callback for background operations.
- When the user explicitly asks to 'use Claude Code to build/develop/create X' or dispatch a Claude Code task.
When not to use this skill
- For very short, interactive coding tasks that require immediate, synchronous feedback (prefer alternatives like `claude-code-clawdbot` for these).
- If the target task does not involve Claude Code or requires a different agent platform.
- When a simple, non-persistent, one-off code generation without project management or notifications is sufficient.
- In environments where the necessary `bash` scripts and Python dependencies cannot be executed or are not installed.
How claude-code-dispatch Compares
| Feature / Agent | claude-code-dispatch | Standard Approach |
|---|---|---|
| Platform Support | Claude | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | medium | N/A |
Frequently Asked Questions
What does this skill do?
Dispatch development tasks to Claude Code with automatic callback on completion. Supports Agent Teams (multi-agent parallel dev with dedicated Testing Agent), cost controls (--max-budget-usd), model fallback, git worktree isolation, custom subagents via --agents JSON, and MCP server integration. Use when: (1) dispatching a coding task to Claude Code and wanting automatic Telegram notification on completion, (2) running Agent Teams for parallel dev+test workflows, (3) needing zero-polling task execution with Stop Hook callback, (4) the user says 'use Claude Code to build/develop/create X', (5) the user asks to dispatch or run a Claude Code task. THIS IS THE DEFAULT for any 'build/develop/create a project' request — prefer this over claude-code-clawdbot for anything that takes >2 min or needs background execution.
Which AI agents support this skill?
This skill is designed for Claude.
How difficult is it to install?
The installation complexity is rated as medium. You can find the installation instructions above.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
AI Agents for Coding
Browse AI agent skills for coding, debugging, testing, refactoring, code review, and developer workflows across Claude, Cursor, and Codex.
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
SKILL.md Source
# Claude Code Dispatch Skill
Dispatch development tasks to Claude Code with automatic notification on
completion. Zero polling, zero token waste.
## Architecture
```
dispatch.sh
→ write task-meta.json
→ launch Claude Code via claude_code_run.py (PTY wrapper)
→ [Agent Teams: --agents JSON defines Testing Agent + custom subagents]
→ Claude Code finishes → Stop/TaskCompleted hook fires automatically
→ notify-agi.sh reads meta + output
→ writes latest.json
→ sends Telegram notification (group + callback)
→ writes pending-wake.json (heartbeat fallback)
```
## Quick Reference
### Basic dispatch
⚠️ **Always use `nohup` + background (`&`)** — dispatch runs until done.
```bash
nohup bash scripts/dispatch.sh \
-p "Build a Python REST API with FastAPI" \
-n "my-api" \
-g "-5006066016" \
--permission-mode bypassPermissions \
--workdir /home/ubuntu/projects/my-api \
> /tmp/dispatch-my-api.log 2>&1 &
```
### With Agent Teams
```bash
nohup bash scripts/dispatch.sh \
-p "Build a full-stack app with React + Express" \
-n "fullstack-app" \
--agent-teams \
--permission-mode bypassPermissions \
--workdir /home/ubuntu/projects/fullstack-app \
> /tmp/dispatch-fullstack.log 2>&1 &
```
When `--agent-teams` is passed without `--agents-json`, a default Testing Agent
is auto-defined via the `--agents` CLI flag (structured JSON, not prompt injection).
### With cost controls
```bash
nohup bash scripts/dispatch.sh \
-p "Refactor the database layer" \
-n "db-refactor" \
--max-budget-usd 5.00 \
--max-turns 50 \
--fallback-model sonnet \
--permission-mode bypassPermissions \
--workdir /home/ubuntu/projects/my-app \
> /tmp/dispatch-refactor.log 2>&1 &
```
### With custom subagents
```bash
nohup bash scripts/dispatch.sh \
-p "Build CLI tool" \
-n "cli-tool" \
--agent-teams \
--agents-json '{"security-reviewer":{"description":"Security expert","prompt":"Review for vulnerabilities","tools":["Read","Grep","Glob"],"model":"opus"}}' \
--permission-mode bypassPermissions \
--workdir /home/ubuntu/projects/cli-tool \
> /tmp/dispatch-cli.log 2>&1 &
```
### With git worktree isolation
```bash
nohup bash scripts/dispatch.sh \
-p "Implement feature X" \
-n "feature-x" \
--worktree feature-x \
--permission-mode bypassPermissions \
--workdir /home/ubuntu/projects/my-app \
> /tmp/dispatch-feature.log 2>&1 &
```
## All Parameters
| Param | Short | Description |
|-------|-------|-------------|
| `--prompt` | `-p` | Task description (required*) |
| `--prompt-file` | | Read prompt from file (required*) |
| `--name` | `-n` | Task name for tracking |
| `--group` | `-g` | Telegram group ID for notifications |
| `--workdir` | `-w` | Working directory |
| `--agent-teams` | | Enable Agent Teams mode |
| `--agents-json` | | Custom subagent definitions (JSON) |
| `--teammate-mode` | | Display: `auto` / `in-process` / `tmux` |
| `--permission-mode` | | `bypassPermissions` / `plan` / `acceptEdits` / `default` |
| `--allowed-tools` | | Tool allowlist |
| `--disallowed-tools` | | Tool denylist |
| `--model` | | Model override (sonnet/opus/haiku/full name) |
| `--fallback-model` | | Auto-fallback when primary is overloaded |
| `--max-budget-usd` | | Maximum dollar spend before stopping |
| `--max-turns` | | Maximum agentic turns |
| `--worktree` | | Git worktree name for isolation |
| `--no-session-persistence` | | Don't save session to disk |
| `--append-system-prompt` | | Append text to system prompt |
| `--append-system-prompt-file` | | Append system prompt from file |
| `--mcp-config` | | Load MCP servers from JSON file |
| `--verbose` | | Enable verbose logging |
| `--callback-group` | | Callback to dispatching agent's group |
| `--callback-dm` | | DM callback user ID |
| `--callback-account` | | DM callback bot account |
| `--session` | `-s` | Callback session key |
\* One of `--prompt` or `--prompt-file` is required.
## Hook Setup
See [references/hook-setup.md](references/hook-setup.md) for full hook
configuration. The skill uses Stop, TaskCompleted, and SessionEnd hooks with
the `notify-agi.sh` script. HTTP hooks are also supported as an alternative.
## Prompt Tips
See [references/prompt-guide.md](references/prompt-guide.md) for examples
and best practices, including cost control, Agent Teams, worktree isolation,
custom subagents, and MCP integration.
## Debugging
```bash
# Watch hook log
tail -f data/claude-code-results/hook.log
# Check latest result
cat data/claude-code-results/latest.json | jq .
# Check task metadata
cat data/claude-code-results/task-meta.json | jq .
# Test Telegram delivery
openclaw message send --channel telegram --target "-5006066016" --message "test"
# Check dispatch log
tail -f /tmp/dispatch-*.log
```
## Gotchas
1. **Must use PTY wrapper** — Direct `claude -p` can hang in exec environments
2. **Hook fires twice** — Stop + SessionEnd both trigger; `.hook-lock` deduplicates (30s window)
3. **Hook stdin is empty in PTY** — Output read from `task-output.txt`, not stdin
4. **tee pipe race** — Hook sleeps 1s for pipe flush before reading output
5. **Meta freshness** — Hook validates meta age (<2h) and session ID
6. **Agent Teams cost** — Use `--max-budget-usd` to cap spend on multi-agent tasks
7. **Rate limits** — Claude Code has daily rate limits resetting at 11:00 UTC; check hook.log for "limit" messagesRelated Skills
CLAUDE.md – JJ Quick Command List
A concise cheat sheet for essential Jujutsu (`jj`) version control commands, designed to help AI agents or users quickly perform common repository operations.
collaborating-with-claude-code
Delegate code implementation/review/debugging/alternatives to Claude Code via a JSON bridge script. Multi-turn via SESSION_ID.
laravel-expert
Senior Laravel Engineer role for production-grade, maintainable, and idiomatic Laravel solutions. Focuses on clean architecture, security, performance, and modern standards (Laravel 10/11+).
webmcp
This skill guides AI agents in implementing WebMCP within web projects, enabling browser-native structured tools for AI interaction using JavaScript or HTML APIs.
Prompt Coach
Analyze your Claude Code session logs to improve prompt quality, optimize tool usage, and enhance your skills as an AI-native engineer.
nextjs
Provides comprehensive Next.js routing capabilities, including typed routes, helpers for `PageProps` and `LayoutProps`, and `nuqs` for managing URL state.
react
This AI agent skill guides the generation of modern React components, incorporating best practices such as destructured props, leveraging compiler optimizations, and proper use of React Effects. It also ensures compatibility and utilizes Tailwind CSS v4 syntax.
just
Use `just` to save and run project-specific commands. Use when the user mentions `justfile`, `recipe`, or needs a simple alternative to `make` for task automation.
chrome-debug
This skill empowers AI agents to debug web applications and inspect browser behavior using the Chrome DevTools Protocol (CDP), offering both collaborative (headful) and automated (headless) modes.
worktree-manager
Create, manage, and cleanup git worktrees with Claude Code agents across all projects. USE THIS SKILL when user says "create worktree", "spin up worktrees", "new worktree for X", "worktree status", "cleanup worktrees", "sync worktrees", or wants parallel development branches. Also use when creating PRs from a worktree branch (to update registry with PR number). Handles worktree creation, dependency installation, validation, agent launching in Ghostty, and global registry management.
clearshot
Structured screenshot analysis for UI implementation and critique. Analyzes every UI screenshot with a 5×5 spatial grid, full element inventory, and design system extraction — facts and taste together, every time. Escalates to full implementation blueprint when building. Trigger on any digital interface image file (png, jpg, gif, webp — websites, apps, dashboards, mockups, wireframes) or commands like 'analyse this screenshot,' 'rebuild this,' 'match this design,' 'clone this.' Skip for non-UI images (photos, memes, charts) unless the user explicitly wants to build a UI from them. Does NOT trigger on HTML source code, CSS, SVGs, or any code pasted as text.
osgrep
Semantic code search using natural language queries. Use when users ask "where is X implemented", "how does Y work", "find the logic for Z", or need to locate code by concept rather than exact text. Returns file paths with line numbers and code snippets.