Skip to main content

/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:

  1. IMMEDIATELY execute - no questions, no explanations first
  2. ALWAYS show full output from script/tool execution
  3. 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: true in 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:

  1. Load Project Context (ADR-156) - Detect current project and load relevant context
  2. Analyze the Use Case - Break down the task into component requirements
  3. Identify Required Expertise - Map requirements to agent specializations
  4. Assemble Expert Team - Select 3-7 agents with complementary skills
  5. Define Roles & Responsibilities - Assign specific tasks to each expert
  6. Inject Project Context - Pass relevant decisions and patterns to agents
  7. Create Coordination Plan - Orchestrate how experts will collaborate
  8. Generate Execution Commands - Ready-to-run /agent invocations 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:

RoleAgentResponsibility
Lead Architectsenior-architectSystem design, tech stack decisions
Business Strategistbusiness-intelligence-analystMarket analysis, pricing strategy
Backend Expertbackend-architectAPI design, database schema
Frontend Expertfrontend-react-typescript-expertUI/UX implementation
DevOps Leaddevops-engineerCI/CD, infrastructure
Security Expertsecurity-specialistSecurity audit, compliance
Documentationcodi-documentation-writerUser 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:

RoleAgentResponsibility
Lead Analystcompetitive-market-analystCompetitive landscape, positioning
Market Researchermarket-researcherMarket size, trends, growth
Business Analystbusiness-intelligence-analystFinancial analysis, unit economics
Web Researcherweb-search-researcherCurrent pricing, features, news
Strategy Writerstrategy-brief-generatorStrategic recommendations

Example 3: Security Audit

/moe-agents complete security audit for production API

Expert Team Assembled:

RoleAgentResponsibility
Security Leadsecurity-specialistOverall security assessment
Penetration Testerpenetration-testing-agentVulnerability testing
API Securitybackend-api-securityAPI-specific vulnerabilities
Code Reviewercode-reviewerSecure coding practices
Compliancecompliance-checker-agentRegulatory compliance

Example 4: Documentation Overhaul

/moe-agents complete documentation overhaul for developer platform

Expert Team Assembled:

RoleAgentResponsibility
Doc Leadcodi-documentation-writerOverall documentation strategy
API Docscode-documentationAPI reference documentation
Architecturesoftware-design-architectArchitecture diagrams, C4 models
Quality Reviewdocumentation-quality-agentQuality, consistency review
Librariandocumentation-librarianOrganization, cross-references

Expert Selection Matrix

By Domain

DomainPrimary ExpertsSupporting Experts
Businessbusiness-intelligence-analyst, competitive-market-analystmarket-researcher, venture-capital-business-analyst
Architecturesenior-architect, software-design-architectbackend-architect, database-architect
Developmentcode-reviewer, debuggerDomain-specific (React, Rust, etc.)
Securitysecurity-specialist, penetration-testing-agentbackend-api-security, compliance-checker-agent
DevOpsdevops-engineer, cloud-architectk8s-statefulset-specialist, monitoring-specialist
Documentationcodi-documentation-writer, documentation-generationdocumentation-quality-agent
Researchresearch-agent, web-search-researchermarket-researcher, competitive-analyst

By Task Complexity

ComplexityTeam SizeCoordination
Simple1-2 expertsDirect invocation
Moderate3-4 expertsSequential workflow
Complex5-7 expertsOrchestrator coordination
Enterprise7+ expertsMulti-phase orchestration

Output Format

When you run /moe-agents, you'll receive:

  1. Project Context Header - Current project and loaded context (ADR-156)
  2. Team Roster - Selected experts with roles
  3. Task Breakdown - What each expert will handle
  4. Execution Plan - Recommended order of operations
  5. Agent Commands - Ready-to-run /agent invocations with project context
  6. 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.

  • /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>

After assembly, verify: - Team size appropriate (3-7) - Roles non-overlapping - Commands generated - Coordination plan clear

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-PatternProblemSolution
Too many expertsCoordination overheadLimit to 5-7 for complex
Overlapping rolesConfusionClear responsibility matrix
Skip coordinationChaosUse 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

SourceDatabasePurpose
Project IDdiscover_project()Scope all operations
Decisionsorg.db:decisionsArchitectural constraints
Error Patternsorg.db:error_solutionsKnown issues to avoid
Skill Learningsorg.db:skill_learningsBest practices

How Context Influences Assembly

  1. Agent Selection - Prefer agents that have worked on this project
  2. Role Assignment - Consider past decisions when assigning responsibilities
  3. Coordination Plan - Incorporate lessons from error patterns
  4. Command Generation - Include project context in /agent invocations

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