/dispatch - Intelligent Work Dispatch
Scans project tracks, computes critical path, matches agents to tasks, detects capability gaps, and generates executable multi-agent dispatch plans with parallel wave execution.
System Prompt
EXECUTION DIRECTIVE:
When the user invokes /dispatch, you MUST execute all 5 phases in sequence, then present an interactive dispatch plan. Do NOT ask clarifying questions first — execute immediately.
SKILL REFERENCE: This command is powered by the project-dispatch skill. Load it for detailed methodology:
Read: skills/project-dispatch/SKILL.md
Usage
/dispatch # Full 5-phase pipeline (all incomplete tracks)
/dispatch --track H,J,N # Focus on specific tracks
/dispatch --critical-only # Only dependency-critical items
/dispatch --execute # Generate plan AND launch agents
/dispatch --dry-run # Preview plan without acting (default)
/dispatch --depth shallow # Track-level summaries only
/dispatch --depth deep # Full task-level analysis + gap detection
/dispatch status # Show active dispatch progress
/dispatch --top N # Show top N critical items (default: 10)
/dispatch --json # Output as JSON for programmatic use
Phase 1: SCAN — Track Inventory
Parse all track files to build task inventory.
Data Sources (in order):
# Primary: Pilot track files (active work)
Glob("**/pilot-tracks/TRACK-*.md")
# Secondary: Extension track files
Glob("**/tracks/track-*.md")
# Tertiary: Project status reference
Read: CLAUDE.md (track status table)
Extract per track:
# Regex patterns (reused from /track-status)
complete = re.findall(r'\[x\]|\[✓\]|✅', content, re.IGNORECASE)
pending = re.findall(r'\[ \]', content)
blocked = re.findall(r'(?:blocked by|depends on|awaiting)', content, re.IGNORECASE)
Output structure:
SCAN RESULTS
─────────────────────────────────────────
Track Domain Total Done Pending Blocked
───── ────── ───── ──── ─────── ───────
B Frontend UI 120 101 19 0
C DevOps/Infra 85 69 16 0
F Documentation 60 24 36 0
H Framework 180 101 79 3
J Memory 45 30 15 2
K Workflow 0 0 0 0
L Extended Testing 0 0 0 0
M Extended Security 0 0 0 0
N GTM/Launch 65 40 25 0
─────────────────────────────────────────
TOTAL 555 365 190 5
Filter behavior:
--track H,J,N→ Only scan those tracks--critical-only→ Skip tracks with 0% (K, L, M)- Default → All incomplete tracks
Phase 2: CRITICAL PATH — Dependency Analysis
Compute which pending tasks unblock the most downstream work.
Dependency Detection:
# Search track files for dependency patterns (reused from dependency-resolver.py)
Grep: "depends on|blocked by|prerequisite|requires|after|needs|awaiting"
in pilot-tracks/TRACK-*.md
Scoring Algorithm:
critical_score = (
downstream_unblock_count * 30 # How many tasks this unblocks
+ inverse_deadline_days * 25 # Closer to deadline = higher score
+ track_priority_weight * 20 # H(critical) > F(nice-to-have)
+ task_depth_penalty * -5 # Deeply nested = lower priority
+ momentum_bonus * 20 # Recent commits in this area = bonus
)
Track Priority Weights (from CLAUDE.md critical path):
H (Framework) = 1.0 # Critical path
J (Memory) = 0.9 # Critical path
N (GTM/Launch) = 0.85 # Deadline-driven
C (DevOps) = 0.7 # Near complete
B (Frontend) = 0.7 # Near complete
F (Docs) = 0.5 # Important but not blocking
K,L,M = 0.3 # Planned, not started
Output: Ordered list of tasks by critical_score (descending).
Phase 3: AGENT MATCH — Capability Mapping
For each critical-path task, find the best agent.
Step 3a: Track Ownership Lookup
# Primary agent from CLAUDE.md track ownership table
track_agents = {
'B': 'frontend-react-typescript-expert',
'C': 'devops-engineer',
'F': 'codi-documentation-writer',
'H': 'senior-architect',
'J': 'senior-architect',
'K': 'devops-engineer',
'L': 'testing-specialist',
'M': 'security-specialist',
'N': 'senior-architect',
}
Step 3b: Capability Verification (reuses /which logic)
# Query platform.db for agent capabilities
source ~/.coditect/.venv/bin/activate
python3 scripts/component-indexer.py --search "{task_description}"
Step 3c: Tool Verification Verify the matched agent has required tools for the task type:
- Backend tasks → needs Bash, Read, Write, Edit
- Security tasks → needs Grep, Bash, Read
- Doc tasks → needs Read, Write, Edit, Glob
Output per task:
Task: H.12.1 - Command scope audit
├─ Primary: senior-architect (score: 95, tools: ✅)
├─ Secondary: code-reviewer (score: 78, tools: ✅)
└─ Match: STRONG
Phase 4: GAP DETECT — Missing Capabilities
Identify tasks that can't be matched to agents.
Gap Categories:
| Category | Detection | Action |
|---|---|---|
| No Agent Match | Score < 70% for all agents | Flag for manual assignment |
| No Tasks Defined | Track at 0% with no [ ] markers | Flag track needs task definition |
| Missing Skill | Task needs capability no skill provides | Recommend /component-create skill |
| Infrastructure Blocker | External dependency not met | Flag as hard blocker |
| Circular Dependency | Task A blocks B blocks A | Flag for manual resolution |
Output:
GAPS DETECTED (3)
──────────────────────────────────────
⚠ K.* (Workflow Automation): 0% — No tasks defined. Action: Define tasks first.
⚠ L.* (Extended Testing): 0% — No tasks defined. Action: Define tasks first.
⚠ M.* (Extended Security): 0% — No tasks defined. Action: Define tasks first.
Phase 5: DISPATCH PLAN — Wave Execution
Group matched tasks into parallel execution waves based on dependency DAG.
Wave Planning (reuses orchestrating-agents skill):
# Topological sort into generations (waves)
# Tasks with no unmet dependencies → Wave 1
# Tasks depending on Wave 1 → Wave 2
# etc.
Plan Output:
┌──────────────────────────────────────────────────────────────┐
│ DISPATCH PLAN 2026-02-07 22:15Z │
│ Scope: PILOT (8 incomplete tracks) Deadline: Mar 11 │
├──────────────────────────────────────────────────────────────┤
│ │
│ CRITICAL PATH (Top 5) │
│ ───────────────────── │
│ #1 H.12.1 Command scope audit → senior-architect │
│ ├─ Unblocks: J.7.1, J.7.2, J.7.3, H.12.3-H.12.5 │
│ └─ Score: 95 | Wave 1 │
│ │
│ #2 J.1.1 Memory context patterns → senior-architect │
│ ├─ Unblocks: J.1.2, J.1.3, J.2.* │
│ └─ Score: 92 | Wave 1 │
│ │
│ #3 N.2.1 Launch checklist → senior-architect │
│ ├─ Deadline: Mar 11 (32 days) │
│ └─ Score: 88 | Wave 1 │
│ │
│ EXECUTION WAVES │
│ ─────────────── │
│ Wave 1 (parallel): H.12.1 + J.1.1 + N.2.1 [3 agents] │
│ Wave 2 (after W1): H.12.3 + J.7.1 + F.3.1 [3 agents] │
│ Wave 3 (after W2): J.7.2 + B.5.1 + N.2.3 [3 agents] │
│ │
│ GAPS │
│ ──── │
│ 3 tracks need task definitions (K, L, M) │
│ │
│ SUMMARY │
│ ─────── │
│ Scanned: 555 tasks | Critical: 12 | Matched: 12/12 │
│ Agents: 5 unique | Waves: 3 | Parallelism: 3x │
│ │
├──────────────────────────────────────────────────────────────┤
│ [1] Execute Wave 1 now │
│ [2] Show full task details for all waves │
│ [3] Export dispatch plan as JSON │
│ [4] Adjust scope (add/remove tracks) │
└──────────────────────────────────────────────────────────────┘
Interactive Selection:
- [1] Execute Wave 1: Launch parallel
Task()calls for each task in Wave 1 - [2] Full details: Expand all waves with agent invocation templates
- [3] JSON export: Machine-readable dispatch plan
- [4] Adjust: Re-run with modified
--trackfilter
Execution (--execute flag)
When --execute is used or user selects [1]:
# Wave 1 — parallel dispatch
Task(subagent_type="senior-architect", prompt="H.12.1: Command scope audit. ...")
Task(subagent_type="senior-architect", prompt="J.1.1: Memory context patterns. ...")
Task(subagent_type="senior-architect", prompt="N.2.1: Launch checklist. ...")
# Wait for Wave 1 completion, then Wave 2
# Each agent includes task ID prefix per ADR-054
Examples
# Quick check: what's the critical path?
/dispatch --critical-only --depth shallow
# Focus on framework and memory (highest priority)
/dispatch --track H,J
# Full analysis with gap detection
/dispatch --depth deep
# Generate and execute immediately
/dispatch --track H --execute
# Export for external tools
/dispatch --json > dispatch-plan.json
Related Commands & Skills
| Component | Role in Pipeline |
|---|---|
/track-status | Phase 1 data source (track scanning) |
/which | Phase 3 agent matching |
/next-task | Simpler single-task version |
/work-next | Read-only discovery (no dispatch) |
/orient | Session context loading |
project-dispatch skill | Core pipeline logic |
critical-path skill | Dependency chain analysis |
orchestrating-agents skill | Wave execution patterns |
moe-task-execution skill | Agent invocation templates |
dependency-resolver.py | DAG builder and topological sort |
Success Output
DISPATCH COMPLETE: /dispatch
─────────────────────────────
Tracks scanned: 8
Tasks analyzed: 555
Critical path items: 12
Agent matches: 12/12 (100%)
Gaps detected: 3
Waves planned: 3
Mode: dry-run (use --execute to launch)
Completion Checklist
- All track files parsed successfully
- Dependency graph computed without cycles
- Agent matching returned results for all critical tasks
- Gap detection completed
- Dispatch plan generated with waves
- Output rendered in structured format
Failure Indicators
- Track files not found (check pilot-tracks/ directory)
- platform.db unavailable (run component-indexer.py first)
- Circular dependency detected (flag for manual resolution)
- No agents matched for critical task (score < 70%)
When NOT to Use
- Single known task: Use
/next-taskinstead - Just want status: Use
/track-statusinstead - Exploring what exists: Use
/work-nextinstead - Need session context: Use
/orientfirst
Anti-Patterns
| Anti-Pattern | Problem | Solution |
|---|---|---|
| Skip Phase 2 | Miss critical dependencies | Always compute critical path |
| Ignore gaps | Tasks fall through cracks | Address gaps before executing |
| Execute without review | Wrong agents dispatched | Default to --dry-run |
| Single-track tunnel vision | Miss cross-track blockers | Scan all tracks first |
Principles
This command embodies:
- #3 Complete Execution — Full pipeline from scan to dispatch plan
- #6 Clear, Understandable — Structured output with scoring
- #9 Based on Facts — Queries real data, not assumptions
- #10 Recycle, Extend, Reuse — Composes 6 existing components
Full Standard: CODITECT-STANDARD-AUTOMATION.md
Version: 1.0.0 Created: 2026-02-07 Author: CODITECT Team