/moe-agents - Mixture of Experts Assembly
Analyzes your use case or workflow and assembles an optimal team of specialized CODITECT agents, each contributing their unique expertise.
System Prompt
⚠️ EXECUTION DIRECTIVE: When the user invokes this command, you MUST:
- IMMEDIATELY execute - no questions, no explanations first
- ALWAYS show full output from script/tool execution
- ALWAYS provide summary after execution completes
DO NOT:
- Say "I don't need to take action" - you ALWAYS execute when invoked
- Ask for confirmation unless
requires_confirmation: truein frontmatter - Skip execution even if it seems redundant - run it anyway
The user invoking the command IS the confirmation.
Usage
/moe-agents <use-case-description>
How It Works
When you run /moe-agents, I will:
- Load Project Context (ADR-156) - Detect current project and load relevant context
- Analyze the Use Case - Break down the task into component requirements
- Identify Required Expertise - Map requirements to agent specializations
- Assemble Expert Team - Select 3-7 agents with complementary skills
- Define Roles & Responsibilities - Assign specific tasks to each expert
- Inject Project Context - Pass relevant decisions and patterns to agents
- Create Coordination Plan - Orchestrate how experts will collaborate
- Generate Execution Commands - Ready-to-run
/agentinvocations with project context
Project Context Loading
Before assembling experts, the command loads project-specific context:
# Step 1: Detect project
cd /Users/halcasteel/PROJECTS/coditect-rollout-master/submodules/core/coditect-core
source .venv/bin/activate
python3 -c "from scripts.core.paths import discover_project; print(discover_project() or 'global')"
# Step 2: Load project context
python3 scripts/context-query.py --project-stats
python3 scripts/context-query.py --decisions --limit 10 --filter-project
python3 scripts/context-query.py --errors --limit 5 --filter-project
Context passed to agents:
- Project ID - Ensures agents operate in correct scope
- Recent Decisions - Architectural choices to respect
- Error Patterns - Known issues and solutions
- Skill Learnings - Accumulated best practices
Examples
Example 1: Build a SaaS Product
/moe-agents build a complete SaaS product from idea to launch
Expert Team Assembled:
| Role | Agent | Responsibility |
|---|---|---|
| Lead Architect | senior-architect | System design, tech stack decisions |
| Business Strategist | business-intelligence-analyst | Market analysis, pricing strategy |
| Backend Expert | backend-architect | API design, database schema |
| Frontend Expert | frontend-react-typescript-expert | UI/UX implementation |
| DevOps Lead | devops-engineer | CI/CD, infrastructure |
| Security Expert | security-specialist | Security audit, compliance |
| Documentation | codi-documentation-writer | User docs, API docs |
Coordination:
/agent orchestrator "Coordinate SaaS development with senior-architect leading architecture, backend-architect on APIs, frontend-react-typescript-expert on UI, devops-engineer on infrastructure, and security-specialist on security review"
Example 2: Competitive Market Analysis
/moe-agents comprehensive competitive analysis for AI code assistant market
Expert Team Assembled:
| Role | Agent | Responsibility |
|---|---|---|
| Lead Analyst | competitive-market-analyst | Competitive landscape, positioning |
| Market Researcher | market-researcher | Market size, trends, growth |
| Business Analyst | business-intelligence-analyst | Financial analysis, unit economics |
| Web Researcher | web-search-researcher | Current pricing, features, news |
| Strategy Writer | strategy-brief-generator | Strategic recommendations |
Example 3: Security Audit
/moe-agents complete security audit for production API
Expert Team Assembled:
| Role | Agent | Responsibility |
|---|---|---|
| Security Lead | security-specialist | Overall security assessment |
| Penetration Tester | penetration-testing-agent | Vulnerability testing |
| API Security | backend-api-security | API-specific vulnerabilities |
| Code Reviewer | code-reviewer | Secure coding practices |
| Compliance | compliance-checker-agent | Regulatory compliance |
Example 4: Documentation Overhaul
/moe-agents complete documentation overhaul for developer platform
Expert Team Assembled:
| Role | Agent | Responsibility |
|---|---|---|
| Doc Lead | codi-documentation-writer | Overall documentation strategy |
| API Docs | code-documentation | API reference documentation |
| Architecture | software-design-architect | Architecture diagrams, C4 models |
| Quality Review | documentation-quality-agent | Quality, consistency review |
| Librarian | documentation-librarian | Organization, cross-references |
Expert Selection Matrix
By Domain
| Domain | Primary Experts | Supporting Experts |
|---|---|---|
| Business | business-intelligence-analyst, competitive-market-analyst | market-researcher, venture-capital-business-analyst |
| Architecture | senior-architect, software-design-architect | backend-architect, database-architect |
| Development | code-reviewer, debugger | Domain-specific (React, Rust, etc.) |
| Security | security-specialist, penetration-testing-agent | backend-api-security, compliance-checker-agent |
| DevOps | devops-engineer, cloud-architect | k8s-statefulset-specialist, monitoring-specialist |
| Documentation | codi-documentation-writer, documentation-generation | documentation-quality-agent |
| Research | research-agent, web-search-researcher | market-researcher, competitive-analyst |
By Task Complexity
| Complexity | Team Size | Coordination |
|---|---|---|
| Simple | 1-2 experts | Direct invocation |
| Moderate | 3-4 experts | Sequential workflow |
| Complex | 5-7 experts | Orchestrator coordination |
| Enterprise | 7+ experts | Multi-phase orchestration |
Output Format
When you run /moe-agents, you'll receive:
- Project Context Header - Current project and loaded context (ADR-156)
- Team Roster - Selected experts with roles
- Task Breakdown - What each expert will handle
- Execution Plan - Recommended order of operations
- Agent Commands - Ready-to-run
/agentinvocations with project context - Orchestration Command - Single command to coordinate all experts
Output Structure
┌─────────────────────────────────────────────────────────────┐
│ /moe-agents: <use-case> │
│ Project: <project-id or "global"> (ADR-156) │
├─────────────────────────────────────────────────────────────┤
│ PROJECT CONTEXT LOADED │
│ ───────────────────── │
│ Decisions: N loaded (influences architecture choices) │
│ Error Patterns: N loaded (known issues to avoid) │
│ Learnings: N loaded (best practices applied) │
│ │
├─────────────────────────────────────────────────────────────┤
│ EXPERT TEAM ASSEMBLED │
│ ───────────────────── │
│ Lead: <agent-name> - <responsibility> │
│ Expert 2: <agent-name> - <responsibility> │
│ Expert 3: <agent-name> - <responsibility> │
│ ... │
├─────────────────────────────────────────────────────────────┤
│ EXECUTION COMMANDS │
│ ────────────────── │
│ /agent <name> "<task>" --project <project-id> │
│ ... │
├─────────────────────────────────────────────────────────────┤
│ ORCHESTRATION │
│ /agent orchestrator "coordinate: <plan> [project: X]" │
└─────────────────────────────────────────────────────────────┘
Combining with /moe-judges
For critical tasks, combine expert assembly with judge evaluation:
# Step 1: Assemble experts
/moe-agents build enterprise API
# Step 2: Execute with experts
/agent orchestrator "coordinate API development..."
# Step 3: Judge the output
/moe-judges evaluate the API design for production readiness
Or use /moe-workflow for automatic expert + judge combination.
Related Commands
/which <task>- Quick single-agent recommendation/moe-judges <output>- Evaluate output with judge panel/moe-workflow <task>- Full expert + judge workflow/agent <name> <task>- Invoke specific agent
Action Policy
<default_behavior> This command analyzes and assembles without executing. Provides:
- Expert team roster
- Role assignments
- Coordination plan
- Ready-to-run commands
User decides when to execute the assembled team. </default_behavior>
Success Output
When moe-agents completes:
✅ COMMAND COMPLETE: /moe-agents
Project: <project-id or "global">
Use Case: <description>
Team Size: N experts
Lead: <primary-agent>
Context: N decisions, N patterns loaded
Commands: N generated (with project context)
Coordination: Ready
Completion Checklist
Before marking complete:
- Use case analyzed
- Experts selected
- Roles assigned
- Commands generated
- Coordination planned
Failure Indicators
This command has FAILED if:
- ❌ No use case provided
- ❌ No experts selected
- ❌ Commands not generated
- ❌ Role conflicts exist
When NOT to Use
Do NOT use when:
- Single agent sufficient (use /which)
- Need immediate execution
- Simple task (use /agent directly)
Anti-Patterns (Avoid)
| Anti-Pattern | Problem | Solution |
|---|---|---|
| Too many experts | Coordination overhead | Limit to 5-7 for complex |
| Overlapping roles | Confusion | Clear responsibility matrix |
| Skip coordination | Chaos | Use orchestrator for >3 |
Principles
This command embodies:
- #6 Clear, Understandable - Clear role matrix
- #3 Complete Execution - Full team assembly
- #9 Based on Facts - Evidence-based selection
Full Standard: CODITECT-STANDARD-AUTOMATION.md
Project Context Integration (ADR-156)
The /moe-agents command now loads and applies project-specific context:
Context Sources
| Source | Database | Purpose |
|---|---|---|
| Project ID | discover_project() | Scope all operations |
| Decisions | org.db:decisions | Architectural constraints |
| Error Patterns | org.db:error_solutions | Known issues to avoid |
| Skill Learnings | org.db:skill_learnings | Best practices |
How Context Influences Assembly
- Agent Selection - Prefer agents that have worked on this project
- Role Assignment - Consider past decisions when assigning responsibilities
- Coordination Plan - Incorporate lessons from error patterns
- Command Generation - Include project context in
/agentinvocations
Context-Aware Commands
Generated commands include project context:
# Without project context (old)
/agent senior-architect "design API for user service"
# With project context (ADR-156)
/agent senior-architect "design API for user service" \
--context "Project: PILOT, Decisions: Use Django REST, PostgreSQL"
Usage
/moe-agents build authentication system # Uses auto-detected project
CODITECT_PROJECT=my-proj /moe-agents ... # Explicit project
Version: 1.1.0 Created: 2025-12-22 Updated: 2026-02-04 Author: CODITECT Team ADR: ADR-156