/drain
Drain the Ready column autonomously — the overnight workhorse that
loops /work-ticket → /review-pr → agent-merge → post-merge
validation for each safely-classified ticket while you sleep.
When to use it
Use /drain when the Ready column is groomed, every ticket has a
safety:* label, and you want the framework to advance multiple
tickets through the full implementation cycle unattended. The drain
run pre-flights production health, topo-sorts dependencies, filters
by safety class, and works through the queue one ticket at a time.
Each ticket gets its own PR, CI run, reviewer verdict, merge gate,
and production validation before the next ticket starts.
/drain is specifically the merge loop — it moves code from Ready
to Done. For promoting a safety:flagged feature from “dark on
production” to “visible to users,” reach for /goal.
The operator’s machine must stay on and the Claude Code session must stay open (v1 trade-off — remote unattended operation is a future ticket). You make the flag-flip release decision in the morning; drain only ships code, never lifts a feature flag.
Safety classes accepted by default
| Class | Included by default | Flag to include |
|---|---|---|
safety:internal | Yes | (always) |
safety:flagged | Yes | (always) |
safety:reversible | No | --include-reversible |
safety:hot | Never | (drain always refuses) |
How it fits
What it does (quick)
- Pre-flights production health (Sentry baseline + board access +
agent-merge.ymlpresence) - Snapshots the Ready column; topo-sorts by
Depends on:lines; filters by safety class - Emits a plan summary as a comment on the originating drain invocation
- Loops one ticket at a time:
/work-ticket→ CI watch →/review-pr→ bridge dispatch → Render deploy poll → post-deploy validation - Writes state to disk at 9 trigger points so
/drain --resumecan re-enter after an API interruption - Emits an audit comment on each ticket naming the merge commit, deploy ID, and validation result
- Posts a wake-up summary at end of run via
scripts/emit-drain-summary.mjs
Invocation shapes
/drain # process safety:flagged + safety:internal; no end time
/drain --until 06:00 # stop at 6 am if Ready is not empty by then
/drain --include-reversible # opt in to safety:reversible tickets (rate-limited)
/drain --max-tickets 5 # cap the number of tickets processed
/drain --dry-run # emit the plan summary; do not execute
/drain --resume <drainId> # resume an interrupted drain run
/drain --resume # auto-detect the most recent interrupted runRelated commands
/groom-backlog— fills Ready before invoking/drain/work-ticket— the per-ticket workhorse drain calls internally/review-pr— auto-chained from/work-ticketon green CI/goal— picks up from where/drainleaves off; promotes a dark-shipped feature flag to GA
Canonical spec: .claude/commands/drain.md