Chapter 1 · Session 17
The evening: plan the night and set the guard rails
An overnight build is decided at five in the afternoon, not at three in the morning. Before you leave, every worker has a brief on main, a spending cap, an exact list of what it may do, and a reason to stop. A one-dollar dry run proves it all before the real night starts.
40 min4 stepsAbout 40 minutes before you leave
By the end of this chapter you can
- Write tonight's plan in docs/nights/ and merge it with its briefs before any worker starts.
- Say what an unattended worker may and may not do, and which guard rail enforces each.
- Prove the guard rails with a one-dollar dry run, then start bounded workers a few minutes apart.
Why overnight, and what it costs
A fleet working while the plant team sleeps turns fourteen idle hours into build time, and your working day goes on what only you can do: deciding, reviewing and talking to the floor. The price is that nobody is watching. So the night produces proposals and nothing else: no merge, no deploy, no database change. The morning decides.
What an unattended worker may and may not do
| A worker may | A worker may not | What stops it |
|---|---|---|
| Read the repository and edit files in its brief's folders | Change migrations, packages, .github/, CLAUDE.md or .claude/ | Deny rules on those paths, given on the command line |
| Run npm ci, the tests, lint and the type check | Install a new package, reach other websites, read .env files | dontAsk mode: anything not on the allowlist is refused, not asked |
| Commit and push its own branch; merge main into it | Push to main, force push, rebase | Session 1's deny rules and main's ruleset |
| Open a pull request, or a draft when it stops | Merge, deploy, or touch the live or development database | Not on the allowlist; and its worktree has no keys at all |
| Spend up to its cap | Spend past the account's limit | --max-budget-usd and --max-turns; the spend limit from Session 16 |
Claude Code's dontAsk mode is made for this: it runs only what you have pre-approved and refuses everything else instead of waiting for an answer nobody will give [1]. Deny rules apply in every mode. The mode that skips all checks is meant only for isolated containers and virtual machines; never use it on a computer that holds company files or keys [1].
Write tonight's plan, and merge it with its briefs
15 minutesWhy
Each worker starts from main as it is on GitHub, so a brief that is not merged is a brief it cannot read. Writing the night on one dated page also means anyone can see in the morning exactly what was asked, with which caps, and compare it with what came back. Most failures trace back to the brief, so this page is where the night is won or lost.
Do this
cd ~/code/acme-platform && git switch main && git pull && claudeRead docs/waves.md, docs/fleet-ledger.md and docs/briefs/TEMPLATE.md. Tonight the fleet runs the next wave of docs/waves.md unattended.
On a new branch night/plan, write docs/nights/ with today's date as the file name (YYYY-MM-DD.md), with these sections:
- Goal: what the night should deliver, in one sentence.
- Workers: one line each, numbered Worker 1, Worker 2, Worker 3 (no more than the wave has, and no more than 3): its brief file, the folders it owns, its worktree name (night-1, night-2, night-3).
- Caps: $8 and 80 turns per worker, and the night's maximum, which is the sum. Say that the budget is an estimate and spend can pass it slightly.
- Stop rules: two identical failures; a folder the brief does not own; any refused action. On stopping: push, then a draft pull request titled STOPPED: with what was finished, what was tried last and the exact error.
- Never tonight: merge, deploy, push to main, force push, rebase, install packages, change migrations, .github/, CLAUDE.md or .claude/, edit an existing test, read .env files.
- Morning: who reviews (pat@acme.com, then sam@acme.com approves), in the order of the workers, by 10:00.
If a worker's task has no brief yet, write it from the template as in Session 16: its own folders, a Do not touch list, acceptance checks written first, and the two-failure limit. Each brief must be clear enough that nobody needs to answer a question. Open a pull request titled "Night plan" with today's date, wait for the checks and show me the link.Read the plan and each brief once more as if you were the worker with nobody to ask. Owner two approves; merge it before you go on.
You will see recreated screen
- Each worker's brief, folders and worktree name, on one line.
- Two workers, because the wave has two tasks. More agents than tasks only adds waiting and collisions.
Check it worked
docs/nights/ on main has today's plan with Workers, Caps, Stop rules, Never tonight and Morning, and every brief it names is on main.
Fastest path
Merge before you do anything else this evening. The dry run in Step 3 reads the plan from main, so it also proves the merge happened.
If it goes wrong
A brief says "ask me if unsure"
Nobody can answer at night. Say: Replace every "ask me" in tonight's briefs with the decision itself, or with: choose the safest reading and write it down.
The wave needs a migration or a new package
That part is not for tonight. Do it by day as the lead (Session 16, Step 2), merge it, and plan the night around what is left.
Check the guard rails you are relying on
5 minutesWhy
The night is safe because of settings made weeks ago: main refuses changes without a pull request and green checks, and the account has a spend limit. A setting someone relaxed for a quick fix last week and forgot to restore turns a bad pull request into a bad main. Five minutes of looking is cheap insurance for an unwatched night.
Do this
https://github.com/acme-ops/acme-platform/settings/rules
Rulesets: protect main is Active; pull request and approval required; required status checks on (Session 10); force pushes blocked; only owner one may bypass.
https://claude.ai/admin-settings/usage
Usage: the spend limit you set in Session 16 is still there.
Then make sure the computer stays awake all night: plugged in, and sleep set to Never when plugged in (Windows: Settings, System, Power). On a Mac, put caffeinate -i in front of each command in Step 4.
You will see recreated screen
- Active, not Evaluate or Disabled.
- On since Session 10, with your checks listed by name.
- Nobody else, and no app or agent account, on the bypass list.
Check it worked
The ruleset is Active with the four settings shown, and a spend limit is set where the fleet's usage is billed.
If it goes wrong
Require status checks is off, or the bypass list has more names
Put it back now (Session 10). Without it, a red pull request can merge, by a tired person in the morning or by anyone on the bypass list.
The computer is a laptop that goes home with you
Use a desktop that stays in the office, or wait until you have one. A run stopped by a lid closing loses only work since its last push, but the night is wasted.
The one-dollar dry run
10 minutesWhy
Problems found at five o'clock cost a dollar; found at seven the next morning they cost a night. The dry run starts one worker exactly as the real ones will start, with a one-dollar cap, and asks it to try the things it must not be able to do. If any of them works, a guard rail is missing and the night does not start.
Do this
mkdir ../night-logsclaude -p "Dry run, do not change any code. Read CLAUDE.md and the newest night plan in docs/nights/. Then try each of these and report each one with the exact command and whether it was allowed or refused: 1. read .env.local; 2. git push origin main; 3. npm install left-pad; 4. edit .github/workflows/ci.yml; 5. npm ci then npm test. Finish with one line per worker in the plan: its brief file and whether you could read it." --worktree night-dryrun --permission-mode dontAsk --max-budget-usd 1 --max-turns 15 --allowedTools "Read" "Edit" "Write" "Bash(npm ci)" "Bash(npm test)" "Bash(npm test *)" "Bash(npm run lint *)" "Bash(npx tsc --noEmit)" "Bash(git status *)" "Bash(git diff *)" "Bash(git log *)" "Bash(git add *)" "Bash(git commit *)" "Bash(git fetch *)" "Bash(git merge origin/main)" "Bash(git push -u origin HEAD)" "Bash(gh pr create *)" "Bash(gh pr list *)" "Bash(gh pr view *)" "Bash(gh pr checks *)" "Bash(gh run view *)" --disallowedTools "Edit(.github/**)" "Edit(.claude/**)" "Edit(supabase/**)" "Edit(package.json)" "Edit(package-lock.json)" "Edit(CLAUDE.md)"When it has reported, remove the dry run's worktree and branch (a message that it is not locked is fine):
git worktree unlock .claude/worktrees/night-dryrun
git worktree remove --force .claude/worktrees/night-dryrun
git branch -D worktree-night-dryrunYou will see recreated screen
- Every forbidden action refused. If any one says allowed, stop: fix the setting before the night.
- The tests run in a fresh worktree, without keys.
- Proof that the plan and briefs are on main where the workers will look.
Check it worked
Items 1 to 4 were refused, the tests ran with exit code 0, every worker's brief was readable, and git worktree list no longer shows night-dryrun.
If it goes wrong
Item 1, 2 or 4 says allowed
A deny rule is missing or was loosened. Do not start the night. Compare .claude/settings.json with Session 1 (Step 10), and check the command was pasted in full, including the --disallowedTools part.
It cannot find the night plan
The Night plan pull request is not merged, or the worktree started from an old copy of main. Merge it, then run the dry run again.
The tests fail in the worktree but pass in your main folder
Something the tests need is not in the repository, often a key in .env.local. Tests must run without real keys; fix that by day before running a night.
Start the night, workers a few minutes apart
5 minutesWhy
Each worker is one command in its own terminal window: its own worktree, the exact allowlist, a dollar cap and a turn cap, and a log file you will read in the morning. Starting them a few minutes apart spreads their large first requests over the same usage window, and lets you see each one begin before you leave.
Do this
Start only as many workers as tonight's plan names. In a terminal in ~/code/acme-platform:
claude -p "You are night worker 1, unattended: nobody can answer questions tonight. Read CLAUDE.md, then the newest night plan in docs/nights/, and carry out the brief for Worker 1. Where the brief is unclear, choose the safest reading and write down what you chose. Stop when: two identical failures, the work needs a folder your brief does not own, or an action is refused. Then commit what you have, push, and open a DRAFT pull request titled STOPPED: and the brief name, saying what you finished, what you tried last and the exact error. When the work is done: push, open the pull request, wait for every check on the latest commit and fix anything red inside your own folders." --worktree night-1 --permission-mode dontAsk --max-budget-usd 8 --max-turns 80 --output-format json --allowedTools "Read" "Edit" "Write" "Bash(npm ci)" "Bash(npm test)" "Bash(npm test *)" "Bash(npm run lint *)" "Bash(npx tsc --noEmit)" "Bash(git status *)" "Bash(git diff *)" "Bash(git log *)" "Bash(git add *)" "Bash(git commit *)" "Bash(git fetch *)" "Bash(git merge origin/main)" "Bash(git push -u origin HEAD)" "Bash(gh pr create *)" "Bash(gh pr list *)" "Bash(gh pr view *)" "Bash(gh pr checks *)" "Bash(gh run view *)" --disallowedTools "Edit(.github/**)" "Edit(.claude/**)" "Edit(supabase/**)" "Edit(package.json)" "Edit(package-lock.json)" "Edit(CLAUDE.md)" > ../night-logs/night-1.jsonWait until a pull request or a first push appears for night-1, or three minutes have passed. Then, in a second terminal:
claude -p "You are night worker 2, unattended: nobody can answer questions tonight. Read CLAUDE.md, then the newest night plan in docs/nights/, and carry out the brief for Worker 2. Where the brief is unclear, choose the safest reading and write down what you chose. Stop when: two identical failures, the work needs a folder your brief does not own, or an action is refused. Then commit what you have, push, and open a DRAFT pull request titled STOPPED: and the brief name, saying what you finished, what you tried last and the exact error. When the work is done: push, open the pull request, wait for every check on the latest commit and fix anything red inside your own folders." --worktree night-2 --permission-mode dontAsk --max-budget-usd 8 --max-turns 80 --output-format json --allowedTools "Read" "Edit" "Write" "Bash(npm ci)" "Bash(npm test)" "Bash(npm test *)" "Bash(npm run lint *)" "Bash(npx tsc --noEmit)" "Bash(git status *)" "Bash(git diff *)" "Bash(git log *)" "Bash(git add *)" "Bash(git commit *)" "Bash(git fetch *)" "Bash(git merge origin/main)" "Bash(git push -u origin HEAD)" "Bash(gh pr create *)" "Bash(gh pr list *)" "Bash(gh pr view *)" "Bash(gh pr checks *)" "Bash(gh run view *)" --disallowedTools "Edit(.github/**)" "Edit(.claude/**)" "Edit(supabase/**)" "Edit(package.json)" "Edit(package-lock.json)" "Edit(CLAUDE.md)" > ../night-logs/night-2.jsonIf the plan has a third worker, a few minutes later in a third terminal:
claude -p "You are night worker 3, unattended: nobody can answer questions tonight. Read CLAUDE.md, then the newest night plan in docs/nights/, and carry out the brief for Worker 3. Where the brief is unclear, choose the safest reading and write down what you chose. Stop when: two identical failures, the work needs a folder your brief does not own, or an action is refused. Then commit what you have, push, and open a DRAFT pull request titled STOPPED: and the brief name, saying what you finished, what you tried last and the exact error. When the work is done: push, open the pull request, wait for every check on the latest commit and fix anything red inside your own folders." --worktree night-3 --permission-mode dontAsk --max-budget-usd 8 --max-turns 80 --output-format json --allowedTools "Read" "Edit" "Write" "Bash(npm ci)" "Bash(npm test)" "Bash(npm test *)" "Bash(npm run lint *)" "Bash(npx tsc --noEmit)" "Bash(git status *)" "Bash(git diff *)" "Bash(git log *)" "Bash(git add *)" "Bash(git commit *)" "Bash(git fetch *)" "Bash(git merge origin/main)" "Bash(git push -u origin HEAD)" "Bash(gh pr create *)" "Bash(gh pr list *)" "Bash(gh pr view *)" "Bash(gh pr checks *)" "Bash(gh run view *)" --disallowedTools "Edit(.github/**)" "Edit(.claude/**)" "Edit(supabase/**)" "Edit(package.json)" "Edit(package-lock.json)" "Edit(CLAUDE.md)" > ../night-logs/night-3.jsonLeave the windows open and the computer awake. Note the time each worker started, for the Morning section tomorrow.
You will see recreated screen
- The whole result, with cost, turns and how it ended, goes to the log file in the morning.
- Its own folder and branch, starting from main.
Check it worked
Each worker in the plan has a worktree (git worktree list), and within a few minutes its branch has a first push or its terminal is still running.
Fastest path
Start worker 1, and while it gets going, re-read worker 2's brief one last time. You lose nothing by starting it three minutes later.
If it goes wrong
A command ends at once with an error about an option
It was not pasted in full: a long command can be cut off at a line break. Copy it again with the Copy button and paste it as one piece.
PowerShell says the path ../night-logs does not exist
Run mkdir ../night-logs from Step 3 in ~/code/acme-platform first.
You hit the plan's usage limit as the workers start
Three workers draw on one usage window. Stop the last one (Ctrl+C), and run two workers until the ledger shows how much a night uses.
Knowledge check
Which permission setup fits an unattended worker on a computer that also holds company files?
Knowledge check
Two workers each run with --max-budget-usd 8. Roughly the most the night's model use can cost is:
References
- Claude Code docs: Choose a permission mode (dontAsk, bypassPermissions). https://code.claude.com/docs/en/permission-modes
- Claude Code docs: CLI reference (-p, --worktree, --max-budget-usd, --max-turns, --allowedTools). https://code.claude.com/docs/en/cli-reference
- Claude Code docs: Run Claude Code programmatically (headless). https://code.claude.com/docs/en/headless
- GitHub Docs: About rulesets. https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/about-rulesets
Chapter 2 · Session 17
Through the night: what workers do, and how they stop
During the night each worker loops: change, test, commit, push. It ends in one of two ways: a pull request because its checks pass, or a draft pull request that says why it stopped. Nobody needs to be woken, because nothing a worker can do overnight is irreversible.
20 min1 stepNo 3 a.m. phone calls
By the end of this chapter you can
- Describe how a worker's night ends, and why there is no state in which it merges or deploys.
- Say which stop rules end a run and what enforces each.
- Read the heartbeat (pushes) without disturbing the workers, and tell a quiet worker from a stuck one.
Stop rules, not hope
| Stop when | Enforced by | Why |
|---|---|---|
| The dollar cap is reached | --max-budget-usd: the run ends whatever the agent thinks [1] | A task that turned out bigger than planned costs no more than its cap |
| The turn cap is reached | --max-turns: the run exits with an error [1] | Ends a loop that is not converging. Its work up to the last push is kept, without a pull request |
| Two identical failures | The brief and CLAUDE.md (Session 16) | Retrying something refused for a reason outside the code never succeeds |
| A folder it does not own | The brief; deny rules on the shared folders | Scope creep collides with the other workers |
| Any refused action | dontAsk refuses it; CLAUDE.md says stop, never find another way | In our build, an agent refused one command opened a pull request with a different one |
Agents going round in circles and not knowing when to stop are the two most common agent failures, and our own fleet hit both: a day of retries rebuilding the same refused commit. The two-failure rule and the caps end that. The draft pull request is the escalation: it puts the question in front of you in the morning, in one place, instead of an answer guessed at 3 a.m.
A heartbeat you can read
Each push to a worker's branch is a heartbeat, and it makes a restart cheap: everything up to the last push is safe on GitHub. Judge a worker by whether its branch is moving, not by whether its terminal prints anything. In our build a watchdog stopped working agents as "dead" because they had been quiet; long thinking is silent.
Who gets woken up? Nobody. Site reliability engineers alert a person only for something that needs a person now [2]. A guarded night cannot touch production, cannot merge and cannot spend past its caps, so a worker that stops simply waits for the morning. If you find yourself wanting an alarm, a guard rail is missing: add it instead. And keep the whole conversation, not just the last answer: Claude Code keeps each run's full session on your computer, and the log file names it, so in the morning you can open it and see every step [3].
Read the heartbeat before bed, without touching the workers
2 minutesWhy
A worker that never really started is the one problem worth catching tonight, because it is cheap to fix now and costs the whole night if found in the morning. Looking at pushes and pull requests tells you everything you need without interrupting a worker, which would waste its context and its turns.
Do this
gh pr list --state opengit -C .claude/worktrees/night-1 log --oneline -5You will see recreated screen
- Its pull request is open: the checks will run on it overnight.
- Recent commits: the worker is alive. No new commit for an hour is normal while it is waiting for checks or thinking.
Check it worked
Each worker has at least one commit on its branch, or is still running in its terminal. You have not typed anything into a worker's window.
If it goes wrong
A worker's terminal has already returned, with no commit and no pull request
Read its log: ../night-logs/night-2.json. The last result line says how it ended. If it could not start (a typo, a missing brief), fix that and run its command again. If it stopped on a rule, leave it for the morning.
A worker has been silent for an hour
Silence is not death. If its branch has commits or its pull request's checks are running, leave it. Do not stop a worker by name (pkill, Task Manager's End task on every node): stop only that terminal with Ctrl+C, and only if you are sure.
Knowledge check
A worker has failed the same test twice with the same error at 01:00. What should happen?
Knowledge check
Why judge a worker by its pushes rather than by what its terminal prints?
References
- Claude Code docs: CLI reference (--max-budget-usd, --max-turns). https://code.claude.com/docs/en/cli-reference
- Google: Site Reliability Engineering, Monitoring Distributed Systems. https://sre.google/sre-book/monitoring-distributed-systems/
- Claude Code docs: Run Claude Code programmatically (JSON output and sessions). https://code.claude.com/docs/en/headless
Chapter 3 · Session 17
The morning review
The night's output is a set of proposals. The morning decides which become part of the plant's platform: collect the night in one table, send back what fails a cheap check, read what is left, and merge one pull request at a time, each green on its latest commit.
45 min4 stepsEnds with a gate
By the end of this chapter you can
- Collect every worker's result, cost and checks on its latest commit in one table.
- Send back what fails a cheap check before spending reading time on it.
- Read each remaining change against the platform's rules, then merge in order, updating from main each time.
- Close the night: the ledger, one rewritten brief, and the worktrees removed.
Cheapest check first
Do not start by reading the biggest pull request. Take every pull request through the checks in order of cost, automatic first, your careful reading last. A pull request that fails an early check goes back without you reading a line.
| Check | How | If it fails |
|---|---|---|
| 1. Checks green on its latest commit | The pull request's checks on GitHub, for the commit it shows now [1] | If behind main, update and re-judge; if still red, back with the failure |
| 2. Only its brief's folders | Files changed, against the brief | Close it; re-cut the task |
| 3. No existing test changed | Files changed: new tests are fine, edited old ones are not | Close it: a pass against a changed test proves nothing |
| 4. Readable size | Roughly 400 changed lines or fewer | Ask for it to be split |
| 5. Works where people use it | Its preview address on your phone (Session 11) | Back with what you saw |
Collect the night in one table
10 minutesWhy
Each worker left three things: a log with its cost and how it ended, a branch, and a pull request or draft. One table of all of them, with each pull request's checks on its latest commit, lets you decide where to spend your reading time in five minutes. Asking only for evidence, and for "cannot tell" where there is none, stops a confident summary hiding a red check.
Do this
cd ~/code/acme-platform && git switch main && git pull && claudeCollect last night's fleet run. Do not change anything.
For each worker in the newest plan in docs/nights/, read ../night-logs/night-N.json and its branch worktree-night-N on GitHub, and give me one table row:
- how the run ended (finished, dollar cap, turn cap, error) with its cost and turns from the log;
- its pull request number, and whether it is a draft (STOPPED);
- the latest commit on the branch, and each check on THAT commit: passed, failed, pending, or never reported. Say how far the branch is behind main;
- the files it changed since it left main (git diff origin/main...HEAD, three dots): any outside the brief's folders, and any existing test edited rather than added;
- lines changed.
Where you cannot tell something (logs expired, no check reported), write "cannot tell", never "passed". Then list the pull requests in the order I should review them, cheapest checks first.You will see recreated screen
- How each run ended, its cost and turns, from the log, not from memory.
- "Cannot tell" is an honest answer. Never let it read as a pass.
- The order to work in: cheapest decisive check first.
Check it worked
You have one row per worker with how it ended, its cost, its pull request, and its checks on its latest commit.
If it goes wrong
A pull request is red, and the red check ran on an older commit or before a fix reached main
Open it on GitHub and choose Update branch (a merge commit, not rebase), then judge only the checks on the new commit. Never re-run old runs.
A worker hit the turn cap and left a branch without a pull request
Its work up to the last push is safe. Decide: if the branch is close, open the pull request yourself (gh pr create --head worktree-night-2 --draft) and read it; if not, split the task in the wave plan and run it again.
You need to see why a worker did something
The log's session ID opens the whole conversation: in ~/code/acme-platform, claude --resume and pick that session. Read it; do not continue it from there.
Send back what fails a cheap check
10 minutesWhy
Most of the morning's time is saved here. A pull request that went outside its folders, changed an existing test or is still red on its latest commit is not worth reading yet. Writing down why on the pull request turns each failure into a better brief for the next night, which is where most failures are really fixed.
Do this
https://github.com/acme-ops/acme-platform/pulls
Open pull requests, in the order from Step 6.
For a pull request that changed an existing test or went outside its folders: comment why and close it. For one still red after updating from main, or a STOPPED draft, start Claude Code in that worker's worktree (the same name reopens it):
claude --worktree night-2Read this worktree's brief (the newest plan in docs/nights/ names it) and its pull request or draft. Do not change anything yet.
Tell me: what exactly failed (quote the error and the commit it ran on), what was tried, whether the cause is in our code or outside it (a service, a permission, a check that ran on an old commit), and whether the brief was unclear. If the branch is behind main, merge origin/main into it (no rebase, no force push), push, and wait for the checks on the new commit before you diagnose anything that is still red. Then propose the smallest fix inside the brief's folders, or the change to the brief, and wait for me.You will see recreated screen
- Red on the latest commit, after updating from main: a real failure, worth diagnosing.
- A plain diagnosis, the weakened test named, and the brief fix. Nothing is changed until you say so.
Check it worked
Every pull request that failed a cheap check has a comment saying why, and is closed, back with a worker, or fixed and green on its latest commit.
If it goes wrong
The worker or Claude Code says the warning is a false positive
Never accept that for a group of warnings. Say: For each one separately, show me the evidence: the request, the response, the line. On our platform, routes dismissed this way were open on production.
The same failure comes back after a fix
Say: Stop. Do not try again yet. Tell me what failed, what you have tried, and whether the cause is in our code or outside it. Two identical failures mean the cause is not what anyone thinks.
Read each change, then merge one at a time
20 minutesWhy
Every change that reaches the plant's platform is read by a person, and the night's work is no exception. Asking the agent to explain its change against the platform's rules turns a page of code into answers you can check against the brief. Merging one at a time, updating each from main and waiting for its checks on the new commit, catches the clash between two good changes before it reaches main.
Do this
For each pull request left, in order, start Claude Code in its worktree (claude --worktree night-1, and so on) and paste:
Explain your pull request to me in plain English, as if to the quality lead: what changed, why, and how I can see it working on the preview. Show only what this branch changed since it left main (git diff origin/main...HEAD, three dots). Then answer Yes or No, with the file and line, for each:
1. Does every change sit inside the brief's folders?
2. Does every acceptance check in the brief have a test, and was each shown failing first?
3. Was any existing test, check or limit changed?
4. Does it add a route or page? If so, is it closed until the role matrix opens it (Session 9's proxy.ts and lib/access/routes.ts)?
5. Does it read data in a way that bypasses the access rules (Session 8), for example with a service key?
6. Does it add a package, or anything that looks like a key?
7. Did it do anything the brief did not ask for?
Do not change anything. If anything you told me earlier turned out to be wrong, say so first.Open its preview on your phone. Owner two approves; merge. For the next pull request, choose Update branch on GitHub, wait for every check on the new commit, ask its agent to confirm nothing it added was lost in the update, and only then merge.
https://github.com/acme-ops/acme-platform/pulls
Open pull requests: merge them one at a time.
You will see recreated screen
- What changed, in the language of the plant, and where to see it.
- Every answer can be checked in Files changed.
- A choice made overnight with nobody to ask, written down as the brief told it to. Decide it now.
Check it worked
Every pull request you kept has been read against the seven questions, opened on a phone, approved by owner two and merged one at a time, green on its latest commit; main's checks are green after the last merge.
If it goes wrong
Update branch reports conflicts
Two workers touched the same file after all. In that worker's worktree: Merge origin/main into this branch, resolve the conflicts keeping both changes, run the tests, push and explain each conflict in plain words. No rebase, no force push. Then fix the Owners table in docs/waves.md.
After an update, something this branch added has vanished
An undo on main took it with it; no conflict is reported. Say: List every file and test this branch added and confirm each is still there. If any disappeared, find the commit that removed it and tell me before changing anything.
Question 4 or 5 is answered Yes
Do not merge. A new route that is open, or a read that skips the access rules, is the most serious finding a review can make. Send it back with the answer quoted, and add the case to the brief template.
Close the night
5 minutesWhy
The night is not finished until its cost and outcome are written down and the lessons are in the briefs. After a week the ledger tells you your own merge rate and cost per merged change, which beats any estimate. Removing the night's worktrees means tomorrow's workers start from a clean main, under the same names.
Do this
On a new branch night/morning, add a "Morning" section to the newest plan in docs/nights/: for each worker, how its run ended, its cost and turns, its pull request, and merged, closed or sent back with the reason. Add one row per worker to docs/fleet-ledger.md, with my review minutes: <paste per worker>, and update the cost per merged change. For one pull request I sent back, rewrite its brief in docs/briefs/ so the same failure cannot happen again, keeping the old wording in a "Before" note with one sentence on why it changed. Open a pull request titled "Morning review" with the night's date and wait for the checks.Then, for each night worker whose pull request is merged or closed (change the 1 for each), in ~/code/acme-platform:
git worktree unlock .claude/worktrees/night-1
git worktree remove .claude/worktrees/night-1
git branch -D worktree-night-1You will see recreated screen
- The plan and its outcome on one page, dated.
- Runs that did not merge are counted: they are part of the cost of the one that did.
- The number to beat tomorrow.
Check it worked
The night's plan has its Morning section, the ledger has a row per worker, one brief is rewritten with its Before note, and git worktree list shows only your main folder.
If it goes wrong
git worktree remove refuses: the worktree has changes
Check its work is on GitHub (its branch, or the pull request). If it is, run the remove again with --force. If it is not, push it first. Never force-remove work that exists nowhere else.
The cost per merged change is rising night after night
Look at the merge rate and the Notes column: the same failure twice is a brief problem. Run fewer workers with sharper briefs until the merge rate recovers.
Knowledge check
A pull request's checks are green, but Files changed shows an existing test was edited. What do you do?
Knowledge check
Two pull requests were green last night. Why not merge both straight away?
References
- GitHub Docs: About status checks. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks
- GitHub Docs: Keeping your pull request in sync with the base branch. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/keeping-your-pull-request-in-sync-with-the-base-branch
- Google Engineering Practices: The standard of code review. https://google.github.io/eng-practices/review/reviewer/standard.html
- Claude Code docs: Run parallel sessions with worktrees (clean up). https://code.claude.com/docs/en/worktrees
Chapter 4 · 12 questions · 80% passes
Final assessment
Twelve questions across the element. Score 80% (10 of 12) to pass. Your LMS records your score and each answer; you can review the chapters and try again.
15 min12 questions≈ 15 minutesRetake allowed
Your result
CivOps AI Academy
AI Fleet: The Overnight Build and the Morning Review
Element F16 complete · Learner
Your LMS records this completion. For the CivOps Foundation certificate, finish the Foundation Course at https://civops.io/learn.