agentleFS
voundbrandvoundbrand/overnight/.cursor/skills/overnight-agent-runbook/SKILL.md

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.

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
  1. Very specific:

    When porting to another repo, copy template/ (see "Porting").

    line 30
  2. Distinctive:

    Do not use this runbook as the default loop for ordinary human-steered Conductor or local-agent work.

    line 34
  3. Distinctive:

    Treat cloud sessions as disposable Linux workers.

    line 48
  4. Distinctive:

    Prefer cloud sessions for docs, tests, pure source changes, refactors, and reviews.

    line 64
  5. Distinctive:

    Prefer AGENTS.md as the shared cross-harness contract for Codex, Claude Code, Cursor Agent, OpenCode, and other coding agents.

    line 71
  6. Distinctive:

    Treat both files as reviewed onboarding code, not as append-only chat memory dumps.

    line 74
  7. Distinctive:

    Use the right instruction surface:

    line 80
  8. Very specific:

    Before coding, decide the shape — it depends on the size of the feature and the blast radius of the change, not a line count.

    line 115
  9. Distinctive:

    One PR: when a single reviewer can hold it in their head and it has one verifiable final state.

    line 119
  10. Distinctive:

    A stack of PRs: when there is a natural sequence (contract → behavior → UI) or later pieces depend on earlier ones landing.

    line 121
  11. Distinctive:

    Parallel PRs: when pieces are genuinely independent (no shared files).

    line 123
  12. Distinctive:

    Local integration train: when hosted CI latency is slowing a compatible multi-worktree wave.

    line 124
  13. Distinctive:

    If none is launch-ready, switch to readiness-prep mode: author the missing per-slice brief / Writes / Verify surface for the next best …

    line 136
  14. Very specific:

    Do not make a single chat transcript the durable state of an overnight run.

    line 149
  15. Distinctive:

    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.

    line 153
  16. Distinctive:

    Repeat 2–5 until the exit condition: no unresolved actionable comments, required checks pass, and the PR has the approvals its policy …

    line 223
  17. Very specific:

    Code-structure gate: If the work moved shared operational mechanics between actions and services, run code-structure before reporting.

    line 227
  18. Distinctive:

    Close or advance the slice: If the PR targets main/the protected base, leave it draft/ready for a human.

    line 230
  19. Distinctive:

    Use a local integration train when a multi-worktree wave is slow because compatible branches are waiting behind hosted CI or review queues.

    line 240
  20. Distinctive:

    Create a local integration branch from the recorded root parent and keep it local unless the manifest explicitly promotes it to a pushed …

    line 248
  21. Distinctive:

    Run the combined local suite and record the result as diagnostic evidence.

    line 255
  22. Distinctive:

    Start a dependent from the train only when it is explicitly marked speculative.

    line 256
  23. Distinctive:

    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 …

    line 264
  24. Very specific:

    Use one persistence loop only.

    line 283
  25. Distinctive:

    Write every Goal as the same contract (the structure behind the prompt library and the six-field standard below):

    line 297
  26. Very specific:

    Read TASK_QUEUE.md (status/owner/priority).

    line 343
  27. Distinctive:

    Prefer the highest-priority row that pulls toward a named product outcome and can land as one clean review.

    line 349
  28. Very specific:

    1 row: when it touches central API/authz/persistence/infra/migrations, shared types, layout/navigation, or needs provider approval.

    line 352
  29. Distinctive:

    2–5 rows: when they form one feature slice with one validation surface.

    line 354
  30. Very specific:

    6–10 rows: only when mostly docs/tests/runbooks or tightly coupled under one integration branch.

    line 355
  31. Distinctive:

    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.

    line 357
  32. Very specific:

    If no row is launch-ready, do not treat "missing OVERNIGHT_* brief", missing Writes, or missing Verify as a terminal blocker by itself.

    line 362
  33. Very specific:

    If the row needs durable queue backfill, update only that row's Notes with the brief path and any Writes: / Verify: entries the plan …

    line 374
  34. Distinctive:

    Commit and push the readiness-prep change, open/update a draft PR if useful, and run the review loop.

    line 376
  35. Distinctive:

    If the brief resolves readiness, proceed into implementation in the same autonomy run.

    line 378
  36. Distinctive:

    Only stop for "no ready work" after both direct implementation and readiness-prep paths have been exhausted.

    line 385
  37. Distinctive:

    Keep coordination lightweight.

    line 390
  38. Very specific:

    Do not create handoff prompts or separate workspace status files for routine reporting.

    line 398
  39. Distinctive:

    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 …

    line 403
  40. Distinctive:

    Before creating a worker branch:

    line 409
  41. Distinctive:

    After the worker branch is review-clean and validation-green:

    line 420
  42. Very specific:

    If the recorded parent is main, origin/main, or any protected base, do not integrate it yourself.

    line 428
  43. Distinctive:

    Start the next dependent worker from the freshly updated parent branch, not from the stale pre-integration parent or from main.

    line 431
  44. Very specific:

    CodeRabbit CLI: when available: cr --agent --base <base> (or cr --plain).

    line 438
  45. Distinctive:

    Leave the branch in a clean, reviewable state (commit or stash intentionally.

    line 484
  46. Distinctive:

    If another independent ready or readiness-prep slice exists (no shared files, no dependency on the blocked one), move to it.

    line 486
  47. Distinctive:

    Every slice's final report includes:

    line 492
  48. Very specific:

    Add project-specific prompts to template/prompts/ as new situations recur, and list them here.

    line 519
  49. Very specific:

    If the target repo also uses Claude Code, copy the same skill folder into .claude/skills/.

    line 527
  50. Distinctive:

    Keep the root instruction file under review.

    line 536
  51. Very specific:

    Use template/goal-prompt.md to write overnight prompts.

    line 539
  52. Distinctive:

    Do not carry over deployment URLs, credentials, product-only branch names, stale queue rows, local worktree paths, or any retired …

    line 544

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 Verify and 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 to main stays 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:

  1. The local controller defines the slice contract: exact parent, branch, Outcome, Writes, Verify, Depends, Must not, and human-gated boundaries.
  2. The cloud worker starts from pushed Git, changes only its slice, runs Linux local Verify with synthetic fixtures, and pushes a branch or draft PR.
  3. The cloud worker leaves a compact closeout and stops; it does not integrate sibling branches, operate staging/production, rotate secrets, or merge PRs.
  4. 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 to AGENTS.md.
  • Skills: task procedures, verification recipes, review rubrics, examples, long references, and scripts. Keep SKILL.md lean and put heavy material in side files.
  • Hooks/pre-push guards/CI: hard rules that must be enforced, such as never pushing to main or 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:

KnobValueNotes
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 toolCodeRabbit 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 truthimplementation_plans/<plan>/TASK_QUEUE.mdBranchability lives in the row Notes + the per-slice brief (WORK_FORWARD_KEY_*.md only if the plan actually has one).
Escalation policyrecord blocker + exact input, move to next independent sliceSee "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:

  1. the current branch and remote head,
  2. the draft PR URL and scripts/agent-signals.sh <base> (or the repo's equivalent),
  3. the task queue row statuses and any committed OVERNIGHT_<ID>_*.md brief,
  4. 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.

  1. 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.
    git status --short --branch
    git fetch origin
    git diff --stat <base>...
    git rev-parse --short HEAD
    Implement with the smallest quality lens that changes the decision (engineering-quality-lens; tdd for behavior through a public seam, diagnose for bugs, architecture-review for shared contracts/risky refactors). Don't bulk-load rule sets.
  2. 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.
  3. Classify each comment (see "The Review Loop Is Agnostic"): actionable, invalid, duplicate, blocked, out-of-scope.
  4. 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.
  5. Push the new head to your own task branch. A new SHA invalidates the prior review — it must be re-reviewed.
  6. 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.
  7. Code-structure gate. If the work moved shared operational mechanics between actions and services, run code-structure before reporting; otherwise record code-structure: not applicable (<reason>).
  8. 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:

  1. Create a local integration branch from the recorded root parent and keep it local unless the manifest explicitly promotes it to a pushed checkpoint.
  2. Admit only heads whose focused local Verify passed and whose diff stays inside their owned files.
  3. 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.
  4. Run the combined local suite and record the result as diagnostic evidence.
  5. 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 /goal and 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):

FieldFor an implementation thread
OutcomeThe 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 surfaceReview clean (CodeRabbit/reviewer), required checks pass, required approvals present.
ConstraintsWhat must not regress (contracts, security posture, tests).
BoundariesOwned files, base branch, allowed tools/providers; never merge or push to main/protected base.
Iteration policyEach 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 stopA 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:

  1. Read TASK_QUEUE.md (status/owner/priority); branchability and serial/parallel guidance live in the row Notes + any per-slice brief (a WORK_FORWARD_KEY_*.md only if the plan actually has one — most do not).
  2. Skip rows that are DONE, DEFERRED, BLOCKED, or IN-PROGRESS owned by another workspace/branch. Reconcile ownership before touching an IN-PROGRESS row — never duplicate it.
  3. Prefer the highest-priority row that pulls toward a named product outcome and can land as one clean review.
  4. 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.
  5. 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.

  1. 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.
  2. Gather the same context as implementation work: design doc, cited decisions and stories, and nearby contracts/fixtures.
  3. Author implementation_plans/<plan>/OVERNIGHT_<ID>_<slug>.md with scope, acceptance criteria, governing decisions, owned files/Writes, Verify command, base branch, out-of-scope boundaries, risks, and blocked-stop conditions.
  4. 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.
  5. Commit and push the readiness-prep change, open/update a draft PR if useful, and run the review loop.
  6. 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 Status to IN-PROGRESS and Owner to 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.md requirement.

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:

  1. 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-inspector before codex/db-03-*, then codex/db-03-* before codex/db-04-*).
  2. Record that parent in the slice brief, PR description, closeout, or row Notes when the plan has a durable place for it.
  3. 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:

  1. Re-fetch and update the parent branch/ref.
  2. 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.
  3. 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.
  4. 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> (or cr --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, prefer SIGNALS_REVIEW_SOURCE=cli with SIGNALS_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:

  1. 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.
  2. Leave the branch in a clean, reviewable state (commit or stash intentionally; git diff --check).
  3. 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-structure result or not 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):

PromptUse when
template/prompts/decompose.mdFirst. Decide one PR vs stack vs parallel, agents-per-thread, and which seed prompt each piece gets.
template/prompts/implement-piece.mdSeed an implementation thread for one piece; it files a draft PR and loops on review.
template/prompts/review-pr.mdOptional. 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.mdGeneric 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

  1. Copy the skill folder into the target repo's .agents/skills/.
  2. If the target repo also uses Claude Code, copy the same skill folder into .claude/skills/. Keep .agents and .claude copies byte-identical unless a harness genuinely needs different frontmatter.
  3. Copy template/AGENTS_SNIPPET.md into the repo's AGENTS.md and fill the configure-knobs table for that repo (base branch, PR surface, review tool, quality-lens source, task source of truth). If the repo has CLAUDE.md, make it point back to AGENTS.md and 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.
  4. 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.
  5. Use template/goal-prompt.md to write overnight prompts.
  6. 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.