loopwright 0.1.11 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ Plan runs in this main thread. You state assumptions; the user decides. Do not e
8
8
 
9
9
  ## Setup
10
10
 
11
- Before your first message to the user, read `{{LW_HOME}}/prompts/user-messages.md` unless you already read it in this conversation, and write every message to the user by it.
11
+ Before your first message to the user, read `{{LW_HOME}}/prompts/user-messages.md` and `{{LW_HOME}}/prompts/glossary.md` unless you already read them in this conversation, and write every message to the user by them, using one term for each idea.
12
12
 
13
13
  1. Run every loopwright command from the worktree root: `cd "$(git rev-parse --show-toplevel)"`.
14
14
  2. `node "{{LW_HOME}}/hooks/lw.mjs" dir` prints the `.loopwright` directory (`<lw>` below). `null` inside a git repo → no task has started here yet; `lw.mjs start` (section 3) creates `.loopwright/`, so continue with a new task. Not a git repo → tell the user loopwright must run inside a git repo, stop.
@@ -18,8 +18,8 @@ Before your first message to the user, read `{{LW_HOME}}/prompts/user-messages.m
18
18
  - `stage: plan` → resume this plan: the first `— pending` item under `## Open questions`, else the proposal (step 6), else the confirmation (step 7). If the user says this plan is abandoned, offer to start the new one with `start tasks/<new file>.md --force` (the old task file stays).
19
19
  - past `plan` → the task is in progress; tell the user to continue it with `/loopwright-flow`. Do not start a second here; a new goal follows "Goal intake".
20
20
  4. `node "{{LW_HOME}}/hooks/lw.mjs" config` prints the main checkout's config; read `maxFixRounds` from it (missing key → 3).
21
- 5. `git status --porcelain` not empty → uncommitted changes will be part of the reviewed diff. Ask the user whether to commit/stash them first or include them; record the answer as a decision once the task file exists.
22
- 6. Upstream check: `GIT_TERMINAL_PROMPT=0 git fetch --quiet` (never prompts for credentials; it fails offline or without auth → skip this check). Then list `git log --oneline HEAD..@{u}`; with no upstream, use `HEAD..origin/HEAD`; with neither, skip. Repeat in any sibling repo the goal touches (e.g. a separate frontend repo). New upstream commits → tell the user and ask whether to pull first. A commit or branch that already touches the goal's feature → ask whether someone has already done this work. Record the answers as decisions once the task file exists.
21
+ 5. `git status --porcelain` not empty → uncommitted changes will be part of the reviewed diff. Ask the user whether to commit/stash them first or include them; record the answer once the task file exists, with `node "{{LW_HOME}}/hooks/lw.mjs" add decision --tag asked <<'LW_TEXT'`, the decision on the next line, then `LW_TEXT`.
22
+ 6. Upstream check: `GIT_TERMINAL_PROMPT=0 git fetch --quiet` (never prompts for credentials; it fails offline or without auth → skip this check). Then list `git log --oneline HEAD..@{u}`; with no upstream, use `HEAD..origin/HEAD`; with neither, skip. Repeat in any sibling repo the goal touches (e.g. a separate frontend repo). New upstream commits → tell the user and ask whether to pull first. A commit or branch that already touches the goal's feature → ask whether someone has already done this work. Once the task file exists, record each answer with `node "{{LW_HOME}}/hooks/lw.mjs" add decision --tag asked <<'LW_TEXT'`, the decision on the next line, then `LW_TEXT`.
23
23
 
24
24
  ## Goal intake
25
25
 
@@ -40,14 +40,14 @@ First step, before any question or message: if `node "{{LW_HOME}}/hooks/lw.mjs"
40
40
 
41
41
  ## Parked stubs
42
42
 
43
- Invoked without a goal (and no active task) → run `grep -l "^status: proposed" <lw>/tasks/*.md` and list the stubs `/loopwright-park` left, one line each (title, `kind`, `found while`, `blocks`). Offer: start one, drop one, or a new task. Drop → set `status: dropped` in the stub; never delete it. Start → treat the stub as an imported spec: run `start tasks/<stub>.md`, and fill that same file in place (status `active`, the Plan template's header lines and sections) instead of creating a second file. Keep its `kind`, `found while` and `blocks` lines. Unlike an imported spec, its goal is confirmed before the scout (section 1); its `## Evidence` is a lead for the scout, not a verified fact.
43
+ Invoked without a goal (and no active task) → run `grep -lE "^([^ ]+ )?status: proposed" <lw>/tasks/*.md` and list the stubs `/loopwright-park` left, one line each (title, `kind`, `found while`, `blocks`). Offer: start one, drop one, or a new task. Drop → run `node "{{LW_HOME}}/hooks/lw.mjs" set status dropped --file tasks/<stub>.md`; never delete it. Start → treat the stub as an imported spec: run `start tasks/<stub>.md` (no title on stdin; it turns that same file into the task file in place, keeping its title, `kind`, `found while`, `blocks`, Goal and Evidence) instead of creating a second file. Unlike an imported spec, its goal is confirmed before the scout (section 1); its `## Evidence` is a lead for the scout, not a verified fact.
44
44
 
45
45
  ## 1. Input
46
46
 
47
47
  - A goal in the user's words, or a path to an imported spec/plan (e.g. from superpowers).
48
- - Restate the goal first, on every task with a typed goal, a bug report or a parked stub's goal, before the scout runs. Say in your own plain words what the user wants and what will change, and ask it as one question in the format of section 4: the user must confirm or correct it before you go on. In the same prompt as the restatement, ask which effort profile the task runs at (lean: trivial or mechanical; balanced: most tasks; thorough: cross-module or risky; deep: major refactors), the recommended profile first. The recommendation is your best guess from the restatement, and `balanced` when it does not show the size; the user has the last say and may confirm or change it. A corrected restatement asks both again. A goal with more than one reading lists the readings as options in the same question. Never skip it because the goal looks clear or obvious. A bug is restated in one sentence, observed and expected; its evidence intake stays after the scout. An imported spec skips the restatement but still gets the profile question on its own before its scout; a reopened plan skips both and asks nothing about the profile, since its header already has one. The confirmed restatement becomes the task file's `## Goal` paragraph and is recorded as an `[asked]` decision once the task file exists. No `await-user` here: no task state exists yet.
48
+ - Restate the goal first, on every task with a typed goal, a bug report or a parked stub's goal, before the scout runs. Say in your own plain words what the user wants and what will change, and ask it as one question in the format of section 4: the user must confirm or correct it before you go on. In the same prompt as the restatement, ask which effort profile the task runs at (lean: trivial or mechanical; balanced: most tasks; thorough: cross-module or risky; deep: major refactors), the recommended profile first. The recommendation is your best guess from the restatement, and `balanced` when it does not show the size; the user has the last say and may confirm or change it. A corrected restatement asks both again. A goal with more than one reading lists the readings as options in the same question. Never skip it because the goal looks clear or obvious. A bug is restated in one sentence, observed and expected; its evidence intake stays after the scout. An imported spec skips the restatement but still gets the profile question on its own before its scout; a reopened plan skips both and asks nothing about the profile, since its header already has one. Once the task file exists, the confirmed restatement becomes its `## Goal` paragraph (`node "{{LW_HOME}}/hooks/lw.mjs" section Goal --set`, the text on stdin through a quoted heredoc) and is recorded as an `asked` decision. No `await-user` here: no task state exists yet.
49
49
  - Called from `/loopwright-fix` → `kind: fix`; read "Fix tasks" below. Otherwise `kind: feature`.
50
- - A goal that looks like a bug, without `/loopwright-fix` → never switch silently. After the restatement, ask one question (format of section 4), recommendation first: "Run this as a fix (repro test first)?" Yes → `kind: fix`; no → `kind: feature`. Record the answer as a decision once the task file exists.
50
+ - A goal that looks like a bug, without `/loopwright-fix` → never switch silently. After the restatement, ask one question (format of section 4), recommendation first: "Run this as a fix (repro test first)?" Yes → `kind: fix`; no → `kind: feature`. Once the task file exists, record the answer with `node "{{LW_HOME}}/hooks/lw.mjs" add decision --tag asked <<'LW_TEXT'`, the decision on the next line, then `LW_TEXT`.
51
51
  - Imported spec: read it fully. Do not interview from scratch; run the assumption pass over it. What the spec states explicitly becomes a decision tagged `batch-confirmed` once the user confirms the batch; what it leaves implicit goes in the ledger.
52
52
 
53
53
  ## 2. Scout
@@ -62,7 +62,13 @@ List every assumption you would otherwise make silently, one line each: `A<n> [h
62
62
  - **low-impact**: everything else (internal naming, file placement following an existing pattern, minor edge-case choices).
63
63
  - Cover: scope in/out, behavior and edge cases, interfaces and paths, error handling, compatibility, how it is tested (no test runner in the repo → high-impact), docs to update, extending an existing mechanism (the scout's `Mechanisms` line) vs adding something new. Behavior that differs by environment, deployment or tenant is high-impact unless it extends a mechanism the scout found.
64
64
 
65
- Show the user the whole ledger in one compact message, as a numbered list in plain words following the rules file: each item says what is assumed and what a wrong guess would change, with its label (`A<n>`, a path) in brackets after. The same goes for the decisions whenever you show them: a plain numbered list. The task file keeps its `A<n>`, `D<n>` and `AC<n>` line shapes unchanged, because hooks read them. Then run `node "{{LW_HOME}}/hooks/lw.mjs" start tasks/<file>.md` (path relative to `<lw>`; if `dir` printed `null`, this creates `.loopwright/`, so run `dir` again for `<lw>`) and create the task file (see Task file) with status `active`, stage `plan` and `plan: draft`, and the profile chosen before the scout in `profile:`. Copy `baseCommit`, `worktree` and `branch` from its output into the header. Put every unresolved ledger line under `## Open questions` with `— pending`; move each to Decisions or Assumptions as it is resolved, so a resumed session knows what is still open. Starting early lets the hooks restore this task after compaction; it builds nothing.
65
+ Show the user the whole ledger in one compact message, as a numbered list in plain words following the rules file: each item says what is assumed and what a wrong guess would change, with its label (`A<n>`, a path) in brackets after. The same goes for the decisions whenever you show them: a plain numbered list. The task file keeps its `A<n>`, `D<n>` and `AC<n>` line shapes unchanged, because hooks read them. Then create the task file with `start`, the title on stdin through a quoted heredoc (path relative to `<lw>`; if `dir` printed `null`, this creates `.loopwright/`, so run `dir` again for `<lw>`; a fix adds `--kind fix`):
66
+ ```bash
67
+ node "{{LW_HOME}}/hooks/lw.mjs" start tasks/<file>.md --profile <chosen profile> <<'LW_TEXT'
68
+ <title>
69
+ LW_TEXT
70
+ ```
71
+ It writes the task file in the layout of the Task file template, with status `active`, stage `plan`, `plan: draft`, the chosen profile, the worktree, branch and base commit, and the empty sections. Every command below that writes the task file follows the same shape: the ids, tags and values are flags, and the text comes on stdin through a quoted heredoc (pick a delimiter that does not appear alone on a line in the text). Put every unresolved ledger line under `## Open questions` with `node "{{LW_HOME}}/hooks/lw.mjs" add question`; it is removed as the decision or assumption is added with `--resolves '<question>'` (the question's text exactly as in the file, each apostrophe in it written as `'\''`), so a resumed session knows what is still open. Starting early lets the hooks restore this task after compaction; it builds nothing.
66
72
 
67
73
  ## 4. High-impact questions, one at a time
68
74
 
@@ -70,12 +76,12 @@ For each high-impact item, most impactful first: ask ONE question, wait for the
70
76
  - Write every question for a reader who does not know the code, following the rules file: first say in one plain sentence what the feature does for its users and what will change.
71
77
  - Claude Code: use `AskUserQuestion` with 2–4 options, your recommendation first and marked "(recommended)".
72
78
  - Codex: numbered plain-text options, recommendation first. The first time, add: "Tip: `/plan` mode offers structured prompts."
73
- Record the answer as `D<n> [asked] <decision> — rejected: <option, why>`. An answer that raises a new high-impact question goes into the ledger and is asked the same way.
79
+ Record the answer with `node "{{LW_HOME}}/hooks/lw.mjs" add decision --tag asked --resolves '<question>'`, the decision as the first stdin line and one `rejected: <option, why>` line per rejected option after it (the tool numbers it and writes the icon). An answer that raises a new high-impact question goes into the ledger and is asked the same way.
74
80
 
75
81
  ## 5. Low-impact batch
76
82
 
77
83
  Send all low-impact items in ONE numbered message: "Reply ok, or override by number." Do not ask them one by one.
78
- Write the result immediately: accepted → `[batch-confirmed]`, changed by the user → `[overridden]` with the user's version. Choices about what to build go under Decisions; facts about the repo or environment go under Assumptions.
84
+ Write the result immediately: accepted → `--tag batch-confirmed`, changed by the user → `--tag overridden` with the user's version. Choices about what to build go in with `add decision`; facts about the repo or environment with `node "{{LW_HOME}}/hooks/lw.mjs" add assumption` (its tags: `confirmed`, `batch-confirmed`, `overridden`).
79
85
 
80
86
  ## 6. Proposal
81
87
 
@@ -86,72 +92,91 @@ In one message, propose and explain each in one line, in plain words following t
86
92
  - **fix-round cap**: default `maxFixRounds` from config; may be lower for small tasks.
87
93
  - **check commands**: exact lint / typecheck / test commands from the scout report.
88
94
  - **acceptance criteria** `AC<n>` (fix tasks: see "Fix tasks"; show them as plain sentences of what the user will be able to see or do, with the label in brackets after): observable behavior, each with the module path and export the test will use (the tester stops without one), and the planned test file. Large tier: slices `S<n>` with their ACs.
89
- The user confirms or edits each item; write the outcome to the header and sections immediately.
95
+ The user confirms or edits each item; write the outcome immediately: the header lines with `node "{{LW_HOME}}/hooks/lw.mjs" set tier|profile|two-pass|"fix-round cap"|checks <value>` (a value with spaces or backticks in single quotes), each criterion with `node "{{LW_HOME}}/hooks/lw.mjs" add ac` (`--interface <module, export>`, `--test <file>`), each slice with `node "{{LW_HOME}}/hooks/lw.mjs" add slice`, and a changed criterion or slice with `edit <id>`.
90
96
 
91
97
  ## 7. Confirm
92
98
 
93
99
  Show the task file path and a short summary in plain words following the rules file: what will be built and why, how big the work is, what the user will be able to see or do when it is done, and how it will be checked; not counts of decisions or criteria. Ask for explicit confirmation. Until the user confirms, keep editing the plan; never start Test or Build.
94
100
  Safe point: for tier standard or large (fixes of those tiers included) and a task that was not reopened, the confirmation offers three answers: confirm and continue here; confirm and continue in a fresh context; keep editing. The small tier and a reopened task (Build has begun, so findings and the implementer report live in this conversation) keep the two answers confirm and keep editing, with no fresh-context offer. Give the reason in one sentence, stated as a tradeoff: later turns re-read the whole conversation, so a fresh context saves tokens when much of the task remains (a large task, a long plan conversation), but the new session rewrites the cache, which can cost more than it saves on a short task; nothing is lost either way because the task file holds the plan.
95
- On explicit confirmation, set the header line to `plan: confirmed` (Test and Build refuse to run without it). Then, unless the task was reopened (keep its base commit so the review scope stays whole), if `git rev-parse HEAD` differs from the recorded base commit, rerun `node "{{LW_HOME}}/hooks/lw.mjs" start tasks/<file>.md --force` and update the header. Then the next stage is `/loopwright-test` (standard, large, and every fix) or `/loopwright-build` (small feature); under `/loopwright-flow`, return to the flow.
101
+ On explicit confirmation, run `node "{{LW_HOME}}/hooks/lw.mjs" set plan confirmed` (Test and Build refuse to run without it). Then, unless the task was reopened (keep its base commit so the review scope stays whole), if `git rev-parse HEAD` differs from the recorded base commit, rerun `node "{{LW_HOME}}/hooks/lw.mjs" start tasks/<file>.md --force`, which updates the base commit line. Then the next stage is `/loopwright-test` (standard, large, and every fix) or `/loopwright-build` (small feature); under `/loopwright-flow`, return to the flow.
96
102
  On "confirm and continue in a fresh context", after the `plan: confirmed` step and the base-commit rerun above, in this order:
97
- 1. Append `## Notes for Done` to the task file (add to it if it exists): up to five lines of things learned so far that Done may propose for `AGENTS.md`.
98
- 2. Re-read the task file and write any decision made in this conversation that it is missing.
103
+ 1. Write up to five lines of things learned so far that Done may propose for `AGENTS.md`: `node "{{LW_HOME}}/hooks/lw.mjs" section "Notes for Done" --append`, the lines on stdin through a quoted heredoc.
104
+ 2. Re-read the task file and add any decision made in this conversation that it is missing, with `add decision`.
99
105
  3. Run `node "{{LW_HOME}}/hooks/lw.mjs" stage test` (it updates the header), so the next session resumes at Test and not at this confirmation.
100
106
  4. Tell the user what to type, by tool: Claude Code "`/clear`, then `/loopwright-flow`" (`/compact` also works and keeps a summary). On Claude Code also say, in plain words following the rules file, that the remaining stages cost less on a cheaper model: instead of `/clear`, leave this session and run `claude --model sonnet "/loopwright-flow"` in the same folder; subagents keep their configured models, and a role whose model is `inherit` follows the session model, so it would run on the cheaper model too; Codex and Junie: start a new session and run the flow. End the turn. If the user's next message arrives in the same session, continue with `/loopwright-test` as usual.
101
107
 
102
108
  ## Fix tasks
103
109
 
104
110
  `kind: fix` adds this to the steps above. A missing `kind` header means `feature`, so older task files keep working.
105
- - Sections: `## Bug report` (observed, expected, steps to reproduce, environment or version, logs or stack trace, already tried), `## Root cause` (starts as a hypothesis; Build confirms it), `## Follow-ups` (siblings the user chose not to include).
111
+ - Sections (`start --kind fix` creates the headings): `## Bug report` (observed, expected, steps to reproduce, environment or version, logs or stack trace, already tried), `## Root cause` (starts as a hypothesis; Build confirms it), `## Follow-ups` (siblings the user chose not to include). Write the first two with `node "{{LW_HOME}}/hooks/lw.mjs" section "Bug report" --set` and `node "{{LW_HOME}}/hooks/lw.mjs" section "Root cause" --set`, the text on stdin through a quoted heredoc; a sibling goes under Follow-ups with `node "{{LW_HOME}}/hooks/lw.mjs" add followup`.
106
112
  - Evidence intake: the scout runs first (section 2) and fills in what the repo can answer. Then ask for the missing evidence in one message, listing only the `## Bug report` items the scout could not fill in. Write the answers to `## Bug report`; "I don't know" is a valid answer and is recorded as such.
107
113
  - The root-cause hypothesis goes in `## Root cause` and in the ledger as a high-impact assumption, shown to the user, who may correct it.
108
- - Acceptance criteria keep the line shape with a leading tag:
109
- - `AC<n> [repro] <input or steps> → actual <symptom>, expected <behavior> — interface: <module, export> — test: <file>`: at least one.
110
- - `AC<n> [regression] <nearby behavior that must not change> — interface: <module, export> — test: <file>`: optional.
114
+ - Acceptance criteria keep the line shape with a leading tag, written with `add ac --tag repro` or `add ac --tag regression`:
115
+ - `AC<n> [repro] <input or steps> → actual <symptom>, expected <behavior>`, then `interface: <module, export>` and `test: <file>` on indented sub-lines: at least one.
116
+ - `AC<n> [regression] <nearby behavior that must not change>`, with the same two sub-lines: optional.
111
117
  - The proposal states that Test always runs for fixes, whatever the tier. Tier is still about size.
112
118
  - If the scout reports the same defect pattern elsewhere (siblings), ask one question, recommendation first: include them in this fix (one `[repro]` criterion each), or list them under `## Follow-ups`.
113
119
 
114
120
  ## Task file
115
121
 
116
122
  Path: `<lw>/tasks/<YYYY-MM-DD>-<readable-title>.md` — today's date and a short title from the goal. Keep meaningful casing (`2026-11-08-add-CLAUDE-to-project.md`); spaces become `-`; replace only filesystem-unsafe characters (`/ \ : * ? " < > |`). If the name exists, append `-2`, `-3`, … before `.md`.
117
- One line per entry; target ≤ ~150 lines. Template:
123
+ One line per entry (a decision's rejected options, a criterion's interface and test go on indented sub-lines); target ≤ ~250 lines. Template:
118
124
 
119
- ```markdown
125
+ ````markdown
120
126
  # <title>
121
127
 
122
- kind: <feature|fix>
123
- status: active
124
- stage: plan
125
- plan: draft
126
- tier: <small|standard|large>
127
- profile: <lean|balanced|thorough|deep>
128
- two-pass: <on|off>
129
- fix-round cap: <n>
130
- checks: `<lint>` · `<typecheck>` · `<test>`
131
- worktree: <path> (branch <branch>)
132
- base commit: <sha>
133
-
134
- ## Goal
128
+ <!-- loopwright progress: written by the state tool, edits are overwritten -->
129
+ **Now: Plan** ▶️
130
+
131
+ Plan ▶️
132
+ <!-- /loopwright progress -->
133
+
134
+ ```yaml
135
+ 🏷️ kind: <feature|fix>
136
+ 🚦 status: active
137
+ 📍 stage: plan
138
+ 📋 plan: draft
139
+ 📐 tier: <small|standard|large>
140
+ 🎚️ profile: <lean|balanced|thorough|deep>
141
+ 👀 two-pass: <on|off>
142
+ 🔧 fix-round cap: <n>
143
+ 🔬 checks: `<lint>` · `<typecheck>` · `<test>`
144
+ 🌿 worktree: <path> (branch <branch>)
145
+ ⚓ base commit: <sha>
146
+ ```
147
+
148
+ ## 🎯 Goal
149
+
135
150
  <one paragraph: what and why>
136
151
 
137
- ## Decisions
138
- - D1 [asked] <decision> — rejected: <option, why>
139
- - D2 [batch-confirmed] <decision>
140
- - D3 [overridden] <user's version> (was: <your assumption>)
152
+ ## ⚖️ Decisions
153
+
154
+ - D1 🙋 [asked] <decision>
155
+ - rejected: <option, why>
156
+ - D2 ☑️ [batch-confirmed] <decision>
157
+ - D3 ✏️ [overridden] <user's version> (was: <your assumption>)
141
158
 
142
- ## Assumptions
143
- - A1 [confirmed] <fact about repo or environment> — <evidence>
159
+ ## 🔎 Assumptions
144
160
 
145
- ## Acceptance criteria
146
- - AC1 <observable behavior> — interface: <module path, export> — test: <file>
161
+ - A1 ☑️ [confirmed] <fact about repo or environment> — <evidence>
147
162
 
148
- ## Slices
149
- - S1 [todo] <slice> — AC1, AC2
163
+ ## 🧪 Acceptance criteria
150
164
 
151
- ## Review log
165
+ - AC1 <observable behavior>
166
+ - interface: <module path, export>
167
+ - test: <file>
168
+
169
+ ## 🧩 Slices
170
+
171
+ - S1 ⬜ [todo] <slice> — AC1, AC2
172
+
173
+ ## 🔁 Review log
174
+
175
+ ## ❓ Open questions
152
176
 
153
- ## Open questions
154
177
  - <question> — <who answers, when>
155
- ```
178
+ ````
156
179
 
157
- Omit `## Slices` unless the tier is large. Keep `## Goal` and the `- D<n>` line shape: the context-reinjection hook reads them.
180
+ The state tool writes this layout, icons and numbering included: `start` creates the file, and `set`, `add`, `mark`, `edit` and `section` change it, so no step edits the task file directly. Fix tasks add `## 🐞 Bug report`, `## 🌱 Root cause`, `## 📌 Follow-ups` and `## 📎 Evidence`; a slice mark `[tested]` or `[passed]` carries 🧪 or ✅ in place of ⬜.
181
+ The progress list between the two markers is written by the state tool and never edited by hand: `start` writes it with Plan running, and `lw.mjs` rewrites it at `stage`, `reopen`, `verdict`, `await-user`, `resume`, `done` and each writer command (`set`, `add`, `mark`, `edit`, `section`) on the active task, and overwrites any edit inside the markers.
182
+ Omit `## Slices` unless the tier is large. Keep `## Goal` and the `- D<n>` line shape: the context restore hook reads them.
@@ -8,7 +8,7 @@ Reviewers judge in their own context. This thread dispatches them, merges their
8
8
 
9
9
  ## Setup
10
10
 
11
- Before your first message to the user, read `{{LW_HOME}}/prompts/user-messages.md` unless you already read it in this conversation, and write every message to the user by it.
11
+ Before your first message to the user, read `{{LW_HOME}}/prompts/user-messages.md` and `{{LW_HOME}}/prompts/glossary.md` unless you already read them in this conversation, and write every message to the user by them, using one term for each idea.
12
12
 
13
13
  1. Run every loopwright command from the worktree root: `cd "$(git rev-parse --show-toplevel)"`.
14
14
  2. `node "{{LW_HOME}}/hooks/lw.mjs" brief reviewer` → `dir` (`<lw>`), `task` (relative to `<lw>`), `baseCommit`, `config` (`crossAgentReview`, `crossAgentReviewer` = `models.crossAgentReviewer`; missing → `off`; `simplify`), `effort`, `reviewed` (`round`: the round of the last reviewed snapshot; present only when `review-diff` can run). `dir` `null` inside a git repo → no task has started here yet; `lw.mjs start` creates `.loopwright/` with the first task, so continue and `task: null` reports "no active task". Not a git repo → tell the user loopwright must run inside a git repo, stop.
@@ -16,10 +16,10 @@ Before your first message to the user, read `{{LW_HOME}}/prompts/user-messages.m
16
16
  4. Read the task file header (`tier`, `two-pass`, `fix-round cap`).
17
17
  5. Scope: small/standard → the task. Large → the first `S<n> [tested]` slice, or `whole` once every slice is `[passed]`.
18
18
  6. Round `n` = number of `- R` lines in `## Review log` for this scope after the last `- Scope change:` line (all of them if there is none) + 1.
19
- 7. Moved branch. `headMoved` in `brief` (new commits since the base commit, at least one already on the upstream branch, and not answered yet for this HEAD) → run `node "{{LW_HOME}}/hooks/lw.mjs" await-user "branch moved"`, list the commits to the user and ask one question: are they pulled commits (leave them out of the review) or this task's own commits (keep them in)? After the answer run `node "{{LW_HOME}}/hooks/lw.mjs" resume` and record it as a decision `D<n> [asked]`.
19
+ 7. Moved branch. `headMoved` in `brief` (new commits since the base commit, at least one already on the upstream branch, and not answered yet for this HEAD) → run `node "{{LW_HOME}}/hooks/lw.mjs" await-user "branch moved"`, list the commits to the user and ask one question: are they pulled commits (leave them out of the review) or this task's own commits (keep them in)? After the answer run `node "{{LW_HOME}}/hooks/lw.mjs" resume` and record it with `node "{{LW_HOME}}/hooks/lw.mjs" add decision --tag asked <<'LW_TEXT'`, the decision on the next line, then `LW_TEXT`.
20
20
  - `headMoved.keptEarlier` → an earlier answer kept commits in the review, so the branch holds both kinds whatever the answer: list only the new commits, and a 'pulled' answer takes the keep-base path below, with the both-kinds notice.
21
21
  - `headMoved.localOnly` → the listed short shas exist only locally, so they are the task's own work and the branch holds both kinds whatever the answer: a 'pulled' answer takes the keep-base path below, with the both-kinds notice. Never judge this from the commit subjects.
22
- - Pulled → run `node "{{LW_HOME}}/hooks/lw.mjs" start <task> --force --base HEAD && node "{{LW_HOME}}/hooks/lw.mjs" stage build` as one call (Passes step 1 sets the stage to review), update `base commit` in the task file header to the new HEAD, run `node "{{LW_HOME}}/hooks/lw.mjs" accept-locks --restart --reason "<the decision in words>"`, then run `brief reviewer` again (the base commit changed).
22
+ - Pulled → run `node "{{LW_HOME}}/hooks/lw.mjs" start <task> --force --base HEAD && node "{{LW_HOME}}/hooks/lw.mjs" stage build` as one call (Passes step 1 sets the stage to review), run `node "{{LW_HOME}}/hooks/lw.mjs" accept-locks --restart --reason "<the decision in words>"`, then run `brief reviewer` again (the base commit changed).
23
23
  - This task's own commits, or a branch holding both kinds → run `node "{{LW_HOME}}/hooks/lw.mjs" keep-base --reason "<the decision in words>"`; the base stays. Both kinds: add `--pulled` to that command, so the locked tests the new commits changed show in `pulledLocks` (run `brief reviewer` again, then step 8), and tell the user the pulled commits stay in the review, because the base cannot move past the task's own commits.
24
24
  8. `pulledLocks` in `brief` (a pulled commit changed those locked tests) → before the first reviewer is spawned, send only the listed files to Test: `node "{{LW_HOME}}/hooks/lw.mjs" reopen test "<the pull decision in words>"` when Build has begun, `node "{{LW_HOME}}/hooks/lw.mjs" stage test` otherwise, then run `/loopwright-test` for those files. After the tester re-locked them, run `node "{{LW_HOME}}/hooks/lw.mjs" accept-locks --reason "<the pull decision in words>" <path>…` with the `pulledLocks` paths, so the re-locks are accepted under the pull decision, then run `brief reviewer` again (`reopen` drops `reviewed`), and continue with step 9 and Simplify.
25
25
  9. `flaggedLocks` in `brief` (present only while a re-lock or forced restart is flagged and not accepted) → before the first reviewer is spawned, compare each item with the task file's decisions. A decision covers an item when it names the test file, the return to Test, or the pull. Covered → run `node "{{LW_HOME}}/hooks/lw.mjs" accept-locks --reason "<that decision in words>" [--restart] [<path>…]` without asking the user (paths for `lockedAfterBuild`, `--restart` for `forcedRestartAfterBuild`). No decision covers an item → leave it to the reviewer, unchanged.
@@ -32,24 +32,24 @@ Skip this section, silently and with no log line, when any of these holds: `simp
32
32
 
33
33
  A `- Simplify:` line ending in `— apply pending` is not a skip: an earlier run was interrupted after the user approved cuts, so skip the question, resuming at the Apply (step 5), taking the approved cuts only from this run's `Simplify:` decisions in `## Decisions` (the last ones written, above the pending `- Simplify:` line), never from a `kept as written` line or an earlier run's decisions.
34
34
 
35
- 1. **Propose.** Now spawn the `loopwright-reviewer` subagent and wait for its result. Give it only: the absolute task file path, the base commit, and "Follow `{{LW_HOME}}/prompts/simplifier.md`." Large tier: add "Scope: whole-branch review of all slices". On Claude Code pass `effort` = the `effort` from `brief`, as in Passes step 2. The result is one JSON object with `obvious` and `tradeoffs` lists. Invalid JSON → dispatch it once more asking for only the JSON; still invalid → append `- Simplify: skipped — invalid output` to `## Review log` and go to Passes.
36
- 2. Both lists empty → append `- Simplify: nothing to cut` and go to Passes with no question.
35
+ 1. **Propose.** Now spawn the `loopwright-reviewer` subagent and wait for its result. Give it only: the absolute task file path, the base commit, and "Follow `{{LW_HOME}}/prompts/simplifier.md`." Large tier: add "Scope: whole-branch review of all slices". On Claude Code pass `effort` = the `effort` from `brief`, as in Passes step 2. The result is one JSON object with `obvious` and `tradeoffs` lists. Invalid JSON → dispatch it once more asking for only the JSON; still invalid → run `node "{{LW_HOME}}/hooks/lw.mjs" add simplify <<'LW_TEXT'`, with `skipped — invalid output` on the next line, then `LW_TEXT` (every writer command below takes its text on stdin the same way; the tool writes the `- Simplify:` line in `## Review log`) and go to Passes.
36
+ 2. Both lists empty → run `add simplify` with `nothing to cut` and go to Passes with no question.
37
37
  3. **Ask.** Run `node "{{LW_HOME}}/hooks/lw.mjs" await-user "simplify"`, then ask everything in one prompt (Claude: `AskUserQuestion`, `multiSelect` for trade-offs; Codex and Junie: numbered text, the user replies with numbers). Write each cut in plain words following the rules file: what would be removed or merged and what the user gives up, with the location and line count in brackets after:
38
38
  - `obvious` non-empty → one question listing each cut with its `lines`: apply all or skip all.
39
39
  - one trade-off cut → one question with its `change`, `lines` and `loses`: apply or skip.
40
40
  - 2–8 trade-off cuts → multi-select questions of up to 4 options each, split evenly into groups of 2 to 4 (an option is a cut: `change`, `lines`, `loses`); a selected option is approved.
41
41
  After the answer run `node "{{LW_HOME}}/hooks/lw.mjs" resume`.
42
- 4. **Record**, before applying anything. Each approved trade-off cut becomes a decision `D<n> [asked] Simplify: <location> — <change>; <lines> lines; gives up: <loses>`, approved obvious cuts (an apply-all answer) one decision line `D<n> [asked] Simplify: apply obvious: <location> — <change>; …`, and all declined cuts, trade-off cuts and the obvious cuts of a skip-all answer, one decision line `D<n> [asked] Simplify: kept as written: <location> — <change>; …` (each cut with its `change`, so it stays identifiable after applying other cuts moves line numbers), so Review does not report them. Then append `- Simplify: <o> obvious applied|skipped, <t> trade-off applied, <d> declined` to `## Review log`, ending it with ` — apply pending` when any cut is approved; write this line before applying, so a resume mid-apply does not ask again.
42
+ 4. **Record**, before applying anything, each with `node "{{LW_HOME}}/hooks/lw.mjs" add decision --tag asked`. Each approved trade-off cut becomes a decision `Simplify: <location> — <change>; <lines> lines; gives up: <loses>`, approved obvious cuts (an apply-all answer) one decision line `Simplify: apply obvious: <location> — <change>; …`, and all declined cuts, trade-off cuts and the obvious cuts of a skip-all answer, one decision line `Simplify: kept as written: <location> — <change>; …` (each cut with its `change`, so it stays identifiable after applying other cuts moves line numbers), so Review does not report them. Then run `add simplify` with `<o> obvious applied|skipped, <t> trade-off applied, <d> declined` on stdin, ending it with ` — apply pending` when any cut is approved; write this line before applying, so a resume mid-apply does not ask again.
43
43
  5. **Apply** each branch that has approved cuts; nothing approved → go to the Passes.
44
44
  - Approved cuts in locked test files first: `node "{{LW_HOME}}/hooks/lw.mjs" stage test`, then spawn the `loopwright-tester` subagent and wait for its result (on Claude Code pass `effort` = the output of `node "{{LW_HOME}}/hooks/lw.mjs" effort tester`; if the spawn rejects `effort`, spawn without it), with the task file path and the approved cuts verbatim for those files only. It applies them, reruns the tests and re-locks only those files. Then run `node "{{LW_HOME}}/hooks/lw.mjs" accept-locks --reason "<the decision in words>" <path>…` with those paths, so Review does not flag the re-lock.
45
- - Approved cuts in other files (the approved obvious cuts and the rest): `node "{{LW_HOME}}/hooks/lw.mjs" stage build`, then spawn the `loopwright-implementer` subagent and wait for its result, as in Build step 2 but with `effort` = the output of `node "{{LW_HOME}}/hooks/lw.mjs" effort implementer`, not the reviewer's. Its prompt contains the task file path and "Approved simplifications:" with the approved cuts verbatim (`location`, `change`); never your own summary. Keep its report verbatim. `Deviations` not "none" → handle them as in Build step 4; if that sends the task back to Plan or Test, remove the ` — apply pending` ending from the `- Simplify:` line before running `reopen`, so Test does not skip the tester.
45
+ - Approved cuts in other files (the approved obvious cuts and the rest): `node "{{LW_HOME}}/hooks/lw.mjs" stage build`, then spawn the `loopwright-implementer` subagent and wait for its result, as when Build spawns it, but with `effort` = the output of `node "{{LW_HOME}}/hooks/lw.mjs" effort implementer`, not the reviewer's. Its prompt contains the task file path and "Approved Simplify cuts:" with the approved cuts verbatim (`location`, `change`); never your own summary. Keep its report verbatim. `Deviations` not "none" → handle them as Build does; if that sends the task back to Plan or Test, run `node "{{LW_HOME}}/hooks/lw.mjs" mark simplify applied` before `reopen`, so Test does not skip the tester.
46
46
  - `two-pass: on` → the second pass gets both implementer reports, Build's and this one.
47
- - After the last branch, remove the ` — apply pending` ending from the `- Simplify:` line. On a resume, skip an approved cut that is already applied.
47
+ - After the last branch, run `mark simplify applied` (it removes the ` — apply pending` ending from the `- Simplify:` line). On a resume, skip an approved cut that is already applied.
48
48
  6. Go on with the Passes.
49
49
 
50
50
  ## Passes
51
51
 
52
- 1. `node "{{LW_HOME}}/hooks/lw.mjs" stage review` (it updates the task file header `stage:` line; if it prints `"header": false`, set that line by hand).
52
+ 1. `node "{{LW_HOME}}/hooks/lw.mjs" stage review` (it updates the task file header `stage:` line; if it prints `"header": false`, run `node "{{LW_HOME}}/hooks/lw.mjs" set stage review`).
53
53
  2. **Blind pass.** Now spawn the `loopwright-reviewer` subagent and wait for its result. Give it only: the absolute task file path, the base commit, and "Follow `{{LW_HOME}}/prompts/reviewer.md`. Blind pass." Large tier: add "Scope: slice S<n> (its ACs; earlier slices passed)" or "Scope: whole-branch review of all slices". Never include the implementer report, chat history or your opinion. On Claude Code pass `effort` = the `effort` from `brief` on the spawn; if `brief` has no `effort` (it warns on stderr) or the spawn rejects `effort`, spawn without it (the agent file's effort applies). Use the same effort for the second pass.
54
54
  **Change review.** When round `n` is 2 or more, `reviewed` is in `brief`, and the earlier round's findings are still in this conversation word for word, spawn the same way with the same `effort`, but the prompt says "Follow `{{LW_HOME}}/prompts/reviewer.md`. Change review." in place of "Blind pass.", keeps the scope line for a large task, and adds "Findings of the earlier round:" with two lists, each finding word for word (location, expectation, proof): "Sent to Build:" (what Build was given) and "Undecided, not asked yet:" (undecided findings that were only counted last round); "Undecided, not asked yet:" may be "none"; when the last verdict failed (`verdict.pass` is false in `brief`) "Sent to Build:" is never "none", and "none" is possible only after a passing verdict (a stale pass); if those findings are not at hand word for word, run the blind pass; never include dismissed findings, the implementer report, chat history or your opinion; otherwise run the blind pass above.
55
55
  3. **Second pass** (only if `two-pass: on`). Now spawn the `loopwright-reviewer` subagent and wait for its result, with the task file path, the base commit, "Follow `{{LW_HOME}}/prompts/reviewer.md`. Second pass.", and then "Verify the claims in this implementer report:" with the report verbatim (Simplify's apply report too, if it ran). Report no longer available → skip and note it in the log line.
@@ -69,26 +69,27 @@ Merge all passes: union of `blocking`, union of `undecided` (drop exact duplicat
69
69
 
70
70
  After a change review, the one-line result you give the user says, in plain words following the rules file, that this round checked only what changed since the last review.
71
71
 
72
- - **Blocking** present → `node "{{LW_HOME}}/hooks/lw.mjs" verdict fail --round <n>`. Fix rounds used = n − 1. If that reaches or exceeds the `fix-round cap`, stop: show every open finding and let the user decide (raise the cap, fix by hand, or accept). Otherwise show the findings briefly, in plain words following the rules file (what is wrong, with the location in brackets after), and run `/loopwright-build` with the Blocking findings verbatim (only what you show the user is rewritten); then review again (round n + 1). Undecided findings of this round are only counted; the next round re-checks them.
73
- - Only **Undecided** → present each to the user, one at a time (Claude: `AskUserQuestion`; Codex: numbered text), in plain words following the rules file: what the reviewer is unsure about and why, with its location in brackets after and the proof as what was checked; options: fix or dismiss. Record each answer under the round's log line: ` - U<k> <location>: fix|dismissed — <user's reason>`. Any "fix" → `verdict fail --round <n>` and Build with those findings, same cap rule. A dismissed re-lock or restart finding also runs `node "{{LW_HOME}}/hooks/lw.mjs" accept-locks --reason "<user's reason>" [--restart] [<path>…]`, so it is not asked again for that re-lock or restart. Every other Undecided finding is asked as above, each round. All dismissed → pass.
74
- - An undecided finding the user wants resolved by changing the plan or a locked test (not just the code) → offer to go back: after `verdict fail --round <n>`, `await-user` and the answer's `resume`, run `node "{{LW_HOME}}/hooks/lw.mjs" reopen <plan|test> "<reason>"` with the user's reason (it sets the header `stage:` line, and `plan: draft` for plan; if it prints `"header": false`, set those lines by hand), then continue with `/loopwright-plan` or `/loopwright-test`. Run it only after the user chooses it.
72
+ - **Blocking** present → `node "{{LW_HOME}}/hooks/lw.mjs" verdict fail --round <n>`. Fix rounds used = n − 1. If that reaches or exceeds the `fix-round cap`, stop: show every blocking finding still left and let the user decide (raise the cap with `node "{{LW_HOME}}/hooks/lw.mjs" set "fix-round cap" <n>`, fix by hand, or accept). Otherwise show the findings briefly, in plain words following the rules file (what is wrong, with the location in brackets after), and run `/loopwright-build` with the Blocking findings verbatim (only what you show the user is rewritten); then review again (round n + 1). Undecided findings of this round are only counted; the next round re-checks them.
73
+ - Only **Undecided** → present each to the user, one at a time (Claude: `AskUserQuestion`; Codex: numbered text), in plain words following the rules file: what the reviewer is unsure about and why, with its location in brackets after and the proof as what was checked; options: fix or dismiss. Keep each answer as `<location>: fix|dismissed — <user's reason>` for the round's log line, written below. Any "fix" → `verdict fail --round <n>` and Build with those findings, same cap rule.
74
+ A dismissed re-lock or restart finding also runs `node "{{LW_HOME}}/hooks/lw.mjs" accept-locks --reason "<user's reason>" [--restart] [<path>…]`, so it is not asked again for that re-lock or restart. Every other Undecided finding is asked as above, each round. All dismissed → pass.
75
+ - An undecided finding the user wants resolved by changing the plan or a locked test (not just the code) → offer to go back: after `verdict fail --round <n>`, `await-user` and the answer's `resume`, run `node "{{LW_HOME}}/hooks/lw.mjs" reopen <plan|test> "<reason>"` with the user's reason (it sets the header `stage:` line, and `plan: draft` for plan; if it prints `"header": false`, run `set stage <plan|test>` and, for plan, `set plan draft`), then continue with `/loopwright-plan` or `/loopwright-test`. Run it only after the user chooses it.
75
76
  - Nothing open → `node "{{LW_HOME}}/hooks/lw.mjs" verdict pass --round <n>`.
76
- - Fix tasks, sibling gate: asked once, at the final pass (the task review for small/standard, the whole-branch review for large), never after a slice review. Every round of a fix task, failed or passed, records its merged `siblings` (union from all passes, dropping exact duplicates by `path` and `line`) as ` - Sibling <path>:<line> — <why>` lines under its log line; after a passing slice review the slice loop goes on.
77
+ - Fix tasks, sibling gate: asked once, at the final pass (the task review for small/standard, the whole-branch review for large), never after a slice review. Every round of a fix task, failed or passed, records its merged `siblings` (union from all passes, dropping exact duplicates by `path` and `line`) with `node "{{LW_HOME}}/hooks/lw.mjs" add sibling` (`<path>:<line> — <why>` on stdin, one call per sibling) under its log line; after a passing slice review the slice loop goes on.
77
78
  - At the final pass, take the merged `siblings` of this verdict plus every `Sibling` line after the last `- Scope change:` line, dropping duplicates by `path` and `line`. Non-empty → run `node "{{LW_HOME}}/hooks/lw.mjs" verdict pass --round <n> && node "{{LW_HOME}}/hooks/lw.mjs" await-user "siblings of the fixed bug"` as one call, in this order because the verdict clears the wait; list each sibling (`path:line`, why), then ask one question for the batch, recommendation first: include the siblings (also fix them), or list them as follow-ups. After the answer run `node "{{LW_HOME}}/hooks/lw.mjs" resume`.
78
- - Include → append `- Scope change: siblings included` to the review log, run `node "{{LW_HOME}}/hooks/lw.mjs" reopen plan "include siblings in the fix"` (it sets the header `stage:` and `plan: draft` lines; if it prints `"header": false`, set them by hand), then continue with `/loopwright-plan` (one `[repro]` criterion per sibling; Test locks the new repro tests and existing locks stay; Build and Review run again with a fresh fix-round budget, because rounds are counted after the scope change).
79
- - No (follow-ups only) → write the siblings under `## Follow-ups` in the task file (`path:line — why`) and go to `/loopwright-done`.
79
+ - Include → run `node "{{LW_HOME}}/hooks/lw.mjs" add scope-change` with `siblings included` on stdin, then run `node "{{LW_HOME}}/hooks/lw.mjs" reopen plan "include siblings in the fix"` (it sets the header `stage:` and `plan: draft` lines; if it prints `"header": false`, run `set stage plan` and `set plan draft`), then continue with `/loopwright-plan` (one `[repro]` criterion per sibling; Test locks the new repro tests and existing locks stay; Build and Review run again with a fresh fix-round budget, because rounds are counted after the scope change).
80
+ - No (follow-ups only) → run `node "{{LW_HOME}}/hooks/lw.mjs" add followup` once per sibling (`<path>:<line> — <why>` on stdin) and go to `/loopwright-done`.
80
81
 
81
- Once the outcome is known (after the user's undecided answers) and before the verdict command, append one line to `## Review log`, followed by its `U<k>` lines if any and, on a fix task, its `Sibling` lines:
82
- `- R<n>: <pass|fail> — <k> blocking, <m> undecided, <d> dropped — <key finding one-liners>; <skipped-pass notes>`
83
- Large tier: `- R<n> S<k>: …` for a slice, `- R<n> whole: …` for the whole-branch review. A change review puts `changes only` in the notes part of its `- R<n>:` line.
82
+ Once the outcome is known (after the user's undecided answers) and before the verdict command, write the round's line to `## Review log` with `node "{{LW_HOME}}/hooks/lw.mjs" add round`, then its `U<k>` lines if any (`node "{{LW_HOME}}/hooks/lw.mjs" add finding`, one call per answer; the tool numbers `U<k>`) and, on a fix task, its `Sibling` lines (`node "{{LW_HOME}}/hooks/lw.mjs" add sibling`). The tool numbers the round per scope and writes `R<n>`; on stdin put:
83
+ `<pass|fail> — <k> blocking, <m> undecided, <d> dropped — <key finding one-liners>; <skipped-pass notes>`
84
+ Large tier: add `--scope S<k>` for a slice and `--scope whole` for the whole-branch review. A change review puts `changes only` in the notes part of its round line.
84
85
 
85
86
  ## After a pass
86
87
 
87
88
  - small/standard → `/loopwright-done`.
88
- - large → mark the slice `S<n> [passed]`; a `[todo]` slice remains → ask the question below, then `/loopwright-test` (or the fresh-context steps). When the last slice passes, run this skill again with scope `whole` (the diff against the base commit, all ACs); its fixes go through Build without new tests. Whole-branch pass → `/loopwright-done`.
89
+ - large → run `node "{{LW_HOME}}/hooks/lw.mjs" mark S<n> passed`; a `[todo]` slice remains → ask the question below, then `/loopwright-test` (or the fresh-context steps). When the last slice passes, run this skill again with scope `whole` (the diff against the base commit, all ACs); its fixes go through Build without new tests. Whole-branch pass → `/loopwright-done`.
89
90
  - Large, after marking the slice `[passed]`, and a [todo] slice remains: ask one question, continue here or continue in a fresh context, with the reason in one sentence, stated as a tradeoff: later turns re-read the whole conversation, so a fresh context saves tokens when much of the task remains (several slices left), but the new session rewrites the cache, which can cost more than it saves when little remains; nothing is lost either way because the task file holds the plan. Not asked after the last slice, after a whole-branch review, or on a small or standard task. Run `node "{{LW_HOME}}/hooks/lw.mjs" await-user "<reason>"` before asking and `resume` after the answer. On "continue in a fresh context", in this order:
90
- 1. Append `## Notes for Done` to the task file (add to it if it exists): up to five lines of things learned so far that Done may propose for `AGENTS.md`.
91
- 2. Re-read the task file and write any decision made in this conversation that it is missing.
92
- 3. Run `node "{{LW_HOME}}/hooks/lw.mjs" stage test` (it updates the header; if it prints `"header": false`, set the `stage:` line by hand), so the next session resumes at the next slice's Test and not in Review with no slice in scope.
91
+ 1. Write up to five lines of things learned so far that Done may propose for `AGENTS.md`: `node "{{LW_HOME}}/hooks/lw.mjs" section "Notes for Done" --append`, the lines on stdin through a quoted heredoc.
92
+ 2. Re-read the task file and add any decision made in this conversation that it is missing, with `add decision`.
93
+ 3. Run `node "{{LW_HOME}}/hooks/lw.mjs" stage test` (it updates the header; if it prints `"header": false`, run `set stage test`), so the next session resumes at the next slice's Test and not in Review with no slice in scope.
93
94
  4. Tell the user what to type, by tool: Claude Code "`/clear`, then `/loopwright-flow`" (`/compact` also works and keeps a summary). On Claude Code also say, in plain words following the rules file, that the remaining stages cost less on a cheaper model: instead of `/clear`, leave this session and run `claude --model sonnet "/loopwright-flow"` in the same folder; subagents keep their configured models, and a role whose model is `inherit` follows the session model, so it would run on the cheaper model too; Codex and Junie: start a new session and run the flow. End the turn. If the user's next message arrives in the same session, continue with `/loopwright-test` as usual.
94
95
  - Any code edit after a pass makes the verdict stale; review again.
@@ -8,7 +8,7 @@ The tester writes acceptance tests from the confirmed ACs and locks them. This t
8
8
 
9
9
  ## Setup
10
10
 
11
- Before your first message to the user, read `{{LW_HOME}}/prompts/user-messages.md` unless you already read it in this conversation, and write every message to the user by it.
11
+ Before your first message to the user, read `{{LW_HOME}}/prompts/user-messages.md` and `{{LW_HOME}}/prompts/glossary.md` unless you already read them in this conversation, and write every message to the user by them, using one term for each idea.
12
12
 
13
13
  1. Run every loopwright command from the worktree root: `cd "$(git rev-parse --show-toplevel)"`.
14
14
  2. `node "{{LW_HOME}}/hooks/lw.mjs" brief tester` → `dir` (`<lw>`), `task` (path relative to `<lw>`), `stage`, `lockedTests`, `reopened`, `pulledLocks`, `effort`. `dir` `null` inside a git repo → no task has started here yet; `lw.mjs start` creates `.loopwright/` with the first task, so continue and `task: null` reports "no active task". Not a git repo → tell the user loopwright must run inside a git repo, stop.
@@ -23,7 +23,7 @@ Before your first message to the user, read `{{LW_HOME}}/prompts/user-messages.m
23
23
 
24
24
  ## Steps
25
25
 
26
- 1. `node "{{LW_HOME}}/hooks/lw.mjs" stage test` (it updates the task file header `stage:` line; if it prints `"header": false`, set that line by hand).
26
+ 1. `node "{{LW_HOME}}/hooks/lw.mjs" stage test` (it updates the task file header `stage:` line; if it prints `"header": false`, run `node "{{LW_HOME}}/hooks/lw.mjs" set stage test`).
27
27
  2. Now spawn the `loopwright-tester` subagent and wait for its result. Give it only the absolute task file path (`<lw>/<task>`) and, for large tier, "Write tests only for slice S<n>: AC…". `pulledLocks`: "A pull changed these locked tests: <paths>. Check each still tests its acceptance criteria, edit only what the pull broke, and re-lock them; leave every other locked test untouched." Reopened: "Reopened task: the reason is … Write or edit tests only for AC…; existing locked tests for them may be edited and re-locked." No chat history, no implementation hints. On Claude Code pass `effort` = the `effort` from `brief` on the spawn; if `brief` has no `effort` (it warns on stderr) or the spawn rejects `effort`, spawn without it (the agent file's effort applies).
28
28
  Fix tasks: also say the task is a fix whose `## Bug report` it must read, and name any existing test the scout or the user found already failing with the reported symptom.
29
29
  3. Verify the report:
@@ -32,13 +32,13 @@ Before your first message to the user, read `{{LW_HOME}}/prompts/user-messages.m
32
32
  - Read the new test files. Comments or doc blocks that restate a test name or an acceptance criterion break the standards: spawn the `loopwright-tester` subagent and wait for its result again, naming the files, before Build; it may edit and re-lock its own tests for this.
33
33
  - Fix tasks: compare each repro failure excerpt with the `observed` line in `## Bug report`. A different error type or message, or a different wrong output, is a mismatch (the test does not match the reported symptom): send the tester back with the mismatch described, via the same spawn rule. A `[regression]` test is expected to pass; one that fails is a `Needs` item.
34
34
  - Fix tasks, no repro (the tester locked no `[repro]` test and `Needs` says it could not reproduce): run `node "{{LW_HOME}}/hooks/lw.mjs" await-user "no repro for the reported bug"`, show the tester's `Needs` in plain words following the rules file (what it tried, what happened, what evidence is missing, and what that means for the fix), then ask one question, recommendation first. After the answer run `node "{{LW_HOME}}/hooks/lw.mjs" resume && node "{{LW_HOME}}/hooks/lw.mjs" stage test` as one call, so a `reopen` by a subagent you spawn next does not directly follow the `resume`.
35
- - (a) Provide the missing evidence: add it to `## Bug report`, dispatch the tester again.
36
- - (b) Find the faulty unit: spawn the `loopwright-scout` subagent and wait for its result, asking it to investigate the internals and name a suspect unit and why. The user confirms or corrects the unit. Then add a `[repro]` criterion at that unit's interface to the task file (`[asked]` decision) and dispatch the tester again.
37
- - (c) Stop the task: set `status: stopped` in the task file header and run `node "{{LW_HOME}}/hooks/lw.mjs" done` (the task file stays).
38
- If (a) and (b) both fail, the task stops the same way, with what was tried recorded in the task file and an honest next step for the user (for example a normal `/loopwright-flow` task to add logging around the suspected code). No repro, no fix: there is no option to continue without a repro, and Build never starts.
39
- - `Uncovered` or `Needs` not empty → show those items to the user, one at a time, in plain words following the rules file: what the tester could not cover or needs. The answer may change an AC or a decision: write it to the task file (`[asked]`), then dispatch the tester again.
40
- 4. Write the test file next to each AC line (`— test: <file>`). `pulledLocks`: leave the slice markers alone. Large tier otherwise: change the slice (reopened: every slice in scope) to `S<n> [tested]`.
41
- 5. Tell the user in a few lines, in plain words following the rules file: what behavior the new tests check, that the tests are now frozen so the code writer cannot change them, and the test file paths in brackets after. Then the next stage is `/loopwright-build`.
35
+ - (a) Provide the missing evidence: append it to `## Bug report` (`node "{{LW_HOME}}/hooks/lw.mjs" section "Bug report" --append <<'LW_TEXT'`, the text on the next lines, then `LW_TEXT`), dispatch the tester again.
36
+ - (b) Find the faulty unit: spawn the `loopwright-scout` subagent and wait for its result, asking it to investigate the internals and name a suspect unit and why. The user confirms or corrects the unit. Then add a `[repro]` criterion at that unit's interface (`node "{{LW_HOME}}/hooks/lw.mjs" add ac --tag repro --interface <module, export>`, the text on stdin through a quoted heredoc) and an `asked` decision (`node "{{LW_HOME}}/hooks/lw.mjs" add decision --tag asked`), and dispatch the tester again.
37
+ - (c) Stop the task: run `node "{{LW_HOME}}/hooks/lw.mjs" set status stopped` and then `node "{{LW_HOME}}/hooks/lw.mjs" done` (the task file stays).
38
+ If (a) and (b) both fail, the task stops the same way, with what was tried appended to `## Bug report` (`section "Bug report" --append`) and an honest next step for the user (for example a normal `/loopwright-flow` task to add logging around the suspected code). No repro, no fix: there is no option to continue without a repro, and Build never starts.
39
+ - `Uncovered` or `Needs` not empty → show those items to the user, one at a time, in plain words following the rules file: what the tester could not cover or needs. The answer may change an AC or a decision: change the criterion with `edit AC<n>` and record the answer with `add decision --tag asked`, then dispatch the tester again.
40
+ 4. Write the test file of each AC with `node "{{LW_HOME}}/hooks/lw.mjs" edit AC<n> --test <file>`. `pulledLocks`: leave the slice markers alone. Large tier otherwise: run `node "{{LW_HOME}}/hooks/lw.mjs" mark S<n> tested` for the slice (reopened: every slice in scope).
41
+ 5. Tell the user in a few lines, in plain words following the rules file: what behavior the new tests check, that the tests are now locked so the implementer cannot change them, and the test file paths in brackets after. Then the next stage is `/loopwright-build`.
42
42
 
43
43
  ## Rules
44
44
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "loopwright",
3
3
  "author": "Xuan Son Trinh",
4
- "version": "0.1.11",
4
+ "version": "0.1.12",
5
5
  "description": "Agent workflow installer for Claude Code, Codex and Junie",
6
6
  "type": "module",
7
7
  "bin": {
@@ -42,6 +42,6 @@
42
42
  "tsdown": "^0.23.7",
43
43
  "typescript": "^7.0.2",
44
44
  "unrun": "^0.3.1",
45
- "vitest": "^5.1.0"
45
+ "vitest": "^5.1.1"
46
46
  }
47
47
  }