@muggleai/works 5.38.0-staging.346 → 5.38.0-staging.348
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/README.md +2 -1
- package/dist/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/plugin/.codex-mcp.json +1 -1
- package/dist/plugin/.codex-plugin/plugin.json +1 -1
- package/dist/plugin/.cursor-plugin/plugin.json +1 -1
- package/dist/plugin/.mcp.json +1 -1
- package/dist/plugin/scripts/guardrails.mjs +3 -2
- package/dist/plugin/skills/do/build.md +2 -1
- package/dist/plugin/skills/do/design.md +35 -0
- package/dist/plugin/skills/do/pre-flight.md +13 -10
- package/dist/plugin/skills/muggle-do/SKILL.md +8 -5
- package/dist/plugin/skills/muggle-preferences/preference-gates/autoRouteBuildToMuggleDo.md +1 -1
- package/dist/plugin/skills/muggle-preferences/preference-gates/frontloadQuestions.md +1 -1
- package/dist/release-manifest.json +3 -3
- package/package.json +10 -10
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.codex-mcp.json +1 -1
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/.cursor-plugin/plugin.json +1 -1
- package/plugin/.mcp.json +1 -1
- package/plugin/scripts/guardrails.mjs +3 -2
- package/plugin/skills/do/build.md +2 -1
- package/plugin/skills/do/design.md +35 -0
- package/plugin/skills/do/pre-flight.md +13 -10
- package/plugin/skills/muggle-do/SKILL.md +8 -5
- package/plugin/skills/muggle-preferences/preference-gates/autoRouteBuildToMuggleDo.md +1 -1
- package/plugin/skills/muggle-preferences/preference-gates/frontloadQuestions.md +1 -1
package/README.md
CHANGED
|
@@ -39,7 +39,8 @@ AI agents: start with [AGENTS.md](AGENTS.md) (install, sign-in, flows, skills, e
|
|
|
39
39
|
| :- | :---- | :----------- | :----------------- |
|
|
40
40
|
| 1 | Pre-flight | Detects repo, branch, dev server, project, credentials; asks everything it can't detect in **one** turn | `state.md` |
|
|
41
41
|
| 2 | Requirements | Freezes goal and acceptance criteria before a line is written | `requirements.md` |
|
|
42
|
-
|
|
|
42
|
+
| 2.5 | Design | Writes the spec and waits for your approval — no code before it is finalized | `design.md` |
|
|
43
|
+
| 3 | Build | Builds the approved design through a plan → subagent build, then commits (signed) | Conventional commits |
|
|
43
44
|
| 4 | Impact analysis | Maps the diff to the user flows it can break | Affected-flow list |
|
|
44
45
|
| 5 | Unit tests | Runs the suite authored in stage 3 | Exit code |
|
|
45
46
|
| 5.5 | Pull request | Opens the PR/MR before the browser run, its walkthrough check red until stage 7 | PR URL |
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "muggle",
|
|
3
3
|
"description": "Acceptance test agent for coding agents: real-browser tests, with screenshots on the PR.",
|
|
4
|
-
"version": "5.38.0-staging.
|
|
4
|
+
"version": "5.38.0-staging.348",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Muggle AI",
|
|
7
7
|
"email": "support@muggle-ai.com"
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "muggle",
|
|
3
3
|
"displayName": "Muggle AI",
|
|
4
4
|
"description": "Acceptance test agent for coding agents: real-browser tests, with screenshots on the PR.",
|
|
5
|
-
"version": "5.38.0-staging.
|
|
5
|
+
"version": "5.38.0-staging.348",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Muggle AI",
|
|
8
8
|
"email": "support@muggle-ai.com"
|
package/dist/plugin/.mcp.json
CHANGED
|
@@ -140,6 +140,7 @@ var RECONCILE_REPLAY_TIMEOUT_MS = 15e3;
|
|
|
140
140
|
var GUARDRAIL_SUBCOMMAND_ASSIGNMENT = /^GUARDRAIL_SUBCOMMAND="([\w-]+)"/m;
|
|
141
141
|
var HOOK_COMMAND_SCRIPTS = /^set -- ([^;]+);/;
|
|
142
142
|
var GUARDRAIL_DISPATCH_SCRIPT = "guardrail-dispatch.sh";
|
|
143
|
+
var MUGGLE_DO_STAGES_BEFORE_BUILD = "requirements \u2192 design (user approves before any code)";
|
|
143
144
|
var MUGGLE_DO_STAGES_AFTER_BUILD = "impact \u2192 unit tests \u2192 PR \u2192 E2E \u2192 watcher";
|
|
144
145
|
var GITHUB_PR_CREATE_CMD = /\bgh\s+pr\s+create\b/;
|
|
145
146
|
var GITHUB_PR_READY_CMD = /\bgh\s+pr\s+ready\b/;
|
|
@@ -3604,7 +3605,7 @@ function buildFollowthroughGate() {
|
|
|
3604
3605
|
if (decision.action === "release" /* Release */) return releaseGate("buildSkipped");
|
|
3605
3606
|
if (decision.action === "none" /* None */) return "{}";
|
|
3606
3607
|
recordGateBlock("buildBlockCount", decision.blockCount);
|
|
3607
|
-
const reason = decision.blockCount === 1 ? `Do not end the turn yet. This session took a build/implement/fix request but no PR was opened. A root cause written into the transcript ships nothing \u2014 once the session ends it is gone, and the watcher gate never fires because it only looks at PRs that exist. Carry the work to a PR via ${muggleSkill("/muggle-do")}, which runs
|
|
3608
|
+
const reason = decision.blockCount === 1 ? `Do not end the turn yet. This session took a build/implement/fix request but no PR was opened. A root cause written into the transcript ships nothing \u2014 once the session ends it is gone, and the watcher gate never fires because it only looks at PRs that exist. Carry the work to a PR via ${muggleSkill("/muggle-do")}, which runs ${MUGGLE_DO_STAGES_BEFORE_BUILD} \u2192 build \u2192 ${MUGGLE_DO_STAGES_AFTER_BUILD}. If no PR is owed here (the user changed their mind, the fix landed in another repo, the answer was advice rather than a change), tell the user why and run \`echo "MUGGLE_BUILD_SKIP: <reason>"\` \u2014 that records the skip and keeps this gate quiet for the rest of the session.` : `Build request still unanswered \u2014 no PR opened (reminder ${decision.blockCount}/${MAX_BUILD_BLOCKS}): carry it to a PR via ${muggleSkill("/muggle-do")}, or record a legitimate skip via \`echo "MUGGLE_BUILD_SKIP: <reason>"\`.`;
|
|
3608
3609
|
return blockStop(reason, host);
|
|
3609
3610
|
}
|
|
3610
3611
|
function walkthroughGate() {
|
|
@@ -3732,7 +3733,7 @@ function buildRouter() {
|
|
|
3732
3733
|
if (readState(sessionId).buildIntentRouted) return "{}";
|
|
3733
3734
|
commitStateMutation(sessionId, { kind: "fields" /* Fields */, fields: { buildIntentRouted: true } });
|
|
3734
3735
|
if (isMuggleDoInvoked) return "{}";
|
|
3735
|
-
const ctx = `This looks like a build/implement/fix request. Per the autoRouteBuildToMuggleDo preference, route it through ${muggleSkill("/muggle-do")} \u2014 which runs
|
|
3736
|
+
const ctx = `This looks like a build/implement/fix request. Per the autoRouteBuildToMuggleDo preference, route it through ${muggleSkill("/muggle-do")} \u2014 which runs ${MUGGLE_DO_STAGES_BEFORE_BUILD} \u2192 build (delegated to superpowers' plan\u2192review) \u2192 ${MUGGLE_DO_STAGES_AFTER_BUILD}. If autoRouteBuildToMuggleDo=always, enter that flow; if =ask, offer it; if =never, proceed normally.`;
|
|
3736
3737
|
return envelope("UserPromptSubmit", ctx, host);
|
|
3737
3738
|
}
|
|
3738
3739
|
function closingAssistantText() {
|
|
@@ -17,6 +17,7 @@ Implement the code change for this dev cycle. Read the frozen requirements from
|
|
|
17
17
|
|
|
18
18
|
For each affected repo:
|
|
19
19
|
|
|
20
|
+
0. **Check the design gate.** `state.md` must carry a `Design: finalized` line from [Stage 2.5](design.md). Without it, edit nothing: go back and run Stage 2.5. Every re-entry below inherits the line already recorded.
|
|
20
21
|
1. **Re-read `requirements.md`.** Treat goal + AC as frozen. If something is unclear at this stage, that's a pre-flight bug — escalate, do not improvise.
|
|
21
22
|
1.5. **Prove a bug fix first.** When `requirements.md` says `Change type: bug fix`, write a unit test for its regression criterion before touching the fix and run it: it must fail, for the bug's reason. Apply the fix, then run it again: it must pass. This stage's marker records the criterion, the test's file path, and `failed before, passed after`. A bug no unit test can reach is waived in `state.md` with the reason. The re-entries below owe no new regression test: they carry review comments and defects the change itself introduced.
|
|
22
23
|
2. **Apply the change** in the repo's worktree. Edit existing files first; create new files only when the requirements demand it. Match the surrounding code's style, naming, and file layout.
|
|
@@ -34,7 +35,7 @@ For each affected repo:
|
|
|
34
35
|
|
|
35
36
|
## Delegation
|
|
36
37
|
|
|
37
|
-
For a non-trivial change — multiple files, real design surface, or anything you would otherwise brainstorm before coding — run the implementation through superpowers'
|
|
38
|
+
For a non-trivial change — multiple files, real design surface, or anything you would otherwise brainstorm before coding — run the implementation through superpowers' plan → subagent-driven build, building from the approved `design.md` — its design step already ran in Stage 2.5 and is not reopened here — then return to this stage's Output. That is a runtime hand-off (an action), not a doc dependency; do not encode superpowers' internals here. Routing a build request into this pipeline (the `autoRouteBuildToMuggleDo` front-door guardrail) exists to combine superpowers' design rigor with this pipeline's impact analysis, PR, E2E, and watcher — neither delivers both alone.
|
|
38
39
|
|
|
39
40
|
## Output
|
|
40
41
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Design Agent (Stage 2.5)
|
|
2
|
+
|
|
3
|
+
Finalize the change's design before any code. Stage 3 never edits a file until `state.md` carries a `Design: finalized` line, and only this stage writes it.
|
|
4
|
+
|
|
5
|
+
## Turn preamble
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
**Stage 2.5 — Design** — writing the spec and holding the build until it is approved.
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Inputs
|
|
12
|
+
|
|
13
|
+
- `requirements.md` from Stage 2.
|
|
14
|
+
- `state.md` from pre-flight.
|
|
15
|
+
|
|
16
|
+
## Which path
|
|
17
|
+
|
|
18
|
+
0. **Already finalized.** `state.md` already carries a `Design: finalized` line — a resumed session, or a re-entry from address-reviews, fix-ci or E2E repair. The stage is closed: reopen nothing, write no `design.md`, ask nothing, and go on to Stage 3. The line is the record of the decision; a missing `design.md` or an approval not shown in this conversation does not make it doubtful.
|
|
19
|
+
1. **Spec supplied.** The task itself is a design or spec the user wrote — a linked or pasted doc that already decides the approach. It is final as given: record `Design: finalized — user-supplied spec <path or link>`, write no `design.md`, and ask nothing.
|
|
20
|
+
2. **Trivial change.** One file, or a few lines across files, with no design surface: no new module, interface, data shape, or behavior a reasonable reader could build two ways. `requirements.md` is the whole spec: record `Design: finalized — trivial, requirements.md is the spec (<one-line reason>)` and ask nothing. When unsure, it is not trivial.
|
|
21
|
+
3. **Everything else** goes through the approval below.
|
|
22
|
+
|
|
23
|
+
## Approval
|
|
24
|
+
|
|
25
|
+
1. **Write the spec** to `~/.muggle-ai/muggle-do/sessions/<slug>/design.md`, using superpowers' design step to reach it. Sections: approach, what changes where (components and files), decisions with the alternative each one rejected, what is out of scope. Every decision is made and stated — no open options handed back.
|
|
26
|
+
2. **Notify** the user with a push notification, where the host has one: `Design ready for <slug> — approve to start the build`.
|
|
27
|
+
3. **Ask** with one `AskUserQuestion`: the spec's path plus a three-line digest of its decisions, options `Approve` / `Request changes`. This is a decision only the user may make: `frontloadQuestions=always` never defaults it, and a run told to go unattended still stops here.
|
|
28
|
+
4. **On `Request changes`**, revise `design.md` from the notes and ask again. Each round appends a line to `iterations/<NNN>.md`.
|
|
29
|
+
5. **On `Approve`**, record `Design: finalized — approved <ISO-8601 timestamp>` in `state.md`.
|
|
30
|
+
|
|
31
|
+
A turn that ends while the question is open records `echo "MUGGLE_STAGE_SKIP: design awaiting approval"`; resuming the session re-asks it. A pre-flight answer that already approved a stated approach counts as `Approve` — cite it in the line.
|
|
32
|
+
|
|
33
|
+
## Output
|
|
34
|
+
|
|
35
|
+
`state.md` carries the `Design: finalized` line, then this stage's marker in `iterations/<NNN>.md`: `Stage 2.5 done — <path taken> — <design.md path, spec link, or trivial reason>`.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
mandatoryStages:
|
|
3
3
|
- requirements.md
|
|
4
|
+
- design.md
|
|
4
5
|
- build.md
|
|
5
6
|
- impact-analysis.md
|
|
6
7
|
- unit-tests.md
|
|
@@ -12,7 +13,9 @@ mandatoryStages:
|
|
|
12
13
|
|
|
13
14
|
# Pre-flight Agent (Stage 1)
|
|
14
15
|
|
|
15
|
-
You are running the **
|
|
16
|
+
You are running the muggle-do dev cycle's **one questioning turn** — the only other user stop is Stage 2.5's design approval ([`design.md`](design.md)). Your job is to consolidate every real decision — task scope, repos, validation strategy, environment, credentials — into a **single turn** so the rest of the cycle can run unattended.
|
|
17
|
+
|
|
18
|
+
**Never ask what has a sensible default.** Branch name, PR target, a detected local URL, the top-matching project, the worktree, and syncing onto the base are taken silently from their defaults and preference gates, then listed in the handoff line, where the user overrides by replying. A question earns its place only when no default exists or a wrong guess costs more than the round trip.
|
|
16
19
|
|
|
17
20
|
**Non-negotiable:** Never split pre-flight across multiple turns. Detect what you can silently, then ask every remaining question at once. If you find yourself asking a follow-up, you failed — fold the follow-up back into this file so the next run covers it.
|
|
18
21
|
|
|
@@ -56,25 +59,25 @@ Before asking anything, gather every fact you can resolve without the user:
|
|
|
56
59
|
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:
|
|
57
60
|
|
|
58
61
|
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.
|
|
59
|
-
2. **Repo(s) to modify** —
|
|
60
|
-
3. **Branch name** —
|
|
61
|
-
4. **Validation strategy** — the single most important
|
|
62
|
+
2. **Repo(s) to modify** — only when no single repo is the obvious match; an obvious match is taken silently. "Use <best match>" / "Change repo" / "Multi-repo (list them)". When multi-repo, state in the option whether the PRs ship as a wave — one change, tested together in one E2E run — or a stream of independent changes, each tested on its own, per step 11 and [`wave-or-stream.md`](wave-or-stream.md) — no separate question.
|
|
63
|
+
3. **Branch name** — never asked: `users/<user>/<slug>` derived from the task.
|
|
64
|
+
4. **Validation strategy** — the single most important decision, asked only when the change does not settle it: a UI change with a detected dev server takes Local E2E silently, a change with no app surface (docs, skill text, config) takes Unit tests only silently. Options:
|
|
62
65
|
- **Local E2E** (Muggle Test Electron against a running localhost) — default if a dev server was detected.
|
|
63
66
|
- **Staging replay** — for changes already deployed to a preview URL.
|
|
64
67
|
- **Unit tests only** — skip browser E2E, acceptable for pure refactors or backend-only changes. Deliverable checks on video, image, audio, data, research, or email artifacts still run.
|
|
65
68
|
- **Skip validation** — explicit opt-out; the PR title gets `[UNVERIFIED]`.
|
|
66
|
-
5. **Local URL** — only if validation is Local E2E
|
|
69
|
+
5. **Local URL** — only if validation is Local E2E and no dev server was detected; a detected one is taken silently. "Type the URL".
|
|
67
70
|
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".
|
|
68
|
-
7. **Muggle Test project** —
|
|
71
|
+
7. **Muggle Test project** — only if validation needs one and no project clearly matches; a clear top match is taken silently. "Use <top match>" / "Use a different existing project (list)" / "Create new".
|
|
69
72
|
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".
|
|
70
|
-
9. **PR target branch** —
|
|
73
|
+
9. **PR target branch** — never asked: the repo's default branch.
|
|
71
74
|
10. **Re-auth Muggle Test MCP?** — only if auth was missing/expired. "Log in now" / "Abort".
|
|
72
75
|
11. **Worktree for this change?** — gate: [`autoUseWorktree`](../muggle-preferences/preference-gates/autoUseWorktree.md). Options: create a dedicated worktree (per [`../_shared/use-worktrees.md`](../_shared/use-worktrees.md)), or work in the current checkout.
|
|
73
76
|
12. **Sync onto the base branch first?** — gate: [`autoRebase`](../muggle-preferences/preference-gates/autoRebase.md), only if `behind > 0`. The answer governs every sync this cycle, not just one: before the dev server / E2E, and again immediately before stage 7 pushes. Options: sync with the base, or run as-is.
|
|
74
77
|
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.
|
|
75
78
|
14. **Add the Muggle E2E check to this repo's CI?** — gate: [`autoInstallCiWorkflow`](../muggle-preferences/preference-gates/autoInstallCiWorkflow.md), only if step 12 found the workflow missing and the gate resolved to `ask`. Record the answer in `state.md` as `CI check: add | skip`; stage 7 acts on it.
|
|
76
79
|
|
|
77
|
-
If fewer than two of the above need the user, still gather them in a single turn — never open a second round.
|
|
80
|
+
If fewer than two of the above need the user, still gather them in a single turn — never open a second round. If none do, ask nothing: write `state.md` and go straight to the handoff. Never add a "confirm these defaults?" question.
|
|
78
81
|
|
|
79
82
|
## Output
|
|
80
83
|
|
|
@@ -119,11 +122,11 @@ Also initialize `iterations/001.md` with a header:
|
|
|
119
122
|
|
|
120
123
|
## Handoff
|
|
121
124
|
|
|
122
|
-
Return control to the muggle-do driver with a one-line summary: `pre-flight complete
|
|
125
|
+
Return control to the muggle-do driver with a one-line summary naming the defaults taken: `pre-flight complete — <repo>, branch <branch> → <PR target>, <validation>; reply to override. Proceeding to requirements and design.` Print nothing else of the answers — they are in `state.md` and the iteration log.
|
|
123
126
|
|
|
124
127
|
## Non-negotiables
|
|
125
128
|
|
|
126
129
|
- Exactly **one** user turn. Zero follow-up questions inside this stage.
|
|
127
130
|
- Silent detection **must** run before the questionnaire — never ask for a value you can detect.
|
|
128
|
-
- Every detected value is a default, not a lock — the user
|
|
131
|
+
- Every detected value is a default, not a lock — the user overrides it by replying to the handoff line.
|
|
129
132
|
- Missing `state.md` or `iterations/001.md` at the end of this stage is a stage failure. Several changes → one session directory each, all written before Stage 2 starts on the first.
|
|
@@ -17,8 +17,9 @@ Runs an autonomous dev cycle from requirements to PR. **Fire and review:** user
|
|
|
17
17
|
|
|
18
18
|
| # | Stage | File |
|
|
19
19
|
| :- | :---- | :--- |
|
|
20
|
-
| 1 | Pre-flight (
|
|
20
|
+
| 1 | Pre-flight (one questioning turn) | [`../do/pre-flight.md`](../do/pre-flight.md) |
|
|
21
21
|
| 2 | Requirements | [`../do/requirements.md`](../do/requirements.md) |
|
|
22
|
+
| 2.5 | Design — user approves before any code | [`../do/design.md`](../do/design.md) |
|
|
22
23
|
| 3 | Build | [`../do/build.md`](../do/build.md) |
|
|
23
24
|
| 4 | Impact analysis | [`../do/impact-analysis.md`](../do/impact-analysis.md) |
|
|
24
25
|
| 5 | Unit tests | [`../do/unit-tests.md`](../do/unit-tests.md) |
|
|
@@ -45,18 +46,19 @@ The pipeline table lists **pointers, not summaries**. Open each stage's file and
|
|
|
45
46
|
**Bootstrap before any code, in order:**
|
|
46
47
|
1. Emit telemetry — [`../_shared/telemetry-emit.md`](../_shared/telemetry-emit.md), `skillName: "muggle-do"`.
|
|
47
48
|
2. Create `~/.muggle-ai/muggle-do/sessions/<slug>/` with `state.md` + `iterations/001.md` (pre-flight owns this; do it even when running unattended).
|
|
48
|
-
3. `TodoWrite` one item per stage 1–8, Stages 5.5 and 7.5 included — these stages are the checklist; never swap in your own decomposition. Several changes → one set of stage items per change.
|
|
49
|
+
3. `TodoWrite` one item per stage 1–8, Stages 2.5, 5.5 and 7.5 included — these stages are the checklist; never swap in your own decomposition. Several changes → one set of stage items per change.
|
|
49
50
|
|
|
50
51
|
**Per stage:** read the file → execute it → append one marker line to `iterations/<NNN>.md`, always in the form `Stage <N> done — <evidence>`, citing the evidence that file requires (jest exit code, E2E verdict + `runId`, screenshot path). The marker is the stage's last line, written after its notes, and carries the evidence itself: nothing between `done` and `—`, never a pointer such as `Stage 4 done (see below) —`. A stage is done only when its evidence is written, never on recollection.
|
|
51
52
|
|
|
52
53
|
### "Autonomous" / "without my intervention" collapses exactly one thing
|
|
53
|
-
Best-effort the Stage-1 questionnaire and don't ask. It does **not** license skipping telemetry, session artifacts, requirements, unit tests, E2E (`autoE2ETest` defaults to `always`), browser verification, the gate below, the Stage-7.5 repair loop, or the watcher hand-off. Stage 7.5 investigates and repairs unattended too; only its user decision is deferred — left open for the user and carried by the watcher, never waived on their behalf. Run the whole pipeline silently — never a shortcut.
|
|
54
|
+
Best-effort the Stage-1 questionnaire and don't ask. It does **not** license skipping telemetry, session artifacts, requirements, the Stage-2.5 design approval, unit tests, E2E (`autoE2ETest` defaults to `always`), browser verification, the gate below, the Stage-7.5 repair loop, or the watcher hand-off. Stage 7.5 investigates and repairs unattended too; only its user decision is deferred — left open for the user and carried by the watcher, never waived on their behalf. Run the whole pipeline silently — never a shortcut.
|
|
54
55
|
|
|
55
56
|
### Definition of Done — gates before Stages 5.5 and 7
|
|
56
57
|
Each line holds, or is waived by a one-line reason written into `state.md` (silence is not a waiver).
|
|
57
58
|
|
|
58
59
|
Before Stage 5.5 opens the PR:
|
|
59
60
|
- `requirements.md` written (forward runs)
|
|
61
|
+
- `Design: finalized` recorded in `state.md` before Stage 3 edited a file (forward runs)
|
|
60
62
|
- Build clean — typecheck + lint on changed files
|
|
61
63
|
- New/changed logic carries unit tests (authored in Stage 3; Stage 5 only runs the suite)
|
|
62
64
|
- Unit suite run, PASS recorded
|
|
@@ -85,7 +87,7 @@ When invoked with the directive (PR URL + slug + review ids), routes to [`../do/
|
|
|
85
87
|
|
|
86
88
|
| Preference | Gate |
|
|
87
89
|
| :--------- | :--- |
|
|
88
|
-
| `frontloadQuestions` | Every stage — `always` keeps Stage 1 the only questioning turn and Stage 7.5's decision open rather than asked; `never` lets a later stage ask when a question arises ([rule](../muggle-preferences/preference-gates/frontloadQuestions.md)) |
|
|
90
|
+
| `frontloadQuestions` | Every stage — `always` keeps Stage 1 the only questioning turn besides Stage 2.5's design approval, and Stage 7.5's decision open rather than asked; `never` lets a later stage ask when a question arises ([rule](../muggle-preferences/preference-gates/frontloadQuestions.md)) |
|
|
89
91
|
| `autoE2ETest` | Stage 6 — run E2E every cycle (default `always`), or fold into pre-flight |
|
|
90
92
|
| `autoResolveConflicts` | On rebase conflict — `always` resolves autonomously behind a verify-or-rollback gate, `never` aborts + escalates; resolve from the configured preference (don't assume a default) |
|
|
91
93
|
| `autoRouteBuildToMuggleDo` | Front-door guardrail — route build/implement/fix requests through this pipeline (build delegated to superpowers); fired by the UserPromptSubmit guardrail, default `ask` |
|
|
@@ -107,7 +109,8 @@ When invoked with the directive (PR URL + slug + review ids), routes to [`../do/
|
|
|
107
109
|
|
|
108
110
|
## Guardrails
|
|
109
111
|
|
|
110
|
-
- Stage 1 and Stage 7.5's user decision are the only user-facing forward stages. Stages 2–7 don't ask mid-cycle; blocker → pre-flight bug.
|
|
112
|
+
- Stage 1, Stage 2.5's design approval, and Stage 7.5's user decision are the only user-facing forward stages. Stages 2 and 3–7 don't ask mid-cycle; blocker → pre-flight bug.
|
|
113
|
+
- No code before a finalized design: Stage 3 starts only after Stage 2.5 records `Design: finalized` in `state.md`.
|
|
111
114
|
- Same stage failing 3× → escalate.
|
|
112
115
|
- Each route's entry file declares the stage files every run of that route opens, and a Stop gate holds the turn until they are read. A turn that ends before its route's last stage — a readiness halt, an escalation, a pause for a background run — records why with `echo "MUGGLE_STAGE_SKIP: <reason>"`.
|
|
113
116
|
- 3 repair iterations reach E2E with failures → put the surviving failures to the user (an open decision when unattended), ship with `[E2E FAILING]`, and hand to the watcher.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `autoRouteBuildToMuggleDo`
|
|
2
2
|
|
|
3
|
-
When the user asks to build, implement, or fix something, controls whether the front-door guardrail routes the work through `/muggle-do` — the orchestrator that runs requirements → build (delegated to superpowers'
|
|
3
|
+
When the user asks to build, implement, or fix something, controls whether the front-door guardrail routes the work through `/muggle-do` — the orchestrator that runs requirements → design (user approves before any code) → build (delegated to superpowers' plan→review) → impact → unit tests → PR → E2E → watcher — or lets the request proceed however the model would otherwise handle it. Fires once per session, on the first build-intent prompt (UserPromptSubmit guardrail).
|
|
4
4
|
|
|
5
5
|
**Picker 1** — header `Route to muggle-do?`, question `"This looks like a build request — run it through /muggle-do (E2E + PR + watcher, build delegated to superpowers)?"`
|
|
6
6
|
- `Route it` — `Enter the /muggle-do pipeline.` → `always`
|
|
@@ -8,7 +8,7 @@ When a run asks its questions. Allowed values: `always` / `never` — there is n
|
|
|
8
8
|
|
|
9
9
|
1. **One up-front batch.** Before the run's first long-running step — invoking `muggle-test-prepare`, any `muggle-local-execute-*` call, a remote generation, replay or bulk dispatch, a build, or a wait on a remote workflow — ask every question the run can foresee, in `AskUserQuestion` calls sent back to back with no work between them. Foreseeable includes every gate the run will fire later that resolves to `ask` (a post-run `openTestResultsAfterRun`, `postPRVisualWalkthrough`, `autoCreatePR`, `autoWatchPR`, `suggestRelated*`), asked now and applied when its step arrives. A foreseeable `ask` gate is never defaulted in place of asking: its picker goes in the batch. A gate resolving to `always` or `never` asks nothing either way.
|
|
10
10
|
2. **Nothing after it.** Once the first long-running step starts, call no `AskUserQuestion` for the rest of the run. A question that surfaces anyway takes a best-effort default: the gate's shipped default, else the option the skill marks recommended, else the option that changes nothing outside this session. Record each as `Defaulted: <question> → <choice> (<reason>)`.
|
|
11
|
-
3. **Decisions only the user may make are never defaulted.** Merging, paying, posting publicly, deleting user data, waiving a failing test, choosing an E2E repair: ask it in the batch when it is foreseeable. When it is not, leave it open, finish every part of the run that does not depend on it, and record it as `Open: <question>`.
|
|
11
|
+
3. **Decisions only the user may make are never defaulted.** Merging, paying, posting publicly, deleting user data, waiving a failing test, choosing an E2E repair, approving a design before it is built: ask it in the batch when it is foreseeable. When it is not, leave it open, finish every part of the run that does not depend on it, and record it as `Open: <question>`.
|
|
12
12
|
4. **One-click follow-ups become report lines.** A non-blocking prompt a skill offers after a step — "did the agent miss anything on this run?", a suggestion to add related cases — is printed as a line with its one-click path (the slash command and its argument) instead of being asked.
|
|
13
13
|
5. **The final report lists them.** The run's closing message ends with a `Decisions` block: every `Defaulted:` line, then every `Open:` line, or `Decisions: none deferred`.
|
|
14
14
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
"release": "5.38.0-staging.
|
|
3
|
-
"buildId": "run-
|
|
4
|
-
"commitSha": "
|
|
2
|
+
"release": "5.38.0-staging.348",
|
|
3
|
+
"buildId": "run-348-1",
|
|
4
|
+
"commitSha": "8379ee9f9307148693aa64d6b4c2741118ba20ad",
|
|
5
5
|
"buildTime": "2026-11-12T07:45:22Z",
|
|
6
6
|
"serviceName": "muggle-ai-works-mcp"
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muggleai/works",
|
|
3
3
|
"mcpName": "io.github.multiplex-ai/muggleai",
|
|
4
|
-
"version": "5.38.0-staging.
|
|
4
|
+
"version": "5.38.0-staging.348",
|
|
5
5
|
"description": "Acceptance test agent for coding agents: real-browser tests, with screenshots on the PR.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/index.js",
|
|
@@ -66,21 +66,21 @@
|
|
|
66
66
|
"typecheck:browser-bench": "tsc --noEmit -p internal/browser-bench/tsconfig.json"
|
|
67
67
|
},
|
|
68
68
|
"muggleConfig": {
|
|
69
|
-
"electronAppVersion": "1.25.
|
|
69
|
+
"electronAppVersion": "1.25.9",
|
|
70
70
|
"downloadBaseUrl": "https://github.com/multiplex-ai/muggle-ai-works/releases/download",
|
|
71
71
|
"runtimeTargetDefault": "staging",
|
|
72
72
|
"checksumsByStream": {
|
|
73
73
|
"production": {
|
|
74
|
-
"win32-x64": "
|
|
75
|
-
"linux-x64": "
|
|
76
|
-
"darwin-arm64": "
|
|
77
|
-
"darwin-x64": "
|
|
74
|
+
"win32-x64": "6101adb55e7f024dd4f415eb16c2d573b93396b96263d910df00926a465419a8",
|
|
75
|
+
"linux-x64": "963dbad2ada4b6b799115da964400ac2c1b4e7383d15ef9b8b17abe05346dfb4",
|
|
76
|
+
"darwin-arm64": "6051b3da16b65ad691ddf57a3b3940db31cacf293278d6ab2c343755879a9e0a",
|
|
77
|
+
"darwin-x64": "8d5d9fc4df08fbde933591847042604151801e7e5fb978598d8e045550b8707f"
|
|
78
78
|
},
|
|
79
79
|
"staging": {
|
|
80
|
-
"darwin-arm64": "
|
|
81
|
-
"linux-x64": "
|
|
82
|
-
"win32-x64": "
|
|
83
|
-
"darwin-x64": "
|
|
80
|
+
"darwin-arm64": "baf064bcf05a435af371e89638aac5eac4aa104aa0f362ff2dc5cc042cb3e528",
|
|
81
|
+
"linux-x64": "4d57f45ff2c00b056513da2ac08568b2031283ef9a1cfbacdd7d1d7f4c41bee9",
|
|
82
|
+
"win32-x64": "27917fef49fd2bbb7c35c8dc63beef07585e23c14adb358b9bab3ed0bebabcc1",
|
|
83
|
+
"darwin-x64": "26a0aa1615992f3bd5f4ee9e1907d7111d468923507cebc0e498b971575bd1ba"
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
86
|
"electronAppSignedFromVersion": "1.10.0",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "muggle",
|
|
3
3
|
"description": "Acceptance test agent for coding agents: real-browser tests, with screenshots on the PR.",
|
|
4
|
-
"version": "5.38.0-staging.
|
|
4
|
+
"version": "5.38.0-staging.348",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Muggle AI",
|
|
7
7
|
"email": "support@muggle-ai.com"
|
package/plugin/.codex-mcp.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "muggle",
|
|
3
3
|
"displayName": "Muggle AI",
|
|
4
4
|
"description": "Acceptance test agent for coding agents: real-browser tests, with screenshots on the PR.",
|
|
5
|
-
"version": "5.38.0-staging.
|
|
5
|
+
"version": "5.38.0-staging.348",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Muggle AI",
|
|
8
8
|
"email": "support@muggle-ai.com"
|
package/plugin/.mcp.json
CHANGED
|
@@ -140,6 +140,7 @@ var RECONCILE_REPLAY_TIMEOUT_MS = 15e3;
|
|
|
140
140
|
var GUARDRAIL_SUBCOMMAND_ASSIGNMENT = /^GUARDRAIL_SUBCOMMAND="([\w-]+)"/m;
|
|
141
141
|
var HOOK_COMMAND_SCRIPTS = /^set -- ([^;]+);/;
|
|
142
142
|
var GUARDRAIL_DISPATCH_SCRIPT = "guardrail-dispatch.sh";
|
|
143
|
+
var MUGGLE_DO_STAGES_BEFORE_BUILD = "requirements \u2192 design (user approves before any code)";
|
|
143
144
|
var MUGGLE_DO_STAGES_AFTER_BUILD = "impact \u2192 unit tests \u2192 PR \u2192 E2E \u2192 watcher";
|
|
144
145
|
var GITHUB_PR_CREATE_CMD = /\bgh\s+pr\s+create\b/;
|
|
145
146
|
var GITHUB_PR_READY_CMD = /\bgh\s+pr\s+ready\b/;
|
|
@@ -3604,7 +3605,7 @@ function buildFollowthroughGate() {
|
|
|
3604
3605
|
if (decision.action === "release" /* Release */) return releaseGate("buildSkipped");
|
|
3605
3606
|
if (decision.action === "none" /* None */) return "{}";
|
|
3606
3607
|
recordGateBlock("buildBlockCount", decision.blockCount);
|
|
3607
|
-
const reason = decision.blockCount === 1 ? `Do not end the turn yet. This session took a build/implement/fix request but no PR was opened. A root cause written into the transcript ships nothing \u2014 once the session ends it is gone, and the watcher gate never fires because it only looks at PRs that exist. Carry the work to a PR via ${muggleSkill("/muggle-do")}, which runs
|
|
3608
|
+
const reason = decision.blockCount === 1 ? `Do not end the turn yet. This session took a build/implement/fix request but no PR was opened. A root cause written into the transcript ships nothing \u2014 once the session ends it is gone, and the watcher gate never fires because it only looks at PRs that exist. Carry the work to a PR via ${muggleSkill("/muggle-do")}, which runs ${MUGGLE_DO_STAGES_BEFORE_BUILD} \u2192 build \u2192 ${MUGGLE_DO_STAGES_AFTER_BUILD}. If no PR is owed here (the user changed their mind, the fix landed in another repo, the answer was advice rather than a change), tell the user why and run \`echo "MUGGLE_BUILD_SKIP: <reason>"\` \u2014 that records the skip and keeps this gate quiet for the rest of the session.` : `Build request still unanswered \u2014 no PR opened (reminder ${decision.blockCount}/${MAX_BUILD_BLOCKS}): carry it to a PR via ${muggleSkill("/muggle-do")}, or record a legitimate skip via \`echo "MUGGLE_BUILD_SKIP: <reason>"\`.`;
|
|
3608
3609
|
return blockStop(reason, host);
|
|
3609
3610
|
}
|
|
3610
3611
|
function walkthroughGate() {
|
|
@@ -3732,7 +3733,7 @@ function buildRouter() {
|
|
|
3732
3733
|
if (readState(sessionId).buildIntentRouted) return "{}";
|
|
3733
3734
|
commitStateMutation(sessionId, { kind: "fields" /* Fields */, fields: { buildIntentRouted: true } });
|
|
3734
3735
|
if (isMuggleDoInvoked) return "{}";
|
|
3735
|
-
const ctx = `This looks like a build/implement/fix request. Per the autoRouteBuildToMuggleDo preference, route it through ${muggleSkill("/muggle-do")} \u2014 which runs
|
|
3736
|
+
const ctx = `This looks like a build/implement/fix request. Per the autoRouteBuildToMuggleDo preference, route it through ${muggleSkill("/muggle-do")} \u2014 which runs ${MUGGLE_DO_STAGES_BEFORE_BUILD} \u2192 build (delegated to superpowers' plan\u2192review) \u2192 ${MUGGLE_DO_STAGES_AFTER_BUILD}. If autoRouteBuildToMuggleDo=always, enter that flow; if =ask, offer it; if =never, proceed normally.`;
|
|
3736
3737
|
return envelope("UserPromptSubmit", ctx, host);
|
|
3737
3738
|
}
|
|
3738
3739
|
function closingAssistantText() {
|
|
@@ -17,6 +17,7 @@ Implement the code change for this dev cycle. Read the frozen requirements from
|
|
|
17
17
|
|
|
18
18
|
For each affected repo:
|
|
19
19
|
|
|
20
|
+
0. **Check the design gate.** `state.md` must carry a `Design: finalized` line from [Stage 2.5](design.md). Without it, edit nothing: go back and run Stage 2.5. Every re-entry below inherits the line already recorded.
|
|
20
21
|
1. **Re-read `requirements.md`.** Treat goal + AC as frozen. If something is unclear at this stage, that's a pre-flight bug — escalate, do not improvise.
|
|
21
22
|
1.5. **Prove a bug fix first.** When `requirements.md` says `Change type: bug fix`, write a unit test for its regression criterion before touching the fix and run it: it must fail, for the bug's reason. Apply the fix, then run it again: it must pass. This stage's marker records the criterion, the test's file path, and `failed before, passed after`. A bug no unit test can reach is waived in `state.md` with the reason. The re-entries below owe no new regression test: they carry review comments and defects the change itself introduced.
|
|
22
23
|
2. **Apply the change** in the repo's worktree. Edit existing files first; create new files only when the requirements demand it. Match the surrounding code's style, naming, and file layout.
|
|
@@ -34,7 +35,7 @@ For each affected repo:
|
|
|
34
35
|
|
|
35
36
|
## Delegation
|
|
36
37
|
|
|
37
|
-
For a non-trivial change — multiple files, real design surface, or anything you would otherwise brainstorm before coding — run the implementation through superpowers'
|
|
38
|
+
For a non-trivial change — multiple files, real design surface, or anything you would otherwise brainstorm before coding — run the implementation through superpowers' plan → subagent-driven build, building from the approved `design.md` — its design step already ran in Stage 2.5 and is not reopened here — then return to this stage's Output. That is a runtime hand-off (an action), not a doc dependency; do not encode superpowers' internals here. Routing a build request into this pipeline (the `autoRouteBuildToMuggleDo` front-door guardrail) exists to combine superpowers' design rigor with this pipeline's impact analysis, PR, E2E, and watcher — neither delivers both alone.
|
|
38
39
|
|
|
39
40
|
## Output
|
|
40
41
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Design Agent (Stage 2.5)
|
|
2
|
+
|
|
3
|
+
Finalize the change's design before any code. Stage 3 never edits a file until `state.md` carries a `Design: finalized` line, and only this stage writes it.
|
|
4
|
+
|
|
5
|
+
## Turn preamble
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
**Stage 2.5 — Design** — writing the spec and holding the build until it is approved.
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Inputs
|
|
12
|
+
|
|
13
|
+
- `requirements.md` from Stage 2.
|
|
14
|
+
- `state.md` from pre-flight.
|
|
15
|
+
|
|
16
|
+
## Which path
|
|
17
|
+
|
|
18
|
+
0. **Already finalized.** `state.md` already carries a `Design: finalized` line — a resumed session, or a re-entry from address-reviews, fix-ci or E2E repair. The stage is closed: reopen nothing, write no `design.md`, ask nothing, and go on to Stage 3. The line is the record of the decision; a missing `design.md` or an approval not shown in this conversation does not make it doubtful.
|
|
19
|
+
1. **Spec supplied.** The task itself is a design or spec the user wrote — a linked or pasted doc that already decides the approach. It is final as given: record `Design: finalized — user-supplied spec <path or link>`, write no `design.md`, and ask nothing.
|
|
20
|
+
2. **Trivial change.** One file, or a few lines across files, with no design surface: no new module, interface, data shape, or behavior a reasonable reader could build two ways. `requirements.md` is the whole spec: record `Design: finalized — trivial, requirements.md is the spec (<one-line reason>)` and ask nothing. When unsure, it is not trivial.
|
|
21
|
+
3. **Everything else** goes through the approval below.
|
|
22
|
+
|
|
23
|
+
## Approval
|
|
24
|
+
|
|
25
|
+
1. **Write the spec** to `~/.muggle-ai/muggle-do/sessions/<slug>/design.md`, using superpowers' design step to reach it. Sections: approach, what changes where (components and files), decisions with the alternative each one rejected, what is out of scope. Every decision is made and stated — no open options handed back.
|
|
26
|
+
2. **Notify** the user with a push notification, where the host has one: `Design ready for <slug> — approve to start the build`.
|
|
27
|
+
3. **Ask** with one `AskUserQuestion`: the spec's path plus a three-line digest of its decisions, options `Approve` / `Request changes`. This is a decision only the user may make: `frontloadQuestions=always` never defaults it, and a run told to go unattended still stops here.
|
|
28
|
+
4. **On `Request changes`**, revise `design.md` from the notes and ask again. Each round appends a line to `iterations/<NNN>.md`.
|
|
29
|
+
5. **On `Approve`**, record `Design: finalized — approved <ISO-8601 timestamp>` in `state.md`.
|
|
30
|
+
|
|
31
|
+
A turn that ends while the question is open records `echo "MUGGLE_STAGE_SKIP: design awaiting approval"`; resuming the session re-asks it. A pre-flight answer that already approved a stated approach counts as `Approve` — cite it in the line.
|
|
32
|
+
|
|
33
|
+
## Output
|
|
34
|
+
|
|
35
|
+
`state.md` carries the `Design: finalized` line, then this stage's marker in `iterations/<NNN>.md`: `Stage 2.5 done — <path taken> — <design.md path, spec link, or trivial reason>`.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
mandatoryStages:
|
|
3
3
|
- requirements.md
|
|
4
|
+
- design.md
|
|
4
5
|
- build.md
|
|
5
6
|
- impact-analysis.md
|
|
6
7
|
- unit-tests.md
|
|
@@ -12,7 +13,9 @@ mandatoryStages:
|
|
|
12
13
|
|
|
13
14
|
# Pre-flight Agent (Stage 1)
|
|
14
15
|
|
|
15
|
-
You are running the **
|
|
16
|
+
You are running the muggle-do dev cycle's **one questioning turn** — the only other user stop is Stage 2.5's design approval ([`design.md`](design.md)). Your job is to consolidate every real decision — task scope, repos, validation strategy, environment, credentials — into a **single turn** so the rest of the cycle can run unattended.
|
|
17
|
+
|
|
18
|
+
**Never ask what has a sensible default.** Branch name, PR target, a detected local URL, the top-matching project, the worktree, and syncing onto the base are taken silently from their defaults and preference gates, then listed in the handoff line, where the user overrides by replying. A question earns its place only when no default exists or a wrong guess costs more than the round trip.
|
|
16
19
|
|
|
17
20
|
**Non-negotiable:** Never split pre-flight across multiple turns. Detect what you can silently, then ask every remaining question at once. If you find yourself asking a follow-up, you failed — fold the follow-up back into this file so the next run covers it.
|
|
18
21
|
|
|
@@ -56,25 +59,25 @@ Before asking anything, gather every fact you can resolve without the user:
|
|
|
56
59
|
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:
|
|
57
60
|
|
|
58
61
|
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.
|
|
59
|
-
2. **Repo(s) to modify** —
|
|
60
|
-
3. **Branch name** —
|
|
61
|
-
4. **Validation strategy** — the single most important
|
|
62
|
+
2. **Repo(s) to modify** — only when no single repo is the obvious match; an obvious match is taken silently. "Use <best match>" / "Change repo" / "Multi-repo (list them)". When multi-repo, state in the option whether the PRs ship as a wave — one change, tested together in one E2E run — or a stream of independent changes, each tested on its own, per step 11 and [`wave-or-stream.md`](wave-or-stream.md) — no separate question.
|
|
63
|
+
3. **Branch name** — never asked: `users/<user>/<slug>` derived from the task.
|
|
64
|
+
4. **Validation strategy** — the single most important decision, asked only when the change does not settle it: a UI change with a detected dev server takes Local E2E silently, a change with no app surface (docs, skill text, config) takes Unit tests only silently. Options:
|
|
62
65
|
- **Local E2E** (Muggle Test Electron against a running localhost) — default if a dev server was detected.
|
|
63
66
|
- **Staging replay** — for changes already deployed to a preview URL.
|
|
64
67
|
- **Unit tests only** — skip browser E2E, acceptable for pure refactors or backend-only changes. Deliverable checks on video, image, audio, data, research, or email artifacts still run.
|
|
65
68
|
- **Skip validation** — explicit opt-out; the PR title gets `[UNVERIFIED]`.
|
|
66
|
-
5. **Local URL** — only if validation is Local E2E
|
|
69
|
+
5. **Local URL** — only if validation is Local E2E and no dev server was detected; a detected one is taken silently. "Type the URL".
|
|
67
70
|
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".
|
|
68
|
-
7. **Muggle Test project** —
|
|
71
|
+
7. **Muggle Test project** — only if validation needs one and no project clearly matches; a clear top match is taken silently. "Use <top match>" / "Use a different existing project (list)" / "Create new".
|
|
69
72
|
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".
|
|
70
|
-
9. **PR target branch** —
|
|
73
|
+
9. **PR target branch** — never asked: the repo's default branch.
|
|
71
74
|
10. **Re-auth Muggle Test MCP?** — only if auth was missing/expired. "Log in now" / "Abort".
|
|
72
75
|
11. **Worktree for this change?** — gate: [`autoUseWorktree`](../muggle-preferences/preference-gates/autoUseWorktree.md). Options: create a dedicated worktree (per [`../_shared/use-worktrees.md`](../_shared/use-worktrees.md)), or work in the current checkout.
|
|
73
76
|
12. **Sync onto the base branch first?** — gate: [`autoRebase`](../muggle-preferences/preference-gates/autoRebase.md), only if `behind > 0`. The answer governs every sync this cycle, not just one: before the dev server / E2E, and again immediately before stage 7 pushes. Options: sync with the base, or run as-is.
|
|
74
77
|
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.
|
|
75
78
|
14. **Add the Muggle E2E check to this repo's CI?** — gate: [`autoInstallCiWorkflow`](../muggle-preferences/preference-gates/autoInstallCiWorkflow.md), only if step 12 found the workflow missing and the gate resolved to `ask`. Record the answer in `state.md` as `CI check: add | skip`; stage 7 acts on it.
|
|
76
79
|
|
|
77
|
-
If fewer than two of the above need the user, still gather them in a single turn — never open a second round.
|
|
80
|
+
If fewer than two of the above need the user, still gather them in a single turn — never open a second round. If none do, ask nothing: write `state.md` and go straight to the handoff. Never add a "confirm these defaults?" question.
|
|
78
81
|
|
|
79
82
|
## Output
|
|
80
83
|
|
|
@@ -119,11 +122,11 @@ Also initialize `iterations/001.md` with a header:
|
|
|
119
122
|
|
|
120
123
|
## Handoff
|
|
121
124
|
|
|
122
|
-
Return control to the muggle-do driver with a one-line summary: `pre-flight complete
|
|
125
|
+
Return control to the muggle-do driver with a one-line summary naming the defaults taken: `pre-flight complete — <repo>, branch <branch> → <PR target>, <validation>; reply to override. Proceeding to requirements and design.` Print nothing else of the answers — they are in `state.md` and the iteration log.
|
|
123
126
|
|
|
124
127
|
## Non-negotiables
|
|
125
128
|
|
|
126
129
|
- Exactly **one** user turn. Zero follow-up questions inside this stage.
|
|
127
130
|
- Silent detection **must** run before the questionnaire — never ask for a value you can detect.
|
|
128
|
-
- Every detected value is a default, not a lock — the user
|
|
131
|
+
- Every detected value is a default, not a lock — the user overrides it by replying to the handoff line.
|
|
129
132
|
- Missing `state.md` or `iterations/001.md` at the end of this stage is a stage failure. Several changes → one session directory each, all written before Stage 2 starts on the first.
|
|
@@ -17,8 +17,9 @@ Runs an autonomous dev cycle from requirements to PR. **Fire and review:** user
|
|
|
17
17
|
|
|
18
18
|
| # | Stage | File |
|
|
19
19
|
| :- | :---- | :--- |
|
|
20
|
-
| 1 | Pre-flight (
|
|
20
|
+
| 1 | Pre-flight (one questioning turn) | [`../do/pre-flight.md`](../do/pre-flight.md) |
|
|
21
21
|
| 2 | Requirements | [`../do/requirements.md`](../do/requirements.md) |
|
|
22
|
+
| 2.5 | Design — user approves before any code | [`../do/design.md`](../do/design.md) |
|
|
22
23
|
| 3 | Build | [`../do/build.md`](../do/build.md) |
|
|
23
24
|
| 4 | Impact analysis | [`../do/impact-analysis.md`](../do/impact-analysis.md) |
|
|
24
25
|
| 5 | Unit tests | [`../do/unit-tests.md`](../do/unit-tests.md) |
|
|
@@ -45,18 +46,19 @@ The pipeline table lists **pointers, not summaries**. Open each stage's file and
|
|
|
45
46
|
**Bootstrap before any code, in order:**
|
|
46
47
|
1. Emit telemetry — [`../_shared/telemetry-emit.md`](../_shared/telemetry-emit.md), `skillName: "muggle-do"`.
|
|
47
48
|
2. Create `~/.muggle-ai/muggle-do/sessions/<slug>/` with `state.md` + `iterations/001.md` (pre-flight owns this; do it even when running unattended).
|
|
48
|
-
3. `TodoWrite` one item per stage 1–8, Stages 5.5 and 7.5 included — these stages are the checklist; never swap in your own decomposition. Several changes → one set of stage items per change.
|
|
49
|
+
3. `TodoWrite` one item per stage 1–8, Stages 2.5, 5.5 and 7.5 included — these stages are the checklist; never swap in your own decomposition. Several changes → one set of stage items per change.
|
|
49
50
|
|
|
50
51
|
**Per stage:** read the file → execute it → append one marker line to `iterations/<NNN>.md`, always in the form `Stage <N> done — <evidence>`, citing the evidence that file requires (jest exit code, E2E verdict + `runId`, screenshot path). The marker is the stage's last line, written after its notes, and carries the evidence itself: nothing between `done` and `—`, never a pointer such as `Stage 4 done (see below) —`. A stage is done only when its evidence is written, never on recollection.
|
|
51
52
|
|
|
52
53
|
### "Autonomous" / "without my intervention" collapses exactly one thing
|
|
53
|
-
Best-effort the Stage-1 questionnaire and don't ask. It does **not** license skipping telemetry, session artifacts, requirements, unit tests, E2E (`autoE2ETest` defaults to `always`), browser verification, the gate below, the Stage-7.5 repair loop, or the watcher hand-off. Stage 7.5 investigates and repairs unattended too; only its user decision is deferred — left open for the user and carried by the watcher, never waived on their behalf. Run the whole pipeline silently — never a shortcut.
|
|
54
|
+
Best-effort the Stage-1 questionnaire and don't ask. It does **not** license skipping telemetry, session artifacts, requirements, the Stage-2.5 design approval, unit tests, E2E (`autoE2ETest` defaults to `always`), browser verification, the gate below, the Stage-7.5 repair loop, or the watcher hand-off. Stage 7.5 investigates and repairs unattended too; only its user decision is deferred — left open for the user and carried by the watcher, never waived on their behalf. Run the whole pipeline silently — never a shortcut.
|
|
54
55
|
|
|
55
56
|
### Definition of Done — gates before Stages 5.5 and 7
|
|
56
57
|
Each line holds, or is waived by a one-line reason written into `state.md` (silence is not a waiver).
|
|
57
58
|
|
|
58
59
|
Before Stage 5.5 opens the PR:
|
|
59
60
|
- `requirements.md` written (forward runs)
|
|
61
|
+
- `Design: finalized` recorded in `state.md` before Stage 3 edited a file (forward runs)
|
|
60
62
|
- Build clean — typecheck + lint on changed files
|
|
61
63
|
- New/changed logic carries unit tests (authored in Stage 3; Stage 5 only runs the suite)
|
|
62
64
|
- Unit suite run, PASS recorded
|
|
@@ -85,7 +87,7 @@ When invoked with the directive (PR URL + slug + review ids), routes to [`../do/
|
|
|
85
87
|
|
|
86
88
|
| Preference | Gate |
|
|
87
89
|
| :--------- | :--- |
|
|
88
|
-
| `frontloadQuestions` | Every stage — `always` keeps Stage 1 the only questioning turn and Stage 7.5's decision open rather than asked; `never` lets a later stage ask when a question arises ([rule](../muggle-preferences/preference-gates/frontloadQuestions.md)) |
|
|
90
|
+
| `frontloadQuestions` | Every stage — `always` keeps Stage 1 the only questioning turn besides Stage 2.5's design approval, and Stage 7.5's decision open rather than asked; `never` lets a later stage ask when a question arises ([rule](../muggle-preferences/preference-gates/frontloadQuestions.md)) |
|
|
89
91
|
| `autoE2ETest` | Stage 6 — run E2E every cycle (default `always`), or fold into pre-flight |
|
|
90
92
|
| `autoResolveConflicts` | On rebase conflict — `always` resolves autonomously behind a verify-or-rollback gate, `never` aborts + escalates; resolve from the configured preference (don't assume a default) |
|
|
91
93
|
| `autoRouteBuildToMuggleDo` | Front-door guardrail — route build/implement/fix requests through this pipeline (build delegated to superpowers); fired by the UserPromptSubmit guardrail, default `ask` |
|
|
@@ -107,7 +109,8 @@ When invoked with the directive (PR URL + slug + review ids), routes to [`../do/
|
|
|
107
109
|
|
|
108
110
|
## Guardrails
|
|
109
111
|
|
|
110
|
-
- Stage 1 and Stage 7.5's user decision are the only user-facing forward stages. Stages 2–7 don't ask mid-cycle; blocker → pre-flight bug.
|
|
112
|
+
- Stage 1, Stage 2.5's design approval, and Stage 7.5's user decision are the only user-facing forward stages. Stages 2 and 3–7 don't ask mid-cycle; blocker → pre-flight bug.
|
|
113
|
+
- No code before a finalized design: Stage 3 starts only after Stage 2.5 records `Design: finalized` in `state.md`.
|
|
111
114
|
- Same stage failing 3× → escalate.
|
|
112
115
|
- Each route's entry file declares the stage files every run of that route opens, and a Stop gate holds the turn until they are read. A turn that ends before its route's last stage — a readiness halt, an escalation, a pause for a background run — records why with `echo "MUGGLE_STAGE_SKIP: <reason>"`.
|
|
113
116
|
- 3 repair iterations reach E2E with failures → put the surviving failures to the user (an open decision when unattended), ship with `[E2E FAILING]`, and hand to the watcher.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `autoRouteBuildToMuggleDo`
|
|
2
2
|
|
|
3
|
-
When the user asks to build, implement, or fix something, controls whether the front-door guardrail routes the work through `/muggle-do` — the orchestrator that runs requirements → build (delegated to superpowers'
|
|
3
|
+
When the user asks to build, implement, or fix something, controls whether the front-door guardrail routes the work through `/muggle-do` — the orchestrator that runs requirements → design (user approves before any code) → build (delegated to superpowers' plan→review) → impact → unit tests → PR → E2E → watcher — or lets the request proceed however the model would otherwise handle it. Fires once per session, on the first build-intent prompt (UserPromptSubmit guardrail).
|
|
4
4
|
|
|
5
5
|
**Picker 1** — header `Route to muggle-do?`, question `"This looks like a build request — run it through /muggle-do (E2E + PR + watcher, build delegated to superpowers)?"`
|
|
6
6
|
- `Route it` — `Enter the /muggle-do pipeline.` → `always`
|
|
@@ -8,7 +8,7 @@ When a run asks its questions. Allowed values: `always` / `never` — there is n
|
|
|
8
8
|
|
|
9
9
|
1. **One up-front batch.** Before the run's first long-running step — invoking `muggle-test-prepare`, any `muggle-local-execute-*` call, a remote generation, replay or bulk dispatch, a build, or a wait on a remote workflow — ask every question the run can foresee, in `AskUserQuestion` calls sent back to back with no work between them. Foreseeable includes every gate the run will fire later that resolves to `ask` (a post-run `openTestResultsAfterRun`, `postPRVisualWalkthrough`, `autoCreatePR`, `autoWatchPR`, `suggestRelated*`), asked now and applied when its step arrives. A foreseeable `ask` gate is never defaulted in place of asking: its picker goes in the batch. A gate resolving to `always` or `never` asks nothing either way.
|
|
10
10
|
2. **Nothing after it.** Once the first long-running step starts, call no `AskUserQuestion` for the rest of the run. A question that surfaces anyway takes a best-effort default: the gate's shipped default, else the option the skill marks recommended, else the option that changes nothing outside this session. Record each as `Defaulted: <question> → <choice> (<reason>)`.
|
|
11
|
-
3. **Decisions only the user may make are never defaulted.** Merging, paying, posting publicly, deleting user data, waiving a failing test, choosing an E2E repair: ask it in the batch when it is foreseeable. When it is not, leave it open, finish every part of the run that does not depend on it, and record it as `Open: <question>`.
|
|
11
|
+
3. **Decisions only the user may make are never defaulted.** Merging, paying, posting publicly, deleting user data, waiving a failing test, choosing an E2E repair, approving a design before it is built: ask it in the batch when it is foreseeable. When it is not, leave it open, finish every part of the run that does not depend on it, and record it as `Open: <question>`.
|
|
12
12
|
4. **One-click follow-ups become report lines.** A non-blocking prompt a skill offers after a step — "did the agent miss anything on this run?", a suggestion to add related cases — is printed as a line with its one-click path (the slash command and its argument) instead of being asked.
|
|
13
13
|
5. **The final report lists them.** The run's closing message ends with a `Decisions` block: every `Defaulted:` line, then every `Open:` line, or `Decisions: none deferred`.
|
|
14
14
|
|