Skip to content

πŸš€ One-command dispatch of dev tasks to Claude Code with auto-notification. Agent Teams support. | YouTube: https://www.youtube.com/@AIsuperdomain

License

Notifications You must be signed in to change notification settings

win4r/claude-code-dispatch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Claude Code Dispatch πŸš€

δΈ­ζ–‡ζ–‡ζ‘£ / Chinese README

One-command dispatch of development tasks to Claude Code with automatic notification on completion. Zero polling, zero token waste.

Fire-and-forget your coding tasks β†’ Claude Code builds it in the background β†’ you get a rich Telegram notification when it's done.

License: MIT

πŸ“Ί YouTube: AISuperDomain β€” AI coding tutorials and demos

✨ Features

  • πŸ”₯ Fire-and-forget β€” Dispatch a task and walk away. Get notified when done.
  • πŸ€– Agent Teams β€” Auto-split tasks into parallel Dev + Testing agents
  • πŸ“± Telegram notifications β€” Rich completion reports with test results, file listings, duration
  • πŸ”„ Three-layer callback β€” Telegram message β†’ webhook wake β†’ heartbeat fallback
  • 🎯 Auto-callback detection β€” Place a dispatch-callback.json in your workspace, zero params needed
  • πŸ›‘οΈ Battle-tested β€” 100+ real-world tasks, all edge cases handled

πŸ“ Architecture

dispatch.sh
  β†’ write task-meta.json
  β†’ launch Claude Code via claude_code_run.py (PTY wrapper)
  β†’ [Agent Teams: Lead splits work β†’ Dev + Testing Agents run in parallel]
  β†’ Claude Code finishes β†’ Stop Hook fires
    β†’ notify-hook.sh reads meta + output
    β†’ writes latest.json
    β†’ sends Telegram notification
    β†’ wakes AGI via webhook
    β†’ writes pending-wake.json (fallback)

πŸš€ Quick Start

1. Install

git clone https://github.com/win4r/claude-code-dispatch.git
cd claude-code-dispatch
chmod +x scripts/*.sh scripts/*.py

2. Setup Hook

Copy the hook script path to Claude Code settings:

# Edit ~/.claude/settings.json
# See docs/hook-setup.md for full config

3. Dispatch a Task

# Simple task
bash scripts/dispatch.sh \
  -p "Build a Python CLI calculator with Click" \
  -n "calc-cli" \
  -w /path/to/project \
  --permission-mode bypassPermissions

# With Telegram notification
bash scripts/dispatch.sh \
  -p "Build a REST API with FastAPI" \
  -n "my-api" \
  -g "<your-telegram-group-id>" \
  -w /path/to/project \
  --permission-mode bypassPermissions

# Agent Teams (parallel dev + testing)
bash scripts/dispatch.sh \
  -p "Build a weather CLI with API, caching, and colored output" \
  -n "weather-cli" \
  -g "<your-telegram-group-id>" \
  --agent-teams \
  --permission-mode bypassPermissions \
  -w /path/to/project

πŸ“‹ Parameters

Param Short Required Description
--prompt -p βœ… Task description
--name -n Task name for tracking
--group -g Telegram group ID for notifications
--workdir -w Working directory (default: cwd)
--agent-teams Enable Agent Teams (parallel dev+test)
--teammate-mode Display: auto / in-process / tmux
--permission-mode bypassPermissions / plan / acceptEdits
--allowed-tools Tool whitelist (e.g. "Read,Bash")
--model Model override
--callback-group Telegram group for callback
--callback-dm Telegram user ID for DM callback
--callback-account Telegram bot account name

πŸ€– Agent Teams

When --agent-teams is enabled, the dispatch script injects instructions for the Lead to:

  1. Split the task into parallel sub-agents
  2. Assign a dedicated Testing Agent that writes and runs tests
  3. Testing Agent runs in parallel with Dev Agent(s)
  4. All tests must pass before task is considered done

Each sub-agent is an independent Claude Code process sharing the same filesystem.

Proven Results

Project Agents Tests Duration
Weather CLI 4 (api, formatter, testing, lead) 42 passed 5m34s
Calculator CLI 3 (dev, testing, lead) 18 passed 3m12s
REST API 4 (routes, db, testing, lead) 31 passed 7m45s

πŸ”„ Auto-Callback Detection

Place a dispatch-callback.json in your workspace root:

For DM bots:

{
  "type": "dm",
  "dm": "<telegram-user-id>",
  "account": "<bot-account-name>"
}

For group agents:

{
  "type": "group",
  "group": "<telegram-group-id>"
}

For webhook wake only:

{
  "type": "wake"
}

Then dispatch without callback params β€” it auto-detects.

πŸ“ Result Files

All results stored in data/claude-code-results/:

File Content
latest.json Full result (output, task name, group, timestamp)
task-meta.json Task metadata (prompt, workdir, status, duration)
task-output.txt Raw Claude Code stdout
pending-wake.json Heartbeat fallback notification
hook.log Hook execution log

⚠️ Gotchas

  1. Must use PTY wrapper β€” Direct claude -p hangs in non-TTY environments. claude_code_run.py handles this via script(1).
  2. Hook fires on ALL Claude Code runs β€” Not just dispatched ones. The hook validates meta file freshness (<2h) to avoid re-sending old notifications.
  3. Hook fires twice β€” Stop + SessionEnd. Built-in .hook-lock deduplicates (30s window).
  4. tee pipe race condition β€” Hook sleeps 1s to wait for pipe flush before reading output.
  5. Always set -w explicitly β€” Missing workdir can drift into wrong cwd.
  6. Codex is different β€” This tool is for Claude Code only. For OpenAI Codex CLI, see codex-cli-dispatch (coming soon).

πŸ”§ Integration with OpenClaw

This tool works standalone, but is designed to integrate with OpenClaw:

  • Telegram notifications via openclaw message send
  • AGI wake via /hooks/wake webhook
  • Multi-agent orchestration via OpenClaw's agent system

πŸ“– Documentation

πŸ“Ί More

License

MIT

About

πŸš€ One-command dispatch of dev tasks to Claude Code with auto-notification. Agent Teams support. | YouTube: https://www.youtube.com/@AIsuperdomain

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published