How /babysit Works
Save to .claude/commands/babysit.md:
---
description: Watch a PR for review comments and auto-respond/fix
argument-hint: [PR number] [--poll <minutes>] [--no-push]
---
You will monitor a PR and respond to review comments. Loop until merged or cancelled.
1. Identify target PR:
- $ARGUMENTS first token if numeric, else use `gh pr view --json number -q .number`.
- Stop if not on a branch with an open PR.
2. Poll interval (default 5 minutes):
- Read `--poll N` from $ARGUMENTS, else default 5.
- Cap minimum at 2 minutes (rate-limit friendly).
3. Each tick:
- `gh pr view <num> --json reviews,comments,reviewDecision,merged`.
- If `merged: true`, stop. If `reviewDecision: APPROVED` and no unresolved comments, stop.
- For each new review/comment since the last tick, classify:
| Class | Examples | Action |
|---|---|---|
| code-fix | "rename foo to bar", "add a null check on line 42", "missing test" | Edit, commit, push |
| reply | "Why did you choose X?", "Can you explain Y?" | Post a `gh pr comment` reply with code reference |
| escalate | "I think we should rearchitect this", "this has security implications" | Post "Tagging @<user> — needs human input" + stop the loop |
| non-actionable | "Nice!", "LGTM after this", reactions | Skip |
4. After any code-fix:
- Re-run the project's pre-commit checks (lint + typecheck).
- Commit with message `fix(review): <comment summary>` (NEVER amend).
- Push to the PR branch.
- Reply on the comment thread: "Fixed in <new_sha>."
5. Output a one-line status each tick: `tick N — <action> — next: <ISO>`.
## Boundaries
- Never amend a previously published commit.
- Never push to main/master.
- Never resolve a review thread without code-fix or human reply.
- Hard cap: 24 hours. After that, escalate and stop.
- If `--no-push` is passed, only post replies — never commit/push.
- Stop the loop AND notify on any escalate-class comment.Example session
You: "/babysit 482"
Claude: -> tick 1: 0 new comments, sleep 5min
-> tick 2: 1 new comment "rename `tmpUsers` to `activeUsers`"
Class: code-fix
Edited src/admin/audit.ts, ran lint+typecheck, pushed a3b4c5d
Replied: "Fixed in a3b4c5d."
-> tick 3: 1 new comment "Why are we storing the full event payload?"
Class: reply
Posted: "Storing full payload because compliance requires retroactive
query support for 90 days; see src/audit/schema.ts:18 comment."
-> tick 8: review approved, 0 unresolved -> stopping.Escalation case:
-> tick 5: 1 new comment "I think we should split this into two PRs"
Class: escalate
Posted: "Tagging @williamwang — needs human input on PR scope."
Stopping loop.FAQ
Q: Will it amend my commits?
A: Never. Each fix is a new commit (fix(review): ...). Amending published commits loses history.
Q: Will it merge the PR? A: No — never auto-merges. Stops when approved or cancelled, lets you press merge.
Q: What's the cap? A: 24 hours per /babysit invocation. Long PRs need re-invocation.
Q: Does it handle non-English review comments? A: Yes — Claude classifies regardless of language. The reply will match the comment's language.
Q: Is this Boris's actual /babysit? A: No — community-written equivalent. The pattern is from his public description.