Foreground

May 20, 2026 · View on GitHub

Async task delegation via detached worker processes, with broker-managed lifecycle, message injection, and MCP notifications.


Quick Start

Launch via Claude Code MCP

claude --dangerously-load-development-channels server:maestro --dangerously-skip-permissions

Delegate tools (delegate_message, delegate_status, delegate_output, delegate_tail, delegate_cancel) are available as MCP tools automatically.

Launch via CLI

# Async (background) — returns immediately with execId
maestro delegate "analyze auth module for vulnerabilities" --to gemini --async

# Foreground — blocks until completion
maestro delegate "say hello" --to claude

Command Reference

Main Command

maestro delegate "<PROMPT>" [options]
OptionDescriptionDefault
--to <tool>Agent: gemini, qwen, codex, claude, opencodeFirst enabled in config
--role <role>Capability role (analyze, explore, review, implement, plan, brainstorm, research)
--mode <mode>analysis (read-only) or write (create/modify/delete)analysis
--effort <level>Reasoning effort (low, medium, high, max)
--model <model>Model overrideTool's primaryModel
--cd <dir>Working directoryCurrent directory
--rule <template>Load protocol + prompt template
--id <id>Execution IDAuto: {prefix}-{HHmmss}-{rand4}
--resume [id]Resume previous session
--includeDirs <dirs>Additional directories (comma-separated)
--session <id>MCP session ID for notificationsAuto-detected
--backend <type>direct or terminaldirect
--asyncRun in background, return immediatelyforeground

Subcommands

maestro delegate show                              # Recent 20 executions
maestro delegate show --all                        # Up to 100
maestro delegate status <id>                       # Broker + history state
maestro delegate status <id> --events 10           # With more broker events
maestro delegate output <id>                       # Assistant output
maestro delegate output <id> --verbose             # With timestamps
maestro delegate output <id> --all                 # Include thinking/reasoning entries
maestro delegate output <id> --offset <n>          # Character offset
maestro delegate output <id> --limit <n>           # Max characters
maestro delegate tail <id>                         # Recent events + history
maestro delegate tail <id> --events 20 --history 20
maestro delegate cancel <id>                       # Request cancellation
maestro delegate message <id> "text"               # Inject follow-up message
maestro delegate message <id> "text" --delivery after_complete
maestro delegate messages <id>                     # List queued messages

MCP Tools

CLI SubcommandMCP ToolExtra Params
message <id> "text"delegate_messagedelivery (inject/after_complete)
messages <id>delegate_messages
status <id>delegate_statuseventLimit
output <id>delegate_output
tail <id>delegate_taillimit
cancel <id>delegate_cancel

Job Lifecycle

queued → running → completed
                 → failed
                 → cancelled

         input_required

Execution ID: {prefix}-{HHmmss}-{rand4} (e.g. gem-143022-a7f2) Prefix: gemini→gem, qwen→qwn, codex→cdx, claude→cld, opencode→opc

Delegate vs CLI: Feature Comparison
Featuremaestro climaestro delegate
Sync execution
Async execution--async
Prompt input-p "..."positional "..."
Tool selection--tool--to
Mode (analysis/write)
Model override
Working directory--cd--cd
Rule templates--rule--rule
Custom exec ID--id--id
Session resume--resume--resume
Backend selection--backend
MCP session binding--session
show (list executions)
output (get result)
output --verbose
watch (real-time stream)
status (broker + history)
tail (recent events)
cancel
message inject
message after_complete
MCP tool equivalents✅ (6 tools)
MCP channel notifications
Snapshot (latest output preview)

Delegate can fully replace CLI. The only CLI-only features (watch, output --tail) are convenience shortcuts.


Message Delivery

ModeBehaviorUse For
injectRoutes to running worker via stdinSupplementary context, course correction
after_completeQueues message; relaunches on completionChained tasks, post-processing
# Inject context into running delegate
maestro delegate message gem-143022-a7f2 "Also check src/utils/sanitize.ts"

# Chain: analyze → auto-fix
maestro delegate "analyze auth vulnerabilities" --to gemini --async
maestro delegate message gem-143022-a7f2 "Fix all critical vulnerabilities" --delivery after_complete

Prompt Construction

Assembly order: Mode protocolUser promptRule template (if specified)

Prompt Template (6 Fields)

PURPOSE: [goal] + [why] + [success criteria]
TASK: [step 1] | [step 2] | [step 3]
MODE: analysis|write
CONTEXT: @[file patterns] | Memory: [prior work context]
EXPECTED: [output format] + [quality criteria]
CONSTRAINTS: [scope limits] | [special requirements]

Rule Templates

Analysis: analysis-trace-code-execution, analysis-diagnose-bug-root-cause, analysis-analyze-code-patterns, analysis-review-architecture, analysis-review-code-quality, analysis-analyze-performance, analysis-assess-security-risks

Planning: planning-plan-architecture-design, planning-breakdown-task-steps, planning-design-component-spec, planning-plan-migration-strategy

Development: development-implement-feature, development-refactor-codebase, development-generate-tests, development-implement-component-ui, development-debug-runtime-issues


Notification System

Dual channels: MCP channel (primary, push) + Hook fallback (JSONL file)

Throttling: status_update at 10s, snapshot at 15s.


Workflows

Launch → Monitor → Retrieve

maestro delegate "analyze auth module" --to gemini --async
# → execId: gem-143022-a7f2

maestro delegate status gem-143022-a7f2
# → status: running

maestro delegate output gem-143022-a7f2
# → full analysis result

Chain: Analyze → Auto-Fix

maestro delegate "find all SQL injection vulnerabilities" --to gemini --async
maestro delegate message gem-143022-a7f2 "Fix all critical vulnerabilities" --delivery after_complete

Cancel → Redirect

maestro delegate cancel gem-143022-a7f2
maestro delegate "analyze only the payment module" --to gemini --async