@muggleai/works 4.10.0 → 4.11.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 (197) hide show
  1. package/README.md +3 -3
  2. package/dist/{chunk-RK6XKSZK.js → chunk-Q7WNEMN4.js} +109 -43
  3. package/dist/{chunk-UVXOHXY2.js → chunk-ZKRHFTIC.js} +832 -89
  4. package/dist/cli.js +2 -2
  5. package/dist/index.js +2 -2
  6. package/dist/plugin/.claude-plugin/plugin.json +1 -1
  7. package/dist/plugin/.cursor-plugin/plugin.json +1 -1
  8. package/dist/plugin/README.md +4 -2
  9. package/dist/plugin/agents/acceptance-tester.md +24 -10
  10. package/dist/plugin/commands/m.md +7 -0
  11. package/dist/plugin/commands/mdo.md +7 -0
  12. package/dist/plugin/commands/mfeedback.md +7 -0
  13. package/dist/plugin/commands/mimport.md +7 -0
  14. package/dist/plugin/commands/mpr.md +7 -0
  15. package/dist/plugin/commands/mprefs.md +7 -0
  16. package/dist/plugin/commands/mregen.md +7 -0
  17. package/dist/plugin/commands/mrelease.md +7 -0
  18. package/dist/plugin/commands/mrepair.md +7 -0
  19. package/dist/plugin/commands/mstatus.md +7 -0
  20. package/dist/plugin/commands/mtest.md +7 -0
  21. package/dist/plugin/commands/mtestlocal.md +7 -0
  22. package/dist/plugin/commands/mtestprep.md +7 -0
  23. package/dist/plugin/commands/mupgrade.md +7 -0
  24. package/dist/plugin/scripts/ensure-electron-app.sh +35 -8
  25. package/dist/plugin/skills/_aliases.json +18 -0
  26. package/dist/plugin/skills/_shared/dev-server-readiness.md +231 -0
  27. package/dist/plugin/skills/_shared/failure-mode-handling.md +244 -0
  28. package/dist/plugin/skills/_shared/post-merge-cleanup.md +10 -0
  29. package/dist/plugin/skills/_shared/pr-followup-helpers.md +150 -0
  30. package/dist/plugin/skills/_shared/rebase-before-e2e.md +15 -0
  31. package/dist/plugin/skills/_shared/telemetry-emit.md +15 -0
  32. package/dist/plugin/skills/_shared/use-worktrees.md +53 -0
  33. package/dist/plugin/skills/do/build.md +51 -0
  34. package/dist/plugin/skills/do/e2e-acceptance.md +64 -19
  35. package/dist/plugin/skills/do/impact-analysis.md +47 -7
  36. package/dist/plugin/skills/do/open-prs.md +72 -74
  37. package/dist/plugin/skills/do/pre-flight.md +21 -14
  38. package/dist/plugin/skills/do/requirements.md +2 -2
  39. package/dist/plugin/skills/do/unit-tests.md +2 -2
  40. package/dist/plugin/skills/m/SKILL.md +8 -0
  41. package/dist/plugin/skills/mdo/SKILL.md +8 -0
  42. package/dist/plugin/skills/mfeedback/SKILL.md +8 -0
  43. package/dist/plugin/skills/mimport/SKILL.md +8 -0
  44. package/dist/plugin/skills/mpr/SKILL.md +8 -0
  45. package/dist/plugin/skills/mprefs/SKILL.md +8 -0
  46. package/dist/plugin/skills/mregen/SKILL.md +8 -0
  47. package/dist/plugin/skills/mrelease/SKILL.md +8 -0
  48. package/dist/plugin/skills/mrepair/SKILL.md +8 -0
  49. package/dist/plugin/skills/mstatus/SKILL.md +8 -0
  50. package/dist/plugin/skills/mtest/SKILL.md +8 -0
  51. package/dist/plugin/skills/mtestlocal/SKILL.md +8 -0
  52. package/dist/plugin/skills/mtestprep/SKILL.md +8 -0
  53. package/dist/plugin/skills/muggle/SKILL.md +9 -6
  54. package/dist/plugin/skills/muggle-do/SKILL.md +36 -61
  55. package/dist/plugin/skills/muggle-do-task/SKILL.md +134 -0
  56. package/dist/plugin/skills/muggle-feedback/SKILL.md +39 -0
  57. package/dist/plugin/skills/muggle-feedback/ops/delete.md +49 -0
  58. package/dist/plugin/skills/muggle-feedback/ops/list.md +65 -0
  59. package/dist/plugin/skills/muggle-feedback/ops/submit.md +130 -0
  60. package/dist/plugin/skills/muggle-pr-followup/SKILL.md +59 -0
  61. package/dist/plugin/skills/muggle-pr-followup/contract.md +191 -0
  62. package/dist/plugin/skills/muggle-pr-visual-walkthrough/SKILL.md +68 -43
  63. package/dist/plugin/skills/muggle-pr-visual-walkthrough/e2e-report-assembly.md +86 -0
  64. package/dist/plugin/skills/muggle-preferences/SKILL.md +16 -108
  65. package/dist/plugin/skills/muggle-preferences/ops/change-one.md +10 -0
  66. package/dist/plugin/skills/muggle-preferences/ops/configure.md +49 -0
  67. package/dist/plugin/skills/muggle-preferences/ops/list.md +9 -0
  68. package/dist/plugin/skills/muggle-preferences/ops/reset.md +6 -0
  69. package/dist/plugin/skills/muggle-preferences/ops/set.md +10 -0
  70. package/dist/plugin/skills/muggle-preferences/preference-gates/README.md +1 -1
  71. package/dist/plugin/skills/muggle-preferences/preference-gates/autoCleanup.md +11 -0
  72. package/dist/plugin/skills/muggle-preferences/preference-gates/autoCreatePR.md +13 -0
  73. package/dist/plugin/skills/muggle-preferences/preference-gates/autoDetectChanges.md +3 -3
  74. package/dist/plugin/skills/muggle-preferences/preference-gates/autoE2ETest.md +11 -0
  75. package/dist/plugin/skills/muggle-preferences/preference-gates/autoLogin.md +1 -1
  76. package/dist/plugin/skills/muggle-preferences/preference-gates/autoPublishLocalResults.md +2 -2
  77. package/dist/plugin/skills/muggle-preferences/preference-gates/autoRebase.md +11 -0
  78. package/dist/plugin/skills/muggle-preferences/preference-gates/autoSelectLocalHost.md +19 -0
  79. package/dist/plugin/skills/muggle-preferences/preference-gates/autoSelectProject.md +1 -2
  80. package/dist/plugin/skills/muggle-preferences/preference-gates/autoUseWorktree.md +11 -0
  81. package/dist/plugin/skills/muggle-preferences/preference-gates/checkForUpdates.md +4 -4
  82. package/dist/plugin/skills/muggle-preferences/preference-gates/defaultExecutionMode.md +1 -1
  83. package/dist/plugin/skills/muggle-preferences/preference-gates/openTestResultsAfterRun.md +1 -1
  84. package/dist/plugin/skills/muggle-preferences/preference-gates/postPRVisualWalkthrough.md +8 -25
  85. package/dist/plugin/skills/muggle-preferences/preference-gates/showElectronBrowser.md +1 -1
  86. package/dist/plugin/skills/muggle-preferences/preference-gates/suggestRelatedTestCases.md +4 -4
  87. package/dist/plugin/skills/muggle-preferences/preference-gates/suggestRelatedUseCases.md +4 -4
  88. package/dist/plugin/skills/muggle-repair/SKILL.md +4 -2
  89. package/dist/plugin/skills/muggle-status/SKILL.md +8 -5
  90. package/dist/plugin/skills/muggle-test/SKILL.md +110 -86
  91. package/dist/plugin/skills/muggle-test-feature-local/SKILL.md +83 -62
  92. package/dist/plugin/skills/muggle-test-import/SKILL.md +28 -23
  93. package/dist/plugin/skills/muggle-test-prepare/SKILL.md +79 -18
  94. package/dist/plugin/skills/muggle-test-regenerate-missing/SKILL.md +34 -18
  95. package/dist/plugin/skills/muggle-test-regenerate-missing/evals/evals.json +9 -9
  96. package/dist/plugin/skills/muggle-upgrade/SKILL.md +4 -2
  97. package/dist/plugin/skills/muggle-works-npm-release/SKILL.md +6 -4
  98. package/dist/plugin/skills/mupgrade/SKILL.md +8 -0
  99. package/dist/release-manifest.json +4 -4
  100. package/dist/{src-GD3YFCCW.js → src-2G7ENRGI.js} +1 -1
  101. package/package.json +9 -7
  102. package/plugin/.claude-plugin/plugin.json +1 -1
  103. package/plugin/.cursor-plugin/plugin.json +1 -1
  104. package/plugin/README.md +4 -2
  105. package/plugin/agents/acceptance-tester.md +24 -10
  106. package/plugin/commands/m.md +7 -0
  107. package/plugin/commands/mdo.md +7 -0
  108. package/plugin/commands/mfeedback.md +7 -0
  109. package/plugin/commands/mimport.md +7 -0
  110. package/plugin/commands/mpr.md +7 -0
  111. package/plugin/commands/mprefs.md +7 -0
  112. package/plugin/commands/mregen.md +7 -0
  113. package/plugin/commands/mrelease.md +7 -0
  114. package/plugin/commands/mrepair.md +7 -0
  115. package/plugin/commands/mstatus.md +7 -0
  116. package/plugin/commands/mtest.md +7 -0
  117. package/plugin/commands/mtestlocal.md +7 -0
  118. package/plugin/commands/mtestprep.md +7 -0
  119. package/plugin/commands/mupgrade.md +7 -0
  120. package/plugin/scripts/ensure-electron-app.sh +35 -8
  121. package/plugin/skills/_aliases.json +18 -0
  122. package/plugin/skills/_shared/dev-server-readiness.md +231 -0
  123. package/plugin/skills/_shared/failure-mode-handling.md +244 -0
  124. package/plugin/skills/_shared/post-merge-cleanup.md +10 -0
  125. package/plugin/skills/_shared/pr-followup-helpers.md +150 -0
  126. package/plugin/skills/_shared/rebase-before-e2e.md +15 -0
  127. package/plugin/skills/_shared/telemetry-emit.md +15 -0
  128. package/plugin/skills/_shared/use-worktrees.md +53 -0
  129. package/plugin/skills/do/build.md +51 -0
  130. package/plugin/skills/do/e2e-acceptance.md +64 -19
  131. package/plugin/skills/do/impact-analysis.md +47 -7
  132. package/plugin/skills/do/open-prs.md +72 -74
  133. package/plugin/skills/do/pre-flight.md +21 -14
  134. package/plugin/skills/do/requirements.md +2 -2
  135. package/plugin/skills/do/unit-tests.md +2 -2
  136. package/plugin/skills/m/SKILL.md +8 -0
  137. package/plugin/skills/mdo/SKILL.md +8 -0
  138. package/plugin/skills/mfeedback/SKILL.md +8 -0
  139. package/plugin/skills/mimport/SKILL.md +8 -0
  140. package/plugin/skills/mpr/SKILL.md +8 -0
  141. package/plugin/skills/mprefs/SKILL.md +8 -0
  142. package/plugin/skills/mregen/SKILL.md +8 -0
  143. package/plugin/skills/mrelease/SKILL.md +8 -0
  144. package/plugin/skills/mrepair/SKILL.md +8 -0
  145. package/plugin/skills/mstatus/SKILL.md +8 -0
  146. package/plugin/skills/mtest/SKILL.md +8 -0
  147. package/plugin/skills/mtestlocal/SKILL.md +8 -0
  148. package/plugin/skills/mtestprep/SKILL.md +8 -0
  149. package/plugin/skills/muggle/SKILL.md +9 -6
  150. package/plugin/skills/muggle-do/SKILL.md +36 -61
  151. package/plugin/skills/muggle-do-task/SKILL.md +134 -0
  152. package/plugin/skills/muggle-feedback/SKILL.md +39 -0
  153. package/plugin/skills/muggle-feedback/ops/delete.md +49 -0
  154. package/plugin/skills/muggle-feedback/ops/list.md +65 -0
  155. package/plugin/skills/muggle-feedback/ops/submit.md +130 -0
  156. package/plugin/skills/muggle-pr-followup/SKILL.md +59 -0
  157. package/plugin/skills/muggle-pr-followup/contract.md +191 -0
  158. package/plugin/skills/muggle-pr-visual-walkthrough/SKILL.md +68 -43
  159. package/plugin/skills/muggle-pr-visual-walkthrough/e2e-report-assembly.md +86 -0
  160. package/plugin/skills/muggle-preferences/SKILL.md +16 -108
  161. package/plugin/skills/muggle-preferences/ops/change-one.md +10 -0
  162. package/plugin/skills/muggle-preferences/ops/configure.md +49 -0
  163. package/plugin/skills/muggle-preferences/ops/list.md +9 -0
  164. package/plugin/skills/muggle-preferences/ops/reset.md +6 -0
  165. package/plugin/skills/muggle-preferences/ops/set.md +10 -0
  166. package/plugin/skills/muggle-preferences/preference-gates/README.md +1 -1
  167. package/plugin/skills/muggle-preferences/preference-gates/autoCleanup.md +11 -0
  168. package/plugin/skills/muggle-preferences/preference-gates/autoCreatePR.md +13 -0
  169. package/plugin/skills/muggle-preferences/preference-gates/autoDetectChanges.md +3 -3
  170. package/plugin/skills/muggle-preferences/preference-gates/autoE2ETest.md +11 -0
  171. package/plugin/skills/muggle-preferences/preference-gates/autoLogin.md +1 -1
  172. package/plugin/skills/muggle-preferences/preference-gates/autoPublishLocalResults.md +2 -2
  173. package/plugin/skills/muggle-preferences/preference-gates/autoRebase.md +11 -0
  174. package/plugin/skills/muggle-preferences/preference-gates/autoSelectLocalHost.md +19 -0
  175. package/plugin/skills/muggle-preferences/preference-gates/autoSelectProject.md +1 -2
  176. package/plugin/skills/muggle-preferences/preference-gates/autoUseWorktree.md +11 -0
  177. package/plugin/skills/muggle-preferences/preference-gates/checkForUpdates.md +4 -4
  178. package/plugin/skills/muggle-preferences/preference-gates/defaultExecutionMode.md +1 -1
  179. package/plugin/skills/muggle-preferences/preference-gates/openTestResultsAfterRun.md +1 -1
  180. package/plugin/skills/muggle-preferences/preference-gates/postPRVisualWalkthrough.md +8 -25
  181. package/plugin/skills/muggle-preferences/preference-gates/showElectronBrowser.md +1 -1
  182. package/plugin/skills/muggle-preferences/preference-gates/suggestRelatedTestCases.md +4 -4
  183. package/plugin/skills/muggle-preferences/preference-gates/suggestRelatedUseCases.md +4 -4
  184. package/plugin/skills/muggle-repair/SKILL.md +4 -2
  185. package/plugin/skills/muggle-status/SKILL.md +8 -5
  186. package/plugin/skills/muggle-test/SKILL.md +110 -86
  187. package/plugin/skills/muggle-test-feature-local/SKILL.md +83 -62
  188. package/plugin/skills/muggle-test-import/SKILL.md +28 -23
  189. package/plugin/skills/muggle-test-prepare/SKILL.md +79 -18
  190. package/plugin/skills/muggle-test-regenerate-missing/SKILL.md +34 -18
  191. package/plugin/skills/muggle-test-regenerate-missing/evals/evals.json +9 -9
  192. package/plugin/skills/muggle-upgrade/SKILL.md +4 -2
  193. package/plugin/skills/muggle-works-npm-release/SKILL.md +6 -4
  194. package/plugin/skills/mupgrade/SKILL.md +8 -0
  195. package/scripts/postinstall.mjs +11 -1
  196. package/dist/plugin/skills/do/validate-code.md +0 -38
  197. package/plugin/skills/do/validate-code.md +0 -38
@@ -1,34 +1,44 @@
1
- # E2E / acceptance agent (Stage 6/7)
1
+ # E2E Acceptance Agent (Stage 6)
2
2
 
3
- You are running **end-to-end (E2E) acceptance** test cases against code changes using Muggle AI's local testing infrastructure. These tests simulate real users in a browser — they are not unit tests.
3
+ You are executing E2E acceptance validation for the muggle-do cycle.
4
+
5
+ Stage 6 of `muggle-do`. Runs browser acceptance tests against code changes and records evidence for downstream PR rendering.
6
+
7
+ Standalone subagent (different invocation path, used by `muggle-test` Mode C): [`../../agents/acceptance-tester.md`](../../agents/acceptance-tester.md).
4
8
 
5
9
  ## Turn preamble
6
10
 
7
11
  Start the turn with:
8
12
 
9
13
  ```
10
- **Stage 6/7 — E2E acceptance** — running browser tests against the validation target from pre-flight.
14
+ **Stage 6 — E2E acceptance** — running browser tests against the validation target from pre-flight.
11
15
  ```
12
16
 
13
17
  ## Design
14
18
 
15
- E2E acceptance testing runs **locally** using the `test-feature-local` approach:
19
+ This stage is **mode-driven by pre-flight**:
20
+
21
+ - `local-e2e` runs the local browser flow (`test-feature-local` approach).
22
+ - `unit-only` or `skip` does not execute browser runs and must emit an explicit non-pass verdict (`SKIPPED` / `UNIT-ONLY` equivalent in downstream reporting).
23
+ - `staging-replay` is not executed in this stage path and should be surfaced as `INCONCLUSIVE` unless the caller has already routed to a dedicated staging runner.
24
+
25
+ For local runs, the tool boundaries are:
16
26
 
17
27
  | Scope | MCP tools |
18
28
  | :---- | :-------- |
19
29
  | Cloud (projects, cases, scripts, auth) | `muggle-remote-*` |
20
30
  | Local (Electron run, publish, results) | `muggle-local-*` |
21
31
 
22
- This guarantees E2E acceptance tests always run — no dependency on cloud replay service availability.
32
+ This keeps execution deterministic: local runs do not depend on cloud replay execution availability.
23
33
 
24
34
  ## Input
25
35
 
26
36
  You receive everything from `state.md` already — pre-flight resolved it:
27
37
 
28
- - `localUrl` — the locally running dev server URL
29
- - `projectId` — the chosen Muggle project
38
+ - `localUrl` — the running validation target URL (typically localhost in local mode)
39
+ - `projectId` — the chosen Muggle Test project
30
40
  - The validation strategy (`local-e2e`, `staging-replay`, `unit-only`, `skip`)
31
- - Test-user credential status (existing / new / skip)
41
+ - Test-user credential status (existing / new / skip), when credentials are needed
32
42
  - The list of changed repos, files, and a summary of changes
33
43
  - The requirements goal
34
44
 
@@ -36,23 +46,41 @@ You receive everything from `state.md` already — pre-flight resolved it:
36
46
 
37
47
  ### Step 0: Consume pre-flight (no user questions)
38
48
 
39
- Read `state.md`. If the validation strategy is `unit-only` or `skip`, **do not run this stage** — skip to stage 7 and record the skip reason. Otherwise use `localUrl` directly; **do not ask the user** for it.
49
+ Read `state.md`. Resolve [`autoE2ETest`](../muggle-preferences/preference-gates/autoE2ETest.md) first — `always` (default, including when unset) runs this stage. `ask` should already have been resolved by pre-flight Q13. Use the resolved validation mode (`local-e2e`, `staging-replay`, `unit-only`, `skip`) to pick execution vs early-exit behavior.
40
50
 
41
- If `localUrl` or `projectId` is missing from `state.md`, that is a pre-flight bug. **Do not paper over it by asking the user** — escalate once with the session path and halt. The fix is to expand `pre-flight.md`, not to grow a new question here.
51
+ Use `localUrl`, `projectId`, and `worktreePath` from `state.md`. Missing any → pre-flight bug; escalate with the session path and halt; do not ask the user.
42
52
 
43
53
  ### Step 0.5: Pre-flight verification probes
44
54
 
45
- Before launching Electron, run these live checks and fail loudly if any fails:
55
+ Before launching the local runner:
46
56
 
47
- 1. `curl -s -o /dev/null -w "%{http_code}" <localUrl>` — expect 2xx or 3xx. If the dev server isn't up, halt with the exact command the user needs to start it.
48
- 2. If a backend URL is recorded, probe its health endpoint. A 5xx or unreachable backend means the dashboard will render in an error state and test results will be meaningless — halt.
49
- 3. `muggle-remote-auth-status` — must be `authenticated`. If not, the pre-flight missed this; escalate.
50
- 4. If test credentials were marked `existing`, confirm the Auth0 tenant in the repo's env matches the tenant the secrets were created under (recorded in `state.md`). Tenant mismatch → halt with "existing secrets target tenant X, local dev targets tenant Y — update pre-flight to collect new credentials."
57
+ 1. **Dev-server + backend readiness** — per [`../_shared/dev-server-readiness.md`](../_shared/dev-server-readiness.md) (port + compile log + backend health). Halt on any failure.
58
+ 2. **Auth** — `muggle-remote-auth-status` must be `authenticated`; else escalate.
59
+ 3. **Identity tenant/domain match** — if test credentials were marked `existing`, confirm the repo's configured identity tenant/domain matches the recorded tenant/domain. Mismatch → halt.
51
60
 
52
61
  ### Step 1: Authentication already verified
53
62
 
54
63
  Pre-flight handled auth. If `muggle-remote-auth-status` somehow shows expired here (session clock skew, etc.), re-auth silently via `muggle-remote-auth-login` + `muggle-remote-auth-poll` — but do not ask the user "continue with this account?" again.
55
64
 
65
+ If validation is `unit-only` or `skip`, emit a `SKIPPED` report with a one-line reason and exit cleanly.
66
+
67
+ If validation is `staging-replay`, emit `INCONCLUSIVE` with reason `staging replay not handled in Stage 6 local runner path` and exit cleanly.
68
+
69
+ ### Step 1.5: Placeholder branch detection
70
+
71
+ Read `pathClassification` from the impact-analysis output (emitted by `do/impact-analysis.md`). If it is `none` — i.e. `git diff <default-branch>...HEAD --stat` was empty after rebase — there is no code under test and running test cases would only re-test master. Write a one-paragraph SKIPPED result to the E2E report (or return a SKIPPED verdict to the caller) and exit the stage cleanly. **Do not** synthesize test cases or run anything.
72
+
73
+ ### Step 1.7: Route + project classification
74
+
75
+ Consume `pathClassification` from impact-analysis and resolve the dispatch target:
76
+
77
+ - `surface-a` → use the classification-specific route + project mapping defined by impact-analysis output
78
+ - `surface-b` → use the classification-specific route + project mapping defined by impact-analysis output
79
+ - `mixed` → run once per classification mapping (route + project), or surface as INCONCLUSIVE if running both is over the wall-time budget
80
+ - `none` → already handled in Step 1.5
81
+
82
+ The `devServerUrl` and project resolved here override any defaults in `state.md` for the remainder of this stage. Treat classification labels as routing hints provided by impact-analysis; do not hardcode product-specific paths in this stage.
83
+
56
84
  ### Step 2: Get Test Cases
57
85
 
58
86
  Use `muggle-remote-test-case-list` with the project ID to fetch all test cases.
@@ -93,7 +121,7 @@ For each relevant test case:
93
121
 
94
122
  ### Local Execution Timeout (`timeoutMs`)
95
123
 
96
- The MCP client often uses a **default wait of 300000 ms (5 minutes)**. **Exploratory script generation** (Auth0 login, dashboards, multi-step wizards, many LLM iterations) routinely **runs longer than 5 minutes** while Electron is still healthy.
124
+ The MCP client often uses a **default wait of 300000 ms (5 minutes)**. **Exploratory script generation** (identity login, multi-step app flows, many LLM iterations) routinely **runs longer than 5 minutes** while Electron is still healthy.
97
125
 
98
126
  - **Always pass `timeoutMs`** — `600000` (10 min) or `900000` (15 min) — unless the test case is known to be simple.
99
127
  - If the tool reports **`Electron execution timed out after 300000ms`** but Electron logs show the run still progressing (steps, screenshots, LLM calls), treat it as **orchestration timeout**, not an Electron app defect: **increase `timeoutMs` and retry**.
@@ -135,7 +163,7 @@ For each published test script:
135
163
  For each test case:
136
164
  - Record pass or fail from the run result
137
165
  - If failed, capture the error message, failure step index, and `artifactsDir` for local debugging
138
- - Every test case must be executed — generate a new script if none exists (no skips)
166
+ - In `local-e2e` mode, every relevant test case must be executed — generate a new script if none exists (no skips)
139
167
 
140
168
  ## Output
141
169
 
@@ -160,10 +188,26 @@ For each test case:
160
188
  - steps: `[{ stepIndex, action, screenshotUrl }, ...]`
161
189
  - artifactsDir: `<path>` (for local debugging)
162
190
 
191
+ **Inconclusive:** (count) — use for runs that couldn't yield a pass/fail signal: no replayable script, environment precondition unmet, infra error, agent stalled on auth/cookie banner before reaching the assertion, missing secrets. The product is **not** implicated — that's `failed`, not `inconclusive`.
192
+ - (test case name):
193
+ - testCaseId: `<id>`
194
+ - runId: `<id>` (synthesize a UUID if no run started)
195
+ - viewUrl: `<url>` (project-level run-results fallback when no specific run URL exists)
196
+ - reason: `<one short sentence>`
197
+ - steps: `[{ stepIndex, action, screenshotUrl }, ...]` (may be empty)
198
+
163
199
  **Metadata:**
164
200
  - projectId: `<projectId>`
165
201
 
166
- **Overall:** ALL PASSED | FAILURES DETECTED
202
+ **Overall:** PASS | FAIL | PARTIAL | INCONCLUSIVE | BLOCKED | SKIPPED — see [`../_shared/failure-mode-handling.md`](../_shared/failure-mode-handling.md) section F for the canonical taxonomy.
203
+
204
+ ## Hard constraints
205
+
206
+ - **Do NOT shut down the dev server.** The caller manages dev-server lifecycle.
207
+ - **Do NOT delete or move workspace config/state files** (for example `.muggle-ai/`, `.env.local`, or equivalent runtime config artifacts) in the worktree.
208
+ - **Do NOT call destructive remote MCP tools** — no `*-delete`, `*-revoke`, `*-cancel`, or `*-update` against remote-owned definitions.
209
+ - **One replacement script generation max per stage cycle.**
210
+ - **Honor `wallTimeBudgetSec` from the caller** — on approach, write a PARTIAL report; never silently exceed.
167
211
 
168
212
  ## Non-negotiables
169
213
 
@@ -171,5 +215,6 @@ For each test case:
171
215
  - Replay: never hand-build or simplify `actionScript` — only use full response from `muggle-remote-action-script-get`.
172
216
  - Always pass `timeoutMs` for execution calls; do not rely on default 5-minute timeout.
173
217
  - No hiding failures: surface errors, exit codes, and artifact paths.
174
- - Every test case must be executed — generate a new script if none exists (no skips).
218
+ - In `local-e2e` mode, every relevant test case must be executed — generate a new script if none exists (no skips).
175
219
  - Always publish after execution to ensure screenshots are cloud-accessible for PR comments.
220
+ - **Never drop a test case from the report because it "couldn't run cleanly."** A test that didn't reach its assertion is `inconclusive`, not absent. Dropping it produces misleading verdicts and pushes downstream PR-comment renderers to hand-write the comment — which is the failure mode this stage exists to prevent.
@@ -1,4 +1,4 @@
1
- # Impact Analysis Agent (Stage 3/7)
1
+ # Impact Analysis Agent (Stage 4)
2
2
 
3
3
  You are analyzing git repositories to determine which ones have actual code changes that need to go through the dev cycle pipeline.
4
4
 
@@ -7,7 +7,7 @@ You are analyzing git repositories to determine which ones have actual code chan
7
7
  Start the turn with:
8
8
 
9
9
  ```
10
- **Stage 3/7 — Impact analysis** — diffing each affected repo against its default branch.
10
+ **Stage 4 — Impact analysis** — diffing each affected repo against its default branch.
11
11
  ```
12
12
 
13
13
  ## Input
@@ -15,22 +15,34 @@ Start the turn with:
15
15
  You receive:
16
16
  - A list of repos with their local filesystem paths
17
17
  - The requirements goal and affected repos from the requirements stage
18
+ - Pre-flight state, including `worktreePath` when a worktree was selected (see [`../_shared/use-worktrees.md`](../_shared/use-worktrees.md))
18
19
 
19
20
  ## Your Job
20
21
 
21
22
  For each repo path provided:
22
23
 
23
- 1. **Check the current branch:** Run `git branch --show-current` in the repo. If it returns empty (detached HEAD), report an error for that repo.
24
- 2. **Detect the default branch:** Run `git symbolic-ref refs/remotes/origin/HEAD --short` to find the default branch (e.g., `origin/main`). Strip the `origin/` prefix. If this fails, check if `main` or `master` exist locally via `git rev-parse --verify`.
25
- 3. **Verify it's a feature branch:** The current branch must NOT be the default branch. If it is, report an error.
26
- 4. **List changed files:** Run `git diff --name-only <default-branch>...HEAD` to find files changed on this branch relative to the default branch. If no merge base exists, fall back to `git diff --name-only HEAD`.
27
- 5. **Get the diff:** Run `git diff <default-branch>...HEAD` for the full diff.
24
+ 1. **Resolve analysis path with worktree awareness:**
25
+ - If `worktreePath` exists for this repo/session, run all git commands from `worktreePath`.
26
+ - Otherwise run from the repo path.
27
+ - Never mix command cwd across base repo + worktree in one analysis pass.
28
+ 2. **Detect worktree context:** Run `git worktree list --porcelain` and determine whether the analysis path is:
29
+ - a linked worktree checkout, or
30
+ - the primary checkout.
31
+ Record this in output as `checkoutType`.
32
+ 3. **Check the current branch:** Run `git branch --show-current` in the resolved analysis path. If it returns empty (detached HEAD), report an error for that repo.
33
+ 4. **Detect the default branch:** Run `git symbolic-ref refs/remotes/origin/HEAD --short` to find the default branch (e.g., `origin/main`). Strip the `origin/` prefix. If this fails, check if `main` or `master` exist locally via `git rev-parse --verify`.
34
+ 5. **Verify it's a feature branch:** The current branch must NOT be the default branch. If it is, report an error.
35
+ 6. **List changed files:** Run `git diff --name-only <default-branch>...HEAD` to find files changed on this branch relative to the default branch. If no merge base exists, fall back to `git diff --name-only HEAD`.
36
+ 7. **Get the diff:** Run `git diff <default-branch>...HEAD` for the full diff.
37
+ 8. **Classify changed paths** to drive downstream test routing — emit `pathClassification` (see "Output state — pathClassification" below).
28
38
 
29
39
  ## Output
30
40
 
31
41
  Report per repo:
32
42
 
33
43
  **Repo: (name)**
44
+ - Analysis path: (resolved path used for git commands)
45
+ - Checkout type: `worktree` | `primary`
34
46
  - Branch: (current branch name)
35
47
  - Default branch: (detected default branch)
36
48
  - Changed files: (list)
@@ -40,3 +52,31 @@ Report per repo:
40
52
  **Summary:** (which repos have changes, which don't, any errors)
41
53
 
42
54
  If NO repos have any changes, clearly state: "No changes detected in any repo."
55
+
56
+ ## Output state — pathClassification
57
+
58
+ Per repo, emit one additional field that the E2E acceptance stage (`do/e2e-acceptance.md` Steps 1.5 and 1.7) consumes to pick routing + project mapping without hardcoding product paths:
59
+
60
+ ```
61
+ pathClassification: <surface-a | surface-b | mixed | none>
62
+ ```
63
+
64
+ Definitions:
65
+ - **`surface-a`** — all changed files match the repo's configured pattern set A.
66
+ - **`surface-b`** — all changed files match the repo's configured pattern set B.
67
+ - **`mixed`** — at least one file matches pattern set A and at least one file matches pattern set B.
68
+ - **`none`** — empty diff (placeholder branch — see standardized output below).
69
+
70
+ Pattern sets must be treated as repo-configured routing buckets (for example, marketing-vs-app areas), not global hardcoded paths in this stage.
71
+
72
+ ### Standardized "no changes" output (placeholder branch)
73
+
74
+ If `git diff <default>...HEAD --stat` is empty for a repo, emit:
75
+
76
+ ```
77
+ pathClassification: none
78
+ filesChanged: []
79
+ recommendation: SKIPPED — placeholder branch, no code under test
80
+ ```
81
+
82
+ `do/e2e-acceptance.md` Step 1.5 reads this and exits the stage cleanly with a SKIPPED verdict — do not silently run tests against master.
@@ -1,106 +1,104 @@
1
- # PR Creation Agent (Stage 7/7)
1
+ # PR Creation Agent (Stage 7 — Open PR)
2
2
 
3
- You are creating pull requests for each repository that has changes after a successful dev cycle run.
3
+ Open a pull request for each repo that has changes. If an E2E walkthrough report is available from the previous stage, attach it. Honor preference gates. Hand off to stage 8 once done.
4
4
 
5
5
  ## Turn preamble
6
6
 
7
- Start the turn with:
8
-
9
7
  ```
10
- **Stage 7/7 — Open PR** — rendering the visual walkthrough and pushing the PR.
8
+ **Stage 7 — Open PR** — pushing the branch and opening the PR.
11
9
  ```
12
10
 
13
- ## Non-negotiable: visual walkthrough is required
14
-
15
- **You MUST invoke `muggle-pr-visual-walkthrough` (Mode B) to render the E2E section of the PR body.** Hand-writing the PR body with a text summary and `gh pr create` is a stage failure — reviewers rely on the dashboard links and per-step screenshots the walkthrough produces.
16
-
17
- If the E2E stage was skipped (validation was `unit-only` or `skip`), you may omit the walkthrough section — but mark the PR title with `[UNVERIFIED]` or `[UNIT-ONLY]` accordingly, and record the reason in the PR body under `## Validation`.
11
+ ## Inputs
18
12
 
19
- Before calling `gh pr create`, self-check:
13
+ - Per-repo: name, path, branch.
14
+ - Requirements: goal, acceptance criteria.
15
+ - **Optional** E2E acceptance report from stage 6 — only present when validation ran. Produced by [`e2e-acceptance.md`](e2e-acceptance.md); schema is canonical in [`muggle-pr-visual-walkthrough/SKILL.md`](../muggle-pr-visual-walkthrough/SKILL.md) (Zod-validated by the CLI).
20
16
 
21
- - [ ] `muggle-pr-visual-walkthrough` was invoked (or the skip reason is recorded).
22
- - [ ] The `body` returned by the skill is embedded verbatim in the PR body.
23
- - [ ] If `comment` is non-null, it will be posted as a follow-up after the PR is created.
17
+ ## Per repo
24
18
 
25
- If you cannot check all three, **halt** — do not create the PR. Fix the upstream stage first.
19
+ 0. **`autoCreatePR` gate** — apply per [`../muggle-preferences/preference-gates/autoCreatePR.md`](../muggle-preferences/preference-gates/autoCreatePR.md). On skip, record the reason in `result.md` and move on.
26
20
 
27
- ## Input
21
+ 1. **Push:** `git push -u origin <branch>` in the repo directory.
28
22
 
29
- You receive:
30
- - Per-repo: repo name, path, branch name
31
- - Requirements: goal, acceptance criteria
32
- - E2E acceptance report: passed/failed test cases, each with:
33
- - `testCaseId`, `testScriptId`, `runId`, `projectId`
34
- - `viewUrl`: link to view run on muggle-ai.com
35
- - `steps`: array of `{ stepIndex, action, screenshotUrl }`
36
- - `failureStepIndex` and `error` (if failed)
37
- - `artifactsDir` (for local debugging)
38
- - `description` and `useCaseName` (optional but recommended) — test case one-liner and parent use case title; drive the grouped overview and the per-test collapsible headers in the rendered walkthrough. Prefer values already in the `e2e-acceptance.md` stage's conversation context; only call `muggle-remote-test-case-get` / `muggle-remote-use-case-get` for anything you don't already have.
23
+ 2. **Title** (under 70 chars):
24
+ - E2E report exists and has failures → `[E2E FAILING] <goal>`
25
+ - No E2E report at all (validation was `unit-only` or `skip`) → `[UNVERIFIED] <goal>` or `[UNIT-ONLY] <goal>` to match the validation strategy
26
+ - Otherwise → `<goal>`
39
27
 
40
- ## Your Job
28
+ 3. **Body** — assemble in order:
29
+ - `## Goal` — from requirements.
30
+ - `## Acceptance Criteria` — bulleted; omit section if empty.
31
+ - `## Changes` — summary of what changed in this repo.
32
+ - `## Validation` — one line: link to E2E report, or `unit-only`, or `skip — <reason>`.
33
+ - **If an E2E report exists,** invoke [`muggle-pr-visual-walkthrough`](../muggle-pr-visual-walkthrough/SKILL.md) Mode B to render the walkthrough block. Embed the returned `body` verbatim (it brings its own `## E2E Acceptance Results` heading). If no report, skip this block entirely.
41
34
 
42
- For each repo with changes:
43
-
44
- 1. **Push the branch** to origin: `git push -u origin <branch-name>` in the repo directory.
45
- 2. **Build the PR title:**
46
- - If E2E acceptance tests have failures: `[E2E FAILING] <goal>`
47
- - Otherwise: `<goal>`
48
- - Keep under 70 characters
49
- 3. **Render the E2E acceptance block** by invoking the shared `muggle-pr-visual-walkthrough` skill in **Mode B** (render-only for embedding). See "Rendering the E2E acceptance block via the shared skill" below. You receive `{body, comment}` where `body` is the E2E markdown block and `comment` is a non-null overflow comment only when the content exceeds the CLI's byte budget.
50
- 4. **Build the PR body** by concatenating, in order:
51
- - `## Goal` — the requirements goal
52
- - `## Acceptance Criteria` — bulleted list (omit section if empty)
53
- - `## Changes` — summary of what changed in this repo
54
- - The `body` field from the skill output (already contains its own `## E2E Acceptance Results` header — do not add another)
55
- 5. **Create the PR** using `gh pr create --title "..." --body "..." --head <branch>` in the repo directory.
56
- 6. **Capture the PR URL** and extract the PR number.
57
- 7. **Post the overflow `comment` only if it is non-null.** In the common case, `comment` is `null` and nothing is posted. Never post speculatively.
35
+ 4. **Create:** `gh pr create --title "..." --body "..." --head <branch>`. Capture the PR URL and number.
58
36
 
37
+ 5. **Overflow comment:** if the walkthrough skill returned a non-null `comment`, post it once:
59
38
  ```bash
60
- gh pr comment <PR#> --body "$(cat <<'EOF'
61
- <comment field contents>
62
- EOF
63
- )"
39
+ jq -r '.comment' /tmp/muggle-pr-section.json | gh pr comment <PR#> --body-file -
64
40
  ```
41
+ Never post when `comment` is `null`.
65
42
 
66
- ## Rendering the E2E acceptance block via the shared skill
67
-
68
- **Do not hand-write the `## E2E Acceptance Results` markdown, and do not call `muggle build-pr-section` directly from this stage.** The rendering workflow is owned by the shared **`muggle-pr-visual-walkthrough`** skill (see `plugin/skills/muggle-pr-visual-walkthrough/SKILL.md`), which wraps the CLI and enforces the `E2eReport` input contract with a Zod schema.
69
-
70
- ### Input — the `E2eReport` JSON
43
+ ## Stage 8 handoff
71
44
 
72
- The `e2e-acceptance.md` stage already produces an `E2eReport` with the exact shape the skill expects (`projectId` + `tests[]` with per-test `name`, `testCaseId`, `testScriptId`, `runId`, `viewUrl`, `status`, and `steps[]` of `{stepIndex, action, screenshotUrl}`; failed tests additionally have `failureStepIndex`, `error`, and optionally `artifactsDir`; every test may additionally carry `description` and `useCaseName` — optional but recommended — which drive the grouped overview and per-test collapsible headers in the rendered walkthrough). Pass it through unchanged — do not reshape it. The full schema is documented in the shared skill.
45
+ After every repo is processed, build the manifest and dispatch **one follow-up loop per opened PR**. The dispatches are the LAST action this stage takes — once they fire, the original session is free.
73
46
 
74
- ### Invocation — Mode B (render-only)
47
+ Write `.muggle-do/sessions/<slug>/prs.json` with one entry per **opened** PR (skip repos where `autoCreatePR` short-circuited or PR creation failed):
75
48
 
76
- Invoke `muggle-pr-visual-walkthrough` via the `Skill` tool with the `E2eReport` already in context. The skill will:
49
+ ```json
50
+ [{ "repo": "owner/repo", "number": 142, "url": "...", "head_sha": "...", "state": "open" }]
51
+ ```
77
52
 
78
- 1. Validate the `E2eReport` and call `muggle build-pr-section` (piping the JSON to stdin).
79
- 2. Parse the CLI's `{body, comment}` stdout.
80
- 3. **Return `{body, comment}` to this stage's conversation** without posting anything — because Mode B is render-only. `body` is the E2E markdown block; `comment` is a non-null overflow follow-up comment only when content exceeds the byte budget, otherwise `null`.
53
+ Seed `.muggle-do/sessions/<slug>/last_seen.json` keyed by `"<owner>/<repo>#<n>"` with the empty-cursor shape (full shape in [`../muggle-pr-followup/contract.md`](../muggle-pr-followup/contract.md)). Stage 7 only seeds; each per-PR loop owns advancing its own cursor.
54
+
55
+ Also seed `.muggle-do/sessions/<slug>/cycle.json` — the muggle-do implementation cycle declaration the follow-up loop will invoke on each actionable review:
56
+
57
+ ```json
58
+ {
59
+ "cycleName": "muggle-do dev cycle",
60
+ "steps": [
61
+ { "stage": 3, "file": "../do/build.md" },
62
+ { "stage": 4, "file": "../do/impact-analysis.md" },
63
+ { "stage": 5, "file": "../do/unit-tests.md" },
64
+ { "stage": 6, "file": "../do/e2e-acceptance.md" },
65
+ { "name": "post-walkthrough", "skill": "muggle-pr-visual-walkthrough", "mode": "A" }
66
+ ],
67
+ "pushHandler": "git push origin <branch>",
68
+ "useSubagent": false
69
+ }
70
+ ```
81
71
 
82
- Mode A (where the skill itself finds an existing PR and posts a `gh pr comment`) is **not used by `muggle-do`** — it's for interactive callers like `muggle-test` that are mid-development with a PR already open. `muggle-do` always creates new PRs, so it always uses Mode B.
72
+ For each entry in `prs.json`, dispatch its own loop as the final action:
73
+ ```
74
+ /loop 1m /muggle:muggle-pr-followup <slug> <pr-number>
75
+ ```
76
+ Resolve `<slug>` from the session directory's basename. One loop per PR — multi-repo sessions opening N PRs result in N independent loops, each tracking its own PR's review thread.
83
77
 
84
- ### After rendering
78
+ If `prs.json` is empty (all repos skipped, or all PR creations failed), **do not dispatch** — record the reason in `result.md` and exit.
85
79
 
86
- Back in this stage:
80
+ ## Self-check before exit
87
81
 
88
- - Embed `body` in the `gh pr create --body` body (see step 4 above).
89
- - Post the overflow `comment` as a follow-up **only when it is non-null** (see step 7 above).
90
- - If the CLI exited non-zero, the skill surfaces the stderr error — do not swallow it, surface it to the user.
82
+ - [ ] Every non-skipped repo got `gh pr create` to succeed.
83
+ - [ ] When an E2E report existed, the walkthrough block was rendered via Mode B (not hand-written).
84
+ - [ ] Overflow `comment` was posted only when non-null.
85
+ - [ ] `prs.json` and `last_seen.json` reflect the PRs actually opened.
86
+ - [ ] If `prs.json` is non-empty, the `/loop` dispatch was the last action.
91
87
 
92
- ### Notes on fit vs. overflow
88
+ ## Output
93
89
 
94
- - **Common case (fit):** the full evidence (summary, per-test rows, collapsible failure details) lives in the PR description, `comment` is `null`, no follow-up comment is posted.
95
- - **Overflow case:** the CLI detects the full body would exceed its byte budget; `body` contains the summary, per-test rows, and a pointer line; `comment` contains the overflow details. Post both.
96
- - You do not make the fit-vs-overflow decision — the CLI does. Never post the comment when it is `null`.
90
+ **PRs Created:** repo → URL
91
+ **Skipped:** repo → reason (when `autoCreatePR` short-circuited)
92
+ **Overflow comments posted:** repo → PR #
93
+ **Stage 8:** `Watching <N> PR(s) — one /loop 1m /muggle:muggle-pr-followup <slug> <pr#> per PR` | `No PRs to watch — stage 8 not dispatched`
94
+ **Errors:** repo → message
97
95
 
98
- ## Output
96
+ ## Post-merge cleanup
99
97
 
100
- **PRs Created:**
101
- - (repo name): (PR URL)
98
+ Gated by `autoCleanup`. Fires in a follow-up turn after merge — never from this stage. See [`../_shared/post-merge-cleanup.md`](../_shared/post-merge-cleanup.md).
102
99
 
103
- **E2E acceptance overflow comments posted:** (only include repos where an overflow comment was actually posted)
104
- - (repo name): comment posted to PR #(number)
100
+ Append one short reminder tied to the gate value:
105
101
 
106
- **Errors:** (any repos where PR creation or comment posting failed, with the error message)
102
+ - `always` → `Once merged, I'll run the cleanup sequence automatically.`
103
+ - `never` → omit.
104
+ - `ask` / absent → `Once merged, I'll check with you about cleanup.`
@@ -1,4 +1,4 @@
1
- # Pre-flight Agent (Stage 1/7)
1
+ # Pre-flight Agent (Stage 1)
2
2
 
3
3
  You are running the **only user-facing stage** of the muggle-do dev cycle. Your job is to consolidate every ambiguity — task scope, repos, validation strategy, environment, credentials, PR target — into a **single turn** so the rest of the cycle can run unattended.
4
4
 
@@ -9,7 +9,7 @@ You are running the **only user-facing stage** of the muggle-do dev cycle. Your
9
9
  Start the turn with:
10
10
 
11
11
  ```
12
- **Stage 1/7 — Pre-flight** — consolidating everything the cycle needs before going silent.
12
+ **Stage 1 — Pre-flight** — consolidating everything the cycle needs before going silent.
13
13
  ```
14
14
 
15
15
  ## Input
@@ -17,7 +17,7 @@ Start the turn with:
17
17
  You receive:
18
18
 
19
19
  - The user's task description (from `$ARGUMENTS`).
20
- - The list of configured repos (names + paths) from the Muggle config.
20
+ - The list of configured repos (names + paths) from the Muggle Test config.
21
21
  - Any session directory that already exists (resumption case).
22
22
 
23
23
  ## Silent detection (do this first — no user prompts)
@@ -26,31 +26,38 @@ Before asking anything, gather every fact you can resolve without the user:
26
26
 
27
27
  1. **Candidate repo(s).** Match keywords in the task description against configured repo names. If one repo is an obvious match, propose it as the default; if two or three are plausible, list them.
28
28
  2. **Current branch and default branch** for each candidate repo. Run `git -C <repo> symbolic-ref refs/remotes/origin/HEAD --short` and `git -C <repo> branch --show-current`. If the current branch is the default, the pre-flight must collect a new branch name.
29
- 3. **Running dev server.** Scan common dev ports — `lsof -iTCP -sTCP:LISTEN -nP | grep -E ':(3000|3001|3999|4200|5173|8080)'` — and hit `/` with `curl -s -o /dev/null -w "%{http_code}"` to confirm 2xx.
30
- 4. **Running backend.** If the repo's `.env.local` (or equivalent) declares a backend URL (e.g. `REACT_APP_BACKEND_BASE_URL=http://localhost:5050`), probe the health endpoint; note up/down.
31
- 5. **Muggle MCP auth.** Call `muggle-remote-auth-status`. If expired, you will ask to re-auth in the questionnaire.
32
- 6. **Candidate Muggle projects.** Call `muggle-remote-project-list` and rank by semantic match against the task description and the repo's dev URL.
33
- 7. **Existing test-user secrets.** For each candidate Muggle project, call `muggle-remote-secret-list` and note whether `managed_profile_email` / `managed_profile_password` exist.
29
+ 3. **Running dev server.** Detect listening ports and reconcile env-file URL/port using [`../_shared/dev-server-readiness.md`](../_shared/dev-server-readiness.md).
30
+ 4. **Running backend.** Probe backend health per [`../_shared/dev-server-readiness.md`](../_shared/dev-server-readiness.md) ("Backend health"). Note up/down.
31
+ 5. **Muggle Test MCP auth.** Call `muggle-remote-auth-status`. If expired, you will ask to re-auth in the questionnaire.
32
+ 6. **Candidate Muggle Test projects.** Call `muggle-remote-project-list` and rank by semantic match against the task description and the repo's dev URL.
33
+ 7. **Existing test-user secrets.** For each candidate Muggle Test project, call `muggle-remote-secret-list` and note whether `managed_profile_email` / `managed_profile_password` exist.
34
34
  8. **Auth0 tenant in use for local dev.** Grep the repo's env file for `*AUTH0_DOMAIN*`; record the tenant. This tells the user whether the staging-tenant test user will work or not.
35
+ 9. **Branch hygiene signals** for the `autoUseWorktree` and `autoRebase` gates (see [`../_shared/use-worktrees.md`](../_shared/use-worktrees.md), [`../_shared/rebase-before-e2e.md`](../_shared/rebase-before-e2e.md)):
36
+ - Is the current checkout already a worktree? `git -C <repo> rev-parse --is-inside-work-tree` plus `git -C <repo> worktree list`.
37
+ - How many commits behind `origin/<default>`? `git -C <repo> fetch origin && git -C <repo> rev-list --count "HEAD..origin/$(git -C <repo> symbolic-ref refs/remotes/origin/HEAD --short | sed 's|origin/||')"`.
38
+ 10. **`autoE2ETest` preference.** Read the session-context preferences line. Unset → treat as `always` (this gate's default — opposite of the system-wide `ask` default). `ask` → surface in Q13. `always` → no question; stage 6 runs.
35
39
 
36
40
  ## The consolidated questionnaire
37
41
 
38
- Present **one `AskQuestion`** (or the platform's structured-selection equivalent) that collects every remaining decision. Use detected values as defaults whenever possible. Questions to include, in this order:
42
+ Present **one `AskUserQuestion`** (or the platform's structured-selection equivalent) that collects every remaining decision. Use detected values as defaults whenever possible. Questions to include, in this order:
39
43
 
40
44
  1. **Task scope clarification** — only if the task description is genuinely ambiguous. Offer 2–3 interpretations as options plus "Other — type a clarification." If the task is unambiguous, omit.
41
45
  2. **Repo(s) to modify** — pre-selected with the best silent match. "Confirm <repo>" / "Change repo" / "Multi-repo (list them)".
42
46
  3. **Branch name** — default: `users/<user>/<slug>` derived from the task. "Use default" / "Use different name (type)".
43
47
  4. **Validation strategy** — the single most important question. Options:
44
- - **Local E2E** (Muggle Electron against a running localhost) — default if a dev server was detected.
48
+ - **Local E2E** (Muggle Test Electron against a running localhost) — default if a dev server was detected.
45
49
  - **Staging replay** — for changes already deployed to a preview URL.
46
50
  - **Unit tests only** — skip E2E, acceptable for pure refactors or backend-only changes.
47
51
  - **Skip validation** — explicit opt-out; the PR title gets `[UNVERIFIED]`.
48
52
  5. **Local URL** — only if validation is Local E2E. Default: the detected port. "Confirm `<detected>`" / "Type a different URL".
49
53
  6. **Backend reachable?** — only if validation is Local E2E and a backend URL is declared. If the health probe failed, ask "Start the backend now and I'll re-probe" / "Proceed anyway" / "Skip to unit tests only".
50
- 7. **Muggle project** — pre-selected with the best silent match. "Use <top match>" / "Use a different existing project (list)" / "Create new".
54
+ 7. **Muggle Test project** — pre-selected with the best silent match. "Use <top match>" / "Use a different existing project (list)" / "Create new".
51
55
  8. **Test-user credentials** — only if validation is Local E2E AND the Auth0 tenant in the repo differs from the tenant the managed secrets were created under. Options: "Reuse existing secrets (may fail if tenant mismatch — will surface failure)" / "Create new secrets for this tenant (provide email + password)" / "Switch to staging replay".
52
56
  9. **PR target branch** — default: the repo's default branch. "Use default" / "Target a different branch".
53
- 10. **Re-auth Muggle MCP?** — only if auth was missing/expired. "Log in now" / "Abort".
57
+ 10. **Re-auth Muggle Test MCP?** — only if auth was missing/expired. "Log in now" / "Abort".
58
+ 11. **Worktree for this change?** — gate: [`autoUseWorktree`](../muggle-preferences/preference-gates/autoUseWorktree.md). Options: create a sibling worktree, or work in the current checkout.
59
+ 12. **Rebase onto `origin/<default>` first?** — gate: [`autoRebase`](../muggle-preferences/preference-gates/autoRebase.md), only if `behind > 0`. Options: rebase before stage 6, or run as-is.
60
+ 13. **Run E2E at the end of every cycle?** — gate: [`autoE2ETest`](../muggle-preferences/preference-gates/autoE2ETest.md), only if step 10's silent detection resolved to `ask`. Options: always run stage 6, or ask each cycle.
54
61
 
55
62
  If fewer than two of the above need the user, still gather them in a single turn — never open a second round.
56
63
 
@@ -73,7 +80,7 @@ After the user answers, write **`state.md`** with every resolved value, verbatim
73
80
  - Validation: <strategy>
74
81
  - Local URL: <url or N/A>
75
82
  - Backend status: <up | down | N/A>
76
- - Muggle project: <name> (<uuid>)
83
+ - Muggle Test project: <name> (<uuid>)
77
84
  - Test credentials: <existing | new | skip>
78
85
  - PR target: <branch>
79
86
  - Auth status: <ok | re-authed | N/A>
@@ -87,7 +94,7 @@ Also initialize `iterations/001.md` with a header:
87
94
  ```markdown
88
95
  # Iteration 001 — <ISO-8601 timestamp>
89
96
 
90
- ### Stage 1/7 — Pre-flight (<timestamp>)
97
+ ### Stage 1 — Pre-flight (<timestamp>)
91
98
 
92
99
  <verbatim copy of pre-flight answers>
93
100
  ```
@@ -1,4 +1,4 @@
1
- # Requirements Analysis Agent (Stage 2/7)
1
+ # Requirements Analysis Agent (Stage 2)
2
2
 
3
3
  You are analyzing a user's task description to extract structured requirements for an autonomous development cycle.
4
4
 
@@ -7,7 +7,7 @@ You are analyzing a user's task description to extract structured requirements f
7
7
  Start the turn with:
8
8
 
9
9
  ```
10
- **Stage 2/7 — Requirements** — extracting structured goals from the pre-flight-clarified task.
10
+ **Stage 2 — Requirements** — extracting structured goals from the pre-flight-clarified task.
11
11
  ```
12
12
 
13
13
  Pre-flight already resolved ambiguity via the consolidated questionnaire. **Do not ask the user any questions here** — infer silently and record assumptions in Notes.
@@ -1,4 +1,4 @@
1
- # Unit Test Runner Agent (Stage 5/7)
1
+ # Unit Test Runner Agent (Stage 5)
2
2
 
3
3
  You are running unit tests for each repository that has changes in the dev cycle pipeline.
4
4
 
@@ -7,7 +7,7 @@ You are running unit tests for each repository that has changes in the dev cycle
7
7
  Start the turn with:
8
8
 
9
9
  ```
10
- **Stage 5/7 — Unit tests** — running each repo's test suite.
10
+ **Stage 5 — Unit tests** — running each repo's test suite.
11
11
  ```
12
12
 
13
13
  ## Input
@@ -0,0 +1,8 @@
1
+ ---
2
+ name: m
3
+ description: Explicit short alias for the `muggle` skill (router/menu). ONLY invoke when the user explicitly types `m` or `/m` — never auto-trigger from any other phrasing.
4
+ ---
5
+
6
+ # m — alias for muggle
7
+
8
+ Invoke the `muggle` skill via the Skill tool. Forward any user-provided arguments unchanged.
@@ -0,0 +1,8 @@
1
+ ---
2
+ name: mdo
3
+ description: Explicit short alias for the `muggle-do-task` skill. ONLY invoke when the user explicitly types `mdo` or `/mdo` — never auto-trigger from any other phrasing.
4
+ ---
5
+
6
+ # mdo — alias for muggle-do-task
7
+
8
+ Invoke the `muggle-do-task` skill via the Skill tool. Forward any user-provided arguments unchanged.
@@ -0,0 +1,8 @@
1
+ ---
2
+ name: mfeedback
3
+ description: Explicit short alias for the `muggle-feedback` skill. ONLY invoke when the user explicitly types `mfeedback` or `/mfeedback` — never auto-trigger from any other phrasing.
4
+ ---
5
+
6
+ # mfeedback — alias for muggle-feedback
7
+
8
+ Invoke the `muggle-feedback` skill via the Skill tool. Forward any user-provided arguments unchanged.
@@ -0,0 +1,8 @@
1
+ ---
2
+ name: mimport
3
+ description: Explicit short alias for the `muggle-test-import` skill. ONLY invoke when the user explicitly types `mimport` or `/mimport` — never auto-trigger from any other phrasing.
4
+ ---
5
+
6
+ # mimport — alias for muggle-test-import
7
+
8
+ Invoke the `muggle-test-import` skill via the Skill tool. Forward any user-provided arguments unchanged.
@@ -0,0 +1,8 @@
1
+ ---
2
+ name: mpr
3
+ description: Explicit short alias for the `muggle-pr-visual-walkthrough` skill. ONLY invoke when the user explicitly types `mpr` or `/mpr` — never auto-trigger from any other phrasing.
4
+ ---
5
+
6
+ # mpr — alias for muggle-pr-visual-walkthrough
7
+
8
+ Invoke the `muggle-pr-visual-walkthrough` skill via the Skill tool. Forward any user-provided arguments unchanged.
@@ -0,0 +1,8 @@
1
+ ---
2
+ name: mprefs
3
+ description: Explicit short alias for the `muggle-preferences` skill. ONLY invoke when the user explicitly types `mprefs` or `/mprefs` — never auto-trigger from any other phrasing.
4
+ ---
5
+
6
+ # mprefs — alias for muggle-preferences
7
+
8
+ Invoke the `muggle-preferences` skill via the Skill tool. Forward any user-provided arguments unchanged.