Dispatch
Claim the next highest-priority issue and preview the dispatch queue using the loop CLI.
Dispatch
The dispatch commands let you claim the next issue for work and preview the priority-ordered work queue. The dispatch queue ranks issues by a composite score that considers priority, goal alignment, age, and issue type.
loop next
Claim the highest-priority unblocked issue and receive dispatch instructions. This is the primary command agents use to get work. It sets the issue status to in_progress and returns the issue with its rendered prompt template.
loop next [options]Options
| Flag | Default | Description |
|---|---|---|
--project <id> | none | Filter by project ID |
Examples
Claim the next issue:
loop nextFilter by project:
loop next --project clx1abc2def3ghi4jkl5mnopGet as JSON for agent automation:
loop next --jsonSample output
#42 [task] Fix login timeout
Status: in_progress
Priority: high
ID: clx1abc2def3ghi4jkl5mnop
Template:
Slug: fix-bug
Version: 3
Instructions:
────────────────────────────────────────────────────────────
You are working on issue #42: Fix login timeout.
...
────────────────────────────────────────────────────────────When the queue is empty:
No issues ready for dispatch.loop dispatch queue
Preview the dispatch queue without claiming any issues. Shows the highest-scored unblocked issues ready for work.
loop dispatch queue [options]Options
| Flag | Default | Description |
|---|---|---|
--project <id> | none | Filter by project ID |
--limit <n> | 10 | Maximum items to show |
Examples
Preview the queue:
loop dispatch queueFilter by project:
loop dispatch queue --project clx1abc2def3ghi4jkl5mnopShow top 5 items as JSON:
loop dispatch queue --limit 5 --jsonSample output
┌──────┬──────┬───────────┬──────────────────────────────┬────────┬───────┬───────────────────────────────┐
│ RANK │ # │ TYPE │ TITLE │ PRI │ SCORE │ BREAKDOWN │
├──────┼──────┼───────────┼──────────────────────────────┼────────┼───────┼───────────────────────────────┤
│ 1 │ 40 │ plan │ Migrate user service to v2 │ urgent │ 118 │ pri:75 + goal:20 + age:3 + … │
│ 2 │ 42 │ task │ Fix login timeout │ high │ 95 │ pri:50 + goal:20 + age:5 + … │
│ 3 │ 39 │ hypo │ Cache warming reduces latency │ medium │ 68 │ pri:25 + goal:20 + age:3 + … │
└──────┴──────┴───────────┴──────────────────────────────┴────────┴───────┴───────────────────────────────┘
Showing 3 of 3 queued issuesScore breakdown
Each issue in the queue has a composite score made up of:
| Component | Description |
|---|---|
pri | Weight based on priority level (urgent=75, high=50, medium=25, low=10) |
goal | Bonus when the issue is linked to a project with an active goal |
age | Bonus that increases as the issue ages, preventing starvation |
type | Bonus based on issue type (plans and tasks score higher) |
Typical dispatch workflow
# 1. Preview what is next in the queue
loop dispatch queue
# 2. Inspect the top issue for more detail
loop issues view clx1abc2def3ghi4jkl5mnop
# 3. Claim the next issue (with prompt instructions)
loop next
# 4. After completing work, mark it done
loop issues done clx1abc2def3ghi4jkl5mnop --outcome "Fixed in PR #47"
# 5. Check system status
loop dashboardAgent usage
Agents can use next in automation scripts:
# Claim the next issue and get the prompt as JSON
RESULT=$(loop next --json)
ISSUE_ID=$(echo "$RESULT" | jq -r '.issue.id')
PROMPT=$(echo "$RESULT" | jq -r '.prompt')
# Execute work based on the prompt...
# Report completion
loop issues done "$ISSUE_ID" --outcome "Task completed successfully"