Boris Cherny uses /loop 5m /babysit-prs to handle PR management without manual attention. This workflow automates the tedious parts of maintaining a PR queue.
A PR that’s open but stale has a cost:
“Babysitting” means continuously monitoring and advancing PRs through their lifecycle — resolving CI failures, addressing review comments, rebasing, and merging when ready.
/babysit-prs Command<!-- .claude/commands/babysit-prs.md -->
# Babysit PRs — Monitor and Advance Open PRs
Check all open PRs and take appropriate action for each.
## Fetch Open PRs
```bash
gh pr list --state open --json number,title,statusCheckRollup,reviewDecision,mergeable,updatedAt
gh pr checks [number]gh pr review [number] --commentsgh pr review [number] --request-reviewgh pr view [number] --json mergeablegh pr merge [number] --squash --autoAfter processing all PRs, output a summary:
/loop Setup# Run babysit-prs every 5 minutes
/loop 5m /babysit-prs
# Run every 30 minutes during business hours
/loop 30m /babysit-prs
# Run once (manual)
/babysit-prs
Before setting up automated PR merging, add safeguards:
<!-- Add to babysit-prs.md -->
## Safety Rules (NEVER violate these)
- NEVER merge to main without at least 1 human approval
- NEVER merge if there are unresolved review threads
- NEVER force-push to shared branches
- NEVER merge PRs tagged with "do-not-merge" or "WIP"
- NEVER merge if the PR author explicitly said "don't merge yet"
- ALWAYS check that CI passes completely (not just required checks)
If any safety rule would be violated: skip the PR and add it to "needs human attention" report.
Add this to your session start or as a scheduled check:
# .claude/commands/pr-dashboard.md
# Show PR queue health
Generate a PR health dashboard:
```bash
gh pr list --state open --json number,title,author,createdAt,reviewDecision,statusCheckRollup,mergeable
Format as a table: | PR | Title | Age | Status | CI | Action Needed | |—|—|—|—|—|—| [populate from data]
Color coding (text):
Add a hook to notify you when babysit-prs takes significant action:
#!/bin/bash
# hooks/pr-notification.sh
# Called after babysit-prs completes
RESULT=$(cat)
MERGED=$(echo "$RESULT" | grep "Merged:" | wc -l)
NEEDS_HUMAN=$(echo "$RESULT" | grep "needs human attention" | wc -l)
if [ $MERGED -gt 0 ] || [ $NEEDS_HUMAN -gt 0 ]; then
# macOS notification
osascript -e "display notification \"$MERGED merged, $NEEDS_HUMAN need attention\" with title \"PR Babysitter\"" 2>/dev/null
# Slack notification
[ -n "$SLACK_WEBHOOK" ] && curl -s -X POST "$SLACK_WEBHOOK" \
-d "{\"text\":\"PR Update: $MERGED merged, $NEEDS_HUMAN need your attention\"}" 2>/dev/null
fi