Skip to main content

Skill Dispatch Algorithm

Version: 1.0.0 | Status: ACTIVE The dispatch algorithm automatically selects the appropriate skill for a task based on multiple matching strategies.

Decision Tree

Task Input


┌─────────────────────────────────────┐
│ 1. Category Override Check          │
│    task.category set?               │
│    → skill_dispatch_by_category()   │
└─────────────────────────────────────┘
    │ No match

┌─────────────────────────────────────┐
│ 2. Task Type Match                  │
│    dispatch_matrix.by_task_type     │
│    task.type → skill mapping        │
└─────────────────────────────────────┘
    │ No match

┌─────────────────────────────────────┐
│ 3. Keyword Pattern Match            │
│    dispatch_matrix.by_keyword       │
│    title + description → regex      │
└─────────────────────────────────────┘
    │ No match

┌─────────────────────────────────────┐
│ 4. Label-based Match                │
│    task.labels → category mapping   │
└─────────────────────────────────────┘
    │ No match

┌─────────────────────────────────────┐
│ 5. Default Fallback                 │
│    → ct-task-executor               │
└─────────────────────────────────────┘

Strategy Details

1. Category Override (Priority 1)

If task has explicit .category field set:
skill_dispatch_by_category("documentation")
# Returns: ct-documentor
Category Mappings (from lib/skill-dispatch.sh):
CategorySkill
orchestrationct-orchestrator
researchct-research-agent
designct-epic-architect
implementationct-task-executor
testingct-test-writer-bats
documentationct-documentor
validationct-validator
specificationct-spec-writer

2. Task Type Match (Priority 2)

From manifest.json dispatch_matrix:
{
  "dispatch_matrix": {
    "by_task_type": {
      "research": "ct-research-agent",
      "planning": "ct-epic-architect",
      "implementation": "ct-task-executor",
      "testing": "ct-test-writer-bats",
      "documentation": "ct-documentor"
    }
  }
}

3. Keyword Pattern Match (Priority 3)

Regex patterns matched against task title + description:
{
  "by_keyword": {
    "epic|plan|decompose|architect": "ct-epic-architect",
    "research|investigate|explore|analyze": "ct-research-agent",
    "test|spec|bats|unit test": "ct-test-writer-bats",
    "document|docs|readme|guide": "ct-documentor",
    "validate|verify|check|audit": "ct-validator"
  }
}

4. Label-based Match (Priority 4)

Task labels mapped to categories:
LabelCategorySkill
researchresearchct-research-agent
epicdesignct-epic-architect
testingtestingct-test-writer-bats
documentationdocumentationct-documentor
bugimplementationct-task-executor

5. Default Fallback

If no match found: ct-task-executor

Usage

Automatic Dispatch

# Get recommended skill for task
cleo orchestrator next --epic T001
# Returns task with recommended skill

# Spawn with auto-selected skill
cleo orchestrator spawn T1234
# Automatically selects skill based on dispatch algorithm

Manual Override

# Force specific skill
cleo orchestrator spawn T1234 --skill ct-research-agent

Debugging

Enable debug output:
export SKILL_DISPATCH_DEBUG=1
cleo orchestrator spawn T1234
Debug output shows:
  • Input task metadata
  • Each strategy attempted
  • Match/no-match result
  • Final skill selected

Exit Codes

CodeMeaning
0Skill selected successfully
1No matching skill (uses default)
4Task not found
6Validation error