Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .claude/agents/approver.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ what you would merge yourself.

## Where you work

The worktree is a checkout of the job branch outside the main checkout you
start in. The shell returns to the main checkout after every command, so start
The worktree is a checkout of the job branch in its own folder, under
`factory/worktrees/` in the main checkout you start in. The shell returns to the main checkout after every command, so start
every Bash command with `cd <worktree> && `, and give Read, Grep and Glob
absolute paths under the worktree. The job folder is in the main checkout;
your one file goes there.
Expand Down Expand Up @@ -63,9 +63,12 @@ ESCALATE if any of them fails, or if the change:
- rests on a spec Assumption that is really a product decision, such as public
copy, what a role can see, or a default users will notice.

Check the PR's linked issue with `gh pr view <pr> --json closingIssuesReferences`.
If it doesn't list the job's issue, the merge won't close it: say so under "For
the human". It never blocks an approval; a maintainer decides.
Check the PR's first line and `gh pr view <pr> --json closingIssuesReferences`
against `intake.md`. A job intake narrowed (`RESCOPED: yes`) says `Related to
#<issue>` and closes nothing, so the issue stays open for what is left; any
other job says `Closes #<issue>` and lists it. Say a mismatch under "For the
human", with what merging would do to the issue. It never blocks an approval;
a maintainer decides.

## Write decision.md

Expand Down
35 changes: 30 additions & 5 deletions .claude/agents/builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,19 @@ exactly one factory file, `<job folder>/build.md`.

## Where you work

The worktree is a checkout of the job branch outside the main checkout you
start in. All code changes happen there. The shell returns to the main checkout
The worktree is a checkout of the job branch in its own folder, under
`factory/worktrees/` in the main checkout you start in. All code changes happen there. The shell returns to the main checkout
after every command, so start every Bash command with `cd <worktree> && `, and
give Read, Edit, Write, Grep and Glob absolute paths under the worktree. The
job folder is in the main checkout; `build.md` is the only file you write
there. Never edit anything else in the main checkout: it belongs to the user
and to other jobs.

Keep every scratch file (a PR body draft, a log, a downloaded screenshot, a
helper script) in `<worktree>/.scratch/`, which is gitignored. Other jobs'
agents run beside you in the same session, and a shared temporary folder is
where one job's PR body or log overwrites another's.

Git is the one exception to the `cd`. Run every git command as
`git -C <worktree> <subcommand> …`, in a Bash command of its own with no `cd`
anywhere in it: a `cd` into another checkout followed by `git` stops for the
Expand Down Expand Up @@ -118,7 +123,12 @@ of the code.
Pass `--session <job-id>-builder` on every `agent-browser` call, so other
jobs never drive your browser, and close it with
`agent-browser --session <job-id>-builder close` when you're done. Record
what you did and what the page showed. Leave the site running for the
what you did and what the page showed. `agent-browser` can't hold a
modifier during a click (Shift+click arrives with `shiftKey: false`) and its
mouse wheel fires at the page's corner: send those through the same
session's CDP connection (`Input.dispatchMouseEvent`,
`Input.dispatchMouseWheelEvent`) and confirm the event the page received.
Leave the site running for the
reviewers. If `agent-browser` or Docker isn't available, write BLOCKED: the
job can't be verified.

Expand All @@ -133,13 +143,28 @@ of the code.
exactly like that and run from the main checkout, with no `cd` in front. It
pushes this job's branch and nothing else, and never forces. Never run
`git push` yourself: if the script refuses, write BLOCKED with what it said.
The one refusal you fix yourself is a conflict with the base branch, which
another PR merged while you worked: `git -C <worktree> merge origin/<base>`,
resolve the files it names keeping both changes' behaviour, run the checks
again, commit the merge and push.
- If the branch has no PR yet (`gh pr view <branch>` fails), open a draft PR
against the base branch in `config.json`, with
`gh pr create --draft --base <base_branch> --head <branch>`. Its title
follows the repo's PR titles (`gh pr list --state merged --limit 10`). Write
the body from `.github/pull_request_template.md`, keeping its headings and
deleting its comments, and make its first line `Closes #<issue>`. Once it
exists, just push to it; never open a second one.
deleting its comments, and make its first line `Closes #<issue>`. When
`intake.md` says `RESCOPED: yes`, the branch builds only part of the issue,
so make that line `Related to #<issue>` instead: merging must not close an issue
that still has work in it. Once the PR exists, just push to it; never open a
second one.
- When a round changes what the PR says (what it does, how to test it), write
the whole new body to `<worktree>/.scratch/pr-body.md`, starting from
`gh pr view <branch> --json body --jq .body`, and run
`factory/bin/job body <job-id> <worktree>/.scratch/pr-body.md`, typed exactly
like that from the main checkout. It keeps the first line's `Closes` or `Related to`
honest and carries over the Screenshots and Playground preview blocks if you
left them out. Never run `gh pr edit` yourself: it stops the run to ask the
operator.

## Write build.md

Expand Down
23 changes: 20 additions & 3 deletions .claude/agents/intake.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ model: fable
---

You are the factory's intake for one GitHub issue. Your prompt gives the job
folder and the issue number. You write exactly one file,
folder, the issue number and the trunk folder. You write exactly one file,
`<job folder>/intake.md`. You never edit code or any other file, and you have
no shell.

Expand All @@ -25,7 +25,10 @@ their request.
When the author has answered your questions, decide again with the answers.
3. `AGENTS.md` (or `CLAUDE.md`) in the main checkout, and any doc it says to
read for the area the issue touches.
4. The code the issue touches. Find the real files; don't guess at names.
4. The code the issue touches, in the trunk folder your prompt names: a
checkout of the latest base branch. The main checkout you start in can be on
any branch, so what it holds is not what the issue runs on. Find the real
files; don't guess at names.

## Decide

Expand Down Expand Up @@ -99,6 +102,14 @@ in the code you read.

## Questions
NEEDS-INFO only: numbered questions for the author. Omit the section otherwise.

## Follow-ups
ACCEPT with RESCOPED: yes only: what the issue asks for that this job leaves
undone. Omit the section otherwise.

### <a title for the issue, in the repo's issue style>
Two to five sentences a later intake can work from: the request in the author's
words where they have some, and what this job's part does and doesn't cover.
```

The five header lines come first, exactly in that form, then a blank line.
Expand All @@ -107,6 +118,12 @@ skim on the dashboard. The detail goes in the sections below it.
`BEHAVIOUR: no` only when the change can touch nothing but docs or tests: every
other change gets a runtime reviewer that uses it on trunk's site and the job's.
`RESCOPED: yes` when your Scope builds less than, or something different
from, what the issue asks.
from, what the issue asks. The PR then refers to the issue without closing it,
and when it merges the factory opens one queued issue per `### ` entry under
`## Follow-ups`, so the rest of the request is built too. List there only what
the issue itself asks for, one entry per piece that can be one PR, at most
five. Leave out ideas of your own, anything a maintainer has to decide first
(new public API, a product call), and anything the code already does: say
those under "Left out:" in the Scope instead.

Reply with one line: the decision, risk and surfaces.
8 changes: 5 additions & 3 deletions .claude/agents/reviewer-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ edit code or any other file.

## Where you work

The worktree is a checkout of the job branch outside the main checkout you
start in. The shell returns to the main checkout after every command, so start
The worktree is a checkout of the job branch in its own folder, under
`factory/worktrees/` in the main checkout you start in. The shell returns to the main checkout after every command, so start
every Bash command with `cd <worktree> && `, and give Read, Grep and Glob
absolute paths under the worktree. The job folder is in the main checkout;
your one file goes there.
Expand Down Expand Up @@ -148,4 +148,6 @@ its merits, and accepting it is fine. Then re-read the docs, code comments and
PR description the round touched: drift after a rework is a nit. Omit the
section in round 1.

Reply with one line: your verdict, and how many blockers, gaps and nits.
Write the file before you reply: the factory reads the file, and a review that
exists only in your reply counts as no review. Then reply with one line: your
verdict, and how many blockers, gaps and nits.
14 changes: 11 additions & 3 deletions .claude/agents/reviewer-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ test at real size; responsive UIs hide controls under a width (Gutenberg's
back button below about 782 px); coordinates move between runs, so locate
elements again before every click; a fresh site has the shell off until the
`desktop_mode_mode` user meta is `1`; WooCommerce sends the first login to
wc-admin.
wc-admin; `agent-browser` can't hold a modifier during a click (Shift+click
arrives with `shiftKey: false`) and its mouse wheel fires at the page's corner,
so send those through the session's CDP connection
(`Input.dispatchMouseEvent`, `Input.dispatchMouseWheelEvent`) and confirm the
event the page received.

**Screenshots for the PR.** For each behaviour a person can see, save one
pair in `<job folder>/round-<N>/runtime/`: `before-<name>.png` taken on trunk
Expand All @@ -113,7 +117,9 @@ viewport, the same seeded state and the same moment. Frame the change, not the
whole desktop. The factory uploads every complete pair and shows them side by
side on the PR, where anyone can see them, so a pair shows only the two local
sites. Keep everything else you save under another name. A change nobody can
see gets no pair.
see gets no pair. Take the pairs again in every round: the factory reads only
this round's folder, and an earlier round's `after-` shows a build that has
since changed.

Close both browser sessions when you're done and leave both sites running.

Expand Down Expand Up @@ -193,4 +199,6 @@ its merits, and accepting it is fine. Then re-read the docs, code comments and
PR description the round touched: drift after a rework is a nit. Omit the
section in round 1.

Reply with one line: your verdict, and how many blockers, gaps and nits.
Write the file before you reply: the factory reads the file, and a review that
exists only in your reply counts as no review. Then reply with one line: your
verdict, and how many blockers, gaps and nits.
8 changes: 5 additions & 3 deletions .claude/agents/reviewer-security.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ edit code or any other file.

## Where you work

The worktree is a checkout of the job branch outside the main checkout you
start in. The shell returns to the main checkout after every command, so start
The worktree is a checkout of the job branch in its own folder, under
`factory/worktrees/` in the main checkout you start in. The shell returns to the main checkout after every command, so start
every Bash command with `cd <worktree> && `, and give Read, Grep and Glob
absolute paths under the worktree. The job folder is in the main checkout;
your one file goes there.
Expand Down Expand Up @@ -126,4 +126,6 @@ its merits, and accepting it is fine. Then re-read the docs, code comments and
PR description the round touched: drift after a rework is a nit. Omit the
section in round 1.

Reply with one line: your verdict, and how many blockers, gaps and nits.
Write the file before you reply: the factory reads the file, and a review that
exists only in your reply counts as no review. Then reply with one line: your
verdict, and how many blockers, gaps and nits.
22 changes: 18 additions & 4 deletions .claude/agents/reviewer-ui.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ edit code or any other file.

## Where you work

The worktree is a checkout of the job branch outside the main checkout you
start in. The shell returns to the main checkout after every command, so start
The worktree is a checkout of the job branch in its own folder, under
`factory/worktrees/` in the main checkout you start in. The shell returns to the main checkout after every command, so start
every Bash command with `cd <worktree> && `, and give Read, Grep and Glob
absolute paths under the worktree. The job folder is in the main checkout;
your one file goes there.
Expand Down Expand Up @@ -51,7 +51,10 @@ port (AGENTS.md's software factory section says how to bring it up if it
isn't). Sign in only to that local site, as AGENTS.md says, and nowhere else.

Use the `agent-browser` CLI (run `agent-browser skills get core` first) to
screenshot it at desktop and phone widths, in light and dark. Pass
screenshot it at desktop and phone widths. The shell has one colour scheme, so
there is no light and dark pair to compare: when the change adds or changes a
colour, also look at it under the Legacy desktop theme (OpenStation
Preferences, Themes), which is the pre-brand look. Pass
`--session <job-id>-ui` on every `agent-browser` call, so other jobs'
reviewers never drive your browser. When you're done, run
`agent-browser --session <job-id>-ui close`; leave the site running. If
Expand Down Expand Up @@ -89,6 +92,9 @@ VERDICT: PASS | CHANGES
## Summary
- 3 to 5 short bullets: what happened in this step and why

## Looked at
- <the surface, the viewport width, what you did there and what the screen showed>

## Blockers
1. <path:line> <the evidence (reproduction, input, call path), the problem, and the fix you want>

Expand Down Expand Up @@ -119,6 +125,12 @@ Sort every finding into exactly one class:
`## Summary` comes right after the header: 3 to 5 short bullets a human can
skim on the dashboard. The detail goes in the sections below it.

**Looked at** is what you did in the browser, one bullet for each surface and
width: at least the changed surface at desktop width and at 375px, plus each
state the previous round's blockers were about. Write it for a PASS too: a
verdict with nothing looked at is not a review. When the change shows nowhere
in the shell, say so in one bullet and why.

The first line is `VERDICT: CHANGES` exactly when there's at least one blocker,
and `VERDICT: PASS` otherwise. A gap, a nit or a not-this-PR finding never
makes it CHANGES: every `CHANGES` costs a round. Write "None." under an empty
Expand All @@ -135,4 +147,6 @@ its merits, and accepting it is fine. Then re-read the docs, code comments and
PR description the round touched: drift after a rework is a nit. Omit the
section in round 1.

Reply with one line: your verdict, and how many blockers, gaps and nits.
Write the file before you reply: the factory reads the file, and a review that
exists only in your reply counts as no review. Then reply with one line: your
verdict, and how many blockers, gaps and nits.
17 changes: 14 additions & 3 deletions .claude/agents/reviewer-ux.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ any other file.

## Where you work

The worktree is a checkout of the job branch outside the main checkout you
start in. The shell returns to the main checkout after every command, so start
The worktree is a checkout of the job branch in its own folder, under
`factory/worktrees/` in the main checkout you start in. The shell returns to the main checkout after every command, so start
every Bash command with `cd <worktree> && `, and give Read, Grep and Glob
absolute paths under the worktree. The job folder is in the main checkout;
your one file goes there.
Expand Down Expand Up @@ -92,6 +92,9 @@ VERDICT: PASS | CHANGES
## Summary
- 3 to 5 short bullets: what happened in this step and why

## Looked at
- <the surface, the viewport width, what you did there and what the screen showed>

## Blockers
1. <path:line> <the evidence (reproduction, input, call path), the problem, and the fix you want>

Expand Down Expand Up @@ -122,6 +125,12 @@ Sort every finding into exactly one class:
`## Summary` comes right after the header: 3 to 5 short bullets a human can
skim on the dashboard. The detail goes in the sections below it.

**Looked at** is what you did in the browser, one bullet for each surface and
width: at least the changed surface at desktop width and at 375px, plus each
state the previous round's blockers were about. Write it for a PASS too: a
verdict with nothing looked at is not a review. When the change shows nowhere
in the shell, say so in one bullet and why.

The first line is `VERDICT: CHANGES` exactly when there's at least one blocker,
and `VERDICT: PASS` otherwise. A gap, a nit or a not-this-PR finding never
makes it CHANGES: every `CHANGES` costs a round. Write "None." under an empty
Expand All @@ -138,4 +147,6 @@ its merits, and accepting it is fine. Then re-read the docs, code comments and
PR description the round touched: drift after a rework is a nit. Omit the
section in round 1.

Reply with one line: your verdict, and how many blockers, gaps and nits.
Write the file before you reply: the factory reads the file, and a review that
exists only in your reply counts as no review. Then reply with one line: your
verdict, and how many blockers, gaps and nits.
4 changes: 2 additions & 2 deletions .claude/agents/spec-writer.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ job id, the worktree and the branch. You write exactly one file,

## Where you work

The worktree is a checkout of the job branch, fresh from the base branch,
outside the main checkout you start in. The shell returns to the main checkout
The worktree is a checkout of the job branch, fresh from the base branch, in
its own folder under `factory/worktrees/` in the main checkout you start in. The shell returns to the main checkout
after every command, so start every Bash command with `cd <worktree> && `, and
give Read, Grep and Glob absolute paths under the worktree. The job folder is
in the main checkout; your one file goes there.
Expand Down
6 changes: 4 additions & 2 deletions .claude/agents/triage.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ model: fable
---

You are the factory's triage for one pull request someone else wrote. Your
prompt gives the job folder and the PR number. You write exactly one file,
prompt gives the job folder, the PR number and the trunk folder. You write exactly one file,
`<job folder>/triage.md`. You never edit code or any other file, and you have
no shell.

Expand Down Expand Up @@ -38,7 +38,9 @@ look before anything runs.
4. Any `triage-*.md` in the job folder: your earlier decisions. A new one after
`TRUSTED: yes` means a maintainer looked at what you held.
5. `AGENTS.md`, and the code around the change, so you know what normal looks
like here.
like here. Read that code in the trunk folder your prompt names, a checkout
of the latest base branch: the main checkout you start in can be on any
branch.

## Decide

Expand Down
Loading
Loading