Guide 06 · Workflow
Overnight batch, one morning overview
Several agents work on separate branches while you are away. In the morning you read one overview and decide what goes into main.
What it is for
Some tasks do not need you at every step: several pages, guides or fixes that do not depend on each other. Here the evening ends with a batch of such tasks, each on its own branch in its own worktree, and agents work on them through the night. In the morning, one agent has merged the branches into an integration branch and written one overview: what is done, what is verified and what you need to decide. Nothing reaches main, the remote or production until you say so.
Each task in the batch still goes through plan, review, implement from guide 02, or gets a short brief if the change is small. This guide covers what sits around several tasks at once. There are four roles:
- You: the request, the choices before the night, the decisions in the morning.
- Control session: the batch contract, the briefs, starting and ending sessions, the merge into main after your decision.
- Workers: one branch each, one report each.
- Integration agent: merges the branches, checks the merged result, writes the overview.
What you need
- Git with worktrees. We use 2.52.
- An agent CLI that runs one session per worktree in a terminal. We use OMP and start the sessions with Orca; guide 02 shows those commands. The git commands below work without Orca.
- Tasks that can each stay in their own folder.
- A folder outside the repo for the contract, the briefs and the reports.
We have not tested other agent CLIs with this workflow. If agent sessions are new to you, start with the basics guide.
Steps
-
You: settle the request before you leave
Write down what you want in your own words. Answer the choices that would block the night before you go. In one of our batches, that was whether a demo agent should call a real model or give scripted answers. Everything else comes back as questions in the morning.
-
Control session: write the batch contract
One shared file that every session reads first. It holds your request word for word, the state of the repo with its commit, the labels for claims, the one folder each branch may write to, the files only integration changes, what nobody does tonight, the checks each branch runs and the shape of the report. Each branch runs its own local server, so each gets its own port.
illustrative # Batch contract: night of Nov 4 Read this first. It applies to every session in the batch. Request, word for word: "prepare a few guides tonight" Repo: main = origin/main = a1b2c3d. Labels on claims: VERIFIED (source), INFERRED, UNVERIFIED. Branch Only folder it may write Port night/hooks site/guides/hooks/ 8105 night/skills site/guides/skills/ 8106 night/integration everything 8109 Only integration changes: site/index.html, site/guides/index.html. A link to another branch's page may 404 on your branch. Nobody pushes, merges into main or deploys. Stage files by name. Temporary files go to one scratch folder per branch. Checks: static checks, HTTP status, browser at 1440 and 390 px. Report: branch and hash, actual check output, verified locally / against the real boundary / unverified, questions for the owner.In one night batch, four branches with separate folders went into the integration branch without a conflict.
-
Control session: one short brief per branch
Each brief points to the contract and adds the goal, what is out of scope and the claims it relies on. Each claim is marked verified (with its source), inferred or unverified. In one of our runs, workers used the labels to check inferred claims before building on them and corrected two. Send the agent a one-line pointer to the brief, as in guide 02.
illustrative # PLAN: night/hooks Read the batch contract first: briefs/night-11-04/contract.md Goal: a guide to hook types, one tested example for each. Out of scope: other folders, shared files, push, deploy. Claims: - main is a1b2c3d, same as origin/main. VERIFIED (git rev-parse) - The site has no build step. VERIFIED (no package.json) - Readers know what a git hook is. INFERRED - Hook X can block a tool call. UNVERIFIED, check the docs Return decisions this brief does not settle as question, recommendation, impact. Last line of your report: PLAN DONE: path to the prompt -
Control session: one worktree per branch, all from the same base
Every branch, the integration branch too, starts from the same commit. Keep a small table of branch, worktree, session and phase, and update it when a phase changes.
real commands · branch names and paths are illustrative git fetch origin git worktree add --no-track -b night/hooks ../night-hooks origin/main git worktree add --no-track -b night/skills ../night-skills origin/main git worktree add --no-track -b night/integration ../night-integration origin/mainWithout
--no-track, Git 2.52 set each new branch to trackorigin/mainin our test. -
Worker: report in a fixed shape
Each worker writes its report to a file in the reports folder: branch and hash, files, the actual output of each check, what is verified locally, what is verified against the real boundary (the live service, the real API) and what is not verified, and its questions as question, recommendation and impact. While they work, workers do not touch shared files such as the changelog or the roadmap; they return a report. Entries in shared files come only once the branch's work is done. The control session ends a worker's session as soon as it is no longer needed.
-
Integration agent: merge, link, check, write the overview
A separate agent in the integration worktree does this, not the control session. First it checks that each branch stayed in its folder. Then it merges the branches in the order the contract gives and stops on any conflict that is not mechanical. It adds the links between new pages that the contract kept for integration and runs the checks again on the merged result. A branch you have not decided on gets only a trial merge, which touches no working tree.
real commands · branch names and paths are illustrative # Files a branch changed outside its folder. Expect no output. git diff --name-only origin/main...night/hooks -- . ':(exclude)site/guides/hooks/' # In the integration worktree, in the contract's order. git merge --no-ff -m "merge night/hooks" night/hooks git merge --no-ff -m "merge night/skills" night/skills # Trial merge of an undecided branch. Exit status 1 means a conflict. git merge-tree --write-tree --name-only night/integration night/paletteLast, it writes the overview and commits it on the integration branch: one section per branch, then the decisions grouped by topic, each with a recommendation.
illustrative # Morning overview, Nov 4 Integration: night/integration (e4f5a6b). Nothing pushed or deployed. Checked locally only. Nothing against the live site. ## night/hooks (b7c8d9e, merged) Brings: /guides/hooks/, three hook types, one example each Verified: examples run in a scratch repo; 1440 and 390 px, no errors Not verified: Safari, Firefox ## night/palette (f0a1b2c, not merged) Trial merge on top of integration: clean, changes index.html only ## Decisions 1. Publish lessons from our own incidents? Recommendation: yes, in general terms, without repo names. Impact if no: the "watch out" sections keep only rules. -
You: decide in the morning
Read the overview, answer the decisions and say what goes into main. In our setup the control session then merges the integration branch in the repo's main checkout and pushes. Deploying is a separate decision. Small follow-ups go to one session as short briefs. Every change to the integration branch makes earlier trial merges stale, so run them again.
How to check it works
git worktree listshows one worktree per branch and one for integration.- The scope check from step 6 prints nothing for every branch.
git log --oneline origin/main..night/integrationincludes one merge per branch and the overview commit.- Before your decision,
git fetch originand thengit rev-parse origin/mainstill print the commit named in the contract: nothing reached the remote overnight. - The overview has a section for every branch with what is verified and what is not, and every decision has a recommendation and an impact.
What to watch out for
-
observed Oct 19, 2026
Four branches, four test counts, none valid after the merge
Four workers ran at the same time, and each wrote its own entry into the same three shared files: the changelog, the roadmap and the session log. Each of the three later merges conflicted in all three files. Each entry also reported test counts for its own branch (573 to 580); the merged result had 591. In the next run, the session record was written once, after the merge: only the append-only log conflicted, and the test counts came from the merged result.
-
observed Oct 31, 2026
The control session did the integration itself
Our rule let the control session do only the final merge into main, in the repo's main checkout. It merged worker branches into an integration branch in a new worktree anyway. A second model that watches the control session caught it after four merges, and an agent started in the integration worktree took over. Integration is its own step with its own agent.
-
observed Oct 31, 2026
Seventeen checks passed; the brief was wrong
A person asked for one more screen in a demo. The control session added its own reading to the brief: the new screen shares a thread and an input field with an existing one. PLAN wrote it up, IMPL built it, and all 17 acceptance checks passed, because they checked the brief. The person sent it back. Review had compared the prompt with the brief, not with the person's words. That is why the contract quotes the request word for word.
-
observed Oct 17, 2026
Green tests, nothing happened
The whole test suite passed and the endpoint returned 200, but in production nothing was scheduled. The tests mocked the call to the external service, so its rejection never showed. A report that says only that the tests pass hides this. It has to say what was checked against the real service and what was not.
-
observed Oct 31, 2026
Sessions left open
The control session closed only 40 to 60 percent of worker sessions, and late. With several branches at once, open sessions pile up. End each one as soon as it is no longer needed.
-
observed Nov 4, 2026
A trial merge went stale
At night, the undecided branch merged cleanly on top of the integration branch. After a small fix on the integration branch in the morning, the same trial merge gave one conflict. Run trial merges again after every change.
Sources
AGENTS.mdin GhostFactory's knowledge repo (K-B), section “Control harness”- The batch contracts, briefs and morning overview behind this site, Nov 4, 2026
- K-B sprint notes and project notes, Oct 17 to Nov 1, 2026
- Git 2.52:
git help worktree,git help diff,git help merge-tree