Drain Tickets
Orchestrate a queue of ready-for-agent tickets through do-work. One fresh subagent per ticket. You choose the plan; workers execute.
1. Resolve queue
Parse the invocation:
| Input | Queue |
|---|---|
Issue numbers (e.g. #3 #4 #5) |
Those tickets, in ascending number order |
Bare /drain-tickets |
Every open eligible ready-for-agent ticket (same eligibility as do-work), ascending |
List each ticket: number, title, one-line complexity guess (high / normal).
If the queue is empty: say so and stop.
Done when: the ordered queue is fixed and shown to the user, or the run stopped on an empty queue.
2. Confirm plan
Stop and ask before any claim, branch, worktree, or subagent. Require an explicit choice on both axes:
| Axis | Options |
|---|---|
| schedule | parallel (worktrees, fan-out) · sequential (one ticket at a time) |
| pr-shape | batch (one shared branch → one draft PR after the queue) · each (draft PR per ticket as do-work normally does) |
If the user already stated both axes, echo the plan back and still wait for confirmation.
Show the matrix consequence in one line, e.g. parallel + batch → worktrees, merge, deferred playwright, one PR.
Done when: the user has confirmed schedule and pr-shape.
3. Drain
Read worker-brief.md once, then run the confirmed plan.
Shared rules (every plan):
- Fresh subagent per ticket — never reuse a worker context.
- Model:
cursor-grok-4.5-highwhen complexity ishigh;composer-2.5whennormal. - Worker runs
do-workfor exactly that ticket, under the overrides in the brief for thispr-shape. - On worker
HITL/ refuse: record it, continue the rest of the queue; do not silent-skip.
sequential + each
Loop: next ticket → spawn worker → await → next. Stop when the queue is exhausted.
sequential + batch
Create one integration branch from the default base. Loop: spawn worker on that branch with batch overrides → await → next. After the loop, go to Finalize.
parallel + each
For every ticket, create a worktree + branch, spawn workers together, await all. Each worker opens its own draft PR.
parallel + batch
Create one integration branch from the default base. For every ticket, create a worktree on issue-<n>-<slug>, spawn workers together, await all. Merge each worktree branch into the integration branch (ascending issue order). Then Finalize.
Done when: every queue ticket has a terminal worker outcome (implemented, HITL, or refused), and for batch the integration branch holds every successful implement.
4. Finalize
each
Summarize: PR URLs, HITL / refused tickets, worktrees removed. Stop.
batch
- One deferred playwright / frontend-artifact round on the integration branch for every UI-touching ticket that succeeded (see
do-workartifacts). - Open one draft PR:
Closes #Nfor every successful ticket; attach artifact evidence. - Clear
WIPon those successful tickets. - Remove worktrees. Summarize successes,
HITL/ refused, and the PR URL.
Done when: required PR(s) exist for the confirmed pr-shape, WIP is cleared on tickets the PRs close, worktrees are gone, and the summary is reported.