overnight-agent-runbook
Skill2 starsChanged 3 months agoMITView on GitHub
Run implementation work unattended/overnight with a review-driven PR loop. The agent picks one reviewable slice, owns its branch through local verification and agnostic code review, may use a local integration train for preflight, never merges to main, and reports a structured closeout. Replaces the retired kanban/dispatcher/polling model. Use when prompting an agent to work autonomously against a task queue or implementation plan.
In this repository40 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- agent-workflow-modernizerSkill
- architecture-reviewSkill
- code-structureSkill
- diagnoseSkill
- engineering-quality-lensSkill
- implementation-plan-builderSkill
- implementation-plan-wikiSkill
- overnight-setupSkill
- prd-to-task-queueSkill
- pr-review-loopSkill
- stacked-pr-orchestratorSkill
- tddSkill
- agent-workflow-modernizerSkill
- architecture-reviewSkill
- code-structureSkill
- diagnoseSkill
- engineering-quality-lensSkill
- implementation-plan-builderSkill
- implementation-plan-wikiSkill
- overnight-agent-runbookSkill
- overnight-setupSkill
- prd-to-task-queueSkill
- pr-review-loopSkill
- stacked-pr-orchestratorSkill
- tddSkill
- agent-workflow-modernizerSkill
- architecture-reviewSkill
- code-structureSkill
- diagnoseSkill
- engineering-quality-lensSkill
- implementation-plan-builderSkill
- implementation-plan-wikiSkill
- overnight-agent-runbookSkill
- overnight-setupSkill
- prd-to-task-queueSkill
- pr-review-loopSkill
- stacked-pr-orchestratorSkill
- tddSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
52 rules. About 0 are common, 36 are distinctive, and 16 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈36
Distinctive · estimate
This author's own choices. Worth a look.
16
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 30
When porting to another repo, copy template/ (see "Porting").
- Distinctive: line 34
Do not use this runbook as the default loop for ordinary human-steered Conductor or local-agent work.
- Distinctive: line 48
Treat cloud sessions as disposable Linux workers.
- Distinctive: line 64
Prefer cloud sessions for docs, tests, pure source changes, refactors, and reviews.
- Distinctive: line 71
Prefer AGENTS.md as the shared cross-harness contract for Codex, Claude Code, Cursor Agent, OpenCode, and other coding agents.
- Distinctive: line 74
Treat both files as reviewed onboarding code, not as append-only chat memory dumps.
- Distinctive: line 80
Use the right instruction surface:
- Very specific: line 115
Before coding, decide the shape — it depends on the size of the feature and the blast radius of the change, not a line count.
- Distinctive: line 119
One PR: when a single reviewer can hold it in their head and it has one verifiable final state.
- Distinctive: line 121
A stack of PRs: when there is a natural sequence (contract → behavior → UI) or later pieces depend on earlier ones landing.
- Distinctive: line 123
Parallel PRs: when pieces are genuinely independent (no shared files).
- Distinctive: line 124
Local integration train: when hosted CI latency is slowing a compatible multi-worktree wave.
- Distinctive: line 136
If none is launch-ready, switch to readiness-prep mode: author the missing per-slice brief / Writes / Verify surface for the next best …
- Very specific: line 149
Do not make a single chat transcript the durable state of an overnight run.
- Distinctive: line 153
After each slice is green/clean and pushed, close that slice with a compact closeout and start the next slice from live repo/PR state.
- Distinctive: line 223
Repeat 2–5 until the exit condition: no unresolved actionable comments, required checks pass, and the PR has the approvals its policy …
- Very specific: line 227
Code-structure gate: If the work moved shared operational mechanics between actions and services, run code-structure before reporting.
- Distinctive: line 230
Close or advance the slice: If the PR targets main/the protected base, leave it draft/ready for a human.
- Distinctive: line 240
Use a local integration train when a multi-worktree wave is slow because compatible branches are waiting behind hosted CI or review queues.
- Distinctive: line 248
Create a local integration branch from the recorded root parent and keep it local unless the manifest explicitly promotes it to a pushed …
- Distinctive: line 255
Run the combined local suite and record the result as diagnostic evidence.
- Distinctive: line 256
Start a dependent from the train only when it is explicitly marked speculative.
- Distinctive: line 264
Stop the loop (don't guess) when the exit condition is met, when a comment is a blocker needing a human-gated decision/action (record it …
- Very specific: line 283
Use one persistence loop only.
- Distinctive: line 297
Write every Goal as the same contract (the structure behind the prompt library and the six-field standard below):
- Very specific: line 343
Read TASK_QUEUE.md (status/owner/priority).
- Distinctive: line 349
Prefer the highest-priority row that pulls toward a named product outcome and can land as one clean review.
- Very specific: line 352
1 row: when it touches central API/authz/persistence/infra/migrations, shared types, layout/navigation, or needs provider approval.
- Distinctive: line 354
2–5 rows: when they form one feature slice with one validation surface.
- Very specific: line 355
6–10 rows: only when mostly docs/tests/runbooks or tightly coupled under one integration branch.
- Distinctive: line 357
If more than ~3 high-risk shared files would be touched, or ownership is unclear, stop and split (write a slice plan) instead of starting.
- Very specific: line 362
If no row is launch-ready, do not treat "missing OVERNIGHT_* brief", missing Writes, or missing Verify as a terminal blocker by itself.
- Very specific: line 374
If the row needs durable queue backfill, update only that row's Notes with the brief path and any Writes: / Verify: entries the plan …
- Distinctive: line 376
Commit and push the readiness-prep change, open/update a draft PR if useful, and run the review loop.
- Distinctive: line 378
If the brief resolves readiness, proceed into implementation in the same autonomy run.
- Distinctive: line 385
Only stop for "no ready work" after both direct implementation and readiness-prep paths have been exhausted.
- Distinctive: line 390
Keep coordination lightweight.
- Very specific: line 398
Do not create handoff prompts or separate workspace status files for routine reporting.
- Distinctive: line 403
Every worker branch has a recorded parent branch: the branch/ref the worker branched from and the branch/ref the slice must return to when …
- Distinctive: line 409
Before creating a worker branch:
- Distinctive: line 420
After the worker branch is review-clean and validation-green:
- Very specific: line 428
If the recorded parent is main, origin/main, or any protected base, do not integrate it yourself.
- Distinctive: line 431
Start the next dependent worker from the freshly updated parent branch, not from the stale pre-integration parent or from main.
- Very specific: line 438
CodeRabbit CLI: when available: cr --agent --base <base> (or cr --plain).
- Distinctive: line 484
Leave the branch in a clean, reviewable state (commit or stash intentionally.
- Distinctive: line 486
If another independent ready or readiness-prep slice exists (no shared files, no dependency on the blocked one), move to it.
- Distinctive: line 492
Every slice's final report includes:
- Very specific: line 519
Add project-specific prompts to template/prompts/ as new situations recur, and list them here.
- Very specific: line 527
If the target repo also uses Claude Code, copy the same skill folder into .claude/skills/.
- Distinctive: line 536
Keep the root instruction file under review.
- Very specific: line 539
Use template/goal-prompt.md to write overnight prompts.
- Distinctive: line 544
Do not carry over deployment URLs, credentials, product-only branch names, stale queue rows, local worktree paths, or any retired …
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Overnight Agent Runbook
This is the operating model for running implementation work unattended (overnight, or any time without a human in the loop), built on top of code review instead of a coordination board.
The driver is the source head and its review evidence. The earlier model used
a kanban board plus a dispatcher loop and polling daemons (branch-kanban/,
auto-dispatch-loop.mjs, generated board data, required .context/agent-status.md
status files). That is retired. Do not restore it, and do not treat
implementation_plans/CODEX_GOALS.md as the standard — it is a kanban-era
artifact. The current model is:
In normal human-steered work, an agent keeps a bounded branch moving with local
Verifyand opens or updates a draft PR when the head is coherent. In unattended or high-assurance work, the agent loops on exact-head review/check evidence until the head is green and review-clean. A controller may also use a local integration train to merge locally verified compatible heads and run a combined local suite before spending hosted CI time. Merging tomainstays human-gated; agent-owned non-main branch integration is allowed only after the gates selected for that mode are green.
This skill is the portable, canonical runbook. It builds on AGENTS.md
(workspace/git rules) and .claude/skills/pr-review-loop/SKILL.md (review mechanics).
When porting to another repo, copy template/ (see "Porting").
Normal Work Is Lighter
Do not use this runbook as the default loop for ordinary human-steered Conductor
or local-agent work. In normal mode, an agent owns a bounded branch/worktree,
runs the focused local Verify, keeps the diff clean, opens or updates a draft
PR when useful, and may use local integration to find conflicts before hosted CI.
It does not need a native /goal, strict signal probes, CodeRabbit labels,
durable evidence markers, or feedback ACK comments on every intermediate head.
Switch from normal mode to this runbook when the user asks for unattended work, when a manifest selects overnight/high-assurance execution, when a head is being certified as ready for human landing, or when exact hosted evidence is required before another branch can depend on it.
Cloud Worker Lanes
Treat cloud sessions as disposable Linux workers. They help by keeping work running when the local machine sleeps and by moving several Git-clean slices in parallel. They do not inherit the local dirty worktree, local files, browser state, Docker Desktop, private-network resources, or credentials. The normal pattern is:
- The local controller defines the slice contract: exact parent, branch,
Outcome,Writes,Verify,Depends,Must not, and human-gated boundaries. - The cloud worker starts from pushed Git, changes only its slice, runs Linux
local
Verifywith synthetic fixtures, and pushes a branch or draft PR. - The cloud worker leaves a compact closeout and stops; it does not integrate sibling branches, operate staging/production, rotate secrets, or merge PRs.
- The local controller fetches cloud heads, runs local integration trains or local-only checks where needed, and performs final certification.
Prefer cloud sessions for docs, tests, pure source changes, refactors, and reviews. Keep local lanes for dirty-state recovery, local integration trains, Docker Desktop checks, browser sessions, secrets, private-network services, and human-gated provider/deployment work.
Instruction Hygiene For Portable AGENTS/CLAUDE Files
Prefer AGENTS.md as the shared cross-harness contract for Codex, Claude Code,
Cursor Agent, OpenCode, and other coding agents. If a repo also has CLAUDE.md,
make it point back to AGENTS.md and contain only Claude-specific exceptions.
Treat both files as reviewed onboarding code, not as append-only chat memory
dumps. Keep the root instruction file lean enough to be followed; put only
day-one repo context, commands, conventions that matter, and mistakes agents
repeatedly make. Delete stale or project-specific lines when copying a template
into a new repo.
Use the right instruction surface:
- Root
AGENTS.md: shared always-on conventions, commands, architecture map, human gates, and high-frequency corrections. - Root
CLAUDE.md: a small Claude-specific overlay that points back toAGENTS.md. - Skills: task procedures, verification recipes, review rubrics, examples,
long references, and scripts. Keep
SKILL.mdlean and put heavy material in side files. - Hooks/pre-push guards/CI: hard rules that must be enforced, such as never
pushing to
mainor blocking credential leaks. - Local ignored files: personal notes or branch-specific reminders that should not affect the whole team.
Rules should be specific and checkable, and they should name the replacement
behavior. Imports can organize long files, but they still load into context; use
them for structure, not as a way to reduce what the agent reads. When a review
flags the same agent mistake twice, update the relevant instruction surface in
Git. If you cannot justify a line in a copied AGENTS.md/CLAUDE.md, remove it.
Configure For Your Project
The model is provider-agnostic. Pin these once per repo:
| Knob | Value | Notes |
| Base branch | <origin/main or exact integration parent> | The comparison/merge target. Never assume main. |
| Remote / PR surface | <GitHub gh / Azure DevOps az repos / GitLab / local-only> | Draft PRs only. |
| Review tool | CodeRabbit CLI (cr --agent --base <base>) | Any reviewer works: a CLI reviewer, a fresh agent session, or both. |
| Quality lens source | <docs/quality-lenses.md + .claude/.agents skills> | How to pick TDD / diagnose / architecture / code-structure. |
| Task source of truth | implementation_plans/<plan>/TASK_QUEUE.md | Branchability lives in the row Notes + the per-slice brief (WORK_FORWARD_KEY_*.md only if the plan actually has one). |
| Escalation policy | record blocker + exact input, move to next independent slice | See "When Blocked Overnight". |
Size The Work First
Before coding, decide the shape — it depends on the size of the feature and the
blast radius of the change, not a line count. Use the saved
template/prompts/decompose.md prompt. Outcomes:
- One PR when a single reviewer can hold it in their head and it has one verifiable final state.
- A stack of PRs when there is a natural sequence (contract → behavior → UI) or later pieces depend on earlier ones landing.
- Parallel PRs when pieces are genuinely independent (no shared files).
- Local integration train when hosted CI latency is slowing a compatible multi-worktree wave. This is an accelerator beside the landing strategy, not a landing strategy itself: the controller keeps a local-only integration branch, merges locally verified worker heads, runs the combined local suite, and sends failures back to the owning branch before pushing any certifiable checkpoint.
A thread is the unit of execution, and it is flexible: it can run a single agent, or multiple agents in tandem (e.g. an implementer plus a paired reviewer, or a frontend/backend split), and it can carry one PR or a stacked sub-sequence. Implementation-plan work defaults to a continuing overnight run only when the session is launched as unattended: after a slice reaches green/clean, pick the next launch-ready independent slice. If none is launch-ready, switch to readiness-prep mode: author the missing per-slice brief / Writes / Verify surface for the next best candidate, then implement it if that prep makes it launch-ready. Human input is not automatically blocking: the agent should prepare the decision packet, record reversible assumptions/options, and move to the next independent row unless the missing decision makes all safe implementation or readiness-prep impossible. Stop for "no ready work" only when no candidate can be implemented, made ready, or advanced with a documented reversible assumption. Pick the smallest shape that still gives each PR one clean review. Split further if any piece would touch more than ~3 high-risk shared files or has more than one final state.
Session Hygiene And Rollover
Do not make a single chat transcript the durable state of an overnight run. The durable state is the branch, draft PR, task row, commits, validation output, and review/check state. Agent sessions are disposable execution containers.
After each slice is green/clean and pushed, close that slice with a compact closeout and start the next slice from live repo/PR state. In UI-backed runtimes such as Conductor, start a fresh agent session before claiming the next row by default; do not keep one Conductor tab accumulating every tool call across many slices. The new session should re-orient from:
- the current branch and remote head,
- the draft PR URL and
scripts/agent-signals.sh <base>(or the repo's equivalent), - the task queue row statuses and any committed
OVERNIGHT_<ID>_*.mdbrief, - the last slice closeout / commit message.
This is not a voluntary token or turn budget. It is transcript hygiene to avoid large local session stores, slow renderers, and resume loops that replay thousands of old tool messages. If a runtime cannot automatically spawn a new session, the agent must still keep output compact, avoid dumping long logs/diffs into chat, write bulky diagnostics to files, and pause after a green slice with a precise restart prompt for the next fresh session.
Quiet overnight mode
In Conductor and other UI-backed runtimes, overnight sessions should run quiet by default. Do not stream routine agent discussion, step-by-step narration, full diffs, long logs, or repeated raw probe output into chat. The durable log is the branch, commits, draft PR, task queue row, committed brief, and validation artifacts; chat is only the control surface.
During normal progress, emit only compact evidence needed to keep the goal loop
honest: the current head/PR when it changes, the SIGNALS ... verdict line or a
short validation summary, blockers, and the slice closeout. If a provider's goal
evaluator requires transcript-visible proof, surface the smallest stable summary
that proves the state instead of pasting raw command output. Put bulky diagnostic
details in files or PR comments and reference them from the closeout.
The Engine: An Exact-Head Review Loop
However many agents or PRs a thread carries, each PR is driven the same way: loop
on exact-head evidence until approved + green. CodeRabbit or an independent
reviewer is the recursive reviewer — it re-reviews automatically on every push
(PR app/webhook), or the agent runs the reviewer itself at certification points
(CLI/fresh session). In normal mode, do not spend this loop on every intermediate
push; use it when the head is stable enough to certify or the manifest requires
high-assurance evidence. The PR comment thread is the durable shared state for
certification; transient chat is not. Serial/stacked work needs no orchestrator
at all. To run several PRs in parallel (each needs its own working copy), see
the optional
.claude/skills/stacked-pr-orchestrator/SKILL.md.
- Open a reviewable PR early. Establish the branch (don't rename it to match
a suggested name), make a coherent first head, then open a draft PR.
Implement with the smallest quality lens that changes the decision (git status --short --branch git fetch origin git diff --stat <base>... git rev-parse --short HEADengineering-quality-lens;tddfor behavior through a public seam,diagnosefor bugs,architecture-reviewfor shared contracts/risky refactors). Don't bulk-load rule sets. - Fetch the review state. Pull every unresolved signal for the current head: code-review findings (CodeRabbit CLI or a fresh independent reviewer) and human PR comments / review threads / required checks / reviewer votes.
- Classify each comment (see "The Review Loop Is Agnostic"): actionable, invalid, duplicate, blocked, out-of-scope.
- Address valid actionable comments, validate the changed area, commit focused fixes. No drive-by refactors. If feedback is entirely invalid/duplicate/out-of-scope, make no noise commit and record why.
- Push the new head to your own task branch. A new SHA invalidates the prior review — it must be re-reviewed.
- Repeat 2–5 until the exit condition: no unresolved actionable comments, required checks pass, and the PR has the approvals its policy requires. Keep it bounded — usually two passes clear a head; continue only for major/critical findings or newly added comments.
- Code-structure gate. If the work moved shared operational mechanics
between actions and services, run
code-structurebefore reporting; otherwise recordcode-structure: not applicable (<reason>). - Close or advance the slice. If the PR targets
main/the protected base, leave it draft/ready for a human. If the target is an explicitly agent-owned non-main integration or stack branch, merge/integrate the worker branch back into that original parent branch after review/check gates are green and conflicts are resolved. Then continue to the next launch-ready independent slice in autonomy-mode. If no slice is launch-ready, perform readiness-prep on the next best candidate instead of stopping.
Local integration train
Use a local integration train when a multi-worktree wave is slow because
compatible branches are waiting behind hosted CI or review queues. The manifest
or controller prompt must name the train branch/worktree, merge order, local
combined Verify command, which dependents may start speculatively from the
train, and the real parent each dependent must later rebind to.
The controller flow is:
- Create a local integration branch from the recorded root parent and keep it local unless the manifest explicitly promotes it to a pushed checkpoint.
- Admit only heads whose focused local
Verifypassed and whose diff stays inside their owned files. - Merge admitted heads into the train in order. If conflicts or failures appear, return fixes to the owning branch or claim a bounded repair slice; do not patch product code directly on the train.
- Run the combined local suite and record the result as diagnostic evidence.
- Start a dependent from the train only when it is explicitly marked speculative. Before readiness, rebase or merge that work onto its recorded real parent and run the normal certification path.
The train never makes a head ready to land by itself. If the train is pushed, treat the pushed head as an ordinary integration checkpoint and run the hosted CI/review/signals or equivalent certification required by the target repo.
Stop the loop (don't guess) when the exit condition is met, when a comment is a blocker needing a human-gated decision/action (record it with the exact input needed), when no independent slice can be implemented, made ready, or advanced with a documented reversible assumption, or when you'd have to touch a surface another in-progress branch owns.
Autonomy Engine: A Persistence Loop (tool-agnostic)
What makes a thread keep working unattended is a persistence loop: an after-each-turn check that re-continues the thread until the PR's exit condition holds, instead of stopping after one turn. This is tool-agnostic — use whatever your agent runtime provides:
- A native Goal feature, if your tool has one. The two documented below are
Codex
/goaland Claude Code/goal; both run an after-each-turn evaluator and continue automatically. Prefer this when available. - A scheduled re-prompt otherwise — a cron job, a
/loop, or a Stop hook that re-sends the same contract every N minutes until the exit condition holds.
Use one persistence loop only. Do not wrap a native Goal in a second cron/polling/dispatcher loop around the same session. Either way the condition is the same contract (below). The review side may be automatic (CodeRabbit or another app re-reviews marked heads) or explicit (a fresh independent reviewer command/session runs on each pushed head). Each turn still needs fresh review evidence to act on.
The persistence loop must respect session rollover. For a single slice, it may re-continue the same session until that slice is green/clean or blocked. When the slice is complete, the next iteration should be a fresh session seeded from the branch/PR/task state above, especially in Conductor or any runtime that stores and renders the full transcript locally. Keep every loop iteration quiet unless it is reporting compact evidence, a blocker, or a closeout.
Write every Goal as the same contract (the structure behind the prompt library and the six-field standard below):
| Field | For an implementation thread |
| Outcome | The current piece is approved + green, and the thread then advances through the next launch-ready pieces; if none is launch-ready, it creates the missing readiness brief/backfill for the next candidate and proceeds when ready. |
| Verification surface | Review clean (CodeRabbit/reviewer), required checks pass, required approvals present. |
| Constraints | What must not regress (contracts, security posture, tests). |
| Boundaries | Owned files, base branch, allowed tools/providers; never merge or push to main/protected base. |
| Iteration policy | Each turn, address the latest unresolved review comments / failing checks, push, request re-review; after green/clean, integrate the worker branch back into its recorded parent only when that parent is an allowed agent-owned non-main branch, or leave protected/main-targeted PRs ready for a human, then claim the next launch-ready row or create the missing readiness brief/backfill. |
| Blocked stop | A human-gated action, no row can be implemented/made ready/advanced with a reversible assumption, or missing input that blocks all safe progress — report exact need and stop. |
Codex (codex/*)
https://developers.openai.com/cookbook/examples/codex/using_goals_in_codex.
Seed the full six-field /goal; Codex continues from idle and the evaluator can
check against concrete evidence (files, tests, logs, artifacts). Do not set a
voluntary token/turn budget unless the user explicitly asks for one; let the
provider/account usage cap be the runtime limit. Respect: evidence-based
completion (never "looks done") and plan-only turns don't continue (make
real progress each turn). Commands: /goal, /goal pause|resume|clear.
Claude Code (claude/*)
https://code.claude.com/docs/en/goal.md (needs Claude Code ≥ v2.1.139, workspace
trust, hooks enabled). /goal <condition> sets a completion condition; after each
turn a small fast model (Haiku) decides yes/no and the thread keeps working until
yes. One goal per session; /goal to check, /goal clear to stop.
Key difference — the evaluator only judges what is in the transcript; it does
not run commands or read files. So phrase the condition as something the agent
demonstrates in-conversation: it must run the check and surface compact evidence
each turn, such as one SIGNALS ... verdict line plus any blocker summary. Good:
"PR <url> has all required checks green, no unresolved review comments, and
required approvals — shown by running scripts/agent-signals.sh <base> or
gh pr view --json statusCheckRollup,reviewDecision,reviews and summarizing the
review/check verdict in this conversation." Name the constraints that must not
change and pair with auto mode so tool calls run unattended. Do not include
stop after N turns unless
the user explicitly asks for a bounded run. Condition limit: 4,000 chars. Works headless:
claude -p "/goal …".
Selecting The Next Slice (no dispatcher)
There is no board or dispatcher choosing work for you. Select directly:
- Read
TASK_QUEUE.md(status/owner/priority); branchability and serial/parallel guidance live in the row Notes + any per-slice brief (aWORK_FORWARD_KEY_*.mdonly if the plan actually has one — most do not). - Skip rows that are
DONE,DEFERRED,BLOCKED, orIN-PROGRESSowned by another workspace/branch. Reconcile ownership before touching anIN-PROGRESSrow — never duplicate it. - Prefer the highest-priority row that pulls toward a named product outcome and can land as one clean review.
- Size the bundle by a single verifiable final state, not a row count:
- 1 row when it touches central API/authz/persistence/infra/migrations, shared types, layout/navigation, or needs provider approval.
- 2–5 rows when they form one feature slice with one validation surface.
- 6–10 rows only when mostly docs/tests/runbooks or tightly coupled under one integration branch.
- If more than ~3 high-risk shared files would be touched, or ownership is unclear, stop and split (write a slice plan) instead of starting.
Readiness-Prep Mode
If no row is launch-ready, do not treat "missing OVERNIGHT_* brief",
missing Writes, or missing Verify as a terminal blocker by itself. That is
prep work the overnight agent should do.
- Pick the highest-priority candidate that is not
DONE,DEFERRED, blocked by an unresolved product decision, blocked by another in-progress owner, or dependent on an unlanded row. - Gather the same context as implementation work: design doc, cited decisions and stories, and nearby contracts/fixtures.
- Author
implementation_plans/<plan>/OVERNIGHT_<ID>_<slug>.mdwith scope, acceptance criteria, governing decisions, owned files/Writes, Verify command, base branch, out-of-scope boundaries, risks, and blocked-stop conditions. - If the row needs durable queue backfill, update only that row's Notes with the
brief path and any
Writes:/Verify:entries the plan expects. - Commit and push the readiness-prep change, open/update a draft PR if useful, and run the review loop.
- If the brief resolves readiness, proceed into implementation in the same autonomy run. If brief authoring exposes a missing decision, first decide whether a reversible assumption, decision packet, or smaller independent slice lets work continue safely. Mark/report a blocker only when the missing decision/credential/dependency prevents all safe implementation and readiness-prep for available candidates.
Only stop for "no ready work" after both direct implementation and readiness-prep paths have been exhausted.
Claiming And Status
Keep coordination lightweight; the branch + draft PR are the real signal.
- For multi-agent overnight runs, claim a row by setting its
StatustoIN-PROGRESSandOwnerto your workspace/branch before writing code, so siblings skip it. This is the one routine queue write that prevents collisions. - Otherwise follow the host repo's rule: update
TASK_QUEUE.md/plan docs only when the task itself requires durable status/ownership/planning changes; report routine progress in the final response. - Do not create handoff prompts or separate workspace status files for routine
reporting. No
.context/agent-status.mdrequirement.
Parent Branch Integration
Every worker branch has a recorded parent branch: the branch/ref the worker branched from and the branch/ref the slice must return to when it is green. This is what keeps stacked local wiki/progress views honest: the parent branch should receive the completed contract/docs/code/status updates before the next dependent worker starts from it.
Before creating a worker branch:
- Fetch remotes and identify the parent branch/ref. For a root slice this is the
project base; for a stacked slice it is the previous agent-owned stack branch
(for example
pp-10-inspectorbeforecodex/db-03-*, thencodex/db-03-*beforecodex/db-04-*). - Record that parent in the slice brief, PR description, closeout, or row Notes when the plan has a durable place for it.
- Branch the worker from that parent and target the draft PR at that same parent when the host supports non-main PR targets.
After the worker branch is review-clean and validation-green:
- Re-fetch and update the parent branch/ref.
- Integrate the worker branch back into the recorded parent only if that parent is an explicitly agent-owned non-main branch. Use the provider's normal PR merge flow or a local non-rewriting merge/fast-forward that preserves branch policy. Resolve conflicts on the worker/parent branch, rerun validation, and push the updated parent.
- If the recorded parent is
main,origin/main, or any protected base, do not integrate it yourself. Leave the draft PR ready with green evidence and stop for human landing. - Start the next dependent worker from the freshly updated parent branch, not
from the stale pre-integration parent or from
main.
The Review Loop Is Agnostic
Defer to pr-review-loop for the mechanics. The provider does not matter:
- CodeRabbit CLI when available:
cr --agent --base <base>(orcr --plain). - A fresh independent reviewer: a separate agent session prompted only to review the exact head SHA, returning findings; the implementation session owns fixes. Use this for non-trivial branches, with or without CodeRabbit.
- Durable evidence required overnight: hosted PR review comments are durable
by default; CLI output is not. If a CLI reviewer is part of the loop, save the
full output to a file or PR comment before relying on it. For repos using
scripts/agent-signals.sh, preferSIGNALS_REVIEW_SOURCE=cliwithSIGNALS_CLI_REVIEW_LOG=.context/coderabbit-cli-review.log, or configure an internal reviewer command whose exit status is a real clean/findings verdict. - Classify every finding:
actionable(fix + validate),invalid(explain, no change),duplicate(fix once),blocked(stop with exact input),out-of-scope(record follow-up). Fix only valid actionable findings; no drive-by refactors. - Each fix is a new head → re-review that head. Bounded: two passes usually enough; continue only for major/critical actionable findings.
Merge And Human Gates (hard line)
In unattended mode an agent may: commit to its own task branch, push that branch, create/update a draft PR for visibility, and merge/integrate branches it owns back into the recorded parent branch when that parent is an explicitly non-main integration/stack branch and the review/check gates are green.
An agent must stop and wait for a human to: merge/complete a PR into
main/origin/main or any protected base branch, create a non-draft PR targeting
main, bypass branch policies, modify protected branches, delete branches,
rewrite history, change/rotate credentials, mutate
approval-sensitive cloud resources, use real client data, spend money, or send
external communications.
When Blocked Overnight
A "blocker" is a precise reason no safe progress remains, even after trying a smaller slice, readiness-prep, a documented reversible assumption, or the next independent row. Missing human input is not automatically blocking. A product decision usually becomes a decision packet plus a move to independent work; it is blocking only when every available candidate depends on that decision. Missing credentials, unavailable services, an upstream branch that must land first, or any human-gated action above are blockers only for the work that actually depends on them.
On a blocker, do not guess or work around the gate. Instead:
- Record the blocker in the slice's closeout: what you attempted, the evidence gathered, the exact blocker, and the exact input/approval needed to resume.
- Leave the branch in a clean, reviewable state (commit or stash intentionally;
git diff --check). - If another independent ready or readiness-prep slice exists (no shared files, no dependency on the blocked one), move to it. Otherwise end the run with the blocker report. Never start work that depends on the blocked slice.
Closeout Report
Every slice's final report includes:
- Slice shape: one branch, independent branches, or stacked sequence (+ landing order).
- Branch, base, latest local head SHA; latest remote head if pushed (else "local-only"); draft PR URL/ID if created.
- Meaningful files changed.
- Validation commands run and results.
- Review: tool/command run and result (or blocker if unavailable), independent reviewer + reviewed head SHA if used, and the finding-classification summary.
- Whether a fresh review (and any policy/check evaluation) ran for the latest head.
- Quality lens used, and
code-structureresult ornot applicable (<reason>). - Unresolved risks, invalid findings, out-of-scope follow-ups, blockers.
- Recommended next step / next ready slice, and any human-gated next action.
Prompt Library
The prompt to use is a saved asset, not improvised — pick the one that fits the
situation. The library lives in template/prompts/ (plus the generic fill-in):
| Prompt | Use when |
template/prompts/decompose.md | First. Decide one PR vs stack vs parallel, agents-per-thread, and which seed prompt each piece gets. |
template/prompts/implement-piece.md | Seed an implementation thread for one piece; it files a draft PR and loops on review. |
template/prompts/review-pr.md | Optional. Only when you want a second reviewer beyond CodeRabbit (CodeRabbit auto-reviews each push, so a separate review thread is usually unnecessary). |
template/goal-prompt.md | Generic fill-in /goal contract when a piece doesn't match a specific prompt. |
Add project-specific prompts to template/prompts/ as new situations recur, and
list them here. A good prompt encodes the contract so the agent never guesses:
end state, verification, scope, base, allowed tools, quality lens, review
expectation, human gates, and the blocked stop condition.
Porting To Another Project
- Copy the skill folder into the target repo's
.agents/skills/. - If the target repo also uses Claude Code, copy the same skill folder into
.claude/skills/. Keep.agentsand.claudecopies byte-identical unless a harness genuinely needs different frontmatter. - Copy
template/AGENTS_SNIPPET.mdinto the repo'sAGENTS.mdand fill the configure-knobs table for that repo (base branch, PR surface, review tool, quality-lens source, task source of truth). If the repo hasCLAUDE.md, make it point back toAGENTS.mdand keep only Claude-specific exceptions there. Then prune copied text: remove any project facts, branch names, deployment URLs, or ceremony the new repo does not need on day one. - Keep the root instruction file under review. Move long procedures into skills, move hard enforcement into hooks/CI, and keep personal notes in local ignored files.
- Use
template/goal-prompt.mdto write overnight prompts. - Pair with a review-loop skill (
pr-review-loop) and quality skills (engineering-quality-lens,tdd,diagnose,architecture-review,code-structure). If the target repo lacks them, port those too.
Do not carry over deployment URLs, credentials, product-only branch names, stale queue rows, local worktree paths, or any retired board/dispatcher machinery.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

