AI-powered PR babysitter — automatically fixes merge conflicts, failing CI, and unresolved review comments using Claude Code
AI-powered PR babysitter that runs locally on your Mac. Automatically fixes merge conflicts, failing CI, and unresolved review comments using Claude Code.
Runs every 5 minutes via macOS launchd. No GitHub Actions minutes burned — uses your own Claude tokens.
- Scans your open PRs on GitHub
- For each PR with issues (merge conflicts, failing checks, unresolved reviews):
- Clones the repo into a temp directory
- Invokes Claude Code CLI to diagnose and fix the issues
- Runs your project's verify/test/lint commands before pushing
- Pushes fixes and resolves review threads
- Tracks attempts via GitHub labels (
babysitter-attempt-N) - Gives up after 10 attempts (
babysitter-gave-uplabel)
- macOS (uses launchd for scheduling)
- Claude Code CLI installed and authenticated
- GitHub CLI (
gh) installed and authenticated jqinstalled (brew install jq)
Review SECURITY.md before starting unattended automation. It covers the trust model, required GitHub token permissions, log sensitivity, and revocation steps.
git clone https://github.com/mstuart/pr-babysitter.git
cd pr-babysitter
./install.shThis copies babysitter and pr-babysitter.sh to ~/.local/bin/.
Update later with git pull --ff-only && ./install.sh. Uninstall with ./install.sh --uninstall after stopping the agent with babysitter stop.
cd /path/to/your/repo
babysitter init # creates .babysitterrc
# edit .babysitterrc with your repo and username
babysitter doctor # read-only preflight check
babysitter start # starts the launchd agentPlace a .babysitterrc in your repo root. See .babysitterrc.example for all options.
Required settings:
BABYSITTER_REPO="owner/repo" # GitHub repo
BABYSITTER_AUTHOR="your-username" # Only watch your PRsOptional settings:
BABYSITTER_MAX_ATTEMPTS=10 # Give up after N attempts
BABYSITTER_MODEL=sonnet # Claude model
BABYSITTER_INTERVAL=300 # Seconds between runsCommand examples. Keep these non-interactive and avoid destructive operations such as deploys, seeds, database resets, package publishing, git push, git reset, or starting long-running services.
# npm
BABYSITTER_INSTALL_CMD="npm ci --prefer-offline --no-audit --no-fund"
BABYSITTER_VERIFY_CMD="npm run verify"
BABYSITTER_TEST_CMD="npm test -- --runInBand"
BABYSITTER_LINT_CMD="npm run lint:fix"
# pnpm
BABYSITTER_INSTALL_CMD="pnpm install --frozen-lockfile --ignore-scripts"
BABYSITTER_VERIFY_CMD="pnpm verify"
BABYSITTER_TEST_CMD="pnpm test -- --runInBand"
BABYSITTER_LINT_CMD="pnpm lint:fix"
# Turborepo
BABYSITTER_INSTALL_CMD="pnpm install --frozen-lockfile --ignore-scripts"
BABYSITTER_VERIFY_CMD="pnpm turbo run typecheck build --filter=...[HEAD^]"
BABYSITTER_TEST_CMD="pnpm turbo run test --filter=...[HEAD^]"
BABYSITTER_LINT_CMD="pnpm turbo run lint --filter=...[HEAD^]"
# Python
BABYSITTER_INSTALL_CMD="python -m pip install -r requirements.txt"
BABYSITTER_VERIFY_CMD="python -m compileall ."
BABYSITTER_TEST_CMD="python -m pytest"
BABYSITTER_LINT_CMD="python -m ruff check --fix ."For full control over what Claude does, point to a prompt template file:
BABYSITTER_PROMPT_FILE=".babysitter-prompt.txt"The file supports variable substitution via envsubst: $REPO, $NUMBER, $TITLE, $ATTEMPT, $MAX, $MERGEABLE, $FAILING, $UNRESOLVED, $VERIFY_CMD, $TEST_CMD, $LINT_CMD.
Or append extra rules to the default prompt:
BABYSITTER_EXTRA_RULES="- This is a monorepo with Turborepo
- NEVER run 'npm run seed' (destroys all data)"Config is loaded from the first match:
$BABYSITTER_CONFIGenv var (explicit path).babysitterrc(walking up from cwd to/)~/.config/pr-babysitter/config
When babysitter start creates the launchd plist, it records the resolved config path in BABYSITTER_CONFIG so unattended runs use the same file checked by the CLI.
babysitter <command>
COMMANDS
init Create a .babysitterrc config in the current directory
doctor Check config, auth, dependencies, and command safety without starting automation
start Load and start the launchd agent
stop Unload and stop the launchd agent
status Show agent status and current PR overview
dashboard Live-updating dashboard (refreshes every 30s)
run Run one babysitter cycle immediately (foreground)
logs Tail the babysitter log
logs clear Clear the log file
reset <pr> Remove all babysitter labels from a PR
reset-all Remove all babysitter labels from all open PRs
version Print version
babysitter dashboard # refreshes every 30s
babysitter dashboard 10 # refreshes every 10sShows: agent status, each PR's health (conflicts, failing checks, unresolved threads), attempt counts, and recent log activity.
| Issue | How |
|---|---|
| Merge conflicts | git merge origin/main + AI conflict resolution |
| TypeScript errors | Runs verify command, fixes reported errors |
| Test failures | Runs test command, fixes failing tests |
| Lint errors | Runs lint command with auto-fix |
| Review comments | Reads unresolved threads, makes requested code changes, resolves threads |
The babysitter will not:
- Force-push
- Guess at answers to discussion questions in reviews
- Push code that fails verification
- Touch PRs by other authors
| Label | Meaning |
|---|---|
babysitter-attempt-N |
The babysitter has made N fix attempts on this PR |
babysitter-gave-up |
Exceeded max attempts — babysitter will no longer touch this PR |
Use babysitter reset <pr-number> to clear labels and let it try again.
MIT