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.
@@ -1,20 +1,20 @@
1
1
  ---
2
2
  name: loopwright-done
3
- description: Use after a loopwright task passes review, to propose AGENTS.md knowledge updates, draft the commit message and PR description, and close the task without committing.
3
+ description: Use after a loopwright task passes review, to propose AGENTS.md knowledge updates, draft the commit message and PR description, make a local commit the user approves, and close the task.
4
4
  ---
5
5
  # loopwright done
6
6
 
7
- Done runs in this main thread; do not spawn the subagents here. You propose; the user approves each change. You do not commit.
7
+ Done runs in this main thread; do not spawn the subagents here. You propose; the user approves each change and the commit.
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` → `dir` (`<lw>`), `task`, `verdict`, `config.docsDir` (the main checkout's config; default `docs/agents`). `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.
15
15
  3. `task: null` → "no active task": stop. Then `node "{{LW_HOME}}/hooks/lw.mjs" fingerprint`.
16
- - No `verdict.pass: true`, or its `fingerprint` differs from the current one → the code changed since review or never passed: run `/loopwright-review` first. Continue only if the user explicitly says so, and note it in the review log.
17
- 4. `node "{{LW_HOME}}/hooks/lw.mjs" stage done` (it updates the task file header `stage:` line; if it prints `"header": false`, set that line by hand).
16
+ - No `verdict.pass: true`, or its `fingerprint` differs from the current one → the code changed since review or never passed: run `/loopwright-review` first. Continue only if the user explicitly says so, and record that as a decision (`node "{{LW_HOME}}/hooks/lw.mjs" add decision --tag asked <<'LW_TEXT'`, the text on the next line, then `LW_TEXT`).
17
+ 4. `node "{{LW_HOME}}/hooks/lw.mjs" stage done` (it updates the task file header `stage:` line; if it prints `"header": false`, run `node "{{LW_HOME}}/hooks/lw.mjs" set stage done`).
18
18
 
19
19
  ## 1. Knowledge (AGENTS.md)
20
20
 
@@ -29,7 +29,7 @@ If `CLAUDE.md` exists and has no line `@AGENTS.md`, propose adding that import l
29
29
 
30
30
  ## 2. Parked follow-ups
31
31
 
32
- `grep -l "^found while: <this task path>" <lw>/tasks/*.md` lists the stubs parked while this task ran (`status: proposed` ones are still open). For each, draft issue text (title, what and why, `path:line` evidence from its `## Evidence`) and show it to the user. It is shown only: never file it, and write no task paths or ids into it. A stub with `blocks: <this task path>` that is still `proposed` → ask one question: clear the flag (the stub no longer blocks) or note it in the PR.
32
+ `grep -lE "^([^ ]+ )?found while: <this task path>" <lw>/tasks/*.md` lists the stubs parked while this task ran (`status: proposed` ones are still open). For each, draft issue text (title, what and why, `path:line` evidence from its `## Evidence`) and show it to the user, written by `{{LW_HOME}}/prompts/commit-and-pr.md`. It is shown only: never file it, and write no task paths or ids into it. A stub with `blocks: <this task path>` that is still `proposed` → ask one question: clear the flag (the stub no longer blocks; `node "{{LW_HOME}}/hooks/lw.mjs" set blocks --unset --file tasks/<stub>.md`) or note it in the PR.
33
33
 
34
34
  In a linked worktree, its `status: proposed` stubs are deleted along with the worktree. List them and offer one question: move them to the main checkout with `node "{{LW_HOME}}/hooks/lw.mjs" carry` (it copies each into the main checkout's `tasks/` and marks the source `status: moved`; it fails in the main checkout, where the stubs already are). Run it only on yes; a stub the user keeps here is lost when the worktree is removed, so say so.
35
35
 
@@ -37,23 +37,32 @@ In a linked worktree, its `status: proposed` stubs are deleted along with the wo
37
37
 
38
38
  Never write task ids (AC, D, S shorthands) into tests, code, comments, commit messages or PR drafts. Describe decisions in words.
39
39
 
40
- Draft both and show them to the user:
41
- - Commit: imperative subject ≤ 72 chars; body says why, the key decisions, and the rejected options with the reason.
42
- - PR: summary of intent; decisions and rejected options; notable assumptions the reviewer should know; how it was verified (check commands, acceptance tests, review rounds from the log). Do not list the diff file by file. Run `node "{{LW_HOME}}/hooks/lw.mjs" check-locks`; when `relockedAfterReopen` is non-empty, add a section listing each locked test changed after a reopen with its reason; when `accepted` is non-empty, list each accepted re-lock or restart with its reason in that section too.
43
- - A `## Follow-ups` section for every kind of task, listing the parked stubs by title and any follow-ups in the task file (still no task paths or ids).
44
- - Fix tasks (`kind: fix`): the PR also states the root cause in one line (from `## Root cause`), the repro test name(s) with "failed before, passes after", and the follow-ups from `## Follow-ups`.
40
+ Draft both by `{{LW_HOME}}/prompts/commit-and-pr.md` and show them to the user. Do not list the diff file by file. Run `node "{{LW_HOME}}/hooks/lw.mjs" check-locks`. Sections built from the task record appear only when it has content:
41
+ - Locked tests changed after a reopen: when `relockedAfterReopen` is non-empty, list each with its reason; when `accepted` is non-empty, list each accepted re-lock or restart with its reason there too.
42
+ - `## Follow-ups`: the parked stubs by title and any follow-ups in the task file (still no task paths or ids).
43
+ - Fix tasks (`kind: fix`): the root cause in one line (from `## Root cause`) and the repro test name(s) with "failed before, passes after", and the follow-ups from `## Follow-ups`.
45
44
 
46
45
  ## Going back
47
46
 
48
47
  When the user says at any question above that something needs fixing, and before Close, offer to go back; do not ask it on every run. Run `node "{{LW_HOME}}/hooks/lw.mjs" await-user "go back from done"` before asking one question, in plain words following the rules file: back to Test, back to Plan, or stay in Done. Recommend Test when only a test or the code changes, Plan when a decision, acceptance criterion or the scope changes.
49
48
  - Stay in Done → run `node "{{LW_HOME}}/hooks/lw.mjs" resume` and continue.
50
- - Plan or Test → run `node "{{LW_HOME}}/hooks/lw.mjs" resume`, append `- Scope change: <reason>` to the review log (the next review starts at round 1 and Simplify runs again), and record the go-back as `D<n> [asked]` with the user's reason. Then run `node "{{LW_HOME}}/hooks/lw.mjs" reopen <plan|test> "<reason>"` (it sets the header `stage:` line, and `plan: draft` for plan; if it prints `"header": false`, set those lines by hand), directly after `resume` with no other `lw.mjs` call between, and only after the user chooses it. Then continue with `/loopwright-plan` or `/loopwright-test`.
49
+ - Plan or Test → run `node "{{LW_HOME}}/hooks/lw.mjs" resume`, run `node "{{LW_HOME}}/hooks/lw.mjs" add scope-change` with the reason on stdin (the next review starts at round 1 and Simplify runs again), and record the go-back with `add decision --tag asked` and the user's reason.
50
+ Then run `node "{{LW_HOME}}/hooks/lw.mjs" reopen <plan|test> "<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`), directly after `resume` with no other state-changing `lw.mjs` call between (the writer calls above only edit the task file), and only after the user chooses it. Then continue with `/loopwright-plan` or `/loopwright-test`.
51
51
  - Applied AGENTS.md/docs edits and carried stubs are kept, not reverted; tell the user they enter the next review's diff.
52
52
 
53
- ## 4. Close
53
+ ## 4. Commit
54
54
 
55
- 1. Set `status: done` in the task file header.
55
+ Offer a local commit with the message drafted in step 3, in every tier. In a large task it also holds the fixes of the whole-branch review. Run `node "{{LW_HOME}}/hooks/lw.mjs" await-user "commit the work"`, 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`.
56
+ - 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.
57
+ - Declined → nothing is committed; the files stay in git's index.
58
+ - `commit --prepare` or `commit` refuses because the branch is blocked → follow `{{LW_HOME}}/prompts/blocked-branch.md`.
59
+ - 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.
60
+ - The output names files a hook rewrote → tell the user which; their content changed after the review, so Review runs again (run `/loopwright-review`) before Close, then come back here.
61
+
62
+ ## 5. Close
63
+
64
+ 1. `node "{{LW_HOME}}/hooks/lw.mjs" set status done`.
56
65
  2. `node "{{LW_HOME}}/hooks/lw.mjs" done` (removes this worktree's machine state; the task file stays).
57
- 3. Tell the user the work is ready to commit, including any approved AGENTS.md/docs changes.
66
+ 3. Tell the user what was committed, or that nothing was and the changes wait in git's index, including any approved AGENTS.md/docs changes.
58
67
 
59
- Do not commit, push, or create the PR. Never delete the task file.
68
+ Never push, and never create the PR: the PR description stays a draft for the user. Never delete the task file.
@@ -8,7 +8,7 @@ Writes a walkthrough of a codebase (or one folder, `/loopwright-explore services
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` → `<lw>`. `null` inside a git repo → no task has started here yet; `lw.mjs explore` creates `.loopwright/`, so continue. Not a git repo → tell the user loopwright must run inside a git repo, stop.
@@ -8,12 +8,12 @@ Entry for bug fixes. It reuses Plan, Test, Build, Review and Done with `kind: fi
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` creates `.loopwright/`, so continue with a new task. Not a git repo → tell the user loopwright must run inside a git repo, stop.
15
15
  3. `node "{{LW_HOME}}/hooks/lw.mjs" status`. "no active task" → this worktree is free; the bug is a new goal, so run "Goal intake" below before Steps (a related task in another worktree is not started again here). It prints a task → this worktree is occupied; follow "Goal intake" below instead of starting a second task here.
16
- 4. Hooks check: `grep -l "loopwright/hooks/" .claude/settings.json .codex/config.toml .junie/config.json ~/.claude/settings.json ~/.codex/config.toml ~/.junie/config.json 2>/dev/null`. No match → warn the user once: "loopwright hooks are not installed, so nothing stops the code writer from editing the frozen tests (locked tests), nothing keeps the agent from stopping with work unfinished (stop gate), and a shortened conversation loses track of the task (context restore); run `npx loopwright init` to install them." Continue unless the user objects.
16
+ 4. Hooks check: `grep -l "loopwright/hooks/" .claude/settings.json .codex/config.toml .junie/config.json ~/.claude/settings.json ~/.codex/config.toml ~/.junie/config.json 2>/dev/null`. No match → warn the user once: "loopwright hooks are not installed, so nothing stops the implementer from editing the locked tests, nothing keeps the agent from stopping with work unfinished (stop gate), and a shortened conversation loses track of the task (context restore); run `npx loopwright init` to install them." Continue unless the user objects.
17
17
 
18
18
  ## Goal intake
19
19
 
@@ -8,21 +8,21 @@ Runs the stage skills in order for the confirmed tier and resumes where a task l
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` → `<lw>`. `null` inside a git repo → no task has started here yet; `lw.mjs start` creates `.loopwright/` with the first task, so continue. Not a git repo → tell the user loopwright must run inside a git repo, stop.
15
- 3. Hooks check: `grep -l "loopwright/hooks/" .claude/settings.json .codex/config.toml .junie/config.json ~/.claude/settings.json ~/.codex/config.toml ~/.junie/config.json 2>/dev/null`. No match → warn the user once: "loopwright hooks are not installed, so nothing stops the code writer from editing the frozen tests (locked tests), nothing keeps the agent from stopping with work unfinished (stop gate), and a shortened conversation loses track of the task (context restore); run `npx loopwright init` to install them." Continue unless the user objects. In Codex, hooks also need approval via `/hooks`.
15
+ 3. Hooks check: `grep -l "loopwright/hooks/" .claude/settings.json .codex/config.toml .junie/config.json ~/.claude/settings.json ~/.codex/config.toml ~/.junie/config.json 2>/dev/null`. No match → warn the user once: "loopwright hooks are not installed, so nothing stops the implementer from editing the locked tests, nothing keeps the agent from stopping with work unfinished (stop gate), and a shortened conversation loses track of the task (context restore); run `npx loopwright init` to install them." Continue unless the user objects. In Codex, hooks also need approval via `/hooks`.
16
16
  4. Junie: if a `loopwright-<role>` subagent fails because its configured model is not available to the user, spawn it again without `model` and `reasoningLevel` (Junie's default); this is not an error to report.
17
17
 
18
18
  ## Resume
19
19
 
20
20
  `node "{{LW_HOME}}/hooks/lw.mjs" status`:
21
21
  - Prints a task, and the user gave a new goal → the worktree is occupied: follow "Goal intake" below, never continue the task unasked. Prints a task, and no goal or the goal is that task → read `<lw>/<task>` and continue at its `stage` (plan: run `loopwright-plan`, which resumes the open plan; review: count rounds from the review log).
22
- - "no active task" → `grep -l "^status: active" <lw>/tasks/*.md`.
22
+ - "no active task" → `grep -lE "^([^ ]+ )?status: active" <lw>/tasks/*.md`.
23
23
  - One or more files → ask the user which one (or a new task). For the chosen file, offer to rebuild state from it: `node "{{LW_HOME}}/hooks/lw.mjs" start tasks/<file>.md --base <base commit from its header>`, then `node "{{LW_HOME}}/hooks/lw.mjs" stage <stage from its header>`. Locked-test hashes are lost with the state: if the task already has acceptance tests and is past Test, tell the user; re-lock the test files named in its AC lines (`stage test`, `lock <files>`, then `stage <stage>`) only if the user confirms they are unchanged.
24
24
  - None, or the user wants a new task → continue below.
25
- - Also list stubs parked by `/loopwright-park` (`status: proposed` in `lw.mjs tasks`, from any worktree; `grep -l "^status: proposed" <lw>/tasks/*.md` lists this worktree's). Offer each as start, drop, or a new task instead. Start → run `loopwright-plan` on it as in that skill ("Parked stubs"); a stub that sits in another worktree starts in a new worktree instead (`lw.mjs worktree "<title>" --stub <absolute path>`, then print the start command). Drop → set `status: dropped` in the stub; never delete it.
25
+ - Also list stubs parked by `/loopwright-park` (`status: proposed` in `lw.mjs tasks`, from any worktree; `grep -lE "^([^ ]+ )?status: proposed" <lw>/tasks/*.md` lists this worktree's). Offer each as start, drop, or a new task instead. Start → run `loopwright-plan` on it as in that skill ("Parked stubs"); a stub that sits in another worktree starts in a new worktree instead (`lw.mjs worktree "<title>" --stub <absolute path>`, then print the start command). Drop → run `node "{{LW_HOME}}/hooks/lw.mjs" set status dropped --file <stub path>`, where the path is the stub's worktree from `lw.mjs tasks` + `/.loopwright/` + its task (`--file tasks/<stub>.md` only finds this worktree's stubs); never delete it.
26
26
  - An `olderLayout` entry listed under this worktree is a task from before tasks were kept per worktree: offer `node "{{LW_HOME}}/hooks/lw.mjs" adopt <task>` to copy it and its state (with locks) in. Nothing moves or is deleted unasked.
27
27
  - No stubs and no task, or the user wants a new task → run "Goal intake" below for the user's goal, then start at Plan with the goal or spec path.
28
28
 
@@ -50,7 +50,7 @@ Follow each stage skill in turn (Claude Code `/loopwright-<stage>`, Codex `$loop
50
50
  - standard (and any fix): `loopwright-plan` → `loopwright-test` → `loopwright-build` → `loopwright-review` → `loopwright-done`
51
51
  - large: `loopwright-plan` → for each slice in order: `loopwright-test` → `loopwright-build` → `loopwright-review` → then one whole-branch `loopwright-review` → `loopwright-done`
52
52
  - A fix (`kind: fix` in the task file header; set by `/loopwright-fix`, or by Plan after the user agrees to run a bug-like goal as a fix) runs `loopwright-test` at every tier: a small fix is never built without a locked repro test. Large keeps its slice loop.
53
- - Going back is the user's choice only: at a deviation, an undecided review finding, or a fix the user raises at Done, run `node "{{LW_HOME}}/hooks/lw.mjs" reopen <plan|test> "<reason>"` (plan or test; accepted only after Build began; it sets the header `stage:` line, and `plan: draft` for plan; if it prints `"header": false`, set those lines by hand), then follow the stage skill it names. Locked tests may then be edited by the tester in Test and are re-locked.
53
+ - Going back is the user's choice only: at a deviation, an undecided review finding, or a fix the user raises at Done, run `node "{{LW_HOME}}/hooks/lw.mjs" reopen <plan|test> "<reason>"` (plan or test; accepted only after Build began; 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 follow the stage skill it names. Locked tests may then be edited by the tester in Test and are re-locked.
54
54
  - A failed review returns to `loopwright-build` and then `loopwright-review`, up to the task's fix-round cap.
55
55
 
56
56
  A "fresh context" answer (at the plan confirmation, or at a slice boundary) ends the turn after the stage is advanced; the next session resumes from `status` and the task file, as in Resume.
@@ -64,12 +64,14 @@ When a stage says to spawn the `loopwright-<role>` subagent, spawn the subagent
64
64
  ## Gates: stop and wait for the user
65
65
 
66
66
  - the goal restatement and the effort profile (one prompt) before the scout, each high-impact question, the "run this as a fix?" question for a bug-like goal, the low-impact batch, the tier/settings proposal, and the final plan confirmation;
67
- - the slice-boundary question after a large-tier slice review passes while a `[todo]` slice remains (continue here or in a fresh context);
67
+ - the slice commit question after a large-tier slice review passes (commit the files added to git's index with the shown message, or not), and then the slice-boundary question while a `[todo]` slice remains (continue here or in a fresh context);
68
+ - the new-branch question, when a commit is refused on a blocked branch (create a working branch and commit there, or skip the commit);
69
+ - the commit-failed question, at a slice or at Done, when a commit fails (retry, skip, or commit it yourself);
68
70
  - tester `Uncovered`/`Needs` items and implementer `Deviations`;
69
71
  - the moved-branch question at the start of Build and Review, when the branch has new commits that are already on the upstream branch (pulled commits, or this task's own);
70
72
  - fixes: the no-repro gate (no locked repro test: provide evidence, find the faulty unit, or stop; never continue without one) and, after the final passing review (whole-branch for large), the sibling gate (include siblings in this fix or list them as follow-ups);
71
73
  - the Simplify question at the start of Review (which proposed cuts to apply; not asked when there is nothing to cut), each undecided review finding, and the fix-round cap being reached;
72
74
  - going back from Done: when the user says at a Done question that something needs fixing, the question back to Plan, back to Test, or stay in Done;
73
- - each AGENTS.md / docs change, and the commit message and PR draft.
75
+ - each AGENTS.md / docs change, the commit message and PR draft, and the commit question at Done (commit with that message, or not).
74
76
 
75
- In Test (no-repro gate), Build, Review and Done (going back), run `node "{{LW_HOME}}/hooks/lw.mjs" await-user "<reason>"` before asking and `resume` after the answer, as those skills say; otherwise the stop gate pushes you past the gate. Never answer a gate yourself or treat silence as approval. Do not commit at any point.
77
+ In Test (no-repro gate), Build, Review and Done (the commit questions, going back), run `node "{{LW_HOME}}/hooks/lw.mjs" await-user "<reason>"` before asking and `resume` after the answer, as those skills say; otherwise the stop gate pushes you past the gate. Never answer a gate yourself or treat silence as approval. Commit only through the commit steps in Review and Done, after the user approves; never push.
@@ -8,7 +8,7 @@ Captures work found mid-task (call it B) as a stub, so the current task (A) keep
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` → `<lw>`. `null` inside a git repo → no task has started here yet; `lw.mjs park` creates `.loopwright/`, so continue. Not a git repo → tell the user loopwright must run inside a git repo, stop.
@@ -19,7 +19,15 @@ Before your first message to the user, read `{{LW_HOME}}/prompts/user-messages.m
19
19
  1. Restate B for the user to edit: a title, a one-paragraph goal, and evidence as `path:line` leads from what you already saw. No scouting: do not read more code to fill this in.
20
20
  2. Ask one question, "Does this block the current task?", recommendation "no" (Claude: `AskUserQuestion`; Codex: numbered text). It needs an active task; with none, skip it.
21
21
  3. Run `node "{{LW_HOME}}/hooks/lw.mjs" park "<title>"`, adding `--blocks` when the answer is yes and `--kind fix` when B is a bug. It prints `{stub, foundWhile, blocks}`.
22
- 4. Write the agreed goal under `## Goal` and the evidence under `## Evidence` of `<lw>/<stub>`.
22
+ 4. Write the agreed goal and the evidence into the stub, the text on stdin through a quoted heredoc (pick a delimiter that does not appear alone on a line in the text):
23
+ ```bash
24
+ node "{{LW_HOME}}/hooks/lw.mjs" section Goal --set --file <stub> <<'LW_TEXT'
25
+ <goal>
26
+ LW_TEXT
27
+ node "{{LW_HOME}}/hooks/lw.mjs" section Evidence --set --file <stub> <<'LW_TEXT'
28
+ <evidence>
29
+ LW_TEXT
30
+ ```
23
31
  5. Blocking → suggest running B first in a new worktree (`node "{{LW_HOME}}/hooks/lw.mjs" worktree "<title>" --stub <stub>` moves the stub there; print the start command as `loopwright-flow` describes under "Goal intake"), and leave A as it is.
24
32
  6. Tell the user the stub path (it lives in this worktree's `.loopwright/`) and that it is listed under A's `## Follow-ups`. Resume A where it was.
25
33
 
@@ -8,18 +8,18 @@ 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.
15
15
  3. `node "{{LW_HOME}}/hooks/lw.mjs" status`. "no active task" → this worktree is free; a new goal still goes through "Goal intake" below first (a related task in another worktree is not started again here), then continue with a new task. If it prints a task, read `<lw>/<task>`:
16
16
  - `stage: plan` and reopened (`status` `history` has a `reopen` event after the last `stage build` event; that event's `reason` says why) → this is the same task returning to Plan for added scope, not a second task: keep its decisions, ACs and tests, run sections 2–6 only for what the reason adds or changes (a new slice starts `[todo]`), then section 7. Do not ask whether the plan is abandoned.
17
17
  - `stage: plan`, and the user gave a new goal unrelated to this plan → the worktree is occupied: follow "Goal intake" below, do not resume.
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).
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 --force` and the new goal's title on stdin through a quoted heredoc, no path (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 (no path: the state tool names the file and prints it as `task`; 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 --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
- 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:
122
+ Path: `<lw>/tasks/<YYYY-MM-DD>-<HH-MM>-<readable-title>.md` — today's date, the local time and a short title from the goal; `start` picks it. Keep meaningful casing (`2026-11-08-14-30-add-CLAUDE-to-project.md`); spaces become `-`; replace only filesystem-unsafe characters (`/ \ : * ? " < > |`). If the name exists, append `-2`, `-3`, … before `.md`.
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.