launch-sub-agent
<task>
Launch a focused sub-agent to execute the provided task. Analyze the task to intelligently select the optimal model and agent configuration, then dispatch a sub-agent with Zero-shot Chain-of-Thought reasoning at the beginning and mandatory self-critique verification at the end.
</task>
<context>
This command implements the Supervisor/Orchestrator pattern from multi-agent architectures where you (the orchestrator) dispatch focused sub-agents with isolated context. The primary benefit is context isolation - each sub-agent operates in a clean context window focused on its specific task without accumulated context pollution.
</context>
Process
Phase 1: Task Analysis with Zero-shot CoT
Before dispatching, analyze the task systematically. Think through step by step:
Phase 2: Model Selection
Select the optimal model based on task analysis:
Decision Tree:
Phase 3: Specialized Agent Matching
If the task matches a specialized domain, incorporate the relevant agent prompt. Specialized agents provide domain-specific best practices, quality standards, and structured approaches that improve output quality.
Decision: Use specialized agent when task clearly benefits from domain expertise. Skip for trivial tasks where specialization adds unnecessary overhead.
Agents: Available specialized agents depends on project and plugins installed. Common agents from the sdd plugin include: sdd:developer, sdd:researcher, sdd:software-architect, sdd:tech-lead, sdd:code-explorer, sdd:business-analyst, sdd:code-reviewer, sdd:tech-writer. If the appropriate specialized agent is not available, fallback to a general agent without specialization.
Integration with Model Selection:
- Specialized agents are combined WITH model selection, not instead of
- Complex task + specialized domain = Opus + Specialized Agent
- Simple task matching domain = Haiku without specialization (overhead not justified)
Usage:
- Read the agent definition
- Include the agent's instructions in the sub-agent prompt AFTER the CoT prefix
- Combine with Zero-shot CoT prefix and Critique suffix
Phase 4: Construct Sub-Agent Prompt
Build the sub-agent prompt with these mandatory components:
4.1 Zero-shot Chain-of-Thought Prefix (REQUIRED - MUST BE FIRST)
4.2 Task Body
4.3 Self-Critique Suffix (REQUIRED - MUST BE LAST)
Phase 5: Dispatch Sub-Agent
Use the Task tool to dispatch with the selected configuration:
Context isolation reminder: Pass only context relevant to this specific task. Do not pass entire conversation history.
Examples
Example 1: Complex Architecture Task (Opus)
Input: /launch-sub-agent Design a caching strategy for our API that handles 10k requests/second
Analysis:
- Task type: Architecture / design
- Complexity: High (performance requirements, system design)
- Output size: Medium (design document)
- Domain match: sdd:software-architect
Selection: Opus + sdd:software-architect agent
Dispatch: Task tool with Opus model, sdd:software-architect prompt, CoT prefix, critique suffix
Example 2: Simple Documentation Update (Haiku)
Input: /launch-sub-agent Update the README to add --verbose flag to CLI options
Analysis:
- Task type: Documentation (simple edit)
- Complexity: Low (single file, well-defined)
- Output size: Small (one section)
- Domain match: None needed (too simple)
Selection: Haiku (fast, cheap, sufficient for task)
Dispatch: Task tool with Haiku model, basic CoT prefix, basic critique suffix
Example 3: Moderate Implementation (Sonnet + Developer)
Input: /launch-sub-agent Implement pagination for /users endpoint following patterns in /products
Analysis:
- Task type: Code implementation
- Complexity: Medium (follow existing patterns)
- Output size: Medium (implementation + tests)
- Domain match: sdd:developer
Selection: Sonnet + sdd:developer agent (non-complex but needs domain expertise)
Dispatch: Task tool with Sonnet model, sdd:developer prompt, CoT prefix, critique suffix
Example 4: Research Task (Opus + Researcher)
Input: /launch-sub-agent Research authentication options for mobile app - evaluate OAuth2, SAML, passwordless
Analysis:
- Task type: Research / comparison
- Complexity: High (comparative analysis, recommendations)
- Output size: Large (comprehensive research)
- Domain match: sdd:researcher
Selection: Opus + sdd:researcher agent
Dispatch: Task tool with Opus model, sdd:researcher prompt, CoT prefix, critique suffix
Best Practices
Context Isolation
- Pass only context relevant to the specific task
- Avoid passing entire conversation history
- Let sub-agent discover codebase patterns through tools
- Use file paths and references rather than embedding large content
Model Selection
- When in doubt, use Opus (quality over cost)
- Use Haiku only for truly trivial tasks
- Use Sonnet for "grunt work" - needs capability but not genius
- Production code always deserves Opus
Specialized Agents
- Use when domain expertise clearly improves quality
- Combine with CoT and critique patterns
- Don't force specialization on general tasks
Quality Gates
- Self-critique loop is non-negotiable
- Sub-agents must answer verification questions before completing
- Review sub-agent output before accepting


