Overnight Pr Routine Loop

A nightly routine that watches your open PRs, auto-fixes build failures, answers review comments in a fresh worktree, and rebases stale branches while you sleep.

WorkflowoperationsMIT1 source files

Before you use this component

This is a third-party source bundle, not an installation into your account. UI Discovery has checked the available redistribution license evidence; runtime behavior has not been tested. Review all files, use a disposable project first, and do not enable scripts or hooks until you understand their permissions.

Some integrations require separately installed software, API keys or paid services. Credentials and subscriptions are not included. These are Claude Code resources; other clients may require adaptation.

Extract the ZIP into a temporary folder, inspect its entry file and supporting resources, then follow the original instructions. Do not overwrite an existing project configuration blindly. Keep the bundled license and attribution notices.

Source publisher
Claude Code Templates
Creator supplied by source
Not listed in source
Pinned source version
a344359459263d73d8948651c789244093c02e4e
License evidence
LICENSE

Source preview

cli-tool/components/loops/operations/overnight-pr-routine-loop.md

---
name: overnight-pr-routine-loop
description: A nightly routine that watches your open PRs, auto-fixes build failures, answers review comments in a fresh worktree, and rebases stale branches while you sleep.
category: operations
interval: daily
stop-condition: Every fixable PR is green and updated; anything ambiguous is left flagged for human review.
components: [command:git-workflow/worktree-init, command:git-workflow/create-pr, agent:git/git-workflow-manager, hook:automation/slack-notifications]
tags: [schedule, pull-requests, automation, loop]
---

# Overnight PR Routine

> **Loop Engineering** — the `/schedule` verb runs a routine *while you are gone*. This is the "I don't write code, I write loops, and they write the code while I sleep" pattern: a scheduled routine that lands the fixable PRs overnight.

## 🎯 Goal
Each night, work the open-PR queue: auto-fix build failures, answer review comments in an isolated worktree, rebase stale branches — and leave anything ambiguous for a human in the morning.

## ⏱️ Schedule
Trigger: `daily` (overnight routine, runs while your laptop is closed).

## ▶️ Run it
```
/schedule every night, watch my open PRs. For each: auto-fix build failures, answer review comments in a fresh worktree, and rebase what is stale. Leave anything ambiguous or product-sensitive for me. Keep state in git so a crash loses nothing. Post a morning summary.
```

## 🔁 Iteration steps
1. **Perceive** — list open PRs and their CI/review state.
2. **Isolate** — spin a fresh worktree per PR with `/worktree-init` (no cross-contamination).
3. **Act** — `git-workflow-manager` fixes build failures, addresses review comments, rebases stale branches.
4. **Verify** — re-run CI; push only when green; ambiguous items are flagged, never guessed.
5. **Report** — post a morning summary via `slack-notifications`; update each PR with `/create-pr`.

## 🛑 Stopping condition
Every fixable PR is green and updated; ambiguous/product-sensitive items are flagged for human review (not auto-merged).

## 💰 Budget & guardrails
A nightly spend ceiling; never auto-merges; isolated worktrees so parallel fixes don't collide; state in git so a crash is recoverable.

## 🧩 Referenced components
- `command:git-workflow/worktree-init` — isolated workspace per PR.
- `command:git-workflow/create-pr` — updates/opens PRs.
- `agent:git/git-workflow-manager` — safe rebases, fixes and comment replies.
- `hook:automation/slack-notifications` — the morning summary.

## 💡 Example
You wake up to three PRs rebased and green, two review comments answered with commits, and one PR flagged "needs a product decision" — exactly the one you should look at.

Preview capped at 60,000 characters. Download the bundle for every original file and notice.

Read the redistribution license
MIT License

Copyright (c) 2025 Daniel (San) Ávila

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Bundle SHA-256: 29210070d9ed7bc44b6b814c35fb87c102305b937338b1b00c8df06afb8b16be. Files are served as downloads and are never executed by this page.