@softure-ai/skills 0.0.0-stage → 0.1.0

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.
Files changed (34) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +71 -2
  3. package/WORKFLOW.md +308 -0
  4. package/package.json +31 -4
  5. package/rules/AGENTS.md +78 -0
  6. package/scripts/install.mjs +151 -0
  7. package/scripts/uninstall.mjs +49 -0
  8. package/skills/softure-archive/SKILL.md +100 -0
  9. package/skills/softure-code-review/SKILL.md +124 -0
  10. package/skills/softure-frame/SKILL.md +113 -0
  11. package/skills/softure-impl-review/SKILL.md +150 -0
  12. package/skills/softure-implement/SKILL.md +141 -0
  13. package/skills/softure-init/SKILL.md +131 -0
  14. package/skills/softure-lesson/SKILL.md +99 -0
  15. package/skills/softure-new/SKILL.md +127 -0
  16. package/skills/softure-plan/SKILL.md +157 -0
  17. package/skills/softure-plan/references/progress-format.md +79 -0
  18. package/skills/softure-plan-review/SKILL.md +152 -0
  19. package/skills/softure-prd/SKILL.md +132 -0
  20. package/skills/softure-research/SKILL.md +165 -0
  21. package/skills/softure-roadmap/SKILL.md +128 -0
  22. package/skills/softure-rule-review/SKILL.md +121 -0
  23. package/skills/softure-shape/SKILL.md +128 -0
  24. package/skills/softure-worktree/SKILL.md +888 -0
  25. package/skills/softure-worktree/scripts/wt-integration.sh +59 -0
  26. package/skills/softure-worktree/scripts/wt-open.sh +57 -0
  27. package/skills/softure-worktree/scripts/wt-roadmap.py +301 -0
  28. package/skills/softure-worktree/scripts/wt-status.sh +70 -0
  29. package/skills/softure-worktree/scripts/wt_config.py +109 -0
  30. package/skills/softure-worktree-manager/SKILL.md +553 -0
  31. package/skills/softure-worktree-manager/scripts/wm-launch.sh +52 -0
  32. package/skills/softure-worktree-manager/scripts/wm-report.sh +45 -0
  33. package/skills/softure-worktree-manager/scripts/wm-resume.sh +132 -0
  34. package/skills/softure-worktree-manager/scripts/wm-watch.sh +49 -0
@@ -0,0 +1,888 @@
1
+ ---
2
+ name: softure-worktree
3
+ description: >
4
+ Carry exactly ONE change — a roadmap item or Change ID — in its own git
5
+ worktree next to the repo: run the whole softure chain there autonomously,
6
+ deciding instead of asking (research → frame → plan → plan-review →
7
+ implement → impl-review → full integration suite → lesson → archive on the
8
+ branch), pull the main branch in and resolve conflicts, then STOP at
9
+ "ready_to_merge" and wait for the owner's signal. On that signal: merge into
10
+ the main branch, remove the worktree and the branch. No push of the main
11
+ branch, no release, no deploy (the owner publishes releases). Built so
12
+ several changes can run in parallel sessions without stepping on each other.
13
+ Use when the user invokes /softure-worktree, or says "take this change in a
14
+ separate worktree", "run it in its own worktree and tell me when it's ready
15
+ to merge", "take it in a worktree and go"; and for the second half when
16
+ they say "merge it", "go into main", "main is free", or run
17
+ /softure-worktree merge.
18
+ argument-hint: "[roadmap-item-id | change-id] [--base <branch>] [--dry-run] | merge [change-id] [--no-tests] | status"
19
+ allowed-tools:
20
+ - Read
21
+ - Glob
22
+ - Grep
23
+ - Write
24
+ - Edit
25
+ - Bash
26
+ - Agent
27
+ - Skill
28
+ - AskUserQuestion
29
+ - SendMessage
30
+ - TaskCreate
31
+ - TaskUpdate
32
+ - TaskList
33
+ - TaskGet
34
+ ---
35
+
36
+ # /softure-worktree — One Change, Its Own Worktree, Main Branch on Signal
37
+
38
+ **One run, one change, one worktree, one branch.** This skill carries a single
39
+ change from an empty folder to `ready_to_merge` in its own worktree, and merges
40
+ it only on a signal. It never walks the roadmap: picking several changes,
41
+ running them side by side and merging them one by one is
42
+ `/softure-worktree-manager`'s job — it launches this skill once per change.
43
+
44
+ This skill is the autonomous shell around the delivery chain
45
+ (`WORKFLOW.md` §1). It invokes every chain skill with `--auto`, so they decide
46
+ instead of asking (`WORKFLOW.md` §8), and it stops only on the escalations
47
+ below.
48
+
49
+ > **Read this first if you are tempted to skip a step:** each chain skill
50
+ > consumes the artifact the previous one wrote. Skipping `/softure-research`
51
+ > does not save a step, it hands `/softure-plan` an empty input and produces a
52
+ > plan built on guesses. The chain is the point.
53
+
54
+ **Project configuration.** Everything project-specific — the main branch, the
55
+ gates, the integration suite, the migrations folder, the worktree setup, the
56
+ report language, whether releases belong to the owner — comes from
57
+ `context/workflow.json` (`WORKFLOW.md` §2). Read it at A0 with
58
+ `python3 <S>/wt_config.py --json`. Below, `<main>` is `mainBranch`, "the gates"
59
+ are every command in `gates`, and reports to the user are written in
60
+ `language`.
61
+
62
+ ## Invocation
63
+
64
+ ```
65
+ /softure-worktree # pick the next free, unblocked item → run to READY
66
+ /softure-worktree FC-2 # this roadmap ID (or Change ID)
67
+ /softure-worktree FC-3 --base <branch> # item whose prerequisite is still an unmerged branch
68
+ /softure-worktree --dry-run # show the pick and the overlap check, change nothing
69
+ /softure-worktree merge [change-id] # owner's signal: merge into <main>, clean up
70
+ /softure-worktree merge --no-tests # owner waived the test run on <main> after the merge
71
+ /softure-worktree status # all worktrees, stages, free lesson and migration numbers
72
+ ```
73
+
74
+ Invoked from inside an existing change worktree (or with a Change ID whose
75
+ branch already exists) → **resume**, not open (see A0).
76
+
77
+ `<S>` below is the scripts folder of this skill **in the main tree**:
78
+ `<MAIN>/.claude/skills/softure-worktree/scripts` (`<MAIN>` =
79
+ `python3 <S>/wt_config.py --root`, the first entry of `git worktree list`).
80
+ Always call the scripts through that absolute path — installed skills are
81
+ usually git-ignored, so a fresh worktree may not have its own copy.
82
+
83
+ ## Two phases and one gate
84
+
85
+ ```
86
+ PHASE A (autonomous) GATE PHASE B (on signal)
87
+ A0 preflight → A1 pick → A2 open → A3 chain (… → A3.8 integration) → A4 archive → A5 sync → READY ⏸ → B merge → cleanup
88
+ <main> <main> <main>+wt worktree worktree worktree <main>
89
+ ```
90
+
91
+ **READY is the end of phase A and the end of the turn.** Report and stop. Do
92
+ not merge, push `<main>` or release on your own. `<main>` is shared; the moment
93
+ of entry is the owner's call — another process may be running on it.
94
+
95
+ **What may leave the machine:** the change branch itself (pushing it protects
96
+ the work) and whatever refs the project's remote integration command pushes
97
+ (A3.8). `<main>` changes only through the merge on the signal (Phase B or the
98
+ coordinator); a push of `<main>` only as Phase B or the roadmap header says.
99
+ **Tags and releases never** when `release.owner` is true — a published release
100
+ *is* the deploy, and it is the owner's (see *Deploy-bound work*).
101
+
102
+ > **Under `/goal`:** the condition is met at READY. If the owner set a goal
103
+ > such as "implement and merge", READY still comes first; merge only follows an
104
+ > explicit signal in the conversation or the goal text itself saying "merge
105
+ > without asking". Do not let a stop hook push you into phase B.
106
+
107
+ ## Cloud session (Claude Code on the web) — branch instead of worktree
108
+
109
+ **Detect it first, in A0:** `[ "$CLAUDE_CODE_REMOTE" = true ]`. When it holds,
110
+ this run is a cloud session and the rules in this section **replace** the
111
+ matching steps below. Everything else (the chain, the gates, the Prime
112
+ Directive, the escalations) stays as written. Why a separate mode: the
113
+ container is fresh and ephemeral, it has one checkout on the session's own
114
+ branch, and the *other* sessions are other containers that see **only
115
+ `origin`** — a stage written to a local `<main>` is invisible to them, so two
116
+ cloud sessions could take the same item.
117
+
118
+ **1. Claim first, on origin, before anything else.** Right after A1 picks the
119
+ item — before installing dependencies, before research — mark it taken **on
120
+ `origin/<main>`**:
121
+
122
+ ```bash
123
+ python3 <S>/wt-roadmap.py open <change-id>
124
+ ```
125
+
126
+ In a cloud session the script (it detects `CLAUDE_CODE_REMOTE`) fetches
127
+ `origin/<main>`, commits that one row on top of it without touching the
128
+ checkout, and **pushes it at once** (retries on a race). Git hooks stay on:
129
+ the push goes from a throwaway worktree whose HEAD is the roadmap commit and
130
+ whose upstream is `origin/<main>`, so a pre-push hook that diffs
131
+ `HEAD @{push}` sees only `roadmap.md`. Never `--no-verify` a push, never
132
+ disable hooks. **Do not push the claim by hand from the session checkout or a
133
+ detached HEAD**: the hook then counts the session's code (or "all files") and
134
+ runs the full suite first, and the claim stays invisible to other sessions
135
+ meanwhile. **Check it landed:** `git ls-remote origin <main>` must show the new
136
+ SHA before you start research.
137
+
138
+ The row says `cloud session, branch <session-branch> — do not take in another
139
+ session`. If `open` refuses because the row is already `in_progress`, another
140
+ session owns it: pick again (A1), never take it over. Every `stage` call later
141
+ in the chain goes to origin the same way, so the owner and every other session
142
+ see live state. A1's "not already taken" check reads **`origin/<main>`**
143
+ (`git fetch origin <main> && git show origin/<main>:context/foundation/roadmap.md`),
144
+ not the local file.
145
+
146
+ **2. No worktree — the session branch is the change branch.** Skip
147
+ `wt-open.sh`. Work in the checkout, on the branch the session was started on;
148
+ it plays the role of `<change-id>` everywhere below (commits, `## Progress`
149
+ SHAs, the READY report). Relative paths are safe — there is no second tree. If
150
+ the session branch is not at `origin/<main>`'s tip when you start, merge
151
+ `origin/<main>` into it first. Record the branch in `change.md` (`branch:`).
152
+
153
+ **3. Dependencies.** Run the `worktree.setup` steps that make sense in the
154
+ container (installing dependencies; not copying a local `.env` that does not
155
+ exist). If a private package registry is unreachable (no token in the
156
+ container), install everything else and restore the manifests so nothing about
157
+ it lands in a commit: back up the manifest and lockfile to the scratchpad,
158
+ remove the private dependency, install, copy the backups back, and check
159
+ `git status --short` is clean.
160
+
161
+ **4. Fewer resources — plan for it.** Cloud containers have fewer CPUs and
162
+ often no outbound access to production hosts or ssh. So:
163
+
164
+ - Run the test gate **once per phase commit**, in the background, and do
165
+ nothing heavy beside it; never two suites at once.
166
+ - Integration: exactly as locally — A3.8 — when the project's integration
167
+ command can run from the container (a remote CI command needs only git and
168
+ network). If it cannot, say so verbatim in READY.
169
+ - Anything that needs production (a request to the live site, ssh) goes to
170
+ **Pending owner checks**, with the exact command.
171
+ - Browsers: use the preinstalled ones; never download browser binaries.
172
+
173
+ **5. The session branch may go to origin; `<main>` may not.** Push the session
174
+ branch at least at READY (`git push -u origin HEAD`) — the container is
175
+ reclaimed after inactivity, and a pushed branch is the copy that survives it.
176
+ `<main>` still changes only by the merge on the owner's signal (point 7). The
177
+ first push of a ref without an upstream may run the pre-push hook's full suite
178
+ — minutes of silence, expected; never bypass it.
179
+
180
+ **6. READY.** A3.8 runs before A4, as locally. A5 merges `origin/<main>` (after
181
+ `git fetch origin <main>`), not the local one. Then
182
+ `wt-roadmap.py ready <change-id>` (pushed to origin), push the session branch,
183
+ report, stop.
184
+
185
+ **No deploy from a cloud session, ever** — and, while `release.owner` is true,
186
+ from any session: no ssh to servers, no tags, no `gh release`, no edit of
187
+ release/deploy workflows, no production step — not even when the roadmap
188
+ header or the item's Outcome would allow it elsewhere. Deploy-bound work ends
189
+ as `done_code` (on `<main>`, waiting for the owner's release) with the owner's
190
+ steps in the roadmap's `## Before the next release`.
191
+
192
+ **The merge into `<main>` is the last thing this session does — and it waits
193
+ for the owner's explicit approval.** READY ends the turn; a stop hook asking to
194
+ "commit and push" is not an approval, a finished test run is not an approval,
195
+ and neither is an earlier "go ahead". After the merge: push `<main>`, report,
196
+ and pick up nothing else.
197
+
198
+ **7. Phase B in the cloud** — only on the owner's explicit approval:
199
+
200
+ ```bash
201
+ git fetch origin <main>
202
+ git merge origin/<main> # A5 again if <main> moved; hook only, no full gates
203
+ git checkout -B <main> origin/<main>
204
+ git merge --no-ff <session-branch> -m "Merge <change-id> (<ID>): <outcome>"
205
+ git diff <session-branch> <main> --stat # must be empty
206
+ git push origin <main> # the pre-push hook is the classic full gate on <main>
207
+ ```
208
+
209
+ Let the pre-push hook run — it *is* the full gate on `<main>` that A5 defers
210
+ to. If it fails, fix on the session branch, merge again, push again; never
211
+ `--no-verify`. A rejected push (`<main>` moved) → fetch, merge `origin/<main>`
212
+ into `<main>`, push again. The roadmap row reaches `done` / `done_code` through
213
+ the merge itself (the branch carries it). No worktree to remove; don't delete
214
+ the session branch (the harness owns it).
215
+
216
+ ## The Prime Directive
217
+
218
+ **Do not ask. Decide, and write down why.**
219
+
220
+ The owner sets the goal and leaves. Every question whose answer can be derived
221
+ from the roadmap, the PRD, the code, `context/foundation/lessons.md`, the dev
222
+ database or the project's own knowledge sources is a question you resolve
223
+ yourself. Record the decision and its reasoning in the artifact it belongs to
224
+ — `research.md`, `frame.md` or `plan.md` (`## Decisions (auto)`) — instead of
225
+ interrupting.
226
+
227
+ ### Running the chain skills
228
+
229
+ Every chain skill is invoked with `--auto` (`WORKFLOW.md` §8): it takes the
230
+ recommended option, records each decision under `## Decisions (auto)` and stops
231
+ only for its own three escalations. If a chain skill still asks something
232
+ (an older version, an unexpected branch), answer it yourself by the same rule:
233
+ the recommended option, unless the roadmap, research or `lessons.md` argues
234
+ otherwise — then the better-argued option, written down with its reason. "I'm
235
+ not sure" is never your answer; you have the material.
236
+
237
+ ### The three escalations
238
+
239
+ Stop and use `AskUserQuestion` only here. Everything else you resolve. When the
240
+ run was launched by `/softure-worktree-manager` (the prompt names a
241
+ coordinator), send the escalation to the coordinator with `SendMessage`
242
+ instead — nobody watches a background session's prompt.
243
+
244
+ 1. **The work would destroy or overwrite someone else's work.** Uncommitted WIP
245
+ you would have to discard, a migration that drops a populated column, a force
246
+ push, anything irreversible that is not yours.
247
+ 2. **A measurement falsifies the premise of the whole item.** Not "a phase got
248
+ harder" — that you re-plan. This is "the roadmap item assumes X, X is
249
+ measurably false, so the item as written builds nothing." Report the
250
+ measurement and wait. Do not plan around a refuted premise.
251
+ 3. **The run spans sessions and unpushed `<main>` is the only copy.** The
252
+ change branch is no reason to ask: push it (`git push -u origin
253
+ <change-id>`) whenever machine loss would cost real work, and say so in the
254
+ report. Only `<main>` cannot be pushed early on your own (Phase B step 6):
255
+ if a merge made `<main>` the only copy of real work, ask.
256
+
257
+ A fourth, weaker case: an **irreversible production change** — ask, but only
258
+ when the roadmap item does not already call for it. Dropping a populated
259
+ production table, sending mail to real addresses, a force push: irreversible
260
+ *and* unasked-for. A change the item names in its own Outcome is **authorized
261
+ by that Outcome** — do it, verify it, report it afterwards. Reversible changes
262
+ you always make.
263
+
264
+ ### The failure mode this section exists to prevent
265
+
266
+ **Stopping is not the safe default. Stopping is a failure.** The owner set a
267
+ goal and left precisely so the work would continue without them; a run that
268
+ halts to confirm a decision the material already settles has turned an
269
+ autonomous run into a slow interactive one, and the owner comes back to a
270
+ question instead of a result.
271
+
272
+ Three habits that look like diligence and are not:
273
+
274
+ - **The pre-emptive check-in.** "The plan is ready — shall I start?" No. The
275
+ chain says implement next, so implement.
276
+ - **Escalating a product judgement because it *feels* like the owner's.** A
277
+ choice between two options you can argue from research, `lessons.md`, the PRD
278
+ or a measurement is **yours**, even when it touches copy, naming or what a
279
+ page claims. Pick the better one, write down why, move on. The owner corrects
280
+ it later if they disagree — cheaper for them than being asked.
281
+ - **Listing "decisions I need from you" at the end of a step.** If you can name
282
+ a recommendation, you have already made the decision. Record it as a
283
+ decision, not a question.
284
+
285
+ The test: *could I defend this choice from something written down?* If yes,
286
+ decide. Only a genuine escalation stops the run — and escalation 2 means a
287
+ **measurement refuted the premise**, not that a choice felt weighty.
288
+
289
+ ## Only your change
290
+
291
+ You own **one** change: the one whose Change ID is your branch name. Other
292
+ folders in `context/changes/` belong to other worktrees or are queued for them
293
+ — never resume, edit, archive or "tidy" them.
294
+
295
+ ### Resume ladder
296
+
297
+ `change.md`'s `status` (`WORKFLOW.md` §4) tells you where the chain broke.
298
+ Re-entering a completed step is safe; the chain skills are idempotent by
299
+ artifact.
300
+
301
+ | `status` | Re-enter at |
302
+ | --- | --- |
303
+ | `new` | A3.1 — research |
304
+ | `preparing` | A3.2 — frame (if `frame.md` is absent and needed), else A3.3 — plan |
305
+ | `planned` | A3.4 — plan review |
306
+ | `plan_reviewed` | A3.5 — implement, from the first `- [ ]` in `## Progress` |
307
+ | `implementing` | A3.5 — implement, from the first `- [ ]` in `## Progress` |
308
+ | `implemented` | A3.6 — implementation review |
309
+ | `impl_reviewed` | A3.7 — triage, then A3.8 — integration, then A4 — archive |
310
+ | `archived` | A4 — finish the move, then A5 |
311
+
312
+ The first `- [ ]` in `## Progress` (`WORKFLOW.md` §6) is the resume point
313
+ *within* implementation. Trust it over any memory of what you did.
314
+
315
+ This skill does **not** walk the roadmap item after item (that is
316
+ `/softure-worktree-manager`), push at archive, or edit the main tree's roadmap
317
+ by hand — the stage lives on `<main>` and is written only by `wt-roadmap.py`.
318
+
319
+ ## Phase A
320
+
321
+ ### A0 — Preflight (main tree, `<main>`)
322
+
323
+ > **Cloud session?** (`CLAUDE_CODE_REMOTE=true`) → see *Cloud session* above:
324
+ > claim on origin first, no worktree; the session branch may be pushed,
325
+ > `<main>` changes only on the signal.
326
+
327
+ ```bash
328
+ python3 <S>/wt_config.py --json # the project's commands, branch, language
329
+ bash <S>/wt-status.sh --files
330
+ git status --short && git diff --cached --quiet || echo STAGED
331
+ ```
332
+
333
+ - **Resume check first.** If the requested Change ID already has a branch, or
334
+ the session was started inside `../<repo>-<id>`, it is a resume: enter it
335
+ (A2, *working through paths*), read `change.md` `status` and use the resume
336
+ ladder. Never open a second worktree for the same change.
337
+ - Staged changes on `<main>` are someone else's commit in progress. Fine for
338
+ reading, but `wt-roadmap.py` refuses to commit under them. Wait and retry;
339
+ don't unstage them.
340
+ - Uncommitted WIP on `<main>` is **normal** (other sessions). Record it; never
341
+ touch it.
342
+ - No `context/workflow.json` → the project has not run `/softure-init`. Run it
343
+ with `--auto` (it detects the stack) and commit the file on `<main>` as its
344
+ own docs-only commit before anything else.
345
+
346
+ ### A1 — Pick
347
+
348
+ Source: an argument wins — match it against the roadmap `ID` column first
349
+ (`FC-2`), then the Change ID. Without one, pick from `## At a glance`
350
+ (`WORKFLOW.md` §5):
351
+
352
+ - **Eligible** = `Status` is `ready` and `Mode` is `autonomous`; never `done`,
353
+ never `blocked`. `proposed` only when no `ready` item remains — say so in
354
+ `change.md`'s Notes, because `proposed` means the owner marked it droppable.
355
+ - Read the item's `### <ID>` block (`Outcome`, `Change ID`, `Prerequisites`,
356
+ `Risk`, `Unknowns`, `Baseline`). **Its Unknowns are your planning agenda** —
357
+ each is a decision you will make and record, not a question you will ask.
358
+ - Order: `## Order`, then table order.
359
+
360
+ Plus three rules for parallel work:
361
+
362
+ 1. **Not already taken.** A row that says `in_progress` or `ready_to_merge`
363
+ belongs to another session, even if its worktree looks idle.
364
+ 2. **Prerequisites delivered in code.** `done` and `done_code` both count,
365
+ because the code is on `<main>`. A prerequisite that is still a live branch
366
+ makes the item eligible **only** with `--base <that-branch>`; record the
367
+ merge order in the roadmap note (`merge after FC-1`).
368
+ 3. **No overlap with running worktrees.** Compare the item's likely surface
369
+ (its roadmap block, the PRD refs, a quick grep) with `wt-status.sh --files`
370
+ of every live branch. Shared *documents* (`roadmap.md`, `lessons.md`,
371
+ `prd.md`) are expected and resolvable. Shared **code files, or both needing
372
+ a migration,** is a collision — two branches will generate the same
373
+ migration number. Prefer a different item. Take it anyway only when nothing
374
+ else is eligible, and write the collision into `research.md` so the merge
375
+ step expects it.
376
+
377
+ **Nothing eligible → report what is taken, what is blocked and why, then
378
+ stop.** Don't invent work and don't take an overlapping item to keep busy.
379
+
380
+ If the owner names a different source ("from the backlog", "from the changes
381
+ folder"), use exactly that source. Moving an entry from `context/backlog/` into
382
+ `context/changes/` is a `git mv`.
383
+
384
+ `--dry-run`: print the pick, the overlap table, the base branch. Stop.
385
+
386
+ ### A2 — Open
387
+
388
+ > **Cloud session:** replaced by *Cloud session* points 1–3.
389
+
390
+ Order matters: **mark the roadmap on `<main>` first, then branch from it**, so
391
+ the branch already carries its own `in_progress` row and the first back-merge
392
+ has one conflict less.
393
+
394
+ ```bash
395
+ python3 <S>/wt-roadmap.py open <change-id> [--note "prerequisite X on branch Y — merge after X"]
396
+ bash <S>/wt-open.sh <change-id> [--base <branch>] # prints WT=<path>
397
+ ```
398
+
399
+ `wt-open.sh` creates `../<repo>-<change-id>` on branch `<change-id>`, runs
400
+ every `worktree.setup` step inside it (installing dependencies, copying local
401
+ env files), and exits non-zero unless the worktree is clean afterwards. A setup
402
+ step that writes tracked files (an installer refreshing committed files) is a
403
+ bug in the setup — restore the files and fix the step; never commit them.
404
+ Prefer a real install over symlinking dependency folders from the main tree:
405
+ some bundlers break on symlinked dependencies.
406
+
407
+ Then **work in the worktree through paths, not through the session's cwd.**
408
+ The session stays launched in the main tree, and every Bash call may reset
409
+ there. So:
410
+
411
+ - every Bash call starts with `cd <WT> &&` (or uses `git -C <WT>`);
412
+ - every `Read`/`Edit`/`Write` takes an **absolute `<WT>/…` path**. Check the
413
+ prefix before each edit. One slip writes into `<main>` while another session
414
+ is editing the same file;
415
+ - chain skills write to `context/changes/<id>/…`. Translate that to
416
+ `<WT>/context/changes/<id>/…` every time, never the main tree's copy; tell
417
+ each chain skill the worktree root when you invoke it;
418
+ - sanity check at the start of each step: `cd <WT> && git branch
419
+ --show-current` must print `<change-id>`.
420
+
421
+ `EnterWorktree(path: "<WT>")` would move the session's cwd into the worktree
422
+ and make relative paths safe; use it only when the owner allows it in this
423
+ repo.
424
+
425
+ Finally, the change folder: `/softure-new <change-id> --auto` if it doesn't
426
+ exist. If it arrived with `<main>` (queued in `context/changes/`), it is
427
+ already there. If it lives in `context/backlog/`, `git mv` it. Set `branch:` in
428
+ `change.md` to `<change-id>` (worktree `<WT>`).
429
+
430
+ ### A3 — The chain (inside the worktree)
431
+
432
+ The chain runs **inside the worktree** (paths, not cwd — A2). First the
433
+ worktree-specific rules that hold across all its steps, then the steps.
434
+
435
+ **Stage on `<main>`, every step.** At research, frame, plan, plan-review,
436
+ `implement N/M`, impl-review, integration and archive:
437
+
438
+ ```bash
439
+ python3 <S>/wt-roadmap.py stage <change-id> "implement 2/5"
440
+ ```
441
+
442
+ It works from any worktree (it finds the main one itself) and commits only that
443
+ row. The owner reads `<main>`'s roadmap as the live board — don't make them
444
+ ask whether it is up to date.
445
+
446
+ **Gates run in the worktree** — every command in `gates` — and `git add -A`
447
+ there. The worktree has no one else's WIP, so "the whole tree" means only your
448
+ work, and a tree-wide pre-commit hook sees only your tree. Disabling hooks
449
+ should never be needed here; if it seems to be, something foreign got in —
450
+ find it.
451
+
452
+ **Integration: the full suite, once per item — A3.8.** Running only "your"
453
+ integration tests lets regressions through that no session sees; the full
454
+ suite on the final tree is what READY reports.
455
+
456
+ **Baseline for "see it red first".** Put a baseline worktree **in the
457
+ scratchpad**, detached, never as a sibling `../<repo>-baseline` — a sibling
458
+ directory is indistinguishable from a change worktree to everyone else.
459
+
460
+ ```bash
461
+ git worktree add --detach "$SCRATCH/baseline" <sha>
462
+ # provide dependencies (install, or symlink when the test runner tolerates it)
463
+ # … run the test, see it fail …
464
+ git worktree remove --force "$SCRATCH/baseline"
465
+ ```
466
+
467
+ **Lesson numbers.** Before `/softure-lesson`, run `wt-status.sh`. It prints
468
+ the highest `L-` across `<main>` **and every worktree** and the next free one —
469
+ an unmerged branch may already hold the number `<main>` would give you.
470
+ Numbers can still collide with a branch opened later; A5 re-checks.
471
+
472
+ **Migrations.** Migration generators number from your branch's state, so two
473
+ branches can produce the same number. Don't write the migration's number into
474
+ prose (roadmap notes, deployment docs) until A5 has confirmed it.
475
+
476
+ #### A3.1 — Research
477
+
478
+ ```
479
+ /softure-research <change-id> --auto
480
+ ```
481
+
482
+ Scope is the roadmap item's Outcome plus its PRD refs; depth is "deep" for
483
+ anything touching money arithmetic, auth, migrations, data integrity or the
484
+ product's core engine, "standard" otherwise. Pass that along.
485
+
486
+ Before moving on, confirm `research.md` exists and actually answers the item's
487
+ `Unknowns`. If it does not, dispatch targeted sub-agents for the gaps and
488
+ append the findings. A plan built on a thin research file is the most
489
+ expensive mistake in this chain.
490
+
491
+ #### A3.2 — Frame (conditional)
492
+
493
+ `/softure-frame` challenges **what** to build. Run
494
+ `/softure-frame <change-id> --auto` when **any** holds:
495
+
496
+ - The Outcome names a mechanism rather than a user-visible result ("add a
497
+ feature flag store") and research suggests a cheaper mechanism reaches the
498
+ same result.
499
+ - Research contradicted a roadmap `Baseline` claim, or found the thing already
500
+ half-built.
501
+ - The item's `Unknowns` contain a genuine fork where the branches differ in
502
+ cost to the owner, not just in taste.
503
+ - `PRD refs` conflict with each other or with `lessons.md`.
504
+
505
+ Otherwise skip, and **write one line in `research.md` saying you skipped
506
+ framing and why**. A silent skip is indistinguishable from forgetting. When
507
+ frame finishes, continue with the plan.
508
+
509
+ #### A3.3 — Plan
510
+
511
+ ```
512
+ /softure-plan <change-id> --auto
513
+ ```
514
+
515
+ Two hard requirements before you leave this step:
516
+
517
+ - **No open questions in the plan.** For you, an open question means *decide
518
+ it now and write the decision in*. An open question that survives into
519
+ `plan.md` becomes an interruption during implementation.
520
+ - **`## Progress` is well-formed** (`WORKFLOW.md` §6): last section, one
521
+ `### Phase N:` per `## Phase N:`, every success criterion as `- [ ] N.M`,
522
+ `#### Automated` and `#### Manual` split honestly. `/softure-implement`
523
+ cannot resume without it.
524
+
525
+ **Split Automated vs Manual by who can verify, not by who traditionally
526
+ does.** A3.5 verifies most "manual" checks itself (browser automation, the
527
+ database, HTTP, the product's own tools). A check you can drive belongs under
528
+ `#### Automated` with the command that drives it. Reserve `#### Manual` for
529
+ what genuinely needs the owner's eyes — visual taste, copy tone, a third-party
530
+ console.
531
+
532
+ ##### Choose the implementation discipline here
533
+
534
+ Write the choice into the plan, per phase (`**Discipline:** TDD | test-after`).
535
+ Use TDD when the phase changes **arithmetic, money handling, tax or business
536
+ rules, migrations, or fixes a reported wrong number**: an arithmetic defect
537
+ gets an oracle of a *different kind* than the implementation, and you must
538
+ **see the new test fail before the fix**. For UI, wiring, copy and
539
+ scaffolding, test-after is fine. `/softure-impl-review` checks you did what you
540
+ picked.
541
+
542
+ #### A3.4 — Plan review
543
+
544
+ ```
545
+ /softure-plan-review <change-id> --auto
546
+ ```
547
+
548
+ Resolve every finding yourself:
549
+
550
+ | Severity | Autonomous disposition |
551
+ | --- | --- |
552
+ | CRITICAL | Always fix. Re-run the review afterwards. |
553
+ | WARNING | Fix unless the fix contradicts the item's scope; then "Accept risk" with a one-line reason. |
554
+ | SUGGESTION | Apply when it fits inside files this plan already touches and adds no phase. Otherwise skip with a one-line reason. |
555
+
556
+ Never leave a finding without a decision — the review file is the audit trail
557
+ of a run nobody watched. If triage rewrote phases, **re-check `## Progress`
558
+ consistency** before implementing.
559
+
560
+ #### A3.5 — Implement every phase
561
+
562
+ ```
563
+ /softure-implement <change-id> phase 1 --auto
564
+ ```
565
+
566
+ Then phase 2, 3, … to the end, without stopping between phases. Re-read
567
+ `plan.md` at each phase start — earlier phases may have taught you something
568
+ the plan did not know.
569
+
570
+ ##### Gates before every phase commit
571
+
572
+ Every command in `gates`, in the worktree. Green or there is no commit. A
573
+ pre-push hook may run the tests again on later pushes; per commit, these gates
574
+ are the line.
575
+
576
+ No integration run per phase: the full suite runs once, at A3.8, on the final
577
+ tree. A phase that writes a new integration test and wants to see it run
578
+ earlier uses the same script with its own name
579
+ (`wt-integration.sh <change-id>-p<N>`) — it is the full suite, so do it only
580
+ when the test is the point of the phase.
581
+
582
+ ##### Staging
583
+
584
+ In a worktree the whole tree is your work — nobody else edits it — so stage
585
+ the whole tree: `git add -A`. Something foreign in the worktree's diff means a
586
+ path slipped into the wrong tree (A2); find out how before committing. Never
587
+ use `git checkout <file>` to undo an experiment — copy to the scratchpad and
588
+ restore from there.
589
+
590
+ The one exception, when the project's rules allow it: **if the entire change
591
+ touched only documentation (`*.md`, `context/`)**, the test gate may be
592
+ skipped; stage only your own paths and verify with `git status --short` that
593
+ no code rode along. Any touch of code, migrations, scripts or config puts you
594
+ back on full gates.
595
+
596
+ Keep the commit subject form `<type>(<change-id>): <phase title> (p<N>)`
597
+ (`WORKFLOW.md` §9). Never `--no-verify`, never `--amend`.
598
+
599
+ ##### Verify the manual checks yourself
600
+
601
+ This is what makes the run autonomous. When a phase ends, do not hand manual
602
+ verification back. Work through each `#### Manual` item and drive it:
603
+
604
+ - **Browser** — automation (e.g. Playwright) against the dev server for
605
+ anything with a UI: render, navigate, fill, click, screenshot, read the
606
+ result. Look at the screenshot; do not assume.
607
+ - **The product's own interfaces** — its API, CLI or MCP server read the same
608
+ logic the UI shows; often the fastest oracle for "is the number right".
609
+ - **Database** — query it directly; for history or migration correctness,
610
+ compare row counts and values, not the rendered page.
611
+ - **HTTP** — `curl` for routes, headers, status codes, redirects, cookie
612
+ attributes.
613
+
614
+ Tick the box **only on evidence you actually looked at**;
615
+ `/softure-implement` is the sole writer of `## Progress`.
616
+
617
+ What you genuinely cannot verify — visual taste, production DNS, a third-party
618
+ dashboard, real email delivery — stays `- [ ]` and goes into a **Pending owner
619
+ checks** list in the READY report. It does not block archiving.
620
+
621
+ ##### When the plan and the code disagree
622
+
623
+ - Plan is right, reality shifted slightly → adapt and continue; note the
624
+ adaptation in the phase commit body.
625
+ - A plan step is genuinely unnecessary now → skip it; note why.
626
+ - The mismatch invalidates the *remaining* phases → re-plan: back to A3.3 for
627
+ the remaining phases only, keep the landed phases and their SHAs, resume.
628
+ - The mismatch invalidates the *whole item* → escalation 2. Report and wait.
629
+
630
+ #### A3.6 — Implementation review
631
+
632
+ ```
633
+ /softure-impl-review <change-id> --auto
634
+ ```
635
+
636
+ Full-plan review, not per phase. It writes
637
+ `context/changes/<id>/reviews/impl-review.md`.
638
+
639
+ #### A3.7 — Triage every finding
640
+
641
+ Same dispositions as A3.4, plus:
642
+
643
+ - Fixes land as their own commit, `fix(<change-id>): address impl review`,
644
+ after the same full gates.
645
+ - A finding that is a **class of mistake** rather than a one-off becomes a
646
+ lesson (A3.9) — and the code is fixed too, unless the lesson is purely about
647
+ process.
648
+ - Deferred findings go to the backlog (`WORKFLOW.md` §3), never into thin air.
649
+
650
+ Re-run `/softure-impl-review` after fixes if any finding was CRITICAL. Leave
651
+ the review file with every finding decided.
652
+
653
+ #### A3.8 — Full integration suite
654
+
655
+ After the impl-review fixes are committed and before archiving — the tree the
656
+ item delivers is final except for paperwork. Stage `integration` on `<main>`,
657
+ then:
658
+
659
+ ```bash
660
+ cd <WT> && bash <S>/wt-integration.sh <change-id> # [--wait MIN], default 30
661
+ ```
662
+
663
+ It runs `integration.remote` (a project command that runs the suite on CI for
664
+ the committed HEAD and waits) or else `integration.local`, for the
665
+ **committed** HEAD — uncommitted files do not ride along (it warns; commit
666
+ first). Output lines and exit codes:
667
+
668
+ | exit | meaning | do |
669
+ | --- | --- | --- |
670
+ | `0` | green (flaky tests that passed on retry are listed as `flaky:`) | on to A3.9. A flaky test in a file your change touched is yours: remove the cause, don't raise retries |
671
+ | `1` | red — or the run could not start | **`new-red:` lines are yours** (reds absent from `<main>`'s latest result). Fix them before READY (see it red first — the run itself is the red), commit `fix(<change-id>): integration — <what>` after full gates, run A3.8 again with the same name. **Reds already on `<main>`** (`red:` but not `new-red:`) are not the item's to fix: report them in READY; the coordinator queues them as their own row. When the command cannot tell new from old, treat every red as yours unless you show it red on `<main>` (scratchpad worktree detached at `origin/<main>`, the same script with name `<change-id>-baseline`) |
672
+ | `75` | no result in time | nothing is lost — the run continues. Follow the printed link, wait for it to finish, read its result. Running A3.8 again starts a **new** run — do that only when the run itself failed to start or died. Never report READY without a result |
673
+ | `78` | integration not configured | READY says `integration: not configured`; suggest configuring it in the report |
674
+
675
+ **Only documentation in the whole change** (the docs-only case, no test gate
676
+ either) → no integration run; READY says `integration: n/a — documentation
677
+ only`.
678
+
679
+ #### A3.9 — Capture the lesson
680
+
681
+ If this change taught something that generalizes — a trap in the stack, a
682
+ wrong assumption the tests did not catch, a pattern worth repeating:
683
+
684
+ ```
685
+ /softure-lesson "<one-line rule>" --auto
686
+ ```
687
+
688
+ Fill its fields from the run, in the worktree's `lessons.md`. **The number
689
+ comes from `wt-status.sh`** (next free across all worktrees), not `<main>`'s
690
+ max + 1 — tell the skill which number to use, or renumber its entry right
691
+ after it writes.
692
+
693
+ Do not manufacture a lesson every change. A lessons file padded with the
694
+ unremarkable is a file nobody reads. Roughly: if you would not want to be told
695
+ this at the start of the next change, do not write it.
696
+
697
+ #### Deploy-bound work
698
+
699
+ Code that needs a release, a new production secret or a production check ends
700
+ as **`done_code (<date>; waiting: <what>)`** — on `<main>`, waiting for the
701
+ owner's release. Put the owner's steps in the roadmap section
702
+ `## Before the next release` (create it above `## Owner decisions and checks`
703
+ if missing): a new secret (where it must be set, under which name), a new
704
+ build-time value, a migration to watch, a one-off command, a production check
705
+ (an exact `curl`). It is the owner's checklist before they publish.
706
+
707
+ While `release.owner` is true: never create a tag, never publish a release,
708
+ never trigger a release workflow, never edit release/deploy workflows or add a
709
+ production environment to any workflow without an explicit order from the
710
+ owner. This rule may be the only thing between a session and production.
711
+
712
+ ### A4 — Archive on the branch
713
+
714
+ Stage `archive`, then `/softure-archive <change-id> --auto` — **no push of
715
+ `<main>`** (the change branch may go to origin, `<main>` never). It stamps
716
+ `change.md`, moves the folder to `context/archive/<created>-<id>/` and commits
717
+ `chore(archive): close <change-id>`. Commit uncommitted files of the change
718
+ folder first (they are yours). Then, on the branch:
719
+
720
+ - The roadmap row (table **and** item block) must read `done` — or
721
+ `done_code (<date>; waiting: <what waits for the release>)` when the change
722
+ awaits a deploy. Pure document changes stay `done`. Add the `## Done` line
723
+ (`WORKFLOW.md` §5) if the archive step did not.
724
+ - Re-point links: documents that referenced `context/changes/<id>/` must now
725
+ point to `context/archive/<date>-<id>/` (`grep -rn "changes/<id>"`).
726
+ - Commit on the branch.
727
+
728
+ ### A5 — Sync with `<main>` and prove it
729
+
730
+ `<main>` moved while you worked. It always does.
731
+
732
+ ```bash
733
+ cd <WT> && git merge <main> # merge, NOT rebase: ## Progress holds the branch's SHAs
734
+ ```
735
+
736
+ Conflict rules, applied the same way in every run so the owner never has to
737
+ check them:
738
+
739
+ | File | Resolution |
740
+ | --- | --- |
741
+ | `roadmap.md`, your row and block | **branch** (`done` / `done_code`) |
742
+ | `roadmap.md`, every other row and section | **`<main>`** |
743
+ | `lessons.md` | `<main>`'s entries first, yours after, **renumbered** to the next free number (`wt-status.sh`). Update every reference to your old numbers (plan, reviews, archive docs, code comments): `grep -rn "L-<old>"`. |
744
+ | migration number collision (`migrations.dir`) | `<main>`'s migration keeps its number. Save your migration body (it may hold hand edits). Remove your migration and whatever metadata the generator keeps for it, take `<main>`'s metadata, run `migrations.regenerate`, then diff the new file against the saved body and restore any hand edits. Update prose that names the number. |
745
+ | `change.md` / archive docs of other changes | union: keep `<main>`'s links and add yours |
746
+ | code | resolve on the merits; this is the only row that needs thought |
747
+
748
+ Then commit the merge. **No full gates after a back-merge.** The pre-commit
749
+ hook is enough; don't run the test gate or integration on the merged tree, and
750
+ don't repeat A3.8 — the item's integration run was on the pre-merge branch,
751
+ and that is the one READY reports. Full gates run twice anyway: in the
752
+ worktree before the back-merge, and the classic way on `<main>` after Phase B
753
+ (the pre-push hook or the owner's own run); the full suite runs again on
754
+ `<main>` after the roadmap and on every release. A third run in between buys
755
+ nothing and, with several worktrees live, mostly measures machine load.
756
+
757
+ What still has to hold: no conflict markers left
758
+ (`git grep -nE '^(<<<<<<<|>>>>>>>)'` → nothing) and the hook green. If a
759
+ *code* conflict needed resolving on the merits, that part is new code: run the
760
+ tests for the files you touched, not the whole suite.
761
+
762
+ Record the stage on `<main>`:
763
+
764
+ ```bash
765
+ python3 <S>/wt-roadmap.py ready <change-id>
766
+ ```
767
+
768
+ ### READY — report and stop
769
+
770
+ Write it in the configured `language`, for someone who wasn't there:
771
+
772
+ ```
773
+ <ID> `<change-id>` — ready to merge.
774
+
775
+ Branch <change-id> (worktree ../<repo>-<change-id>), <N> commits, <main> merged in @ <sha>.
776
+ Gates on the branch before merging <main>: <each gate> ✓ (tests <count>)
777
+ integration: <green|red|n/a|not configured> <passed>/<total> on <sha> — <url>; new reds: <list or "none">
778
+ (reds already on <main>: <list or "none">; flaky: <list or "none">)
779
+ After merging <main>: hook ✓ — full gates the classic way on <main>.
780
+
781
+ What it delivers: <2–4 sentences: the outcome for the user, not a file list>
782
+ Conflicts when merging <main>: <file — how resolved>, lessons <L-x…>, migration <number>
783
+ Waits for the release: <migration, secret, steps — or "nothing, documentation only">
784
+ For your eyes: <Manual items you could not verify yourself>
785
+ Decisions worth knowing: <one line each, pointing to the artifact>
786
+
787
+ On your signal ("merge") I'll merge into <main> and remove the worktree and the branch. No push of <main> and no deploy — the release is yours.
788
+ ```
789
+
790
+ Then end the turn. Don't poll, don't schedule wake-ups, and don't ask "shall I
791
+ merge?". The report already says what happens next.
792
+
793
+ ## Phase B — merge (only on the owner's signal)
794
+
795
+ Signals (in any language the owner uses): "merge", "go into main", "main is free",
796
+ `/softure-worktree merge`. "Wait", "I'll let you know" mean wait, even if earlier you were told to
797
+ merge at the end.
798
+
799
+ 1. **Main tree on `<main>`:** `git branch --show-current` in the main tree
800
+ must print `<main>`. Commands for the branch go through `git -C <WT>`.
801
+ 2. **Is the branch current?** `git merge-base --is-ancestor <main>
802
+ <change-id>` must succeed. If `<main>` moved again, repeat A5 inside the
803
+ worktree (`git -C <WT> merge <main>`, conflicts, commit with the hook only —
804
+ **no full gates**), then come back. When a dependency branch was used
805
+ (`--base`), check it is already in `<main>` (`git merge-base --is-ancestor
806
+ <base> <main>`). If not, wait for it.
807
+ 3. **Foreign WIP on `<main>` that the merge would touch:**
808
+ ```bash
809
+ comm -12 <(git diff --name-only HEAD | sort) <(git diff --name-only <main>...<change-id> | sort)
810
+ ```
811
+ - Empty → go.
812
+ - Only `context/foundation/roadmap.md` / `lessons.md` → park it, merge, put
813
+ it back:
814
+ ```bash
815
+ git stash push -- <those paths>
816
+ git merge --no-ff … # step 4
817
+ git stash pop # both sides append at the end → usually CONFLICTS
818
+ # resolve by keeping both sides (no markers left), then UNSTAGE it:
819
+ git reset -q -- <those paths> # a conflicted pop leaves them staged/unmerged
820
+ git diff -- <those paths> # must show ONLY the other session's lines
821
+ git stash drop # only after that diff checks out
822
+ ```
823
+ Skip the `git reset` and the other session's WIP stays in the index,
824
+ where the next commit (theirs or yours) picks it up untested. A failed pop
825
+ keeps the stash, so nothing is lost until you drop it.
826
+ - Anything else → another session is editing the same code right now.
827
+ Report the files and wait; don't stash code that isn't yours.
828
+ 4. **Merge:** `git merge --no-ff <change-id> -m "Merge <change-id> (<ID>):
829
+ <outcome, one line>"`. The pre-commit hook runs. Since step 2 made `<main>`
830
+ an ancestor, `git diff <change-id> <main> --stat` must now be **empty** —
831
+ proof that `<main>` holds exactly the branch's tree. The full gates on that
832
+ tree run the classic way on `<main>` afterwards; say that in the report.
833
+ With `--no-tests`, the owner has also waived that later run; say so.
834
+ 5. **Cleanup — only your own:**
835
+ ```bash
836
+ git -C <WT> status --short # must be empty (ignored files are fine)
837
+ git worktree remove <WT> # --force only if the refusal names nothing but ignored files
838
+ git branch -d <change-id> # -d, never -D: refuses if not merged, which is the point
839
+ git worktree list # yours gone, others untouched
840
+ ```
841
+ 6. **No push of `<main>`.** Say so in one line and offer it. If the work has
842
+ spanned sessions and `<main>` is the only copy, that is escalation 3: ask.
843
+ If you pushed the change branch earlier, delete it from origin now
844
+ (`git push origin --delete <change-id>`) — it is merged.
845
+ 7. **Report:** merge SHA, conflicts and how they were resolved, what waits for
846
+ the release (and the roadmap section it is written in), worktree and branch
847
+ removed, `<main>` not pushed.
848
+
849
+ ## Escalations specific to worktrees (in addition to the three above)
850
+
851
+ - **Another session's uncommitted code overlaps your merge** (B3) → wait and
852
+ report. Never stash, overwrite or commit it.
853
+ - **Someone else's worktree or branch looks abandoned** → report it. Never
854
+ remove it. `git worktree remove` and `git branch -d` are only for your own.
855
+ - **The pick is only possible by colliding** with a live branch's code → take
856
+ nothing, report the table (A1).
857
+
858
+ ## Invariants
859
+
860
+ - **One run, one change, one worktree, one branch** — all named
861
+ `<change-id>`. Never pick a second change after READY; the manager does that.
862
+ - **`## Progress` in `plan.md` is the only execution state.**
863
+ `/softure-implement` is its only writer; the roadmap stage is a pointer at
864
+ it, never a copy.
865
+ - **Every chain skill runs with `--auto`**, and every decision you made instead
866
+ of asking is written down in `research.md`, `frame.md` or `plan.md`.
867
+ - **A commit per completed phase, SHA in `## Progress`, full gates first.**
868
+ - **See the test fail before you believe the fix**; an arithmetic fix gets an
869
+ oracle of a different kind.
870
+ - **`<main>` is written by exactly two things:** `wt-roadmap.py` (one row per
871
+ commit) and the final `--no-ff` merge. Nothing else from this skill lands on
872
+ `<main>`, and nothing lands there before the owner's signal. Refs this skill
873
+ may push: the change branch and whatever the project's integration command
874
+ pushes — nothing else.
875
+ - **The roadmap on `<main>` always shows where the change is:** `in_progress`
876
+ from A2 with the current stage, `ready_to_merge` at READY,
877
+ `done` / `done_code` after the merge.
878
+ - **Every file edit from A2 to B1 lands under `<WT>`**, never in the main tree.
879
+ - **Integration: the full suite, once per item** — A3.8, after impl-review and
880
+ its fixes, before archive. New reds are fixed before READY; reds already on
881
+ `<main>` are reported.
882
+ - **Lesson numbers come from `wt-status.sh`**, never from `<main>` alone.
883
+ - **No push of `<main>` before the signal, no tag, no release, no deploy, no
884
+ `--no-verify`, no `git checkout <file>`, no `branch -D`.**
885
+ - **After the merge, `<main>`'s tree equals the branch's tree**
886
+ (`git diff <change-id> <main>` empty).
887
+ - **Full gates run in the worktree before the back-merge and on `<main>` after
888
+ it, never on the merged tree in between.**