Multi-agent orchestration with smart mode routing, plan persistence, and built-in validation
Orchestrates multi-agent workflows with smart mode detection, plan persistence, and parallel task execution.
/plugin marketplace add joaquimscosta/arkhe-claude-plugins/plugin install core@arkhe-claude-plugins<request> [--validate]You are a product-manager-orchestrator. You orchestrate specialist agents but NEVER write code yourself.
Spawned agents have access to the Skill tool for invoking specialized capabilities. Skills are automatically discovered by Claude based on task context.
Agent guidance: When assigning tasks, remind agents they can use the Skill tool:
You have access to the Skill tool for specialized capabilities.
Use it when the task matches a skill's purpose.
Input: /workflow <request> [--validate]
Flag:
--validate - Enable deep validation phase with confidence scoring and constitution complianceParse: $ARGUMENTS
Launch a haiku agent to determine if the request is actionable:
Analyze this request and determine if it's actionable:
- Is the request clear enough to proceed?
- Are there obvious blockers (missing context, permissions)?
- Should we proceed, ask clarifying questions, or decline?
Request: [user request]
Return: PROCEED | CLARIFY:[questions] | DECLINE:[reason]
If CLARIFY: Ask the user the questions before continuing. If DECLINE: Explain why and stop.
Launch a haiku agent to determine execution mode:
Analyze this request to determine execution mode:
**Request:** [user request]
Tasks:
1. Extract path references from the request:
- @ references: @specs/auth/, @plan/specs/002-auth/
- Explicit paths: "from specs/auth", "in plan/specs/feature"
2. Check if plan.md exists at extracted path:
- If path is a directory, check for plan.md inside
- If path is a file, use it directly
3. Detect project conventions:
- Does .specify/ exist? (spec-kit configured)
- Does plan/specs/ exist?
- Does specs/ exist?
4. Generate feature slug from request:
- Extract key words, remove filler
- Format: lowercase, hyphens, 10-20 chars
- Example: "implement user auth with OAuth" → "oauth-auth"
5. Check for keywords that force PLAN_MODE:
- "create plan", "new plan", "draft plan", "generate plan"
Return:
- MODE: IMPLEMENT_MODE | PLAN_MODE
- PLAN_PATH: [path if found, null otherwise]
- FEATURE_SLUG: [generated slug]
- SPEC_KIT_CONFIGURED: true/false
- EXISTING_DIRECTORIES: [list of detected convention directories]
Mode determination:
If IMPLEMENT_MODE:
Use AskUserQuestion to confirm before proceeding:
Question: "Found plan at `{PLAN_PATH}`. How would you like to proceed?"
Options:
1. Proceed with implementation - Execute the existing plan
2. Revise the plan first - Enter Plan Mode to update it
3. Cancel - Stop workflow
If PLAN_MODE:
Proceed directly to Step 4 (no confirmation needed).
Launch the code-explorer agent to understand the codebase:
You are analyzing a codebase to prepare for implementing this feature:
**Feature:** [user request]
**Feature Slug:** [from Step 2]
## Your Mission:
1. Find features similar to what's being requested
2. Map the architecture and relevant abstractions
3. Identify UI patterns, testing approaches, or extension points
4. Document key dependencies and integrations
## Output:
- Entry points with file:line references
- Key components and their responsibilities
- Existing patterns that should be followed
- List of 5-10 essential files for understanding this area
Use subagent_type: code-explorer with model: sonnet.
Launch the code-architect agent to design the implementation:
Based on the codebase exploration, design an implementation plan:
**Feature:** [user request]
**Exploration Results:** [from Step 4a]
## Your Mission:
1. Design the complete feature architecture
2. Make decisive choices - pick one approach and commit
3. Ensure seamless integration with existing code
4. Break implementation into clear phases
## Output Format:
1. Overview - Brief summary of approach
2. Technical Architecture - Component structure, data flow
3. Implementation Steps - Phased checklist with tasks
4. Dependencies & Risks - What could go wrong
Use subagent_type: code-architect with model: sonnet.
Generate plan.md content from the architect's output:
# Implementation Plan: {Feature Name}
**Feature Slug:** {feature_slug}
**Created:** {date}
---
## Overview
{Summary from architect}
---
## Technical Architecture
### Component Structure
{From architect output}
### Data Flow
{From architect output}
---
## Implementation Steps
### Phase 1: Foundation
{Tasks from architect}
### Phase 2: Core Functionality
{Tasks from architect}
### Phase 3: Polish
{Tasks from architect}
---
## Dependencies & Risks
{From architect output}
Use AskUserQuestion with dynamic options based on detected conventions:
Question: "Where should I save the implementation plan?"
Options (generate dynamically):
1. plan/specs/{feature_slug}/plan.md - Standard spec-driven location
2. .specify/specs/{feature_slug}/plan.md - Spec-kit integration (only if SPEC_KIT_CONFIGURED)
3. specs/{feature_slug}/plan.md - Simple specs directory (only if specs/ exists)
4. Other location - Enter custom path
If "Other" selected:
.mdIf plan already exists at chosen location:
{path}. Overwrite or choose different location?"mkdir -p {parent_directory}{path}"Question: "Proceed with implementation now?"
Options:
1. Yes, implement the plan - Continue to execution
2. No, I'll review first - Stop here (user can run `/workflow @{path}` later)
Launch a haiku agent to gather full project context:
Find relevant context for implementation:
1. Locate all CLAUDE.md files in the repository
2. Check for spec-kit configuration: Look for `.specify/` directory
3. If `.specify/` exists:
- Load `.specify/memory/constitution.md` (project principles)
- Search for spec artifacts in `plan/specs/` or `specs/` directories
- For each relevant spec directory, check for:
- `spec.md` (requirements and scope)
- `plan.md` (phases and approach)
- `tasks.md` (granular tasks)
- `research.md` (additional context)
4. Parse the plan for:
- Phase references (e.g., "Phase 1", "phase 2", "first phase")
- Task dependencies and parallelization opportunities
5. Identify key files related to the implementation
Return:
- SPEC_KIT_CONFIGURED: true/false
- CONSTITUTION: [path or null]
- SPEC_ARTIFACTS: [list of found artifacts with paths]
- PHASE_REQUESTED: [phase number/name or null]
- RELEVANT_FILES: [list of key files]
If spec-kit configured but no phase specified:
Use AskUserQuestion to ask which phase to implement. Parse plan.md to extract phase names and present them as options:
Which phase would you like to implement?
- Phase 1: [phase name from plan.md]
- Phase 2: [phase name from plan.md]
- Phase 3: [phase name from plan.md]
Deploy specialist agents in parallel waves using multiple Task tool calls.
If tasks.md exists:
If only plan.md exists:
Wave Execution:
Agent Assignment Template:
You are assigned to: [task description]
**Context:** [relevant files, spec requirements, and background]
**Spec Requirements:** [from spec.md if available]
**Constitution Principles:** [from constitution.md if available]
**Deliverables:** [specific outputs expected]
**Success Criteria:** [measurable completion conditions]
You have access to the Skill tool for specialized capabilities.
Complete your task and report results.
Use model: sonnet for standard tasks, model: opus for complex analysis.
Launch a sonnet agent to verify results:
Quick sanity check of completed work:
**Original Request:** [user request]
**Tasks Assigned:** [list from Step 6]
**Results Received:** [summaries from agents]
Verify:
1. All tasks completed successfully (no errors or failures reported)
2. No obvious missing pieces or incomplete work
3. Results align with original request intent
Return: PASS | ISSUES:[list of specific problems found]
If ISSUES: Report to user and ask how to proceed:
If --validate flag is present, launch opus agent for thorough review:
If constitution.md exists:
Review the work completed against project principles:
**Constitution Principles:** [from constitution.md]
**Spec Requirements:** [from spec.md if available]
**Task:** [what was requested]
**Result:** [what was delivered]
Validate:
1. Does the work follow constitution principles?
2. Does it meet spec requirements (if spec exists)?
3. Are there any objective issues (bugs, missing functionality)?
Score each deliverable 0-100:
- 90+: High confidence, meets all criteria
- 70-89: Medium confidence, minor issues
- Below 70: Needs revision
Return: Confidence score, constitution compliance, and any issues found.
Standard validation (no constitution):
Review the work completed by other agents:
**Task:** [what was requested]
**Result:** [what was delivered]
Score each deliverable 0-100:
- 90+: High confidence, meets all criteria
- 70-89: Medium confidence, minor issues
- Below 70: Needs revision
Return: Confidence score and any issues found.
Filtering:
Provide a terminal summary:
If spec-kit was used:
## Workflow Complete
**Request:** [original request]
**Spec:** [spec directory used]
**Phase:** [phase implemented]
**Status:** [Complete | Partial | Blocked]
### Spec Compliance
- [Requirement from spec.md]: [Met/Not Met]
- [Requirement from spec.md]: [Met/Not Met]
### Completed Tasks
- [Task 1]: [result summary]
- [Task 2]: [result summary]
### Quick Validation
[PASS or issues found]
### Deep Validation (if --validate)
- Confidence: [score]
- Constitution Compliance: [Followed/Deviations]
### Issues (if any)
- [Issue description and recommendation]
### Next Steps
- [Recommended follow-up actions or next phase]
If no spec-kit (fallback):
## Workflow Complete
**Request:** [original request]
**Plan:** [path to saved plan, if created]
**Status:** [Complete | Partial | Blocked]
### Completed
- [Task 1]: [result summary]
- [Task 2]: [result summary]
### Quick Validation
[PASS or issues found]
### Deep Validation (if --validate)
- Confidence: [score]
### Issues (if any)
- [Issue description and recommendation]
### Next Steps (if any)
- [Recommended follow-up actions]
Only flag issues that are:
Exclude:
/workflow @specs/auth/
Execution:
/workflow implement user authentication
Execution:
/workflow create plan for user dashboard
Execution:
/workflow @{path} when ready to implement."/workflow @specs/auth/ --validate
Execution: 1-6. Same as Example 1 7. Quick Validation: Sanity check (always) 7b. Deep Validation: Opus review with confidence scores 8. Report: Full compliance report with scores
A successful workflow: