@muggleai/works 5.38.0 → 5.39.0-staging.360

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,604 +1,604 @@
1
- # Muggle Works
2
-
3
- **Acceptance test agent for coding agents: real-browser tests, with screenshots on the PR.**
4
-
5
- Coding agents are good at producing a diff. They are bad at knowing whether the diff works, whether it broke the login flow, and what still has to happen before a human can merge it. Muggle Works is the harness around the agent that answers those questions: it freezes requirements, delegates the design and build, runs the unit suite, drives a **real browser** through the affected user flows, opens the pull request with screenshots attached, and then keeps watching that PR — picking up review comments, red CI, and a stale base branch until the change is genuinely mergeable.
6
-
7
- [![npm](https://img.shields.io/npm/v/@muggleai/works.svg)](https://www.npmjs.com/package/@muggleai/works)
8
- [![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
9
- [![Node](https://img.shields.io/badge/node-%3E%3D22-brightgreen.svg)](https://nodejs.org)
10
- [![MCP tools](https://img.shields.io/badge/MCP%20tools-130-blue.svg)](#mcp-tool-reference)
11
-
12
- Works in Claude Code, Cursor, Codex, Windsurf, and any MCP client. Powered by [Muggle AI](https://www.muggle-ai.com).
13
-
14
- AI agents: start with [AGENTS.md](AGENTS.md) (install, sign-in, flows, skills, errors) or [llms.txt](llms.txt). `muggle serve` also serves both as MCP resources, `muggle://docs/agents` and `muggle://docs/llms`.
15
-
16
- ---
17
-
18
- ## Highlights
19
-
20
- - **One request, one pull request.** `/mdo "add a logout button"` runs requirements → design → build → impact analysis → unit tests → browser acceptance → PR. You answer one questionnaire up front, then walk away.
21
- - **A real browser under a real identity.** Not a headless stub. Every managed login profile owns a live inbox, so magic links, emailed OTPs, email 2FA, verification mail, and password resets are all testable — no mail catcher, no test-only backdoor, no `SKIP_AUTH` flag.
22
- - **GitHub and GitLab as peers.** Pull requests and merge requests, review threads and discussions, Actions and pipelines, signed commits on both. Self-hosted GitLab included — the provider is detected from the remote, not hardcoded.
23
- - **The loop keeps running after you close the laptop.** A watcher polls the PR and re-enters the cycle when a reviewer comments, CI goes red, or the branch falls behind its base. Feedback becomes commits without you relaying it.
24
- - **A gate, not a vibe.** No PR is opened until requirements are written, the build typechecks and lints, new logic carries unit tests, the suite passes, and a browser verdict is recorded — or a waiver reason is written down. Silence is not a waiver.
25
- - **Plain English in, replayable scripts out.** Describe a flow in a sentence; get a script that persists across sessions and re-runs as a regression test after every change.
26
- - **130 MCP tools** if you'd rather assemble your own pipeline than use the packaged one.
27
-
28
- ### Built for two kinds of people
29
-
30
- **If you write code for a living,** this is the discipline you'd apply yourself if you had the patience to apply it every time: frozen requirements, a Definition of Done that blocks the PR, evidence attached to the review, and a follow-up loop that doesn't forget.
31
-
32
- **If you vibe-code,** this is the part you can't easily judge by reading the diff. You don't have to know Playwright, or what a fixture is, or why the checkout page broke on mobile. Describe the feature; the harness builds it, clicks through it like a user, shows you the screenshots, and tells you what failed in English.
33
-
34
- ---
35
-
36
- ## The cycle
37
-
38
- | # | Stage | What it does | Evidence it leaves |
39
- | :- | :---- | :----------- | :----------------- |
40
- | 1 | Pre-flight | Detects repo, branch, dev server, project, credentials; asks everything it can't detect in **one** turn | `state.md` |
41
- | 2 | Requirements | Freezes goal and acceptance criteria before a line is written | `requirements.md` |
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 |
44
- | 4 | Impact analysis | Maps the diff to the user flows it can break | Affected-flow list |
45
- | 5 | Unit tests | Runs the suite authored in stage 3 | Exit code |
46
- | 5.5 | Pull request | Opens the PR/MR before the browser run, its walkthrough check red until stage 7 | PR URL |
47
- | 6 | Acceptance | Drives a real browser through the affected flows, its progress showing on the PR | Verdict + `runId` + per-step screenshots |
48
- | 7 | Walkthrough | Settles the PR's walkthrough comment with the run's evidence | Walkthrough comment |
49
- | 7.5 | Repair | Investigates and fixes acceptance failures, up to 3 iterations | Repair log |
50
- | 8 | Watcher | Polls reviews, CI, and base-branch drift; re-enters the cycle on each | `followup.log` |
51
-
52
- Stage 5.5 refuses to open the PR until build and unit tests meet the Definition of Done, and stage 7 refuses to settle its walkthrough without an E2E verdict. Stage 8 is dispatched only once stage 7.5 clears — a cycle with unrepaired failures never reaches a watcher.
53
-
54
- ---
55
-
56
- ## Quick start
57
-
58
- ### 1. Install
59
-
60
- **Claude Code** — full plugin: skills, MCP tools, and the browser runner.
61
-
62
- ```
63
- /plugin marketplace add multiplex-ai/muggle-ai-works
64
- /plugin install muggleai@muggle-works
65
- ```
66
-
67
- The marketplace is `muggle-works` and its entry is `muggleai`; the installed plugin is named `muggle`, so its skills appear as `/muggle:<skill>`.
68
-
69
- **Cursor** — `npm install -g @muggleai/works`. The postinstall writes `~/.cursor/mcp.json` and syncs the `muggle-*` skills into `~/.cursor/skills/`. Restart Cursor.
70
-
71
- **Codex** — full plugin: skills, MCP tools, and the guardrail hooks.
72
-
73
- ```
74
- codex plugin marketplace add multiplex-ai/muggle-ai-works
75
- codex plugin add muggle@muggle-works
76
- ```
77
-
78
- Restart Codex and trust the plugin's hooks when it asks (or later, in `/hooks`). Skills are invoked as `$muggle:<skill>` — `$muggle:muggle-do`, `$muggle:muggle-test` — or picked from `/skills`. See [Codex](#codex) for what differs.
79
-
80
- **Windsurf, any other MCP client** — install the package as above, then register the server:
81
-
82
- ```json
83
- {
84
- "mcpServers": {
85
- "muggle": {
86
- "command": "muggle",
87
- "args": ["serve"],
88
- "env": {
89
- "MUGGLE_MCP_PROMPT_SERVICE_TARGET": "production"
90
- }
91
- }
92
- }
93
- }
94
- ```
95
-
96
- ### 2. Set up
97
-
98
- ```bash
99
- muggle init
100
- ```
101
-
102
- Explains how the harness works, saves your preferences, and offers to install the pull-request walkthrough check. Then confirm the install is healthy:
103
-
104
- ```
105
- /mstatus # Claude Code
106
- $muggle:muggle-status # Codex
107
- muggle doctor # anywhere — also checks the Codex plugin or MCP entry
108
- ```
109
-
110
- Broken? `/mrepair`, or `muggle setup --force`.
111
-
112
- ### 3. Build something
113
-
114
- ```
115
- /mdo "Add a logout button to the header"
116
- ```
117
-
118
- ```
119
- PRE-FLIGHT → repo: frontend · branch: users/me/logout-button · target: localhost:3000
120
- REQUIREMENTS → Goal: logout button in header. AC: visible, ends session, redirects to /login.
121
- BUILD → src/components/Header.tsx, src/hooks/useLogout.ts (+ unit tests)
122
- IMPACT → affects "User Login" and "Session" flows
123
- UNIT TESTS → 12/12 pass
124
- ACCEPTANCE → 3/3 test cases pass · runId a1b2c3 · 14 screenshots
125
- PULL REQUEST → #42 opened, walkthrough posted
126
- WATCHER → armed on #42
127
- ```
128
-
129
- Authentication starts on the first protected call: a browser opens with a verification code, you sign in, and the call continues. Credentials persist in `~/.muggle-ai/`.
130
-
131
- ---
132
-
133
- ## Commands
134
-
135
- Every skill has a short alias. Both spellings work in Claude Code. In Codex, mention the skill with `$`: `$muggle:muggle-do`, or the alias `$muggle:mdo`.
136
-
137
- | Command | Alias | What it does |
138
- | :------ | :---- | :----------- |
139
- | `/muggle:muggle` | `/m` | Command router and menu |
140
- | `/muggle:muggle-do` | `/mdo` | The full cycle: request → pull request |
141
- | `/muggle:muggle-test` | `/mtest` | Change-driven acceptance testing on your diff, PR, or branch |
142
- | `/muggle:muggle-test-feature-local` | `/mtestlocal` | Test one named flow against localhost |
143
- | `/muggle:muggle-test-prepare` | `/mtestprep` | Verify and start the dev servers a run needs |
144
- | `/muggle:muggle-test-import` | `/mimport` | Import Playwright, Cypress, Gherkin, or PRDs |
145
- | `/muggle:muggle-test-regenerate-missing` | `/mregen` | Bulk-regenerate scripts for cases that have none |
146
- | `/muggle:muggle-browser-task` | `/mbt` | Perform a real action on a website from plain English |
147
- | `/muggle:muggle-pr-visual-walkthrough` | `/mpr` | Post screenshots and a pass/fail summary to a PR |
148
- | `/muggle:muggle-pr-followup` | `/mprfollowup` | Watch a PR's reviews, CI, and base drift |
149
- | `/muggle:muggle-feedback` | `/mfeedback` | Flag a generated script or step as wrong |
150
- | `/muggle:muggle-bug-report` | `/mbugreport` | Report a bug in Muggle AI and follow the ticket |
151
- | `/muggle:muggle-taste-profile` | `/mtaste` | Build, view, upload, or clear your taste profile |
152
- | `/muggle:muggle-preferences` | `/mprefs` | View, set, or reset preferences |
153
- | `/muggle:muggle-status` | `/mstatus` | Health check: runner, MCP server, auth |
154
- | `/muggle:muggle-repair` | `/mrepair` | Diagnose and fix a broken install |
155
- | `/muggle:muggle-upgrade` | `/mupgrade` | Update to the latest version |
156
- | `/muggle:muggle-init` | `/minit` | Run the onboarding walkthrough |
157
- | `/muggle:muggle-ci-install` | `/mci` | Add the walkthrough check to GitHub Actions |
158
- | `/muggle:muggle-login` | `/mlogin` | Sign in, or switch accounts |
159
- | `/muggle:muggle-logout` | `/mlogout` | Sign out |
160
- | `/muggle:muggle-run-view` | `/mrun` | View a local run's steps and frames |
161
- | `/muggle:muggle-cleanup` | `/mcleanup` | Remove old runner versions |
162
- | `/muggle:muggle-register` | `/mregister` | Create a new account from the terminal |
163
-
164
- ---
165
-
166
- ## GitHub and GitLab
167
-
168
- The harness resolves one provider token — `github` or `gitlab` — from the URL you passed or the `origin` remote, then picks the matching recipe set. GitHub goes through `gh`, GitLab through `glab`. Self-hosted GitLab resolves by matching the remote host against `glab`'s configured host, so `git.acme.com` works without configuration.
169
-
170
- | Capability | GitHub | GitLab |
171
- | :--------- | :----- | :----- |
172
- | Open and update the change | Pull request | Merge request |
173
- | Read review feedback | Review threads + line comments | Discussions + notes |
174
- | Reply per comment, resolve threads | Yes | Yes |
175
- | Read CI status and re-enter on red | Actions | Pipelines |
176
- | Rebase onto a drifted base | Yes | Yes |
177
- | Signed commits | Yes | Yes |
178
-
179
- Nested GitLab namespaces of any depth are handled — the project path is everything before the `/-/` segment, never assumed to be two levels.
180
-
181
- ### The pull-request walkthrough check
182
-
183
- When a PR is opened from a session running this plugin, Muggle reserves a comment for the acceptance walkthrough and holds the turn open until it's settled. The comment moves through three stages, edited in place: **waiting for the E2E feasibility check**; then **E2E running — waiting for the report** or **E2E not feasible** with the reason; then the E2E report. A PR that changes only docs, tests, lint/format config, or CI config opens straight at its reason. A session that ends without a run or a reason leaves the comment at the stage it reached, and the check stays unsettled.
184
-
185
- A PR opened any other way — the web UI, a teammate without the plugin — never passes through that session, so the same check also runs in GitHub Actions. It fails while the comment is still empty, and whenever the walkthrough reports a failed or inconclusive test case; the check's summary names each one with its failing step and a link to the run. While a new E2E run is underway on the PR, the check stays in progress until that run's walkthrough replaces the previous one. When the Muggle PR watcher sees it red, it repairs the cases, re-runs the whole suite, and re-settles the comment.
186
-
187
- The `autoInstallCiWorkflow` preference, chosen during `muggle init`, decides whether Muggle adds the workflow itself: `always` installs it in the repository `muggle init` runs in and in any repository `/muggle-do` opens a PR from, `ask` (the default) asks first, `never` leaves CI alone. To add it to a repository by hand:
188
-
189
- ```bash
190
- muggle ci-install
191
- ```
192
-
193
- That writes `.github/workflows/muggle-walkthrough.yml`. Run again later, it replaces a copy an earlier release wrote with the current one, and leaves a copy you edited alone unless you pass `--force`; `muggle init` and `/muggle-do` do the same refresh on their own unless `autoInstallCiWorkflow` is `never`. To add it by hand instead:
194
-
195
- <!-- muggle:ci-workflow-snippet -->
196
- ```yaml
197
- name: muggle-walkthrough
198
-
199
- on:
200
- pull_request:
201
- types: [opened, synchronize, reopened, ready_for_review]
202
- issue_comment:
203
- types: [created, edited]
204
-
205
- permissions:
206
- contents: read
207
- checks: write
208
- pull-requests: write
209
-
210
- concurrency:
211
- group: muggle-walkthrough-${{ github.event.pull_request.number || github.event.issue.number }}
212
- cancel-in-progress: false
213
-
214
- jobs:
215
- walkthrough-comment:
216
- if: github.event_name == 'pull_request' || github.event.issue.pull_request
217
- runs-on: ubuntu-latest
218
- steps:
219
- - name: Check the walkthrough comment
220
- env:
221
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
222
- run: npx -y -p @muggleai/works muggle pr-walkthrough-check --check-run
223
- ```
224
- <!-- /muggle:ci-workflow-snippet -->
225
-
226
- Four things worth knowing:
227
-
228
- - The verdict is published as a check run against the pull request's head commit, not as this job's own status. An `issue_comment` run executes against the default branch, and only a head-commit check reaches the pull request from there — which is what lets settling the comment turn the check green without a new push.
229
- - GitHub reads the `issue_comment` trigger from the **default branch's** copy of the workflow, so comment-driven re-runs start working only once it is merged.
230
- - Runs for one pull request queue rather than cancel. Settling the comment starts a run while the one checking the push may still be going, and cancelling that run would leave a cancelled job on the pull request — red beside a green check. An installed copy that still says `cancel-in-progress: true` shows exactly that; `muggle ci-install` updates it.
231
- - On a pull request from a fork, `GITHUB_TOKEN` is read-only and the check run cannot be published. The command fails open and reports nothing rather than blocking the pull request.
232
-
233
- ---
234
-
235
- ## Architecture
236
-
237
- Test management lives in the cloud; execution is local and stateless. `muggle-remote-*` tools own projects, use cases, test cases, and scripts. `muggle-local-*` tools receive what they need and run the browser — so a local run never waits on cloud replay capacity.
238
-
239
- ### Entity model
240
-
241
- ```
242
- Project ("My App")
243
- └── Use Case ("User Login Flow")
244
- └── Test Case ("Login with valid credentials")
245
- └── Test Script (recorded browser steps)
246
- └── Run Result (pass/fail + screenshots)
247
- ```
248
-
249
- ### Execution flow
250
-
251
- ```
252
- Your agent describes what to test
253
- │
254
- ▼
255
- muggle-remote-* create or find the test cases
256
- │
257
- ▼
258
- muggle-local-execute-test-generation launches the browser runner
259
- │
260
- ▼
261
- An agent drives the browser step by step (click, type, navigate, assert)
262
- │
263
- ▼
264
- Per-step screenshots → action-script.json recorded
265
- │
266
- ▼
267
- Results at ~/.muggle-ai/sessions/{runId}/ — published during the run,
268
- so the result carries a viewUrl straight to the dashboard
269
- ```
270
-
271
- ### Data directory
272
-
273
- ```
274
- ~/.muggle-ai/
275
- ├── oauth-session.json # OAuth tokens (short-lived, auto-refresh)
276
- ├── api-key.json # Long-lived key for service calls
277
- ├── projects/ # Local project cache
278
- ├── sessions/ # Run sessions — read one with `muggle run-view [runId]`
279
- │ └── {runId}/
280
- │ ├── action-script.json # Recorded browser steps
281
- │ ├── results.md # Step-by-step report
282
- │ └── electron-runtime/screenshot/ # Per-step images
283
- ├── muggle-do/sessions/ # Cycle state, iterations, PR watchers
284
- └── electron-app/{version}/
285
- ```
286
-
287
- ---
288
-
289
- ## MCP tool reference
290
-
291
- 130 tools across authentication, projects, use cases, test cases, test states, scripts, workflows, local execution, reporting, secrets, pricing, billing, and administration. Call them directly from any MCP client to build your own pipeline.
292
-
293
- **Authentication** — `muggle-remote-auth-status`, `-login`, `-poll`, `-logout`, `-register` (create an account from an email and password, no browser), plus `-api-key-create`, `-list`, `-get`, `-revoke`.
294
-
295
- **Projects** — `muggle-remote-organization-list` names the organizations an `organizationId` can make a project belong to. `muggle-remote-project-create`, `-list`, `-get`, `-update`, `-delete`, plus per-project rollups: `-test-results-summary-get`, `-test-runs-summary-get`, `-test-scripts-summary-get`. Pass `primaryResolution`, `compatibleResolutions` and `runStrategy` (`primaryOnly`, the default, `primaryFirst` or `allAtOnce`) to `-create` or `-update` to verify every test case at more than one viewport; `muggle-remote-project-display-resolutions-get` reads a lane's primary, compatible and enabled resolutions and its run strategy.
296
-
297
- | Use cases | Purpose |
298
- | :-------- | :------ |
299
- | `muggle-remote-use-case-list` / `-get` | Read use cases |
300
- | `muggle-remote-use-case-create` / `-update` | Persist a fully-specified use case (no LLM) |
301
- | `muggle-remote-use-case-create-from-prompts` | Create from natural language |
302
- | `muggle-remote-use-case-prompt-preview` | Preview before creating |
303
- | `muggle-remote-use-case-update-from-prompt` | Regenerate from a new prompt |
304
- | `muggle-remote-use-case-discovery-memory-get` | Candidates a site scan discovered |
305
- | `muggle-remote-use-case-candidates-approve` | Approve discovered candidates |
306
- | `muggle-remote-use-case-bulk-preview-submit` | Async batch preview (~50% cheaper) |
307
- | `muggle-remote-use-case-delete` | Delete (cascades to test cases + scripts) |
308
-
309
- | Test cases | Purpose |
310
- | :--------- | :------ |
311
- | `muggle-remote-test-case-list` / `-list-by-use-case` / `-get` | Read test cases |
312
- | `muggle-remote-test-case-create` / `-update` / `-delete` | Manage test cases |
313
- | `muggle-remote-test-case-generate-from-prompt` | Generate from a prompt |
314
- | `muggle-remote-test-case-ancestors-get` | Walk prerequisite chains |
315
- | `muggle-remote-run-settings-list` | A test case's runSettings records in one lane |
316
- | `muggle-remote-test-case-display-resolutions-get` | The resolutions a test case runs at in one lane, primary first |
317
- | `muggle-remote-test-case-display-resolutions-update` | Set the resolutions a test case is generated and run at in one lane |
318
- | `muggle-remote-fan-out-plan` | A lane's records in start order, and whether the rest wait on the primary |
319
- | `muggle-remote-test-case-bulk-preview-submit` | Async batch preview (~50% cheaper) |
320
- | `muggle-remote-test-plan-graph-rebuild` | Rebuild the prerequisite graph |
321
-
322
- | Test states | Purpose |
323
- | :---------- | :------ |
324
- | `muggle-remote-test-chaining-catalog-get` / `-settings-update` | Read a project's states and roles; set its fresh account set state and parallel account set limit |
325
- | `muggle-remote-test-state-create` / `-update` / `-delete` | Manage states: facts about one account set's data, plus a check |
326
- | `muggle-remote-test-role-create` / `-update` / `-delete` | Manage roles: created or supplied accounts a test acts as |
327
- | `muggle-remote-test-chaining-plan-get` | Preview the account set plan without running anything |
328
-
329
- Bulk-preview submissions return a `jobId` immediately. Poll `muggle-remote-bulk-preview-job-get` until terminal, then persist with the matching `-create` tool. `-list` and `-cancel` round out the set.
330
-
331
- | Scripts and workflows | Purpose |
332
- | :-------------------- | :------ |
333
- | `muggle-remote-test-script-list` / `-get` / `-delete` | Manage test scripts |
334
- | `muggle-remote-action-script-get` / `-delete` | Manage recorded action scripts |
335
- | `muggle-remote-workflow-start-website-scan` | Scan a site for use cases |
336
- | `muggle-remote-workflow-start-test-case-detection` | Generate test cases |
337
- | `muggle-remote-workflow-start-test-script-generation` | Generate a script |
338
- | `muggle-remote-workflow-start-test-script-generation-bulk` | Generate in bulk |
339
- | `muggle-remote-workflow-start-test-script-replay` | Replay one script |
340
- | `muggle-remote-workflow-start-test-script-replay-bulk` | Batch replay |
341
- | `muggle-remote-workflow-start-prd-file-process` | Turn an uploaded requirements doc into use cases |
342
- | `muggle-remote-workflow-cancel-run` / `-cancel-runtime` | Cancel in flight |
343
- | `muggle-remote-workflow-get-website-scan-latest-run`, `muggle-remote-wf-get-*` | Poll the latest run of each workflow type |
344
- | `muggle-remote-workflow-list-website-scan-runtimes`, `muggle-remote-wf-list-*` | List a workflow type's runtimes |
345
-
346
- | Local execution | Purpose |
347
- | :-------------- | :------ |
348
- | `muggle-local-check-status` | Browser runner status |
349
- | `muggle-local-list-sessions` | Stored local run sessions |
350
- | `muggle-local-execute-test-generation` | Generate a script by driving the browser |
351
- | `muggle-local-execute-replay` | Replay an existing script |
352
- | `muggle-local-cancel-execution` | Cancel the active run |
353
- | `muggle-local-run-result-list` / `-get` | Results, screenshots, and cloud refs (`viewUrl`) |
354
- | `muggle-local-run-steps-get` | A run's ordered steps beside the frame each produced |
355
- | `muggle-local-test-script-list` / `-get` | Read locally cached scripts |
356
- | `muggle-local-last-host-*` / `-last-project-*` | Remember the host and project between runs |
357
- | `muggle-local-preferences-set` | Set harness preferences |
358
- | `muggle-local-telemetry-skill-emit` / `-event-emit` | Usage telemetry the skills record |
359
- | `muggle-remote-local-run-upload` | Publish a local run to the cloud |
360
-
361
- **Pricing and billing** — `muggle-remote-pricing-get` reads the live plans, token price and token packages without sign-in. `muggle-remote-wallet-package-list` lists the packages the signed-in user can buy, with the `packageId` that `muggle-remote-wallet-topup` and `-wallet-auto-topup-update` take.
362
-
363
- **Reporting** — `muggle-remote-report-stats-summary-get`, `-cost-query`, `-final-generate` (PDF/HTML/Markdown), `-preferences-upsert`.
364
-
365
- **Administration** — `muggle-remote-prd-file-*` (upload, list and delete requirements docs), `muggle-remote-secret-*` (credentials for test environments, with `-secret-group-*` and `-secret-type-list`), `muggle-remote-wallet-*` (top-ups, payment methods, auto-topup), `muggle-remote-recommend-cicd-setup` / `-recommend-schedule`, `muggle-remote-user-feedback-*`, `muggle-remote-bug-report-*` (file, list, read and reply to bug reports about Muggle AI, with `muggle-local-bug-report-context-get` gathering the harness context they carry), `muggle-remote-taste-profile-*` (upload, get and delete the taste profile, kept locally by `muggle-local-taste-signal-*` and `muggle-local-taste-profile-*`).
366
-
367
- **Resources** — `muggle://docs/agents` ([AGENTS.md](AGENTS.md)) and `muggle://docs/llms` ([llms.txt](llms.txt)), read from the installed package through `resources/list` and `resources/read`.
368
-
369
- ---
370
-
371
- ## CLI reference
372
-
373
- ```bash
374
- # Server
375
- muggle serve # Start the MCP server with all tools
376
- muggle serve --e2e # Cloud tools only (muggle-remote-*)
377
- muggle serve --local # Local tools only (muggle-local-*)
378
-
379
- # Setup and diagnostics
380
- muggle init [--json | --apply <file>] # Guided setup; saves preferences, offers the CI check
381
- muggle llm-source [--show] # Who supplies the model for local runs: Muggle AI credit, your Anthropic key, a local model, or your Claude Code
382
- muggle llm-source --use <source> [--base-url <url> --model <name>] # Set it without prompting
383
- muggle setup [--force] # Download or update the browser runner
384
- muggle upgrade [--check | --version <v>] [--force] # Install the latest (or a given) runner version
385
- muggle versions # List installed runner versions
386
- muggle cleanup [--dry-run] [--all] [--skills] # Remove old versions and obsolete skills
387
- muggle doctor # Diagnose installation problems
388
-
389
- # Inspecting runs
390
- muggle run-view [runId] # A run's steps beside the frames they produced (newest run by default)
391
- muggle run-view --html [--out-dir <dir>] # Render those frames as a self-contained page
392
- muggle run-view --open # Render it and open it in the browser
393
- muggle checkout-freshness [--base <branch>] [--no-fetch] # Fetch the base and check this checkout is built on its latest commit
394
-
395
- # Authentication
396
- muggle login [--key-name <name>] [--key-expiry 30d|90d|1y|never]
397
- muggle logout
398
- muggle status
399
-
400
- # Pricing
401
- muggle pricing [--json] # Plans, token price and token packages from the live catalog
402
-
403
- # Pull requests
404
- muggle ci-install [--force] # Add or update the walkthrough check in GitHub Actions
405
- muggle pr-walkthrough-check [--pr <n>] [--check-run] # Verify a PR's walkthrough comment is settled
406
- muggle build-pr-section [--base <branch>] # Render a PR evidence block from a report on stdin
407
- muggle e2e-plan [--pr <url>] # Post the test cases a local run is about to execute (JSON on stdin) to the walkthrough
408
-
409
- # Shared local services, between agents in different checkouts
410
- muggle stack claim [--wait <seconds>] # Claim the ports this checkout's E2E run needs
411
- muggle stack check [--port <port>] # Confirm the stack still serves this checkout's claim
412
- muggle stack release # Give up the lease and place in line
413
- muggle stack status # Every lease, the line, and tracked services
414
-
415
- # Session and PR-watcher supervision
416
- muggle watch install [--uninstall] # Schedule the watch with the OS scheduler
417
- muggle watch tick # Run one watch pass
418
- muggle watch status # Last pass: sessions, processes, PR watches, findings
419
- muggle watch reload-plugins [--dry-run] # Reload plugins across active Claude sessions
420
- muggle watch register --slot <dir> # Opt a PR-watch slot into out-of-session recovery
421
- muggle watch unregister --slot <dir> # Withdraw it
422
-
423
- muggle --version
424
- muggle --help
425
- ```
426
-
427
- ---
428
-
429
- ## Configuration
430
-
431
- **Environment targeting.** Set `MUGGLE_MCP_PROMPT_SERVICE_TARGET` (`production` or `dev`) in the MCP server's `env` block — in Codex, export it in your shell; the plugin forwards it. Mismatching it against the account you log in with is the usual cause of `unauthorized_client`.
432
-
433
- **Multi-repo cycles.** Drop a `muggle-repos.json` in your working directory so a single request can span services:
434
-
435
- ```json
436
- [
437
- { "name": "frontend", "path": "/absolute/path/to/frontend", "testCommand": "pnpm test" },
438
- { "name": "backend", "path": "/absolute/path/to/backend", "testCommand": "pnpm test" }
439
- ]
440
- ```
441
-
442
- **Preferences.** `/mprefs` (or `muggle init`) controls the gates — whether to use a worktree, rebase onto the base branch, run acceptance tests every cycle, open the PR automatically, and arm the watcher. Each gate takes `always`, `ask`, or `never`.
443
-
444
- When installed as a Claude Code plugin, MCP configuration ships with the plugin (`plugin/.mcp.json`; Codex reads `plugin/.codex-mcp.json`) — there is nothing to copy by hand.
445
-
446
- ---
447
-
448
- ## Client support
449
-
450
- | Client | MCP tools | Skills | Guardrail hooks |
451
- | :----- | :-------- | :----- | :-------------- |
452
- | **Claude Code** | Yes | Yes — slash commands | Yes |
453
- | **Codex** | Yes | Yes — `$muggle:<skill>` | Yes, once trusted |
454
- | **Cursor** | Yes, auto-configured | Synced to `~/.cursor/skills/` | Advisory |
455
- | **Windsurf, others** | Yes, via MCP config | No | No |
456
-
457
- Slash commands are plugin-managed; update them with `/plugin update muggleai@muggle-works` (Claude Code) or `codex plugin marketplace upgrade muggle-works` (Codex).
458
-
459
- ### Codex
460
-
461
- The Codex plugin ships the same skills, MCP server, and hooks as the Claude Code one, with what Codex needs written in rather than left to defaults:
462
-
463
- - **Long local runs.** Codex cancels an MCP call after 60 seconds unless told otherwise, and a local browser run takes minutes. The plugin's server allows 30 minutes per call and two minutes to start.
464
- - **Your environment.** Codex starts MCP servers with only `HOME`, `PATH` and the locale. The plugin forwards what the server reads — `MUGGLE_MCP_PROMPT_SERVICE_TARGET`, the `AUTH0_*` and service-URL overrides, `HTTPS_PROXY`/`NO_PROXY`, and on Linux the display variables the browser runner needs.
465
- - **Claude Code tools in the skills.** Codex has no `AskUserQuestion`, `Skill` tool, or background monitor. Each skill points at [`_shared/host-tool-equivalents.md`](plugin/skills/_shared/host-tool-equivalents.md), which maps them to Codex, and the session-start hook names it too.
466
- - **PR watching.** Codex cannot wake a session when a reviewer comments, so `$muggle:muggle-pr-followup` handles what is outstanding each time you run it rather than watching in the background.
467
- - **Sandbox.** Codex's default sandbox blocks the network and writes outside the workspace, so `gh`/`glab` and state under `~/.muggle-ai/` ask for approval. To stop the prompts, allow both in `~/.codex/config.toml`:
468
-
469
- ```toml
470
- [sandbox_workspace_write]
471
- network_access = true
472
- writable_roots = ["/absolute/path/to/home/.muggle-ai"]
473
- ```
474
- - **Headless runs.** `codex exec` cannot ask you anything. It refuses every muggle MCP call ("requires approval, but approval policy is never"), and it runs only hooks you have already trusted. Trust the hooks once in the TUI (`/hooks`), and approve the muggle tools in `~/.codex/config.toml`:
475
-
476
- ```toml
477
- [plugins."muggle@muggle-works".mcp_servers.muggle]
478
- default_tools_approval_mode = "approve"
479
- ```
480
-
481
- `--dangerously-bypass-hook-trust` skips the trust step for one run. It is meant for automation that already vets hook sources.
482
-
483
- Registering only the MCP server, without the plugin? Keep the timeout, or local runs are cut off at a minute:
484
-
485
- ```toml
486
- [mcp_servers.muggle]
487
- command = "muggle"
488
- args = ["serve"]
489
- tool_timeout_sec = 1800
490
- startup_timeout_sec = 120
491
- env_vars = ["MUGGLE_MCP_PROMPT_SERVICE_TARGET"]
492
- ```
493
-
494
- `muggle doctor` checks whichever of the two you set up.
495
-
496
- ---
497
-
498
- ## Troubleshooting
499
-
500
- **`unauthorized_client` during login** — the MCP server is pointed at one environment and you're authenticating against another. Fix `MUGGLE_MCP_PROMPT_SERVICE_TARGET` and restart the client.
501
-
502
- **Browser runner not found**
503
-
504
- ```bash
505
- muggle setup --force
506
- muggle doctor
507
- ```
508
-
509
- **Authentication keeps expiring**
510
-
511
- ```bash
512
- muggle logout
513
- rm ~/.muggle-ai/oauth-session.json ~/.muggle-ai/api-key.json
514
- muggle login
515
- ```
516
-
517
- ---
518
-
519
- ## The ecosystem
520
-
521
- | Package | Purpose | Install |
522
- | :------ | :------ | :------ |
523
- | **Muggle Works** (this repo) | Delivery-cycle harness, MCP server, acceptance testing | `/plugin install muggleai@muggle-works` · `codex plugin add muggle@muggle-works` |
524
- | **[muggle-ai-teams](https://github.com/multiplex-ai/muggle-ai-teams)** | Agent orchestration, workflow steps, rules | `npm install @muggleai/teams` |
525
-
526
- With both installed, muggle-ai-teams folds acceptance testing into each workflow step: test instructions written per slice at **Plan**, per-slice browser tests at **Build**, a full regression sweep at **Verify**, and results published and linked in the PR at **Ship**. Frontend slices get browser tests; backend-only slices are covered by unit tests, with the skip reasoned in writing.
527
-
528
- Want it hosted, with nothing to configure? [Muggle AI](https://www.muggle-ai.com).
529
-
530
- ---
531
-
532
- ## Contributing
533
-
534
- ```bash
535
- pnpm install # This repo is pnpm-only
536
- pnpm run build # tsup + plugin artifact
537
- pnpm test # Tests impacted since origin/master, on 25% of cores (full suite in CI; MUGGLE_VITEST_FULL=1 forces it locally)
538
- pnpm run lint # Lint (auto-fix)
539
- pnpm run typecheck # Type check
540
- pnpm run dev # Watch mode
541
- ```
542
-
543
- Verification gates, all run in CI:
544
-
545
- ```bash
546
- pnpm run verify:plugin # Plugin and marketplace metadata agree
547
- pnpm run verify:contracts # CLI/MCP/plugin/skill surface contracts hold
548
- pnpm run verify:skill-deps # Skill dependencies stay one-way
549
- pnpm run verify:signatures # Shipped artifacts are signed
550
- pnpm run verify:upgrade-experience # Existing-user upgrade still works
551
- pnpm run verify:electron-release-checksums
552
- ```
553
-
554
- Codex has its own layers, from static contracts up to model-driven evals. See [docs/compatibility-strategy.md](docs/compatibility-strategy.md#codex):
555
-
556
- ```bash
557
- CODEX_BIN=$(command -v codex) pnpm run test:codex # The plugin under the real Codex CLI, against a scripted model
558
- ```
559
-
560
- ### Repository layout
561
-
562
- ```
563
- muggle-ai-works/
564
- ├── plugin/ # Claude Code, Codex and Cursor plugin — source of truth
565
- │ ├── skills/ # Skill definitions (muggle-do, muggle-test, _shared/vcs, …)
566
- │ ├── hooks/ # Session hooks (codex-hooks.json is generated from hooks.json)
567
- │ ├── .mcp.json # MCP server config
568
- │ ├── .codex-mcp.json # The same server, with Codex's timeouts and env passthrough
569
- │ └── .codex-plugin/ # Codex manifest
570
- ├── src/
571
- │ ├── cli/ # CLI entrypoint
572
- │ └── server/ # MCP server — tool registration, stdio transport
573
- ├── packages/
574
- │ ├── mcps/ # Tool registries, schemas, services
575
- │ ├── commands/ # CLI command contracts
576
- │ └── workflows/ # Workflow contracts
577
- ├── scripts/ # Build, verification, postinstall
578
- ├── config/compatibility/ # Surface contract baselines
579
- ├── internal/ # Maintainer-only skills (not published)
580
- ├── .claude-plugin/ # Marketplace catalog (Claude Code)
581
- └── .agents/plugins/ # Marketplace catalog (Codex)
582
- ```
583
-
584
- ### Releases
585
-
586
- | Workflow | Trigger | What it does |
587
- | :------- | :------ | :----------- |
588
- | `ci.yml` | Push/PR to `master` | Lint, test, build, contract verification across platforms |
589
- | `verify-end-user-upgrade.yml` | Weekly + manual | Existing-user upgrade validation |
590
- | `publish-works-to-npm.yml` | Tag `v*` or manual | Verify, audit, smoke-install, publish |
591
-
592
- Two independent tag tracks: `vX.Y.Z` publishes `@muggleai/works` to npm; `electron-app-vX.Y.Z` publishes browser-runner binaries consumed by `muggle setup` and `muggle upgrade`.
593
-
594
- Maintainers cut releases with the repo-local `/mrelease` skill rather than tagging by hand — CI can otherwise publish a version that disagrees with the checked-in manifests.
595
-
596
- Agents pick tools by reading descriptions, so that text is tuned deliberately rather than written once. `internal/skills/optimize-descriptions/SKILL.md` documents the five layers of agent-facing text, where each lives, and how to build and run trigger eval sets against them. It is maintainer-only and ships in neither the npm package nor the plugin.
597
-
598
- ---
599
-
600
- ## License
601
-
602
- [Apache 2.0](LICENSE). Use it, fork it, make it yours.
603
-
604
- If it saves you a bad merge, a star helps others find it.
1
+ # Muggle Works
2
+
3
+ **Acceptance test agent for coding agents: real-browser tests, with screenshots on the PR.**
4
+
5
+ Coding agents are good at producing a diff. They are bad at knowing whether the diff works, whether it broke the login flow, and what still has to happen before a human can merge it. Muggle Works is the harness around the agent that answers those questions: it freezes requirements, delegates the design and build, runs the unit suite, drives a **real browser** through the affected user flows, opens the pull request with screenshots attached, and then keeps watching that PR — picking up review comments, red CI, and a stale base branch until the change is genuinely mergeable.
6
+
7
+ [![npm](https://img.shields.io/npm/v/@muggleai/works.svg)](https://www.npmjs.com/package/@muggleai/works)
8
+ [![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](LICENSE)
9
+ [![Node](https://img.shields.io/badge/node-%3E%3D22-brightgreen.svg)](https://nodejs.org)
10
+ [![MCP tools](https://img.shields.io/badge/MCP%20tools-130-blue.svg)](#mcp-tool-reference)
11
+
12
+ Works in Claude Code, Cursor, Codex, Windsurf, and any MCP client. Powered by [Muggle AI](https://www.muggle-ai.com).
13
+
14
+ AI agents: start with [AGENTS.md](AGENTS.md) (install, sign-in, flows, skills, errors) or [llms.txt](llms.txt). `muggle serve` also serves both as MCP resources, `muggle://docs/agents` and `muggle://docs/llms`.
15
+
16
+ ---
17
+
18
+ ## Highlights
19
+
20
+ - **One request, one pull request.** `/mdo "add a logout button"` runs requirements → design → build → impact analysis → unit tests → browser acceptance → PR. You answer one questionnaire up front, then walk away.
21
+ - **A real browser under a real identity.** Not a headless stub. Every managed login profile owns a live inbox, so magic links, emailed OTPs, email 2FA, verification mail, and password resets are all testable — no mail catcher, no test-only backdoor, no `SKIP_AUTH` flag.
22
+ - **GitHub and GitLab as peers.** Pull requests and merge requests, review threads and discussions, Actions and pipelines, signed commits on both. Self-hosted GitLab included — the provider is detected from the remote, not hardcoded.
23
+ - **The loop keeps running after you close the laptop.** A watcher polls the PR and re-enters the cycle when a reviewer comments, CI goes red, or the branch falls behind its base. Feedback becomes commits without you relaying it.
24
+ - **A gate, not a vibe.** No PR is opened until requirements are written, the build typechecks and lints, new logic carries unit tests, the suite passes, and a browser verdict is recorded — or a waiver reason is written down. Silence is not a waiver.
25
+ - **Plain English in, replayable scripts out.** Describe a flow in a sentence; get a script that persists across sessions and re-runs as a regression test after every change.
26
+ - **130 MCP tools** if you'd rather assemble your own pipeline than use the packaged one.
27
+
28
+ ### Built for two kinds of people
29
+
30
+ **If you write code for a living,** this is the discipline you'd apply yourself if you had the patience to apply it every time: frozen requirements, a Definition of Done that blocks the PR, evidence attached to the review, and a follow-up loop that doesn't forget.
31
+
32
+ **If you vibe-code,** this is the part you can't easily judge by reading the diff. You don't have to know Playwright, or what a fixture is, or why the checkout page broke on mobile. Describe the feature; the harness builds it, clicks through it like a user, shows you the screenshots, and tells you what failed in English.
33
+
34
+ ---
35
+
36
+ ## The cycle
37
+
38
+ | # | Stage | What it does | Evidence it leaves |
39
+ | :- | :---- | :----------- | :----------------- |
40
+ | 1 | Pre-flight | Detects repo, branch, dev server, project, credentials; asks everything it can't detect in **one** turn | `state.md` |
41
+ | 2 | Requirements | Freezes goal and acceptance criteria before a line is written | `requirements.md` |
42
+ | 2.5 | Design | Opens a `[DESIGN]` PR with the spec — merging it approves the design and starts the build; no code before it | Design PR |
43
+ | 3 | Build | Builds the approved design through a plan → subagent build, then commits (signed) | Conventional commits |
44
+ | 4 | Impact analysis | Maps the diff to the user flows it can break | Affected-flow list |
45
+ | 5 | Unit tests | Runs the suite authored in stage 3 | Exit code |
46
+ | 5.5 | Pull request | Opens the PR/MR before the browser run, its walkthrough check red until stage 7 | PR URL |
47
+ | 6 | Acceptance | Drives a real browser through the affected flows, its progress showing on the PR | Verdict + `runId` + per-step screenshots |
48
+ | 7 | Walkthrough | Settles the PR's walkthrough comment with the run's evidence | Walkthrough comment |
49
+ | 7.5 | Repair | Investigates and fixes acceptance failures, up to 3 iterations | Repair log |
50
+ | 8 | Watcher | Polls reviews, CI, and base-branch drift; re-enters the cycle on each | `followup.log` |
51
+
52
+ Stage 5.5 refuses to open the PR until build and unit tests meet the Definition of Done, and stage 7 refuses to settle its walkthrough without an E2E verdict. Stage 8 is dispatched only once stage 7.5 clears — a cycle with unrepaired failures never reaches a watcher.
53
+
54
+ ---
55
+
56
+ ## Quick start
57
+
58
+ ### 1. Install
59
+
60
+ **Claude Code** — full plugin: skills, MCP tools, and the browser runner.
61
+
62
+ ```
63
+ /plugin marketplace add multiplex-ai/muggle-ai-works
64
+ /plugin install muggleai@muggle-works
65
+ ```
66
+
67
+ The marketplace is `muggle-works` and its entry is `muggleai`; the installed plugin is named `muggle`, so its skills appear as `/muggle:<skill>`.
68
+
69
+ **Cursor** — `npm install -g @muggleai/works`. The postinstall writes `~/.cursor/mcp.json` and syncs the `muggle-*` skills into `~/.cursor/skills/`. Restart Cursor.
70
+
71
+ **Codex** — full plugin: skills, MCP tools, and the guardrail hooks.
72
+
73
+ ```
74
+ codex plugin marketplace add multiplex-ai/muggle-ai-works
75
+ codex plugin add muggle@muggle-works
76
+ ```
77
+
78
+ Restart Codex and trust the plugin's hooks when it asks (or later, in `/hooks`). Skills are invoked as `$muggle:<skill>` — `$muggle:muggle-do`, `$muggle:muggle-test` — or picked from `/skills`. See [Codex](#codex) for what differs.
79
+
80
+ **Windsurf, any other MCP client** — install the package as above, then register the server:
81
+
82
+ ```json
83
+ {
84
+ "mcpServers": {
85
+ "muggle": {
86
+ "command": "muggle",
87
+ "args": ["serve"],
88
+ "env": {
89
+ "MUGGLE_MCP_PROMPT_SERVICE_TARGET": "production"
90
+ }
91
+ }
92
+ }
93
+ }
94
+ ```
95
+
96
+ ### 2. Set up
97
+
98
+ ```bash
99
+ muggle init
100
+ ```
101
+
102
+ Explains how the harness works, saves your preferences, and offers to install the pull-request walkthrough check. Then confirm the install is healthy:
103
+
104
+ ```
105
+ /mstatus # Claude Code
106
+ $muggle:muggle-status # Codex
107
+ muggle doctor # anywhere — also checks the Codex plugin or MCP entry
108
+ ```
109
+
110
+ Broken? `/mrepair`, or `muggle setup --force`.
111
+
112
+ ### 3. Build something
113
+
114
+ ```
115
+ /mdo "Add a logout button to the header"
116
+ ```
117
+
118
+ ```
119
+ PRE-FLIGHT → repo: frontend · branch: users/me/logout-button · target: localhost:3000
120
+ REQUIREMENTS → Goal: logout button in header. AC: visible, ends session, redirects to /login.
121
+ BUILD → src/components/Header.tsx, src/hooks/useLogout.ts (+ unit tests)
122
+ IMPACT → affects "User Login" and "Session" flows
123
+ UNIT TESTS → 12/12 pass
124
+ ACCEPTANCE → 3/3 test cases pass · runId a1b2c3 · 14 screenshots
125
+ PULL REQUEST → #42 opened, walkthrough posted
126
+ WATCHER → armed on #42
127
+ ```
128
+
129
+ Authentication starts on the first protected call: a browser opens with a verification code, you sign in, and the call continues. Credentials persist in `~/.muggle-ai/`.
130
+
131
+ ---
132
+
133
+ ## Commands
134
+
135
+ Every skill has a short alias. Both spellings work in Claude Code. In Codex, mention the skill with `$`: `$muggle:muggle-do`, or the alias `$muggle:mdo`.
136
+
137
+ | Command | Alias | What it does |
138
+ | :------ | :---- | :----------- |
139
+ | `/muggle:muggle` | `/m` | Command router and menu |
140
+ | `/muggle:muggle-do` | `/mdo` | The full cycle: request → pull request |
141
+ | `/muggle:muggle-test` | `/mtest` | Change-driven acceptance testing on your diff, PR, or branch |
142
+ | `/muggle:muggle-test-feature-local` | `/mtestlocal` | Test one named flow against localhost |
143
+ | `/muggle:muggle-test-prepare` | `/mtestprep` | Verify and start the dev servers a run needs |
144
+ | `/muggle:muggle-test-import` | `/mimport` | Import Playwright, Cypress, Gherkin, or PRDs |
145
+ | `/muggle:muggle-test-regenerate-missing` | `/mregen` | Bulk-regenerate scripts for cases that have none |
146
+ | `/muggle:muggle-browser-task` | `/mbt` | Perform a real action on a website from plain English |
147
+ | `/muggle:muggle-pr-visual-walkthrough` | `/mpr` | Post screenshots and a pass/fail summary to a PR |
148
+ | `/muggle:muggle-pr-followup` | `/mprfollowup` | Watch a PR's reviews, CI, and base drift |
149
+ | `/muggle:muggle-feedback` | `/mfeedback` | Flag a generated script or step as wrong |
150
+ | `/muggle:muggle-bug-report` | `/mbugreport` | Report a bug in Muggle AI and follow the ticket |
151
+ | `/muggle:muggle-taste-profile` | `/mtaste` | Build, view, upload, or clear your taste profile |
152
+ | `/muggle:muggle-preferences` | `/mprefs` | View, set, or reset preferences |
153
+ | `/muggle:muggle-status` | `/mstatus` | Health check: runner, MCP server, auth |
154
+ | `/muggle:muggle-repair` | `/mrepair` | Diagnose and fix a broken install |
155
+ | `/muggle:muggle-upgrade` | `/mupgrade` | Update to the latest version |
156
+ | `/muggle:muggle-init` | `/minit` | Run the onboarding walkthrough |
157
+ | `/muggle:muggle-ci-install` | `/mci` | Add the walkthrough check to GitHub Actions |
158
+ | `/muggle:muggle-login` | `/mlogin` | Sign in, or switch accounts |
159
+ | `/muggle:muggle-logout` | `/mlogout` | Sign out |
160
+ | `/muggle:muggle-run-view` | `/mrun` | View a local run's steps and frames |
161
+ | `/muggle:muggle-cleanup` | `/mcleanup` | Remove old runner versions |
162
+ | `/muggle:muggle-register` | `/mregister` | Create a new account from the terminal |
163
+
164
+ ---
165
+
166
+ ## GitHub and GitLab
167
+
168
+ The harness resolves one provider token — `github` or `gitlab` — from the URL you passed or the `origin` remote, then picks the matching recipe set. GitHub goes through `gh`, GitLab through `glab`. Self-hosted GitLab resolves by matching the remote host against `glab`'s configured host, so `git.acme.com` works without configuration.
169
+
170
+ | Capability | GitHub | GitLab |
171
+ | :--------- | :----- | :----- |
172
+ | Open and update the change | Pull request | Merge request |
173
+ | Read review feedback | Review threads + line comments | Discussions + notes |
174
+ | Reply per comment, resolve threads | Yes | Yes |
175
+ | Read CI status and re-enter on red | Actions | Pipelines |
176
+ | Rebase onto a drifted base | Yes | Yes |
177
+ | Signed commits | Yes | Yes |
178
+
179
+ Nested GitLab namespaces of any depth are handled — the project path is everything before the `/-/` segment, never assumed to be two levels.
180
+
181
+ ### The pull-request walkthrough check
182
+
183
+ When a PR is opened from a session running this plugin, Muggle reserves a comment for the acceptance walkthrough and holds the turn open until it's settled. The comment moves through three stages, edited in place: **waiting for the E2E feasibility check**; then **E2E running — waiting for the report** or **E2E not feasible** with the reason; then the E2E report. A PR that changes only docs, tests, lint/format config, or CI config opens straight at its reason. A session that ends without a run or a reason leaves the comment at the stage it reached, and the check stays unsettled.
184
+
185
+ A PR opened any other way — the web UI, a teammate without the plugin — never passes through that session, so the same check also runs in GitHub Actions. It fails while the comment is still empty, and whenever the walkthrough reports a failed or inconclusive test case; the check's summary names each one with its failing step and a link to the run. While a new E2E run is underway on the PR, the check stays in progress until that run's walkthrough replaces the previous one. When the Muggle PR watcher sees it red, it repairs the cases, re-runs the whole suite, and re-settles the comment.
186
+
187
+ The `autoInstallCiWorkflow` preference, chosen during `muggle init`, decides whether Muggle adds the workflow itself: `always` installs it in the repository `muggle init` runs in and in any repository `/muggle-do` opens a PR from, `ask` (the default) asks first, `never` leaves CI alone. To add it to a repository by hand:
188
+
189
+ ```bash
190
+ muggle ci-install
191
+ ```
192
+
193
+ That writes `.github/workflows/muggle-walkthrough.yml`. Run again later, it replaces a copy an earlier release wrote with the current one, and leaves a copy you edited alone unless you pass `--force`; `muggle init` and `/muggle-do` do the same refresh on their own unless `autoInstallCiWorkflow` is `never`. To add it by hand instead:
194
+
195
+ <!-- muggle:ci-workflow-snippet -->
196
+ ```yaml
197
+ name: muggle-walkthrough
198
+
199
+ on:
200
+ pull_request:
201
+ types: [opened, synchronize, reopened, ready_for_review]
202
+ issue_comment:
203
+ types: [created, edited]
204
+
205
+ permissions:
206
+ contents: read
207
+ checks: write
208
+ pull-requests: write
209
+
210
+ concurrency:
211
+ group: muggle-walkthrough-${{ github.event.pull_request.number || github.event.issue.number }}
212
+ cancel-in-progress: false
213
+
214
+ jobs:
215
+ walkthrough-comment:
216
+ if: github.event_name == 'pull_request' || github.event.issue.pull_request
217
+ runs-on: ubuntu-latest
218
+ steps:
219
+ - name: Check the walkthrough comment
220
+ env:
221
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
222
+ run: npx -y -p @muggleai/works muggle pr-walkthrough-check --check-run
223
+ ```
224
+ <!-- /muggle:ci-workflow-snippet -->
225
+
226
+ Four things worth knowing:
227
+
228
+ - The verdict is published as a check run against the pull request's head commit, not as this job's own status. An `issue_comment` run executes against the default branch, and only a head-commit check reaches the pull request from there — which is what lets settling the comment turn the check green without a new push.
229
+ - GitHub reads the `issue_comment` trigger from the **default branch's** copy of the workflow, so comment-driven re-runs start working only once it is merged.
230
+ - Runs for one pull request queue rather than cancel. Settling the comment starts a run while the one checking the push may still be going, and cancelling that run would leave a cancelled job on the pull request — red beside a green check. An installed copy that still says `cancel-in-progress: true` shows exactly that; `muggle ci-install` updates it.
231
+ - On a pull request from a fork, `GITHUB_TOKEN` is read-only and the check run cannot be published. The command fails open and reports nothing rather than blocking the pull request.
232
+
233
+ ---
234
+
235
+ ## Architecture
236
+
237
+ Test management lives in the cloud; execution is local and stateless. `muggle-remote-*` tools own projects, use cases, test cases, and scripts. `muggle-local-*` tools receive what they need and run the browser — so a local run never waits on cloud replay capacity.
238
+
239
+ ### Entity model
240
+
241
+ ```
242
+ Project ("My App")
243
+ └── Use Case ("User Login Flow")
244
+ └── Test Case ("Login with valid credentials")
245
+ └── Test Script (recorded browser steps)
246
+ └── Run Result (pass/fail + screenshots)
247
+ ```
248
+
249
+ ### Execution flow
250
+
251
+ ```
252
+ Your agent describes what to test
253
+ │
254
+ ▼
255
+ muggle-remote-* create or find the test cases
256
+ │
257
+ ▼
258
+ muggle-local-execute-test-generation launches the browser runner
259
+ │
260
+ ▼
261
+ An agent drives the browser step by step (click, type, navigate, assert)
262
+ │
263
+ ▼
264
+ Per-step screenshots → action-script.json recorded
265
+ │
266
+ ▼
267
+ Results at ~/.muggle-ai/sessions/{runId}/ — published during the run,
268
+ so the result carries a viewUrl straight to the dashboard
269
+ ```
270
+
271
+ ### Data directory
272
+
273
+ ```
274
+ ~/.muggle-ai/
275
+ ├── oauth-session.json # OAuth tokens (short-lived, auto-refresh)
276
+ ├── api-key.json # Long-lived key for service calls
277
+ ├── projects/ # Local project cache
278
+ ├── sessions/ # Run sessions — read one with `muggle run-view [runId]`
279
+ │ └── {runId}/
280
+ │ ├── action-script.json # Recorded browser steps
281
+ │ ├── results.md # Step-by-step report
282
+ │ └── electron-runtime/screenshot/ # Per-step images
283
+ ├── muggle-do/sessions/ # Cycle state, iterations, PR watchers
284
+ └── electron-app/{version}/
285
+ ```
286
+
287
+ ---
288
+
289
+ ## MCP tool reference
290
+
291
+ 130 tools across authentication, projects, use cases, test cases, test states, scripts, workflows, local execution, reporting, secrets, pricing, billing, and administration. Call them directly from any MCP client to build your own pipeline.
292
+
293
+ **Authentication** — `muggle-remote-auth-status`, `-login`, `-poll`, `-logout`, `-register` (create an account from an email and password, no browser), plus `-api-key-create`, `-list`, `-get`, `-revoke`.
294
+
295
+ **Projects** — `muggle-remote-organization-list` names the organizations an `organizationId` can make a project belong to. `muggle-remote-project-create`, `-list`, `-get`, `-update`, `-delete`, plus per-project rollups: `-test-results-summary-get`, `-test-runs-summary-get`, `-test-scripts-summary-get`. Pass `primaryResolution`, `compatibleResolutions` and `runStrategy` (`primaryOnly`, the default, `primaryFirst` or `allAtOnce`) to `-create` or `-update` to verify every test case at more than one viewport; `muggle-remote-project-display-resolutions-get` reads a lane's primary, compatible and enabled resolutions and its run strategy.
296
+
297
+ | Use cases | Purpose |
298
+ | :-------- | :------ |
299
+ | `muggle-remote-use-case-list` / `-get` | Read use cases |
300
+ | `muggle-remote-use-case-create` / `-update` | Persist a fully-specified use case (no LLM) |
301
+ | `muggle-remote-use-case-create-from-prompts` | Create from natural language |
302
+ | `muggle-remote-use-case-prompt-preview` | Preview before creating |
303
+ | `muggle-remote-use-case-update-from-prompt` | Regenerate from a new prompt |
304
+ | `muggle-remote-use-case-discovery-memory-get` | Candidates a site scan discovered |
305
+ | `muggle-remote-use-case-candidates-approve` | Approve discovered candidates |
306
+ | `muggle-remote-use-case-bulk-preview-submit` | Async batch preview (~50% cheaper) |
307
+ | `muggle-remote-use-case-delete` | Delete (cascades to test cases + scripts) |
308
+
309
+ | Test cases | Purpose |
310
+ | :--------- | :------ |
311
+ | `muggle-remote-test-case-list` / `-list-by-use-case` / `-get` | Read test cases |
312
+ | `muggle-remote-test-case-create` / `-update` / `-delete` | Manage test cases |
313
+ | `muggle-remote-test-case-generate-from-prompt` | Generate from a prompt |
314
+ | `muggle-remote-test-case-ancestors-get` | Walk prerequisite chains |
315
+ | `muggle-remote-run-settings-list` | A test case's runSettings records in one lane |
316
+ | `muggle-remote-test-case-display-resolutions-get` | The resolutions a test case runs at in one lane, primary first |
317
+ | `muggle-remote-test-case-display-resolutions-update` | Set the resolutions a test case is generated and run at in one lane |
318
+ | `muggle-remote-fan-out-plan` | A lane's records in start order, and whether the rest wait on the primary |
319
+ | `muggle-remote-test-case-bulk-preview-submit` | Async batch preview (~50% cheaper) |
320
+ | `muggle-remote-test-plan-graph-rebuild` | Rebuild the prerequisite graph |
321
+
322
+ | Test states | Purpose |
323
+ | :---------- | :------ |
324
+ | `muggle-remote-test-chaining-catalog-get` / `-settings-update` | Read a project's states and roles; set its fresh account set state and parallel account set limit |
325
+ | `muggle-remote-test-state-create` / `-update` / `-delete` | Manage states: facts about one account set's data, plus a check |
326
+ | `muggle-remote-test-role-create` / `-update` / `-delete` | Manage roles: created or supplied accounts a test acts as |
327
+ | `muggle-remote-test-chaining-plan-get` | Preview the account set plan without running anything |
328
+
329
+ Bulk-preview submissions return a `jobId` immediately. Poll `muggle-remote-bulk-preview-job-get` until terminal, then persist with the matching `-create` tool. `-list` and `-cancel` round out the set.
330
+
331
+ | Scripts and workflows | Purpose |
332
+ | :-------------------- | :------ |
333
+ | `muggle-remote-test-script-list` / `-get` / `-delete` | Manage test scripts |
334
+ | `muggle-remote-action-script-get` / `-delete` | Manage recorded action scripts |
335
+ | `muggle-remote-workflow-start-website-scan` | Scan a site for use cases |
336
+ | `muggle-remote-workflow-start-test-case-detection` | Generate test cases |
337
+ | `muggle-remote-workflow-start-test-script-generation` | Generate a script |
338
+ | `muggle-remote-workflow-start-test-script-generation-bulk` | Generate in bulk |
339
+ | `muggle-remote-workflow-start-test-script-replay` | Replay one script |
340
+ | `muggle-remote-workflow-start-test-script-replay-bulk` | Batch replay |
341
+ | `muggle-remote-workflow-start-prd-file-process` | Turn an uploaded requirements doc into use cases |
342
+ | `muggle-remote-workflow-cancel-run` / `-cancel-runtime` | Cancel in flight |
343
+ | `muggle-remote-workflow-get-website-scan-latest-run`, `muggle-remote-wf-get-*` | Poll the latest run of each workflow type |
344
+ | `muggle-remote-workflow-list-website-scan-runtimes`, `muggle-remote-wf-list-*` | List a workflow type's runtimes |
345
+
346
+ | Local execution | Purpose |
347
+ | :-------------- | :------ |
348
+ | `muggle-local-check-status` | Browser runner status |
349
+ | `muggle-local-list-sessions` | Stored local run sessions |
350
+ | `muggle-local-execute-test-generation` | Generate a script by driving the browser |
351
+ | `muggle-local-execute-replay` | Replay an existing script |
352
+ | `muggle-local-cancel-execution` | Cancel the active run |
353
+ | `muggle-local-run-result-list` / `-get` | Results, screenshots, and cloud refs (`viewUrl`) |
354
+ | `muggle-local-run-steps-get` | A run's ordered steps beside the frame each produced |
355
+ | `muggle-local-test-script-list` / `-get` | Read locally cached scripts |
356
+ | `muggle-local-last-host-*` / `-last-project-*` | Remember the host and project between runs |
357
+ | `muggle-local-preferences-set` | Set harness preferences |
358
+ | `muggle-local-telemetry-skill-emit` / `-event-emit` | Usage telemetry the skills record |
359
+ | `muggle-remote-local-run-upload` | Publish a local run to the cloud |
360
+
361
+ **Pricing and billing** — `muggle-remote-pricing-get` reads the live plans, token price and token packages without sign-in. `muggle-remote-wallet-package-list` lists the packages the signed-in user can buy, with the `packageId` that `muggle-remote-wallet-topup` and `-wallet-auto-topup-update` take.
362
+
363
+ **Reporting** — `muggle-remote-report-stats-summary-get`, `-cost-query`, `-final-generate` (PDF/HTML/Markdown), `-preferences-upsert`.
364
+
365
+ **Administration** — `muggle-remote-prd-file-*` (upload, list and delete requirements docs), `muggle-remote-secret-*` (credentials for test environments, with `-secret-group-*` and `-secret-type-list`), `muggle-remote-wallet-*` (top-ups, payment methods, auto-topup), `muggle-remote-recommend-cicd-setup` / `-recommend-schedule`, `muggle-remote-user-feedback-*`, `muggle-remote-bug-report-*` (file, list, read and reply to bug reports about Muggle AI, with `muggle-local-bug-report-context-get` gathering the harness context they carry), `muggle-remote-taste-profile-*` (upload, get and delete the taste profile, kept locally by `muggle-local-taste-signal-*` and `muggle-local-taste-profile-*`).
366
+
367
+ **Resources** — `muggle://docs/agents` ([AGENTS.md](AGENTS.md)) and `muggle://docs/llms` ([llms.txt](llms.txt)), read from the installed package through `resources/list` and `resources/read`.
368
+
369
+ ---
370
+
371
+ ## CLI reference
372
+
373
+ ```bash
374
+ # Server
375
+ muggle serve # Start the MCP server with all tools
376
+ muggle serve --e2e # Cloud tools only (muggle-remote-*)
377
+ muggle serve --local # Local tools only (muggle-local-*)
378
+
379
+ # Setup and diagnostics
380
+ muggle init [--json | --apply <file>] # Guided setup; saves preferences, offers the CI check
381
+ muggle llm-source [--show] # Who supplies the model for local runs: Muggle AI credit, your Anthropic key, a local model, or your Claude Code
382
+ muggle llm-source --use <source> [--base-url <url> --model <name>] # Set it without prompting
383
+ muggle setup [--force] # Download or update the browser runner
384
+ muggle upgrade [--check | --version <v>] [--force] # Install the latest (or a given) runner version
385
+ muggle versions # List installed runner versions
386
+ muggle cleanup [--dry-run] [--all] [--skills] # Remove old versions and obsolete skills
387
+ muggle doctor # Diagnose installation problems
388
+
389
+ # Inspecting runs
390
+ muggle run-view [runId] # A run's steps beside the frames they produced (newest run by default)
391
+ muggle run-view --html [--out-dir <dir>] # Render those frames as a self-contained page
392
+ muggle run-view --open # Render it and open it in the browser
393
+ muggle checkout-freshness [--base <branch>] [--no-fetch] # Fetch the base and check this checkout is built on its latest commit
394
+
395
+ # Authentication
396
+ muggle login [--key-name <name>] [--key-expiry 30d|90d|1y|never]
397
+ muggle logout
398
+ muggle status
399
+
400
+ # Pricing
401
+ muggle pricing [--json] # Plans, token price and token packages from the live catalog
402
+
403
+ # Pull requests
404
+ muggle ci-install [--force] # Add or update the walkthrough check in GitHub Actions
405
+ muggle pr-walkthrough-check [--pr <n>] [--check-run] # Verify a PR's walkthrough comment is settled
406
+ muggle build-pr-section [--base <branch>] # Render a PR evidence block from a report on stdin
407
+ muggle e2e-plan [--pr <url>] # Post the test cases a local run is about to execute (JSON on stdin) to the walkthrough
408
+
409
+ # Shared local services, between agents in different checkouts
410
+ muggle stack claim [--wait <seconds>] # Claim the ports this checkout's E2E run needs
411
+ muggle stack check [--port <port>] # Confirm the stack still serves this checkout's claim
412
+ muggle stack release # Give up the lease and place in line
413
+ muggle stack status # Every lease, the line, and tracked services
414
+
415
+ # Session and PR-watcher supervision
416
+ muggle watch install [--uninstall] # Schedule the watch with the OS scheduler
417
+ muggle watch tick # Run one watch pass
418
+ muggle watch status # Last pass: sessions, processes, PR watches, findings
419
+ muggle watch reload-plugins [--dry-run] # Reload plugins across active Claude sessions
420
+ muggle watch register --slot <dir> # Opt a PR-watch slot into out-of-session recovery
421
+ muggle watch unregister --slot <dir> # Withdraw it
422
+
423
+ muggle --version
424
+ muggle --help
425
+ ```
426
+
427
+ ---
428
+
429
+ ## Configuration
430
+
431
+ **Environment targeting.** Set `MUGGLE_MCP_PROMPT_SERVICE_TARGET` (`production` or `dev`) in the MCP server's `env` block — in Codex, export it in your shell; the plugin forwards it. Mismatching it against the account you log in with is the usual cause of `unauthorized_client`.
432
+
433
+ **Multi-repo cycles.** Drop a `muggle-repos.json` in your working directory so a single request can span services:
434
+
435
+ ```json
436
+ [
437
+ { "name": "frontend", "path": "/absolute/path/to/frontend", "testCommand": "pnpm test" },
438
+ { "name": "backend", "path": "/absolute/path/to/backend", "testCommand": "pnpm test" }
439
+ ]
440
+ ```
441
+
442
+ **Preferences.** `/mprefs` (or `muggle init`) controls the gates — whether to use a worktree, rebase onto the base branch, run acceptance tests every cycle, open the PR automatically, and arm the watcher. Each gate takes `always`, `ask`, or `never`.
443
+
444
+ When installed as a Claude Code plugin, MCP configuration ships with the plugin (`plugin/.mcp.json`; Codex reads `plugin/.codex-mcp.json`) — there is nothing to copy by hand.
445
+
446
+ ---
447
+
448
+ ## Client support
449
+
450
+ | Client | MCP tools | Skills | Guardrail hooks |
451
+ | :----- | :-------- | :----- | :-------------- |
452
+ | **Claude Code** | Yes | Yes — slash commands | Yes |
453
+ | **Codex** | Yes | Yes — `$muggle:<skill>` | Yes, once trusted |
454
+ | **Cursor** | Yes, auto-configured | Synced to `~/.cursor/skills/` | Advisory |
455
+ | **Windsurf, others** | Yes, via MCP config | No | No |
456
+
457
+ Slash commands are plugin-managed; update them with `/plugin update muggleai@muggle-works` (Claude Code) or `codex plugin marketplace upgrade muggle-works` (Codex).
458
+
459
+ ### Codex
460
+
461
+ The Codex plugin ships the same skills, MCP server, and hooks as the Claude Code one, with what Codex needs written in rather than left to defaults:
462
+
463
+ - **Long local runs.** Codex cancels an MCP call after 60 seconds unless told otherwise, and a local browser run takes minutes. The plugin's server allows 30 minutes per call and two minutes to start.
464
+ - **Your environment.** Codex starts MCP servers with only `HOME`, `PATH` and the locale. The plugin forwards what the server reads — `MUGGLE_MCP_PROMPT_SERVICE_TARGET`, the `AUTH0_*` and service-URL overrides, `HTTPS_PROXY`/`NO_PROXY`, and on Linux the display variables the browser runner needs.
465
+ - **Claude Code tools in the skills.** Codex has no `AskUserQuestion`, `Skill` tool, or background monitor. Each skill points at [`_shared/host-tool-equivalents.md`](plugin/skills/_shared/host-tool-equivalents.md), which maps them to Codex, and the session-start hook names it too.
466
+ - **PR watching.** Codex cannot wake a session when a reviewer comments, so `$muggle:muggle-pr-followup` handles what is outstanding each time you run it rather than watching in the background.
467
+ - **Sandbox.** Codex's default sandbox blocks the network and writes outside the workspace, so `gh`/`glab` and state under `~/.muggle-ai/` ask for approval. To stop the prompts, allow both in `~/.codex/config.toml`:
468
+
469
+ ```toml
470
+ [sandbox_workspace_write]
471
+ network_access = true
472
+ writable_roots = ["/absolute/path/to/home/.muggle-ai"]
473
+ ```
474
+ - **Headless runs.** `codex exec` cannot ask you anything. It refuses every muggle MCP call ("requires approval, but approval policy is never"), and it runs only hooks you have already trusted. Trust the hooks once in the TUI (`/hooks`), and approve the muggle tools in `~/.codex/config.toml`:
475
+
476
+ ```toml
477
+ [plugins."muggle@muggle-works".mcp_servers.muggle]
478
+ default_tools_approval_mode = "approve"
479
+ ```
480
+
481
+ `--dangerously-bypass-hook-trust` skips the trust step for one run. It is meant for automation that already vets hook sources.
482
+
483
+ Registering only the MCP server, without the plugin? Keep the timeout, or local runs are cut off at a minute:
484
+
485
+ ```toml
486
+ [mcp_servers.muggle]
487
+ command = "muggle"
488
+ args = ["serve"]
489
+ tool_timeout_sec = 1800
490
+ startup_timeout_sec = 120
491
+ env_vars = ["MUGGLE_MCP_PROMPT_SERVICE_TARGET"]
492
+ ```
493
+
494
+ `muggle doctor` checks whichever of the two you set up.
495
+
496
+ ---
497
+
498
+ ## Troubleshooting
499
+
500
+ **`unauthorized_client` during login** — the MCP server is pointed at one environment and you're authenticating against another. Fix `MUGGLE_MCP_PROMPT_SERVICE_TARGET` and restart the client.
501
+
502
+ **Browser runner not found**
503
+
504
+ ```bash
505
+ muggle setup --force
506
+ muggle doctor
507
+ ```
508
+
509
+ **Authentication keeps expiring**
510
+
511
+ ```bash
512
+ muggle logout
513
+ rm ~/.muggle-ai/oauth-session.json ~/.muggle-ai/api-key.json
514
+ muggle login
515
+ ```
516
+
517
+ ---
518
+
519
+ ## The ecosystem
520
+
521
+ | Package | Purpose | Install |
522
+ | :------ | :------ | :------ |
523
+ | **Muggle Works** (this repo) | Delivery-cycle harness, MCP server, acceptance testing | `/plugin install muggleai@muggle-works` · `codex plugin add muggle@muggle-works` |
524
+ | **[muggle-ai-teams](https://github.com/multiplex-ai/muggle-ai-teams)** | Agent orchestration, workflow steps, rules | `npm install @muggleai/teams` |
525
+
526
+ With both installed, muggle-ai-teams folds acceptance testing into each workflow step: test instructions written per slice at **Plan**, per-slice browser tests at **Build**, a full regression sweep at **Verify**, and results published and linked in the PR at **Ship**. Frontend slices get browser tests; backend-only slices are covered by unit tests, with the skip reasoned in writing.
527
+
528
+ Want it hosted, with nothing to configure? [Muggle AI](https://www.muggle-ai.com).
529
+
530
+ ---
531
+
532
+ ## Contributing
533
+
534
+ ```bash
535
+ pnpm install # This repo is pnpm-only
536
+ pnpm run build # tsup + plugin artifact
537
+ pnpm test # Tests impacted since origin/master, on 25% of cores (full suite in CI; MUGGLE_VITEST_FULL=1 forces it locally)
538
+ pnpm run lint # Lint (auto-fix)
539
+ pnpm run typecheck # Type check
540
+ pnpm run dev # Watch mode
541
+ ```
542
+
543
+ Verification gates, all run in CI:
544
+
545
+ ```bash
546
+ pnpm run verify:plugin # Plugin and marketplace metadata agree
547
+ pnpm run verify:contracts # CLI/MCP/plugin/skill surface contracts hold
548
+ pnpm run verify:skill-deps # Skill dependencies stay one-way
549
+ pnpm run verify:signatures # Shipped artifacts are signed
550
+ pnpm run verify:upgrade-experience # Existing-user upgrade still works
551
+ pnpm run verify:electron-release-checksums
552
+ ```
553
+
554
+ Codex has its own layers, from static contracts up to model-driven evals. See [docs/compatibility-strategy.md](docs/compatibility-strategy.md#codex):
555
+
556
+ ```bash
557
+ CODEX_BIN=$(command -v codex) pnpm run test:codex # The plugin under the real Codex CLI, against a scripted model
558
+ ```
559
+
560
+ ### Repository layout
561
+
562
+ ```
563
+ muggle-ai-works/
564
+ ├── plugin/ # Claude Code, Codex and Cursor plugin — source of truth
565
+ │ ├── skills/ # Skill definitions (muggle-do, muggle-test, _shared/vcs, …)
566
+ │ ├── hooks/ # Session hooks (codex-hooks.json is generated from hooks.json)
567
+ │ ├── .mcp.json # MCP server config
568
+ │ ├── .codex-mcp.json # The same server, with Codex's timeouts and env passthrough
569
+ │ └── .codex-plugin/ # Codex manifest
570
+ ├── src/
571
+ │ ├── cli/ # CLI entrypoint
572
+ │ └── server/ # MCP server — tool registration, stdio transport
573
+ ├── packages/
574
+ │ ├── mcps/ # Tool registries, schemas, services
575
+ │ ├── commands/ # CLI command contracts
576
+ │ └── workflows/ # Workflow contracts
577
+ ├── scripts/ # Build, verification, postinstall
578
+ ├── config/compatibility/ # Surface contract baselines
579
+ ├── internal/ # Maintainer-only skills (not published)
580
+ ├── .claude-plugin/ # Marketplace catalog (Claude Code)
581
+ └── .agents/plugins/ # Marketplace catalog (Codex)
582
+ ```
583
+
584
+ ### Releases
585
+
586
+ | Workflow | Trigger | What it does |
587
+ | :------- | :------ | :----------- |
588
+ | `ci.yml` | Push/PR to `master` | Lint, test, build, contract verification across platforms |
589
+ | `verify-end-user-upgrade.yml` | Weekly + manual | Existing-user upgrade validation |
590
+ | `publish-works-to-npm.yml` | Tag `v*` or manual | Verify, audit, smoke-install, publish |
591
+
592
+ Two independent tag tracks: `vX.Y.Z` publishes `@muggleai/works` to npm; `electron-app-vX.Y.Z` publishes browser-runner binaries consumed by `muggle setup` and `muggle upgrade`.
593
+
594
+ Maintainers cut releases with the repo-local `/mrelease` skill rather than tagging by hand — CI can otherwise publish a version that disagrees with the checked-in manifests.
595
+
596
+ Agents pick tools by reading descriptions, so that text is tuned deliberately rather than written once. `internal/skills/optimize-descriptions/SKILL.md` documents the five layers of agent-facing text, where each lives, and how to build and run trigger eval sets against them. It is maintainer-only and ships in neither the npm package nor the plugin.
597
+
598
+ ---
599
+
600
+ ## License
601
+
602
+ [Apache 2.0](LICENSE). Use it, fork it, make it yours.
603
+
604
+ If it saves you a bad merge, a star helps others find it.