loopwright 0.1.11 → 0.1.13
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.
- package/README.md +6 -6
- package/content/agents/implementer.md +1 -1
- package/content/agents/reviewer.md +1 -1
- package/content/hooks/default-config.json +1 -0
- package/content/hooks/guard-locked-tests.mjs +1 -1
- package/content/hooks/lib.mjs +101 -29
- package/content/hooks/lw.mjs +469 -67
- package/content/hooks/plain-questions.mjs +6 -10
- package/content/hooks/reinject-context.mjs +10 -3
- package/content/hooks/stop-gate.mjs +1 -2
- package/content/hooks/task-file.mjs +243 -0
- package/content/prompts/blocked-branch.md +9 -0
- package/content/prompts/commit-and-pr.md +55 -0
- package/content/prompts/glossary.md +37 -0
- package/content/prompts/standards.md +1 -0
- package/content/prompts/user-messages.md +6 -25
- package/content/skills/loopwright-build/SKILL.md +7 -7
- package/content/skills/loopwright-done/SKILL.md +25 -16
- package/content/skills/loopwright-explore/SKILL.md +1 -1
- package/content/skills/loopwright-fix/SKILL.md +2 -2
- package/content/skills/loopwright-flow/SKILL.md +10 -8
- package/content/skills/loopwright-park/SKILL.md +10 -2
- package/content/skills/loopwright-plan/SKILL.md +73 -48
- package/content/skills/loopwright-review/SKILL.md +29 -22
- package/content/skills/loopwright-test/SKILL.md +9 -9
- package/dist/cli.js +1 -0
- package/package.json +2 -2
|
@@ -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
|
|
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
|
|
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),
|
|
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 →
|
|
36
|
-
2. Both lists empty →
|
|
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 `
|
|
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
|
|
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,
|
|
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`,
|
|
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,33 @@ 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
|
|
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.
|
|
74
|
-
|
|
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`)
|
|
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 →
|
|
79
|
-
- No (follow-ups only) →
|
|
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,
|
|
82
|
-
|
|
83
|
-
Large tier:
|
|
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 →
|
|
89
|
+
- large → after a slice review, offer the slice commit below, then 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`.
|
|
90
|
+
- Large, after a slice review passes (every slice, the last one too; never after the whole-branch review, whose fixes Done commits), before marking the slice `[passed]` and before the question below: offer a local commit. Draft the message by `{{LW_HOME}}/prompts/commit-and-pr.md`. Run `node "{{LW_HOME}}/hooks/lw.mjs" await-user "commit the slice"`, then `node "{{LW_HOME}}/hooks/lw.mjs" commit --prepare` (it runs `git add` for the task's changes and lists the files). Tell the user in plain words following the rules file which files are added to the commit and that `git restore --staged <file>` leaves one out, show the message, and ask one question: commit these files with this message, or not. After the answer run `node "{{LW_HOME}}/hooks/lw.mjs" resume`.
|
|
91
|
+
- Approved → run `node "{{LW_HOME}}/hooks/lw.mjs" commit <<'LW_COMMIT'` with the message on the next lines, then `LW_COMMIT`. It commits exactly what is in git's index and never pushes; tell the user the commit id it prints.
|
|
92
|
+
- Declined → nothing is committed; the files stay in git's index and the next commit includes them.
|
|
93
|
+
- `commit --prepare` or `commit` refuses because the branch is blocked → follow `{{LW_HOME}}/prompts/blocked-branch.md`.
|
|
94
|
+
- It fails (a git hook or signing rejected the commit) → show git's error and run `await-user "commit failed"`, then ask: retry, skip (the changes stay added and the task goes on) or commit it yourself; run `resume` after the answer. Never skip hooks.
|
|
95
|
+
- The output names files a hook rewrote → tell the user which, and since their content changed after the review, Review runs again for this slice (the verdict is stale) before the slice is marked `[passed]`.
|
|
89
96
|
- 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.
|
|
91
|
-
2. Re-read the task file and
|
|
92
|
-
3. Run `node "{{LW_HOME}}/hooks/lw.mjs" stage test` (it updates the header; if it prints `"header": false`, set
|
|
97
|
+
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.
|
|
98
|
+
2. Re-read the task file and add any decision made in this conversation that it is missing, with `add decision`.
|
|
99
|
+
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
100
|
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
101
|
- 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
|
|
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`,
|
|
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:
|
|
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
|
|
37
|
-
- (c) Stop the task: set
|
|
38
|
-
If (a) and (b) both fail, the task stops the same way, with what was tried
|
|
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:
|
|
40
|
-
4. Write the test file
|
|
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
|
|
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/dist/cli.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "loopwright",
|
|
3
3
|
"author": "Xuan Son Trinh",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.13",
|
|
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.
|
|
45
|
+
"vitest": "^5.1.1"
|
|
46
46
|
}
|
|
47
47
|
}
|